diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4e194e72..75a575de 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -3,7 +3,7 @@ run-name: ${{ github.actor }} is triggering on GitHub Actions 🚀 on: [push] jobs: Build-test-freebsd: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 name: Build and Test in FreeBSD steps: - uses: actions/checkout@master @@ -16,12 +16,12 @@ jobs: release: "15.0" usesh: true prepare: | - pkg install -y go pkgconf libX11 libXtst gtk3 + pkg install -y go pkgconf libX11 libXtst gtk4 run: | make test && make build Build-test-nix-flake: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v27 @@ -31,12 +31,12 @@ jobs: run: nix develop Releaser: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@master with: fetch-depth: 1 - - run: sudo apt-get update && sudo apt-get install -y make libibus-1.0-dev libx11-dev libxtst-dev libgtk-3-dev osc + - run: sudo apt-get update && sudo apt-get install -y make pkgconf libibus-1.0-dev libx11-dev libxtst-dev osc libgtk-4-dev libglib2.0-dev gobject-introspection - run: make test && make build - shell: bash env: diff --git a/config/config.go b/config/config.go index 58fe0504..268bf48e 100644 --- a/config/config.go +++ b/config/config.go @@ -15,6 +15,7 @@ const ( configFile = "%s/ibus-%s.config.json" mactabFile = "%s/ibus-%s.macro.text" sampleMactabFile = "data/macro.tpl.txt" + APP_ID = "ibus-bamboo.ui-shortcut-options" ) type Config struct { diff --git a/engine.go b/engine.go index e5bff2f9..4c68722b 100644 --- a/engine.go +++ b/engine.go @@ -22,6 +22,7 @@ package main import ( "fmt" "log" + "os" "os/exec" "reflect" "strconv" @@ -29,6 +30,8 @@ import ( "github.com/BambooEngine/bamboo-core" ibus "github.com/BambooEngine/goibus" + "github.com/diamondburned/gotk4/pkg/gio/v2" + "github.com/diamondburned/gotk4/pkg/gtk/v4" "github.com/godbus/dbus/v5" "ibus-bamboo/config" @@ -62,15 +65,26 @@ type IBusBambooEngine struct { shouldRestoreKeyStrokes bool // enqueue key strokes to process later shouldEnqueuKeyStrokes bool + // UI shortcut options + appShortcutOptions *gtk.Application + windowShortcutOptions *gtk.ApplicationWindow } func NewIbusBambooEngine(name string, cfg *config.Config, base IEngine, preeditor bamboo.IEngine) *IBusBambooEngine { - return &IBusBambooEngine{ + engine := &IBusBambooEngine{ engineName: name, IEngine: base, preeditor: preeditor, config: cfg, } + engine.appShortcutOptions = gtk.NewApplication(config.APP_ID, gio.ApplicationDefaultFlags) + + engine.appShortcutOptions.ConnectActivate(func() { + engine.activateUIOptions() + }) + _ = engine.appShortcutOptions.Run(os.Args) + + return engine } /* @@ -267,17 +281,20 @@ func (e *IBusBambooEngine) PropertyActivate(propName string, propState uint32) * return nil } if propName == PropKeyConfiguration { - ui.OpenGUI(e.engineName) + //ui.OpenGUI(e.engineName) + e.ShowUIOptions() e.config = config.LoadConfig(e.engineName) return nil } if propName == PropKeyInputModeLookupTableShortcut { - ui.OpenGUI(e.engineName) + //ui.OpenGUI(e.engineName) + e.ShowUIOptions() e.config = config.LoadConfig(e.engineName) return nil } if propName == PropKeyMacroTable { - ui.OpenGUI(e.engineName) + //ui.OpenGUI(e.engineName) + e.ShowUIOptions() e.config = config.LoadConfig(e.engineName) return nil } @@ -399,3 +416,37 @@ func (e *IBusBambooEngine) PropertyActivate(propName string, propState uint32) * e.RegisterProperties(e.propList) return nil } + +/* UI Shortcut Options */ +func (e *IBusBambooEngine) activateUIOptions() { + // Main app + e.windowShortcutOptions = gtk.NewApplicationWindow(e.appShortcutOptions) + e.windowShortcutOptions.SetTitle("ibus-bamboo shortcut options") + e.windowShortcutOptions.SetDecorated(true) + e.windowShortcutOptions.SetDefaultSize(600, 300) + + // Tabs Notebook + notebook := gtk.NewNotebook() + notebook.AppendPage(ui.RenderShortcut(e.windowShortcutOptions), gtk.NewLabel("Phím tắt")) + notebook.AppendPage(ui.RenderInputTextView(), gtk.NewLabel("Gõ tắt")) + notebook.AppendPage(ui.RenderInputTextView(), gtk.NewLabel("Tự định nghĩa kiểu gõ")) + notebook.AppendPage(ui.RenderOther(e.windowShortcutOptions), gtk.NewLabel("Khác")) + e.windowShortcutOptions.SetChild(notebook) + + e.windowShortcutOptions.ConnectCloseRequest(func() bool { + e.windowShortcutOptions.SetVisible(false) + return true + }) +} + +func (e *IBusBambooEngine) ShowUIOptions() { + if e.windowShortcutOptions != nil { + e.windowShortcutOptions.SetVisible(true) + } +} + +func (e *IBusBambooEngine) HideUIOptions() { + if e.windowShortcutOptions != nil { + e.windowShortcutOptions.SetVisible(false) + } +} diff --git a/engine_utils.go b/engine_utils.go index f7a583c4..03e7c8dc 100644 --- a/engine_utils.go +++ b/engine_utils.go @@ -22,7 +22,7 @@ package main import ( "fmt" "ibus-bamboo/config" - "ibus-bamboo/ui" + _ "ibus-bamboo/ui" "io/ioutil" "os" "strconv" @@ -57,7 +57,8 @@ func GetIBusEngineCreator() func(*dbus.Conn, string) dbus.ObjectPath { engine.shouldEnqueuKeyStrokes = true ibus.PublishEngine(conn, objectPath, engine) if *gui { - ui.OpenGUI(engine.engineName) + //ui.OpenGUI(engine.engineName) + engine.ShowUIOptions() os.Exit(0) } go engine.init() diff --git a/flake.nix b/flake.nix index 1f387034..6d70816d 100644 --- a/flake.nix +++ b/flake.nix @@ -29,12 +29,19 @@ nativeBuildInputs = [ pkgs.pkg-config - pkgs.wrapGAppsHook3 - pkgs.go + pkgs.wrapGAppsHook + pkgs.git ]; buildInputs = [ + pkgs.go pkgs.xorg.libXtst + pkgs.gtk4 + pkgs.glib + pkgs.librsvg + pkgs.gdk-pixbuf + pkgs.gobject-introspection + pkgs.hicolor-icon-theme ]; preConfigure = '' @@ -63,10 +70,15 @@ pkgs.pkg-config pkgs.wrapGAppsHook3 pkgs.go + pkgs.gopls ]; buildInputs = [ pkgs.xorg.libXtst + pkgs.gtk4 + pkgs.graphene + pkgs.glib + pkgs.gobject-introspection ]; }; } diff --git a/go.mod b/go.mod index 75c2c74e..1519a8ee 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,20 @@ module ibus-bamboo -go 1.13 +go 1.23.0 + +toolchain go1.23.4 require ( github.com/BambooEngine/bamboo-core v0.0.0-20240916131919-b2e49a2b48c7 github.com/BambooEngine/goibus v0.0.0-20240724150421-cfe61b2f8f77 + github.com/diamondburned/gotk4/pkg v0.3.1 github.com/dkolbly/wl v0.0.0-20180220001605-b06f57e7e2e6 github.com/godbus/dbus/v5 v5.1.0 golang.org/x/net v0.36.0 ) + +require ( + github.com/KarpelesLab/weak v0.1.1 // indirect + go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 // indirect + golang.org/x/sync v0.1.0 // indirect +) diff --git a/go.sum b/go.sum index e633c280..61515c53 100644 --- a/go.sum +++ b/go.sum @@ -2,73 +2,17 @@ github.com/BambooEngine/bamboo-core v0.0.0-20240916131919-b2e49a2b48c7 h1:sXj2Uz github.com/BambooEngine/bamboo-core v0.0.0-20240916131919-b2e49a2b48c7/go.mod h1:OxsVN3QJM/OrAVsnsSrSTC2SOudVOrb0vTw1dJrcOK4= github.com/BambooEngine/goibus v0.0.0-20240724150421-cfe61b2f8f77 h1:gCwm/sU1uaaUJe3E93CNigsKaX9dneiNhx+ElKrD0fM= github.com/BambooEngine/goibus v0.0.0-20240724150421-cfe61b2f8f77/go.mod h1:6VXFP/0WXorUWDU7y9Ejyg6GGCflBuNvWPBmfI3k2s4= +github.com/KarpelesLab/weak v0.1.1 h1:fNnlPo3aypS9tBzoEQluY13XyUfd/eWaSE/vMvo9s4g= +github.com/KarpelesLab/weak v0.1.1/go.mod h1:pzXsWs5f2bf+fpgHayTlBE1qJpO3MpJKo5sRaLu1XNw= +github.com/diamondburned/gotk4/pkg v0.3.1 h1:uhkXSUPUsCyz3yujdvl7DSN8jiLS2BgNTQE95hk6ygg= +github.com/diamondburned/gotk4/pkg v0.3.1/go.mod h1:DqeOW+MxSZFg9OO+esk4JgQk0TiUJJUBfMltKhG+ub4= github.com/dkolbly/wl v0.0.0-20180220001605-b06f57e7e2e6 h1:boaySJl2jhPwf+lSBRugRERVEZ0ovAwppOBx73P6zoM= github.com/dkolbly/wl v0.0.0-20180220001605-b06f57e7e2e6/go.mod h1:fUuzU55URBTyjoKP2pYoAoeZd1SvdjJP4IkYoT21xZg= github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= -golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= -golang.org/x/crypto v0.35.0/go.mod h1:dy7dXNW32cAb/6/PRuTNsix8T+vJAqvuIy5Bli/x0YQ= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= -golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 h1:lGdhQUN/cnWdSH3291CUuxSEqc+AsGTiDxPP3r2J0l4= +go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E= golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA= golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= -golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= -golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= -golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= -golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/ui/keyboard-shortcut-editor.c b/ui/keyboard-shortcut-editor.c deleted file mode 100644 index c29cc553..00000000 --- a/ui/keyboard-shortcut-editor.c +++ /dev/null @@ -1,533 +0,0 @@ -#include -#include -#include "_cgo_export.h" - -#define TOTAL_ROWS 5 -#define TOTAL_MASKS_PER_ROW 4 -#define IBworkaroundForFBMessenger 1<<19 -#define IBworkaroundForWPS 1<<20 - -int row = 0; -int col = 0; -const int KEYVAL = 1; -const int MASK = 0; -guint32 *key_pairs_tmp; -char *input_mode_alert = "Ibus-bamboo cung cấp nhiều chế độ gõ khác nhau (1 chế độ gõ có gạch chân và 5 chế độ gõ không gạch chân; tránh nhầm lẫn chế độ gõ với kiểu gõ, các kiểu gõ bao gồm telex, vni, ...).\n\n\ -Một số lưu ý:\n\ -- Một ứng dụng có thể hoạt động tốt với chế độ gõ này trong khi không hoạt động tốt với chế độ gõ khác.\n\ -- Các chế độ gõ được lưu riêng biệt cho mỗi phần mềm (firefox có thể đang dùng chế độ 3, trong khi libreoffice thì lại dùng chế độ 2).\n\ -- Bạn có thể dùng chế độ Thêm vào danh sách loại trừ để không gõ tiếng Việt trong một chương trình nào đó.\n\ -- Để gõ ký tự ~ hãy nhấn tổ hợp Shift+~ 2 lần."; -char *fix_fb_alert = "Bật tùy chọn này nếu bạn gặp tình trạng lặp chữ khi chat trong Facebook, Messenger.\n\ -Lưu ý: Tính năng này có thể khiến thanh địa chỉ trên trình duyệt Google Chrome hoạt động không chính xác."; -char *labels[TOTAL_MASKS_PER_ROW] = {"Ctrl", "Alt", "Shift", "Super"}; -int masks[TOTAL_MASKS_PER_ROW] = {GDK_CONTROL_MASK, GDK_MOD1_MASK, GDK_SHIFT_MASK, - GDK_SUPER_MASK}; -int keyvals[TOTAL_MASKS_PER_ROW] = {GDK_KEY_Control_L, GDK_KEY_Alt_L, GDK_KEY_Shift_L, - GDK_KEY_Super_L}; -char *text_arr[TOTAL_ROWS] = {"Chuyển chế độ gõ", "Khôi phục phím", - "Tạm tắt bộ gõ", "Emoji", "Hexadecimal"}; -GtkWidget *maskWidgets[TOTAL_MASKS_PER_ROW * TOTAL_ROWS]; -GtkWidget *keyWidgets[TOTAL_ROWS]; -int usIM = 0; - -/* - * Destroy - * - * Close down the application - */ -gint close_window_cb(GtkWidget *widget, gpointer *dialog) { - if (GTK_IS_WIDGET(dialog)) { - gtk_widget_destroy(GTK_WIDGET(dialog)); - } else if (GTK_IS_WIDGET(widget)) { - gtk_widget_destroy(GTK_WIDGET(widget)); - } - gtk_main_quit(); - return FALSE; -} - -gint btn_reset_cb(GtkWidget *widget, gpointer *data) { - for (int i = 0 ; i < TOTAL_ROWS * 2; i++ ){ - key_pairs_tmp[i] = 0; - } - for (int i=0 ; i < TOTAL_ROWS * TOTAL_MASKS_PER_ROW ; i++) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(maskWidgets[i]), FALSE); - } - for (int i=0 ; i < TOTAL_ROWS ; i++) { - gtk_entry_set_text(GTK_ENTRY(keyWidgets[i]), ""); - } - return FALSE; -} - -/* - * btn_save_cb - * - * Some event happened and the name is passed in the - * data field. - */ -void btn_save_cb(GtkWidget *widget, gpointer data) { - saveShortcuts(key_pairs_tmp, 10); - close_window_cb(widget, data); -} - -void btn_macro_save_cb(GtkWidget *widget, gpointer data) { - GtkTextBuffer *buffer = g_object_get_data(G_OBJECT(widget), "buffer"); - int nSaveMacroText = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "saveMacroText")); - gchar *text; - GtkTextIter start, end; - gtk_text_buffer_get_bounds (buffer, &start, &end); - - text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE); - if (nSaveMacroText) { - saveMacroText(text); - } else { - saveConfigText(text); - } - close_window_cb(widget, data); -} - -/* - * check_event_cb - * - * Handle a checkbox signal - */ -void check_event_cb(GtkWidget *widget, gpointer data) { - int pos = GPOINTER_TO_INT(data); - int row = pos / TOTAL_MASKS_PER_ROW, mask_col = pos % TOTAL_MASKS_PER_ROW; - if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) { - key_pairs_tmp[row * 2] |= masks[mask_col]; - } else { - key_pairs_tmp[row * 2] &= ~masks[mask_col]; - } -} - -char * int_to_accel(int keyval) { - gchar *accel = NULL; - accel = gtk_accelerator_get_label(keyval, 0); - - // Convert to upper case - char *s = accel; - while (*s) { - *s = toupper((unsigned char)*s); - s++; - } - return accel; -} - -static gboolean key_release_cb(GtkWidget *entry, GdkEventKey *event, - gpointer data) { - int row = GPOINTER_TO_INT(data); - int keyval = key_pairs_tmp[row * 2 + 1]; - - /* --- Put text in the field. --- */ - gtk_entry_set_text(GTK_ENTRY(entry), int_to_accel(keyval)); - return TRUE; -} - -static gboolean key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) { - int row = GPOINTER_TO_INT(data); - if (event->keyval == GDK_KEY_BackSpace || event->keyval == GDK_KEY_Delete) { - key_pairs_tmp[row * 2 + 1] = 0; - return FALSE; - } - key_pairs_tmp[row * 2 + 1] = gdk_keyval_to_lower(event->keyval); - return TRUE; -} - -void add_checkbox(GtkWidget *parent, char *text, int mask_pos) { - // GtkWidget *check; - int pad = 10; - /* - * --- Create a check button - */ - maskWidgets[mask_pos] = gtk_check_button_new_with_label(text); - /* - * --- Active/Inactive check button - */ - int row = mask_pos / TOTAL_MASKS_PER_ROW, mask_col = mask_pos % TOTAL_MASKS_PER_ROW; - int mask = key_pairs_tmp[row * 2]; - gboolean active = FALSE; - if (mask&masks[mask_col]) { - active = TRUE; - } - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(maskWidgets[mask_pos]), active); - - /* --- Pack the checkbox into the parent (expand? fill? padding?). --- */ - gtk_box_pack_start(GTK_BOX(parent), maskWidgets[mask_pos], FALSE, FALSE, pad); - - g_signal_connect(maskWidgets[mask_pos], "toggled", G_CALLBACK(check_event_cb), - GINT_TO_POINTER(mask_pos)); -} - -void add_macro_text(GtkWidget *widget, GtkWidget *w, char *macro_text, int saveMacroText) { - GtkWidget *save_button, *macro_tv; - GtkWidget *hbox; - /* Horizontal box to pack save button */ - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL); - GtkTextBuffer *buffer; - macro_tv = gtk_text_view_new (); - buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (macro_tv)); - - gtk_text_buffer_set_text (buffer, macro_text, -1); - gtk_container_add(GTK_CONTAINER(scrolled_window), macro_tv); - gtk_scrolled_window_set_propagate_natural_width(GTK_SCROLLED_WINDOW(scrolled_window), 1); - gtk_scrolled_window_set_propagate_natural_height(GTK_SCROLLED_WINDOW(scrolled_window), 1); - gtk_text_view_set_bottom_margin(GTK_TEXT_VIEW(macro_tv), 30); - - gtk_widget_set_valign(hbox, GTK_ALIGN_END); - gtk_widget_set_vexpand(hbox, TRUE); - gtk_widget_set_halign(hbox, GTK_ALIGN_END); - /* --- Pack it in. --- */ - gtk_box_pack_start(GTK_BOX(widget), scrolled_window, FALSE, FALSE, 0); - /* --- Create a Save button. --- */ - save_button = gtk_button_new_with_label("Save"); - g_object_set_data(G_OBJECT(save_button), "buffer", buffer); - g_object_set_data(G_OBJECT(save_button), "saveMacroText", GINT_TO_POINTER(saveMacroText)); - g_signal_connect(save_button, "clicked", G_CALLBACK(btn_macro_save_cb), w); - /* --- Pack the button into the vertical box (vbox box1). --- */ - gtk_box_pack_start(GTK_BOX(hbox), save_button, FALSE, FALSE, 10); - gtk_widget_set_margin_bottom(hbox, 10); - - gtk_box_pack_start(GTK_BOX(widget), hbox, TRUE, TRUE, 0); -} - -static void -show_input_mode_alert (char *msg) -{ - GtkWidget *dialog; - dialog=gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s", msg); - if(dialog) - { - g_signal_connect_swapped(dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); - gtk_widget_show_all(dialog); - } -} - -void add_shortcut_box(GtkWidget *widget, char *text, int row) { - GtkWidget *hbox, *label_hbox; - GtkWidget *label; - int pad = 10; - /* Horizontal box to pack shortcut and label */ - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - - /* Horizontal box to pack label */ - label_hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - /* --- create a new label. --- */ - label = gtk_label_new(text); - gtk_label_set_xalign(GTK_LABEL(label), 0); - /* --- Pack the label into the horizontal box (expand? fill? padding) --- */ - gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, TRUE, pad); - - for (int i = 0; i < TOTAL_MASKS_PER_ROW; i++) { - add_checkbox(hbox, labels[i], row * TOTAL_MASKS_PER_ROW + i); - } - - /* --- Create an entry field --- */ - keyWidgets[row] = gtk_entry_new(); - GtkWidget *entry = keyWidgets[row]; - - /* --- Pack the entry into the vertical box (expand? fill?, padding?). --- */ - gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 10); - - /* --- Put some text in the field. --- */ - int kvl = gdk_keyval_to_lower(key_pairs_tmp[row*2+1]); - gtk_entry_set_text(GTK_ENTRY(entry), int_to_accel(kvl)); - gtk_entry_set_alignment(GTK_ENTRY(entry), 0.5); - - /* --- Pack it in. --- */ - gtk_box_pack_start(GTK_BOX(widget), hbox, FALSE, FALSE, 0); - - g_signal_connect(entry, "key_press_event", G_CALLBACK(key_press_cb), - GINT_TO_POINTER(row)); - g_signal_connect(entry, "key_release_event", G_CALLBACK(key_release_cb), - GINT_TO_POINTER(row)); -} - -void add_control_buttons(GtkWidget *widget, GtkWidget *dialog) { - GtkWidget *save_button; - GtkWidget *cancel_button; - GtkWidget *reset_button; - GtkWidget *hbox; - - /* Horizontal box to pack OK and Cancel buttons */ - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_widget_set_halign(hbox, GTK_ALIGN_END); - - /* --- Create a Reset button. --- */ - reset_button = gtk_button_new_with_label("Reset"); - - /* --- Pack the reset_button into the vertical box (vbox box1). --- */ - gtk_box_pack_start(GTK_BOX(hbox), reset_button, FALSE, FALSE, 10); - - /* --- Create a Cancel button. --- */ - cancel_button = gtk_button_new_with_label("Cancel"); - - /* --- Pack the cancel_button into the vertical box (vbox box1). --- */ - gtk_box_pack_start(GTK_BOX(hbox), cancel_button, FALSE, FALSE, 10); - - /* --- Create a Save button. --- */ - save_button = gtk_button_new_with_label("Save"); - - /* --- Pack the button into the vertical box (vbox box1). --- */ - gtk_box_pack_start(GTK_BOX(hbox), save_button, FALSE, FALSE, 10); - - gtk_container_add(GTK_CONTAINER(widget), hbox); - - g_signal_connect(reset_button, "clicked", G_CALLBACK(btn_reset_cb), "clicked"); - g_signal_connect(save_button, "clicked", G_CALLBACK(btn_save_cb), dialog); - g_signal_connect(cancel_button, "clicked", G_CALLBACK(close_window_cb), - dialog); -} - -static void set_margin ( GtkWidget *vbox, gint hmargin, gint vmargin ) -{ - gtk_widget_set_margin_start(vbox, hmargin); - gtk_widget_set_margin_end(vbox, hmargin); - gtk_widget_set_margin_top(vbox, vmargin); - gtk_widget_set_margin_bottom(vbox, vmargin); -} - -static void on_toggle_fix_wps_clicked (GtkWidget *checkbox, gpointer data) -{ - guint flags = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(checkbox), "flags")); - gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)); - if (active) { - if (data != NULL) { - show_input_mode_alert((char*)data); - } - flags |= IBworkaroundForWPS; - } else { - flags &= ~(IBworkaroundForWPS); - } - saveFlags(flags); -} - -static void on_toggle_fix_address_bar_clicked (GtkWidget *checkbox, gpointer data) -{ - guint flags = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(checkbox), "flags")); - gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)); - if (active) { - if (data != NULL) { - show_input_mode_alert((char*)data); - } - flags |= IBworkaroundForFBMessenger; - } else { - flags &= ~(IBworkaroundForFBMessenger); - } - saveFlags(flags); -} - -static void -combo_changed_cb (GtkComboBox *combo, gpointer data) -{ - GtkTreeIter iter; - - if (gtk_combo_box_get_active_iter (combo, &iter)) - { - GtkTreeModel *model; - gint effect; - - model = gtk_combo_box_get_model (combo); - gtk_tree_model_get (model, &iter, 1, &effect, -1); - - if (effect > 0 && data != NULL) { - show_input_mode_alert((char*)data); - } - saveInputMode(effect+1); - } -} - -GtkWidget* create_new_dropdown(int mode, char *alert, char **options, int n) { - GtkListStore *store; - GtkTreeIter iter; - GtkWidget *combobox; - GtkTreeModel *model; - GtkCellRenderer *renderer; - - combobox = gtk_combo_box_new (); - - store=gtk_list_store_new(2,G_TYPE_STRING, G_TYPE_INT); - - for (int i=0; i < n; i++) { - gtk_list_store_append(GTK_LIST_STORE(store),&iter); - gtk_list_store_set(store,&iter,0,options[i],1, i, -1); - } - - gtk_combo_box_set_model(GTK_COMBO_BOX(combobox), GTK_TREE_MODEL(store)); - - /* by default, this is blank, so set the first */ - gtk_combo_box_set_active ( GTK_COMBO_BOX (combobox), - mode-1 ); - g_signal_connect (combobox, "changed", - G_CALLBACK (combo_changed_cb), - alert); - renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer, - "text", 0, - NULL); - return combobox; -} - -static gboolean -tooltip_press_callback (GtkWidget *event_box, - GdkEventButton *event, - gpointer data) -{ - g_print ("Event box clicked at coordinates %f,%f\n", - event->x, event->y); - show_input_mode_alert((char*)data); - // Returning TRUE means we handled the event, so the signal - // emission should be stopped (don’t call any further callbacks - // that may be connected). Return FALSE to continue invoking callbacks. - return TRUE; -} - -char *options[] = { - "1. Pre-edit (có gạch chân)", - "2. Surrounding Text (không gạch chân)", - "3. ForwardKeyEvent I (không gạch chân)", - "4. ForwardKeyEvent II (không gạch chân)", - "5. Forward as Commit (không gạch chân)", - "6. XTestFakeKeyEvent (không gạch chân)", -}; - -static void add_page_other_settings_content(GtkWidget *parent, GtkWidget *w, guint flags, int mode) -{ - GtkWidget *grid; - GtkWidget *label1; - GtkWidget *label2; - GtkWidget *dropdown1; - GtkWidget *checkbox2, *checkbox3; - GtkWidget *cancel_button; - GtkWidget *hbox; - - grid = gtk_grid_new(); - gtk_container_add(GTK_CONTAINER(parent), grid); - - label1 = gtk_label_new("Chế độ gõ mặc định"); - gtk_grid_attach(GTK_GRID(grid), label1, 0, 0, 1, 1); // column, row, width, height - - dropdown1 = create_new_dropdown(mode, input_mode_alert, options, 7-1); - gtk_grid_attach(GTK_GRID(grid), dropdown1, 1, 0, 1, 1); - - checkbox2 = gtk_check_button_new_with_label("Sửa lỗi lặp chữ trong FB"); - gtk_grid_attach(GTK_GRID(grid), checkbox2, 0, 1, 1, 1); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox2), flags&IBworkaroundForFBMessenger); - g_object_set_data(G_OBJECT(checkbox2), "flags", GUINT_TO_POINTER(flags)); - g_signal_connect(checkbox2, "toggled", G_CALLBACK(on_toggle_fix_address_bar_clicked), fix_fb_alert); - - checkbox3 = gtk_check_button_new_with_label("Sửa lỗi không hiện chữ trong WPS"); - gtk_grid_attach(GTK_GRID(grid), checkbox3, 0, 2, 1, 1); - g_object_set_data(G_OBJECT(checkbox3), "flags", GUINT_TO_POINTER(flags)); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox3), flags&IBworkaroundForWPS); - g_signal_connect(checkbox3, "toggled", G_CALLBACK(on_toggle_fix_wps_clicked), NULL); - - // Set consistent padding for all rows - gtk_grid_set_row_spacing(GTK_GRID(grid), 10); - gtk_grid_set_column_spacing(GTK_GRID(grid), 20); - - // Pack the button group in the bottom right corner - GtkWidget *vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 10); - - /* Horizontal box to pack OK and Cancel buttons */ - hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_widget_set_halign(hbox, GTK_ALIGN_END); - gtk_widget_set_valign(vbox, GTK_ALIGN_END); - gtk_widget_set_vexpand(vbox, TRUE); - - /* --- Create a Cancel button. --- */ - cancel_button = gtk_button_new_with_label("Close"); - - g_signal_connect(cancel_button, "clicked", G_CALLBACK(close_window_cb), w); - - /* --- Pack the cancel_button into the vertical box (vbox box1). --- */ - gtk_box_pack_end(GTK_BOX(hbox), cancel_button, FALSE, FALSE, 10); - gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 10); - - gtk_container_add(GTK_CONTAINER(parent), vbox); -} - -/* - * Main - program begins here - */ -int openGUI(guint flags, int mode, guint32 *s, int size, char *mtext, char *cfg_text) { - GtkWidget *w; - GtkWidget *vbox, *vcbox; - int which; - int pad = 10; - int arr[10] = {0}; - - key_pairs_tmp = s; - - gtk_init(NULL, NULL); - /* --- Create the top level window --- */ - w = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_widget_set_size_request(w, 600, 150); - - /* --- You should always remember to connect the delete_event - * to the main window. - */ - g_signal_connect(w, "delete_event", G_CALLBACK(close_window_cb), w); - - /* --- Give the window a border --- */ - gtk_container_set_border_width(GTK_CONTAINER(w), 2); - - /* --- We create a vertical box (vbox) to pack - * the horizontal boxes into. - */ - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, pad); - - int i = usIM ? 3 : 0; - for (; i < TOTAL_ROWS; i++) { - add_shortcut_box(vbox, text_arr[i], i); - } - - vcbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, pad); - add_control_buttons(vcbox, w); - - /* --- Align the controls box to the bottom. --- */ - gtk_widget_set_valign(vcbox, GTK_ALIGN_END); - gtk_widget_set_vexpand(vcbox, TRUE); - gtk_box_pack_start(GTK_BOX(vbox), vcbox, TRUE, TRUE, 0); - - set_margin(vbox, 5, pad); - - - GtkWidget *m_notebook; - m_notebook = gtk_notebook_new(); - - gtk_container_add(GTK_CONTAINER (w), m_notebook); - - GtkWidget *button; - - GtkWidget* keyboardPage = gtk_label_new("Phím tắt"); - gtk_notebook_append_page(GTK_NOTEBOOK(m_notebook), vbox, keyboardPage); - - GtkWidget* macroPage = gtk_label_new("Gõ tắt"); - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, pad); - add_macro_text(vbox, w, mtext, 1); - gtk_notebook_append_page(GTK_NOTEBOOK(m_notebook), vbox, macroPage); - - GtkWidget* cfgPage = gtk_label_new("Tự định nghĩa kiểu gõ"); - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, pad); - add_macro_text(vbox, w, cfg_text, 0); - gtk_notebook_append_page(GTK_NOTEBOOK(m_notebook), vbox, cfgPage); - - vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, pad); - set_margin(vbox, 5, pad); - GtkWidget* othersPage = gtk_label_new("Khác"); - add_page_other_settings_content(vbox, w, flags, mode); - gtk_notebook_append_page(GTK_NOTEBOOK(m_notebook), vbox, othersPage); - - /* - * --- Make the main window visible - */ - gtk_window_set_title(GTK_WINDOW(w), "Settings"); - - gtk_widget_show_all(GTK_WIDGET(w)); - - gtk_main(); -} - diff --git a/ui/ui.go b/ui/ui.go index 18d71d69..eff9e325 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -1,101 +1,139 @@ package ui -/* -#cgo pkg-config: gtk+-3.0 -#include - -extern int openGUI(guint flags, int mode, guint32 *s, int size, char *mtext, char *cfgtext); -*/ -import "C" import ( - "encoding/json" - "ibus-bamboo/config" - "io/ioutil" - "os" - "unsafe" + "github.com/diamondburned/gotk4/pkg/gtk/v4" ) -var engineName string +const APP_ID = "ibus-bamboo.mode-options" -//export saveFlags -func saveFlags(flags C.guint) { - var ( - cfg = config.LoadConfig(engineName) - ) - config.SaveConfig(cfg, engineName) - cfg.IBflags = uint(flags) - config.SaveConfig(cfg, engineName) +var modeOptions = []string{ + "1. Pre-edit (có gạch chân)", + "2. Surrounding Text (không gạch chân)", + "3. ForwardKeyEvent I (không gạch chân)", + "4. ForwardKeyEvent II (không gạch chân)", + "5. Forward as Commit (không gạch chân)", + "6. XTestFakeKeyEvent (không gạch chân)", } -//export saveConfigText -func saveConfigText(text *C.char) { - var ( - cfgText = C.GoString(text) - cfgFn = config.GetConfigPath(engineName) - ) - err := ioutil.WriteFile(cfgFn, []byte(cfgText), 0644) - if err != nil { - panic(err) - } +func saveShortCut() error { + return nil } -//export saveMacroText -func saveMacroText(text *C.char) { - var ( - macroText = C.GoString(text) - macroFP = config.GetMacroPath(engineName) - ) - err := ioutil.WriteFile(macroFP, []byte(macroText), 0644) - if err != nil { - panic(err) - } -} +func RenderShortcut(window *gtk.ApplicationWindow) *gtk.Box { + // Button + buttonClose := gtk.NewButtonWithLabel("Đóng") + buttonClose.ConnectClicked(func() { + window.Close() + }) + buttonReset := gtk.NewButtonWithLabel("Đặt lại") + buttonSave := gtk.NewButtonWithLabel("Lưu") + + // Box + buttonBox := gtk.NewBox(gtk.OrientationHorizontal, 10) + buttonBox.SetHAlign(gtk.AlignEnd) + buttonBox.SetHExpand(true) + buttonBox.Append(buttonClose) + buttonBox.Append(buttonReset) + buttonBox.Append(buttonSave) -//export saveInputMode -func saveInputMode(mode int) { - var ( - cfg = config.LoadConfig(engineName) - ) - cfg.DefaultInputMode = mode - config.SaveConfig(cfg, engineName) + // MainBox + mainBox := gtk.NewBox(gtk.OrientationVertical, 10) + mainBox.SetMarginTop(10) + mainBox.SetMarginBottom(10) + mainBox.SetMarginStart(10) + mainBox.SetMarginEnd(10) + mainBox.Append(buttonBox) + + return mainBox } -//export saveShortcuts -func saveShortcuts(ptr *C.guint32, length int) { - var ( - cfg = config.LoadConfig(engineName) - ) - codes := makeSliceFromPtr(ptr, length) - cfg.Shortcuts = codes - config.SaveConfig(cfg, engineName) +func saveInputTextView() error { + return nil } -func makeSliceFromPtr(ptr *C.guint32, size int) [10]uint32 { - var out [10]uint32 - slice := (*[1 << 28]C.guint32)(unsafe.Pointer(ptr))[:size:size] - for i, elem := range slice[:size] { - out[i] = uint32(elem) +func RenderInputTextView() *gtk.Box { + // TextView + textView := gtk.NewTextView() + textView.SetWrapMode(gtk.WrapNone) + textView.SetVExpand(true) + textView.SetHExpand(true) + textView.SetTopMargin(10) + textView.SetBottomMargin(10) + textView.SetLeftMargin(10) + textView.SetRightMargin(10) + + // CSS for textView + textView.AddCSSClass("bordered-textview") + css := ` + .bordered-textview text { + border: 1px solid #999999; + border-radius: 5px; + padding: 5px; } - return out + ` + cssProvider := gtk.NewCSSProvider() + cssProvider.LoadFromString(css) + gtk.StyleContextAddProviderForDisplay(textView.Display(), cssProvider, gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) + + // ScrollView for TextView input + scrollView := gtk.NewScrolledWindow() + scrollView.SetVExpand(true) + scrollView.SetMinContentHeight(200) + scrollView.SetChild(textView) + + // Button + buttonSave := gtk.NewButtonWithLabel("Lưu") + buttonBox := gtk.NewBox(gtk.OrientationHorizontal, 0) + buttonBox.SetMarginBottom(10) + buttonBox.SetMarginEnd(10) + buttonBox.SetHAlign(gtk.AlignEnd) + buttonBox.SetHExpand(true) + buttonBox.Append(buttonSave) + + // MainBox + mainBox := gtk.NewBox(gtk.OrientationVertical, 10) + mainBox.SetMarginTop(10) + mainBox.SetMarginBottom(10) + mainBox.SetMarginStart(10) + mainBox.SetMarginEnd(10) + mainBox.Append(scrollView) + mainBox.Append(buttonBox) + + return mainBox } -func OpenGUI(engName string) { - engineName = engName - var ( - cfg = config.LoadConfig(engineName) - shortcuts = cfg.Shortcuts[:] - s = (*C.guint32)(&shortcuts[0]) - size = len(shortcuts) - macroFilePath = config.GetMacroPath(engineName) - ) - mText, err := ioutil.ReadFile(macroFilePath) - if err != nil { - panic(err) - } - data, err := json.MarshalIndent(cfg, "", " ") - if err != nil { - panic(err) - } - os.Setenv("GTK_IM_MODULE", "gtk-im-context-simple") - C.openGUI(C.guint(cfg.IBflags), C.int(cfg.DefaultInputMode), s, C.int(size), C.CString(string(mText)), C.CString(string(data))) +func RenderOther(window *gtk.ApplicationWindow) *gtk.Box { + // Mode Choose + labelDefaultMode := gtk.NewLabel("Chế độ gõ mặc định") + dropdownMode := gtk.NewDropDownFromStrings(modeOptions) + modeBox := gtk.NewBox(gtk.OrientationHorizontal, 10) + modeBox.Append(labelDefaultMode) + modeBox.Append(dropdownMode) + + // Checkbox + checkboxFixFB := gtk.NewCheckButtonWithLabel("Sửa lỗi lặp chữ trong FB") + checkboxFixWPS := gtk.NewCheckButtonWithLabel("Sửa lỗi không hiện chữ trong WPS") + + // Button + buttonClose := gtk.NewButtonWithLabel("Đóng") + buttonClose.ConnectClicked(func() { + window.Close() + }) + buttonBox := gtk.NewBox(gtk.OrientationHorizontal, 10) + buttonBox.Append(buttonClose) + buttonBox.SetHAlign(gtk.AlignEnd) + buttonBox.SetHExpand(true) + + // MainBox + mainBox := gtk.NewBox(gtk.OrientationVertical, 10) + mainBox.SetMarginTop(10) + mainBox.SetMarginBottom(10) + mainBox.SetMarginStart(10) + mainBox.SetMarginEnd(10) + mainBox.Append(modeBox) + mainBox.Append(checkboxFixFB) + mainBox.Append(checkboxFixWPS) + mainBox.Append(buttonBox) + + return mainBox } diff --git a/vendor/github.com/BambooEngine/bamboo-core/go.mod b/vendor/github.com/BambooEngine/bamboo-core/go.mod deleted file mode 100644 index 6fd54b7d..00000000 --- a/vendor/github.com/BambooEngine/bamboo-core/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/BambooEngine/bamboo-core - -go 1.18 diff --git a/vendor/github.com/BambooEngine/goibus/go.mod b/vendor/github.com/BambooEngine/goibus/go.mod deleted file mode 100644 index 7c5f27a8..00000000 --- a/vendor/github.com/BambooEngine/goibus/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module github.com/BambooEngine/goibus - -go 1.13 - -require github.com/godbus/dbus/v5 v5.1.0 diff --git a/vendor/github.com/BambooEngine/goibus/go.sum b/vendor/github.com/BambooEngine/goibus/go.sum deleted file mode 100644 index 024b2693..00000000 --- a/vendor/github.com/BambooEngine/goibus/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk= -github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= diff --git a/vendor/github.com/KarpelesLab/weak/LICENSE b/vendor/github.com/KarpelesLab/weak/LICENSE new file mode 100644 index 00000000..f5c8bd03 --- /dev/null +++ b/vendor/github.com/KarpelesLab/weak/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Karpelès Lab Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/KarpelesLab/weak/Makefile b/vendor/github.com/KarpelesLab/weak/Makefile new file mode 100644 index 00000000..c3ec5ac7 --- /dev/null +++ b/vendor/github.com/KarpelesLab/weak/Makefile @@ -0,0 +1,15 @@ +#!/bin/make +GOROOT:=$(shell PATH="/pkg/main/dev-lang.go.dev/bin:$$PATH" go env GOROOT) +GOPATH:=$(shell $(GOROOT)/bin/go env GOPATH) + +.PHONY: test deps + +all: + $(GOPATH)/bin/goimports -w -l . + $(GOROOT)/bin/go build -v + +deps: + $(GOROOT)/bin/go get -v -t . + +test: + $(GOROOT)/bin/go test -v diff --git a/vendor/github.com/KarpelesLab/weak/README.md b/vendor/github.com/KarpelesLab/weak/README.md new file mode 100644 index 00000000..48a6f6c6 --- /dev/null +++ b/vendor/github.com/KarpelesLab/weak/README.md @@ -0,0 +1,91 @@ +[![GoDoc](https://godoc.org/github.com/KarpelesLab/weak?status.svg)](https://godoc.org/github.com/KarpelesLab/weak) + +# weakref map in go 1.18 + +This is a weakref map for Go 1.18, with some inspiration from [xeus2001's weakref implementation](https://github.com/xeus2001/go-weak). + +This provides both a `weak.Ref` object to store weak references, and a `weak.Map` object for maps. + +## Usage + +```go +import "github.com/KarpelesLab/weak" + +var m = weak.NewMap[uint64, Object]() + +// instanciate/get an object +func Get(id uint64) (*Object, error) { + // try to get from cache + var obj *Object + if obj = m.Get(id); obj == nil { + // create new + obj = m.Set(id, &Object{id: id}) // this will return an existing object if already existing + } + + obj.initOnce.Do(obj.init) // use sync.Once to ensure init happens only once + return obj, obj.err +} + +func main() { + obj, err := Get(1234) + // ... +} +``` + +As to the `Object` implementation, it could look like: + +```go +type Object struct { + id uint64 + initOnce sync.Once + f *os.File + err error +} + +func (o *Object) init() { + o.f, o.err = os.Open(fmt.Sprintf("/tmp/file%d.bin", o.id)) +} + +func (o *Object) Destroy() { + if o.f != nil { + o.f.Close() + } +} +``` + +### File example + +Simple example that allows opening multiple files without having to care about closing these and reading random data using `ReadAt`. + +```go +import { + "github.com/KarpelesLab/weak" + "os" + "sync" +} + +type File struct { + *os.File + err error + open sync.Once +} + +var fileCache = weak.NewMap[string, File]() + +func Open(filepath string) (io.ReaderAt, error) ( + var f *File + if f = fileCache.Get(filepath); f == nil { + f = fileCache.Set(filepath, &File{}) + } + f.open.Do(func() { + f.File, f.err = os.Open(filepath) + }) + return f, f.err +} + +func (f *File) Destroy() { + if f.File != nil { + f.File.Close() + } +} +``` diff --git a/vendor/github.com/KarpelesLab/weak/map.go b/vendor/github.com/KarpelesLab/weak/map.go new file mode 100644 index 00000000..9c42740d --- /dev/null +++ b/vendor/github.com/KarpelesLab/weak/map.go @@ -0,0 +1,91 @@ +package weak + +import ( + "sync" +) + +// Map is a thread safe map for objects to be kept as weak references, useful for cache/etc +type Map[K comparable, T any] struct { + m map[K]*Ref[T] + l sync.RWMutex +} + +// Object implementing Destroyable added to a Map will have their Destroy() method called +// when the object is about to be removed. This replaces use of a finalizer. +type Destroyable interface { + Destroy() +} + +// NewMap returns a new weak reference map +func NewMap[K comparable, T any]() *Map[K, T] { + res := &Map[K, T]{ + m: make(map[K]*Ref[T]), + } + + return res +} + +// Get returns the value at index k in the map. If no such value exists, nil is returned. +func (w *Map[K, T]) Get(k K) *T { + w.l.RLock() + defer w.l.RUnlock() + + v, ok := w.m[k] + if !ok { + return nil + } + + return v.Get() +} + +// Set inserts the value v if it does not already exists, and return it. If a value v +// already exists, then the previous value is returned. +func (w *Map[K, T]) Set(k K, v *T) *T { + w.l.Lock() + defer w.l.Unlock() + + // already exists? + wr, ok := w.m[k] + if ok { + v2 := wr.Get() + if v2 != nil { + // return past (still alive) value + return v2 + } + } + + // store new value + wr = NewRefDestroyer(v, func(dv *T, wr *Ref[T]) { + w.destroy(wr, dv, k) + }) + w.m[k] = wr + + return v +} + +// Delete removes element at key k from the map. This doesn't call Destroy immediately +// as this would typically happen when the object is actually cleared by the garbage +// collector and instances of said object may still be used. +func (w *Map[K, T]) Delete(k K) { + w.l.Lock() + defer w.l.Unlock() + + delete(w.m, k) +} + +func (w *Map[K, T]) destroy(wr *Ref[T], ptr *T, k K) { + w.l.Lock() + defer w.l.Unlock() + + wr2, ok := w.m[k] + if !ok { + return + } + if wr == wr2 { + delete(w.m, k) + } + + if v, ok := any(ptr).(Destroyable); ok { + go v.Destroy() + } +} diff --git a/vendor/github.com/KarpelesLab/weak/ref.go b/vendor/github.com/KarpelesLab/weak/ref.go new file mode 100644 index 00000000..4162d3e3 --- /dev/null +++ b/vendor/github.com/KarpelesLab/weak/ref.go @@ -0,0 +1,82 @@ +package weak + +import ( + "runtime" + "sync/atomic" + "unsafe" +) + +// Ref is a weak reference to a Go object +type Ref[T any] struct { + hidden uintptr + state refState +} + +func (wr *Ref[T]) value() *T { + v := atomic.LoadUintptr(&wr.hidden) + if v == 0 { + return nil + } + return (*T)(unsafe.Pointer(v)) +} + +// Get returns the value for a given weak reference pointer +func (wr *Ref[T]) Get() *T { + for { + if wr.state.CaS(refALIVE, refINUSE) { + val := wr.value() + // all good + wr.state.Set(refALIVE) // set back to alive + return val + } + if wr.state.Get() == refDEAD { + return nil + } + runtime.Gosched() + } +} + +// NewRef returns a reference to the object v that may be cleared by the garbage collector +func NewRef[T any](v *T) *Ref[T] { + if v == nil { + return &Ref[T]{0, refDEAD} + } + wr := &Ref[T]{uintptr(unsafe.Pointer(v)), refALIVE} + var f func(p *T) + f = func(p *T) { + if wr.state.CaS(refALIVE, refDEAD) { + // we're now refdead, clear the pointer value + atomic.StoreUintptr(&wr.hidden, 0) + return + } + // this was not ALIVE, it means it was likely INUSE, re-set finalizer and wait + runtime.SetFinalizer(p, f) + } + runtime.SetFinalizer(v, f) + + return wr +} + +// NewRefDestroyer returns a reference to the object v that may be cleared by the garbage collector, +// in which case destroy will be called. +func NewRefDestroyer[T any](v *T, destroy func(v *T, wr *Ref[T])) *Ref[T] { + if v == nil { + return &Ref[T]{0, refDEAD} + } + wr := &Ref[T]{uintptr(unsafe.Pointer(v)), refALIVE} + var f func(p *T) + f = func(p *T) { + if wr.state.CaS(refALIVE, refDEAD) { + atomic.StoreUintptr(&wr.hidden, 0) + if destroy != nil { + go destroy(p, wr) + } + return + } + // this was not ALIVE, it means it was likely INUSE, re-set finalizer and wait + runtime.SetFinalizer(p, f) + } + runtime.SetFinalizer(v, f) + + return wr +} diff --git a/vendor/github.com/KarpelesLab/weak/state.go b/vendor/github.com/KarpelesLab/weak/state.go new file mode 100644 index 00000000..37e0533e --- /dev/null +++ b/vendor/github.com/KarpelesLab/weak/state.go @@ -0,0 +1,23 @@ +package weak + +import "sync/atomic" + +type refState uint32 + +const ( + refDEAD refState = 0 + refALIVE refState = 1 + refINUSE refState = 2 +) + +func (wrS *refState) CaS(old, new refState) bool { + return atomic.CompareAndSwapUint32((*uint32)(wrS), uint32(old), uint32(new)) +} + +func (wrS *refState) Set(v refState) { + atomic.StoreUint32((*uint32)(wrS), uint32(v)) +} + +func (wrS *refState) Get() refState { + return refState(atomic.LoadUint32((*uint32)(wrS))) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/LICENSE b/vendor/github.com/diamondburned/gotk4/pkg/LICENSE new file mode 100644 index 00000000..ee6256cd --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/LICENSE @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/antialias.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/antialias.go new file mode 100644 index 00000000..5d01bb66 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/antialias.go @@ -0,0 +1,27 @@ +package cairo + +// #include +// #include +// #include +import "C" +import ( + "unsafe" +) + +// Antialias is a representation of Cairo's cairo_antialias_t. +type Antialias int + +const ( + AntialiasDefault Antialias = C.CAIRO_ANTIALIAS_DEFAULT + AntialiasNone Antialias = C.CAIRO_ANTIALIAS_NONE + AntialiasGray Antialias = C.CAIRO_ANTIALIAS_GRAY + AntialiasSubpixel Antialias = C.CAIRO_ANTIALIAS_SUBPIXEL + AntialiasFast Antialias = C.CAIRO_ANTIALIAS_FAST // (since 1.12) + AntialiasGood Antialias = C.CAIRO_ANTIALIAS_GOOD // (since 1.12) + AntialiasBest Antialias = C.CAIRO_ANTIALIAS_BEST // (since 1.12) +) + +func marshalAntialias(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return Antialias(c), nil +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/cairo.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/cairo.go new file mode 100644 index 00000000..4e4c91fd --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/cairo.go @@ -0,0 +1,65 @@ +// Copyright (c) 2013-2014 Conformal Systems +// +// This file originated from: http://opensource.conformal.com/ +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +// Package cairo implements Go bindings for Cairo. Supports version 1.10 and +// later. +package cairo + +// #cgo pkg-config: cairo cairo-gobject gobject-2.0 +// #include +// #include +// #include +import "C" +import ( + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/glib" +) + +func init() { + tm := []glib.TypeMarshaler{ + // Enums + {glib.Type(C.cairo_gobject_antialias_get_type()), marshalAntialias}, + {glib.Type(C.cairo_gobject_content_get_type()), marshalContent}, + {glib.Type(C.cairo_gobject_fill_rule_get_type()), marshalFillRule}, + {glib.Type(C.cairo_gobject_line_cap_get_type()), marshalLineCap}, + {glib.Type(C.cairo_gobject_line_join_get_type()), marshalLineJoin}, + {glib.Type(C.cairo_gobject_operator_get_type()), marshalOperator}, + {glib.Type(C.cairo_gobject_status_get_type()), marshalStatus}, + {glib.Type(C.cairo_gobject_surface_type_get_type()), marshalSurfaceType}, + + // Boxed + {glib.Type(C.cairo_gobject_context_get_type()), marshalContext}, + {glib.Type(C.cairo_gobject_surface_get_type()), marshalSurface}, + } + glib.RegisterGValueMarshalers(tm) +} + +// Constants + +// Content is a representation of Cairo's cairo_content_t. +type Content int + +const ( + ContentColor Content = C.CAIRO_CONTENT_COLOR + ContentAlpha Content = C.CAIRO_CONTENT_ALPHA + ContentColorAlpha Content = C.CAIRO_CONTENT_COLOR_ALPHA +) + +func marshalContent(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return Content(c), nil +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/canvas.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/canvas.go new file mode 100644 index 00000000..e2d92534 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/canvas.go @@ -0,0 +1,426 @@ +package cairo + +// #include +// #include +// #include +import "C" + +import ( + "reflect" + "runtime" + "sync" + "unsafe" +) + +// Context is a representation of Cairo's cairo_t. +type Context struct { + _ [0]sync.Mutex + context *C.cairo_t +} + +// native returns a pointer to the underlying cairo_t. +func (v *Context) native() *C.cairo_t { + if v == nil { + return nil + } + return v.context +} + +// Native returns a pointer to the underlying cairo_t. +func (v *Context) Native() uintptr { + return uintptr(unsafe.Pointer(v.native())) +} + +func marshalContext(p uintptr) (interface{}, error) { + c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) + context := (*C.cairo_t)(unsafe.Pointer(c)) + return wrapContext(context), nil +} + +func wrapContext(context *C.cairo_t) *Context { + return &Context{context: context} +} + +func WrapContext(p uintptr) *Context { + context := (*C.cairo_t)(unsafe.Pointer(p)) + return wrapContext(context) +} + +// Closes the context. The context must not be used afterwards. +func (v *Context) Close() { + v.destroy() +} + +// Create is a wrapper around cairo_create(). +func Create(target *Surface) *Context { + c := C.cairo_create(target.native()) + ctx := wrapContext(c) + runtime.SetFinalizer(ctx, (*Context).destroy) + return ctx +} + +// reference is a wrapper around cairo_reference(). +func (v *Context) reference() { + v.context = C.cairo_reference(v.native()) +} + +// destroy is a wrapper around cairo_destroy(). +func (v *Context) destroy() { + if v.context != nil { + C.cairo_destroy(v.native()) + v.context = nil + } +} + +// Status is a wrapper around cairo_status(). +func (v *Context) Status() Status { + c := C.cairo_status(v.native()) + return Status(c) +} + +// Save is a wrapper around cairo_save(). +func (v *Context) Save() { + C.cairo_save(v.native()) +} + +// Restore is a wrapper around cairo_restore(). +func (v *Context) Restore() { + C.cairo_restore(v.native()) +} + +// GetTarget is a wrapper around cairo_get_target(). +func (v *Context) Target() *Surface { + c := C.cairo_get_target(v.native()) + s := wrapSurface(c) + s.reference() + runtime.SetFinalizer(s, (*Surface).destroy) + return s +} + +// PushGroup is a wrapper around cairo_push_group(). +func (v *Context) PushGroup() { + C.cairo_push_group(v.native()) +} + +// PushGroupWithContent is a wrapper around cairo_push_group_with_content(). +func (v *Context) PushGroupWithContent(content Content) { + C.cairo_push_group_with_content(v.native(), C.cairo_content_t(content)) +} + +// TODO(jrick) PopGroup (depends on Pattern) +// cairo_pop_group + +// PopGroupToSource is a wrapper around cairo_pop_group_to_source(). +func (v *Context) PopGroupToSource() { + C.cairo_pop_group_to_source(v.native()) +} + +// GetGroupTarget is a wrapper around cairo_get_group_target(). +func (v *Context) GroupTarget() *Surface { + c := C.cairo_get_group_target(v.native()) + s := wrapSurface(c) + s.reference() + runtime.SetFinalizer(s, (*Surface).destroy) + return s +} + +// SetSource is a wrapper around cairo_set_source(). +func (v *Context) SetSource(p *Pattern) { + C.cairo_set_source(v.native(), p.native()) +} + +// SetSourceRGB is a wrapper around cairo_set_source_rgb(). +func (v *Context) SetSourceRGB(red, green, blue float64) { + C.cairo_set_source_rgb(v.native(), C.double(red), C.double(green), + C.double(blue)) +} + +// SetSourceRGBA is a wrapper around cairo_set_source_rgba(). +func (v *Context) SetSourceRGBA(red, green, blue, alpha float64) { + C.cairo_set_source_rgba(v.native(), C.double(red), C.double(green), + C.double(blue), C.double(alpha)) +} + +// TODO(jrick) SetSource (depends on Pattern) +// cairo_set_source + +// SetSourceSurface is a wrapper around cairo_set_source_surface(). +func (v *Context) SetSourceSurface(surface *Surface, x, y float64) { + C.cairo_set_source_surface(v.native(), surface.native(), C.double(x), + C.double(y)) +} + +// TODO(jrick) Source (depends on Pattern) +// cairo_get_source + +// SetAntialias is a wrapper around cairo_set_antialias(). +func (v *Context) SetAntialias(antialias Antialias) { + C.cairo_set_antialias(v.native(), C.cairo_antialias_t(antialias)) +} + +// GetAntialias is a wrapper around cairo_get_antialias(). +func (v *Context) Antialias() Antialias { + c := C.cairo_get_antialias(v.native()) + return Antialias(c) +} + +// SetDash is a wrapper around cairo_set_dash(). +func (v *Context) SetDash(dashes []float64, offset float64) { + header := (*reflect.SliceHeader)(unsafe.Pointer(&dashes)) + cdashes := (*C.double)(unsafe.Pointer(header.Data)) + C.cairo_set_dash(v.native(), cdashes, C.int(header.Len), + C.double(offset)) +} + +// GetDashCount is a wrapper around cairo_get_dash_count(). +func (v *Context) DashCount() int { + c := C.cairo_get_dash_count(v.native()) + return int(c) +} + +// GetDash is a wrapper around cairo_get_dash(). +func (v *Context) Dash() (dashes []float64, offset float64) { + dashCount := v.DashCount() + cdashes := (*C.double)(C.calloc(8, C.size_t(dashCount))) + var coffset C.double + C.cairo_get_dash(v.native(), cdashes, &coffset) + header := (*reflect.SliceHeader)((unsafe.Pointer(&dashes))) + header.Data = uintptr(unsafe.Pointer(cdashes)) + header.Len = dashCount + header.Cap = dashCount + return dashes, float64(coffset) +} + +// SetFillRule is a wrapper around cairo_set_fill_rule(). +func (v *Context) SetFillRule(fillRule FillRule) { + C.cairo_set_fill_rule(v.native(), C.cairo_fill_rule_t(fillRule)) +} + +// GetFillRule is a wrapper around cairo_get_fill_rule(). +func (v *Context) FillRule() FillRule { + c := C.cairo_get_fill_rule(v.native()) + return FillRule(c) +} + +// SetLineCap is a wrapper around cairo_set_line_cap(). +func (v *Context) SetLineCap(lineCap LineCap) { + C.cairo_set_line_cap(v.native(), C.cairo_line_cap_t(lineCap)) +} + +// GetLineCap is a wrapper around cairo_get_line_cap(). +func (v *Context) LineCap() LineCap { + c := C.cairo_get_line_cap(v.native()) + return LineCap(c) +} + +// SetLineJoin is a wrapper around cairo_set_line_join(). +func (v *Context) SetLineJoin(lineJoin LineJoin) { + C.cairo_set_line_join(v.native(), C.cairo_line_join_t(lineJoin)) +} + +// GetLineJoin is a wrapper around cairo_get_line_join(). +func (v *Context) LineJoin() LineJoin { + c := C.cairo_get_line_join(v.native()) + return LineJoin(c) +} + +// SetLineWidth is a wrapper around cairo_set_line_width(). +func (v *Context) SetLineWidth(width float64) { + C.cairo_set_line_width(v.native(), C.double(width)) +} + +// GetLineWidth is a wrapper cairo_get_line_width(). +func (v *Context) LineWidth() float64 { + c := C.cairo_get_line_width(v.native()) + return float64(c) +} + +// SetMiterLimit is a wrapper around cairo_set_miter_limit(). +func (v *Context) SetMiterLimit(limit float64) { + C.cairo_set_miter_limit(v.native(), C.double(limit)) +} + +// GetMiterLimit is a wrapper around cairo_get_miter_limit(). +func (v *Context) MiterLimit() float64 { + c := C.cairo_get_miter_limit(v.native()) + return float64(c) +} + +// SetOperator is a wrapper around cairo_set_operator(). +func (v *Context) SetOperator(op Operator) { + C.cairo_set_operator(v.native(), C.cairo_operator_t(op)) +} + +// GetOperator is a wrapper around cairo_get_operator(). +func (v *Context) Operator() Operator { + c := C.cairo_get_operator(v.native()) + return Operator(c) +} + +// SetTolerance is a wrapper around cairo_set_tolerance(). +func (v *Context) SetTolerance(tolerance float64) { + C.cairo_set_tolerance(v.native(), C.double(tolerance)) +} + +// GetTolerance is a wrapper around cairo_get_tolerance(). +func (v *Context) Tolerance() float64 { + c := C.cairo_get_tolerance(v.native()) + return float64(c) +} + +// Clip is a wrapper around cairo_clip(). +func (v *Context) Clip() { + C.cairo_clip(v.native()) +} + +// ClipPreserve is a wrapper around cairo_clip_preserve(). +func (v *Context) ClipPreserve() { + C.cairo_clip_preserve(v.native()) +} + +// ClipExtents is a wrapper around cairo_clip_extents(). +func (v *Context) ClipExtents() (x1, y1, x2, y2 float64) { + var cx1, cy1, cx2, cy2 C.double + C.cairo_clip_extents(v.native(), &cx1, &cy1, &cx2, &cy2) + return float64(cx1), float64(cy1), float64(cx2), float64(cy2) +} + +// InClip is a wrapper around cairo_in_clip(). +func (v *Context) InClip(x, y float64) bool { + c := C.cairo_in_clip(v.native(), C.double(x), C.double(y)) + return gobool(c) +} + +// ResetClip is a wrapper around cairo_reset_clip(). +func (v *Context) ResetClip() { + C.cairo_reset_clip(v.native()) +} + +// Rectangle is a wrapper around cairo_rectangle(). +func (v *Context) Rectangle(x, y, w, h float64) { + C.cairo_rectangle(v.native(), C.double(x), C.double(y), C.double(w), C.double(h)) +} + +// Arc is a wrapper around cairo_arc(). +func (v *Context) Arc(xc, yc, radius, angle1, angle2 float64) { + C.cairo_arc(v.native(), C.double(xc), C.double(yc), C.double(radius), C.double(angle1), C.double(angle2)) +} + +// ArcNegative is a wrapper around cairo_arc_negative(). +func (v *Context) ArcNegative(xc, yc, radius, angle1, angle2 float64) { + C.cairo_arc_negative(v.native(), C.double(xc), C.double(yc), C.double(radius), C.double(angle1), C.double(angle2)) +} + +// LineTo is a wrapper around cairo_line_to(). +func (v *Context) LineTo(x, y float64) { + C.cairo_line_to(v.native(), C.double(x), C.double(y)) +} + +// CurveTo is a wrapper around cairo_curve_to(). +func (v *Context) CurveTo(x1, y1, x2, y2, x3, y3 float64) { + C.cairo_curve_to(v.native(), C.double(x1), C.double(y1), C.double(x2), C.double(y2), C.double(x3), C.double(y3)) +} + +// MoveTo is a wrapper around cairo_move_to(). +func (v *Context) MoveTo(x, y float64) { + C.cairo_move_to(v.native(), C.double(x), C.double(y)) +} + +// TODO(jrick) CopyClipRectangleList (depends on RectangleList) +// cairo_copy_clip_rectangle_list + +// Fill is a wrapper around cairo_fill(). +func (v *Context) Fill() { + C.cairo_fill(v.native()) +} + +// ClosePath is a wrapper around cairo_close_path(). +func (v *Context) ClosePath() { + C.cairo_close_path(v.native()) +} + +// NewSubPath is a wrapper around cairo_new_sub_path(). +func (v *Context) NewSubPath() { + C.cairo_new_sub_path(v.native()) +} + +// NewPath is a wrapper around cairo_new_path(). +func (v *Context) NewPath() { + C.cairo_new_path(v.native()) +} + +// GetCurrentPoint is a wrapper around cairo_get_current_point(). +func (v *Context) CurrentPoint() (x, y float64) { + C.cairo_get_current_point(v.native(), (*C.double)(&x), (*C.double)(&y)) + return +} + +// FillPreserve is a wrapper around cairo_fill_preserve(). +func (v *Context) FillPreserve() { + C.cairo_fill_preserve(v.native()) +} + +// FillExtents is a wrapper around cairo_fill_extents(). +func (v *Context) FillExtents() (x1, y1, x2, y2 float64) { + var cx1, cy1, cx2, cy2 C.double + C.cairo_fill_extents(v.native(), &cx1, &cy1, &cx2, &cy2) + return float64(cx1), float64(cy1), float64(cx2), float64(cy2) +} + +// InFill is a wrapper around cairo_in_fill(). +func (v *Context) InFill(x, y float64) bool { + c := C.cairo_in_fill(v.native(), C.double(x), C.double(y)) + return gobool(c) +} + +// TODO(jrick) Mask (depends on Pattern) +// cairo_mask_surface + +// MaskSurface is a wrapper around cairo_mask_surface(). +func (v *Context) MaskSurface(surface *Surface, surfaceX, surfaceY float64) { + C.cairo_mask_surface(v.native(), surface.native(), C.double(surfaceX), + C.double(surfaceY)) +} + +// Paint is a wrapper around cairo_paint(). +func (v *Context) Paint() { + C.cairo_paint(v.native()) +} + +// PaintWithAlpha is a wrapper around cairo_paint_with_alpha(). +func (v *Context) PaintWithAlpha(alpha float64) { + C.cairo_paint_with_alpha(v.native(), C.double(alpha)) +} + +// Stroke is a wrapper around cairo_stroke(). +func (v *Context) Stroke() { + C.cairo_stroke(v.native()) +} + +// StrokePreserve is a wrapper around cairo_stroke_preserve(). +func (v *Context) StrokePreserve() { + C.cairo_stroke_preserve(v.native()) +} + +// StrokeExtents is a wrapper around cairo_stroke_extents(). +func (v *Context) StrokeExtents() (x1, y1, x2, y2 float64) { + var cx1, cy1, cx2, cy2 C.double + C.cairo_stroke_extents(v.native(), &cx1, &cy1, &cx2, &cy2) + return float64(cx1), float64(cy1), float64(cx2), float64(cy2) +} + +// InStroke is a wrapper around cairo_in_stroke(). +func (v *Context) InStroke(x, y float64) bool { + c := C.cairo_in_stroke(v.native(), C.double(x), C.double(y)) + return gobool(c) +} + +// CopyPage is a wrapper around cairo_copy_page(). +func (v *Context) CopyPage() { + C.cairo_copy_page(v.native()) +} + +// ShowPage is a wrapper around cairo_show_page(). +func (v *Context) ShowPage() { + C.cairo_show_page(v.native()) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/fillrule.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/fillrule.go new file mode 100644 index 00000000..4b704b82 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/fillrule.go @@ -0,0 +1,22 @@ +package cairo + +// #include +// #include +// #include +import "C" +import ( + "unsafe" +) + +// FillRule is a representation of Cairo's cairo_fill_rule_t. +type FillRule int + +const ( + FillRuleWinding FillRule = C.CAIRO_FILL_RULE_WINDING + FillRuleEvenOdd FillRule = C.CAIRO_FILL_RULE_EVEN_ODD +) + +func marshalFillRule(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return FillRule(c), nil +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/fontoptions.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/fontoptions.go new file mode 100644 index 00000000..c07798d8 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/fontoptions.go @@ -0,0 +1,184 @@ +package cairo + +// #include +// #include +// #include +import "C" +import ( + "runtime" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/glib" +) + +func init() { + tm := []glib.TypeMarshaler{ + // Enums + {glib.Type(C.cairo_gobject_subpixel_order_get_type()), marshalSubpixelOrder}, + {glib.Type(C.cairo_gobject_hint_style_get_type()), marshalHintStyle}, + {glib.Type(C.cairo_gobject_hint_metrics_get_type()), marshalHintMetrics}, + + // Boxed + {glib.Type(C.cairo_gobject_font_options_get_type()), marshalFontOptions}, + } + glib.RegisterGValueMarshalers(tm) +} + +// SubpixelOrder is a representation of Cairo's cairo_subpixel_order_t. +type SubpixelOrder int + +const ( + SubpixelOrderDefault SubpixelOrder = C.CAIRO_SUBPIXEL_ORDER_DEFAULT + SubpixelOrderRGB SubpixelOrder = C.CAIRO_SUBPIXEL_ORDER_RGB + SubpixelOrderBGR SubpixelOrder = C.CAIRO_SUBPIXEL_ORDER_BGR + SubpixelOrderVRGB SubpixelOrder = C.CAIRO_SUBPIXEL_ORDER_VRGB + SubpixelOrderVBGR SubpixelOrder = C.CAIRO_SUBPIXEL_ORDER_VBGR +) + +func marshalSubpixelOrder(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return SubpixelOrder(c), nil +} + +// HintStyle is a representation of Cairo's cairo_hint_style_t. +type HintStyle int + +const ( + HintStyleDefault HintStyle = C.CAIRO_HINT_STYLE_DEFAULT + HintStyleNone HintStyle = C.CAIRO_HINT_STYLE_NONE + HintStyleSlight HintStyle = C.CAIRO_HINT_STYLE_SLIGHT + HintStyleMedium HintStyle = C.CAIRO_HINT_STYLE_MEDIUM + HintStyleFull HintStyle = C.CAIRO_HINT_STYLE_FULL +) + +func marshalHintStyle(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return HintStyle(c), nil +} + +// HintMetrics is a representation of Cairo's cairo_hint_metrics_t. +type HintMetrics int + +const ( + HintMetricsDefault HintMetrics = C.CAIRO_HINT_METRICS_DEFAULT + HintMetricsOff HintMetrics = C.CAIRO_HINT_METRICS_OFF + HintMetricsOn HintMetrics = C.CAIRO_HINT_METRICS_ON +) + +func marshalHintMetrics(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return HintMetrics(c), nil +} + +// FontOptions is a representation of Cairo's cairo_font_options_t. +type FontOptions struct { + native *C.cairo_font_options_t +} + +func marshalFontOptions(p uintptr) (interface{}, error) { + c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) + return &FontOptions{ + native: (*C.cairo_font_options_t)(unsafe.Pointer(c)), + }, nil +} + +// CreatFontOptions is a wrapper around cairo_font_options_create(). +func CreateFontOptions() *FontOptions { + native := C.cairo_font_options_create() + + opts := &FontOptions{native} + runtime.SetFinalizer(opts, (*FontOptions).destroy) + + return opts +} + +func (o *FontOptions) destroy() { + C.cairo_font_options_destroy(o.native) +} + +// Copy is a wrapper around cairo_font_options_copy(). +func (o *FontOptions) Copy() *FontOptions { + native := C.cairo_font_options_copy(o.native) + + opts := &FontOptions{native} + runtime.SetFinalizer(opts, (*FontOptions).destroy) + + return opts +} + +// Status is a wrapper around cairo_font_options_status(). +func (o *FontOptions) Status() Status { + return Status(C.cairo_font_options_status(o.native)) +} + +// Merge is a wrapper around cairo_font_options_merge(). +func (o *FontOptions) Merge(other *FontOptions) { + C.cairo_font_options_merge(o.native, other.native) +} + +// Hash is a wrapper around cairo_font_options_hash(). +func (o *FontOptions) Hash() uint32 { + return uint32(C.cairo_font_options_hash(o.native)) +} + +// Equal is a wrapper around cairo_font_options_equal(). +func (o *FontOptions) Equal(other *FontOptions) bool { + return gobool(C.cairo_font_options_equal(o.native, other.native)) +} + +// SetAntialias is a wrapper around cairo_font_options_set_antialias(). +func (o *FontOptions) SetAntialias(antialias Antialias) { + C.cairo_font_options_set_antialias(o.native, C.cairo_antialias_t(antialias)) +} + +// GetAntialias is a wrapper around cairo_font_options_get_antialias(). +func (o *FontOptions) Antialias() Antialias { + return Antialias(C.cairo_font_options_get_antialias(o.native)) +} + +// SetSubpixelOrder is a wrapper around cairo_font_options_set_subpixel_order(). +func (o *FontOptions) SetSubpixelOrder(subpixelOrder SubpixelOrder) { + C.cairo_font_options_set_subpixel_order(o.native, C.cairo_subpixel_order_t(subpixelOrder)) +} + +// GetSubpixelOrder is a wrapper around cairo_font_options_get_subpixel_order(). +func (o *FontOptions) SubpixelOrder() SubpixelOrder { + return SubpixelOrder(C.cairo_font_options_get_subpixel_order(o.native)) +} + +// SetHintStyle is a wrapper around cairo_font_options_set_hint_style(). +func (o *FontOptions) SetHintStyle(hintStyle HintStyle) { + C.cairo_font_options_set_hint_style(o.native, C.cairo_hint_style_t(hintStyle)) +} + +// GetHintStyle is a wrapper around cairo_font_options_get_hint_style(). +func (o *FontOptions) HintStyle() HintStyle { + return HintStyle(C.cairo_font_options_get_hint_style(o.native)) +} + +// SetHintMetrics is a wrapper around cairo_font_options_set_hint_metrics(). +func (o *FontOptions) SetHintMetrics(hintMetrics HintMetrics) { + C.cairo_font_options_set_hint_metrics(o.native, C.cairo_hint_metrics_t(hintMetrics)) +} + +// GetHintMetrics is a wrapper around cairo_font_options_get_hint_metrics(). +func (o *FontOptions) HintMetrics() HintMetrics { + return HintMetrics(C.cairo_font_options_get_hint_metrics(o.native)) +} + +// GetVariations is a wrapper around cairo_font_options_get_variations(). +func (o *FontOptions) Variations() string { + return C.GoString(C.cairo_font_options_get_variations(o.native)) +} + +// SetVariations is a wrapper around cairo_font_options_set_variations(). +func (o *FontOptions) SetVariations(variations string) { + var cvariations *C.char + if variations != "" { + cvariations = C.CString(variations) + // Cairo will call strdup on its own. + defer C.free(unsafe.Pointer(cvariations)) + } + + C.cairo_font_options_set_variations(o.native, cvariations) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/format.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/format.go new file mode 100644 index 00000000..748d978d --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/format.go @@ -0,0 +1,33 @@ +package cairo + +// #include +// #include +// #include +import "C" +import ( + "unsafe" +) + +// Format is a representation of Cairo's cairo_format_t. +type Format int + +const ( + FormatInvalid Format = C.CAIRO_FORMAT_INVALID + FormatARGB32 Format = C.CAIRO_FORMAT_ARGB32 + FormatRGB24 Format = C.CAIRO_FORMAT_RGB24 + FormatA8 Format = C.CAIRO_FORMAT_A8 + FormatA1 Format = C.CAIRO_FORMAT_A1 + FormatRGB16_565 Format = C.CAIRO_FORMAT_RGB16_565 + FormatRGB30 Format = C.CAIRO_FORMAT_RGB30 +) + +func marshalFormat(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return Format(c), nil +} + +// FormatStrideForWidth is a wrapper for cairo_format_stride_for_width(). +func FormatStrideForWidth(format Format, width int) int { + c := C.cairo_format_stride_for_width(C.cairo_format_t(format), C.int(width)) + return int(c) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/linecap.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/linecap.go new file mode 100644 index 00000000..5b97fa2c --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/linecap.go @@ -0,0 +1,23 @@ +package cairo + +// #include +// #include +// #include +import "C" +import ( + "unsafe" +) + +// LineCap is a representation of Cairo's cairo_line_cap_t. +type LineCap int + +const ( + LineCapButt LineCap = C.CAIRO_LINE_CAP_BUTT + LineCapRound LineCap = C.CAIRO_LINE_CAP_ROUND + LineCapSquare LineCap = C.CAIRO_LINE_CAP_SQUARE +) + +func marshalLineCap(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return LineCap(c), nil +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/linejoin.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/linejoin.go new file mode 100644 index 00000000..a92e2fb1 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/linejoin.go @@ -0,0 +1,23 @@ +package cairo + +// #include +// #include +// #include +import "C" +import ( + "unsafe" +) + +// LineJoin is a representation of Cairo's cairo_line_join_t. +type LineJoin int + +const ( + LineJoinMiter LineJoin = C.CAIRO_LINE_JOIN_MITER + LineJoinRound LineJoin = C.CAIRO_LINE_JOIN_ROUND + LineJoinBevel LineJoin = C.CAIRO_LINE_JOIN_BEVEL +) + +func marshalLineJoin(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return LineJoin(c), nil +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/matrix.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/matrix.go new file mode 100644 index 00000000..a934df68 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/matrix.go @@ -0,0 +1,98 @@ +package cairo + +// #include +// #include +// #include +import "C" + +import ( + "unsafe" +) + +// Matrix struct +type Matrix struct { + Xx, Yx float64 + Xy, Yy float64 + X0, Y0 float64 +} + +// NewMatrix creates a new identiy matrix +func NewMatrix(xx, yx, xy, yy, x0, y0 float64) *Matrix { + return &Matrix{ + Xx: xx, + Yx: yx, + Xy: xy, + Yy: yy, + X0: x0, + Y0: y0, + } +} + +// Native returns native c pointer to a matrix +func (m *Matrix) native() *C.cairo_matrix_t { + return (*C.cairo_matrix_t)(unsafe.Pointer(m)) +} + +// Native returns native c pointer to a matrix +func (m *Matrix) Native() uintptr { + return uintptr(unsafe.Pointer(m.native())) +} + +// InitIdentity initializes this matrix to identity matrix +func (m *Matrix) InitIdentity() { + C.cairo_matrix_init_identity(m.native()) +} + +// InitTranslate initializes a matrix with the given translation +func (m *Matrix) InitTranslate(tx, ty float64) { + C.cairo_matrix_init_translate(m.native(), C.double(tx), C.double(ty)) +} + +// InitScale initializes a matrix with the give scale +func (m *Matrix) InitScale(sx, sy float64) { + C.cairo_matrix_init_scale(m.native(), C.double(sx), C.double(sy)) +} + +// InitRotate initializes a matrix with the given rotation +func (m *Matrix) InitRotate(radians float64) { + C.cairo_matrix_init_rotate(m.native(), C.double(radians)) +} + +// Translate translates a matrix by the given amount +func (m *Matrix) Translate(tx, ty float64) { + C.cairo_matrix_translate(m.native(), C.double(tx), C.double(ty)) +} + +// Scale scales the matrix by the given amounts +func (m *Matrix) Scale(sx, sy float64) { + C.cairo_matrix_scale(m.native(), C.double(sx), C.double(sy)) +} + +// Rotate rotates the matrix by the given amount +func (m *Matrix) Rotate(radians float64) { + C.cairo_matrix_rotate(m.native(), C.double(radians)) +} + +// Invert inverts the matrix +func (m *Matrix) Invert() { + C.cairo_matrix_invert(m.native()) +} + +// Multiply multiplies the matrix by another matrix +func (m *Matrix) Multiply(a, b Matrix) { + C.cairo_matrix_multiply(m.native(), a.native(), b.native()) +} + +// TransformDistance ... +func (m *Matrix) TransformDistance(dx, dy float64) (float64, float64) { + C.cairo_matrix_transform_distance(m.native(), + (*C.double)(unsafe.Pointer(&dx)), (*C.double)(unsafe.Pointer(&dy))) + return dx, dy +} + +// TransformPoint ... +func (m *Matrix) TransformPoint(x, y float64) (float64, float64) { + C.cairo_matrix_transform_point(m.native(), + (*C.double)(unsafe.Pointer(&x)), (*C.double)(unsafe.Pointer(&y))) + return x, y +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/mimetype.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/mimetype.go new file mode 100644 index 00000000..1652a180 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/mimetype.go @@ -0,0 +1,13 @@ +package cairo + +// MimeType is a representation of Cairo's CAIRO_MIME_TYPE_* +// preprocessor constants. +type MimeType string + +const ( + MIMETypeJP2 MimeType = "image/jp2" + MIMETypeJPEG MimeType = "image/jpeg" + MIMETypePNG MimeType = "image/png" + MIMETypeURI MimeType = "image/x-uri" + MIMETypeUniqueID MimeType = "application/x-cairo.uuid" +) diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/operator.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/operator.go new file mode 100644 index 00000000..9c3297e9 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/operator.go @@ -0,0 +1,49 @@ +package cairo + +// #include +// #include +// #include +import "C" +import ( + "unsafe" +) + +// Operator is a representation of Cairo's cairo_operator_t. +type Operator int + +const ( + OperatorClear Operator = C.CAIRO_OPERATOR_CLEAR + OperatorSource Operator = C.CAIRO_OPERATOR_SOURCE + OperatorOver Operator = C.CAIRO_OPERATOR_OVER + OperatorIn Operator = C.CAIRO_OPERATOR_IN + OperatorOut Operator = C.CAIRO_OPERATOR_OUT + OperatorAtop Operator = C.CAIRO_OPERATOR_ATOP + OperatorDest Operator = C.CAIRO_OPERATOR_DEST + OperatorDestOver Operator = C.CAIRO_OPERATOR_DEST_OVER + OperatorDestIn Operator = C.CAIRO_OPERATOR_DEST_IN + OperatorDestOut Operator = C.CAIRO_OPERATOR_DEST_OUT + OperatorDestAtop Operator = C.CAIRO_OPERATOR_DEST_ATOP + OperatorXOR Operator = C.CAIRO_OPERATOR_XOR + OperatorAdd Operator = C.CAIRO_OPERATOR_ADD + OperatorSaturate Operator = C.CAIRO_OPERATOR_SATURATE + OperatorMultiply Operator = C.CAIRO_OPERATOR_MULTIPLY + OperatorScreen Operator = C.CAIRO_OPERATOR_SCREEN + OperatorOverlay Operator = C.CAIRO_OPERATOR_OVERLAY + OperatorDarken Operator = C.CAIRO_OPERATOR_DARKEN + OperatorLighten Operator = C.CAIRO_OPERATOR_LIGHTEN + OperatorColorDodge Operator = C.CAIRO_OPERATOR_COLOR_DODGE + OperatorColorBurn Operator = C.CAIRO_OPERATOR_COLOR_BURN + OperatorHardLight Operator = C.CAIRO_OPERATOR_HARD_LIGHT + OperatorSoftLight Operator = C.CAIRO_OPERATOR_SOFT_LIGHT + OperatorDifference Operator = C.CAIRO_OPERATOR_DIFFERENCE + OperatorExclusion Operator = C.CAIRO_OPERATOR_EXCLUSION + OperatorHSLHue Operator = C.CAIRO_OPERATOR_HSL_HUE + OperatorHSLSaturation Operator = C.CAIRO_OPERATOR_HSL_SATURATION + OperatorHSLColor Operator = C.CAIRO_OPERATOR_HSL_COLOR + OperatorHSLLuminosity Operator = C.CAIRO_OPERATOR_HSL_LUMINOSITY +) + +func marshalOperator(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return Operator(c), nil +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/pattern.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/pattern.go new file mode 100644 index 00000000..0733a0f2 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/pattern.go @@ -0,0 +1,139 @@ +package cairo + +// #include +// #include +// #include +import "C" + +import ( + "runtime" + "unsafe" +) + +//--------------------------------------------[ cairo_pattern_t == Pattern ]-- + +// Filter is a representation of Cairo's cairo_filter_t. +type Filter int + +const ( + FilterFast Filter = C.CAIRO_FILTER_FAST + FilterGood Filter = C.CAIRO_FILTER_GOOD + FilterBest Filter = C.CAIRO_FILTER_BEST + FilterNearest Filter = C.CAIRO_FILTER_NEAREST + FilterBilinear Filter = C.CAIRO_FILTER_BILINEAR + FilterGaussian Filter = C.CAIRO_FILTER_GAUSSIAN +) + +func marshalFilter(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return Filter(c), nil +} + +// Pattern is a representation of Cairo's cairo_pattern_t. +type Pattern struct { + pattern *C.cairo_pattern_t +} + +// NewPatternFromRGB is a wrapper around cairo_pattern_create_rgb(). +func NewPatternFromRGB(red, green, blue float64) (*Pattern, error) { + c := C.cairo_pattern_create_rgb(C.double(red), C.double(green), C.double(blue)) + return newPatternFromNative(c) +} + +// NewPatternFromRGBA is a wrapper around cairo_pattern_create_rgba(). +func NewPatternFromRGBA(red, green, blue, alpha float64) (*Pattern, error) { + c := C.cairo_pattern_create_rgba(C.double(red), C.double(green), C.double(blue), C.double(alpha)) + return newPatternFromNative(c) +} + +// NewPatternForSurface is a wrapper around cairo_pattern_create_for_surface(). +func NewPatternForSurface(s *Surface) (*Pattern, error) { + c := C.cairo_pattern_create_for_surface(s.native()) + return newPatternFromNative(c) +} + +// NewPatternLinear is a wrapper around cairo_pattern_create_linear(). +func NewPatternLinear(x0, y0, x1, y1 float64) (*Pattern, error) { + c := C.cairo_pattern_create_linear(C.double(x0), C.double(y0), C.double(x1), C.double(y1)) + return newPatternFromNative(c) +} + +// NewPatternRadial is a wrapper around cairo_pattern_create_radial(). +func NewPatternRadial(x0, y0, r0, x1, y1, r1 float64) (*Pattern, error) { + c := C.cairo_pattern_create_radial(C.double(x0), C.double(y0), C.double(r0), + C.double(x1), C.double(y1), C.double(r1)) + return newPatternFromNative(c) +} + +func newPatternFromNative(patternNative *C.cairo_pattern_t) (*Pattern, error) { + ptr := wrapPattern(patternNative) + e := ptr.Status().ToError() + if e != nil { + return nil, e + } + runtime.SetFinalizer(ptr, (*Pattern).destroy) + return ptr, nil +} + +// native returns a pointer to the underlying cairo_pattern_t. +func (v *Pattern) native() *C.cairo_pattern_t { + if v == nil { + return nil + } + return v.pattern +} + +// Native returns a pointer to the underlying cairo_pattern_t. +func (v *Pattern) Native() uintptr { + return uintptr(unsafe.Pointer(v.native())) +} + +func marshalPattern(p uintptr) (interface{}, error) { + c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) + pattern := (*C.cairo_pattern_t)(unsafe.Pointer(c)) + return wrapPattern(pattern), nil +} + +func wrapPattern(pattern *C.cairo_pattern_t) *Pattern { + return &Pattern{pattern} +} + +// reference is a wrapper around cairo_pattern_reference(). +func (v *Pattern) reference() { + v.pattern = C.cairo_pattern_reference(v.native()) +} + +// destroy is a wrapper around cairo_pattern_destroy(). +func (v *Pattern) destroy() { + C.cairo_pattern_destroy(v.native()) +} + +// Status is a wrapper around cairo_pattern_status(). +func (v *Pattern) Status() Status { + c := C.cairo_pattern_status(v.native()) + return Status(c) +} + +// AddColorStopRGB is a wrapper around cairo_pattern_add_color_stop_rgb(). +func (v *Pattern) AddColorStopRGB(offset, red, green, blue float64) error { + C.cairo_pattern_add_color_stop_rgb(v.native(), C.double(offset), + C.double(red), C.double(green), C.double(blue)) + return v.Status().ToError() +} + +// AddColorStopRGBA is a wrapper around cairo_pattern_add_color_stop_rgba(). +func (v *Pattern) AddColorStopRGBA(offset, red, green, blue, alpha float64) error { + C.cairo_pattern_add_color_stop_rgba(v.native(), C.double(offset), + C.double(red), C.double(green), C.double(blue), C.double(alpha)) + return v.Status().ToError() +} + +// PatternSetFilter is a wrapper around cairo_pattern_set_filter(). +func (v *Pattern) PatternSetFilter(filter Filter) { + C.cairo_pattern_set_filter(v.native(), C.cairo_filter_t(filter)) +} + +// PatternGetFilter is a wrapper around cairo_pattern_get_filter(). +func (v *Pattern) PatternGetFilter() Filter { + return Filter(C.cairo_pattern_get_filter(v.native())) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/region.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/region.go new file mode 100644 index 00000000..eaec1b68 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/region.go @@ -0,0 +1,381 @@ +// region.go + +package cairo + +// #include +// #include +import "C" + +import ( + "runtime" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/glib" +) + +func init() { + tm := []glib.TypeMarshaler{ + // Enums + {glib.Type(C.cairo_gobject_region_overlap_get_type()), marshalRegionOverlap}, + + // Boxed + {glib.Type(C.cairo_gobject_region_get_type()), marshalRegion}, + } + glib.RegisterGValueMarshalers(tm) +} + +// RegionOverlap is a representation of Cairo's cairo_region_overlap_t. +type RegionOverlap int + +const ( + RegionOverlapIn RegionOverlap = C.CAIRO_REGION_OVERLAP_IN + RegionOverlapOut RegionOverlap = C.CAIRO_REGION_OVERLAP_OUT + RegionOverlapPart RegionOverlap = C.CAIRO_REGION_OVERLAP_PART +) + +func marshalRegionOverlap(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return RegionOverlap(c), nil +} + +/* + * Rectangle + */ + +// Rectangle is a representation of Cairo's cairo_rectangle_int_t. +type Rectangle struct { + X, Y int + Width, Height int +} + +// commodity function to ceate Rectangle cairo object. +func RectangleNew(x, y, width, height int) *Rectangle { + r := new(Rectangle) + r.X = x + r.Y = y + r.Width = width + r.Height = height + return r +} + +func (v *Rectangle) native() *C.cairo_rectangle_int_t { + r := new(C.cairo_rectangle_int_t) + r.x = C.int(v.X) + r.y = C.int(v.Y) + r.width = C.int(v.Width) + r.height = C.int(v.Height) + return r +} + +func toRectangle(cr *C.cairo_rectangle_int_t) *Rectangle { + return &Rectangle{ + X: int(cr.x), Y: int(cr.y), + Width: int(cr.width), Height: int(cr.height)} +} + +/* + * Region + */ + +// Region is a representation of Cairo's cairo_region_t. +type Region struct { + region *C.cairo_region_t +} + +// native returns a pointer to the underlying cairo_region_t. +func (v *Region) native() *C.cairo_region_t { + if v == nil { + return nil + } + return v.region +} + +// Native returns a pointer to the underlying cairo_region_t. +func (v *Region) Native() uintptr { + return uintptr(unsafe.Pointer(v.native())) +} + +func marshalRegion(p uintptr) (interface{}, error) { + c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) + region := (*C.cairo_region_t)(unsafe.Pointer(c)) + return wrapRegion(region), nil +} + +func wrapRegion(region *C.cairo_region_t) *Region { + return &Region{region} +} + +// newRegionFromNative that handle finalizer. +func newRegionFromNative(regionNative *C.cairo_region_t) (*Region, error) { + ptr := wrapRegion(regionNative) + e := ptr.Status().ToError() + if e != nil { + return nil, e + } + runtime.SetFinalizer(ptr, (*Region).destroy) + return ptr, nil +} + +// RegionCreate is a wrapper around cairo_region_create(). +func RegionCreate() (*Region, error) { + + return newRegionFromNative(C.cairo_region_create()) +} + +// CreateRectangle is a wrapper around cairo_region_create_rectangle(). +func (v *Region) CreateRectangle(rectangle *Rectangle) (*Region, error) { + + return newRegionFromNative(C.cairo_region_create_rectangle( + rectangle.native())) +} + +// CreateRectangles is a wrapper around cairo_region_create_rectangles(). +func (v *Region) CreateRectangles(rectangles ...*Rectangle) (*Region, error) { + + length := len(rectangles) + + cRectangles := make([]C.cairo_rectangle_int_t, length) + + for i := 0; i < length; i++ { + cRectangles[i] = *rectangles[i].native() + } + + pRect := &cRectangles[0] + + return newRegionFromNative( + C.cairo_region_create_rectangles( + pRect, + C.int(length))) +} + +// Copy is a wrapper around cairo_region_copy(). +func (v *Region) Copy() (*Region, error) { + + return newRegionFromNative(C.cairo_region_copy(v.native())) +} + +// reference is a wrapper around cairo_region_reference(). +func (v *Region) reference() { + v.region = C.cairo_region_reference(v.native()) +} + +// destroy is a wrapper around cairo_region_destroy(). +func (v *Region) destroy() { + C.cairo_region_destroy(v.native()) +} + +// Status is a wrapper around cairo_region_status(). +func (v *Region) Status() Status { + c := C.cairo_region_status(v.native()) + return Status(c) +} + +// GetExtents is a wrapper around cairo_region_get_extents(). +func (v *Region) Extents(extents *Rectangle) { + + C.cairo_region_get_extents(v.native(), extents.native()) +} + +// NumRectangles is a wrapper around cairo_region_num_rectangles(). +func (v *Region) NumRectangles() int { + + return int(C.cairo_region_num_rectangles(v.native())) +} + +// GetRectangle is a wrapper around cairo_region_get_rectangle(). +func (v *Region) Rectangle(nth int) *Rectangle { + + cr := new(C.cairo_rectangle_int_t) + C.cairo_region_get_rectangle(v.native(), C.int(nth), cr) + + return toRectangle(cr) +} + +// IsEmpty is a wrapper around cairo_region_is_empty(). +func (v *Region) IsEmpty() bool { + + return gobool(C.cairo_region_is_empty(v.native())) +} + +// ContainsPoint is a wrapper around cairo_region_contains_point(). +func (v *Region) ContainsPoint(x, y int) bool { + + return gobool(C.cairo_region_contains_point( + v.native(), C.int(x), C.int(y))) +} + +// ContainsRectangle is a wrapper around cairo_region_contains_rectangle(). +func (v *Region) ContainsRectangle(rectangle *Rectangle) RegionOverlap { + + return RegionOverlap( + C.cairo_region_contains_rectangle( + v.native(), rectangle.native())) +} + +// Equal is a wrapper around cairo_region_equal(). +func (v *Region) Equal(region *Region) bool { + + return gobool(C.cairo_region_equal(v.native(), region.native())) +} + +// Translate is a wrapper around cairo_region_translate(). +func (v *Region) Translate(dx, dy int) { + + C.cairo_region_translate(v.native(), C.int(dx), C.int(dy)) +} + +// Intersect is a wrapper around cairo_region_intersect(). +// Note: contrary to the original statement, the source +// 'Region' remains preserved. +func (v *Region) Intersect(other *Region) (*Region, error) { + + dst, err := v.Copy() + if err != nil { + return nil, err + } + err = Status( + C.cairo_region_intersect( + dst.native(), + other.native())).ToError() + if err != nil { + return nil, err + } + + return dst, nil +} + +// IntersectRectangle is a wrapper around cairo_region_intersect_rectangle(). +// Note: contrary to the original statement, the source 'Region' remains preserved. +func (v *Region) IntersectRectangle(rectangle *Rectangle) (*Region, error) { + + dst, err := v.Copy() + if err != nil { + return nil, err + } + err = Status( + C.cairo_region_intersect_rectangle( + dst.native(), + rectangle.native())).ToError() + if err != nil { + return nil, err + } + + return dst, nil +} + +// Substract is a wrapper around cairo_region_subtract(). +// Note: contrary to the original statement, the source +// 'Region' remains preserved. +func (v *Region) Substract(other *Region) (*Region, error) { + + dst, err := v.Copy() + if err != nil { + return nil, err + } + err = Status( + C.cairo_region_subtract( + dst.native(), + other.native())).ToError() + if err != nil { + return nil, err + } + + return dst, nil +} + +// SubstractRectangle is a wrapper around cairo_region_subtract_rectangle(). +// Note: contrary to the original statement, the source 'Region' remains preserved. +func (v *Region) SubstractRectangle(rectangle *Rectangle) (*Region, error) { + + dst, err := v.Copy() + if err != nil { + return nil, err + } + err = Status( + C.cairo_region_subtract_rectangle( + dst.native(), + rectangle.native())).ToError() + if err != nil { + return nil, err + } + + return dst, nil +} + +// Union is a wrapper around cairo_region_union(). +// Note: contrary to the original statement, the source +// 'Region' remains preserved. +func (v *Region) Union(other *Region) (*Region, error) { + + dst, err := v.Copy() + if err != nil { + return nil, err + } + err = Status( + C.cairo_region_union( + dst.native(), + other.native())).ToError() + if err != nil { + return nil, err + } + + return dst, nil +} + +// UnionRectangle is a wrapper around cairo_region_union_rectangle(). +// Note: contrary to the original statement, the source 'Region' remains preserved. +func (v *Region) UnionRectangle(rectangle *Rectangle) (*Region, error) { + + dst, err := v.Copy() + if err != nil { + return nil, err + } + err = Status( + C.cairo_region_union_rectangle( + dst.native(), + rectangle.native())).ToError() + if err != nil { + return nil, err + } + + return dst, nil +} + +// Xor is a wrapper around cairo_region_xor(). +// Note: contrary to the original statement, the source +// 'Region' remains preserved. +func (v *Region) Xor(other *Region) (*Region, error) { + + dst, err := v.Copy() + if err != nil { + return nil, err + } + err = Status( + C.cairo_region_xor( + dst.native(), + other.native())).ToError() + if err != nil { + return nil, err + } + + return dst, nil +} + +// XorRectangle is a wrapper around cairo_region_xor_rectangle(). +// Note: contrary to the original statement, the source 'Region' remains preserved. +func (v *Region) XorRectangle(rectangle *Rectangle) (*Region, error) { + + dst, err := v.Copy() + if err != nil { + return nil, err + } + err = Status( + C.cairo_region_xor_rectangle( + dst.native(), + rectangle.native())).ToError() + if err != nil { + return nil, err + } + + return dst, nil +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/status.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/status.go new file mode 100644 index 00000000..f162fb91 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/status.go @@ -0,0 +1,126 @@ +package cairo + +// #include +// #include +// #include +import "C" +import ( + "strings" + "unsafe" +) + +// Status is a representation of Cairo's cairo_status_t. +type Status int + +const ( + StatusSuccess Status = C.CAIRO_STATUS_SUCCESS + StatusNoMemory Status = C.CAIRO_STATUS_NO_MEMORY + StatusInvalidRestore Status = C.CAIRO_STATUS_INVALID_RESTORE + StatusInvalidPopGroup Status = C.CAIRO_STATUS_INVALID_POP_GROUP + StatusNoCurrentPoint Status = C.CAIRO_STATUS_NO_CURRENT_POINT + StatusInvalidMatrix Status = C.CAIRO_STATUS_INVALID_MATRIX + StatusInvalidStatus Status = C.CAIRO_STATUS_INVALID_STATUS + StatusNullPointer Status = C.CAIRO_STATUS_NULL_POINTER + StatusInvalidString Status = C.CAIRO_STATUS_INVALID_STRING + StatusInvalidPathData Status = C.CAIRO_STATUS_INVALID_PATH_DATA + StatusReadError Status = C.CAIRO_STATUS_READ_ERROR + StatusWriteError Status = C.CAIRO_STATUS_WRITE_ERROR + StatusSurfaceFinished Status = C.CAIRO_STATUS_SURFACE_FINISHED + StatusSurfaceTypeMismatch Status = C.CAIRO_STATUS_SURFACE_TYPE_MISMATCH + StatusPatternTypeMismatch Status = C.CAIRO_STATUS_PATTERN_TYPE_MISMATCH + StatusInvalidContent Status = C.CAIRO_STATUS_INVALID_CONTENT + StatusInvalidFormat Status = C.CAIRO_STATUS_INVALID_FORMAT + StatusInvalidVisual Status = C.CAIRO_STATUS_INVALID_VISUAL + StatusFileNotFound Status = C.CAIRO_STATUS_FILE_NOT_FOUND + StatusInvalidDash Status = C.CAIRO_STATUS_INVALID_DASH + StatusInvalidDSCComment Status = C.CAIRO_STATUS_INVALID_DSC_COMMENT + StatusInvalidIndex Status = C.CAIRO_STATUS_INVALID_INDEX + StatusClipNotRepresentable Status = C.CAIRO_STATUS_CLIP_NOT_REPRESENTABLE + StatusTempFileError Status = C.CAIRO_STATUS_TEMP_FILE_ERROR + StatusInvalidStride Status = C.CAIRO_STATUS_INVALID_STRIDE + StatusFontTypeMismatch Status = C.CAIRO_STATUS_FONT_TYPE_MISMATCH + StatusUserFontImmutable Status = C.CAIRO_STATUS_USER_FONT_IMMUTABLE + StatusUserFontError Status = C.CAIRO_STATUS_USER_FONT_ERROR + StatusNegativeCount Status = C.CAIRO_STATUS_NEGATIVE_COUNT + StatusInvalidClusters Status = C.CAIRO_STATUS_INVALID_CLUSTERS + StatusInvalidSlant Status = C.CAIRO_STATUS_INVALID_SLANT + StatusInvalidWeight Status = C.CAIRO_STATUS_INVALID_WEIGHT + StatusInvalidSize Status = C.CAIRO_STATUS_INVALID_SIZE + StatusUserFontNotImplemented Status = C.CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED + StatusDeviceTypeMismatch Status = C.CAIRO_STATUS_DEVICE_TYPE_MISMATCH + StatusDeviceError Status = C.CAIRO_STATUS_DEVICE_ERROR + // STATUS_INVALID_MESH_CONSTRUCTION Status = C.CAIRO_STATUS_INVALID_MESH_CONSTRUCTION (since 1.12) + // STATUS_DEVICE_FINISHED Status = C.CAIRO_STATUS_DEVICE_FINISHED (since 1.12) +) + +var keyStatus = map[Status]string{ + StatusSuccess: "CAIRO_StatusSuccess", + StatusNoMemory: "CAIRO_STATUS_NO_MEMORY", + StatusInvalidRestore: "CAIRO_STATUS_INVALID_RESTORE", + StatusInvalidPopGroup: "CAIRO_STATUS_INVALID_POP_GROUP", + StatusNoCurrentPoint: "CAIRO_STATUS_NO_CURRENT_POINT", + StatusInvalidMatrix: "CAIRO_STATUS_INVALID_MATRIX", + StatusInvalidStatus: "CAIRO_STATUS_INVALID_STATUS", + StatusNullPointer: "CAIRO_STATUS_NULL_POINTER", + StatusInvalidString: "CAIRO_STATUS_INVALID_STRING", + StatusInvalidPathData: "CAIRO_STATUS_INVALID_PATH_DATA", + StatusReadError: "CAIRO_STATUS_READ_ERROR", + StatusWriteError: "CAIRO_STATUS_WRITE_ERROR", + StatusSurfaceFinished: "CAIRO_STATUS_SURFACE_FINISHED", + StatusSurfaceTypeMismatch: "CAIRO_STATUS_SURFACE_TYPE_MISMATCH", + StatusPatternTypeMismatch: "CAIRO_STATUS_PATTERN_TYPE_MISMATCH", + StatusInvalidContent: "CAIRO_STATUS_INVALID_CONTENT", + StatusInvalidFormat: "CAIRO_STATUS_INVALID_FORMAT", + StatusInvalidVisual: "CAIRO_STATUS_INVALID_VISUAL", + StatusFileNotFound: "CAIRO_STATUS_FILE_NOT_FOUND", + StatusInvalidDash: "CAIRO_STATUS_INVALID_DASH", + StatusInvalidDSCComment: "CAIRO_STATUS_INVALID_DSC_COMMENT", + StatusInvalidIndex: "CAIRO_STATUS_INVALID_INDEX", + StatusClipNotRepresentable: "CAIRO_STATUS_CLIP_NOT_REPRESENTABLE", + StatusTempFileError: "CAIRO_STATUS_TEMP_FILE_ERROR", + StatusInvalidStride: "CAIRO_STATUS_INVALID_STRIDE", + StatusFontTypeMismatch: "CAIRO_STATUS_FONT_TYPE_MISMATCH", + StatusUserFontImmutable: "CAIRO_STATUS_USER_FONT_IMMUTABLE", + StatusUserFontError: "CAIRO_STATUS_USER_FONT_ERROR", + StatusNegativeCount: "CAIRO_STATUS_NEGATIVE_COUNT", + StatusInvalidClusters: "CAIRO_STATUS_INVALID_CLUSTERS", + StatusInvalidSlant: "CAIRO_STATUS_INVALID_SLANT", + StatusInvalidWeight: "CAIRO_STATUS_INVALID_WEIGHT", + StatusInvalidSize: "CAIRO_STATUS_INVALID_SIZE", + StatusUserFontNotImplemented: "CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED", + StatusDeviceTypeMismatch: "CAIRO_STATUS_DEVICE_TYPE_MISMATCH", + StatusDeviceError: "CAIRO_STATUS_DEVICE_ERROR", +} + +func marshalStatus(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return Status(c), nil +} + +// String returns a readable status messsage usable in texts. +func (s Status) String() string { + str, ok := keyStatus[s] + if !ok { + str = "CAIRO_STATUS_UNDEFINED" + } + + str = strings.Replace(str, "CAIRO_STATUS_", "", 1) + str = strings.Replace(str, "_", " ", 0) + return strings.ToLower(str) +} + +// Error implements error. It calls String() unless s is StatusSuccess. +func (s Status) Error() string { + if s == StatusSuccess { + return "" + } + return s.String() +} + +// ToError returns the error for the status. Returns nil if success. +func (s Status) ToError() error { + if s == StatusSuccess { + return nil + } + return s +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/surface.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/surface.go new file mode 100644 index 00000000..e228351c --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/surface.go @@ -0,0 +1,307 @@ +package cairo + +// #include +// #include +// #include +// #include +// cairo_status_t _gotk4_cairo_write_func(void*, unsigned char*, unsigned int); +import "C" + +import ( + "io" + "runtime" + "sync" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gbox" +) + +/* + * cairo_surface_t + */ + +// Surface is a representation of Cairo's cairo_surface_t. +type Surface struct { + _ [0]sync.Mutex + surface *C.cairo_surface_t +} + +// CreatePDFSurface is a wrapper around cairo_pdf_surface_create(). +func CreatePDFSurface(fileName string, width float64, height float64) (*Surface, error) { + cstr := C.CString(fileName) + defer C.free(unsafe.Pointer(cstr)) + + surfaceNative := C.cairo_pdf_surface_create(cstr, C.double(width), C.double(height)) + + status := Status(C.cairo_surface_status(surfaceNative)) + if status != StatusSuccess { + return nil, status + } + + s := wrapSurface(surfaceNative) + + runtime.SetFinalizer(s, (*Surface).destroy) + + return s, nil +} + +// native returns a pointer to the underlying cairo_surface_t. +func (v *Surface) native() *C.cairo_surface_t { + if v == nil { + return nil + } + return v.surface +} + +// Native returns a pointer to the underlying cairo_surface_t. +func (v *Surface) Native() uintptr { + return uintptr(unsafe.Pointer(v.native())) +} + +func marshalSurface(p uintptr) (interface{}, error) { + c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) + return WrapSurface(uintptr(c)), nil +} + +func wrapSurface(surface *C.cairo_surface_t) *Surface { + return &Surface{surface: surface} +} + +// NewSurface creates a gotk3 cairo Surface from a pointer to a +// C cairo_surface_t. This is primarily designed for use with other +// gotk3 packages and should be avoided by applications. +func NewSurface(s uintptr, needsRef bool) *Surface { + surface := WrapSurface(s) + if needsRef { + surface.reference() + } + runtime.SetFinalizer(surface, (*Surface).destroy) + return surface +} + +func WrapSurface(s uintptr) *Surface { + ptr := (*C.cairo_surface_t)(unsafe.Pointer(s)) + return wrapSurface(ptr) +} + +// Closes the surface. The surface must not be used afterwards. +func (v *Surface) Close() { + v.destroy() +} + +// CreateSimilar is a wrapper around cairo_surface_create_similar(). +func (v *Surface) CreateSimilar(content Content, width, height int) *Surface { + c := C.cairo_surface_create_similar(v.native(), + C.cairo_content_t(content), C.int(width), C.int(height)) + s := wrapSurface(c) + runtime.SetFinalizer(s, (*Surface).destroy) + return s +} + +// TODO cairo_surface_create_similar_image (since 1.12) + +// CreateForRectangle is a wrapper around cairo_surface_create_for_rectangle(). +func (v *Surface) CreateForRectangle(x, y, width, height float64) *Surface { + c := C.cairo_surface_create_for_rectangle(v.native(), C.double(x), + C.double(y), C.double(width), C.double(height)) + s := wrapSurface(c) + runtime.SetFinalizer(s, (*Surface).destroy) + return s +} + +// reference is a wrapper around cairo_surface_reference(). +func (v *Surface) reference() { + v.surface = C.cairo_surface_reference(v.native()) +} + +// destroy is a wrapper around cairo_surface_destroy(). +func (v *Surface) destroy() { + if v.surface != nil { + C.cairo_surface_destroy(v.native()) + v.surface = nil + } +} + +// Status is a wrapper around cairo_surface_status(). +func (v *Surface) Status() Status { + c := C.cairo_surface_status(v.native()) + return Status(c) +} + +// Flush is a wrapper around cairo_surface_flush(). +func (v *Surface) Flush() { + C.cairo_surface_flush(v.native()) +} + +// TODO(jrick) Device (requires Device bindings) +// cairo_surface_get_device + +// TODO(jrick) FontOptions (require FontOptions bindings) +// cairo_surface_get_font_options + +// TODO(jrick) Content (requires Content bindings) +// cairo_surface_get_content + +// MarkDirty is a wrapper around cairo_surface_mark_dirty(). +func (v *Surface) MarkDirty() { + C.cairo_surface_mark_dirty(v.native()) +} + +// MarkDirtyRectangle is a wrapper around cairo_surface_mark_dirty_rectangle(). +func (v *Surface) MarkDirtyRectangle(x, y, width, height int) { + C.cairo_surface_mark_dirty_rectangle(v.native(), C.int(x), C.int(y), + C.int(width), C.int(height)) +} + +// SetDeviceOffset is a wrapper around cairo_surface_set_device_offset(). +func (v *Surface) SetDeviceOffset(x, y float64) { + C.cairo_surface_set_device_offset(v.native(), C.double(x), C.double(y)) +} + +// GetDeviceOffset is a wrapper around cairo_surface_get_device_offset(). +func (v *Surface) DeviceOffset() (x, y float64) { + var xOffset, yOffset C.double + C.cairo_surface_get_device_offset(v.native(), &xOffset, &yOffset) + return float64(xOffset), float64(yOffset) +} + +// SetFallbackResolution is a wrapper around +// cairo_surface_set_fallback_resolution(). +func (v *Surface) SetFallbackResolution(xPPI, yPPI float64) { + C.cairo_surface_set_fallback_resolution(v.native(), C.double(xPPI), + C.double(yPPI)) +} + +// GetFallbackResolution is a wrapper around cairo_surface_get_fallback_resolution(). +func (v *Surface) FallbackResolution() (xPPI, yPPI float64) { + var x, y C.double + C.cairo_surface_get_fallback_resolution(v.native(), &x, &y) + return float64(x), float64(y) +} + +// GetType is a wrapper around cairo_surface_get_type(). +func (v *Surface) Type() SurfaceType { + c := C.cairo_surface_get_type(v.native()) + return SurfaceType(c) +} + +// TODO(jrick) SetUserData (depends on UserDataKey and DestroyFunc) +// cairo_surface_set_user_data + +// TODO(jrick) UserData (depends on UserDataKey) +// cairo_surface_get_user_data + +// CopyPage is a wrapper around cairo_surface_copy_page(). +func (v *Surface) CopyPage() { + C.cairo_surface_copy_page(v.native()) +} + +// ShowPage is a wrapper around cairo_surface_show_page(). +func (v *Surface) ShowPage() { + C.cairo_surface_show_page(v.native()) +} + +// HasShowTextGlyphs is a wrapper around cairo_surface_has_show_text_glyphs(). +func (v *Surface) HasShowTextGlyphs() bool { + c := C.cairo_surface_has_show_text_glyphs(v.native()) + return gobool(c) +} + +// TODO(jrick) SetMimeData (depends on DestroyFunc) +// cairo_surface_set_mime_data + +// GetMimeData is a wrapper around cairo_surface_get_mime_data(). The +// returned mimetype data is returned as a Go byte slice. +func (v *Surface) MimeData(mimeType MimeType) []byte { + cstr := C.CString(string(mimeType)) + defer C.free(unsafe.Pointer(cstr)) + var data *C.uchar + var length C.ulong + C.cairo_surface_get_mime_data(v.native(), cstr, &data, &length) + return C.GoBytes(unsafe.Pointer(data), C.int(length)) +} + +// WriteToPNG is a wrapper around cairo_surface_write_png(). It writes the Cairo +// surface to the given file in PNG format. +func (v *Surface) WriteToPNG(fileName string) error { + cstr := C.CString(fileName) + defer C.free(unsafe.Pointer(cstr)) + + status := Status(C.cairo_surface_write_to_png(v.surface, cstr)) + + if status != StatusSuccess { + return status + } + + return nil +} + +type writerBox struct { + w io.Writer +} + +//export _gotk4_cairo_write_func +func _gotk4_cairo_write_func(userdata unsafe.Pointer, data *C.uchar, len C.uint) C.cairo_status_t { + wb, ok := gbox.Get(uintptr(unsafe.Pointer(userdata))).(writerBox) + if !ok { + return C.CAIRO_STATUS_WRITE_ERROR + } + + bytes := unsafe.Slice((*byte)(unsafe.Pointer(data)), uint(len)) + + _, err := wb.w.Write(bytes) + if err != nil { + return C.CAIRO_STATUS_WRITE_ERROR + } + + return C.CAIRO_STATUS_SUCCESS +} + +// WriteToPNGWriter is a wrapper around cairo_surface_write_png_stream(). It +// writes the Cairo surface to the given io.Writer in PNG format. +func (v *Surface) WriteToPNGWriter(w io.Writer) error { + dataptr := gbox.Assign(writerBox{w}) + defer gbox.Delete(dataptr) + + status := Status(C.cairo_surface_write_to_png_stream( + v.surface, + (*[0]byte)(C._gotk4_cairo_write_func), + unsafe.Pointer(dataptr), + )) + + if status != StatusSuccess { + return status + } + + return nil +} + +// TODO(jrick) SupportsMimeType (since 1.12) +// cairo_surface_supports_mime_type + +// TODO(jrick) MapToImage (since 1.12) +// cairo_surface_map_to_image + +// TODO(jrick) UnmapImage (since 1.12) +// cairo_surface_unmap_image + +// GetHeight is a wrapper around cairo_image_surface_get_height(). +func (v *Surface) Height() int { + return int(C.cairo_image_surface_get_height(v.surface)) +} + +// GetWidth is a wrapper around cairo_image_surface_get_width(). +func (v *Surface) Width() int { + return int(C.cairo_image_surface_get_width(v.surface)) +} + +// GetStride is a wrapper around cairo_image_surface_get_stride(). +func (v *Surface) Stride() int { + return int(C.cairo_image_surface_get_stride(v.surface)) +} + +// GetData is a wrapper around cairo_image_surface_get_data(). +func (v *Surface) Data() []byte { + ptr := unsafe.Pointer(C.cairo_image_surface_get_data(v.surface)) + return unsafe.Slice((*byte)(ptr), v.Height()*v.Stride()) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/surface_image.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/surface_image.go new file mode 100644 index 00000000..8057f56e --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/surface_image.go @@ -0,0 +1,116 @@ +package cairo + +// #include +// #include +// #include +// #include +import "C" + +import ( + "image" + "image/draw" + "runtime" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/cairo/swizzle" +) + +// CreatePNGSurface is a wrapper around cairo_image_surface_create_from_png(). +func CreatePNGSurfaceFromPNG(fileName string) (*Surface, error) { + cstr := C.CString(fileName) + defer C.free(unsafe.Pointer(cstr)) + + surfaceNative := C.cairo_image_surface_create_from_png(cstr) + + status := Status(C.cairo_surface_status(surfaceNative)) + if status != StatusSuccess { + return nil, status + } + + return &Surface{surface: surfaceNative}, nil +} + +// CreateImageSurfaceForData is a wrapper around cairo_image_surface_create_for_data(). +func CreateImageSurfaceForData(data []byte, format Format, width, height, stride int) *Surface { + surfaceNative := C.cairo_image_surface_create_for_data((*C.uchar)(unsafe.Pointer(&data[0])), + C.cairo_format_t(format), C.int(width), C.int(height), C.int(stride)) + + status := Status(C.cairo_surface_status(surfaceNative)) + if status != StatusSuccess { + panic("cairo_image_surface_create_for_data: " + status.Error()) + } + + s := wrapSurface(surfaceNative) + runtime.SetFinalizer(s, (*Surface).destroy) + + return s +} + +// CreateImageSurface is a wrapper around cairo_image_surface_create(). +func CreateImageSurface(format Format, width, height int) *Surface { + surfaceNative := C.cairo_image_surface_create(C.cairo_format_t(format), + C.int(width), C.int(height)) + + status := Status(C.cairo_surface_status(surfaceNative)) + if status != StatusSuccess { + panic("cairo_image_surface_create: " + status.Error()) + } + + s := wrapSurface(surfaceNative) + runtime.SetFinalizer(s, (*Surface).destroy) + + return s +} + +// CreateSurfaceFromImage is a better wrapper around cairo_image_surface_create_for_data(). +func CreateSurfaceFromImage(img image.Image) *Surface { + var s *Surface + + switch img := img.(type) { + case *image.RGBA: + s = CreateImageSurface(FormatARGB32, img.Rect.Dx(), img.Rect.Dy()) + pix := s.Data() + // Copy is pretty fast. Copy the RGBA data to the image directly. + copy(pix, img.Pix) + // Swizzle the RGBA bytes to the correct order. + swizzle.BGRA(pix) + + case *image.NRGBA: + s = CreateImageSurface(FormatARGB32, img.Rect.Dx(), img.Rect.Dy()) + + pix := s.Data() + // I'm not sure how slower this is than just doing a fast copy and + // calculate onto the malloc'd bytes, but since we're mostly doing + // calculations for each pixel, it likely doesn't matter. + for i := 0; i < len(pix); i += 4 { + alpha8 := img.Pix[i+3] + alpha16 := uint16(alpha8) + pix[i+0] = uint8(uint16(img.Pix[i+2]) * alpha16 / 0xFF) + pix[i+1] = uint8(uint16(img.Pix[i+1]) * alpha16 / 0xFF) + pix[i+2] = uint8(uint16(img.Pix[i+0]) * alpha16 / 0xFF) + pix[i+3] = alpha8 + } + + case *image.Alpha: + s = CreateImageSurface(FormatA8, img.Rect.Dx(), img.Rect.Dy()) + copy(s.Data(), img.Pix) + + default: + bounds := img.Bounds() + s = CreateImageSurface(FormatARGB32, bounds.Dx(), bounds.Dy()) + + // Create a new image.RGBA that uses the malloc'd byte array as the + // backing array, then draw directly on it. + rgba := image.RGBA{ + Pix: s.Data(), + Stride: bounds.Dx(), + Rect: bounds, + } + draw.Draw(&rgba, bounds, img, image.Point{}, draw.Over) + // The drawn result is in RGBA, so swizzle it to the right format. + swizzle.BGRA(rgba.Pix) + } + + s.MarkDirty() + return s +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/surfacetype.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/surfacetype.go new file mode 100644 index 00000000..205bb5be --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/surfacetype.go @@ -0,0 +1,45 @@ +package cairo + +// #include +// #include +// #include +import "C" +import ( + "unsafe" +) + +// SurfaceType is a representation of Cairo's cairo_surface_type_t. +type SurfaceType int + +const ( + SurfaceTypeImage SurfaceType = C.CAIRO_SURFACE_TYPE_IMAGE + SurfaceTypePDF SurfaceType = C.CAIRO_SURFACE_TYPE_PDF + SurfaceTypePS SurfaceType = C.CAIRO_SURFACE_TYPE_PS + SurfaceTypeXlib SurfaceType = C.CAIRO_SURFACE_TYPE_XLIB + SurfaceTypeXCB SurfaceType = C.CAIRO_SURFACE_TYPE_XCB + SurfaceTypeGlitz SurfaceType = C.CAIRO_SURFACE_TYPE_GLITZ + SurfaceTypeQuartz SurfaceType = C.CAIRO_SURFACE_TYPE_QUARTZ + SurfaceTypeWin32 SurfaceType = C.CAIRO_SURFACE_TYPE_WIN32 + SurfaceTypeBeOS SurfaceType = C.CAIRO_SURFACE_TYPE_BEOS + SurfaceTypeDirectFB SurfaceType = C.CAIRO_SURFACE_TYPE_DIRECTFB + SurfaceTypeSVG SurfaceType = C.CAIRO_SURFACE_TYPE_SVG + SurfaceTypeOS2 SurfaceType = C.CAIRO_SURFACE_TYPE_OS2 + SurfaceTypeWin32Printing SurfaceType = C.CAIRO_SURFACE_TYPE_WIN32_PRINTING + SurfaceTypeQuartzImage SurfaceType = C.CAIRO_SURFACE_TYPE_QUARTZ_IMAGE + SurfaceTypeScript SurfaceType = C.CAIRO_SURFACE_TYPE_SCRIPT + SurfaceTypeQt SurfaceType = C.CAIRO_SURFACE_TYPE_QT + SurfaceTypeRecording SurfaceType = C.CAIRO_SURFACE_TYPE_RECORDING + SurfaceTypeVG SurfaceType = C.CAIRO_SURFACE_TYPE_VG + SurfaceTypeGL SurfaceType = C.CAIRO_SURFACE_TYPE_GL + SurfaceTypeDRM SurfaceType = C.CAIRO_SURFACE_TYPE_DRM + SurfaceTypeTee SurfaceType = C.CAIRO_SURFACE_TYPE_TEE + SurfaceTypeXML SurfaceType = C.CAIRO_SURFACE_TYPE_XML + SurfaceTypeSKia SurfaceType = C.CAIRO_SURFACE_TYPE_SKIA + SurfaceTypeSubsurface SurfaceType = C.CAIRO_SURFACE_TYPE_SUBSURFACE + // SURFACE_TYPE_COGL SurfaceType = C.CAIRO_SURFACE_TYPE_COGL (since 1.12) +) + +func marshalSurfaceType(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return SurfaceType(c), nil +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/LICENSE b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/LICENSE new file mode 100644 index 00000000..6a66aea5 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_amd64.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_amd64.go new file mode 100644 index 00000000..55693ff2 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_amd64.go @@ -0,0 +1,17 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package swizzle + +// haveSSSE3 returns whether the CPU supports SSSE3 instructions (i.e. PSHUFB). +// +// Note that this is SSSE3, not SSE3. +func haveSSSE3() bool + +var useBGRA16 = haveSSSE3() + +const useBGRA4 = true + +func bgra16(p []byte) +func bgra4(p []byte) diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_amd64.s b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_amd64.s new file mode 100644 index 00000000..1c652802 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_amd64.s @@ -0,0 +1,76 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "textflag.h" + +// func haveSSSE3() bool +TEXT ·haveSSSE3(SB),NOSPLIT,$0 + MOVQ $1, AX + CPUID + SHRQ $9, CX + ANDQ $1, CX + MOVB CX, ret+0(FP) + RET + +// func bgra16(p []byte) +TEXT ·bgra16(SB),NOSPLIT,$0-24 + MOVQ p+0(FP), SI + MOVQ len+8(FP), DI + + // Sanity check that len is a multiple of 16. + MOVQ DI, AX + ANDQ $15, AX + JNZ done + + // Make the shuffle control mask (16-byte register X0) look like this, + // where the low order byte comes first: + // + // 02 01 00 03 06 05 04 07 0a 09 08 0b 0e 0d 0c 0f + // + // Load the bottom 8 bytes into X0, the top into X1, then interleave them + // into X0. + MOVQ $0x0704050603000102, AX + MOVQ AX, X0 + MOVQ $0x0f0c0d0e0b08090a, AX + MOVQ AX, X1 + PUNPCKLQDQ X1, X0 + + ADDQ SI, DI +loop: + CMPQ SI, DI + JEQ done + + MOVOU (SI), X1 + PSHUFB X0, X1 + MOVOU X1, (SI) + + ADDQ $16, SI + JMP loop +done: + RET + +// func bgra4(p []byte) +TEXT ·bgra4(SB),NOSPLIT,$0-24 + MOVQ p+0(FP), SI + MOVQ len+8(FP), DI + + // Sanity check that len is a multiple of 4. + MOVQ DI, AX + ANDQ $3, AX + JNZ done + + ADDQ SI, DI +loop: + CMPQ SI, DI + JEQ done + + MOVB 0(SI), AX + MOVB 2(SI), BX + MOVB BX, 0(SI) + MOVB AX, 2(SI) + + ADDQ $4, SI + JMP loop +done: + RET diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_common.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_common.go new file mode 100644 index 00000000..0825919f --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_common.go @@ -0,0 +1,31 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package swizzle provides functions for converting between RGBA pixel +// formats. +package swizzle + +// BGRA converts a pixel buffer between Go's RGBA and other systems' BGRA byte +// orders. +// +// It panics if the input slice length is not a multiple of 4. +func BGRA(p []byte) { + if len(p)%4 != 0 { + panic("input slice length is not a multiple of 4") + } + + // Use asm code for 16- or 4-byte chunks, if supported. + if useBGRA16 { + n := len(p) &^ (16 - 1) + bgra16(p[:n]) + p = p[n:] + } else if useBGRA4 { + bgra4(p) + return + } + + for i := 0; i < len(p); i += 4 { + p[i+0], p[i+2] = p[i+2], p[i+0] + } +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_other.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_other.go new file mode 100644 index 00000000..f1c2726e --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/swizzle/swizzle_other.go @@ -0,0 +1,16 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build !amd64 +// +build !amd64 + +package swizzle + +const ( + useBGRA16 = false + useBGRA4 = false +) + +func bgra16(p []byte) { panic("unreachable") } +func bgra4(p []byte) { panic("unreachable") } diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/text.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/text.go new file mode 100644 index 00000000..83df11b9 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/text.go @@ -0,0 +1,125 @@ +package cairo + +// #include +// #include +// #include +import "C" + +import ( + "unsafe" +) + +// FontSlant is a representation of Cairo's cairo_font_slant_t +type FontSlant int + +const ( + FontSlantNormal FontSlant = C.CAIRO_FONT_SLANT_NORMAL + FontSlantItalic FontSlant = C.CAIRO_FONT_SLANT_ITALIC + FontSlantOblique FontSlant = C.CAIRO_FONT_SLANT_OBLIQUE +) + +// FontWeight is a representation of Cairo's cairo_font_weight_t +type FontWeight int + +const ( + FontWeightNormal FontWeight = C.CAIRO_FONT_WEIGHT_NORMAL + FontWeightBold FontWeight = C.CAIRO_FONT_WEIGHT_BOLD +) + +func (v *Context) SelectFontFace(family string, slant FontSlant, weight FontWeight) { + cstr := C.CString(family) + defer C.free(unsafe.Pointer(cstr)) + C.cairo_select_font_face(v.native(), (*C.char)(cstr), C.cairo_font_slant_t(slant), C.cairo_font_weight_t(weight)) +} + +func (v *Context) SetFontSize(size float64) { + C.cairo_set_font_size(v.native(), C.double(size)) +} + +// TODO: cairo_set_font_matrix + +// TODO: cairo_get_font_matrix + +// TODO: cairo_set_font_options + +// TODO: cairo_get_font_options + +// TODO: cairo_set_font_face + +// TODO: cairo_get_font_face + +// TODO: cairo_set_scaled_font + +// TODO: cairo_get_scaled_font + +func (v *Context) ShowText(utf8 string) { + cstr := C.CString(utf8) + defer C.free(unsafe.Pointer(cstr)) + C.cairo_show_text(v.native(), (*C.char)(cstr)) +} + +// TODO: cairo_show_glyphs + +// TODO: cairo_show_text_glyphs + +type FontExtents struct { + Ascent float64 + Descent float64 + Height float64 + MaxXAdvance float64 + MaxYAdvance float64 +} + +func (v *Context) FontExtents() FontExtents { + var extents C.cairo_font_extents_t + C.cairo_font_extents(v.native(), &extents) + return FontExtents{ + Ascent: float64(extents.ascent), + Descent: float64(extents.descent), + Height: float64(extents.height), + MaxXAdvance: float64(extents.max_x_advance), + MaxYAdvance: float64(extents.max_y_advance), + } +} + +type TextExtents struct { + XBearing float64 + YBearing float64 + Width float64 + Height float64 + XAdvance float64 + YAdvance float64 +} + +func (v *Context) TextExtents(utf8 string) TextExtents { + cstr := C.CString(utf8) + defer C.free(unsafe.Pointer(cstr)) + var extents C.cairo_text_extents_t + C.cairo_text_extents(v.native(), (*C.char)(cstr), &extents) + return TextExtents{ + XBearing: float64(extents.x_bearing), + YBearing: float64(extents.y_bearing), + Width: float64(extents.width), + Height: float64(extents.height), + XAdvance: float64(extents.x_advance), + YAdvance: float64(extents.y_advance), + } +} + +// TODO: cairo_glyph_extents + +// TODO: cairo_toy_font_face_create + +// TODO: cairo_toy_font_face_get_family + +// TODO: cairo_toy_font_face_get_slant + +// TODO: cairo_toy_font_face_get_weight + +// TODO: cairo_glyph_allocate + +// TODO: cairo_glyph_free + +// TODO: cairo_text_cluster_allocate + +// TODO: cairo_text_cluster_free diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/translations.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/translations.go new file mode 100644 index 00000000..65896fda --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/translations.go @@ -0,0 +1,78 @@ +package cairo + +// #include +// #include +// #include +import "C" + +// Translate is a wrapper around cairo_translate. +func (v *Context) Translate(tx, ty float64) { + C.cairo_translate(v.native(), C.double(tx), C.double(ty)) +} + +// Scale is a wrapper around cairo_scale. +func (v *Context) Scale(sx, sy float64) { + C.cairo_scale(v.native(), C.double(sx), C.double(sy)) +} + +// Rotate is a wrapper around cairo_rotate. +func (v *Context) Rotate(angle float64) { + C.cairo_rotate(v.native(), C.double(angle)) +} + +// Transform is a wrapper around cairo_transform. +func (v *Context) Transform(matrix *Matrix) { + C.cairo_transform(v.native(), matrix.native()) +} + +// SetMatrix is a wrapper around cairo_set_matrix. +func (v *Context) SetMatrix(matrix *Matrix) { + C.cairo_set_matrix(v.native(), matrix.native()) +} + +// GetMatrix is a wrapper around cairo_get_matrix. +func (v *Context) Matrix() *Matrix { + var matrix C.cairo_matrix_t + C.cairo_get_matrix(v.native(), &matrix) + return &Matrix{ + Xx: float64(matrix.xx), + Yx: float64(matrix.yx), + Xy: float64(matrix.xy), + Yy: float64(matrix.yy), + X0: float64(matrix.x0), + Y0: float64(matrix.y0), + } +} + +// IdentityMatrix is a wrapper around cairo_identity_matrix(). +// +// Resets the current transformation matrix (CTM) by setting it equal to the +// identity matrix. That is, the user-space and device-space axes will be +// aligned and one user-space unit will transform to one device-space unit. +func (v *Context) IdentityMatrix() { + C.cairo_identity_matrix(v.native()) +} + +// UserToDevice is a wrapper around cairo_user_to_device. +func (v *Context) UserToDevice(x, y float64) (float64, float64) { + C.cairo_user_to_device(v.native(), (*C.double)(&x), (*C.double)(&y)) + return x, y +} + +// UserToDeviceDistance is a wrapper around cairo_user_to_device_distance. +func (v *Context) UserToDeviceDistance(dx, dy float64) (float64, float64) { + C.cairo_user_to_device_distance(v.native(), (*C.double)(&dx), (*C.double)(&dy)) + return dx, dy +} + +// DeviceToUser is a wrapper around cairo_device_to_user. +func (v *Context) DeviceToUser(x, y float64) (float64, float64) { + C.cairo_device_to_user(v.native(), (*C.double)(&x), (*C.double)(&y)) + return x, y +} + +// DeviceToUserDistance is a wrapper around cairo_device_to_user_distance. +func (v *Context) DeviceToUserDistance(x, y float64) (float64, float64) { + C.cairo_device_to_user_distance(v.native(), (*C.double)(&x), (*C.double)(&y)) + return x, y +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/cairo/util.go b/vendor/github.com/diamondburned/gotk4/pkg/cairo/util.go new file mode 100644 index 00000000..39adda79 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/cairo/util.go @@ -0,0 +1,20 @@ +package cairo + +// #include +// #include +// #include +import "C" + +func cairobool(b bool) C.cairo_bool_t { + if b { + return C.cairo_bool_t(1) + } + return C.cairo_bool_t(0) +} + +func gobool(b C.cairo_bool_t) bool { + if b != 0 { + return true + } + return false +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/LICENSE b/vendor/github.com/diamondburned/gotk4/pkg/core/LICENSE new file mode 100644 index 00000000..49575584 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2021 diamondburned + +Permission to use, copy, modify, and/or distribute this software for any purpose +with or without fee is hereby granted, provided that the above copyright notice +and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS +OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF +THIS SOFTWARE diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/closure/closure.go b/vendor/github.com/diamondburned/gotk4/pkg/core/closure/closure.go new file mode 100644 index 00000000..63b1ff9f --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/closure/closure.go @@ -0,0 +1,35 @@ +package closure + +import ( + "sync" + "unsafe" +) + +// Registry describes the local closure registry of each object. +type Registry struct { + reg sync.Map // unsafe.Pointer(*C.GClosure) -> *FuncStack +} + +// NewRegistry creates an empty closure registry. +func NewRegistry() *Registry { + return &Registry{} +} + +// Register registers the given GClosure callback. +func (r *Registry) Register(gclosure unsafe.Pointer, callback *FuncStack) { + r.reg.Store(uintptr(gclosure), callback) +} + +// Load loads the given GClosure's callback. Nil is returned if it's not found. +func (r *Registry) Load(gclosure unsafe.Pointer) *FuncStack { + fs, ok := r.reg.Load(uintptr(gclosure)) + if !ok { + return nil + } + return fs.(*FuncStack) +} + +// Delete deletes the given GClosure callback. +func (r *Registry) Delete(gclosure unsafe.Pointer) { + r.reg.Delete(uintptr(gclosure)) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/closure/funcstack.go b/vendor/github.com/diamondburned/gotk4/pkg/core/closure/funcstack.go new file mode 100644 index 00000000..1c405a2e --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/closure/funcstack.go @@ -0,0 +1,123 @@ +package closure + +import ( + "fmt" + "reflect" + "runtime" + "strconv" + "strings" +) + +// FrameSize is the number of frames that FuncStack should trace back from. +const FrameSize = 3 + +// FuncStack wraps a function value and provides function frames containing the +// caller trace for debugging. +type FuncStack struct { + Func interface{} + Frames [FrameSize]uintptr +} + +// NewFuncStack creates a new FuncStack. The given frameSkip is added 2, meaning +// the first frame from 0 will start from the caller of NewFuncStack. +func NewFuncStack(fn interface{}, frameSkip int) *FuncStack { + if reflect.TypeOf(fn).Kind() != reflect.Func { + panic("closure value is not a func") + } + + return newFuncStack(fn, frameSkip) +} + +func newFuncStack(fn interface{}, frameSkip int) *FuncStack { + fs := FuncStack{Func: fn} + runtime.Callers(frameSkip+3, fs.Frames[:]) + return &fs +} + +// NewIdleFuncStack works akin to NewFuncStack, but it also validates the given +// function type for the correct acceptable signatures for SourceFunc while also +// caching the checks. +func NewIdleFuncStack(fn interface{}, frameSkip int) *FuncStack { + switch fn.(type) { + case func(), func() bool: + return newFuncStack(fn, frameSkip) + + default: + fs := newFuncStack(fn, frameSkip) + fs.Panicf("unexpected func type %T, expected func() (error?)", fn) + } + + return nil +} + +// Func returns the function as a reflect.Value. +func (fs *FuncStack) Value() reflect.Value { + return reflect.ValueOf(fs.Func) +} + +// IsValid returns true if the given FuncStack is not a zero-value i.e. valid. +func (fs *FuncStack) IsValid() bool { + return fs != nil && fs.Frames != [FrameSize]uintptr{} +} + +// ValidFrames returns non-zero frames. +func (fs *FuncStack) ValidFrames() []uintptr { + if fs == nil { + return nil + } + + var i int + for i < FrameSize && fs.Frames[i] != 0 { + i++ + } + return fs.Frames[:i] +} + +const headerSignature = "closure error: " + +// Panicf panics with the given FuncStack printed to standard error. +func (fs *FuncStack) Panicf(msgf string, v ...interface{}) { + msg := strings.Builder{} + msg.WriteString(headerSignature) + fmt.Fprintf(&msg, msgf, v...) + + frames := runtime.CallersFrames(fs.ValidFrames()) + if frames == nil { + panic(msg.String()) + } + + msg.WriteString("\n\nClosure added at:") + for { + frame, more := frames.Next() + msg.WriteString("\n\t") + msg.WriteString(frame.Function) + msg.WriteString(" at ") + msg.WriteString(frame.File) + msg.WriteByte(':') + msg.WriteString(strconv.Itoa(frame.Line)) + + if !more { + break + } + } + + panic(msg.String()) +} + +// TryRepanic attempts to recover a panic. If successful, it will re-panic with +// the trace, or none if there is already one. +func (fs *FuncStack) TryRepanic() { + panicking := recover() + if panicking == nil { + return + } + + if msg, ok := panicking.(string); ok { + if strings.Contains(msg, headerSignature) { + // We can just repanic as-is. + panic(msg) + } + } + + fs.Panicf("unexpected panic caught: %v", panicking) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/gbox/box.go b/vendor/github.com/diamondburned/gotk4/pkg/core/gbox/box.go new file mode 100644 index 00000000..b9da0eff --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/gbox/box.go @@ -0,0 +1,118 @@ +package gbox + +// #cgo pkg-config: glib-2.0 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// extern void callbackDelete(guintptr _0); +import "C" + +import ( + "github.com/diamondburned/gotk4/pkg/core/slab" +) + +// Holy moly. This is unbelievable. It truly is unbelievable. I can't even +// believe myself. +// +// Check this out. C.gpointer is resolved to an unsafe.Pointer. That... sounds +// fine? I mean, a gpointer is a void*, so that checks out with the C specs. +// +// C functions usually take in a user_data parameter of type C.gpointer, which +// package gbox stores Go values by giving it an incremental ID and sending it +// to the function. This usually works, except the programs will randomly crash +// when we do this. +// +// What the hell? Why? It turns out that, because we cast a uintptr into a +// C.gpointer, we're effectively casting it to an unsafe.Pointer. As a result, +// Go will try to scan the pointer randomly, sees that it's not a pointer but is +// actually some wacky value, and panics. +// +// The real what-the-fuck here is why-the-fuck is it doing this to a C pointer? +// I guess for safety, but it seems so ridiculous to generate this kind of code. +// +// It turns out that this problem isn't unique to this library (or gotk3), nor +// was it a new issue. It also turns out that this is exactly what +// mattn/go-pointer is meant to work around, which is funny, because I've always +// thought it did what gbox did before. +// +// It also turns out that the new runtime/cgo package made this quite +// misleading. When you read the examples multiple times, you'll notice that +// they all use C.uintptr_t, not any other type. This is extremely important, +// because the fact that these functions use that type instead of void* means +// that they circumvent all checks. +// +// Now, we can take the easy way and do what mattn/go-pointer actually does: we +// allocate a pointer with nothing in it, and we use that pointer as the key. +// Cgo scans the pointer, sees that it's a valid pointer, and proceeds. +// +// OR, we can do it the stupid way. We can see what Go does to determine an +// invalid pointer and do some pointer trickery to fool it into believing we +// have a valid pointer. +// +// If you inspect the panic message caused by the runtime when it stumbles on +// the weird error, you'll see a runtime.adjustpointers routine in the trace. +// Inspecting the routine closer reveals this following snippet of code: +// +// if f.valid() && 0 < p && p < minLegalPointer && debug.invalidptr != 0 { +// // Looks like a junk value in a pointer slot. +// // Live analysis wrong? +// getg().m.traceback = 2 +// print("runtime: bad pointer in frame ", funcname(f), " at ", pp, ": ", hex(p), "\n") +// throw("invalid pointer found on stack") +// } +// +// The check should make this pretty obvious: one of the conditions are failing, +// causing the runtime to panic with the "invalid pointer found on stack" +// message. The upper part of the stack trace tells us that the address at p is +// 0x31, and the code is telling us that 0x31 is not a good value. +// +// To find out why, let's check what minLegalPointer is: +// +// ―❤―▶ grepr minLegalPointer +// ./malloc.go:316: // minLegalPointer is the smallest possible legal pointer. +// ./malloc.go:321: minLegalPointer uintptr = 4096 +// +// There we go! The returned value was 0x31, which is less than 4096, so the +// runtime trips on that and panics. Now, if we can just add up exactly that +// value, we can trick the runtime into thinking that it is, in fact, a valid +// pointer. Isn't that great? Surely this can't blow up when we reach a higher +// number. Who cares? +const minLegalPointer = 4096 + +var registry slab.Slab + +func init() { + registry.Grow(1024) +} + +// Assign assigns the given value and returns the fake pointer. +func Assign(v interface{}) uintptr { + return registry.Put(v, false) + minLegalPointer +} + +// AssignOnce stores the given value so that, when the value is retrieved, it +// will immediately be deleted. +func AssignOnce(v interface{}) uintptr { + return registry.Put(v, true) + minLegalPointer +} + +// Get gets the value from the given fake pointer. The context must match the +// given value in Assign. +func Get(ptr uintptr) interface{} { + return registry.Get(ptr - minLegalPointer) +} + +// Delete deletes a boxed value. It is exposed to C under the name +// "callbackDelete". +func Delete(ptr uintptr) { + registry.Delete(ptr - minLegalPointer) +} + +//export callbackDelete +func callbackDelete(ptr uintptr) { + registry.Delete(ptr - minLegalPointer) +} + +// Pop gets a value and deletes it atomically. +func Pop(ptr uintptr) interface{} { + return registry.Pop(ptr - minLegalPointer) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/gcancel/gcancel.go b/vendor/github.com/diamondburned/gotk4/pkg/core/gcancel/gcancel.go new file mode 100644 index 00000000..ffe7455e --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/gcancel/gcancel.go @@ -0,0 +1,202 @@ +// Package gcancel provides a converter between gio.Cancellable and +// context.Context. +package gcancel + +// #cgo pkg-config: gio-2.0 +// #include +import "C" + +import ( + "context" + "runtime" + "time" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/glib" +) + +type ctxKey uint8 + +const ( + _ ctxKey = iota + cancellableKey +) + +// Cancellable is a wrapper around the GCancellable object. It satisfies the +// context.Context interface. +type Cancellable struct { + *glib.Object + ctx context.Context + done <-chan struct{} +} + +var _ context.Context = (*Cancellable)(nil) + +// Cancel will set cancellable to cancelled. It is the same as calling the +// cancel callback given after context creation. +func (c *Cancellable) Cancel() { + // Save a Cgo call: if the channel is already closed, then ignore. + select { + case <-c.done: + return + default: + } + + defer runtime.KeepAlive(c.Object) + + if c.Object == nil { + panic("bug: Cancel called on nil Cancellable object") + } + + native := (*C.GCancellable)(unsafe.Pointer(c.Object.Native())) + C.g_cancellable_cancel(native) +} + +// IsCancelled checks if a cancellable job has been cancelled. +func (c *Cancellable) IsCancelled() bool { + // Fast paths: check the contexts, which will be closed by our goroutines. + + select { + case <-c.done: + return true + default: + } + + select { + case <-c.ctx.Done(): + return true + default: + } + + defer runtime.KeepAlive(c.Object) + + // nil obj == no cancellable. + if c.Object == nil { + return false + } + + native := (*C.GCancellable)(unsafe.Pointer(c.Object.Native())) + return C.g_cancellable_is_cancelled(native) != 0 +} + +// Deadline returns the deadline of the parent context. +func (c *Cancellable) Deadline() (time.Time, bool) { + return c.ctx.Deadline() +} + +// Value returns the values of the parent context. +func (c *Cancellable) Value(key interface{}) interface{} { + return c.ctx.Value(key) +} + +// Done returns the channel that's closed once the cancellable is cancelled. +func (c *Cancellable) Done() <-chan struct{} { + return c.done +} + +// Err returns context.Canceled if the cancellable is already cancelled, +// otherwise nil is returned. +func (c *Cancellable) Err() error { + if c.IsCancelled() { + return context.Canceled + } + return nil +} + +var nilCancellable = &Cancellable{ + Object: nil, + ctx: context.Background(), + done: nil, +} + +// CancellableFromContext gets the underlying Cancellable instance from the +// given context. If ctx does not contain the Cancellable instance, then a +// context with a nil Object field is returned. It is mostly for internal use; +// users should use WithCancel instead. +func GCancellableFromContext(ctx context.Context) *Cancellable { + if obj := fromContext(ctx, false); obj != nil { + return obj + } + return nilCancellable +} + +// NewCancellableContext creates a new context.Context from the given +// *GCancellable. If the pointer is nil, then context.Background() is used. +func NewCancellableContext(cancellable unsafe.Pointer) context.Context { + cval := (*C.GCancellable)(cancellable) + if cval == nil { + return context.Background() + } + + obj := &Cancellable{ + // TODO: query gbox for a Cancellable. + Object: glib.Take(cancellable), + ctx: context.Background(), + } + + done := make(chan struct{}) + obj.Connect("cancelled", func() { close(done) }) + obj.done = done + + return obj +} + +// WithCancel behaves similarly to context.WithCancel, except the created +// context is of type Cancellable. This is useful if the user wants to reuse the +// same Cancellable instance for multiple calls. +// +// This function costs a goroutine to do this unless the given context is +// previously created with WithCancel, is otherwise a Cancellable instance, or +// is an instance from context.Background() or context.TODO(), but it should be +// fairly cheap otherwise. +func WithCancel(ctx context.Context) (context.Context, context.CancelFunc) { + cancellable := fromContext(ctx, true) + return context.WithValue(cancellable, cancellableKey, cancellable), cancellable.Cancel +} + +func fromContext(ctx context.Context, create bool) *Cancellable { + if ctx == nil { + panic("given ctx is nil") + } + + // If the context is already a cancellable, then return that. + if v, ok := ctx.(*Cancellable); ok { + return v + } + + // If the context inherits a cancellable somewhere, then use it, but only if + // the Done channel is still the same as the context's. We don't want to + // mistakenly use the wrong channel. + v, ok := ctx.Value(cancellableKey).(*Cancellable) + if ok && ctx.Done() == v.done { + return v + } + + if !create { + return nil + } + + cancellable := &Cancellable{ + Object: glib.AssumeOwnership(unsafe.Pointer(C.g_cancellable_new())), + ctx: ctx, + } + + done := make(chan struct{}) + cancellable.Connect("cancelled", func() { close(done) }) + cancellable.done = done + + // Only need this if the parent context isn't Background. + if ctx != context.Background() && ctx != context.TODO() { + go cancelOnParent(ctx, done, cancellable) + } + + return cancellable +} + +func cancelOnParent(ctx context.Context, done chan struct{}, cancellable *Cancellable) { + select { + case <-ctx.Done(): + cancellable.Cancel() + case <-cancellable.done: + } +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/gdebug/gdebug.go b/vendor/github.com/diamondburned/gotk4/pkg/core/gdebug/gdebug.go new file mode 100644 index 00000000..47c90bbc --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/gdebug/gdebug.go @@ -0,0 +1,48 @@ +package gdebug + +import ( + "fmt" + "io" + "log" + "os" + "strings" +) + +var debug = strings.Split(os.Getenv("GOTK4_DEBUG"), ",") + +func HasKey(key string) bool { + for _, k := range debug { + if k == key { + return true + } + } + return false +} + +func NewDebugLogger(key string) *log.Logger { + if !HasKey(key) { + return log.New(io.Discard, "", 0) + } + return mustDebugLogger(key) +} + +func NewDebugLoggerNullable(key string) *log.Logger { + if !HasKey(key) { + return nil + } + return mustDebugLogger(key) +} + +func mustDebugLogger(name string) *log.Logger { + if HasKey("to-console") { + return log.Default() + } + + f, err := os.CreateTemp(os.TempDir(), fmt.Sprintf("gotk4-%s-%d-*", name, os.Getpid())) + if err != nil { + log.Panicln("cannot create temp", name, "file:", err) + } + + log.Println("gotk4: intern: enabled debug file at", f.Name()) + return log.New(f, "", log.LstdFlags) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/gerror/gerror.go b/vendor/github.com/diamondburned/gotk4/pkg/core/gerror/gerror.go new file mode 100644 index 00000000..17277844 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/gerror/gerror.go @@ -0,0 +1,149 @@ +package gerror + +// #cgo pkg-config: glib-2.0 gobject-introspection-1.0 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// #include +// #include +// #include +import "C" + +import ( + "reflect" + "sync" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/glib" + "golang.org/x/sync/singleflight" +) + +func init() { + glib.RegisterGValueMarshalers([]glib.TypeMarshaler{ + {T: glib.Type(C.g_error_get_type()), F: marshalGError}, + }) +} + +// GErrorCoder is an interface that returns a GError code. Errors may optionally +// implement this interface to override the default error code. +type GErrorCoder interface { + GErrorCode() int +} + +var ( + quarkMap sync.Map // reflect.Type -> uint32 + quarkFlight singleflight.Group +) + +// getQuark returns the quark associated with the given error. It registers the +// type of the given error using reflect. +func getQuark(err error) C.GQuark { + // This is actually very cheap. + typ := reflect.TypeOf(err) + + quark, ok := quarkMap.Load(typ) + if ok { + return C.GQuark(quark.(uint32)) + } + + var typeName string + + // cpu: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz + // BenchmarkReflectType-8 9097218 123.1 ns/op + + pkgPath := typ.PkgPath() + if pkgPath == "" { + typeName = typ.Name() + } else { + typeName = pkgPath + "." + typ.Name() + } + + quark, _, _ = quarkFlight.Do(pkgPath, func() (interface{}, error) { + // Allocate the quark string inside the singlefligth group, so the + // pointer is ensured to be the same for this type. This string must not + // be freed, since g_quark_from_static_string will use it directly. + quarkString := (*C.gchar)(C.CString(typeName)) + + // Immediately convert this to uint32, since I don't trust interfaces + // holding C types. + quark := uint32(C.g_quark_from_static_string(quarkString)) + quarkMap.Store(typ, quark) + + return quark, nil + }) + + return C.GQuark(quark.(uint32)) +} + +// New creates a new *C.GError from the given error. The caller is responsible +// for freeing the error with g_error_free(). +func New(err error) unsafe.Pointer { + if err == nil { + return nil + } + + var code int + if coder, ok := err.(GErrorCoder); ok { + code = coder.GErrorCode() + } + + errString := (*C.gchar)(C.CString(err.Error())) + defer C.free(unsafe.Pointer(errString)) + + return unsafe.Pointer(C.g_error_new_literal(getQuark(err), C.gint(code), errString)) +} + +// GError is converted from a C.GError to implement Go's error interface. +type GError struct { + quark uint32 + code int + err string +} + +func marshalGError(p uintptr) (interface{}, error) { + b := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) + return Copy(unsafe.Pointer(b)), nil +} + +// Quark returns the internal quark for the error. Callers that want this quark +// must manually type assert using their own interface. +func (err *GError) Quark() uint32 { + return err.quark +} + +func (err *GError) ErrorCode() int { + return err.code +} + +func (err *GError) Error() string { + return err.err +} + +// Take returns a new Go error from a *GError and frees the *GError. If the +// *GError is nil, then a nil error is returned. +func Take(gerror unsafe.Pointer) error { + if gerror == nil { + return nil + } + + v := (*C.GError)(gerror) + defer C.g_error_free(v) + + return newGError(v) +} + +// Copy return a new Go error from a *GError without freeing. +func Copy(gerror unsafe.Pointer) error { + if gerror == nil { + return nil + } + + return newGError((*C.GError)(gerror)) +} + +func newGError(v *C.GError) *GError { + return &GError{ + quark: uint32(v.domain), + code: int(v.code), + err: C.GoString(v.message), + } +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/gextras/gextras.go b/vendor/github.com/diamondburned/gotk4/pkg/core/gextras/gextras.go new file mode 100644 index 00000000..f52fa041 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/gextras/gextras.go @@ -0,0 +1,107 @@ +// Package gextras contains supplemental types to gotk3. +package gextras + +// #cgo pkg-config: glib-2.0 +// #include +// #include // HashTable +import "C" + +import ( + "unsafe" +) + +// ZeroString points to a null-terminated string of length 0. +var ZeroString unsafe.Pointer + +func init() { + ZeroString = unsafe.Pointer(C.malloc(1)) + *(*byte)(ZeroString) = 0 +} + +type record struct{ intern *internRecord } + +type internRecord struct{ c unsafe.Pointer } + +// StructNative returns the underlying C pointer of the given Go record struct +// pointer. It can be used like so: +// +// rec := NewRecord(...) // T = *Record +// c := (*namespace_record)(StructPtr(unsafe.Pointer(rec))) +func StructNative(ptr unsafe.Pointer) unsafe.Pointer { + return (*record)(ptr).intern.c +} + +// StructIntern returns the given struct's internal struct pointer. +func StructIntern(ptr unsafe.Pointer) *struct{ C unsafe.Pointer } { + return (*struct{ C unsafe.Pointer })(unsafe.Pointer((*record)(ptr).intern)) +} + +// SetStructNative sets the native value inside the Go struct value that the +// given dst pointer points to. It can be used like so: +// +// var rec Record +// SetStructNative(&rec, cvalue) // T(cvalue) = *namespace_record +func SetStructNative(dst, native unsafe.Pointer) { + (*record)(dst).intern.c = native +} + +// NewStructNative creates a new Go struct from the given native pointer. The +// finalizer is NOT set. +func NewStructNative(native unsafe.Pointer) unsafe.Pointer { + r := record{intern: &internRecord{native}} + return unsafe.Pointer(&r) +} + +// HashTableSize returns the size of the *GHashTable. +func HashTableSize(ptr unsafe.Pointer) int { + return int(C.g_hash_table_size((*C.GHashTable)(ptr))) +} + +// MoveHashTable calls f on every value of the given *GHashTable and frees each +// element in the process if rm is true. +func MoveHashTable(ptr unsafe.Pointer, rm bool, f func(k, v unsafe.Pointer)) { + var k, v C.gpointer + var iter C.GHashTableIter + C.g_hash_table_iter_init(&iter, (*C.GHashTable)(ptr)) + + for C.g_hash_table_iter_next(&iter, &k, &v) != 0 { + f(unsafe.Pointer(k), unsafe.Pointer(v)) + } + + if rm { + C.g_hash_table_unref((*C.GHashTable)(ptr)) + } +} + +// ListSize returns the length of the list. +func ListSize(ptr unsafe.Pointer) int { + return int(C.g_list_length((*C.GList)(ptr))) +} + +// MoveList calls f on every value of the given *GList. If rm is true, then the +// GList is freed. +func MoveList(ptr unsafe.Pointer, rm bool, f func(v unsafe.Pointer)) { + for v := (*C.GList)(ptr); v != nil; v = v.next { + f(unsafe.Pointer(v.data)) + } + + if rm { + C.g_list_free((*C.GList)(ptr)) + } +} + +// SListSize returns the length of the singly-linked list. +func SListSize(ptr unsafe.Pointer) int { + return int(C.g_slist_length((*C.GSList)(ptr))) +} + +// MoveSList is similar to MoveList, except it's used for singly-linked lists. +func MoveSList(ptr unsafe.Pointer, rm bool, f func(v unsafe.Pointer)) { + for v := (*C.GSList)(ptr); v != nil; v = v.next { + f(unsafe.Pointer(v.data)) + } + + if rm { + C.g_slist_free((*C.GSList)(ptr)) + } +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/glib/connect.go b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/connect.go new file mode 100644 index 00000000..11ea312c --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/connect.go @@ -0,0 +1,74 @@ +//go:build !no_string_connect + +package glib + +// #include +// #include +// #include "glib.go.h" +import "C" +import ( + "runtime" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/closure" +) + +// Connect is a wrapper around g_signal_connect_closure(). f must be a function +// with at least one parameter matching the type it is connected to. +// +// It is optional to list the rest of the required types from GTK, as values +// that don't fit into the function parameter will simply be ignored; however, +// extraneous types will trigger a runtime panic. Arguments for f must be a +// matching Go equivalent type for the C callback, or an interface type which +// the value may be packed in. If the type is not suitable, a runtime panic will +// occur when the signal is emitted. +func (v *Object) Connect(detailedSignal string, f interface{}) SignalHandle { + return v.connectClosure(false, detailedSignal, f) +} + +// ConnectAfter is a wrapper around g_signal_connect_closure(). The difference +// between Connect and ConnectAfter is that the latter will be invoked after the +// default handler, not before. For more information, refer to Connect. +func (v *Object) ConnectAfter(detailedSignal string, f interface{}) SignalHandle { + return v.connectClosure(true, detailedSignal, f) +} + +func (v *Object) connectClosure(after bool, detailedSignal string, f interface{}) SignalHandle { + fs := closure.NewFuncStack(f, 2) + + cstr := C.CString(detailedSignal) + defer C.free(unsafe.Pointer(cstr)) + + gclosure := closureNew(v, fs) + c := C.g_signal_connect_closure(C.gpointer(v.Native()), (*C.gchar)(cstr), gclosure, gbool(after)) + + runtime.KeepAlive(v) + + return SignalHandle(c) +} + +// NewClosure creates a new closure for the given object. +func NewClosure(v *Object, f interface{}) unsafe.Pointer { + return unsafe.Pointer(closureNew(v, f)) +} + +// closureNew creates a new GClosure that's bound to the current object and adds +// its callback function to the internal registry. It's exported for visibility +// to other gotk3 packages and should not be used in a regular application. +func closureNew(v *Object, f interface{}) *C.GClosure { + fs, ok := f.(*closure.FuncStack) + if !ok { + fs = closure.NewFuncStack(f, 2) + } + + gclosure := C.g_closure_new_simple(C.sizeof_GClosure, nil) + + closures := v.box.Closures() + closures.Register(unsafe.Pointer(gclosure), fs) + + C.g_object_watch_closure(v.native(), gclosure) + C.g_closure_set_meta_marshal(gclosure, C.gpointer(v.Native()), (*[0]byte)(C._gotk4_goMarshal)) + C.g_closure_add_finalize_notifier(gclosure, C.gpointer(v.Native()), (*[0]byte)(C._gotk4_removeClosure)) + + return gclosure +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/glib/glib.go b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/glib.go new file mode 100644 index 00000000..2ffb7267 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/glib.go @@ -0,0 +1,1723 @@ +// Package glib provides some hand-written GObject and GLib bindings. +package glib + +// #cgo pkg-config: gio-2.0 glib-2.0 gobject-2.0 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// #include +// #include +// #include +// #include +// #include "glib.go.h" +import "C" + +import ( + "errors" + "log" + "reflect" + "runtime" + "sync" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/closure" + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/intern" +) + +// GBool converts a Go bool to a GLib gboolean. +func GBool(b bool) C.gboolean { + if b { + return C.gboolean(1) + } + return C.gboolean(0) +} + +// Deprecated: use GBool. +func gbool(b bool) C.gboolean { + return GBool(b) +} + +// GoBool converts a GLib gboolean to a Go bool. +func GoBool(b C.gboolean) bool { + return b != 0 +} + +// Deprecated: use GoBool. +func gobool(b C.gboolean) bool { + return GoBool(b) +} + +// InitI18n initializes the i18n subsystem. It runs the following C code: +// +// setlocale(LC_ALL, ""); +// bindtextdomain(domain, dir); +// bind_textdomain_codeset(domain, "UTF-8"); +// textdomain(domain); +func InitI18n(domain, dir string) { + domainStr := C.CString(domain) + defer C.free(unsafe.Pointer(domainStr)) + + dirStr := C.CString(dir) + defer C.free(unsafe.Pointer(dirStr)) + + C.init_i18n(domainStr, dirStr) +} + +// Local localizes a string using gettext. +func Local(input string) string { + cstr := C.CString(input) + defer C.free(unsafe.Pointer(cstr)) + + return C.GoString(C.localize(cstr)) +} + +// Type is a representation of GLib's GType. +type Type uint + +const ( + TypeInvalid Type = C.G_TYPE_INVALID + TypeNone Type = C.G_TYPE_NONE + TypeInterface Type = C.G_TYPE_INTERFACE + TypeChar Type = C.G_TYPE_CHAR + TypeUchar Type = C.G_TYPE_UCHAR + TypeBoolean Type = C.G_TYPE_BOOLEAN + TypeInt Type = C.G_TYPE_INT + TypeUint Type = C.G_TYPE_UINT + TypeLong Type = C.G_TYPE_LONG + TypeUlong Type = C.G_TYPE_ULONG + TypeInt64 Type = C.G_TYPE_INT64 + TypeUint64 Type = C.G_TYPE_UINT64 + TypeEnum Type = C.G_TYPE_ENUM + TypeFlags Type = C.G_TYPE_FLAGS + TypeFloat Type = C.G_TYPE_FLOAT + TypeDouble Type = C.G_TYPE_DOUBLE + TypeString Type = C.G_TYPE_STRING + TypePointer Type = C.G_TYPE_POINTER + TypeBoxed Type = C.G_TYPE_BOXED + TypeParam Type = C.G_TYPE_PARAM + TypeObject Type = C.G_TYPE_OBJECT + TypeVariant Type = C.G_TYPE_VARIANT +) + +// FundamentalType returns the fundamental type of the given actual type. +func FundamentalType(actual Type) Type { + return Type(C._g_value_fundamental(C.GType(actual))) +} + +// IsValue checks whether the passed in type can be used for g_value_init(). +func (t Type) IsValue() bool { + return gobool(C._g_type_is_value(C.GType(t))) +} + +// Name is a wrapper around g_type_name(). +func (t Type) Name() string { + return C.GoString((*C.char)(C.g_type_name(C.GType(t)))) +} + +// String calls t.Name(). It satisfies fmt.Stringer. +func (t Type) String() string { + return t.Name() +} + +// Depth is a wrapper around g_type_depth(). +func (t Type) Depth() uint { + return uint(C.g_type_depth(C.GType(t))) +} + +// Parent is a wrapper around g_type_parent(). +func (t Type) Parent() Type { + return Type(C.g_type_parent(C.GType(t))) +} + +// Interfaces returns the interfaces of the given type. +func (t Type) Interfaces() []Type { + ifaces := t.interfaces() + if len(ifaces) > 0 { + defer C.free(unsafe.Pointer(&ifaces[0])) + return append([]Type(nil), ifaces...) + } + + return nil +} + +func (t Type) interfaces() []Type { + var n C.guint + c := C.g_type_interfaces(C.GType(t), &n) + + if n > 0 { + return unsafe.Slice((*Type)(unsafe.Pointer(c)), n) + } + + C.free(unsafe.Pointer(c)) + return nil +} + +// IsA is a wrapper around g_type_is_a(). +func (t Type) IsA(isAType Type) bool { + return gobool(C.g_type_is_a(C.GType(t), C.GType(isAType))) +} + +// TypeFromName is a wrapper around g_type_from_name(). +func TypeFromName(typeName string) Type { + cstr := (*C.gchar)(C.CString(typeName)) + defer C.free(unsafe.Pointer(cstr)) + + return Type(C.g_type_from_name(cstr)) +} + +// TypeNextBase is a wrapper around g_type_next_base. +func TypeNextBase(leafType, rootType Type) Type { + return Type(C.g_type_next_base(C.GType(leafType), C.GType(rootType))) +} + +// AnyClosure describes any function type. If AnyClosure does not contain a +// function type, the consumer function is allowed to panic. +type AnyClosure interface{} + +// GeneratedClosure boxes around any function value to be given to FuncStack. +// +// The user should never use this struct. The code generator should use it like +// so: +// +// obj.Connect("signal", externglib.GeneratedClosure{Func: v}) +// +// There are a few differences in behavior that we have to make in goMarshal(), +// and we want a clean way to differentiate manual Connect() calls with +// traditional closures and autogenerated ones that are far more consistent. +// +// Deprecated: this isn't used anywhere anymore. +type GeneratedClosure struct { + Func interface{} +} + +// _gotk4_goMarshal is called by the GLib runtime when a closure needs to be +// invoked. The closure will be invoked with as many arguments as it can take, +// from 0 to the full amount provided by the call. If the closure asks for more +// parameters than there are to give, then a runtime panic will occur. +// +//export _gotk4_goMarshal +func _gotk4_goMarshal( + gclosure *C.GClosure, + retValue *C.GValue, + nParams C.guint, + params *C.GValue, + invocationHint C.gpointer, + gobject *C.GObject) { + + // Get the function value associated with this callback closure. + box := intern.TryGet(unsafe.Pointer(gobject)) + if box == nil { + log.Printf( + "warning: object %s %v cannot be resurrected", + typeFromObject(unsafe.Pointer(gobject)), + unsafe.Pointer(gobject), + ) + return + } + + fs := box.Closures().Load(unsafe.Pointer(gclosure)) + if fs == nil { + log.Printf( + "warning: object %s %v missing closure %v", + typeFromObject(unsafe.Pointer(gobject)), + unsafe.Pointer(gobject), + unsafe.Pointer(gclosure), + ) + return + } + + fn := fs.Func + var skip int + + if box, ok := fn.(GeneratedClosure); ok { + fn = box.Func + skip++ + } + + // Fast path for an empty function. + if fn, ok := fn.(func()); ok { + fn() + return + } + + fsValue := reflect.ValueOf(fn) + fsType := fsValue.Type() + + // Get number of parameters passed in. + nGLibParams := int(nParams) + nTotalParams := nGLibParams + + // Reflect may panic, so we defer recover here to re-panic with our trace. + defer fs.TryRepanic() + + // Get number of parameters from the callback closure. If this exceeds + // the total number of marshaled parameters, trigger a runtime panic. + nCbParams := fsType.NumIn() + if nCbParams > nTotalParams { + fs.Panicf("too many closure args: have %d, max %d", nCbParams, nTotalParams) + } + + // Create a slice of reflect.Values as arguments to call the function. + gValues := unsafe.Slice(params, nGLibParams) + args := make([]reflect.Value, 0, nCbParams) + + // Fill beginning of args, up to the minimum of the total number of callback + // parameters and parameters from the glib runtime. + for i := skip; (i-skip) < nCbParams && i < nGLibParams; i++ { + val := goGValue(&gValues[i]) + + // Parameters that are descendants of GObject come wrapped in another + // GObject. For C applications, the default marshaller + // (g_cclosure_marshal_VOID__VOID in gmarshal.c in the GTK glib + // library) 'peeks' into the enclosing object and passes the wrapped + // object to the handler. Use the Object.Cast() function + // to emulate that for Go signal handlers. + switch v := val.(type) { + case *Object: + val = v.Cast() + case *Variant: + if g := v.GoValue(); g != nil { + val = g + } + } + + // Allow callbacks to omit the first type. + paramType := fsType.In(i - skip) + if i == 0 && !reflect.TypeOf(val).ConvertibleTo(paramType) { + // The first type does not match. Allow skipping this first + // parameter and try plugging again into the second one. + skip++ + // Ideally, we would have a function to check if the next type + // actually matches as well instead of this, but whatever. + continue + } + + rval := reflect.ValueOf(val) + rtyp := rval.Type() + if rtyp != paramType { + rval = rval.Convert(paramType) + } + + args = append(args, rval) + } + + // Call closure with args. If the callback returns one or more values, save + // the GValue equivalent of the first. + rv := fsValue.Call(args) + if retValue != nil && len(rv) > 0 { + gv := allocateValue() + gv.InitGoValue(rv[0].Interface()) + defer gv.unset() + + ok := C.g_value_transform(gv.native(), retValue) != 0 + + if !ok { + fs.Panicf( + "failed to transform return value from %s to %s", + gv.Type(), (&Value{&value{retValue}}).Type()) + } + } +} + +// Priority is the enumerated type for GLib priority event sources. +type Priority int + +const ( + PriorityHigh Priority = C.G_PRIORITY_HIGH + PriorityDefault Priority = C.G_PRIORITY_DEFAULT // TimeoutAdd + PriorityHighIdle Priority = C.G_PRIORITY_HIGH_IDLE + PriorityDefaultIdle Priority = C.G_PRIORITY_DEFAULT_IDLE // IdleAdd + PriorityLow Priority = C.G_PRIORITY_LOW +) + +type SourceHandle uint + +// _gotk4_sourceFunc is the callback for g_idle_add_full and g_timeout_add_full +// that replaces the GClosure API. +// +//export _gotk4_sourceFunc +func _gotk4_sourceFunc(data C.gpointer) C.gboolean { + fs, ok := gbox.Get(uintptr(data)).(*closure.FuncStack) + if !ok { + log.Println("warning: idle handler", data, "not found") + return C.FALSE + } + + defer fs.TryRepanic() + + var result bool + + switch f := fs.Func.(type) { + case func(): + f() + case func() bool: + result = f() + } + + if result { + return C.TRUE + } + + return C.FALSE +} + +//export _gotk4_removeSourceFunc +func _gotk4_removeSourceFunc(data C.gpointer) { + gbox.Delete(uintptr(data)) +} + +var ( + _sourceFunc = (*[0]byte)(C._gotk4_sourceFunc) + _removeSourceFunc = (*[0]byte)(C._gotk4_removeSourceFunc) +) + +// IdleAdd adds an idle source to the default main event loop context with the +// DefaultIdle priority. If f is not a function with no parameter, then IdleAdd +// will panic. +// +// After running once, the source func will be removed from the main event loop, +// unless f returns a single bool true. +func IdleAdd(f interface{}) SourceHandle { + return idleAdd(PriorityDefaultIdle, f) +} + +// IdleAddPriority adds an idle source to the default main event loop context +// with the given priority. Its behavior is the same as IdleAdd. +func IdleAddPriority(priority Priority, f interface{}) SourceHandle { + return idleAdd(priority, f) +} + +/* + Playing unsafe will get you in trouble... + + runtime: bad pointer in frame github.com/diamondburned/gotk4/pkg/core/glib.idleAdd.func1 at 0xc000e20e68: 0x87 + fatal error: invalid pointer found on stack +*/ + +//go:nosplit +func idleAdd(priority Priority, f interface{}) SourceHandle { + fs := closure.NewIdleFuncStack(f, 2) + id := gbox.Assign(fs) + h := C.g_idle_add_full(C.gint(priority), _sourceFunc, C.gpointer(id), _removeSourceFunc) + + return SourceHandle(h) +} + +// TimeoutAdd adds an timeout source to the default main event loop context. +// Timeout is in milliseconds. If f is not a function with no parameter, then it +// will panic. +// +// After running once, the source func will be removed from the main event loop, +// unless f returns a single bool true. +func TimeoutAdd(milliseconds uint, f interface{}) SourceHandle { + return timeoutAdd(milliseconds, false, PriorityDefault, f) +} + +// TimeoutAddPriority is similar to TimeoutAdd with the given priority. Refer to +// TimeoutAdd for more information. +func TimeoutAddPriority(milliseconds uint, priority Priority, f interface{}) SourceHandle { + return timeoutAdd(milliseconds, false, priority, f) +} + +// TimeoutSecondsAdd is similar to TimeoutAdd, except with seconds granularity. +func TimeoutSecondsAdd(seconds uint, f interface{}) SourceHandle { + return timeoutAdd(seconds, true, PriorityDefault, f) +} + +// TimeoutSecondsAddPriority adds a timeout source with the given priority. +// Refer to TimeoutSecondsAdd for more information. +func TimeoutSecondsAddPriority(seconds uint, priority Priority, f interface{}) SourceHandle { + return timeoutAdd(seconds, true, priority, f) +} + +//go:nosplit +//go:nocheckptr +func timeoutAdd(time uint, sec bool, priority Priority, f interface{}) SourceHandle { + fs := closure.NewIdleFuncStack(f, 2) + id := gbox.Assign(fs) + + var h C.guint + if sec { + h = C.g_timeout_add_seconds_full(C.gint(priority), C.guint(time), _sourceFunc, C.gpointer(id), _removeSourceFunc) + } else { + h = C.g_timeout_add_full(C.gint(priority), C.guint(time), _sourceFunc, C.gpointer(id), _removeSourceFunc) + } + + return SourceHandle(h) +} + +// SourceRemove is a wrapper around g_source_remove() +func SourceRemove(src SourceHandle) bool { + return gobool(C.g_source_remove(C.guint(src))) +} + +// WipeAllClosures wipes all the Go closures associated with the given object +// away. BE EXTREMELY CAREFUL WHEN USING THIS FUNCTION! If not careful, your +// program WILL crash! +// +// There is only one specific use case for this function: if your object has +// closures connected to it where these closures capture the object itself, then +// it might create a cyclic dependency on the GC, preventing its finalizer from +// ever running. This will cause the program to leak memory. As a temporary +// hack, this function is introduced for cases where the programmer knows for +// sure that the object will never be used again, and it is significant enough +// of a leak that having a workaround is better than not. +// +// Deprecated: this function is dangerous and should not be used. Using this +// function now causes a panic. +func WipeAllClosures(objector Objector) { + panic("WipeAllClosures is deprecated and should not be used") +} + +// Destroy destroys the Go reference to the given object. The object must not be +// used ever again; it is the caller's responsibility to ensure that it will +// never be used again. Resurrecting the object again is undefined behavior. +func Destroy(objector Objector) { + v := BaseObject(objector) + v.destroy() +} + +// SignalHandle is the ID of a signal handler. +type SignalHandle uint + +type generatedClosureData struct { + GObject uintptr + GClosure uintptr +} + +// ConnectGeneratedClosure connects the exported trampoline function and a Go +// closure (in f) to the given signal. +func ConnectGeneratedClosure( + obj Objector, + signal string, after bool, + tramp unsafe.Pointer, f interface{}) SignalHandle { + + fs, ok := f.(*closure.FuncStack) + if !ok { + fs = closure.NewFuncStack(f, 1) + } + + v := InternObject(obj) + data := &generatedClosureData{GObject: v.Native()} + + // Hold a weak reference mapping the object globally (per GClosure + // instance). + userData := C.gpointer(gbox.Assign(data)) + + gclosure := C.g_cclosure_new(C.GCallback(tramp), userData, (*[0]byte)(C._gotk4_removeGeneratedClosure)) + + // Hold the GClosure reference. + data.GClosure = uintptr(unsafe.Pointer(gclosure)) + + // Hold a strong reference mapping the Go closure to the object. + closures := v.box.Closures() + closures.Register(unsafe.Pointer(gclosure), fs) + + // Just in case. + C.g_object_watch_closure(v.native(), gclosure) + + // TODO: intern this. + csignal := (*C.gchar)(C.CString(signal)) + defer C.free(unsafe.Pointer(csignal)) + + id := C.g_signal_connect_closure(C.gpointer(v.native()), csignal, gclosure, gbool(after)) + + runtime.KeepAlive(obj) + return SignalHandle(id) +} + +// ConnectedGeneratedClosure returns the function from the given user_data +// pointer that's set by ConnectGeneratedClosure's GClosure instance. +func ConnectedGeneratedClosure(closureData uintptr) *closure.FuncStack { + data, _ := gbox.Get(closureData).(*generatedClosureData) + if data == nil { + return nil + } + + // Get the function value associated with this callback closure. + box := intern.TryGet(unsafe.Pointer(data.GObject)) + if box == nil { + log.Printf( + "gotk4: warning: object %s %v cannot be resurrected", + typeFromObject(unsafe.Pointer(data.GObject)), + unsafe.Pointer(data.GObject), + ) + return nil + } + + fs := box.Closures().Load(unsafe.Pointer(data.GClosure)) + if fs == nil { + log.Printf( + "gotk4: warning: object %s %v missing closure %v", + typeFromObject(unsafe.Pointer(data.GObject)), + unsafe.Pointer(data.GObject), + unsafe.Pointer(data.GClosure), + ) + return nil + } + + return fs +} + +//export _gotk4_removeClosure +func _gotk4_removeClosure(obj *C.GObject, gclosure *C.GClosure) { + box := intern.TryGet(unsafe.Pointer(obj)) + if box == nil { + return + } + + closures := box.Closures() + closures.Delete(unsafe.Pointer(gclosure)) +} + +//export _gotk4_removeGeneratedClosure +func _gotk4_removeGeneratedClosure(fnID C.guintptr, gclosure *C.GClosure) { + data, _ := gbox.Pop(uintptr(fnID)).(*generatedClosureData) + if data == nil { + return + } + _gotk4_removeClosure((*C.GObject)(unsafe.Pointer(data.GObject)), gclosure) +} + +// Objector is an interface that describes the Object type's methods. Only this +// package's Object types and types that embed it can satisfy this interface. +type Objector interface { + HandlerBlock(SignalHandle) + HandlerUnblock(SignalHandle) + HandlerDisconnect(SignalHandle) + + NotifyProperty(string, func()) SignalHandle + ObjectProperty(string) interface{} + SetObjectProperty(string, interface{}) + FreezeNotify() + ThawNotify() + StopEmission(string) + + baseObject() *Object +} + +var _ Objector = (*Object)(nil) + +// ObjectEq returns true if both obj1 and obj2 point to the same GObject +// pointers. +func ObjectEq(obj1, obj2 Objector) bool { + return obj1.baseObject().Eq(obj2) +} + +// Object is a representation of GLib's GObject. Object types cannot be +// compared; pointer comparisons must be done using the Eq method. +type Object struct { + _ [0]func() // equal guard + _ [0]sync.Mutex // copy guard + box *intern.Box +} + +// BaseObject gets the internal Object type. This is used for calling methods +// not in the Objector. +func BaseObject(obj Objector) *Object { + if obj == nil { + return nil + } + return obj.baseObject() +} + +// InternObject calls BaseObject. +// +// Deprecated: Use BaseObject. +func InternObject(obj Objector) *Object { + return BaseObject(obj) +} + +// Take wraps a unsafe.Pointer as a Object, taking ownership of it. +// This function is exported for visibility in other gotk3 packages and +// is not meant to be used by applications. +// +// To be clear, this should mostly be used when Gtk says "transfer none". Refer +// to AssumeOwnership for more details. +func Take(ptr unsafe.Pointer) *Object { + return newObject(ptr, true) +} + +// AssumeOwnership is similar to Take, except the function does not take a +// reference. This is usually used for newly constructed objects that for some +// reason does not have an initial floating reference. +// +// To be clear, this should often be used when Gtk says "transfer full", as it +// means the ownership is transferred to us (Go), so we can assume that much. +// This is in contrary to Take, which is used when Gtk says "transfer none", as +// we're now referencing an object that might possibly be kept by C, so we +// should take our own. +func AssumeOwnership(ptr unsafe.Pointer) *Object { + return newObject(ptr, false) +} + +// newObject creates a new Object from a GObject pointer with the finalizer set. +func newObject(ptr unsafe.Pointer, take bool) *Object { + if ptr == nil { + return nil + } + + return &Object{ + box: intern.Get(ptr, take), + } +} + +func (v *Object) destroy() { + intern.Free(v.box) +} + +// Cast casts v to the concrete Go type (e.g. *Object to *gtk.Entry). +// +//go:nosplit +//go:nocheckptr +func (v *Object) Cast() Objector { + if v.native() == nil { + // nil-typed interface != non-nil-typed nil-value interface + return nil + } + + var gvalue C.GValue + C.g_value_init_from_instance(&gvalue, C.gpointer(v.Native())) + + value := ValueFromNative(unsafe.Pointer(&gvalue)) + defer value.unset() + + // Note that if GoValue successfully unmarshaled into a nil object type, + // then the interface would actually be non-nil. + if gv := value.GoValue(); gv != nil && gv != InvalidValue { + return gv.(Objector) + } + + runtime.KeepAlive(v) + return v +} + +// CastType casts v to a concrete Go type that is associated with the given +// GType. +// +//go:nosplit +//go:nocheckptr +func (v *Object) CastType(gtype Type) Objector { + if v.native() == nil { + // nil-typed interface != non-nil-typed nil-value interface + return nil + } + + var gvalue C.GValue + C.g_value_init_from_instance(&gvalue, C.gpointer(v.Native())) + + value := ValueFromNative(unsafe.Pointer(&gvalue)) + defer value.unset() + + // Note that if GoValue successfully unmarshaled into a nil object type, + // then the interface would actually be non-nil. + if gv := value.GoValueAsType(gtype); gv != nil && gv != InvalidValue { + return gv.(Objector) + } + + runtime.KeepAlive(v) + return v +} + +// WalkCast is like Cast, except the user is walked through the object's entire +// inheritance tree as well as all its interfaces. This is used in the code +// generator for type assertions. +func (v *Object) WalkCast(f func(Objector) bool) (object Objector) { + if v.native() == nil { + return nil + } + + var gvalue C.GValue + C.g_value_init_from_instance(&gvalue, C.gpointer(v.Native())) + + value := ValueFromNative(unsafe.Pointer(&gvalue)) + defer value.unset() + + value.WalkGoValue(func(v interface{}) bool { + ob, ok := v.(Objector) + if !ok { + return false + } + + if f(ob) { + object = ob + return true + } + + return false + }) + + runtime.KeepAlive(v) + return +} + +func (v *Object) baseObject() *Object { + return v +} + +// native returns a pointer to the underlying GObject. +func (v *Object) native() *C.GObject { + if v == nil || v.box == nil { + return nil + } + return (*C.GObject)(v.box.GObject()) +} + +// Native returns a pointer to the underlying GObject. +func (v *Object) Native() uintptr { + return uintptr(unsafe.Pointer(v.native())) +} + +// Eq returns true if v's GObject pointer matches other's. +func (v *Object) Eq(other Objector) bool { + if other == nil && v.native() == nil { + return true + } + return v.native() == other.baseObject().native() +} + +// IsA is a wrapper around g_type_is_a(). +func (v *Object) IsA(typ Type) bool { + return gobool(C.g_type_is_a(C.GType(v.TypeFromInstance()), C.GType(typ))) +} + +// Type aliases to TypeFromInstance. +func (v *Object) Type() Type { + return v.TypeFromInstance() +} + +// TypeFromInstance is a wrapper around g_type_from_instance(). +func (v *Object) TypeFromInstance() Type { + t := typeFromObject(unsafe.Pointer(v.native())) + runtime.KeepAlive(v) + return t +} + +func typeFromObject(obj unsafe.Pointer) Type { + return Type(C._g_type_from_instance(C.gpointer(obj))) +} + +// StopEmission stops a signal’s current emission. It is a wrapper around +// g_signal_stop_emission_by_name(). +func (v *Object) StopEmission(s string) { + cstr := C.CString(s) + defer C.free(unsafe.Pointer(cstr)) + + C.g_signal_stop_emission_by_name((C.gpointer)(v.Native()), (*C.gchar)(cstr)) + runtime.KeepAlive(v) +} + +// PropertyType returns the Type of a property of the underlying GObject. If the +// property is missing, it will return TypeInvalid. +func (v *Object) PropertyType(name string) Type { + cstr := C.CString(name) + defer C.free(unsafe.Pointer(cstr)) + + return v.propertyType(cstr) +} + +func (v *Object) propertyType(cstr *C.gchar) Type { + paramSpec := C.g_object_class_find_property(C._g_object_get_class(v.native()), (*C.gchar)(cstr)) + runtime.KeepAlive(v) + + if paramSpec == nil { + return TypeInvalid + } + + return Type(paramSpec.value_type) +} + +// ObjectProperty is a wrapper around g_object_get_property(). If the property's +// type cannot be resolved to a Go type, then InvalidValue is returned. +func (v *Object) ObjectProperty(name string) interface{} { + cstr := C.CString(name) + defer C.free(unsafe.Pointer(cstr)) + + t := v.propertyType((*C.gchar)(cstr)) + if t == TypeInvalid { + return InvalidValue + } + + p := InitValue(t) + + C.g_object_get_property(v.native(), (*C.gchar)(cstr), p.native()) + runtime.KeepAlive(v) + + return p.GoValue() +} + +// SetObjectProperty is a wrapper around g_object_set_property(). +func (v *Object) SetObjectProperty(name string, value interface{}) { + cstr := C.CString(name) + defer C.free(unsafe.Pointer(cstr)) + + p := allocateValue() + p.InitGoValue(value) + defer p.unset() + + C.g_object_set_property(v.native(), (*C.gchar)(cstr), p.native()) + runtime.KeepAlive(v) +} + +// NotifyProperty adds a handler that's called when the object's property is +// updated. +func (v *Object) NotifyProperty(property string, f func()) SignalHandle { + return ConnectGeneratedClosure( + v, "notify::"+property, false, + unsafe.Pointer(C._gotk4_notifyHandlerTramp), f, + ) +} + +// FreezeNotify increases the freeze count on object. If the freeze count is +// non-zero, the emission of “notify” signals on object is stopped. The signals +// are queued until the freeze count is decreased to zero. Duplicate +// notifications are squashed so that at most one GObject::notify signal is +// emitted for each property modified while the object is frozen. +// +// This is necessary for accessors that modify multiple properties to prevent +// premature notification while the object is still being modified. +func (v *Object) FreezeNotify() { + C.g_object_freeze_notify(v.native()) + runtime.KeepAlive(v) +} + +// ThawNotify reverts the effect of a previous call to g_object_freeze_notify(). +// The freeze count is decreased on object and when it reaches zero, queued +// “notify” signals are emitted. +// +// Duplicate notifications for each property are squashed so that at most one +// GObject::notify signal is emitted for each property, in the reverse order in +// which they have been queued. +// +// It is an error to call this function when the freeze count is zero. +func (v *Object) ThawNotify() { + C.g_object_thaw_notify(v.native()) + runtime.KeepAlive(v) +} + +//export _gotk4_notifyHandlerTramp +func _gotk4_notifyHandlerTramp(obj C.gpointer, paramSpec C.gpointer, closureData C.guintptr) { + closure := ConnectedGeneratedClosure(uintptr(closureData)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f := closure.Func.(func()) + f() +} + +// Emit emits the signal specified by the string s to an Object. Arguments to +// callback functions connected to this signal must be specified in args. Emit +// returns an interface{} which must be type asserted to an equivalent Go type. +// The return value is the return value for the native C callback. +// +// Note that this code is unsafe in that the types of values in args are not +// checked against whether they are suitable for the callback. +func (v *Object) Emit(s string, args ...interface{}) interface{} { + cstr := C.CString(s) + defer C.free(unsafe.Pointer(cstr)) + + // Create array of this instance and arguments + valv := (*C.GValue)(C.calloc(C.sizeof_GValue, C.size_t(len(args)+1))) + defer C.free(unsafe.Pointer(valv)) + + // Add args and valv + val := allocateValue() + val.InitGoValue(v) + defer val.unset() + + C.val_list_insert(valv, C.int(0), val.native()) + + for i := range args { + val := allocateValue() + val.InitGoValue(args[i]) + defer val.unset() + + C.val_list_insert(valv, C.int(i+1), val.native()) + } + + t := v.TypeFromInstance() + // TODO: use just the signal name + id := C.g_signal_lookup((*C.gchar)(cstr), C.GType(t)) + if id == 0 { + log.Println("Emit: signal", s, "not found for object type", t) + return nil + } + + ret := allocateValue() + defer ret.unset() + + C.g_signal_emitv(valv, id, C.GQuark(0), ret.native()) + runtime.KeepAlive(v) + + return ret.GoValue() +} + +// HandlerBlock is a wrapper around g_signal_handler_block(). +func (v *Object) HandlerBlock(handle SignalHandle) { + C.g_signal_handler_block(C.gpointer(v.Native()), C.gulong(handle)) + runtime.KeepAlive(v) +} + +// HandlerUnblock is a wrapper around g_signal_handler_unblock(). +func (v *Object) HandlerUnblock(handle SignalHandle) { + C.g_signal_handler_unblock(C.gpointer(v.Native()), C.gulong(handle)) + runtime.KeepAlive(v) +} + +// HandlerDisconnect is a wrapper around g_signal_handler_disconnect(). +func (v *Object) HandlerDisconnect(handle SignalHandle) { + // Ensure that Gtk will not use the closure beforehand. + C.g_signal_handler_disconnect(C.gpointer(v.Native()), C.gulong(handle)) + runtime.KeepAlive(v) +} + +// InitiallyUnowned is a representation of GLib's GInitiallyUnowned. +type InitiallyUnowned struct { + *Object +} + +type initiallyUnownedor interface { + baseInitiallyUnowned() *InitiallyUnowned +} + +// baseInitiallyUnowned is similar to baseObject: it returns itself. This is +// used for subclassing; see go.go. +func (v *InitiallyUnowned) baseInitiallyUnowned() *InitiallyUnowned { + return v +} + +type invalidValueType struct{} + +var ( + // InvalidValue is returned from Value methods, such as GoValue, to indicate + // that the value obtained is invalid. + InvalidValue = invalidValueType{} +) + +// Value is a representation of GLib's GValue. +type Value struct { + *value +} + +type value struct { + gvalue *C.GValue +} + +func (v *value) unset() { + if v.isValue() { + C.g_value_unset(v.gvalue) + } + runtime.KeepAlive(v) +} + +func (v *value) isValue() bool { + b := gobool(C._g_is_value(v.gvalue)) + runtime.KeepAlive(v) + return b +} + +func marshalValue(p uintptr) (interface{}, error) { + c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) + if c == nil { + return nil, nil + } + + v := &value{(*C.GValue)(unsafe.Pointer(c))} + runtime.SetFinalizer(v, (*value).unset) + + return &Value{v}, nil +} + +var ( + mustHeap interface{} + never bool +) + +// allocateValue does not attach a finalizer. +func allocateValue() *Value { + gvalue := new(C.GValue) + if never { + // Force the value to be on the Go heap, because we don't want it on the + // stack. The compiler will likely throw it on the heap without this + // anyway, but we'd like to be careful. + mustHeap = gvalue + } + + v := &value{gvalue} + return &Value{v} +} + +// AllocateValue allocates a Value but does not initialize it. It sets a +// runtime finalizer to call g_value_unset() on the underlying GValue after +// leaving scope. +func AllocateValue() *Value { + v := allocateValue() + + //An allocated GValue is not guaranteed to hold a value that can be unset + //We need to double check before unsetting, to prevent: + //`g_value_unset: assertion 'G_IS_VALUE (value)' failed` + runtime.SetFinalizer(v.value, (*value).unset) + + return v +} + +// InitValue is a wrapper around g_value_init() and allocates and initializes a +// new Value with the Type t. A runtime finalizer is set to call g_value_unset() +// on the underlying GValue after leaving scope. ValueInit() returns a non-nil +// error if the allocation failed. +func InitValue(t Type) *Value { + v := AllocateValue() + v.Init(t) + return v +} + +// ValueFromNative returns a type-asserted pointer to the Value. It does not add +// a finalizer into the Value. This function should only be used for +// autogenerated bindings. +func ValueFromNative(l unsafe.Pointer) *Value { + return &Value{&value{(*C.GValue)(l)}} +} + +// NewValue converts a Go type to a comparable GValue. It will panic if the +// given type is unknown. Most Go primitive types and all Object types are +// supported. +func NewValue(v interface{}) *Value { + val := AllocateValue() + val.InitGoValue(v) + return val +} + +// goGValue is a convenient function that creates a Go value from the given +// GValue pointer. +func goGValue(cgvalue *C.GValue) interface{} { + return (&Value{&value{cgvalue}}).GoValue() +} + +func (v *Value) native() *C.GValue { + if v == nil || v.value == nil { + return nil + } + return v.value.gvalue +} + +// Native returns a pointer to the underlying GValue. +func (v *Value) Native() uintptr { + return uintptr(unsafe.Pointer(v.native())) +} + +// IsValue checks if value is a valid and initialized GValue structure. +func (v *Value) IsValue() bool { + return v.isValue() +} + +// TypeName gets the type name of value. +func (v *Value) TypeName() string { + s := C.GoString((*C.char)(C._g_value_type_name(v.native()))) + runtime.KeepAlive(v) + return s +} + +// Init initializes the Value to the given GType. It does nothing if the Value +// is already initialized. +func (v *Value) Init(gtype Type) { + if !v.IsValue() { + C.g_value_init(v.native(), C.GType(gtype)) + } + runtime.KeepAlive(v) +} + +// InitGoValue sets the Go value of the GValue. The GValue MUST NOT HAVE BEEN +// INITIALIED ALREADY! +func (v *Value) InitGoValue(goValue any) { + if goValue == nil { + v.Init(TypePointer) + v.SetPointer(uintptr(unsafe.Pointer(nil))) + return + } + + if newValuePrimitive(v, goValue) { + return + } + + if goValue == InvalidValue { + v.Init(TypeInvalid) + return + } + + // Try this since above doesn't catch constants under other types. + rval := reflect.Indirect(reflect.ValueOf(goValue)) + + var ok bool + switch rval.Kind() { + case reflect.Bool: + ok = newValuePrimitive(v, rval.Bool()) + case reflect.Int8: + ok = newValuePrimitive(v, int8(rval.Int())) + case reflect.Int32: + ok = newValuePrimitive(v, int32(rval.Int())) + case reflect.Int64: + ok = newValuePrimitive(v, int64(rval.Int())) + case reflect.Int: + ok = newValuePrimitive(v, int(rval.Int())) + case reflect.Uint8: + ok = newValuePrimitive(v, uint8(rval.Uint())) + case reflect.Uint32: + ok = newValuePrimitive(v, uint32(rval.Uint())) + case reflect.Uint64: + ok = newValuePrimitive(v, uint64(rval.Uint())) + case reflect.Uint: + ok = newValuePrimitive(v, uint(rval.Uint())) + case reflect.Float32: + ok = newValuePrimitive(v, float32(rval.Float())) + case reflect.Float64: + ok = newValuePrimitive(v, float64(rval.Float())) + case reflect.String: + ok = newValuePrimitive(v, rval.String()) + } + + if ok { + return + } + + log.Panicf("type %T not implemented", goValue) +} + +func newValuePrimitive(val *Value, v interface{}) bool { + switch e := v.(type) { + case *Value: + *val = *e + case bool: + val.Init(TypeBoolean) + val.SetBool(e) + case int8: + val.Init(TypeChar) + val.SetSchar(e) + case int32: + val.Init(TypeInt) // C int is 32-bit + val.SetInt(int(e)) + case int64: + val.Init(TypeInt64) + val.SetInt64(e) + case int: + val.Init(TypeInt64) + val.SetInt64(int64(e)) + case uint8: + val.Init(TypeUchar) + val.SetUchar(e) + case uint32: + val.Init(TypeUint) + val.SetUint(uint(e)) + case uint64: + val.Init(TypeUint64) + val.SetUint64(e) + case uint: + val.Init(TypeUint64) + val.SetUint64(uint64(e)) + case float32: + val.Init(TypeFloat) + val.SetFloat(e) + case float64: + val.Init(TypeDouble) + val.SetDouble(e) + case string: + val.Init(TypeString) + val.SetString(e) + case Objector: + val.Init(TypeObject) + val.SetObject(InternObject(e)) + default: + return false + } + return true +} + +// Type returns the Value's actual type. is a wrapper around the G_VALUE_TYPE() +// macro. It returns TYPE_INVALID if v does not hold a Type, or otherwise +// returns the Type of v. +// +// To get the fundamental type, use FundamentalType. +func (v *Value) Type() (actual Type) { + if v == nil || !v.IsValue() { + return TypeInvalid + } + actual = Type(C._g_value_type(v.native())) + runtime.KeepAlive(v) + return +} + +// CastObject casts the given object pointer to the Go concrete type. The caller +// is responsible for recasting the interface to the wanted type. +// +// Deprecated: Use obj.Cast() instead. +func CastObject(obj *Object) interface{} { + return obj.Cast() +} + +// GValueMarshaler is a marshal function to convert a GValue into an +// appropriate Go type. The uintptr parameter is a *C.GValue. +type GValueMarshaler func(uintptr) (interface{}, error) + +// TypeMarshaler represents an actual type and it's associated marshaler. +type TypeMarshaler struct { + T Type + F GValueMarshaler +} + +type marshalMap sync.Map + +var marshalers = new(marshalMap) + +// RegisterGValueMarshaler registers a single GValue marshaler. If the function +// has already been called before on the same Type, then it does nothing, and +// the new function is ignored. +func RegisterGValueMarshaler(t Type, f GValueMarshaler) { + (*sync.Map)(marshalers).LoadOrStore(t, f) +} + +// RegisterGValueMarshalers adds marshalers for several types to the internal +// marshalers map. Once registered, calling GoValue on any Value with a +// registered type will return the data returned by the marshaler. +func RegisterGValueMarshalers(marshalers []TypeMarshaler) { + for _, m := range marshalers { + RegisterGValueMarshaler(m.T, m.F) + } +} + +func init() { + RegisterGValueMarshaler(TypeInvalid, marshalInvalid) + RegisterGValueMarshaler(TypeNone, marshalNone) + RegisterGValueMarshaler(TypeInterface, marshalInterface) + RegisterGValueMarshaler(TypeChar, marshalChar) + RegisterGValueMarshaler(TypeUchar, marshalUchar) + RegisterGValueMarshaler(TypeBoolean, marshalBoolean) + RegisterGValueMarshaler(TypeInt, marshalInt) + RegisterGValueMarshaler(TypeLong, marshalLong) + RegisterGValueMarshaler(TypeEnum, marshalEnum) + RegisterGValueMarshaler(TypeInt64, marshalInt64) + RegisterGValueMarshaler(TypeUint, marshalUint) + RegisterGValueMarshaler(TypeUlong, marshalUlong) + RegisterGValueMarshaler(TypeFlags, marshalFlags) + RegisterGValueMarshaler(TypeUint64, marshalUint64) + RegisterGValueMarshaler(TypeFloat, marshalFloat) + RegisterGValueMarshaler(TypeDouble, marshalDouble) + RegisterGValueMarshaler(TypeString, marshalString) + RegisterGValueMarshaler(TypePointer, marshalPointer) + RegisterGValueMarshaler(TypeBoxed, marshalBoxed) + RegisterGValueMarshaler(TypeObject, marshalObject) + // RegisterGValueMarshaler(TypeVariant, marshalVariant) + RegisterGValueMarshaler(Type(C.g_value_get_type()), marshalValue) +} + +// lookup returns the closest available GValueMarshaler for the given value's +// type. +func (m *marshalMap) lookup(v *Value) GValueMarshaler { + typ := v.Type() + + // Check the inheritance tree for concrete classes up until TypeObject. + for t := typ; t != 0 && t != TypeObject; t = t.Parent() { + f, ok := m.lookupType(t) + if ok { + return f + } + } + + // Check the tree again for interfaces. + for t := typ; t != 0; t = t.Parent() { + if f := m.lookupIfaces(t); f != nil { + return f + } + } + + fundamental := FundamentalType(typ) + if f, ok := m.lookupType(fundamental); ok { + return f + } + + log.Printf("gotk4: missing marshaler for type %q (i.e. %q)", v.Type(), fundamental) + return nil +} + +// lookupWalk is like lookup, except the function walks the user through every +// single possible marshaler until it returns true. +func (m *marshalMap) lookupWalk(v *Value, testFn func(GValueMarshaler) bool) bool { + typ := v.Type() + + // Check the inheritance tree for concrete classes. + for t := typ; t != 0; t = t.Parent() { + f, ok := m.lookupType(t) + if ok { + if testFn(f) { + return true + } + } + } + + // Check the tree again for interfaces. + for t := typ; t != 0; t = t.Parent() { + if f := m.lookupIfaces(t); f != nil { + if testFn(f) { + return true + } + } + } + + fundamental := FundamentalType(typ) + if f, ok := m.lookupType(fundamental); ok { + if testFn(f) { + return true + } + } + + log.Printf("gotk4: missing marshaler for type %q (i.e. %q)", v.Type(), fundamental) + return false +} + +func (m *marshalMap) lookupIfaces(t Type) GValueMarshaler { + ifaces := t.interfaces() + if len(ifaces) > 0 { + defer C.free(unsafe.Pointer(&ifaces[0])) + } + + for _, t := range ifaces { + f, ok := m.lookupType(t) + if ok { + return f + } + } + + return nil +} + +func (m *marshalMap) lookupType(t Type) (GValueMarshaler, bool) { + v, ok := (*sync.Map)(m).Load(t) + if ok { + return v.(GValueMarshaler), true + } + return nil, false +} + +func marshalInvalid(uintptr) (interface{}, error) { + return nil, errors.New("invalid type") +} + +func marshalNone(uintptr) (interface{}, error) { + return nil, nil +} + +func marshalInterface(uintptr) (interface{}, error) { + return nil, errors.New("interface conversion not yet implemented") +} + +func marshalChar(p uintptr) (interface{}, error) { + c := C.g_value_get_schar((*C.GValue)(unsafe.Pointer(p))) + return int8(c), nil +} + +func marshalUchar(p uintptr) (interface{}, error) { + c := C.g_value_get_uchar((*C.GValue)(unsafe.Pointer(p))) + return uint8(c), nil +} + +func marshalBoolean(p uintptr) (interface{}, error) { + c := C.g_value_get_boolean((*C.GValue)(unsafe.Pointer(p))) + return gobool(c), nil +} + +func marshalInt(p uintptr) (interface{}, error) { + c := C.g_value_get_int((*C.GValue)(unsafe.Pointer(p))) + return int(c), nil +} + +func marshalLong(p uintptr) (interface{}, error) { + c := C.g_value_get_long((*C.GValue)(unsafe.Pointer(p))) + return int(c), nil +} + +func marshalEnum(p uintptr) (interface{}, error) { + c := C.g_value_get_enum((*C.GValue)(unsafe.Pointer(p))) + return int(c), nil +} + +func marshalInt64(p uintptr) (interface{}, error) { + c := C.g_value_get_int64((*C.GValue)(unsafe.Pointer(p))) + return int64(c), nil +} + +func marshalUint(p uintptr) (interface{}, error) { + c := C.g_value_get_uint((*C.GValue)(unsafe.Pointer(p))) + return uint(c), nil +} + +func marshalUlong(p uintptr) (interface{}, error) { + c := C.g_value_get_ulong((*C.GValue)(unsafe.Pointer(p))) + return uint(c), nil +} + +func marshalFlags(p uintptr) (interface{}, error) { + c := C.g_value_get_flags((*C.GValue)(unsafe.Pointer(p))) + return uint(c), nil +} + +func marshalUint64(p uintptr) (interface{}, error) { + c := C.g_value_get_uint64((*C.GValue)(unsafe.Pointer(p))) + return uint64(c), nil +} + +func marshalFloat(p uintptr) (interface{}, error) { + c := C.g_value_get_float((*C.GValue)(unsafe.Pointer(p))) + return float32(c), nil +} + +func marshalDouble(p uintptr) (interface{}, error) { + c := C.g_value_get_double((*C.GValue)(unsafe.Pointer(p))) + return float64(c), nil +} + +func marshalString(p uintptr) (interface{}, error) { + c := C.g_value_get_string((*C.GValue)(unsafe.Pointer(p))) + return C.GoString((*C.char)(c)), nil +} + +func marshalBoxed(p uintptr) (interface{}, error) { + c := C.g_value_get_boxed((*C.GValue)(unsafe.Pointer(p))) + return unsafe.Pointer(c), nil +} + +func marshalPointer(p uintptr) (interface{}, error) { + c := C.g_value_get_pointer((*C.GValue)(unsafe.Pointer(p))) + return unsafe.Pointer(c), nil +} + +func marshalObject(p uintptr) (interface{}, error) { + c := C.g_value_get_object((*C.GValue)(unsafe.Pointer(p))) + return Take(unsafe.Pointer(c)), nil +} + +func marshalVariant(p uintptr) (interface{}, error) { + c := C.g_value_get_variant((*C.GValue)(unsafe.Pointer(p))) + return newVariant((*C.GVariant)(c)), nil +} + +// GoValue converts a Value to comparable Go type. GoValue() returns +// InvalidValue if the conversion was unsuccessful. The returned value must be +// type asserted to the actual Go type. +// +// Unlike the type getters, although this method is not type-safe, it can get +// any concrete object type out, as long as there exists a marshaler for it. +func (v *Value) GoValue() interface{} { + if !v.isValue() { + return InvalidValue + } + + f := marshalers.lookup(v) + runtime.KeepAlive(v) + if f == nil { + return InvalidValue + } + + // No need to add finalizer because it is already done by AllocateValue and + // InitValue. (?) + g, err := f(uintptr(unsafe.Pointer(v.native()))) + runtime.KeepAlive(v) + if err != nil { + log.Printf("gotk4: marshaler error for %s: %v", v.Type(), err) + return InvalidValue + } + + return g +} + +// GoValueAsType is like GoValue, except it tries to cast into the given gtype +// instead of the detected underlying type. +func (v *Value) GoValueAsType(gtype Type) interface{} { + if !v.isValue() { + return InvalidValue + } + + f, ok := marshalers.lookupType(gtype) + if !ok { + runtime.KeepAlive(v) + return InvalidValue + } + + // No need to add finalizer because it is already done by AllocateValue and + // InitValue. (?) + g, err := f(uintptr(unsafe.Pointer(v.native()))) + runtime.KeepAlive(v) + if err != nil { + log.Printf("gotk4: marshaler error for %s: %v", v.Type(), err) + return InvalidValue + } + + return g +} + +// WalkGoValue is like GoValue, except the user is walked through every single +// possible type of the value until it's no longer possible or until the +// callback returns true. +func (v *Value) WalkGoValue(f func(interface{}) bool) (value interface{}) { + marshalers.lookupWalk(v, func(marshaler GValueMarshaler) bool { + g, err := marshaler(uintptr(unsafe.Pointer(v.native()))) + if err != nil { + log.Printf("gotk4: marshaler error for %s: %v", v.Type(), err) + return false + } + + if f(g) { + value = g + return true + } + + return false + }) + + runtime.KeepAlive(v) + return +} + +// SetBool is a wrapper around g_value_set_boolean(). +func (v *Value) SetBool(val bool) { + C.g_value_set_boolean(v.native(), gbool(val)) + runtime.KeepAlive(v) +} + +// SetSChar is a wrapper around g_value_set_schar(). +func (v *Value) SetSchar(val int8) { + C.g_value_set_schar(v.native(), C.gint8(val)) + runtime.KeepAlive(v) +} + +// SetInt64 is a wrapper around g_value_set_int64(). +func (v *Value) SetInt64(val int64) { + C.g_value_set_int64(v.native(), C.gint64(val)) + runtime.KeepAlive(v) +} + +// SetLong is a wrapper around g_value_set_long(). +func (v *Value) SetLong(long int32) { + C.g_value_set_long(v.native(), C.glong(long)) + runtime.KeepAlive(v) +} + +// SetInt is a wrapper around g_value_set_int(). +func (v *Value) SetInt(val int) { + C.g_value_set_int(v.native(), C.gint(val)) + runtime.KeepAlive(v) +} + +// SetUchar is a wrapper around g_value_set_uchar(). +func (v *Value) SetUchar(val uint8) { + C.g_value_set_uchar(v.native(), C.guchar(val)) + runtime.KeepAlive(v) +} + +// SetUint64 is a wrapper around g_value_set_uint64(). +func (v *Value) SetUint64(val uint64) { + C.g_value_set_uint64(v.native(), C.guint64(val)) + runtime.KeepAlive(v) +} + +// SetUlong is a wrapper around g_value_set_ulong(). +func (v *Value) SetUlong(ulong uint32) { + C.g_value_set_ulong(v.native(), C.gulong(ulong)) + runtime.KeepAlive(v) +} + +// SetUint is a wrapper around g_value_set_uint(). +func (v *Value) SetUint(val uint) { + C.g_value_set_uint(v.native(), C.guint(val)) + runtime.KeepAlive(v) +} + +// SetFloat is a wrapper around g_value_set_float(). +func (v *Value) SetFloat(val float32) { + C.g_value_set_float(v.native(), C.gfloat(val)) + runtime.KeepAlive(v) +} + +// SetDouble is a wrapper around g_value_set_double(). +func (v *Value) SetDouble(val float64) { + C.g_value_set_double(v.native(), C.gdouble(val)) + runtime.KeepAlive(v) +} + +// SetString is a wrapper around g_value_set_string(). +func (v *Value) SetString(val string) { + cstr := C.CString(val) + defer C.free(unsafe.Pointer(cstr)) + + C.g_value_set_string(v.native(), (*C.gchar)(cstr)) + runtime.KeepAlive(v) +} + +// SetInstance is a wrapper around g_value_set_instance(). +func (v *Value) SetInstance(instance uintptr) { + C.g_value_set_instance(v.native(), C.gpointer(instance)) + runtime.KeepAlive(v) +} + +// SetObject is a wrapper around g_value_set_object(). +func (v *Value) SetObject(obj *Object) { + C.g_value_set_object(v.native(), C.gpointer(obj.native())) + runtime.KeepAlive(v) + runtime.KeepAlive(obj) +} + +// SetPointer is a wrapper around g_value_set_pointer(). +func (v *Value) SetPointer(p uintptr) { + C.g_value_set_pointer(v.native(), C.gpointer(p)) + runtime.KeepAlive(v) +} + +// Pointer is a wrapper around g_value_get_pointer(). +func (v *Value) Pointer() unsafe.Pointer { + p := unsafe.Pointer(C.g_value_get_pointer(v.native())) + runtime.KeepAlive(v) + return p +} + +// Boxed is a wrapper around g_value_get_boxed(). +func (v *Value) Boxed() unsafe.Pointer { + p := unsafe.Pointer(C.g_value_get_boxed(v.native())) + runtime.KeepAlive(v) + return p +} + +// Object is a wrapper around g_value_get_object(). The returned object is taken +// its own reference. +func (v *Value) Object() *Object { + p := unsafe.Pointer(C.g_value_get_object(v.native())) + o := Take(unsafe.Pointer(p)) + runtime.KeepAlive(v) + return o +} + +// Enum is a wrapper around g_value_get_enum(). +func (v *Value) Enum() int { + i := int(C.g_value_get_enum(v.native())) + runtime.KeepAlive(v) + return i +} + +// Flags is a wrapper around g_value_get_flags(). +func (v *Value) Flags() uint { + u := uint(C.g_value_get_flags(v.native())) + runtime.KeepAlive(v) + return u +} + +// String is a wrapper around g_value_get_string(). String() returns a non-nil +// error if g_value_get_string() returned a NULL pointer to distinguish between +// returning a NULL pointer and returning an empty string. +func (v *Value) String() string { + c := C.g_value_get_string(v.native()) + runtime.KeepAlive(v) + + if c == nil { + return "" + } + + return C.GoString((*C.char)(c)) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/glib/glib.go.h b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/glib.go.h new file mode 100644 index 00000000..62ce6ba1 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/glib.go.h @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2013-2014 Conformal Systems + * + * This file originated from: http://opensource.conformal.com/ + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef __GLIB_GO_H__ +#define __GLIB_GO_H__ + +#include +#include +#include + +#include +#define G_SETTINGS_ENABLE_BACKEND +#include +#include +#include +#include +#include + +/* GObject Type Casting */ +static GType _g_type_from_instance(gpointer instance) { + return (G_TYPE_FROM_INSTANCE(instance)); +} + +static GValue *alloc_gvalue_list(int n) { + GValue *valv; + + valv = g_new0(GValue, n); + return (valv); +} + +static void val_list_insert(GValue *valv, int i, GValue *val) { + valv[i] = *val; +} + +/* + * GValue + */ + +static GValue *_g_value_alloc() { return (g_new0(GValue, 1)); } + +static GValue *_g_value_init(GType g_type) { + GValue *value; + + value = g_new0(GValue, 1); + return (g_value_init(value, g_type)); +} + +static gboolean _g_type_is_value(GType g_type) { + return (G_TYPE_IS_VALUE(g_type)); +} + +static gboolean _g_is_value(GValue *val) { return (G_IS_VALUE(val)); } + +static GType _g_value_type(GValue *val) { return (G_VALUE_TYPE(val)); } + +static const gchar *_g_value_type_name(GValue *val) { + return (G_VALUE_TYPE_NAME(val)); +} + +static GType _g_value_fundamental(GType type) { + return (G_TYPE_FUNDAMENTAL(type)); +} + +static GObjectClass *_g_object_get_class(GObject *object) { + return (G_OBJECT_GET_CLASS(object)); +} + +/* + * Closure support + */ + +extern void _gotk4_removeSourceFunc(gpointer data); +extern gboolean _gotk4_sourceFunc(gpointer data); + +extern void _gotk4_goMarshal(GClosure *, GValue *, guint, GValue *, gpointer, + GObject *); +extern void _gotk4_notifyHandlerTramp(gpointer, gpointer, guintptr); + +extern void _gotk4_removeClosure(GObject *, GClosure *); +extern void _gotk4_removeGeneratedClosure(guintptr, GClosure *); + +static inline guint _g_signal_new(const gchar *name) { + return g_signal_new(name, G_TYPE_OBJECT, G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION, + 0, NULL, NULL, g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 0); +} + +static void init_i18n(const char *domain, const char *dir) { + setlocale(LC_ALL, ""); + bindtextdomain(domain, dir); + bind_textdomain_codeset(domain, "UTF-8"); + textdomain(domain); +} + +static const char *localize(const char *string) { return _(string); } + +#endif diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/glib/go.go b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/go.go new file mode 100644 index 00000000..5944d944 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/go.go @@ -0,0 +1,985 @@ +package glib + +// #include +// #include +// #include "glib.go.h" +// +// extern void _gotk4_gobject_init_class(gpointer, gpointer); +// extern void _gotk4_gobject_init_instance(GTypeInstance*, gpointer); +// extern void _gotk4_gobject_dispose(GObject*); +// extern void _gotk4_gobject_get_property(GObject*, guint, GValue*, GParamSpec*); +// extern void _gotk4_gobject_set_property(GObject*, guint, GValue*, GParamSpec*); +import "C" + +import ( + "log" + "math" + "reflect" + "runtime" + "strings" + "sync" + "unicode" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gbox" +) + +func init() { + RegisterClassInfo[ + *Object, + *struct{}, + ObjectOverrides, + ]( + TypeObject, + initObjectClass, + func(o *Object) *Object { return o }, + func(o *Object) ObjectOverrides { + // This is actually quite funny. Instead of having our own thing + // that the caller can choose to call here, we just don't let the + // caller choose anything. Instead, we will always do our thing in + // the C callback. + return ObjectOverrides{ + Init: func() {}, + Dispose: func() {}, + } + }, + ) +} + +// ObjectOverrides contains optional virtual methods hookable onto the Object +// type. +type ObjectOverrides struct { + // Init is called during init_instance, which is actually when a + // GTypeInstance is instantiated, not GObject. + Init func() + // Dispose is called during GObject's dispose. + Dispose func() +} + +func initObjectClass(gclass unsafe.Pointer, overrides ObjectOverrides, initFunc func(*struct{})) { + // Install our GObject methods. + gobjectClass := (*C.GObjectClass)(gclass) + gobjectClass.dispose = (*[0]byte)(C._gotk4_gobject_dispose) + gobjectClass.get_property = (*[0]byte)(C._gotk4_gobject_get_property) + gobjectClass.set_property = (*[0]byte)(C._gotk4_gobject_set_property) +} + +// RegisteredSubclass is a type that described a registered Go subclass type. +type RegisteredSubclass[T any] registeredSubclass + +func rtypeElem[T any]() reflect.Type { + var zero T + rtype := reflect.TypeOf(zero) + if rtype.Kind() == reflect.Ptr { + rtype = rtype.Elem() + } + return rtype +} + +func rtypeElemV(v any) reflect.Type { + // Fast path? + rtype := reflect.TypeOf(v) + if rtype.Kind() == reflect.Ptr { + rtype = rtype.Elem() + } + return rtype +} + +type registerOpts struct { + typeOpts map[*classTypeInfo]registerTypeOpts // nil == currentType + paramSpecs []*ParamSpec + gtypeName string +} + +// registerTypeOpts contains register options specific to a single subclass +// type. +type registerTypeOpts struct { + override func(Objector) any + classInit func(any) +} + +func (o *registerOpts) wantTypeOpts() { + if o.typeOpts == nil { + o.typeOpts = make(map[*classTypeInfo]registerTypeOpts) + } +} + +// RegisterOptsFunc is a function type that modifies the behavior of a +// RegisterSubclass call. +type RegisterOptsFunc func(*registerOpts) + +// WithParamSpecs adds additional ParamSpecs into a type for its properties. +func WithParamSpecs(paramSpecs []*ParamSpec) RegisterOptsFunc { + return func(opts *registerOpts) { opts.paramSpecs = append(opts.paramSpecs, paramSpecs...) } +} + +// WithGTypeName overrides the autogenerated GLib type name, which is the +// namespace concatenated with the Go type name. +func WithGTypeName(gtypeName string) RegisterOptsFunc { + return func(opts *registerOpts) { opts.gtypeName = gtypeName } +} + +// WithClassInit adds a custom ClassInit function. Use this method to add a +// function that, for example, takes in a WidgetClass. +func WithClassInit[ClassT any](f func(ClassT)) RegisterOptsFunc { + return func(opts *registerOpts) { + opts.wantTypeOpts() + rtype := rtypeElem[ClassT]() + + ptype, ok := classTypeClassTypes[rtype] + if !ok { + log.Panicf("gotk4: cannot add ClassInit func for unknown Class type %s", rtype) + } + + topt := opts.typeOpts[ptype] + topt.classInit = func(v any) { + class, _ := v.(ClassT) + f(class) + } + opts.typeOpts[ptype] = topt + } +} + +// WithOverrides adds one XOverrides instance into the subclass. The user can +// use this to override any particular virtual method of any of its parent +// classes. +func WithOverrides[T Objector, OverridesT any](f func(T) OverridesT) RegisterOptsFunc { + return func(opts *registerOpts) { + opts.wantTypeOpts() + rtype := rtypeElem[OverridesT]() + + ptype, ok := classOverridesTypes[rtype] + if !ok { + log.Panicf("gotk4: cannot add Overrides func for unknown Overrides type %s", rtype) + // ptype = nil + } + + topt := opts.typeOpts[ptype] + topt.override = func(obj Objector) any { + v, _ := obj.(T) + return f(v) + } + opts.typeOpts[ptype] = topt + } +} + +// classInitParamType gets the Class type of the classInit function. +func classInitParamType(funcValue any) reflect.Type { + // We know this is a func(*T). + rtype := reflect.TypeOf(funcValue) + firstParamType := rtype.In(0) + return firstParamType.Elem() +} + +// RegisterSubclass is RegisterSubclassWithConstructor, but a zero-value +// instance of T is automatically created. +func RegisterSubclass[T Objector](opts ...RegisterOptsFunc) *RegisteredSubclass[T] { + rtype := rtypeElem[T]() + return RegisterSubclassWithConstructor(func() T { + return reflect.New(rtype).Interface().(T) + }, opts...) +} + +// RegisterSubclassWithConstructor registers a new type T that is a subclass of +// its parent type, which is the first field that must be embedded. +// +// ctor has to be idempotent (i.e. can be called multiple times w/o side +// effects). +func RegisterSubclassWithConstructor[T Objector](ctor func() T, opts ...RegisterOptsFunc) *RegisteredSubclass[T] { + rtype := rtypeElem[T]() + + subclass, ok := knownTypes[rtype] + if ok { + log.Panicln( + "gotk4: type", rtype, + "is already registered as a subclass of", subclass.parentType.GoInstanceType) + } + + subclass = registerSubclass(rtype, func() Objector { return ctor() }, opts) + knownTypes[rtype] = subclass + knownGTypes[subclass.gType] = subclass + + return castRegisteredSubclass[T](subclass) +} + +func castRegisteredSubclass[T any](src *registeredSubclass) *RegisteredSubclass[T] { + return (*RegisteredSubclass[T])(unsafe.Pointer(src)) +} + +// New creates an instance of the subclass object with no properties. +func (r *RegisteredSubclass[T]) New() T { + return r.NewWithProperties(nil) +} + +// NewWithProperties creates an instance of the subclass object with the given +// properties. +func (r *RegisteredSubclass[T]) NewWithProperties(properties map[string]any) T { + var names_ **C.gchar + var values_ *C.GValue + + if len(properties) > 0 { + names := make([]*C.char, 0, len(properties)) + values := make([]C.GValue, 0, len(properties)) + + for name, value := range properties { + cname := (*C.char)(C.CString(name)) + defer C.free(unsafe.Pointer(cname)) + + gvalue := NewValue(value) + defer runtime.KeepAlive(gvalue) + + names = append(names, cname) + values = append(values, *gvalue.gvalue) + } + + names_ = &names[0] + values_ = &values[0] + } + + cval := C.g_object_new_with_properties( + C.GType(r.gType), + C.guint(len(properties)), + names_, values_, + ) + + // So we created an instance. We have the instance in private. We can just + // dig it up and avoid the whole type-casting mess. + private := privateFromInstance(unsafe.Pointer(cval)) + return private.instance().(T) +} + +// Type returns the GType of the registered Go subclass. +func (r *RegisteredSubclass[T]) Type() Type { + return r.gType +} + +type registeredSubclass struct { + goType reflect.Type // NOT POINTER + gType Type + parentType *classTypeInfo + typeClass unsafe.Pointer + constructor func() Objector + properties map[*C.GParamSpec]subclassProperty + + opts registerOpts +} + +type subclassProperty struct { + name string + fieldIdx []int +} + +func (p *subclassProperty) instance(goval any) propertyInstance { + prop := reflect.Indirect(reflect.ValueOf(goval)).FieldByIndex(p.fieldIdx) + return prop.Addr().Interface().(propertyInstance) +} + +var ( + knownTypes = map[reflect.Type]*registeredSubclass{} + knownGTypes = map[Type]*registeredSubclass{} +) + +func subclassFromData(data C.gpointer) *registeredSubclass { + return gbox.Get(uintptr(data)).(*registeredSubclass) +} + +func registerSubclass(rtype reflect.Type, ctor func() Objector, optsFuncs []RegisterOptsFunc) *registeredSubclass { + subclass := ®isteredSubclass{ + goType: rtype, + parentType: extractParentType(rtype), + constructor: ctor, + } + + for _, fn := range optsFuncs { + fn(&subclass.opts) + } + + // We want len(opts.paramSpecs) == len(properties). Ideally, ParamSpecs + // should be optional and we should automatically detect the type, however + // that is not the case. + for _, spec := range subclass.opts.paramSpecs { + // Permanently take a reference, since we're globalling this forever + // anyway. + C.g_param_spec_ref(spec.intern) + } + + // Scan for Property fields. + subclass.properties = make(map[*C.GParamSpec]subclassProperty, len(subclass.opts.paramSpecs)) + for i := 0; i < rtype.NumField(); i++ { + field := rtype.Field(i) + if !strings.HasSuffix(field.Type.PkgPath(), "/core/glib") { + continue + } + // Hack! + if !strings.HasPrefix(field.Type.Name(), "Property[") { + continue + } + + name := field.Tag.Get("glib") + if name == "" { + log.Panicf("field %s of type %s has no glib tag", field.Name, rtype) + } + + if !reflect.PtrTo(field.Type).Implements(rtypeProperty) { + log.Panicf("BUG: *Property[T] of %s does not implement propertyInstance", reflect.PtrTo(field.Type)) + } + + // Validate the name. + var gspec *C.GParamSpec + for _, spec := range subclass.opts.paramSpecs { + if spec.Name() == name { + gspec = spec.intern + break + } + } + + if gspec == nil { + // Try and generate our own. + nilProp := reflect.NewAt(field.Type, nil).Interface().(propertyInstance) + ptyp := rtypeToParamType(nilProp.rtype()) + + gspec = gParamSpecBlank(name, ptyp) + paramSpecTypeInit(unsafe.Pointer(gspec), ptyp) + + // Append. This means WE CANNOT RELY ON THE INDEX! + subclass.opts.paramSpecs = append(subclass.opts.paramSpecs, &ParamSpec{ + ¶mSpec{gspec}, + }) + } + + subclass.properties[gspec] = subclassProperty{ + name: name, + fieldIdx: field.Index, + } + } + + var typeQuery C.GTypeQuery + C.g_type_query(C.GType(subclass.parentType.GType), &typeQuery) + if typeQuery._type == 0 { + log.Panicln("GType", subclass.parentType.GType, "is generated but is unknown") + } + + var typeInfo C.GTypeInfo + + // Why are these ushort anyway? + typeInfo.class_size = C.gushort(typeQuery.class_size) + typeInfo.class_data = C.gconstpointer(gbox.Assign(subclass)) + typeInfo.class_init = C.GClassInitFunc(C._gotk4_gobject_init_class) + + typeInfo.instance_size = C.gushort(typeQuery.instance_size) + typeInfo.instance_init = C.GInstanceInitFunc(C._gotk4_gobject_init_instance) + + gtypeName := subclass.opts.gtypeName + if gtypeName == "" { + gtypeName = transformGTypeName(rtype) + } + + ctypeName := (*C.gchar)(C.CString(gtypeName)) + defer C.free(unsafe.Pointer(ctypeName)) + + gtype := C.g_type_register_static( + C.GType(subclass.parentType.GType), + ctypeName, + &typeInfo, + C.GTypeFlags(0)) + subclass.gType = Type(gtype) + + return subclass +} + +// TODO: autogenerate this: +// +// type enumerator[T any] interface { +// Enumerate() []T +// } + +// G_TYPE_PARAM_CHAR +// G_TYPE_PARAM_UCHAR +// G_TYPE_PARAM_BOOLEAN +// G_TYPE_PARAM_INT +// G_TYPE_PARAM_UINT +// G_TYPE_PARAM_LONG +// G_TYPE_PARAM_ULONG +// G_TYPE_PARAM_INT64 +// G_TYPE_PARAM_UINT64 +// G_TYPE_PARAM_UNICHAR +// G_TYPE_PARAM_ENUM +// G_TYPE_PARAM_FLAGS +// G_TYPE_PARAM_FLOAT +// G_TYPE_PARAM_DOUBLE +// G_TYPE_PARAM_STRING +// G_TYPE_PARAM_PARAM +// G_TYPE_PARAM_BOXED +// G_TYPE_PARAM_POINTER +// G_TYPE_PARAM_OBJECT +// G_TYPE_PARAM_OVERRIDE +// G_TYPE_PARAM_GTYPE +// G_TYPE_PARAM_VARIANT +func rtypeToParamType(rtype reflect.Type) Type { + if rtype == rtypePVariant { + return Type(C.G_TYPE_PARAM_VARIANT) + } + if rtype.Implements(rtypeObjector) { + return Type(C.G_TYPE_PARAM_OBJECT) + } + switch rtype.Kind() { + case reflect.String: + return Type(C.G_TYPE_PARAM_STRING) + case reflect.Int8: + return Type(C.G_TYPE_PARAM_CHAR) + case reflect.Int16, reflect.Int32: + return Type(C.G_TYPE_PARAM_INT) + case reflect.Int64, reflect.Int: + return Type(C.G_TYPE_PARAM_INT64) + case reflect.Uint8: + return Type(C.G_TYPE_PARAM_UCHAR) + case reflect.Uint16, reflect.Uint32: + return Type(C.G_TYPE_PARAM_UINT) + case reflect.Uint64, reflect.Uint: + return Type(C.G_TYPE_PARAM_UINT64) + case reflect.Float32: + return Type(C.G_TYPE_PARAM_FLOAT) + case reflect.Float64: + return Type(C.G_TYPE_PARAM_DOUBLE) + case reflect.Bool: + return Type(C.G_TYPE_PARAM_BOOLEAN) + case reflect.Ptr: + // TODO: gbox + } + log.Panicf("gotk4: unsupported type %T cannot be converted to GTypeParam", rtype) + return 0 +} + +// TODO: remove all this shit and just use the Go functions. Please. +func paramSpecTypeInit(spec unsafe.Pointer, ptype Type) { + switch C.GType(ptype) { + case C.G_TYPE_PARAM_INT: + ispec := (*C.GParamSpecInt)(spec) + ispec.minimum = C.gint(-math.MaxInt32) + ispec.maximum = C.gint(+math.MaxInt32) + case C.G_TYPE_PARAM_INT64: + ispec := (*C.GParamSpecInt64)(spec) + ispec.minimum = C.gint64(-math.MaxInt64) + ispec.maximum = C.gint64(+math.MaxInt64) + case C.G_TYPE_PARAM_UINT: + uspec := (*C.GParamSpecUInt)(spec) + uspec.minimum = C.guint(0) + uspec.maximum = C.guint(+math.MaxUint32) + case C.G_TYPE_PARAM_UINT64: + uspec := (*C.GParamSpecUInt64)(spec) + uspec.minimum = C.guint64(0) + uspec.maximum = C.guint64(+math.MaxUint64) + case C.G_TYPE_PARAM_FLOAT: + fspec := (*C.GParamSpecFloat)(spec) + fspec.minimum = C.gfloat(-math.MaxFloat32) + fspec.maximum = C.gfloat(+math.MaxFloat32) + case C.G_TYPE_PARAM_DOUBLE: + fspec := (*C.GParamSpecDouble)(spec) + fspec.minimum = C.gdouble(-math.MaxFloat64) + fspec.maximum = C.gdouble(+math.MaxFloat64) + } +} + +// gParamSpecBlank is used for generating a ParamSpec from just the struct +// field. +func gParamSpecBlank(name string, gtype Type) *C.GParamSpec { + cname := (*C.gchar)(C.CString(name)) + defer C.free(unsafe.Pointer(cname)) + + emptyStr := (*C.gchar)(C.CString("")) + defer C.free(unsafe.Pointer(emptyStr)) + + paramSpec := (*C.GParamSpec)(C.g_param_spec_internal( + C.GType(gtype), + cname, emptyStr, emptyStr, + C.GParamFlags(ParamReadWrite), + )) + return C.g_param_spec_ref_sink(paramSpec) +} + +func transformGTypeName(rtype reflect.Type) string { + goType := rtype.String() + + first, second, ok := strings.Cut(goType, ".") + if ok { + return capitalizeFirst(first) + capitalizeFirst(second) + } + + return capitalizeFirst(goType) +} + +func capitalizeFirst(str string) string { + if str == "" { + return str + } + runes := []rune(str) + return string(unicode.ToUpper(runes[0])) + string(runes[1:]) +} + +func extractParentType(rtype reflect.Type) *classTypeInfo { + if rtype.Kind() != reflect.Struct { + log.Panicln("given type is not a struct or a *struct") + } + + field := rtype.Field(0) + if !field.Anonymous { + log.Panicln("first field (parent) must be embedded") + } + + typeInfo, ok := classInstanceTypes[field.Type] + if !ok { + // TODO: allow inheriting from a Go type. + log.Panicln("unknown type", field.Type) + } + + return typeInfo +} + +func (r *registeredSubclass) setParent(instance any, parent unsafe.Pointer) { + // transfer: none! See GInstanceInitFunc's docs. + gobject := Take(unsafe.Pointer(parent)) + + // We want to set the first field of our new Go class instance, which is the + // parent, to be the initialized parent. There's a pretty nifty way of doing + // this: we can hijack our base methods and use that. + + // gobjectVal might have type *gtk.Widget, for example. + gobjectVal := r.parentType.WrapClass(gobject) + + rval := reflect.ValueOf(instance).Elem() + + parentVal := rval.Field(0) + if !parentVal.IsZero() { + log.Panicf("cannot construct subclass %s instance with non-nil parent", r.goType) + } + + // v.Widget = *(gobjectVal.(*gtk.Widget)) + parentVal.Set(reflect.ValueOf(gobjectVal).Elem()) +} + +// Overrides gets the XOverrides instance associated with the given object's +// parent. The instance will have already been modified by the subclass if it +// did. +func Overrides[OverridesT any](obj Objector) OverridesT { + rtype := rtypeElemV(obj) + + if subclass, ok := knownTypes[rtype]; ok { + topt, ok := subclass.opts.typeOpts[subclass.parentType] + if ok && topt.override != nil { + overrides, ok := topt.override(obj).(OverridesT) + if ok { + return overrides + } + + var z OverridesT + log.Panicf( + "gotk4: Overrides: object type %s's parent overrides type is %s, cannot assert to %T", + rtype, subclass.parentType.GoOverridesType, z) + } + + var z OverridesT + return z + } + + if typeInfo, ok := classInstanceTypes[rtype]; ok { + overrides, ok := typeInfo.Overrides(obj).(OverridesT) + if ok { + return overrides + } + + var z OverridesT + log.Panicf( + "gotk4: Overrides: object type %s's overrides type is %s, cannot assert to %T", + rtype, typeInfo.GoOverridesType, z) + } + + obase := BaseObject(obj) + return OverridesFromObj[OverridesT](obase) +} + +// OverridesFromObj is like Overrides, except it specifically takes the base +// object. The GType is asked for instead of using the underlying Go type. +func OverridesFromObj[OverridesT any](obj *Object) OverridesT { + gtype := obj.TypeFromInstance() + + if subclass, ok := knownGTypes[gtype]; ok { + topt, ok := subclass.opts.typeOpts[subclass.parentType] + if ok && topt.override != nil { + overrides, ok := topt.override(obj).(OverridesT) + if ok { + return overrides + } + + var z OverridesT + log.Panicf( + "gotk4: OverridesFromObj: object type %s's parent overrides type is %s, cannot assert to %T", + gtype, subclass.parentType.GoOverridesType, z) + } + + var z OverridesT + return z + } + + if typeInfo, ok := classGTypes[gtype]; ok { + overrides, ok := typeInfo.Overrides(obj).(OverridesT) + if ok { + return overrides + } + + var z OverridesT + log.Panicf( + "gotk4: OverridesFromObj: object type %s's overrides type is %s, cannot assert to %T", + gtype, typeInfo.GoOverridesType, z) + } + + var z OverridesT + return z +} + +// ParentOverrides is similar to Overrides, except the object's parent type is +// used instead of the object's type. +func ParentOverrides[OverridesT any](obj Objector) OverridesT { + rtype := rtypeElemV(obj) + + subclass, ok := knownTypes[rtype] + if !ok { + log.Panicf( + "gotk4: cannot get ParentOverrides of non-subclass type %s (unsupported)", + rtype) + } + + typeInfo, ok := classInstanceTypes[subclass.parentType.GoInstanceType] + if ok { + overrides, ok := typeInfo.Overrides(obj).(OverridesT) + if ok { + return overrides + } + var z OverridesT + log.Panicf( + "gotk4: object type %s's overrides type is %s, cannot assert to %T", + rtype, typeInfo.GoOverridesType, z) + } + + var z OverridesT + return z +} + +// PeekParentClass returns the C.TClass type using peek_parent, which is free of +// any subclassing changes. +func PeekParentClass(obj Objector) unsafe.Pointer { + base := BaseObject(obj) + parentGType := base.TypeFromInstance().Parent() + return unsafe.Pointer(C.g_type_class_peek(C.GType(parentGType))) +} + +type classTypeInfo struct { + GType Type + GoInstanceType reflect.Type + GoClassType reflect.Type + GoOverridesType reflect.Type + // InitClass will be called to initialize a class using the given Go value. + // It should type assert goValue and sets the available functions into the + // gclass (*GObjectTypeClass) type parameter. + // + // goValue might not point to a valid value. + // + // initFunc will be of type func(*TClass). + InitClass func(gclass unsafe.Pointer, overrides, initFunc any) + // WrapClass wraps the given Object to the right Ojector of GoType. + WrapClass func(obj *Object) Objector + // Overrides creates an overrides value from the given object. + Overrides func(obj Objector) any +} + +var ( + classInstanceTypes = make(map[reflect.Type]*classTypeInfo, 1024) + classTypeClassTypes = make(map[reflect.Type]*classTypeInfo, 1024) + classOverridesTypes = make(map[reflect.Type]*classTypeInfo, 1024) + classGTypes = make(map[Type]*classTypeInfo, 1024) +) + +// RegisterClassInfo registers the given class type info. This function is NOT +// thread-safe; only call it in init(). +func RegisterClassInfo[InstanceT Objector, ClassT, OverridesT any]( + gtype Type, + initClassFunc func(gclass unsafe.Pointer, overrides OverridesT, initFunc func(ClassT)), + wrapClassFunc func(*Object) InstanceT, + overridesFunc func(InstanceT) OverridesT, +) { + typeInfo := &classTypeInfo{ + GType: gtype, + GoInstanceType: rtypeElem[InstanceT](), + GoClassType: rtypeElem[ClassT](), + GoOverridesType: rtypeElem[OverridesT](), + InitClass: func(gclass unsafe.Pointer, overridesV, initFuncV any) { + overrides, _ := overridesV.(OverridesT) + initFunc, _ := initFuncV.(func(ClassT)) + initClassFunc(gclass, overrides, initFunc) + }, + WrapClass: func(obj *Object) Objector { + return wrapClassFunc(obj) + }, + Overrides: func(obj Objector) any { + return overridesFunc(obj.(InstanceT)) + }, + } + + classGTypes[typeInfo.GType] = typeInfo + classInstanceTypes[typeInfo.GoInstanceType] = typeInfo + classTypeClassTypes[typeInfo.GoClassType] = typeInfo + classOverridesTypes[typeInfo.GoOverridesType] = typeInfo +} + +// registeredGClass binds gclass (which is a *GTypeClassInfo describing XClass +// structs) to data (which is the ID that gets us a *registeredSubclass). +// It exists for init_instance. +// +// gpointer (*GTypeClassInfo) -> *privateGoInstance +var registeredPrivateInstances sync.Map + +// privateGoInstance maps the two private fields. +type privateGoInstance struct { + subclassID C.gpointer // constant + instanceID C.gpointer // used for finalizing +} + +func privateFromInstance(obj unsafe.Pointer) *privateGoInstance { + gtype := typeFromObject(obj) + + private := C.g_type_instance_get_private((*C.GTypeInstance)(obj), C.GType(gtype)) + if private == nil { + log.Panicf("cannot get private from unknown object %s (%p)", Type(gtype), obj) + } + + p := (*privateGoInstance)(unsafe.Pointer(private)) + return p +} + +func (p *privateGoInstance) subclass() *registeredSubclass { + return subclassFromData(p.subclassID) +} + +func (p *privateGoInstance) instance() any { + return gbox.Get(uintptr(p.instanceID)) +} + +//export _gotk4_gobject_init_class +func _gotk4_gobject_init_class(gclass, data C.gpointer) { + subclass := subclassFromData(data) + subclass.typeClass = unsafe.Pointer(gclass) + + _, dup := registeredPrivateInstances.LoadOrStore(gclass, &privateGoInstance{subclassID: data}) + if dup { + log.Panicf("init_class called on the same gclass %s (%p) twice", subclass.goType, gclass) + } + + // I believe this function is only called once. The internal macros actually + // just set a global variable right inside this callback, so I'd assume + // that's the case. It's weird, but still. + // + // Also, privateOffset is originally in int, which is 32-bit. Why? Why do + // they do this? Why not guintptr? What??? + // + // You know what? Nevermind. Why do they deprecate the function that I'm + // supposed to use, and then write in the comment that the generated macro + // that's supposed to solve everything in an ideal world (???) just + // literally calls that deprecated function? Nevermind that, why is the + // alternative A FUCKING PRIVATE FUNCTION?! COME ON WHAT THE FUCK?! + // + // Anyway, here's the deprecated one. We have Cgo flags that silence + // deprecation notices because GLib is a fucking clown. + C.g_type_class_add_private(gclass, C.gsize(unsafe.Sizeof(privateGoInstance{}))) + + for parentType, topt := range subclass.opts.typeOpts { + if parentType == nil { + parentType = subclass.parentType + } + + var overrides any + if topt.override != nil { + overrides = topt.override(nil) + } + + parentType.InitClass(unsafe.Pointer(gclass), overrides, topt.classInit) + } + + // Install properties, if any. + if len(subclass.opts.paramSpecs) > 0 { + gParamSpecs := make([]*C.GParamSpec, len(subclass.opts.paramSpecs)+1) + for i, spec := range subclass.opts.paramSpecs { + // [0] is reserved by GLib. + gParamSpecs[i+1] = spec.intern + } + + C.g_object_class_install_properties( + (*C.GObjectClass)(gclass), + C.guint(len(gParamSpecs)), + &gParamSpecs[0], + ) + } +} + +//export _gotk4_gobject_init_instance +func _gotk4_gobject_init_instance(obj *C.GTypeInstance, gclass C.gpointer) { + // Reminder: obj of type *GTypeInstance IS a regular *GObject if we're + // initializing a class! We can consider it as such. + + // Grab our registeredSubclass ID. We don't actually need the gclass past + // this point. + privateV, ok := registeredPrivateInstances.Load(gclass) + if !ok { + log.Panicf( + "init_instance called on unregistered gclass %s (%p)", + typeFromObject(unsafe.Pointer(obj)), gclass) + } + + private := privateV.(*privateGoInstance) + subclass := private.subclass() + + // Allocate and construct a new instance. + instance := subclass.constructor() + private.instanceID = C.gpointer(gbox.Assign(instance)) + + // Bind our new Go class' parent field. + subclass.setParent(instance, unsafe.Pointer(obj)) + + // Copy our fully initialized private instance values to GLib's allocated + // object private one. + *privateFromInstance(unsafe.Pointer(obj)) = *private + + // Initialize its properties. + if len(subclass.properties) > 0 { + for gspec, propProto := range subclass.properties { + prop := propProto.instance(instance) + prop.init(instance, gspec) + } + } + + // Call its initializer. + if overrides := Overrides[ObjectOverrides](instance); overrides.Init != nil { + overrides.Init() + } +} + +//export _gotk4_gobject_dispose +func _gotk4_gobject_dispose(obj *C.GObject) { + private := privateFromInstance(unsafe.Pointer(obj)) + instance := private.instance().(Objector) + + // Call its disposal function. + if overrides := Overrides[ObjectOverrides](instance); overrides.Dispose != nil { + overrides.Dispose() + } + + // Unbind our instance from the global store. + // TODO: should we do this in Finalize or Dispose? + gbox.Delete(uintptr(private.instanceID)) +} + +func getAndValidateProperty(obj *C.GObject, spec *C.GParamSpec) propertyInstance { + private := privateFromInstance(unsafe.Pointer(obj)) + + instance := private.instance() + subclass := private.subclass() + + propertyType, ok := subclass.properties[spec] + if !ok { + log.Panicf( + "gotk4: requested property %s for object %s is unknown", + C.GoString(spec.name), typeFromObject(unsafe.Pointer(obj))) + } + + return propertyType.instance(instance) +} + +//export _gotk4_gobject_get_property +func _gotk4_gobject_get_property(obj *C.GObject, propID C.guint, value *C.GValue, spec *C.GParamSpec) { + if propID == 0 { + return // reserved prop? dunno + } + + property := getAndValidateProperty(obj, spec) + property.get(ValueFromNative(unsafe.Pointer(value))) +} + +//export _gotk4_gobject_set_property +func _gotk4_gobject_set_property(obj *C.GObject, propID C.guint, value *C.GValue, spec *C.GParamSpec) { + if propID == 0 { + return // reserved prop? dunno + } + + property := getAndValidateProperty(obj, spec) + property.set(ValueFromNative(unsafe.Pointer(value))) +} + +// Property describes a Go GObject property. It is used as an alternative to +// manually written property getter/setters. +type Property[T any] struct { + parent Objector + name string + value T + + gspec *C.GParamSpec +} + +type propertyInstance interface { + rtype() reflect.Type + init(obj Objector, spec *C.GParamSpec) + set(*Value) + get(*Value) +} + +var _ propertyInstance = (*Property[any])(nil) + +var ( + rtypeProperty = reflect.TypeOf((*propertyInstance)(nil)).Elem() + rtypeObjector = reflect.TypeOf((*Objector)(nil)).Elem() + rtypePVariant = reflect.TypeOf((*Variant)(nil)) +) + +func (p *Property[T]) rtype() reflect.Type { + var z T + return reflect.TypeOf(z) +} + +func (p *Property[T]) init(obj Objector, spec *C.GParamSpec) { + p.parent = obj + p.gspec = spec + p.name = C.GoString(spec.name) +} + +func (p *Property[T]) gtype() Type { + return Type(p.gspec.value_type) +} + +func (p *Property[T]) set(value *Value) { + govalue := value.GoValueAsType(p.gtype()) + // This will panic if the type is not convertible. + p.value = reflect.ValueOf(govalue).Convert(p.rtype()).Interface().(T) +} + +func (p *Property[T]) get(value *Value) { + value.InitGoValue(p.value) +} + +// Set sets the new property. +func (p *Property[T]) Set(v T) { + base := BaseObject(p.parent) + base.SetObjectProperty(p.name, v) +} + +// Get gets the value of the property. +func (p *Property[T]) Get() T { + base := BaseObject(p.parent) + pval := base.ObjectProperty(p.name) + if rtype := reflect.TypeOf(pval); rtype != p.rtype() { + return reflect.ValueOf(pval).Convert(p.rtype()).Interface().(T) + } + return pval.(T) +} + +// Notify calls f everytime the property changes. +func (p *Property[T]) Notify(f func(T)) SignalHandle { + base := BaseObject(p.parent) + return base.NotifyProperty(p.name, func() { f(p.Get()) }) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/glib/gvariant.go b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/gvariant.go new file mode 100644 index 00000000..a3d4b9de --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/gvariant.go @@ -0,0 +1,319 @@ +package glib + +// #include "glib.go.h" +import "C" + +import ( + "runtime" + "unsafe" +) + +// A Variant is a representation of GLib's GVariant. +type Variant struct { + GVariant *C.GVariant +} + +// native returns a pointer to the underlying GVariant. +func (v *Variant) native() *C.GVariant { + if v == nil || v.GVariant == nil { + return nil + } + return v.GVariant +} + +// Native returns a pointer to the underlying GVariant. +func (v *Variant) Native() uintptr { + return uintptr(unsafe.Pointer(v.native())) +} + +// newVariant wraps a native GVariant. +// Does NOT handle reference counting! Use takeVariant() to take ownership of values. +func newVariant(p *C.GVariant) *Variant { + if p == nil { + return nil + } + return &Variant{GVariant: p} +} + +// takeVariant wraps a native GVariant, +// takes ownership and sets up a finalizer to free the instance during GC. +func takeVariant(p *C.GVariant) *Variant { + if p == nil { + return nil + } + obj := &Variant{GVariant: p} + + if obj.IsFloating() { + obj.RefSink() + } else { + obj.Ref() + } + + runtime.SetFinalizer(obj, (*Variant).Unref) + return obj +} + +// IsFloating returns true if the variant has a floating reference count. +// Reference counting is usually handled in the gotk layer, +// most applications should not call this. +func (v *Variant) IsFloating() bool { + b := gobool(C.g_variant_is_floating(v.native())) + runtime.KeepAlive(v) + return b +} + +// Ref is a wrapper around g_variant_ref. +// Reference counting is usually handled in the gotk layer, +// most applications should not need to call this. +func (v *Variant) Ref() { + C.g_variant_ref(v.native()) + runtime.KeepAlive(v) +} + +// RefSink is a wrapper around g_variant_ref_sink. +// Reference counting is usually handled in the gotk layer, +// most applications should not need to call this. +func (v *Variant) RefSink() { + C.g_variant_ref_sink(v.native()) + runtime.KeepAlive(v) +} + +// TakeRef is a wrapper around g_variant_take_ref. +// Reference counting is usually handled in the gotk layer, +// most applications should not need to call this. +func (v *Variant) TakeRef() { + C.g_variant_take_ref(v.native()) + runtime.KeepAlive(v) +} + +// Unref is a wrapper around g_variant_unref. +// Reference counting is usually handled in the gotk layer, +// most applications should not need to call this. +func (v *Variant) Unref() { + C.g_variant_unref(v.native()) + runtime.KeepAlive(v) +} + +// TypeString returns the g variant type string for this variant. +func (v *Variant) TypeString() string { + // the string returned from this belongs to GVariant and must not be freed. + s := C.GoString((*C.char)(C.g_variant_get_type_string(v.native()))) + runtime.KeepAlive(v) + return s +} + +// IsContainer returns true if the variant is a container and false otherwise. +func (v *Variant) IsContainer() bool { + b := gobool(C.g_variant_is_container(v.native())) + runtime.KeepAlive(v) + return b +} + +// String is a wrapper around g_variant_get_string. If the Variant type is not a +// string, then Print is called instead. This is done to satisfy fmt.Stringer; +// it behaves similarly to reflect.Value.String(). +func (v *Variant) String() string { + defer runtime.KeepAlive(v) + + if C.g_variant_get_type(v.native()) != C.G_VARIANT_TYPE_STRING { + return v.Print(false) + } + + // The string value remains valid as long as the GVariant exists, do NOT free the cstring in this function. + var len C.gsize + gc := C.g_variant_get_string(v.native(), &len) + + // This is opposed to g_variant_dup_string, which copies the string. + // g_variant_dup_string is not implemented, + // as we copy the string value anyways when converting to a go string. + + return C.GoStringN((*C.char)(gc), (C.int)(len)) +} + +// Type returns the VariantType for this variant. +func (v *Variant) Type() *VariantType { + // The return value is valid for the lifetime of value and must not be freed. + t := newVariantType(C.g_variant_get_type(v.native())) + runtime.KeepAlive(v) + return t +} + +// IsType returns true if the variant's type matches t. +func (v *Variant) IsType(t *VariantType) bool { + b := gobool(C.g_variant_is_of_type(v.native(), t.native())) + runtime.KeepAlive(v) + runtime.KeepAlive(t) + return b +} + +// Print wraps g_variant_print(). It returns a string understood by +// g_variant_parse(). +func (v *Variant) Print(typeAnnotate bool) string { + gc := C.g_variant_print(v.native(), gbool(typeAnnotate)) + runtime.KeepAlive(v) + + defer C.g_free(C.gpointer(gc)) + + return C.GoString((*C.char)(gc)) +} + +// GoValue converts the variant's value to the Go value. It only supports the +// following types for now: +// +// s: string +// b: bool +// d: float64 +// n: int16 +// i: int32 +// x: int64 +// y: byte +// q: uint16 +// u: uint32 +// t: uint64 +// +// Variants with unsupported types will cause the function to return nil. +func (v *Variant) GoValue() interface{} { + var val interface{} + switch C.g_variant_get_type(v.native()) { + case C.G_VARIANT_TYPE_STRING: + val = v.String() + case C.G_VARIANT_TYPE_BOOLEAN: + val = gobool(C.g_variant_get_boolean(v.native())) + case C.G_VARIANT_TYPE_DOUBLE: + val = float64(C.g_variant_get_double(v.native())) + case C.G_VARIANT_TYPE_INT16: + val = int16(C.g_variant_get_int16(v.native())) + case C.G_VARIANT_TYPE_INT32: + val = int32(C.g_variant_get_int32(v.native())) + case C.G_VARIANT_TYPE_INT64: + val = int64(C.g_variant_get_int64(v.native())) + case C.G_VARIANT_TYPE_BYTE: + val = uint8(C.g_variant_get_byte(v.native())) + case C.G_VARIANT_TYPE_UINT16: + val = uint16(C.g_variant_get_uint16(v.native())) + case C.G_VARIANT_TYPE_UINT32: + val = uint32(C.g_variant_get_uint32(v.native())) + case C.G_VARIANT_TYPE_UINT64: + val = uint64(C.g_variant_get_uint64(v.native())) + } + + runtime.KeepAlive(v) + return val +} + +// A VariantType is a wrapper for the GVariantType, which encodes type +// information for GVariants. +type VariantType struct { + GVariantType *C.GVariantType +} + +func (v *VariantType) native() *C.GVariantType { + return v.GVariantType +} + +func (v *VariantType) Native() uintptr { + if v == nil || v.GVariantType == nil { + return uintptr(unsafe.Pointer(nil)) + } + return uintptr(unsafe.Pointer(v.native())) +} + +// String returns a copy of this VariantType's type string. +func (v *VariantType) String() string { + ch := C.g_variant_type_dup_string(v.native()) + runtime.KeepAlive(v) + + defer C.g_free(C.gpointer(ch)) + return C.GoString((*C.char)(ch)) +} + +// newVariantType wraps a native GVariantType. +// Does not create a finalizer. +// Use takeVariantType for instances which need to be freed after use. +func newVariantType(v *C.GVariantType) *VariantType { + if v == nil { + return nil + } + return &VariantType{v} +} + +// takeVariantType wraps a native GVariantType +// and sets up a finalizer to free the instance during GC. +func takeVariantType(v *C.GVariantType) *VariantType { + if v == nil { + return nil + } + obj := &VariantType{v} + runtime.SetFinalizer(obj, (*VariantType).Free) + return obj +} + +// Variant types for comparison. Note that variant types cannot be compared by +// value; use VariantType.Equal instead. +var ( + VariantTypeBoolean = newVariantType(C.G_VARIANT_TYPE_BOOLEAN) + VariantTypeByte = newVariantType(C.G_VARIANT_TYPE_BYTE) + VariantTypeInt16 = newVariantType(C.G_VARIANT_TYPE_INT16) + VariantTypeUint16 = newVariantType(C.G_VARIANT_TYPE_UINT16) + VariantTypeInt32 = newVariantType(C.G_VARIANT_TYPE_INT32) + VariantTypeUint32 = newVariantType(C.G_VARIANT_TYPE_UINT32) + VariantTypeInt64 = newVariantType(C.G_VARIANT_TYPE_INT64) + VariantTypeUint64 = newVariantType(C.G_VARIANT_TYPE_UINT64) + VariantTypeHandle = newVariantType(C.G_VARIANT_TYPE_HANDLE) + VariantTypeDouble = newVariantType(C.G_VARIANT_TYPE_DOUBLE) + VariantTypeString = newVariantType(C.G_VARIANT_TYPE_STRING) + VariantTypeObjectPath = newVariantType(C.G_VARIANT_TYPE_OBJECT_PATH) + VariantTypeSignature = newVariantType(C.G_VARIANT_TYPE_SIGNATURE) + VariantTypeVariant = newVariantType(C.G_VARIANT_TYPE_VARIANT) + VariantTypeAny = newVariantType(C.G_VARIANT_TYPE_ANY) + VariantTypeBasic = newVariantType(C.G_VARIANT_TYPE_BASIC) + VariantTypeMaybe = newVariantType(C.G_VARIANT_TYPE_MAYBE) + VariantTypeArray = newVariantType(C.G_VARIANT_TYPE_ARRAY) + VariantTypeTuple = newVariantType(C.G_VARIANT_TYPE_TUPLE) + VariantTypeUnit = newVariantType(C.G_VARIANT_TYPE_UNIT) + VariantTypeDictEntry = newVariantType(C.G_VARIANT_TYPE_DICT_ENTRY) + VariantTypeDictionary = newVariantType(C.G_VARIANT_TYPE_DICTIONARY) + VariantTypeStringArray = newVariantType(C.G_VARIANT_TYPE_STRING_ARRAY) + VariantTypeObjectPathArray = newVariantType(C.G_VARIANT_TYPE_OBJECT_PATH_ARRAY) + VariantTypeBytestring = newVariantType(C.G_VARIANT_TYPE_BYTESTRING) + VariantTypeBytestringArray = newVariantType(C.G_VARIANT_TYPE_BYTESTRING_ARRAY) + VariantTypeVardict = newVariantType(C.G_VARIANT_TYPE_VARDICT) +) + +// Free is a wrapper around g_variant_type_free. +// Reference counting is usually handled in the gotk layer, +// most applications should not call this. +func (v *VariantType) Free() { + C.g_variant_type_free(v.native()) +} + +// NewVariantType is a wrapper around g_variant_type_new. +func NewVariantTypeNew(typeString string) *VariantType { + cstr := (*C.gchar)(C.CString(typeString)) + defer C.free(unsafe.Pointer(cstr)) + + c := C.g_variant_type_new(cstr) + return takeVariantType(c) +} + +// VariantTypeStringIsValid is a wrapper around g_variant_type_string_is_valid. +func VariantTypeStringIsValid(typeString string) bool { + cstr := (*C.gchar)(C.CString(typeString)) + defer C.free(unsafe.Pointer(cstr)) + + return gobool(C.g_variant_type_string_is_valid(cstr)) +} + +// Equal is a wrapper around g_variant_type_equal. +func (v *VariantType) Equal(to *VariantType) bool { + b := gobool(C.g_variant_type_equal(C.gconstpointer(v.native()), C.gconstpointer(to.native()))) + runtime.KeepAlive(v) + return b +} + +// IsSubtypeOf is a wrapper around g_variant_type_is_subtype_of. +func (v *VariantType) IsSubtypeOf(supertype *VariantType) bool { + b := gobool(C.g_variant_type_is_subtype_of(v.native(), supertype.native())) + runtime.KeepAlive(v) + return b +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/glib/paramspec.go b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/paramspec.go new file mode 100644 index 00000000..687c1741 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/paramspec.go @@ -0,0 +1,264 @@ +package glib + +// #include "glib.go.h" +import "C" + +import ( + "log" + "runtime" + "unsafe" +) + +/* +type paramPrototyper interface { + paramSpec() *ParamSpec +} + +type ParamPrototype[T any] struct { + Name string + Nick string + Blurb string + Default T + Flags ParamFlags +} + +type ParamNumberPrototype[T ~int | ~uint | ~int32 | ~uint32 | ~int64 | ~uint64] struct { + Name string + Nick string + Blurb string + Min T + Max T + Default T + Flags ParamFlags +} + +func (p *ParamNumberPrototype[T]) paramSpec() *ParamSpec { + var z T + switch reflect.TypeOf(z).Kind() { + case reflect.Int, reflect.Int32: + return NewIntParam(p.Name, p.Nick, p.Blurb, int32(p.Min), int32(p.Max), int32(p.Default), p.Flags) + case reflect.Uint, reflect.Uint32: + } +} +*/ + +// ParamSpec is a go representation of a C GParamSpec +type ParamSpec struct{ *paramSpec } + +type paramSpec struct{ intern *C.GParamSpec } + +func newParamSpecCommon(name, nick, blurb string) (cname, cnick, cblurb *C.gchar, free func()) { + cname = (*C.gchar)(C.CString(name)) + cnick = (*C.gchar)(C.CString(nick)) + cblurb = (*C.gchar)(C.CString(blurb)) + free = func() { + C.free(unsafe.Pointer(cname)) + C.free(unsafe.Pointer(cnick)) + C.free(unsafe.Pointer(cblurb)) + } + + if !gobool(C.g_param_spec_is_valid_name(cname)) { + log.Panicf("invalid param spec name %q", name) + } + + return +} + +// NewStringParam returns a new ParamSpec that will hold a string value. +func NewStringParam(name, nick, blurb string, defaultValue string, flags ParamFlags) *ParamSpec { + var cdefault *C.gchar + if defaultValue != "" { + cdefault = C.CString(defaultValue) + } + + cname, cnick, cblurb, cfree := newParamSpecCommon(name, nick, blurb) + defer cfree() + + paramSpec := C.g_param_spec_string( + cname, cnick, cblurb, + (*C.gchar)(cdefault), + C.GParamFlags(flags), + ) + return ParamSpecTake(unsafe.Pointer(paramSpec), false) +} + +// NewBoolParam creates a new ParamSpec that will hold a boolean value. +func NewBoolParam(name, nick, blurb string, defaultValue bool, flags ParamFlags) *ParamSpec { + cname, cnick, cblurb, cfree := newParamSpecCommon(name, nick, blurb) + defer cfree() + + paramSpec := C.g_param_spec_boolean( + cname, cnick, cblurb, + gbool(defaultValue), + C.GParamFlags(flags), + ) + return ParamSpecTake(unsafe.Pointer(paramSpec), false) +} + +// NewIntParam creates a new ParamSpec that will hold a signed integer value. +func NewIntParam(name, nick, blurb string, min, max, defaultValue int32, flags ParamFlags) *ParamSpec { + cname, cnick, cblurb, cfree := newParamSpecCommon(name, nick, blurb) + defer cfree() + + paramSpec := C.g_param_spec_int( + cname, cnick, cblurb, + C.gint(min), + C.gint(max), + C.gint(defaultValue), + C.GParamFlags(flags), + ) + return ParamSpecTake(unsafe.Pointer(paramSpec), false) +} + +// NewUintParam creates a new ParamSpec that will hold an unsigned integer value. +func NewUintParam(name, nick, blurb string, min, max, defaultValue uint32, flags ParamFlags) *ParamSpec { + cname, cnick, cblurb, cfree := newParamSpecCommon(name, nick, blurb) + defer cfree() + + paramSpec := C.g_param_spec_uint( + cname, cnick, cblurb, + C.guint(min), + C.guint(max), + C.guint(defaultValue), + C.GParamFlags(flags), + ) + return ParamSpecTake(unsafe.Pointer(paramSpec), false) +} + +// NewInt64Param creates a new ParamSpec that will hold a signed 64-bit integer value. +func NewInt64Param(name, nick, blurb string, min, max, defaultValue int64, flags ParamFlags) *ParamSpec { + cname, cnick, cblurb, cfree := newParamSpecCommon(name, nick, blurb) + defer cfree() + + paramSpec := C.g_param_spec_int64( + cname, cnick, cblurb, + C.gint64(min), + C.gint64(max), + C.gint64(defaultValue), + C.GParamFlags(flags), + ) + return ParamSpecTake(unsafe.Pointer(paramSpec), false) +} + +// NewUint64Param creates a new ParamSpec that will hold an unsigned 64-bit integer value. +func NewUint64Param(name, nick, blurb string, min, max, defaultValue uint64, flags ParamFlags) *ParamSpec { + cname, cnick, cblurb, cfree := newParamSpecCommon(name, nick, blurb) + defer cfree() + + paramSpec := C.g_param_spec_uint64( + cname, cnick, cblurb, + C.guint64(min), + C.guint64(max), + C.guint64(defaultValue), + C.GParamFlags(flags), + ) + return ParamSpecTake(unsafe.Pointer(paramSpec), false) +} + +// NewFloat32Param creates a new ParamSpec that will hold a 32-bit float value. +func NewFloat32Param(name, nick, blurb string, min, max, defaultValue float32, flags ParamFlags) *ParamSpec { + cname, cnick, cblurb, cfree := newParamSpecCommon(name, nick, blurb) + defer cfree() + + paramSpec := C.g_param_spec_float( + cname, cnick, cblurb, + C.gfloat(min), + C.gfloat(max), + C.gfloat(defaultValue), + C.GParamFlags(flags), + ) + return ParamSpecTake(unsafe.Pointer(paramSpec), false) +} + +// NewFloat64Param creates a new ParamSpec that will hold a 64-bit float value. +func NewFloat64Param(name, nick, blurb string, min, max, defaultValue float64, flags ParamFlags) *ParamSpec { + cname, cnick, cblurb, cfree := newParamSpecCommon(name, nick, blurb) + defer cfree() + + paramSpec := C.g_param_spec_double( + cname, cnick, cblurb, + C.gdouble(min), + C.gdouble(max), + C.gdouble(defaultValue), + C.GParamFlags(flags), + ) + return ParamSpecTake(unsafe.Pointer(paramSpec), false) +} + +// NewBoxedParam creates a new ParamSpec containing a boxed type. +func NewBoxedParam(name, nick, blurb string, boxedType Type, flags ParamFlags) *ParamSpec { + cname, cnick, cblurb, cfree := newParamSpecCommon(name, nick, blurb) + defer cfree() + + paramSpec := C.g_param_spec_boxed( + cname, cnick, cblurb, + C.GType(boxedType), + C.GParamFlags(flags), + ) + return ParamSpecTake(unsafe.Pointer(paramSpec), false) +} + +// ParamSpecFromNative wraps ptr into a ParamSpec. +func ParamSpecFromNative(ptr unsafe.Pointer) *ParamSpec { + return &ParamSpec{¶mSpec{(*C.GParamSpec)(ptr)}} +} + +// ParamSpecTake wraps ptr into a ParamSpec and ensures that it's properly GC'd. +func ParamSpecTake(ptr unsafe.Pointer, take bool) *ParamSpec { + p := ParamSpecFromNative(ptr) + if !take { + C.g_param_spec_ref(p.intern) + } + runtime.SetFinalizer(p.paramSpec, func(p *paramSpec) { + C.g_param_spec_unref(p.intern) + }) + return p +} + +// Name returns the name of this parameter. +func (p *ParamSpec) Name() string { + return C.GoString(C.g_param_spec_get_name(p.intern)) +} + +// Blurb returns the blurb for this parameter. +func (p *ParamSpec) Blurb() string { + return C.GoString(C.g_param_spec_get_blurb(p.intern)) +} + +// Flags returns the flags for this parameter. +func (p *ParamSpec) Flags() ParamFlags { + return ParamFlags(p.intern.flags) +} + +// ValueType returns the GType for the value inside this parameter. +func (p *ParamSpec) ValueType() Type { + return Type(p.intern.value_type) +} + +// OwnerType returns the Gtype for the owner of this parameter. +func (p *ParamSpec) OwnerType() Type { + return Type(p.intern.owner_type) +} + +// Unref the underlying paramater spec. +func (p *ParamSpec) Unref() { C.g_param_spec_unref(p.intern) } + +// ParamFlags is a go cast of GParamFlags. +type ParamFlags int + +// Has returns true if these flags contain the provided ones. +func (p ParamFlags) Has(b ParamFlags) bool { return p&b != 0 } + +const ( + ParamReadable ParamFlags = C.G_PARAM_READABLE + ParamWritable = C.G_PARAM_WRITABLE + ParamReadWrite = C.G_PARAM_READABLE | C.G_PARAM_WRITABLE + ParamConstruct = C.G_PARAM_CONSTRUCT + ParamConstructOnly = C.G_PARAM_CONSTRUCT_ONLY + ParamLaxValidation = C.G_PARAM_LAX_VALIDATION + ParamStaticName = C.G_PARAM_STATIC_NAME + ParamStaticNick = C.G_PARAM_STATIC_NICK + ParamStaticBlurb = C.G_PARAM_STATIC_BLURB + ParamExplicitNotify = C.G_PARAM_EXPLICIT_NOTIFY + ParamDeprecated = C.G_PARAM_DEPRECATED +) diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/glib/slist.go b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/slist.go new file mode 100644 index 00000000..ff664e87 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/slist.go @@ -0,0 +1,177 @@ +package glib + +// #include +// #include +// #include "glib.go.h" +import "C" + +import ( + "runtime" + "unsafe" +) + +// TODO(go1.18): Make SList a generic type. + +// SList is a representation of Glib's GSList. A SList must be manually freed +// by either calling Free() or FreeFull() +type SList struct { + list *C.struct__GSList + // If set, dataWrap is called every time Data() + // is called to wrap raw underlying + // value into appropriate type. + dataWrap func(unsafe.Pointer) interface{} +} + +func WrapSList(obj uintptr) *SList { + return wrapSList((*C.struct__GSList)(unsafe.Pointer(obj))) +} + +func wrapSList(obj *C.struct__GSList) *SList { + if obj == nil { + return nil + } + + //NOTE a list should be freed by calling either + //g_slist_free() or g_slist_free_full(). However, it's not possible to use a + //finalizer for this. + return &SList{list: obj} +} + +func (v *SList) wrapNewHead(obj *C.struct__GSList) *SList { + if obj == nil { + return nil + } + return &SList{ + list: obj, + dataWrap: v.dataWrap, + } +} + +func (v *SList) Native() uintptr { + return uintptr(unsafe.Pointer(v.list)) +} + +func (v *SList) native() *C.struct__GSList { + if v == nil || v.list == nil { + return nil + } + return v.list +} + +// DataWapper sets wrap functions, which is called during NthData() +// and Data(). It's used to cast raw C data into appropriate +// Go structures and types every time that data is retreived. +func (v *SList) DataWrapper(fn func(unsafe.Pointer) interface{}) { + if v == nil { + return + } + v.dataWrap = fn +} + +func (v *SList) Append(data uintptr) *SList { + defer runtime.KeepAlive(v) + + ret := C.g_slist_append(v.native(), C.gpointer(data)) + if ret == v.native() { + return v + } + + return v.wrapNewHead(ret) +} + +// Length is a wrapper around g_slist_length(). +func (v *SList) Length() uint { + defer runtime.KeepAlive(v) + + return uint(C.g_slist_length(v.native())) +} + +// Next is a wrapper around the next struct field +func (v *SList) Next() *SList { + defer runtime.KeepAlive(v) + + n := v.native() + if n == nil { + return nil + } + + return wrapSList(n.next) +} + +// dataRaw is a wrapper around the data struct field +func (v *SList) dataRaw() unsafe.Pointer { + n := v.native() + if n == nil { + return nil + } + return unsafe.Pointer(n.data) +} + +// DataRaw is a wrapper around the data struct field +func (v *SList) DataRaw() unsafe.Pointer { + defer runtime.KeepAlive(v) + + n := v.native() + if n == nil { + return nil + } + return unsafe.Pointer(n.data) +} + +// Data acts the same as data struct field, but it returns raw unsafe.Pointer as interface. +// TODO: Align with List struct and add member + logic for `dataWrap func(unsafe.Pointer) interface{}`? +func (v *SList) Data() interface{} { + defer runtime.KeepAlive(v) + + ptr := v.dataRaw() + if v.dataWrap != nil { + return v.dataWrap(ptr) + } + return ptr +} + +// Foreach acts the same as g_slist_foreach(). +// No user_data argument is implemented because of Go clojure capabilities. +func (v *SList) Foreach(fn func(item interface{})) { + for l := v; l != nil; l = l.Next() { + fn(l.Data()) + } +} + +// Free is a wrapper around g_slist_free(). +func (v *SList) Free() { + C.g_slist_free(v.native()) + runtime.KeepAlive(v) +} + +// FreeFull is a wrapper around g_slist_free_full(). +func (v *SList) FreeFull() { + //TODO implement GDestroyNotify callback + C.g_slist_free_full(v.native(), nil) + runtime.KeepAlive(v) +} + +// GSList * g_slist_alloc () +// GSList * g_slist_prepend () +// GSList * g_slist_insert () +// GSList * g_slist_insert_before () +// GSList * g_slist_insert_sorted () +// GSList * g_slist_remove () +// GSList * g_slist_remove_link () +// GSList * g_slist_delete_link () +// GSList * g_slist_remove_all () +// void g_slist_free_1 () +// GSList * g_slist_copy () +// GSList * g_slist_copy_deep () +// GSList * g_slist_reverse () +// GSList * g_slist_insert_sorted_with_data () +// GSList * g_slist_sort () +// GSList * g_slist_sort_with_data () +// GSList * g_slist_concat () +// GSList * g_slist_last () +// GSList * g_slist_nth () +// gpointer g_slist_nth_data () +// GSList * g_slist_find () +// GSList * g_slist_find_custom () +// gint g_slist_position () +// gint g_slist_index () diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/glib/weakref.go b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/weakref.go new file mode 100644 index 00000000..b359b853 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/glib/weakref.go @@ -0,0 +1,110 @@ +package glib + +// #include +// #include +// +// extern void _gotk4_glib_weak_notify(gpointer, GObject*); +import "C" + +import ( + "fmt" + "runtime" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/intern" +) + +// WeakRefObject is like SetFinalizer, except it's not thread-safe (so notify +// SHOULD NOT REFERENCE OBJECT). It is best that you just do not use this at +// all. +func WeakRefObject(obj Objector, notify func()) { + data := gbox.AssignOnce(notify) + C.g_object_weak_ref( + BaseObject(obj).native(), + C.GWeakNotify(C._gotk4_glib_weak_notify), + C.gpointer(data)) +} + +//export _gotk4_glib_weak_notify +func _gotk4_glib_weak_notify(data C.gpointer, _ *C.GObject) { + notify := gbox.Get(uintptr(data)).(func()) + notify() +} + +// WeakRef wraps GWeakRef. It provides a container that allows the user to +// obtain a weak reference to a CGo GObject. The weak reference is thread-safe +// and will be cleared when the object is finalized. +type WeakRef[T Objector] struct { + weak C.GWeakRef + gtyp Type +} + +// NewWeakRef creates a new weak reference on the Go heap to the given GObject's +// C pointer. The fact that the returned WeakRef is in Go-allocated memory does +// not actually add a reference to the object, which is the default behavior. +func NewWeakRef[T Objector](obj T) *WeakRef[T] { + wk := &WeakRef[T]{} + wk.gtyp = BaseObject(obj).Type() + C.g_weak_ref_init(&wk.weak, C.gpointer(BaseObject(obj).native())) + + // Unsure if calling clear is needed, but we'd rather be careful. + runtime.SetFinalizer(wk, (*WeakRef[T]).clear) + runtime.KeepAlive(obj) + + return wk +} + +func (r *WeakRef[T]) clear() { + C.g_weak_ref_clear(&r.weak) +} + +// Get acquires a strong reference to the object if the weak reference is still +// valid. If the weak reference is no longer valid, Get returns nil. +func (r *WeakRef[T]) Get() T { + // The thread safetyness of this is actually debatable. I haven't confirmed + // this, but it should still work fine. + gobjectPtr := C.g_weak_ref_get(&r.weak) + if gobjectPtr == nil { + var z T + return z + } + + // weak_ref_get actually takes a strong reference atomically. With the rest + // of this function, we either obtain a strong Go reference (mapping to the + // toggle reference) or we cannot get a reference at all. In either case, we + // can safely unref the object after this function. + defer C.g_object_unref(C.gpointer(gobjectPtr)) + + // Try to see if we have the object in our GObject intern pool. If not, + // don't try to construct a new one. + box := intern.TryGet(unsafe.Pointer(gobjectPtr)) + if box == nil { + var z T + return z + } + + // Construct a new Object pointer from the box. Keep in mind our equality + // guarantees. + obj := &Object{box: box} + + if v, ok := obj.CastType(r.gtyp).(T); ok { + // Try casting using the GType. + // This is the most common case. + return v + } + + // The GType might be a private extended type. In this case, we need to + // use WalkCast and forego the GType. + v := obj.WalkCast(func(obj Objector) bool { + _, ok := obj.(T) + return ok + }) + if v, ok := v.(T); ok { + return v + } + + // If we still can't cast, then we're out of luck. + var z T + panic(fmt.Sprintf("glib: weak reference cast failed: %T does not satisfy %s", z, r.gtyp)) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern.c b/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern.c new file mode 100644 index 00000000..6ec2e1d0 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern.c @@ -0,0 +1,18 @@ +#include "intern.h" + +const gchar *gotk4_object_type_name(gpointer obj) { + return G_OBJECT_TYPE_NAME(obj); +}; + +gboolean gotk4_intern_remove_toggle_ref(gpointer obj) { + // First, remove the toggle reference. This forces the object to be freed, + // calling any necessary finalizers. + g_object_remove_toggle_ref(G_OBJECT(obj), (GToggleNotify)goToggleNotify, + NULL); + + // Only once the object is freed, we can remove it from the weak reference + // registry, since now the finalizers will not be called anymore. + goFinishRemovingToggleRef(obj); + + return FALSE; +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern.go b/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern.go new file mode 100644 index 00000000..dbaa3caa --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern.go @@ -0,0 +1,378 @@ +// Package intern implements value interning for Cgo sharing. +package intern + +// #cgo pkg-config: gobject-2.0 +// #include "intern.h" +import "C" + +import ( + "fmt" + "runtime" + "runtime/debug" + "runtime/pprof" + "sync" + "sync/atomic" + "unsafe" + + "github.com/KarpelesLab/weak" + "github.com/diamondburned/gotk4/pkg/core/closure" + "github.com/diamondburned/gotk4/pkg/core/gdebug" + + // Require a non-moving GC for heap pointers. Current GC is moving only by + // the stack. See https://github.com/go4org/intern. + _ "go4.org/unsafe/assume-no-moving-gc" +) + +// Box is an opaque type holding extra data. +type Box struct { + dummy *boxDummy + closures atomic.Pointer[closure.Registry] + gobject unsafe.Pointer + finalize bool +} + +type boxDummy struct { + gobject unsafe.Pointer +} + +// Object returns Box's C GObject pointer. +func (b *Box) GObject() unsafe.Pointer { + return b.gobject +} + +// Closures returns the closure registry for this Box. +func (b *Box) Closures() *closure.Registry { + closures := b.closures.Load() + if closures != nil { + return closures + } + + // If the closures are nil, then we'll have to create a new one. + closures = closure.NewRegistry() + if !b.closures.CompareAndSwap(nil, closures) { + // If the CAS failed, then we'll read the value again. + return b.closures.Load() + } + + return closures +} + +// Hack to force an object on the heap. +var never bool +var sink_ interface{} + +//go:nosplit +func sink(v interface{}) { + if never { + sink_ = v + } +} + +var ( + traceObjects = gdebug.NewDebugLoggerNullable("trace-objects") + toggleRefs = gdebug.NewDebugLoggerNullable("toggle-refs") + objectProfile *pprof.Profile +) + +func init() { + if gdebug.HasKey("profile-objects") { + objectProfile = pprof.NewProfile("gotk4-object-box") + } +} + +func objInfo(obj unsafe.Pointer) string { + return fmt.Sprintf("%p (%s):", obj, C.GoString(C.gotk4_object_type_name(C.gpointer(obj)))) +} + +func objRefCount(obj unsafe.Pointer) int { + return int(C.g_atomic_int_get((*C.gint)(unsafe.Pointer(&(*C.GObject)(obj).ref_count)))) +} + +// newBox creates a zero-value instance of Box. +func newBox(obj unsafe.Pointer) *Box { + box := &Box{} + box.gobject = obj + + // Cheat Go's GC by adding a finalizer to a dummy pointer that is inside Box + // but is not Box itself. + box.dummy = &boxDummy{gobject: obj} + sink(box.dummy) + runtime.SetFinalizer(box.dummy, finalizeBox) + + if objectProfile != nil { + objectProfile.Add(obj, 3) + } + + if traceObjects != nil { + traceObjects.Printf("%p: %s", obj, debug.Stack()) + } + + // Force box on the heap. Objects on the stack can move, but not objects on + // the heap. At least not for now; the assume-no-moving-gc import will + // guard against that. + sink(box) + + return box +} + +// shared contains shared closure data. +var shared = struct { + mu sync.RWMutex + // weak stores *Box while the object is in Go's heap. The finalizer will + // move *Box to strong if the reference is toggled. This is only the case, + // because the finalizer will not run otherwise. + weak *weak.Map[unsafe.Pointer, Box] + // strong stores *Box while the object is still referenced by C but not Go. + strong map[unsafe.Pointer]*Box +}{ + weak: weak.NewMap[unsafe.Pointer, Box](), + strong: make(map[unsafe.Pointer]*Box, 1024), +} + +// TryGet gets the Box associated with the GObject or nil if it's gone. The +// caller must not retain the Box pointer anywhere. +func TryGet(gobject unsafe.Pointer) *Box { + shared.mu.RLock() + box, _ := gets(gobject) + shared.mu.RUnlock() + return box +} + +// Get gets the interned box for the given GObject C pointer. If the object is +// new or unknown, then a new box is made. If the intern box already exists for +// a given C pointer, then that box is weakly referenced and returned. The box +// will be reference-counted; the caller must use ShouldFree to unreference it. +func Get(gobject unsafe.Pointer, take bool) *Box { + // If the registry does not exist, then we'll have to globally register it. + // If the registry is currently strongly referenced, then we must move it to + // a weak reference. + + box := TryGet(gobject) + if box != nil { + return box + } + + shared.mu.Lock() + + box, _ = gets(gobject) + if box != nil { + shared.mu.Unlock() + return box + } + + box = newBox(gobject) + + // add_toggle_ref's documentation states: + // + // Since a (normal) reference must be held to the object before + // calling g_object_add_toggle_ref(), the initial state of the + // reverse link is always strong. + // + shared.strong[gobject] = box + + if toggleRefs != nil { + toggleRefs.Println(objInfo(gobject), + "Get: will introduce new box, current ref =", objRefCount(gobject)) + } + + shared.mu.Unlock() + + C.g_object_add_toggle_ref( + (*C.GObject)(gobject), + (*[0]byte)(C.goToggleNotify), nil, + ) + + // We should already have a strong reference. Sink the object in case. This + // will force the reference to be truly strong. + if C.g_object_is_floating(C.gpointer(gobject)) != C.FALSE { + // First, we need to ref_sink the object to convert the floating + // reference to a strong reference. + C.g_object_ref_sink(C.gpointer(gobject)) + // Then, we need to unref it to balance the ref_sink. + C.g_object_unref(C.gpointer(gobject)) + + if toggleRefs != nil { + toggleRefs.Println(objInfo(gobject), + "Get: ref_sink'd the object, current ref =", objRefCount(gobject)) + } + } + + // If we're "not taking," then we can assume our ownership over the object, + // meaning the strong reference is now ours. That means we need to replace + // it, not add. + if !take { + if toggleRefs != nil { + toggleRefs.Println(objInfo(gobject), + "Get: not taking, so unrefing the object, current ref =", objRefCount(gobject)) + } + C.g_object_unref(C.gpointer(gobject)) + } + + if toggleRefs != nil { + toggleRefs.Println(objInfo(gobject), + "Get: introduced new box, current ref =", objRefCount(gobject)) + } + + // Undo the initial ref_sink. + // C.g_object_unref(C.gpointer(gobject)) + + return box +} + +// Free explicitly frees the box permanently. It must not be resurrected after +// this. +// +// Deprecated: this function is no longer needed. +func Free(box *Box) { + panic("not implemented") +} + +// finalizeBox only delays its finalization until GLib notifies us a toggle. It +// does so for as long as an object is stored only in the Go heap. Once the +// object is also shared, the toggle notifier will strongly reference the Box. +func finalizeBox(dummy *boxDummy) { + if dummy == nil { + panic("bug: finalizeBox called with nil dummy") + } + + shared.mu.Lock() + defer shared.mu.Unlock() + + box, strong := gets(dummy.gobject) + if box == nil { + // Silently ignore unknown objects. + // + // This is a trick to make sure that the box is really finalized. Turns + // out it hates being finalized in goFinishRemovingToggleRef, so we just + // don't call it there and let the GC do its thing. + + if traceObjects != nil { + traceObjects.Printf("%p: finalizeBox: unknown object", dummy.gobject) + } + + return + } + + // Always delegate the finalization to the next cycle. + // This won't be the case once goFinishRemovingToggleRef is called. + runtime.SetFinalizer(dummy, finalizeBox) + + if box.finalize { + // If the box is already finalizing, then we don't need to do anything. + // Repeat this until box is gone from the registry. + + if toggleRefs != nil { + toggleRefs.Printf( + "%p: finalizeBox: already finalizing, waiting for goFinishRemovingToggleRef", + dummy.gobject) + } + + return + } + + if strong { + // If strong: the closures are strong-referenced, then they might still + // be referenced from the C side, and those closures might access this + // object. Don't free. + + if toggleRefs != nil { + toggleRefs.Println( + objInfo(dummy.gobject), + "finalizeBox: moving finalize to next GC cycle since object is still strong") + } + + return + } + + // Mark the box as finalizing. + box.finalize = true + + // Do this before we dispatch the remove_toggle_ref, because the + // remove_toggle_ref might destroy the object. + var objInfoS string + if toggleRefs != nil { + objInfoS = objInfo(dummy.gobject) + } + + // Do this in the main loop instead. This is because finalizers are + // called in a finalizer thread, and our remove_toggle_ref might be + // destroying other main loop objects. + C.g_main_context_invoke( + nil, // nil means the default main context + (*[0]byte)(C.gotk4_intern_remove_toggle_ref), + C.gpointer(dummy.gobject)) + + if toggleRefs != nil { + toggleRefs.Printf( + "%s finalizeBox: remove_toggle_ref queued for next main loop iteration for box %p", + objInfoS, box) + } +} + +//go:nosplit +func gets(gobject unsafe.Pointer) (b *Box, strong bool) { + if strong, ok := shared.strong[gobject]; ok { + return strong, true + } + + if weak := shared.weak.Get(gobject); weak != nil { + // If forObject is false, then that probably means this was called + // inside goMarshal while the Go object is still alive, otherwise + // toggleNotify would've moved it over. We don't have to worry about + // this being freed as long as we acquire the mutex. + // + // TODO: does this actually resurrect the value properly? We have a + // mutex to guard this which is also used in the finalizer, so it + // shouldn't explode, but still. + return weak, false + } + + return nil, false +} + +// makeStrong forces the Box instance associated with the given object to be +// strongly referenced. +// +//go:nosplit +func makeStrong(gobject unsafe.Pointer) *Box { + // TODO: double mutex check, similar to ShouldFree. + + box, strong := gets(gobject) + if toggleRefs != nil { + toggleRefs.Println(objInfo(gobject), "makeStrong: obtained box", box, "strong =", strong) + } + if box == nil { + return nil + } + + if !strong { + shared.strong[gobject] = box + shared.weak.Delete(gobject) + + // Clear weak.Map's finalizer. + runtime.SetFinalizer(box, nil) + } + + return box +} + +// makeWeak forces the Box intsance associated with the given object to be +// weakly referenced. +// +//go:nosplit +func makeWeak(gobject unsafe.Pointer) *Box { + box, strong := gets(gobject) + if toggleRefs != nil { + toggleRefs.Println(objInfo(gobject), "makeWeak: obtained box", box, "strong =", strong) + } + if box == nil { + return nil + } + + if strong { + shared.weak.Set(gobject, box) + delete(shared.strong, gobject) + } + + return box +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern.h b/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern.h new file mode 100644 index 00000000..c7d53edb --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern.h @@ -0,0 +1,6 @@ +#include + +extern void goToggleNotify(gpointer, GObject *, gboolean); +extern void goFinishRemovingToggleRef(gpointer); +const gchar *gotk4_object_type_name(gpointer obj); +gboolean gotk4_intern_remove_toggle_ref(gpointer obj); diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern_export.go b/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern_export.go new file mode 100644 index 00000000..bb4ed5f2 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/intern/intern_export.go @@ -0,0 +1,105 @@ +package intern + +// #cgo pkg-config: gobject-2.0 +// #include "intern.h" +import "C" + +import ( + "unsafe" +) + +// goToggleNotify is called by GLib on each toggle notification. It doesn't +// actually free anything and relies on Box's finalizer to free both the box and +// the C GObject. +// +//export goToggleNotify +func goToggleNotify(_ C.gpointer, obj *C.GObject, isLastInt C.gboolean) { + gobject := unsafe.Pointer(obj) + isLast := isLastInt != C.FALSE + + shared.mu.Lock() + defer shared.mu.Unlock() + + var box *Box + if isLast { + box = makeWeak(gobject) + } else { + box = makeStrong(gobject) + } + + if box == nil { + if toggleRefs != nil { + toggleRefs.Println(objInfo(unsafe.Pointer(obj)), "goToggleNotify: box not found") + } + return + } + + if box.finalize { + if toggleRefs != nil { + toggleRefs.Println(objInfo(unsafe.Pointer(obj)), "goToggleNotify: resurrecting finalized object") + } + box.finalize = false + return + } + + if toggleRefs != nil { + toggleRefs.Println(objInfo(unsafe.Pointer(obj)), "goToggleNotify: is last =", isLast) + } +} + +// finishRemovingToggleRef is called after the toggle reference removal routine +// is dispatched in the main loop. It removes the GObject from the global maps. +// +//export goFinishRemovingToggleRef +func goFinishRemovingToggleRef(gobject unsafe.Pointer) { + if toggleRefs != nil { + toggleRefs.Printf("goFinishRemovingToggleRef: called on %p", gobject) + } + + shared.mu.Lock() + defer shared.mu.Unlock() + + box, strong := gets(gobject) + if box == nil { + if toggleRefs != nil { + toggleRefs.Printf( + "goFinishRemovingToggleRef: object %p not found in weak map", + gobject) + } + return + } + + if toggleRefs != nil { + toggleRefs.Printf( + "goFinishRemovingToggleRef: object %p found in weak map containing box %p", + gobject, box) + } + + if strong { + if toggleRefs != nil { + toggleRefs.Printf( + "goFinishRemovingToggleRef: object %p still strong", + gobject) + } + return + } + + if !box.finalize { + if toggleRefs != nil { + toggleRefs.Printf( + "goFinishRemovingToggleRef: object %p not finalizing, instead resurrected", + gobject) + } + return + } + + shared.weak.Delete(gobject) + + if toggleRefs != nil { + toggleRefs.Printf("goFinishRemovingToggleRef: removed %p from weak ref, will be finalized soon", gobject) + } + + if objectProfile != nil { + objectProfile.Remove(gobject) + } +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/core/slab/slab.go b/vendor/github.com/diamondburned/gotk4/pkg/core/slab/slab.go new file mode 100644 index 00000000..421bff10 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/core/slab/slab.go @@ -0,0 +1,129 @@ +package slab + +import ( + "sync" + "sync/atomic" +) + +// atomicContainer is a struct containing an interface that is used for swapping +// into Value. +type atomicContainer struct { + data interface{} +} + +type slabEntry struct { + Value atomic.Value + Index uintptr + Once bool +} + +// Slab is an implementation of the internal registry free list. A zero-value +// instance is a valid instance. A slab is safe to use concurrently. +type Slab struct { + list []slabEntry // 3 words + mu sync.RWMutex // 3 words (assuming 64-bit) + free uintptr // 1 word +} + +// Grow grows the slab to the given capacity. +func (s *Slab) Grow(n int) { + s.mu.Lock() + defer s.mu.Unlock() + + if cap(s.list) < n { + new := make([]slabEntry, len(s.list), n) + copy(new, s.list) + s.list = new + } +} + +// Put stores the entry inside the slab. If once is true, then when the entry is +// retrieved using Get, it will also be wiped off the list. +func (s *Slab) Put(entry interface{}, once bool) uintptr { + slabEntry := slabEntry{atomic.Value{}, 0, once} + if once { + // Wrap the entry value inside an atomic container for type consistency. + slabEntry.Value.Store(atomicContainer{entry}) + } else { + slabEntry.Value.Store(entry) + } + + s.mu.Lock() + defer s.mu.Unlock() + + if s.free == uintptr(len(s.list)) { + index := uintptr(len(s.list)) + s.list = append(s.list, slabEntry) + s.free++ + + return index + } + + index := s.free + s.free = s.list[index].Index + s.list[index] = slabEntry + + return index +} + +// Get gets the entry at the given index. +func (s *Slab) Get(i uintptr) interface{} { + s.mu.RLock() + + // Perform simple bound check. + if i >= uintptr(len(s.list)) { + s.mu.RUnlock() + return nil + } + + entry := s.list[i] + var v interface{} + + // Perform an atomic value retrieve. + if entry.Once { + // Use Swap here, so that future Get is guaranteed to return an empty + // atomicContainer while we're acquiring the lock in Pop. + container := entry.Value.Swap(atomicContainer{}).(atomicContainer) + s.mu.RUnlock() + // Reacquire the lock and free the entry in the list. + s.Delete(i) + // Set v if the container is not empty. + if container.data != nil { + v = container.data + } + } else { + v = entry.Value.Load() + s.mu.RUnlock() + } + + return v +} + +// Pop removes the entry at the given index and returns the old value. +func (s *Slab) Pop(i uintptr) interface{} { + s.mu.Lock() + defer s.mu.Unlock() + + // Perform simple bound check. + if i >= uintptr(len(s.list)) { + return nil + } + + popped := s.list[i].Value.Load() + s.list[i] = slabEntry{atomic.Value{}, s.free, false} + s.free = i + + return popped +} + +// Delete removes the entry at the given index. +func (s *Slab) Delete(i uintptr) { + s.mu.Lock() + defer s.mu.Unlock() + + // Perform simple bound check. + if i < uintptr(len(s.list)) { + s.list[i] = slabEntry{atomic.Value{}, s.free, false} + s.free = i + } +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/gdk/v4/gdk.go b/vendor/github.com/diamondburned/gotk4/pkg/gdk/v4/gdk.go new file mode 100644 index 00000000..46c5e73f --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/gdk/v4/gdk.go @@ -0,0 +1,21223 @@ +// Code generated by girgen. DO NOT EDIT. + +package gdk + +import ( + "context" + "fmt" + "runtime" + _ "runtime/cgo" + "strings" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/cairo" + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gcancel" + "github.com/diamondburned/gotk4/pkg/core/gerror" + "github.com/diamondburned/gotk4/pkg/core/gextras" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" + "github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2" + "github.com/diamondburned/gotk4/pkg/gio/v2" + "github.com/diamondburned/gotk4/pkg/glib/v2" + "github.com/diamondburned/gotk4/pkg/pango" +) + +// #cgo pkg-config: gtk4 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// #include +// #include +// extern void _gotk4_gio2_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer); +// extern void _gotk4_gdk4_VulkanContext_ConnectImagesUpdated(gpointer, guintptr); +// extern void _gotk4_gdk4_Surface_ConnectLeaveMonitor(gpointer, GdkMonitor*, guintptr); +// extern void _gotk4_gdk4_Surface_ConnectLayout(gpointer, gint, gint, guintptr); +// extern void _gotk4_gdk4_Surface_ConnectEnterMonitor(gpointer, GdkMonitor*, guintptr); +// extern void _gotk4_gdk4_Seat_ConnectToolRemoved(gpointer, GdkDeviceTool*, guintptr); +// extern void _gotk4_gdk4_Seat_ConnectToolAdded(gpointer, GdkDeviceTool*, guintptr); +// extern void _gotk4_gdk4_Seat_ConnectDeviceRemoved(gpointer, GdkDevice*, guintptr); +// extern void _gotk4_gdk4_Seat_ConnectDeviceAdded(gpointer, GdkDevice*, guintptr); +// extern void _gotk4_gdk4_Paintable_ConnectInvalidateSize(gpointer, guintptr); +// extern void _gotk4_gdk4_Paintable_ConnectInvalidateContents(gpointer, guintptr); +// extern void _gotk4_gdk4_Monitor_ConnectInvalidate(gpointer, guintptr); +// extern void _gotk4_gdk4_FrameClock_ConnectUpdate(gpointer, guintptr); +// extern void _gotk4_gdk4_FrameClock_ConnectResumeEvents(gpointer, guintptr); +// extern void _gotk4_gdk4_FrameClock_ConnectPaint(gpointer, guintptr); +// extern void _gotk4_gdk4_FrameClock_ConnectLayout(gpointer, guintptr); +// extern void _gotk4_gdk4_FrameClock_ConnectFlushEvents(gpointer, guintptr); +// extern void _gotk4_gdk4_FrameClock_ConnectBeforePaint(gpointer, guintptr); +// extern void _gotk4_gdk4_FrameClock_ConnectAfterPaint(gpointer, guintptr); +// extern void _gotk4_gdk4_Drag_ConnectDropPerformed(gpointer, guintptr); +// extern void _gotk4_gdk4_Drag_ConnectDNDFinished(gpointer, guintptr); +// extern void _gotk4_gdk4_Drag_ConnectCancel(gpointer, GdkDragCancelReason, guintptr); +// extern void _gotk4_gdk4_Display_ConnectSettingChanged(gpointer, gchar*, guintptr); +// extern void _gotk4_gdk4_Display_ConnectSeatRemoved(gpointer, GdkSeat*, guintptr); +// extern void _gotk4_gdk4_Display_ConnectSeatAdded(gpointer, GdkSeat*, guintptr); +// extern void _gotk4_gdk4_Display_ConnectOpened(gpointer, guintptr); +// extern void _gotk4_gdk4_Display_ConnectClosed(gpointer, gboolean, guintptr); +// extern void _gotk4_gdk4_DisplayManager_ConnectDisplayOpened(gpointer, GdkDisplay*, guintptr); +// extern void _gotk4_gdk4_Device_ConnectToolChanged(gpointer, GdkDeviceTool*, guintptr); +// extern void _gotk4_gdk4_Device_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gdk4_ContentProvider_ConnectContentChanged(gpointer, guintptr); +// extern void _gotk4_gdk4_ContentProviderClass_detach_clipboard(GdkContentProvider*, GdkClipboard*); +// extern void _gotk4_gdk4_ContentProviderClass_content_changed(GdkContentProvider*); +// extern void _gotk4_gdk4_ContentProviderClass_attach_clipboard(GdkContentProvider*, GdkClipboard*); +// extern void _gotk4_gdk4_Clipboard_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gdk4_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer); +// extern gboolean _gotk4_gdk4_Surface_ConnectRender(gpointer, cairo_region_t*, guintptr); +// extern gboolean _gotk4_gdk4_Surface_ConnectEvent(gpointer, gpointer*, guintptr); +// extern gboolean _gotk4_gdk4_ContentProviderClass_write_mime_type_finish(GdkContentProvider*, GAsyncResult*, GError**); +// extern gboolean _gotk4_gdk4_ContentProviderClass_get_value(GdkContentProvider*, GValue*, GError**); +// extern GdkContentFormats* _gotk4_gdk4_ContentProviderClass_ref_storable_formats(GdkContentProvider*); +// extern GdkContentFormats* _gotk4_gdk4_ContentProviderClass_ref_formats(GdkContentProvider*); +// GdkContentFormats* _gotk4_gdk4_ContentProvider_virtual_ref_formats(void* fnptr, GdkContentProvider* arg0) { +// return ((GdkContentFormats* (*)(GdkContentProvider*))(fnptr))(arg0); +// }; +// GdkContentFormats* _gotk4_gdk4_ContentProvider_virtual_ref_storable_formats(void* fnptr, GdkContentProvider* arg0) { +// return ((GdkContentFormats* (*)(GdkContentProvider*))(fnptr))(arg0); +// }; +// GdkPaintable* _gotk4_gdk4_Paintable_virtual_get_current_image(void* fnptr, GdkPaintable* arg0) { +// return ((GdkPaintable* (*)(GdkPaintable*))(fnptr))(arg0); +// }; +// GdkPaintableFlags _gotk4_gdk4_Paintable_virtual_get_flags(void* fnptr, GdkPaintable* arg0) { +// return ((GdkPaintableFlags (*)(GdkPaintable*))(fnptr))(arg0); +// }; +// double _gotk4_gdk4_Paintable_virtual_get_intrinsic_aspect_ratio(void* fnptr, GdkPaintable* arg0) { +// return ((double (*)(GdkPaintable*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gdk4_ContentProvider_virtual_get_value(void* fnptr, GdkContentProvider* arg0, GValue* arg1, GError** arg2) { +// return ((gboolean (*)(GdkContentProvider*, GValue*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gdk4_ContentProvider_virtual_write_mime_type_finish(void* fnptr, GdkContentProvider* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GdkContentProvider*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// int _gotk4_gdk4_Paintable_virtual_get_intrinsic_height(void* fnptr, GdkPaintable* arg0) { +// return ((int (*)(GdkPaintable*))(fnptr))(arg0); +// }; +// int _gotk4_gdk4_Paintable_virtual_get_intrinsic_width(void* fnptr, GdkPaintable* arg0) { +// return ((int (*)(GdkPaintable*))(fnptr))(arg0); +// }; +// void _gotk4_gdk4_ContentProvider_virtual_attach_clipboard(void* fnptr, GdkContentProvider* arg0, GdkClipboard* arg1) { +// ((void (*)(GdkContentProvider*, GdkClipboard*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gdk4_ContentProvider_virtual_content_changed(void* fnptr, GdkContentProvider* arg0) { +// ((void (*)(GdkContentProvider*))(fnptr))(arg0); +// }; +// void _gotk4_gdk4_ContentProvider_virtual_detach_clipboard(void* fnptr, GdkContentProvider* arg0, GdkClipboard* arg1) { +// ((void (*)(GdkContentProvider*, GdkClipboard*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gdk4_ContentProvider_virtual_write_mime_type_async(void* fnptr, GdkContentProvider* arg0, char* arg1, GOutputStream* arg2, int arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GdkContentProvider*, char*, GOutputStream*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gdk4_Paintable_virtual_snapshot(void* fnptr, GdkPaintable* arg0, GdkSnapshot* arg1, double arg2, double arg3) { +// ((void (*)(GdkPaintable*, GdkSnapshot*, double, double))(fnptr))(arg0, arg1, arg2, arg3); +// }; +import "C" + +// GType values. +var ( + GTypeAxisUse = coreglib.Type(C.gdk_axis_use_get_type()) + GTypeCrossingMode = coreglib.Type(C.gdk_crossing_mode_get_type()) + GTypeDevicePadFeature = coreglib.Type(C.gdk_device_pad_feature_get_type()) + GTypeDeviceToolType = coreglib.Type(C.gdk_device_tool_type_get_type()) + GTypeDmabufError = coreglib.Type(C.gdk_dmabuf_error_get_type()) + GTypeDragCancelReason = coreglib.Type(C.gdk_drag_cancel_reason_get_type()) + GTypeEventType = coreglib.Type(C.gdk_event_type_get_type()) + GTypeFullscreenMode = coreglib.Type(C.gdk_fullscreen_mode_get_type()) + GTypeGLError = coreglib.Type(C.gdk_gl_error_get_type()) + GTypeGravity = coreglib.Type(C.gdk_gravity_get_type()) + GTypeInputSource = coreglib.Type(C.gdk_input_source_get_type()) + GTypeKeyMatch = coreglib.Type(C.gdk_key_match_get_type()) + GTypeMemoryFormat = coreglib.Type(C.gdk_memory_format_get_type()) + GTypeNotifyType = coreglib.Type(C.gdk_notify_type_get_type()) + GTypeScrollDirection = coreglib.Type(C.gdk_scroll_direction_get_type()) + GTypeScrollUnit = coreglib.Type(C.gdk_scroll_unit_get_type()) + GTypeSubpixelLayout = coreglib.Type(C.gdk_subpixel_layout_get_type()) + GTypeSurfaceEdge = coreglib.Type(C.gdk_surface_edge_get_type()) + GTypeTextureError = coreglib.Type(C.gdk_texture_error_get_type()) + GTypeTitlebarGesture = coreglib.Type(C.gdk_titlebar_gesture_get_type()) + GTypeTouchpadGesturePhase = coreglib.Type(C.gdk_touchpad_gesture_phase_get_type()) + GTypeVulkanError = coreglib.Type(C.gdk_vulkan_error_get_type()) + GTypeAnchorHints = coreglib.Type(C.gdk_anchor_hints_get_type()) + GTypeAxisFlags = coreglib.Type(C.gdk_axis_flags_get_type()) + GTypeDragAction = coreglib.Type(C.gdk_drag_action_get_type()) + GTypeFrameClockPhase = coreglib.Type(C.gdk_frame_clock_phase_get_type()) + GTypeGLAPI = coreglib.Type(C.gdk_gl_api_get_type()) + GTypeModifierType = coreglib.Type(C.gdk_modifier_type_get_type()) + GTypePaintableFlags = coreglib.Type(C.gdk_paintable_flags_get_type()) + GTypeSeatCapabilities = coreglib.Type(C.gdk_seat_capabilities_get_type()) + GTypeToplevelState = coreglib.Type(C.gdk_toplevel_state_get_type()) + GTypeDevicePad = coreglib.Type(C.gdk_device_pad_get_type()) + GTypeDragSurface = coreglib.Type(C.gdk_drag_surface_get_type()) + GTypePaintable = coreglib.Type(C.gdk_paintable_get_type()) + GTypePopup = coreglib.Type(C.gdk_popup_get_type()) + GTypeToplevel = coreglib.Type(C.gdk_toplevel_get_type()) + GTypeAppLaunchContext = coreglib.Type(C.gdk_app_launch_context_get_type()) + GTypeButtonEvent = coreglib.Type(C.gdk_button_event_get_type()) + GTypeCairoContext = coreglib.Type(C.gdk_cairo_context_get_type()) + GTypeClipboard = coreglib.Type(C.gdk_clipboard_get_type()) + GTypeContentDeserializer = coreglib.Type(C.gdk_content_deserializer_get_type()) + GTypeContentProvider = coreglib.Type(C.gdk_content_provider_get_type()) + GTypeContentSerializer = coreglib.Type(C.gdk_content_serializer_get_type()) + GTypeCrossingEvent = coreglib.Type(C.gdk_crossing_event_get_type()) + GTypeCursor = coreglib.Type(C.gdk_cursor_get_type()) + GTypeDNDEvent = coreglib.Type(C.gdk_dnd_event_get_type()) + GTypeDeleteEvent = coreglib.Type(C.gdk_delete_event_get_type()) + GTypeDevice = coreglib.Type(C.gdk_device_get_type()) + GTypeDeviceTool = coreglib.Type(C.gdk_device_tool_get_type()) + GTypeDisplay = coreglib.Type(C.gdk_display_get_type()) + GTypeDisplayManager = coreglib.Type(C.gdk_display_manager_get_type()) + GTypeDmabufTexture = coreglib.Type(C.gdk_dmabuf_texture_get_type()) + GTypeDmabufTextureBuilder = coreglib.Type(C.gdk_dmabuf_texture_builder_get_type()) + GTypeDrag = coreglib.Type(C.gdk_drag_get_type()) + GTypeDrawContext = coreglib.Type(C.gdk_draw_context_get_type()) + GTypeDrop = coreglib.Type(C.gdk_drop_get_type()) + GTypeEvent = coreglib.Type(C.gdk_event_get_type()) + GTypeFocusEvent = coreglib.Type(C.gdk_focus_event_get_type()) + GTypeFrameClock = coreglib.Type(C.gdk_frame_clock_get_type()) + GTypeGLContext = coreglib.Type(C.gdk_gl_context_get_type()) + GTypeGLTexture = coreglib.Type(C.gdk_gl_texture_get_type()) + GTypeGLTextureBuilder = coreglib.Type(C.gdk_gl_texture_builder_get_type()) + GTypeGrabBrokenEvent = coreglib.Type(C.gdk_grab_broken_event_get_type()) + GTypeKeyEvent = coreglib.Type(C.gdk_key_event_get_type()) + GTypeMemoryTexture = coreglib.Type(C.gdk_memory_texture_get_type()) + GTypeMonitor = coreglib.Type(C.gdk_monitor_get_type()) + GTypeMotionEvent = coreglib.Type(C.gdk_motion_event_get_type()) + GTypePadEvent = coreglib.Type(C.gdk_pad_event_get_type()) + GTypeProximityEvent = coreglib.Type(C.gdk_proximity_event_get_type()) + GTypeScrollEvent = coreglib.Type(C.gdk_scroll_event_get_type()) + GTypeSeat = coreglib.Type(C.gdk_seat_get_type()) + GTypeSnapshot = coreglib.Type(C.gdk_snapshot_get_type()) + GTypeSurface = coreglib.Type(C.gdk_surface_get_type()) + GTypeTexture = coreglib.Type(C.gdk_texture_get_type()) + GTypeTouchEvent = coreglib.Type(C.gdk_touch_event_get_type()) + GTypeTouchpadEvent = coreglib.Type(C.gdk_touchpad_event_get_type()) + GTypeVulkanContext = coreglib.Type(C.gdk_vulkan_context_get_type()) + GTypeContentFormats = coreglib.Type(C.gdk_content_formats_get_type()) + GTypeContentFormatsBuilder = coreglib.Type(C.gdk_content_formats_builder_get_type()) + GTypeDmabufFormats = coreglib.Type(C.gdk_dmabuf_formats_get_type()) + GTypeEventSequence = coreglib.Type(C.gdk_event_sequence_get_type()) + GTypeFileList = coreglib.Type(C.gdk_file_list_get_type()) + GTypeFrameTimings = coreglib.Type(C.gdk_frame_timings_get_type()) + GTypePopupLayout = coreglib.Type(C.gdk_popup_layout_get_type()) + GTypeRGBA = coreglib.Type(C.gdk_rgba_get_type()) + GTypeRectangle = coreglib.Type(C.gdk_rectangle_get_type()) + GTypeTextureDownloader = coreglib.Type(C.gdk_texture_downloader_get_type()) + GTypeToplevelLayout = coreglib.Type(C.gdk_toplevel_layout_get_type()) +) + +func init() { + coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{ + coreglib.TypeMarshaler{T: GTypeAxisUse, F: marshalAxisUse}, + coreglib.TypeMarshaler{T: GTypeCrossingMode, F: marshalCrossingMode}, + coreglib.TypeMarshaler{T: GTypeDevicePadFeature, F: marshalDevicePadFeature}, + coreglib.TypeMarshaler{T: GTypeDeviceToolType, F: marshalDeviceToolType}, + coreglib.TypeMarshaler{T: GTypeDmabufError, F: marshalDmabufError}, + coreglib.TypeMarshaler{T: GTypeDragCancelReason, F: marshalDragCancelReason}, + coreglib.TypeMarshaler{T: GTypeEventType, F: marshalEventType}, + coreglib.TypeMarshaler{T: GTypeFullscreenMode, F: marshalFullscreenMode}, + coreglib.TypeMarshaler{T: GTypeGLError, F: marshalGLError}, + coreglib.TypeMarshaler{T: GTypeGravity, F: marshalGravity}, + coreglib.TypeMarshaler{T: GTypeInputSource, F: marshalInputSource}, + coreglib.TypeMarshaler{T: GTypeKeyMatch, F: marshalKeyMatch}, + coreglib.TypeMarshaler{T: GTypeMemoryFormat, F: marshalMemoryFormat}, + coreglib.TypeMarshaler{T: GTypeNotifyType, F: marshalNotifyType}, + coreglib.TypeMarshaler{T: GTypeScrollDirection, F: marshalScrollDirection}, + coreglib.TypeMarshaler{T: GTypeScrollUnit, F: marshalScrollUnit}, + coreglib.TypeMarshaler{T: GTypeSubpixelLayout, F: marshalSubpixelLayout}, + coreglib.TypeMarshaler{T: GTypeSurfaceEdge, F: marshalSurfaceEdge}, + coreglib.TypeMarshaler{T: GTypeTextureError, F: marshalTextureError}, + coreglib.TypeMarshaler{T: GTypeTitlebarGesture, F: marshalTitlebarGesture}, + coreglib.TypeMarshaler{T: GTypeTouchpadGesturePhase, F: marshalTouchpadGesturePhase}, + coreglib.TypeMarshaler{T: GTypeVulkanError, F: marshalVulkanError}, + coreglib.TypeMarshaler{T: GTypeAnchorHints, F: marshalAnchorHints}, + coreglib.TypeMarshaler{T: GTypeAxisFlags, F: marshalAxisFlags}, + coreglib.TypeMarshaler{T: GTypeDragAction, F: marshalDragAction}, + coreglib.TypeMarshaler{T: GTypeFrameClockPhase, F: marshalFrameClockPhase}, + coreglib.TypeMarshaler{T: GTypeGLAPI, F: marshalGLAPI}, + coreglib.TypeMarshaler{T: GTypeModifierType, F: marshalModifierType}, + coreglib.TypeMarshaler{T: GTypePaintableFlags, F: marshalPaintableFlags}, + coreglib.TypeMarshaler{T: GTypeSeatCapabilities, F: marshalSeatCapabilities}, + coreglib.TypeMarshaler{T: GTypeToplevelState, F: marshalToplevelState}, + coreglib.TypeMarshaler{T: GTypeDevicePad, F: marshalDevicePad}, + coreglib.TypeMarshaler{T: GTypeDragSurface, F: marshalDragSurface}, + coreglib.TypeMarshaler{T: GTypePaintable, F: marshalPaintable}, + coreglib.TypeMarshaler{T: GTypePopup, F: marshalPopup}, + coreglib.TypeMarshaler{T: GTypeToplevel, F: marshalToplevel}, + coreglib.TypeMarshaler{T: GTypeAppLaunchContext, F: marshalAppLaunchContext}, + coreglib.TypeMarshaler{T: GTypeButtonEvent, F: marshalButtonEvent}, + coreglib.TypeMarshaler{T: GTypeCairoContext, F: marshalCairoContext}, + coreglib.TypeMarshaler{T: GTypeClipboard, F: marshalClipboard}, + coreglib.TypeMarshaler{T: GTypeContentDeserializer, F: marshalContentDeserializer}, + coreglib.TypeMarshaler{T: GTypeContentProvider, F: marshalContentProvider}, + coreglib.TypeMarshaler{T: GTypeContentSerializer, F: marshalContentSerializer}, + coreglib.TypeMarshaler{T: GTypeCrossingEvent, F: marshalCrossingEvent}, + coreglib.TypeMarshaler{T: GTypeCursor, F: marshalCursor}, + coreglib.TypeMarshaler{T: GTypeDNDEvent, F: marshalDNDEvent}, + coreglib.TypeMarshaler{T: GTypeDeleteEvent, F: marshalDeleteEvent}, + coreglib.TypeMarshaler{T: GTypeDevice, F: marshalDevice}, + coreglib.TypeMarshaler{T: GTypeDeviceTool, F: marshalDeviceTool}, + coreglib.TypeMarshaler{T: GTypeDisplay, F: marshalDisplay}, + coreglib.TypeMarshaler{T: GTypeDisplayManager, F: marshalDisplayManager}, + coreglib.TypeMarshaler{T: GTypeDmabufTexture, F: marshalDmabufTexture}, + coreglib.TypeMarshaler{T: GTypeDmabufTextureBuilder, F: marshalDmabufTextureBuilder}, + coreglib.TypeMarshaler{T: GTypeDrag, F: marshalDrag}, + coreglib.TypeMarshaler{T: GTypeDrawContext, F: marshalDrawContext}, + coreglib.TypeMarshaler{T: GTypeDrop, F: marshalDrop}, + coreglib.TypeMarshaler{T: GTypeEvent, F: marshalEvent}, + coreglib.TypeMarshaler{T: GTypeFocusEvent, F: marshalFocusEvent}, + coreglib.TypeMarshaler{T: GTypeFrameClock, F: marshalFrameClock}, + coreglib.TypeMarshaler{T: GTypeGLContext, F: marshalGLContext}, + coreglib.TypeMarshaler{T: GTypeGLTexture, F: marshalGLTexture}, + coreglib.TypeMarshaler{T: GTypeGLTextureBuilder, F: marshalGLTextureBuilder}, + coreglib.TypeMarshaler{T: GTypeGrabBrokenEvent, F: marshalGrabBrokenEvent}, + coreglib.TypeMarshaler{T: GTypeKeyEvent, F: marshalKeyEvent}, + coreglib.TypeMarshaler{T: GTypeMemoryTexture, F: marshalMemoryTexture}, + coreglib.TypeMarshaler{T: GTypeMonitor, F: marshalMonitor}, + coreglib.TypeMarshaler{T: GTypeMotionEvent, F: marshalMotionEvent}, + coreglib.TypeMarshaler{T: GTypePadEvent, F: marshalPadEvent}, + coreglib.TypeMarshaler{T: GTypeProximityEvent, F: marshalProximityEvent}, + coreglib.TypeMarshaler{T: GTypeScrollEvent, F: marshalScrollEvent}, + coreglib.TypeMarshaler{T: GTypeSeat, F: marshalSeat}, + coreglib.TypeMarshaler{T: GTypeSnapshot, F: marshalSnapshot}, + coreglib.TypeMarshaler{T: GTypeSurface, F: marshalSurface}, + coreglib.TypeMarshaler{T: GTypeTexture, F: marshalTexture}, + coreglib.TypeMarshaler{T: GTypeTouchEvent, F: marshalTouchEvent}, + coreglib.TypeMarshaler{T: GTypeTouchpadEvent, F: marshalTouchpadEvent}, + coreglib.TypeMarshaler{T: GTypeVulkanContext, F: marshalVulkanContext}, + coreglib.TypeMarshaler{T: GTypeContentFormats, F: marshalContentFormats}, + coreglib.TypeMarshaler{T: GTypeContentFormatsBuilder, F: marshalContentFormatsBuilder}, + coreglib.TypeMarshaler{T: GTypeDmabufFormats, F: marshalDmabufFormats}, + coreglib.TypeMarshaler{T: GTypeEventSequence, F: marshalEventSequence}, + coreglib.TypeMarshaler{T: GTypeFileList, F: marshalFileList}, + coreglib.TypeMarshaler{T: GTypeFrameTimings, F: marshalFrameTimings}, + coreglib.TypeMarshaler{T: GTypePopupLayout, F: marshalPopupLayout}, + coreglib.TypeMarshaler{T: GTypeRGBA, F: marshalRGBA}, + coreglib.TypeMarshaler{T: GTypeRectangle, F: marshalRectangle}, + coreglib.TypeMarshaler{T: GTypeTextureDownloader, F: marshalTextureDownloader}, + coreglib.TypeMarshaler{T: GTypeToplevelLayout, F: marshalToplevelLayout}, + }) +} + +// ACTION_ALL defines all possible DND actions. +// +// This can be used in gdk.Drop.Status() messages when any drop can be accepted +// or a more specific drop method is not yet known. +const ACTION_ALL = 7 + +// BUTTON_MIDDLE: middle button. +const BUTTON_MIDDLE = 2 + +// BUTTON_PRIMARY: primary button. This is typically the left mouse button, +// or the right button in a left-handed setup. +const BUTTON_PRIMARY = 1 + +// BUTTON_SECONDARY: secondary button. This is typically the right mouse button, +// or the left button in a left-handed setup. +const BUTTON_SECONDARY = 3 + +// CURRENT_TIME represents the current time, and can be used anywhere a time is +// expected. +const CURRENT_TIME = 0 + +// EVENT_PROPAGATE: use this macro as the return value for continuing the +// propagation of an event handler. +const EVENT_PROPAGATE = false + +// EVENT_STOP: use this macro as the return value for stopping the propagation +// of an event handler. +const EVENT_STOP = true +const KEY_0 = 48 +const KEY_1 = 49 +const KEY_2 = 50 +const KEY_3 = 51 +const KEY_3270_AltCursor = 64784 +const KEY_3270_Attn = 64782 +const KEY_3270_BackTab = 64773 +const KEY_3270_ChangeScreen = 64793 +const KEY_3270_Copy = 64789 +const KEY_3270_CursorBlink = 64783 +const KEY_3270_CursorSelect = 64796 +const KEY_3270_DeleteWord = 64794 +const KEY_3270_Duplicate = 64769 +const KEY_3270_Enter = 64798 +const KEY_3270_EraseEOF = 64774 +const KEY_3270_EraseInput = 64775 +const KEY_3270_ExSelect = 64795 +const KEY_3270_FieldMark = 64770 +const KEY_3270_Ident = 64787 +const KEY_3270_Jump = 64786 +const KEY_3270_KeyClick = 64785 +const KEY_3270_Left2 = 64772 +const KEY_3270_PA1 = 64778 +const KEY_3270_PA2 = 64779 +const KEY_3270_PA3 = 64780 +const KEY_3270_Play = 64790 +const KEY_3270_PrintScreen = 64797 +const KEY_3270_Quit = 64777 +const KEY_3270_Record = 64792 +const KEY_3270_Reset = 64776 +const KEY_3270_Right2 = 64771 +const KEY_3270_Rule = 64788 +const KEY_3270_Setup = 64791 +const KEY_3270_Test = 64781 +const KEY_4 = 52 +const KEY_5 = 53 +const KEY_6 = 54 +const KEY_7 = 55 +const KEY_8 = 56 +const KEY_9 = 57 +const KEY_A = 65 +const KEY_AE = 198 +const KEY_Aacute = 193 +const KEY_Abelowdot = 16785056 +const KEY_Abreve = 451 +const KEY_Abreveacute = 16785070 +const KEY_Abrevebelowdot = 16785078 +const KEY_Abrevegrave = 16785072 +const KEY_Abrevehook = 16785074 +const KEY_Abrevetilde = 16785076 +const KEY_AccessX_Enable = 65136 +const KEY_AccessX_Feedback_Enable = 65137 +const KEY_Acircumflex = 194 +const KEY_Acircumflexacute = 16785060 +const KEY_Acircumflexbelowdot = 16785068 +const KEY_Acircumflexgrave = 16785062 +const KEY_Acircumflexhook = 16785064 +const KEY_Acircumflextilde = 16785066 +const KEY_AddFavorite = 269025081 +const KEY_Adiaeresis = 196 +const KEY_Agrave = 192 +const KEY_Ahook = 16785058 +const KEY_Alt_L = 65513 +const KEY_Alt_R = 65514 +const KEY_Amacron = 960 +const KEY_Aogonek = 417 +const KEY_ApplicationLeft = 269025104 +const KEY_ApplicationRight = 269025105 +const KEY_Arabic_0 = 16778848 +const KEY_Arabic_1 = 16778849 +const KEY_Arabic_2 = 16778850 +const KEY_Arabic_3 = 16778851 +const KEY_Arabic_4 = 16778852 +const KEY_Arabic_5 = 16778853 +const KEY_Arabic_6 = 16778854 +const KEY_Arabic_7 = 16778855 +const KEY_Arabic_8 = 16778856 +const KEY_Arabic_9 = 16778857 +const KEY_Arabic_ain = 1497 +const KEY_Arabic_alef = 1479 +const KEY_Arabic_alefmaksura = 1513 +const KEY_Arabic_beh = 1480 +const KEY_Arabic_comma = 1452 +const KEY_Arabic_dad = 1494 +const KEY_Arabic_dal = 1487 +const KEY_Arabic_damma = 1519 +const KEY_Arabic_dammatan = 1516 +const KEY_Arabic_ddal = 16778888 +const KEY_Arabic_farsi_yeh = 16778956 +const KEY_Arabic_fatha = 1518 +const KEY_Arabic_fathatan = 1515 +const KEY_Arabic_feh = 1505 +const KEY_Arabic_fullstop = 16778964 +const KEY_Arabic_gaf = 16778927 +const KEY_Arabic_ghain = 1498 +const KEY_Arabic_ha = 1511 +const KEY_Arabic_hah = 1485 +const KEY_Arabic_hamza = 1473 +const KEY_Arabic_hamza_above = 16778836 +const KEY_Arabic_hamza_below = 16778837 +const KEY_Arabic_hamzaonalef = 1475 +const KEY_Arabic_hamzaonwaw = 1476 +const KEY_Arabic_hamzaonyeh = 1478 +const KEY_Arabic_hamzaunderalef = 1477 +const KEY_Arabic_heh = 1511 +const KEY_Arabic_heh_doachashmee = 16778942 +const KEY_Arabic_heh_goal = 16778945 +const KEY_Arabic_jeem = 1484 +const KEY_Arabic_jeh = 16778904 +const KEY_Arabic_kaf = 1507 +const KEY_Arabic_kasra = 1520 +const KEY_Arabic_kasratan = 1517 +const KEY_Arabic_keheh = 16778921 +const KEY_Arabic_khah = 1486 +const KEY_Arabic_lam = 1508 +const KEY_Arabic_madda_above = 16778835 +const KEY_Arabic_maddaonalef = 1474 +const KEY_Arabic_meem = 1509 +const KEY_Arabic_noon = 1510 +const KEY_Arabic_noon_ghunna = 16778938 +const KEY_Arabic_peh = 16778878 +const KEY_Arabic_percent = 16778858 +const KEY_Arabic_qaf = 1506 +const KEY_Arabic_question_mark = 1471 +const KEY_Arabic_ra = 1489 +const KEY_Arabic_rreh = 16778897 +const KEY_Arabic_sad = 1493 +const KEY_Arabic_seen = 1491 +const KEY_Arabic_semicolon = 1467 +const KEY_Arabic_shadda = 1521 +const KEY_Arabic_sheen = 1492 +const KEY_Arabic_sukun = 1522 +const KEY_Arabic_superscript_alef = 16778864 +const KEY_Arabic_switch = 65406 +const KEY_Arabic_tah = 1495 +const KEY_Arabic_tatweel = 1504 +const KEY_Arabic_tcheh = 16778886 +const KEY_Arabic_teh = 1482 +const KEY_Arabic_tehmarbuta = 1481 +const KEY_Arabic_thal = 1488 +const KEY_Arabic_theh = 1483 +const KEY_Arabic_tteh = 16778873 +const KEY_Arabic_veh = 16778916 +const KEY_Arabic_waw = 1512 +const KEY_Arabic_yeh = 1514 +const KEY_Arabic_yeh_baree = 16778962 +const KEY_Arabic_zah = 1496 +const KEY_Arabic_zain = 1490 +const KEY_Aring = 197 +const KEY_Armenian_AT = 16778552 +const KEY_Armenian_AYB = 16778545 +const KEY_Armenian_BEN = 16778546 +const KEY_Armenian_CHA = 16778569 +const KEY_Armenian_DA = 16778548 +const KEY_Armenian_DZA = 16778561 +const KEY_Armenian_E = 16778551 +const KEY_Armenian_FE = 16778582 +const KEY_Armenian_GHAT = 16778562 +const KEY_Armenian_GIM = 16778547 +const KEY_Armenian_HI = 16778565 +const KEY_Armenian_HO = 16778560 +const KEY_Armenian_INI = 16778555 +const KEY_Armenian_JE = 16778571 +const KEY_Armenian_KE = 16778580 +const KEY_Armenian_KEN = 16778559 +const KEY_Armenian_KHE = 16778557 +const KEY_Armenian_LYUN = 16778556 +const KEY_Armenian_MEN = 16778564 +const KEY_Armenian_NU = 16778566 +const KEY_Armenian_O = 16778581 +const KEY_Armenian_PE = 16778570 +const KEY_Armenian_PYUR = 16778579 +const KEY_Armenian_RA = 16778572 +const KEY_Armenian_RE = 16778576 +const KEY_Armenian_SE = 16778573 +const KEY_Armenian_SHA = 16778567 +const KEY_Armenian_TCHE = 16778563 +const KEY_Armenian_TO = 16778553 +const KEY_Armenian_TSA = 16778558 +const KEY_Armenian_TSO = 16778577 +const KEY_Armenian_TYUN = 16778575 +const KEY_Armenian_VEV = 16778574 +const KEY_Armenian_VO = 16778568 +const KEY_Armenian_VYUN = 16778578 +const KEY_Armenian_YECH = 16778549 +const KEY_Armenian_ZA = 16778550 +const KEY_Armenian_ZHE = 16778554 +const KEY_Armenian_accent = 16778587 +const KEY_Armenian_amanak = 16778588 +const KEY_Armenian_apostrophe = 16778586 +const KEY_Armenian_at = 16778600 +const KEY_Armenian_ayb = 16778593 +const KEY_Armenian_ben = 16778594 +const KEY_Armenian_but = 16778589 +const KEY_Armenian_cha = 16778617 +const KEY_Armenian_da = 16778596 +const KEY_Armenian_dza = 16778609 +const KEY_Armenian_e = 16778599 +const KEY_Armenian_exclam = 16778588 +const KEY_Armenian_fe = 16778630 +const KEY_Armenian_full_stop = 16778633 +const KEY_Armenian_ghat = 16778610 +const KEY_Armenian_gim = 16778595 +const KEY_Armenian_hi = 16778613 +const KEY_Armenian_ho = 16778608 +const KEY_Armenian_hyphen = 16778634 +const KEY_Armenian_ini = 16778603 +const KEY_Armenian_je = 16778619 +const KEY_Armenian_ke = 16778628 +const KEY_Armenian_ken = 16778607 +const KEY_Armenian_khe = 16778605 +const KEY_Armenian_ligature_ew = 16778631 +const KEY_Armenian_lyun = 16778604 +const KEY_Armenian_men = 16778612 +const KEY_Armenian_nu = 16778614 +const KEY_Armenian_o = 16778629 +const KEY_Armenian_paruyk = 16778590 +const KEY_Armenian_pe = 16778618 +const KEY_Armenian_pyur = 16778627 +const KEY_Armenian_question = 16778590 +const KEY_Armenian_ra = 16778620 +const KEY_Armenian_re = 16778624 +const KEY_Armenian_se = 16778621 +const KEY_Armenian_separation_mark = 16778589 +const KEY_Armenian_sha = 16778615 +const KEY_Armenian_shesht = 16778587 +const KEY_Armenian_tche = 16778611 +const KEY_Armenian_to = 16778601 +const KEY_Armenian_tsa = 16778606 +const KEY_Armenian_tso = 16778625 +const KEY_Armenian_tyun = 16778623 +const KEY_Armenian_verjaket = 16778633 +const KEY_Armenian_vev = 16778622 +const KEY_Armenian_vo = 16778616 +const KEY_Armenian_vyun = 16778626 +const KEY_Armenian_yech = 16778597 +const KEY_Armenian_yentamna = 16778634 +const KEY_Armenian_za = 16778598 +const KEY_Armenian_zhe = 16778602 +const KEY_Atilde = 195 +const KEY_AudibleBell_Enable = 65146 +const KEY_AudioCycleTrack = 269025179 +const KEY_AudioForward = 269025175 +const KEY_AudioLowerVolume = 269025041 +const KEY_AudioMedia = 269025074 +const KEY_AudioMicMute = 269025202 +const KEY_AudioMute = 269025042 +const KEY_AudioNext = 269025047 +const KEY_AudioPause = 269025073 +const KEY_AudioPlay = 269025044 +const KEY_AudioPreset = 269025206 +const KEY_AudioPrev = 269025046 +const KEY_AudioRaiseVolume = 269025043 +const KEY_AudioRandomPlay = 269025177 +const KEY_AudioRecord = 269025052 +const KEY_AudioRepeat = 269025176 +const KEY_AudioRewind = 269025086 +const KEY_AudioStop = 269025045 +const KEY_Away = 269025165 +const KEY_B = 66 +const KEY_Babovedot = 16784898 +const KEY_Back = 269025062 +const KEY_BackForward = 269025087 +const KEY_BackSpace = 65288 +const KEY_Battery = 269025171 +const KEY_Begin = 65368 +const KEY_Blue = 269025190 +const KEY_Bluetooth = 269025172 +const KEY_Book = 269025106 +const KEY_BounceKeys_Enable = 65140 +const KEY_Break = 65387 +const KEY_BrightnessAdjust = 269025083 +const KEY_Byelorussian_SHORTU = 1726 +const KEY_Byelorussian_shortu = 1710 +const KEY_C = 67 +const KEY_CD = 269025107 +const KEY_CH = 65186 +const KEY_C_H = 65189 +const KEY_C_h = 65188 +const KEY_Cabovedot = 709 +const KEY_Cacute = 454 +const KEY_Calculator = 269025053 +const KEY_Calendar = 269025056 +const KEY_Cancel = 65385 +const KEY_Caps_Lock = 65509 +const KEY_Ccaron = 456 +const KEY_Ccedilla = 199 +const KEY_Ccircumflex = 710 +const KEY_Ch = 65185 +const KEY_Clear = 65291 +const KEY_ClearGrab = 269024801 +const KEY_Close = 269025110 +const KEY_Codeinput = 65335 +const KEY_ColonSign = 16785569 +const KEY_Community = 269025085 +const KEY_ContrastAdjust = 269025058 +const KEY_Control_L = 65507 +const KEY_Control_R = 65508 +const KEY_Copy = 269025111 +const KEY_CruzeiroSign = 16785570 +const KEY_Cut = 269025112 +const KEY_CycleAngle = 269025180 +const KEY_Cyrillic_A = 1761 +const KEY_Cyrillic_BE = 1762 +const KEY_Cyrillic_CHE = 1790 +const KEY_Cyrillic_CHE_descender = 16778422 +const KEY_Cyrillic_CHE_vertstroke = 16778424 +const KEY_Cyrillic_DE = 1764 +const KEY_Cyrillic_DZHE = 1727 +const KEY_Cyrillic_E = 1788 +const KEY_Cyrillic_EF = 1766 +const KEY_Cyrillic_EL = 1772 +const KEY_Cyrillic_EM = 1773 +const KEY_Cyrillic_EN = 1774 +const KEY_Cyrillic_EN_descender = 16778402 +const KEY_Cyrillic_ER = 1778 +const KEY_Cyrillic_ES = 1779 +const KEY_Cyrillic_GHE = 1767 +const KEY_Cyrillic_GHE_bar = 16778386 +const KEY_Cyrillic_HA = 1768 +const KEY_Cyrillic_HARDSIGN = 1791 +const KEY_Cyrillic_HA_descender = 16778418 +const KEY_Cyrillic_I = 1769 +const KEY_Cyrillic_IE = 1765 +const KEY_Cyrillic_IO = 1715 +const KEY_Cyrillic_I_macron = 16778466 +const KEY_Cyrillic_JE = 1720 +const KEY_Cyrillic_KA = 1771 +const KEY_Cyrillic_KA_descender = 16778394 +const KEY_Cyrillic_KA_vertstroke = 16778396 +const KEY_Cyrillic_LJE = 1721 +const KEY_Cyrillic_NJE = 1722 +const KEY_Cyrillic_O = 1775 +const KEY_Cyrillic_O_bar = 16778472 +const KEY_Cyrillic_PE = 1776 +const KEY_Cyrillic_SCHWA = 16778456 +const KEY_Cyrillic_SHA = 1787 +const KEY_Cyrillic_SHCHA = 1789 +const KEY_Cyrillic_SHHA = 16778426 +const KEY_Cyrillic_SHORTI = 1770 +const KEY_Cyrillic_SOFTSIGN = 1784 +const KEY_Cyrillic_TE = 1780 +const KEY_Cyrillic_TSE = 1763 +const KEY_Cyrillic_U = 1781 +const KEY_Cyrillic_U_macron = 16778478 +const KEY_Cyrillic_U_straight = 16778414 +const KEY_Cyrillic_U_straight_bar = 16778416 +const KEY_Cyrillic_VE = 1783 +const KEY_Cyrillic_YA = 1777 +const KEY_Cyrillic_YERU = 1785 +const KEY_Cyrillic_YU = 1760 +const KEY_Cyrillic_ZE = 1786 +const KEY_Cyrillic_ZHE = 1782 +const KEY_Cyrillic_ZHE_descender = 16778390 +const KEY_Cyrillic_a = 1729 +const KEY_Cyrillic_be = 1730 +const KEY_Cyrillic_che = 1758 +const KEY_Cyrillic_che_descender = 16778423 +const KEY_Cyrillic_che_vertstroke = 16778425 +const KEY_Cyrillic_de = 1732 +const KEY_Cyrillic_dzhe = 1711 +const KEY_Cyrillic_e = 1756 +const KEY_Cyrillic_ef = 1734 +const KEY_Cyrillic_el = 1740 +const KEY_Cyrillic_em = 1741 +const KEY_Cyrillic_en = 1742 +const KEY_Cyrillic_en_descender = 16778403 +const KEY_Cyrillic_er = 1746 +const KEY_Cyrillic_es = 1747 +const KEY_Cyrillic_ghe = 1735 +const KEY_Cyrillic_ghe_bar = 16778387 +const KEY_Cyrillic_ha = 1736 +const KEY_Cyrillic_ha_descender = 16778419 +const KEY_Cyrillic_hardsign = 1759 +const KEY_Cyrillic_i = 1737 +const KEY_Cyrillic_i_macron = 16778467 +const KEY_Cyrillic_ie = 1733 +const KEY_Cyrillic_io = 1699 +const KEY_Cyrillic_je = 1704 +const KEY_Cyrillic_ka = 1739 +const KEY_Cyrillic_ka_descender = 16778395 +const KEY_Cyrillic_ka_vertstroke = 16778397 +const KEY_Cyrillic_lje = 1705 +const KEY_Cyrillic_nje = 1706 +const KEY_Cyrillic_o = 1743 +const KEY_Cyrillic_o_bar = 16778473 +const KEY_Cyrillic_pe = 1744 +const KEY_Cyrillic_schwa = 16778457 +const KEY_Cyrillic_sha = 1755 +const KEY_Cyrillic_shcha = 1757 +const KEY_Cyrillic_shha = 16778427 +const KEY_Cyrillic_shorti = 1738 +const KEY_Cyrillic_softsign = 1752 +const KEY_Cyrillic_te = 1748 +const KEY_Cyrillic_tse = 1731 +const KEY_Cyrillic_u = 1749 +const KEY_Cyrillic_u_macron = 16778479 +const KEY_Cyrillic_u_straight = 16778415 +const KEY_Cyrillic_u_straight_bar = 16778417 +const KEY_Cyrillic_ve = 1751 +const KEY_Cyrillic_ya = 1745 +const KEY_Cyrillic_yeru = 1753 +const KEY_Cyrillic_yu = 1728 +const KEY_Cyrillic_ze = 1754 +const KEY_Cyrillic_zhe = 1750 +const KEY_Cyrillic_zhe_descender = 16778391 +const KEY_D = 68 +const KEY_DOS = 269025114 +const KEY_Dabovedot = 16784906 +const KEY_Dcaron = 463 +const KEY_Delete = 65535 +const KEY_Display = 269025113 +const KEY_Documents = 269025115 +const KEY_DongSign = 16785579 +const KEY_Down = 65364 +const KEY_Dstroke = 464 +const KEY_E = 69 +const KEY_ENG = 957 +const KEY_ETH = 208 +const KEY_EZH = 16777655 +const KEY_Eabovedot = 972 +const KEY_Eacute = 201 +const KEY_Ebelowdot = 16785080 +const KEY_Ecaron = 460 +const KEY_Ecircumflex = 202 +const KEY_Ecircumflexacute = 16785086 +const KEY_Ecircumflexbelowdot = 16785094 +const KEY_Ecircumflexgrave = 16785088 +const KEY_Ecircumflexhook = 16785090 +const KEY_Ecircumflextilde = 16785092 +const KEY_EcuSign = 16785568 +const KEY_Ediaeresis = 203 +const KEY_Egrave = 200 +const KEY_Ehook = 16785082 +const KEY_Eisu_Shift = 65327 +const KEY_Eisu_toggle = 65328 +const KEY_Eject = 269025068 +const KEY_Emacron = 938 +const KEY_End = 65367 +const KEY_Eogonek = 458 +const KEY_Escape = 65307 +const KEY_Eth = 208 +const KEY_Etilde = 16785084 +const KEY_EuroSign = 8364 +const KEY_Excel = 269025116 +const KEY_Execute = 65378 +const KEY_Explorer = 269025117 +const KEY_F = 70 +const KEY_F1 = 65470 +const KEY_F10 = 65479 +const KEY_F11 = 65480 +const KEY_F12 = 65481 +const KEY_F13 = 65482 +const KEY_F14 = 65483 +const KEY_F15 = 65484 +const KEY_F16 = 65485 +const KEY_F17 = 65486 +const KEY_F18 = 65487 +const KEY_F19 = 65488 +const KEY_F2 = 65471 +const KEY_F20 = 65489 +const KEY_F21 = 65490 +const KEY_F22 = 65491 +const KEY_F23 = 65492 +const KEY_F24 = 65493 +const KEY_F25 = 65494 +const KEY_F26 = 65495 +const KEY_F27 = 65496 +const KEY_F28 = 65497 +const KEY_F29 = 65498 +const KEY_F3 = 65472 +const KEY_F30 = 65499 +const KEY_F31 = 65500 +const KEY_F32 = 65501 +const KEY_F33 = 65502 +const KEY_F34 = 65503 +const KEY_F35 = 65504 +const KEY_F4 = 65473 +const KEY_F5 = 65474 +const KEY_F6 = 65475 +const KEY_F7 = 65476 +const KEY_F8 = 65477 +const KEY_F9 = 65478 +const KEY_FFrancSign = 16785571 +const KEY_Fabovedot = 16784926 +const KEY_Farsi_0 = 16778992 +const KEY_Farsi_1 = 16778993 +const KEY_Farsi_2 = 16778994 +const KEY_Farsi_3 = 16778995 +const KEY_Farsi_4 = 16778996 +const KEY_Farsi_5 = 16778997 +const KEY_Farsi_6 = 16778998 +const KEY_Farsi_7 = 16778999 +const KEY_Farsi_8 = 16779000 +const KEY_Farsi_9 = 16779001 +const KEY_Farsi_yeh = 16778956 +const KEY_Favorites = 269025072 +const KEY_Finance = 269025084 +const KEY_Find = 65384 +const KEY_First_Virtual_Screen = 65232 +const KEY_Forward = 269025063 +const KEY_FrameBack = 269025181 +const KEY_FrameForward = 269025182 +const KEY_G = 71 +const KEY_Gabovedot = 725 +const KEY_Game = 269025118 +const KEY_Gbreve = 683 +const KEY_Gcaron = 16777702 +const KEY_Gcedilla = 939 +const KEY_Gcircumflex = 728 +const KEY_Georgian_an = 16781520 +const KEY_Georgian_ban = 16781521 +const KEY_Georgian_can = 16781546 +const KEY_Georgian_char = 16781549 +const KEY_Georgian_chin = 16781545 +const KEY_Georgian_cil = 16781548 +const KEY_Georgian_don = 16781523 +const KEY_Georgian_en = 16781524 +const KEY_Georgian_fi = 16781558 +const KEY_Georgian_gan = 16781522 +const KEY_Georgian_ghan = 16781542 +const KEY_Georgian_hae = 16781552 +const KEY_Georgian_har = 16781556 +const KEY_Georgian_he = 16781553 +const KEY_Georgian_hie = 16781554 +const KEY_Georgian_hoe = 16781557 +const KEY_Georgian_in = 16781528 +const KEY_Georgian_jhan = 16781551 +const KEY_Georgian_jil = 16781547 +const KEY_Georgian_kan = 16781529 +const KEY_Georgian_khar = 16781541 +const KEY_Georgian_las = 16781530 +const KEY_Georgian_man = 16781531 +const KEY_Georgian_nar = 16781532 +const KEY_Georgian_on = 16781533 +const KEY_Georgian_par = 16781534 +const KEY_Georgian_phar = 16781540 +const KEY_Georgian_qar = 16781543 +const KEY_Georgian_rae = 16781536 +const KEY_Georgian_san = 16781537 +const KEY_Georgian_shin = 16781544 +const KEY_Georgian_tan = 16781527 +const KEY_Georgian_tar = 16781538 +const KEY_Georgian_un = 16781539 +const KEY_Georgian_vin = 16781525 +const KEY_Georgian_we = 16781555 +const KEY_Georgian_xan = 16781550 +const KEY_Georgian_zen = 16781526 +const KEY_Georgian_zhar = 16781535 +const KEY_Go = 269025119 +const KEY_Greek_ALPHA = 1985 +const KEY_Greek_ALPHAaccent = 1953 +const KEY_Greek_BETA = 1986 +const KEY_Greek_CHI = 2007 +const KEY_Greek_DELTA = 1988 +const KEY_Greek_EPSILON = 1989 +const KEY_Greek_EPSILONaccent = 1954 +const KEY_Greek_ETA = 1991 +const KEY_Greek_ETAaccent = 1955 +const KEY_Greek_GAMMA = 1987 +const KEY_Greek_IOTA = 1993 +const KEY_Greek_IOTAaccent = 1956 +const KEY_Greek_IOTAdiaeresis = 1957 +const KEY_Greek_IOTAdieresis = 1957 +const KEY_Greek_KAPPA = 1994 +const KEY_Greek_LAMBDA = 1995 +const KEY_Greek_LAMDA = 1995 +const KEY_Greek_MU = 1996 +const KEY_Greek_NU = 1997 +const KEY_Greek_OMEGA = 2009 +const KEY_Greek_OMEGAaccent = 1963 +const KEY_Greek_OMICRON = 1999 +const KEY_Greek_OMICRONaccent = 1959 +const KEY_Greek_PHI = 2006 +const KEY_Greek_PI = 2000 +const KEY_Greek_PSI = 2008 +const KEY_Greek_RHO = 2001 +const KEY_Greek_SIGMA = 2002 +const KEY_Greek_TAU = 2004 +const KEY_Greek_THETA = 1992 +const KEY_Greek_UPSILON = 2005 +const KEY_Greek_UPSILONaccent = 1960 +const KEY_Greek_UPSILONdieresis = 1961 +const KEY_Greek_XI = 1998 +const KEY_Greek_ZETA = 1990 +const KEY_Greek_accentdieresis = 1966 +const KEY_Greek_alpha = 2017 +const KEY_Greek_alphaaccent = 1969 +const KEY_Greek_beta = 2018 +const KEY_Greek_chi = 2039 +const KEY_Greek_delta = 2020 +const KEY_Greek_epsilon = 2021 +const KEY_Greek_epsilonaccent = 1970 +const KEY_Greek_eta = 2023 +const KEY_Greek_etaaccent = 1971 +const KEY_Greek_finalsmallsigma = 2035 +const KEY_Greek_gamma = 2019 +const KEY_Greek_horizbar = 1967 +const KEY_Greek_iota = 2025 +const KEY_Greek_iotaaccent = 1972 +const KEY_Greek_iotaaccentdieresis = 1974 +const KEY_Greek_iotadieresis = 1973 +const KEY_Greek_kappa = 2026 +const KEY_Greek_lambda = 2027 +const KEY_Greek_lamda = 2027 +const KEY_Greek_mu = 2028 +const KEY_Greek_nu = 2029 +const KEY_Greek_omega = 2041 +const KEY_Greek_omegaaccent = 1979 +const KEY_Greek_omicron = 2031 +const KEY_Greek_omicronaccent = 1975 +const KEY_Greek_phi = 2038 +const KEY_Greek_pi = 2032 +const KEY_Greek_psi = 2040 +const KEY_Greek_rho = 2033 +const KEY_Greek_sigma = 2034 +const KEY_Greek_switch = 65406 +const KEY_Greek_tau = 2036 +const KEY_Greek_theta = 2024 +const KEY_Greek_upsilon = 2037 +const KEY_Greek_upsilonaccent = 1976 +const KEY_Greek_upsilonaccentdieresis = 1978 +const KEY_Greek_upsilondieresis = 1977 +const KEY_Greek_xi = 2030 +const KEY_Greek_zeta = 2022 +const KEY_Green = 269025188 +const KEY_H = 72 +const KEY_Hangul = 65329 +const KEY_Hangul_A = 3775 +const KEY_Hangul_AE = 3776 +const KEY_Hangul_AraeA = 3830 +const KEY_Hangul_AraeAE = 3831 +const KEY_Hangul_Banja = 65337 +const KEY_Hangul_Cieuc = 3770 +const KEY_Hangul_Codeinput = 65335 +const KEY_Hangul_Dikeud = 3751 +const KEY_Hangul_E = 3780 +const KEY_Hangul_EO = 3779 +const KEY_Hangul_EU = 3793 +const KEY_Hangul_End = 65331 +const KEY_Hangul_Hanja = 65332 +const KEY_Hangul_Hieuh = 3774 +const KEY_Hangul_I = 3795 +const KEY_Hangul_Ieung = 3767 +const KEY_Hangul_J_Cieuc = 3818 +const KEY_Hangul_J_Dikeud = 3802 +const KEY_Hangul_J_Hieuh = 3822 +const KEY_Hangul_J_Ieung = 3816 +const KEY_Hangul_J_Jieuj = 3817 +const KEY_Hangul_J_Khieuq = 3819 +const KEY_Hangul_J_Kiyeog = 3796 +const KEY_Hangul_J_KiyeogSios = 3798 +const KEY_Hangul_J_KkogjiDalrinIeung = 3833 +const KEY_Hangul_J_Mieum = 3811 +const KEY_Hangul_J_Nieun = 3799 +const KEY_Hangul_J_NieunHieuh = 3801 +const KEY_Hangul_J_NieunJieuj = 3800 +const KEY_Hangul_J_PanSios = 3832 +const KEY_Hangul_J_Phieuf = 3821 +const KEY_Hangul_J_Pieub = 3812 +const KEY_Hangul_J_PieubSios = 3813 +const KEY_Hangul_J_Rieul = 3803 +const KEY_Hangul_J_RieulHieuh = 3810 +const KEY_Hangul_J_RieulKiyeog = 3804 +const KEY_Hangul_J_RieulMieum = 3805 +const KEY_Hangul_J_RieulPhieuf = 3809 +const KEY_Hangul_J_RieulPieub = 3806 +const KEY_Hangul_J_RieulSios = 3807 +const KEY_Hangul_J_RieulTieut = 3808 +const KEY_Hangul_J_Sios = 3814 +const KEY_Hangul_J_SsangKiyeog = 3797 +const KEY_Hangul_J_SsangSios = 3815 +const KEY_Hangul_J_Tieut = 3820 +const KEY_Hangul_J_YeorinHieuh = 3834 +const KEY_Hangul_Jamo = 65333 +const KEY_Hangul_Jeonja = 65336 +const KEY_Hangul_Jieuj = 3768 +const KEY_Hangul_Khieuq = 3771 +const KEY_Hangul_Kiyeog = 3745 +const KEY_Hangul_KiyeogSios = 3747 +const KEY_Hangul_KkogjiDalrinIeung = 3827 +const KEY_Hangul_Mieum = 3761 +const KEY_Hangul_MultipleCandidate = 65341 +const KEY_Hangul_Nieun = 3748 +const KEY_Hangul_NieunHieuh = 3750 +const KEY_Hangul_NieunJieuj = 3749 +const KEY_Hangul_O = 3783 +const KEY_Hangul_OE = 3786 +const KEY_Hangul_PanSios = 3826 +const KEY_Hangul_Phieuf = 3773 +const KEY_Hangul_Pieub = 3762 +const KEY_Hangul_PieubSios = 3764 +const KEY_Hangul_PostHanja = 65339 +const KEY_Hangul_PreHanja = 65338 +const KEY_Hangul_PreviousCandidate = 65342 +const KEY_Hangul_Rieul = 3753 +const KEY_Hangul_RieulHieuh = 3760 +const KEY_Hangul_RieulKiyeog = 3754 +const KEY_Hangul_RieulMieum = 3755 +const KEY_Hangul_RieulPhieuf = 3759 +const KEY_Hangul_RieulPieub = 3756 +const KEY_Hangul_RieulSios = 3757 +const KEY_Hangul_RieulTieut = 3758 +const KEY_Hangul_RieulYeorinHieuh = 3823 +const KEY_Hangul_Romaja = 65334 +const KEY_Hangul_SingleCandidate = 65340 +const KEY_Hangul_Sios = 3765 +const KEY_Hangul_Special = 65343 +const KEY_Hangul_SsangDikeud = 3752 +const KEY_Hangul_SsangJieuj = 3769 +const KEY_Hangul_SsangKiyeog = 3746 +const KEY_Hangul_SsangPieub = 3763 +const KEY_Hangul_SsangSios = 3766 +const KEY_Hangul_Start = 65330 +const KEY_Hangul_SunkyeongeumMieum = 3824 +const KEY_Hangul_SunkyeongeumPhieuf = 3828 +const KEY_Hangul_SunkyeongeumPieub = 3825 +const KEY_Hangul_Tieut = 3772 +const KEY_Hangul_U = 3788 +const KEY_Hangul_WA = 3784 +const KEY_Hangul_WAE = 3785 +const KEY_Hangul_WE = 3790 +const KEY_Hangul_WEO = 3789 +const KEY_Hangul_WI = 3791 +const KEY_Hangul_YA = 3777 +const KEY_Hangul_YAE = 3778 +const KEY_Hangul_YE = 3782 +const KEY_Hangul_YEO = 3781 +const KEY_Hangul_YI = 3794 +const KEY_Hangul_YO = 3787 +const KEY_Hangul_YU = 3792 +const KEY_Hangul_YeorinHieuh = 3829 +const KEY_Hangul_switch = 65406 +const KEY_Hankaku = 65321 +const KEY_Hcircumflex = 678 +const KEY_Hebrew_switch = 65406 +const KEY_Help = 65386 +const KEY_Henkan = 65315 +const KEY_Henkan_Mode = 65315 +const KEY_Hibernate = 269025192 +const KEY_Hiragana = 65317 +const KEY_Hiragana_Katakana = 65319 +const KEY_History = 269025079 +const KEY_Home = 65360 +const KEY_HomePage = 269025048 +const KEY_HotLinks = 269025082 +const KEY_Hstroke = 673 +const KEY_Hyper_L = 65517 +const KEY_Hyper_R = 65518 +const KEY_I = 73 +const KEY_ISO_Center_Object = 65075 +const KEY_ISO_Continuous_Underline = 65072 +const KEY_ISO_Discontinuous_Underline = 65073 +const KEY_ISO_Emphasize = 65074 +const KEY_ISO_Enter = 65076 +const KEY_ISO_Fast_Cursor_Down = 65071 +const KEY_ISO_Fast_Cursor_Left = 65068 +const KEY_ISO_Fast_Cursor_Right = 65069 +const KEY_ISO_Fast_Cursor_Up = 65070 +const KEY_ISO_First_Group = 65036 +const KEY_ISO_First_Group_Lock = 65037 +const KEY_ISO_Group_Latch = 65030 +const KEY_ISO_Group_Lock = 65031 +const KEY_ISO_Group_Shift = 65406 +const KEY_ISO_Last_Group = 65038 +const KEY_ISO_Last_Group_Lock = 65039 +const KEY_ISO_Left_Tab = 65056 +const KEY_ISO_Level2_Latch = 65026 +const KEY_ISO_Level3_Latch = 65028 +const KEY_ISO_Level3_Lock = 65029 +const KEY_ISO_Level3_Shift = 65027 +const KEY_ISO_Level5_Latch = 65042 +const KEY_ISO_Level5_Lock = 65043 +const KEY_ISO_Level5_Shift = 65041 +const KEY_ISO_Lock = 65025 +const KEY_ISO_Move_Line_Down = 65058 +const KEY_ISO_Move_Line_Up = 65057 +const KEY_ISO_Next_Group = 65032 +const KEY_ISO_Next_Group_Lock = 65033 +const KEY_ISO_Partial_Line_Down = 65060 +const KEY_ISO_Partial_Line_Up = 65059 +const KEY_ISO_Partial_Space_Left = 65061 +const KEY_ISO_Partial_Space_Right = 65062 +const KEY_ISO_Prev_Group = 65034 +const KEY_ISO_Prev_Group_Lock = 65035 +const KEY_ISO_Release_Both_Margins = 65067 +const KEY_ISO_Release_Margin_Left = 65065 +const KEY_ISO_Release_Margin_Right = 65066 +const KEY_ISO_Set_Margin_Left = 65063 +const KEY_ISO_Set_Margin_Right = 65064 +const KEY_Iabovedot = 681 +const KEY_Iacute = 205 +const KEY_Ibelowdot = 16785098 +const KEY_Ibreve = 16777516 +const KEY_Icircumflex = 206 +const KEY_Idiaeresis = 207 +const KEY_Igrave = 204 +const KEY_Ihook = 16785096 +const KEY_Imacron = 975 +const KEY_Insert = 65379 +const KEY_Iogonek = 967 +const KEY_Itilde = 933 +const KEY_J = 74 +const KEY_Jcircumflex = 684 +const KEY_K = 75 +const KEY_KP_0 = 65456 +const KEY_KP_1 = 65457 +const KEY_KP_2 = 65458 +const KEY_KP_3 = 65459 +const KEY_KP_4 = 65460 +const KEY_KP_5 = 65461 +const KEY_KP_6 = 65462 +const KEY_KP_7 = 65463 +const KEY_KP_8 = 65464 +const KEY_KP_9 = 65465 +const KEY_KP_Add = 65451 +const KEY_KP_Begin = 65437 +const KEY_KP_Decimal = 65454 +const KEY_KP_Delete = 65439 +const KEY_KP_Divide = 65455 +const KEY_KP_Down = 65433 +const KEY_KP_End = 65436 +const KEY_KP_Enter = 65421 +const KEY_KP_Equal = 65469 +const KEY_KP_F1 = 65425 +const KEY_KP_F2 = 65426 +const KEY_KP_F3 = 65427 +const KEY_KP_F4 = 65428 +const KEY_KP_Home = 65429 +const KEY_KP_Insert = 65438 +const KEY_KP_Left = 65430 +const KEY_KP_Multiply = 65450 +const KEY_KP_Next = 65435 +const KEY_KP_Page_Down = 65435 +const KEY_KP_Page_Up = 65434 +const KEY_KP_Prior = 65434 +const KEY_KP_Right = 65432 +const KEY_KP_Separator = 65452 +const KEY_KP_Space = 65408 +const KEY_KP_Subtract = 65453 +const KEY_KP_Tab = 65417 +const KEY_KP_Up = 65431 +const KEY_Kana_Lock = 65325 +const KEY_Kana_Shift = 65326 +const KEY_Kanji = 65313 +const KEY_Kanji_Bangou = 65335 +const KEY_Katakana = 65318 +const KEY_KbdBrightnessDown = 269025030 +const KEY_KbdBrightnessUp = 269025029 +const KEY_KbdLightOnOff = 269025028 +const KEY_Kcedilla = 979 +const KEY_Keyboard = 269025203 +const KEY_Korean_Won = 3839 +const KEY_L = 76 +const KEY_L1 = 65480 +const KEY_L10 = 65489 +const KEY_L2 = 65481 +const KEY_L3 = 65482 +const KEY_L4 = 65483 +const KEY_L5 = 65484 +const KEY_L6 = 65485 +const KEY_L7 = 65486 +const KEY_L8 = 65487 +const KEY_L9 = 65488 +const KEY_Lacute = 453 +const KEY_Last_Virtual_Screen = 65236 +const KEY_Launch0 = 269025088 +const KEY_Launch1 = 269025089 +const KEY_Launch2 = 269025090 +const KEY_Launch3 = 269025091 +const KEY_Launch4 = 269025092 +const KEY_Launch5 = 269025093 +const KEY_Launch6 = 269025094 +const KEY_Launch7 = 269025095 +const KEY_Launch8 = 269025096 +const KEY_Launch9 = 269025097 +const KEY_LaunchA = 269025098 +const KEY_LaunchB = 269025099 +const KEY_LaunchC = 269025100 +const KEY_LaunchD = 269025101 +const KEY_LaunchE = 269025102 +const KEY_LaunchF = 269025103 +const KEY_Lbelowdot = 16784950 +const KEY_Lcaron = 421 +const KEY_Lcedilla = 934 +const KEY_Left = 65361 +const KEY_LightBulb = 269025077 +const KEY_Linefeed = 65290 +const KEY_LiraSign = 16785572 +const KEY_LogGrabInfo = 269024805 +const KEY_LogOff = 269025121 +const KEY_LogWindowTree = 269024804 +const KEY_Lstroke = 419 +const KEY_M = 77 +const KEY_Mabovedot = 16784960 +const KEY_Macedonia_DSE = 1717 +const KEY_Macedonia_GJE = 1714 +const KEY_Macedonia_KJE = 1724 +const KEY_Macedonia_dse = 1701 +const KEY_Macedonia_gje = 1698 +const KEY_Macedonia_kje = 1708 +const KEY_Mae_Koho = 65342 +const KEY_Mail = 269025049 +const KEY_MailForward = 269025168 +const KEY_Market = 269025122 +const KEY_Massyo = 65324 +const KEY_Meeting = 269025123 +const KEY_Memo = 269025054 +const KEY_Menu = 65383 +const KEY_MenuKB = 269025125 +const KEY_MenuPB = 269025126 +const KEY_Messenger = 269025166 +const KEY_Meta_L = 65511 +const KEY_Meta_R = 65512 +const KEY_MillSign = 16785573 +const KEY_ModeLock = 269025025 +const KEY_Mode_switch = 65406 +const KEY_MonBrightnessDown = 269025027 +const KEY_MonBrightnessUp = 269025026 +const KEY_MouseKeys_Accel_Enable = 65143 +const KEY_MouseKeys_Enable = 65142 +const KEY_Muhenkan = 65314 +const KEY_Multi_key = 65312 +const KEY_MultipleCandidate = 65341 +const KEY_Music = 269025170 +const KEY_MyComputer = 269025075 +const KEY_MySites = 269025127 +const KEY_N = 78 +const KEY_Nacute = 465 +const KEY_NairaSign = 16785574 +const KEY_Ncaron = 466 +const KEY_Ncedilla = 977 +const KEY_New = 269025128 +const KEY_NewSheqelSign = 16785578 +const KEY_News = 269025129 +const KEY_Next = 65366 +const KEY_Next_VMode = 269024802 +const KEY_Next_Virtual_Screen = 65234 +const KEY_Ntilde = 209 +const KEY_Num_Lock = 65407 +const KEY_O = 79 +const KEY_OE = 5052 +const KEY_Oacute = 211 +const KEY_Obarred = 16777631 +const KEY_Obelowdot = 16785100 +const KEY_Ocaron = 16777681 +const KEY_Ocircumflex = 212 +const KEY_Ocircumflexacute = 16785104 +const KEY_Ocircumflexbelowdot = 16785112 +const KEY_Ocircumflexgrave = 16785106 +const KEY_Ocircumflexhook = 16785108 +const KEY_Ocircumflextilde = 16785110 +const KEY_Odiaeresis = 214 +const KEY_Odoubleacute = 469 +const KEY_OfficeHome = 269025130 +const KEY_Ograve = 210 +const KEY_Ohook = 16785102 +const KEY_Ohorn = 16777632 +const KEY_Ohornacute = 16785114 +const KEY_Ohornbelowdot = 16785122 +const KEY_Ohorngrave = 16785116 +const KEY_Ohornhook = 16785118 +const KEY_Ohorntilde = 16785120 +const KEY_Omacron = 978 +const KEY_Ooblique = 216 +const KEY_Open = 269025131 +const KEY_OpenURL = 269025080 +const KEY_Option = 269025132 +const KEY_Oslash = 216 +const KEY_Otilde = 213 +const KEY_Overlay1_Enable = 65144 +const KEY_Overlay2_Enable = 65145 +const KEY_P = 80 +const KEY_Pabovedot = 16784982 +const KEY_Page_Down = 65366 +const KEY_Page_Up = 65365 +const KEY_Paste = 269025133 +const KEY_Pause = 65299 +const KEY_PesetaSign = 16785575 +const KEY_Phone = 269025134 +const KEY_Pictures = 269025169 +const KEY_Pointer_Accelerate = 65274 +const KEY_Pointer_Button1 = 65257 +const KEY_Pointer_Button2 = 65258 +const KEY_Pointer_Button3 = 65259 +const KEY_Pointer_Button4 = 65260 +const KEY_Pointer_Button5 = 65261 +const KEY_Pointer_Button_Dflt = 65256 +const KEY_Pointer_DblClick1 = 65263 +const KEY_Pointer_DblClick2 = 65264 +const KEY_Pointer_DblClick3 = 65265 +const KEY_Pointer_DblClick4 = 65266 +const KEY_Pointer_DblClick5 = 65267 +const KEY_Pointer_DblClick_Dflt = 65262 +const KEY_Pointer_DfltBtnNext = 65275 +const KEY_Pointer_DfltBtnPrev = 65276 +const KEY_Pointer_Down = 65251 +const KEY_Pointer_DownLeft = 65254 +const KEY_Pointer_DownRight = 65255 +const KEY_Pointer_Drag1 = 65269 +const KEY_Pointer_Drag2 = 65270 +const KEY_Pointer_Drag3 = 65271 +const KEY_Pointer_Drag4 = 65272 +const KEY_Pointer_Drag5 = 65277 +const KEY_Pointer_Drag_Dflt = 65268 +const KEY_Pointer_EnableKeys = 65273 +const KEY_Pointer_Left = 65248 +const KEY_Pointer_Right = 65249 +const KEY_Pointer_Up = 65250 +const KEY_Pointer_UpLeft = 65252 +const KEY_Pointer_UpRight = 65253 +const KEY_PowerDown = 269025057 +const KEY_PowerOff = 269025066 +const KEY_Prev_VMode = 269024803 +const KEY_Prev_Virtual_Screen = 65233 +const KEY_PreviousCandidate = 65342 +const KEY_Print = 65377 +const KEY_Prior = 65365 +const KEY_Q = 81 +const KEY_R = 82 +const KEY_R1 = 65490 +const KEY_R10 = 65499 +const KEY_R11 = 65500 +const KEY_R12 = 65501 +const KEY_R13 = 65502 +const KEY_R14 = 65503 +const KEY_R15 = 65504 +const KEY_R2 = 65491 +const KEY_R3 = 65492 +const KEY_R4 = 65493 +const KEY_R5 = 65494 +const KEY_R6 = 65495 +const KEY_R7 = 65496 +const KEY_R8 = 65497 +const KEY_R9 = 65498 +const KEY_RFKill = 269025205 +const KEY_Racute = 448 +const KEY_Rcaron = 472 +const KEY_Rcedilla = 931 +const KEY_Red = 269025187 +const KEY_Redo = 65382 +const KEY_Refresh = 269025065 +const KEY_Reload = 269025139 +const KEY_RepeatKeys_Enable = 65138 +const KEY_Reply = 269025138 +const KEY_Return = 65293 +const KEY_Right = 65363 +const KEY_RockerDown = 269025060 +const KEY_RockerEnter = 269025061 +const KEY_RockerUp = 269025059 +const KEY_Romaji = 65316 +const KEY_RotateWindows = 269025140 +const KEY_RotationKB = 269025142 +const KEY_RotationPB = 269025141 +const KEY_RupeeSign = 16785576 +const KEY_S = 83 +const KEY_SCHWA = 16777615 +const KEY_Sabovedot = 16784992 +const KEY_Sacute = 422 +const KEY_Save = 269025143 +const KEY_Scaron = 425 +const KEY_Scedilla = 426 +const KEY_Scircumflex = 734 +const KEY_ScreenSaver = 269025069 +const KEY_ScrollClick = 269025146 +const KEY_ScrollDown = 269025145 +const KEY_ScrollUp = 269025144 +const KEY_Scroll_Lock = 65300 +const KEY_Search = 269025051 +const KEY_Select = 65376 +const KEY_SelectButton = 269025184 +const KEY_Send = 269025147 +const KEY_Serbian_DJE = 1713 +const KEY_Serbian_DZE = 1727 +const KEY_Serbian_JE = 1720 +const KEY_Serbian_LJE = 1721 +const KEY_Serbian_NJE = 1722 +const KEY_Serbian_TSHE = 1723 +const KEY_Serbian_dje = 1697 +const KEY_Serbian_dze = 1711 +const KEY_Serbian_je = 1704 +const KEY_Serbian_lje = 1705 +const KEY_Serbian_nje = 1706 +const KEY_Serbian_tshe = 1707 +const KEY_Shift_L = 65505 +const KEY_Shift_Lock = 65510 +const KEY_Shift_R = 65506 +const KEY_Shop = 269025078 +const KEY_SingleCandidate = 65340 +const KEY_Sinh_a = 16780677 +const KEY_Sinh_aa = 16780678 +const KEY_Sinh_aa2 = 16780751 +const KEY_Sinh_ae = 16780679 +const KEY_Sinh_ae2 = 16780752 +const KEY_Sinh_aee = 16780680 +const KEY_Sinh_aee2 = 16780753 +const KEY_Sinh_ai = 16780691 +const KEY_Sinh_ai2 = 16780763 +const KEY_Sinh_al = 16780746 +const KEY_Sinh_au = 16780694 +const KEY_Sinh_au2 = 16780766 +const KEY_Sinh_ba = 16780726 +const KEY_Sinh_bha = 16780727 +const KEY_Sinh_ca = 16780704 +const KEY_Sinh_cha = 16780705 +const KEY_Sinh_dda = 16780713 +const KEY_Sinh_ddha = 16780714 +const KEY_Sinh_dha = 16780719 +const KEY_Sinh_dhha = 16780720 +const KEY_Sinh_e = 16780689 +const KEY_Sinh_e2 = 16780761 +const KEY_Sinh_ee = 16780690 +const KEY_Sinh_ee2 = 16780762 +const KEY_Sinh_fa = 16780742 +const KEY_Sinh_ga = 16780700 +const KEY_Sinh_gha = 16780701 +const KEY_Sinh_h2 = 16780675 +const KEY_Sinh_ha = 16780740 +const KEY_Sinh_i = 16780681 +const KEY_Sinh_i2 = 16780754 +const KEY_Sinh_ii = 16780682 +const KEY_Sinh_ii2 = 16780755 +const KEY_Sinh_ja = 16780706 +const KEY_Sinh_jha = 16780707 +const KEY_Sinh_jnya = 16780709 +const KEY_Sinh_ka = 16780698 +const KEY_Sinh_kha = 16780699 +const KEY_Sinh_kunddaliya = 16780788 +const KEY_Sinh_la = 16780733 +const KEY_Sinh_lla = 16780741 +const KEY_Sinh_lu = 16780687 +const KEY_Sinh_lu2 = 16780767 +const KEY_Sinh_luu = 16780688 +const KEY_Sinh_luu2 = 16780787 +const KEY_Sinh_ma = 16780728 +const KEY_Sinh_mba = 16780729 +const KEY_Sinh_na = 16780721 +const KEY_Sinh_ndda = 16780716 +const KEY_Sinh_ndha = 16780723 +const KEY_Sinh_ng = 16780674 +const KEY_Sinh_ng2 = 16780702 +const KEY_Sinh_nga = 16780703 +const KEY_Sinh_nja = 16780710 +const KEY_Sinh_nna = 16780715 +const KEY_Sinh_nya = 16780708 +const KEY_Sinh_o = 16780692 +const KEY_Sinh_o2 = 16780764 +const KEY_Sinh_oo = 16780693 +const KEY_Sinh_oo2 = 16780765 +const KEY_Sinh_pa = 16780724 +const KEY_Sinh_pha = 16780725 +const KEY_Sinh_ra = 16780731 +const KEY_Sinh_ri = 16780685 +const KEY_Sinh_rii = 16780686 +const KEY_Sinh_ru2 = 16780760 +const KEY_Sinh_ruu2 = 16780786 +const KEY_Sinh_sa = 16780739 +const KEY_Sinh_sha = 16780737 +const KEY_Sinh_ssha = 16780738 +const KEY_Sinh_tha = 16780717 +const KEY_Sinh_thha = 16780718 +const KEY_Sinh_tta = 16780711 +const KEY_Sinh_ttha = 16780712 +const KEY_Sinh_u = 16780683 +const KEY_Sinh_u2 = 16780756 +const KEY_Sinh_uu = 16780684 +const KEY_Sinh_uu2 = 16780758 +const KEY_Sinh_va = 16780736 +const KEY_Sinh_ya = 16780730 +const KEY_Sleep = 269025071 +const KEY_SlowKeys_Enable = 65139 +const KEY_Spell = 269025148 +const KEY_SplitScreen = 269025149 +const KEY_Standby = 269025040 +const KEY_Start = 269025050 +const KEY_StickyKeys_Enable = 65141 +const KEY_Stop = 269025064 +const KEY_Subtitle = 269025178 +const KEY_Super_L = 65515 +const KEY_Super_R = 65516 +const KEY_Support = 269025150 +const KEY_Suspend = 269025191 +const KEY_Switch_VT_1 = 269024769 +const KEY_Switch_VT_10 = 269024778 +const KEY_Switch_VT_11 = 269024779 +const KEY_Switch_VT_12 = 269024780 +const KEY_Switch_VT_2 = 269024770 +const KEY_Switch_VT_3 = 269024771 +const KEY_Switch_VT_4 = 269024772 +const KEY_Switch_VT_5 = 269024773 +const KEY_Switch_VT_6 = 269024774 +const KEY_Switch_VT_7 = 269024775 +const KEY_Switch_VT_8 = 269024776 +const KEY_Switch_VT_9 = 269024777 +const KEY_Sys_Req = 65301 +const KEY_T = 84 +const KEY_THORN = 222 +const KEY_Tab = 65289 +const KEY_Tabovedot = 16785002 +const KEY_TaskPane = 269025151 +const KEY_Tcaron = 427 +const KEY_Tcedilla = 478 +const KEY_Terminal = 269025152 +const KEY_Terminate_Server = 65237 +const KEY_Thai_baht = 3551 +const KEY_Thai_bobaimai = 3514 +const KEY_Thai_chochan = 3496 +const KEY_Thai_chochang = 3498 +const KEY_Thai_choching = 3497 +const KEY_Thai_chochoe = 3500 +const KEY_Thai_dochada = 3502 +const KEY_Thai_dodek = 3508 +const KEY_Thai_fofa = 3517 +const KEY_Thai_fofan = 3519 +const KEY_Thai_hohip = 3531 +const KEY_Thai_honokhuk = 3534 +const KEY_Thai_khokhai = 3490 +const KEY_Thai_khokhon = 3493 +const KEY_Thai_khokhuat = 3491 +const KEY_Thai_khokhwai = 3492 +const KEY_Thai_khorakhang = 3494 +const KEY_Thai_kokai = 3489 +const KEY_Thai_lakkhangyao = 3557 +const KEY_Thai_lekchet = 3575 +const KEY_Thai_lekha = 3573 +const KEY_Thai_lekhok = 3574 +const KEY_Thai_lekkao = 3577 +const KEY_Thai_leknung = 3569 +const KEY_Thai_lekpaet = 3576 +const KEY_Thai_leksam = 3571 +const KEY_Thai_leksi = 3572 +const KEY_Thai_leksong = 3570 +const KEY_Thai_leksun = 3568 +const KEY_Thai_lochula = 3532 +const KEY_Thai_loling = 3525 +const KEY_Thai_lu = 3526 +const KEY_Thai_maichattawa = 3563 +const KEY_Thai_maiek = 3560 +const KEY_Thai_maihanakat = 3537 +const KEY_Thai_maihanakat_maitho = 3550 +const KEY_Thai_maitaikhu = 3559 +const KEY_Thai_maitho = 3561 +const KEY_Thai_maitri = 3562 +const KEY_Thai_maiyamok = 3558 +const KEY_Thai_moma = 3521 +const KEY_Thai_ngongu = 3495 +const KEY_Thai_nikhahit = 3565 +const KEY_Thai_nonen = 3507 +const KEY_Thai_nonu = 3513 +const KEY_Thai_oang = 3533 +const KEY_Thai_paiyannoi = 3535 +const KEY_Thai_phinthu = 3546 +const KEY_Thai_phophan = 3518 +const KEY_Thai_phophung = 3516 +const KEY_Thai_phosamphao = 3520 +const KEY_Thai_popla = 3515 +const KEY_Thai_rorua = 3523 +const KEY_Thai_ru = 3524 +const KEY_Thai_saraa = 3536 +const KEY_Thai_saraaa = 3538 +const KEY_Thai_saraae = 3553 +const KEY_Thai_saraaimaimalai = 3556 +const KEY_Thai_saraaimaimuan = 3555 +const KEY_Thai_saraam = 3539 +const KEY_Thai_sarae = 3552 +const KEY_Thai_sarai = 3540 +const KEY_Thai_saraii = 3541 +const KEY_Thai_sarao = 3554 +const KEY_Thai_sarau = 3544 +const KEY_Thai_saraue = 3542 +const KEY_Thai_sarauee = 3543 +const KEY_Thai_sarauu = 3545 +const KEY_Thai_sorusi = 3529 +const KEY_Thai_sosala = 3528 +const KEY_Thai_soso = 3499 +const KEY_Thai_sosua = 3530 +const KEY_Thai_thanthakhat = 3564 +const KEY_Thai_thonangmontho = 3505 +const KEY_Thai_thophuthao = 3506 +const KEY_Thai_thothahan = 3511 +const KEY_Thai_thothan = 3504 +const KEY_Thai_thothong = 3512 +const KEY_Thai_thothung = 3510 +const KEY_Thai_topatak = 3503 +const KEY_Thai_totao = 3509 +const KEY_Thai_wowaen = 3527 +const KEY_Thai_yoyak = 3522 +const KEY_Thai_yoying = 3501 +const KEY_Thorn = 222 +const KEY_Time = 269025183 +const KEY_ToDoList = 269025055 +const KEY_Tools = 269025153 +const KEY_TopMenu = 269025186 +const KEY_TouchpadOff = 269025201 +const KEY_TouchpadOn = 269025200 +const KEY_TouchpadToggle = 269025193 +const KEY_Touroku = 65323 +const KEY_Travel = 269025154 +const KEY_Tslash = 940 +const KEY_U = 85 +const KEY_UWB = 269025174 +const KEY_Uacute = 218 +const KEY_Ubelowdot = 16785124 +const KEY_Ubreve = 733 +const KEY_Ucircumflex = 219 +const KEY_Udiaeresis = 220 +const KEY_Udoubleacute = 475 +const KEY_Ugrave = 217 +const KEY_Uhook = 16785126 +const KEY_Uhorn = 16777647 +const KEY_Uhornacute = 16785128 +const KEY_Uhornbelowdot = 16785136 +const KEY_Uhorngrave = 16785130 +const KEY_Uhornhook = 16785132 +const KEY_Uhorntilde = 16785134 +const KEY_Ukrainian_GHE_WITH_UPTURN = 1725 +const KEY_Ukrainian_I = 1718 +const KEY_Ukrainian_IE = 1716 +const KEY_Ukrainian_YI = 1719 +const KEY_Ukrainian_ghe_with_upturn = 1709 +const KEY_Ukrainian_i = 1702 +const KEY_Ukrainian_ie = 1700 +const KEY_Ukrainian_yi = 1703 +const KEY_Ukranian_I = 1718 +const KEY_Ukranian_JE = 1716 +const KEY_Ukranian_YI = 1719 +const KEY_Ukranian_i = 1702 +const KEY_Ukranian_je = 1700 +const KEY_Ukranian_yi = 1703 +const KEY_Umacron = 990 +const KEY_Undo = 65381 +const KEY_Ungrab = 269024800 +const KEY_Uogonek = 985 +const KEY_Up = 65362 +const KEY_Uring = 473 +const KEY_User1KB = 269025157 +const KEY_User2KB = 269025158 +const KEY_UserPB = 269025156 +const KEY_Utilde = 989 +const KEY_V = 86 +const KEY_VendorHome = 269025076 +const KEY_Video = 269025159 +const KEY_View = 269025185 +const KEY_VoidSymbol = 16777215 +const KEY_W = 87 +const KEY_WLAN = 269025173 +const KEY_WWAN = 269025204 +const KEY_WWW = 269025070 +const KEY_Wacute = 16785026 +const KEY_WakeUp = 269025067 +const KEY_Wcircumflex = 16777588 +const KEY_Wdiaeresis = 16785028 +const KEY_WebCam = 269025167 +const KEY_Wgrave = 16785024 +const KEY_WheelButton = 269025160 +const KEY_WindowClear = 269025109 +const KEY_WonSign = 16785577 +const KEY_Word = 269025161 +const KEY_X = 88 +const KEY_Xabovedot = 16785034 +const KEY_Xfer = 269025162 +const KEY_Y = 89 +const KEY_Yacute = 221 +const KEY_Ybelowdot = 16785140 +const KEY_Ycircumflex = 16777590 +const KEY_Ydiaeresis = 5054 +const KEY_Yellow = 269025189 +const KEY_Ygrave = 16785138 +const KEY_Yhook = 16785142 +const KEY_Ytilde = 16785144 +const KEY_Z = 90 +const KEY_Zabovedot = 431 +const KEY_Zacute = 428 +const KEY_Zcaron = 430 +const KEY_Zen_Koho = 65341 +const KEY_Zenkaku = 65320 +const KEY_Zenkaku_Hankaku = 65322 +const KEY_ZoomIn = 269025163 +const KEY_ZoomOut = 269025164 +const KEY_Zstroke = 16777653 +const KEY_a = 97 +const KEY_aacute = 225 +const KEY_abelowdot = 16785057 +const KEY_abovedot = 511 +const KEY_abreve = 483 +const KEY_abreveacute = 16785071 +const KEY_abrevebelowdot = 16785079 +const KEY_abrevegrave = 16785073 +const KEY_abrevehook = 16785075 +const KEY_abrevetilde = 16785077 +const KEY_acircumflex = 226 +const KEY_acircumflexacute = 16785061 +const KEY_acircumflexbelowdot = 16785069 +const KEY_acircumflexgrave = 16785063 +const KEY_acircumflexhook = 16785065 +const KEY_acircumflextilde = 16785067 +const KEY_acute = 180 +const KEY_adiaeresis = 228 +const KEY_ae = 230 +const KEY_agrave = 224 +const KEY_ahook = 16785059 +const KEY_amacron = 992 +const KEY_ampersand = 38 +const KEY_aogonek = 433 +const KEY_apostrophe = 39 +const KEY_approxeq = 16785992 +const KEY_approximate = 2248 +const KEY_aring = 229 +const KEY_asciicircum = 94 +const KEY_asciitilde = 126 +const KEY_asterisk = 42 +const KEY_at = 64 +const KEY_atilde = 227 +const KEY_b = 98 +const KEY_babovedot = 16784899 +const KEY_backslash = 92 +const KEY_ballotcross = 2804 +const KEY_bar = 124 +const KEY_because = 16785973 +const KEY_blank = 2527 +const KEY_botintegral = 2213 +const KEY_botleftparens = 2220 +const KEY_botleftsqbracket = 2216 +const KEY_botleftsummation = 2226 +const KEY_botrightparens = 2222 +const KEY_botrightsqbracket = 2218 +const KEY_botrightsummation = 2230 +const KEY_bott = 2550 +const KEY_botvertsummationconnector = 2228 +const KEY_braceleft = 123 +const KEY_braceright = 125 +const KEY_bracketleft = 91 +const KEY_bracketright = 93 +const KEY_braille_blank = 16787456 +const KEY_braille_dot_1 = 65521 +const KEY_braille_dot_10 = 65530 +const KEY_braille_dot_2 = 65522 +const KEY_braille_dot_3 = 65523 +const KEY_braille_dot_4 = 65524 +const KEY_braille_dot_5 = 65525 +const KEY_braille_dot_6 = 65526 +const KEY_braille_dot_7 = 65527 +const KEY_braille_dot_8 = 65528 +const KEY_braille_dot_9 = 65529 +const KEY_braille_dots_1 = 16787457 +const KEY_braille_dots_12 = 16787459 +const KEY_braille_dots_123 = 16787463 +const KEY_braille_dots_1234 = 16787471 +const KEY_braille_dots_12345 = 16787487 +const KEY_braille_dots_123456 = 16787519 +const KEY_braille_dots_1234567 = 16787583 +const KEY_braille_dots_12345678 = 16787711 +const KEY_braille_dots_1234568 = 16787647 +const KEY_braille_dots_123457 = 16787551 +const KEY_braille_dots_1234578 = 16787679 +const KEY_braille_dots_123458 = 16787615 +const KEY_braille_dots_12346 = 16787503 +const KEY_braille_dots_123467 = 16787567 +const KEY_braille_dots_1234678 = 16787695 +const KEY_braille_dots_123468 = 16787631 +const KEY_braille_dots_12347 = 16787535 +const KEY_braille_dots_123478 = 16787663 +const KEY_braille_dots_12348 = 16787599 +const KEY_braille_dots_1235 = 16787479 +const KEY_braille_dots_12356 = 16787511 +const KEY_braille_dots_123567 = 16787575 +const KEY_braille_dots_1235678 = 16787703 +const KEY_braille_dots_123568 = 16787639 +const KEY_braille_dots_12357 = 16787543 +const KEY_braille_dots_123578 = 16787671 +const KEY_braille_dots_12358 = 16787607 +const KEY_braille_dots_1236 = 16787495 +const KEY_braille_dots_12367 = 16787559 +const KEY_braille_dots_123678 = 16787687 +const KEY_braille_dots_12368 = 16787623 +const KEY_braille_dots_1237 = 16787527 +const KEY_braille_dots_12378 = 16787655 +const KEY_braille_dots_1238 = 16787591 +const KEY_braille_dots_124 = 16787467 +const KEY_braille_dots_1245 = 16787483 +const KEY_braille_dots_12456 = 16787515 +const KEY_braille_dots_124567 = 16787579 +const KEY_braille_dots_1245678 = 16787707 +const KEY_braille_dots_124568 = 16787643 +const KEY_braille_dots_12457 = 16787547 +const KEY_braille_dots_124578 = 16787675 +const KEY_braille_dots_12458 = 16787611 +const KEY_braille_dots_1246 = 16787499 +const KEY_braille_dots_12467 = 16787563 +const KEY_braille_dots_124678 = 16787691 +const KEY_braille_dots_12468 = 16787627 +const KEY_braille_dots_1247 = 16787531 +const KEY_braille_dots_12478 = 16787659 +const KEY_braille_dots_1248 = 16787595 +const KEY_braille_dots_125 = 16787475 +const KEY_braille_dots_1256 = 16787507 +const KEY_braille_dots_12567 = 16787571 +const KEY_braille_dots_125678 = 16787699 +const KEY_braille_dots_12568 = 16787635 +const KEY_braille_dots_1257 = 16787539 +const KEY_braille_dots_12578 = 16787667 +const KEY_braille_dots_1258 = 16787603 +const KEY_braille_dots_126 = 16787491 +const KEY_braille_dots_1267 = 16787555 +const KEY_braille_dots_12678 = 16787683 +const KEY_braille_dots_1268 = 16787619 +const KEY_braille_dots_127 = 16787523 +const KEY_braille_dots_1278 = 16787651 +const KEY_braille_dots_128 = 16787587 +const KEY_braille_dots_13 = 16787461 +const KEY_braille_dots_134 = 16787469 +const KEY_braille_dots_1345 = 16787485 +const KEY_braille_dots_13456 = 16787517 +const KEY_braille_dots_134567 = 16787581 +const KEY_braille_dots_1345678 = 16787709 +const KEY_braille_dots_134568 = 16787645 +const KEY_braille_dots_13457 = 16787549 +const KEY_braille_dots_134578 = 16787677 +const KEY_braille_dots_13458 = 16787613 +const KEY_braille_dots_1346 = 16787501 +const KEY_braille_dots_13467 = 16787565 +const KEY_braille_dots_134678 = 16787693 +const KEY_braille_dots_13468 = 16787629 +const KEY_braille_dots_1347 = 16787533 +const KEY_braille_dots_13478 = 16787661 +const KEY_braille_dots_1348 = 16787597 +const KEY_braille_dots_135 = 16787477 +const KEY_braille_dots_1356 = 16787509 +const KEY_braille_dots_13567 = 16787573 +const KEY_braille_dots_135678 = 16787701 +const KEY_braille_dots_13568 = 16787637 +const KEY_braille_dots_1357 = 16787541 +const KEY_braille_dots_13578 = 16787669 +const KEY_braille_dots_1358 = 16787605 +const KEY_braille_dots_136 = 16787493 +const KEY_braille_dots_1367 = 16787557 +const KEY_braille_dots_13678 = 16787685 +const KEY_braille_dots_1368 = 16787621 +const KEY_braille_dots_137 = 16787525 +const KEY_braille_dots_1378 = 16787653 +const KEY_braille_dots_138 = 16787589 +const KEY_braille_dots_14 = 16787465 +const KEY_braille_dots_145 = 16787481 +const KEY_braille_dots_1456 = 16787513 +const KEY_braille_dots_14567 = 16787577 +const KEY_braille_dots_145678 = 16787705 +const KEY_braille_dots_14568 = 16787641 +const KEY_braille_dots_1457 = 16787545 +const KEY_braille_dots_14578 = 16787673 +const KEY_braille_dots_1458 = 16787609 +const KEY_braille_dots_146 = 16787497 +const KEY_braille_dots_1467 = 16787561 +const KEY_braille_dots_14678 = 16787689 +const KEY_braille_dots_1468 = 16787625 +const KEY_braille_dots_147 = 16787529 +const KEY_braille_dots_1478 = 16787657 +const KEY_braille_dots_148 = 16787593 +const KEY_braille_dots_15 = 16787473 +const KEY_braille_dots_156 = 16787505 +const KEY_braille_dots_1567 = 16787569 +const KEY_braille_dots_15678 = 16787697 +const KEY_braille_dots_1568 = 16787633 +const KEY_braille_dots_157 = 16787537 +const KEY_braille_dots_1578 = 16787665 +const KEY_braille_dots_158 = 16787601 +const KEY_braille_dots_16 = 16787489 +const KEY_braille_dots_167 = 16787553 +const KEY_braille_dots_1678 = 16787681 +const KEY_braille_dots_168 = 16787617 +const KEY_braille_dots_17 = 16787521 +const KEY_braille_dots_178 = 16787649 +const KEY_braille_dots_18 = 16787585 +const KEY_braille_dots_2 = 16787458 +const KEY_braille_dots_23 = 16787462 +const KEY_braille_dots_234 = 16787470 +const KEY_braille_dots_2345 = 16787486 +const KEY_braille_dots_23456 = 16787518 +const KEY_braille_dots_234567 = 16787582 +const KEY_braille_dots_2345678 = 16787710 +const KEY_braille_dots_234568 = 16787646 +const KEY_braille_dots_23457 = 16787550 +const KEY_braille_dots_234578 = 16787678 +const KEY_braille_dots_23458 = 16787614 +const KEY_braille_dots_2346 = 16787502 +const KEY_braille_dots_23467 = 16787566 +const KEY_braille_dots_234678 = 16787694 +const KEY_braille_dots_23468 = 16787630 +const KEY_braille_dots_2347 = 16787534 +const KEY_braille_dots_23478 = 16787662 +const KEY_braille_dots_2348 = 16787598 +const KEY_braille_dots_235 = 16787478 +const KEY_braille_dots_2356 = 16787510 +const KEY_braille_dots_23567 = 16787574 +const KEY_braille_dots_235678 = 16787702 +const KEY_braille_dots_23568 = 16787638 +const KEY_braille_dots_2357 = 16787542 +const KEY_braille_dots_23578 = 16787670 +const KEY_braille_dots_2358 = 16787606 +const KEY_braille_dots_236 = 16787494 +const KEY_braille_dots_2367 = 16787558 +const KEY_braille_dots_23678 = 16787686 +const KEY_braille_dots_2368 = 16787622 +const KEY_braille_dots_237 = 16787526 +const KEY_braille_dots_2378 = 16787654 +const KEY_braille_dots_238 = 16787590 +const KEY_braille_dots_24 = 16787466 +const KEY_braille_dots_245 = 16787482 +const KEY_braille_dots_2456 = 16787514 +const KEY_braille_dots_24567 = 16787578 +const KEY_braille_dots_245678 = 16787706 +const KEY_braille_dots_24568 = 16787642 +const KEY_braille_dots_2457 = 16787546 +const KEY_braille_dots_24578 = 16787674 +const KEY_braille_dots_2458 = 16787610 +const KEY_braille_dots_246 = 16787498 +const KEY_braille_dots_2467 = 16787562 +const KEY_braille_dots_24678 = 16787690 +const KEY_braille_dots_2468 = 16787626 +const KEY_braille_dots_247 = 16787530 +const KEY_braille_dots_2478 = 16787658 +const KEY_braille_dots_248 = 16787594 +const KEY_braille_dots_25 = 16787474 +const KEY_braille_dots_256 = 16787506 +const KEY_braille_dots_2567 = 16787570 +const KEY_braille_dots_25678 = 16787698 +const KEY_braille_dots_2568 = 16787634 +const KEY_braille_dots_257 = 16787538 +const KEY_braille_dots_2578 = 16787666 +const KEY_braille_dots_258 = 16787602 +const KEY_braille_dots_26 = 16787490 +const KEY_braille_dots_267 = 16787554 +const KEY_braille_dots_2678 = 16787682 +const KEY_braille_dots_268 = 16787618 +const KEY_braille_dots_27 = 16787522 +const KEY_braille_dots_278 = 16787650 +const KEY_braille_dots_28 = 16787586 +const KEY_braille_dots_3 = 16787460 +const KEY_braille_dots_34 = 16787468 +const KEY_braille_dots_345 = 16787484 +const KEY_braille_dots_3456 = 16787516 +const KEY_braille_dots_34567 = 16787580 +const KEY_braille_dots_345678 = 16787708 +const KEY_braille_dots_34568 = 16787644 +const KEY_braille_dots_3457 = 16787548 +const KEY_braille_dots_34578 = 16787676 +const KEY_braille_dots_3458 = 16787612 +const KEY_braille_dots_346 = 16787500 +const KEY_braille_dots_3467 = 16787564 +const KEY_braille_dots_34678 = 16787692 +const KEY_braille_dots_3468 = 16787628 +const KEY_braille_dots_347 = 16787532 +const KEY_braille_dots_3478 = 16787660 +const KEY_braille_dots_348 = 16787596 +const KEY_braille_dots_35 = 16787476 +const KEY_braille_dots_356 = 16787508 +const KEY_braille_dots_3567 = 16787572 +const KEY_braille_dots_35678 = 16787700 +const KEY_braille_dots_3568 = 16787636 +const KEY_braille_dots_357 = 16787540 +const KEY_braille_dots_3578 = 16787668 +const KEY_braille_dots_358 = 16787604 +const KEY_braille_dots_36 = 16787492 +const KEY_braille_dots_367 = 16787556 +const KEY_braille_dots_3678 = 16787684 +const KEY_braille_dots_368 = 16787620 +const KEY_braille_dots_37 = 16787524 +const KEY_braille_dots_378 = 16787652 +const KEY_braille_dots_38 = 16787588 +const KEY_braille_dots_4 = 16787464 +const KEY_braille_dots_45 = 16787480 +const KEY_braille_dots_456 = 16787512 +const KEY_braille_dots_4567 = 16787576 +const KEY_braille_dots_45678 = 16787704 +const KEY_braille_dots_4568 = 16787640 +const KEY_braille_dots_457 = 16787544 +const KEY_braille_dots_4578 = 16787672 +const KEY_braille_dots_458 = 16787608 +const KEY_braille_dots_46 = 16787496 +const KEY_braille_dots_467 = 16787560 +const KEY_braille_dots_4678 = 16787688 +const KEY_braille_dots_468 = 16787624 +const KEY_braille_dots_47 = 16787528 +const KEY_braille_dots_478 = 16787656 +const KEY_braille_dots_48 = 16787592 +const KEY_braille_dots_5 = 16787472 +const KEY_braille_dots_56 = 16787504 +const KEY_braille_dots_567 = 16787568 +const KEY_braille_dots_5678 = 16787696 +const KEY_braille_dots_568 = 16787632 +const KEY_braille_dots_57 = 16787536 +const KEY_braille_dots_578 = 16787664 +const KEY_braille_dots_58 = 16787600 +const KEY_braille_dots_6 = 16787488 +const KEY_braille_dots_67 = 16787552 +const KEY_braille_dots_678 = 16787680 +const KEY_braille_dots_68 = 16787616 +const KEY_braille_dots_7 = 16787520 +const KEY_braille_dots_78 = 16787648 +const KEY_braille_dots_8 = 16787584 +const KEY_breve = 418 +const KEY_brokenbar = 166 +const KEY_c = 99 +const KEY_c_h = 65187 +const KEY_cabovedot = 741 +const KEY_cacute = 486 +const KEY_careof = 2744 +const KEY_caret = 2812 +const KEY_caron = 439 +const KEY_ccaron = 488 +const KEY_ccedilla = 231 +const KEY_ccircumflex = 742 +const KEY_cedilla = 184 +const KEY_cent = 162 +const KEY_ch = 65184 +const KEY_checkerboard = 2529 +const KEY_checkmark = 2803 +const KEY_circle = 3023 +const KEY_club = 2796 +const KEY_colon = 58 +const KEY_comma = 44 +const KEY_containsas = 16785931 +const KEY_copyright = 169 +const KEY_cr = 2532 +const KEY_crossinglines = 2542 +const KEY_cuberoot = 16785947 +const KEY_currency = 164 +const KEY_cursor = 2815 +const KEY_d = 100 +const KEY_dabovedot = 16784907 +const KEY_dagger = 2801 +const KEY_dcaron = 495 +const KEY_dead_A = 65153 +const KEY_dead_E = 65155 +const KEY_dead_I = 65157 +const KEY_dead_O = 65159 +const KEY_dead_U = 65161 +const KEY_dead_a = 65152 +const KEY_dead_abovecomma = 65124 +const KEY_dead_abovedot = 65110 +const KEY_dead_abovereversedcomma = 65125 +const KEY_dead_abovering = 65112 +const KEY_dead_aboveverticalline = 65169 +const KEY_dead_acute = 65105 +const KEY_dead_belowbreve = 65131 +const KEY_dead_belowcircumflex = 65129 +const KEY_dead_belowcomma = 65134 +const KEY_dead_belowdiaeresis = 65132 +const KEY_dead_belowdot = 65120 +const KEY_dead_belowmacron = 65128 +const KEY_dead_belowring = 65127 +const KEY_dead_belowtilde = 65130 +const KEY_dead_belowverticalline = 65170 +const KEY_dead_breve = 65109 +const KEY_dead_capital_schwa = 65163 +const KEY_dead_caron = 65114 +const KEY_dead_cedilla = 65115 +const KEY_dead_circumflex = 65106 +const KEY_dead_currency = 65135 +const KEY_dead_dasia = 65125 +const KEY_dead_diaeresis = 65111 +const KEY_dead_doubleacute = 65113 +const KEY_dead_doublegrave = 65126 +const KEY_dead_e = 65154 +const KEY_dead_grave = 65104 +const KEY_dead_greek = 65164 +const KEY_dead_hook = 65121 +const KEY_dead_horn = 65122 +const KEY_dead_i = 65156 +const KEY_dead_invertedbreve = 65133 +const KEY_dead_iota = 65117 +const KEY_dead_longsolidusoverlay = 65171 +const KEY_dead_lowline = 65168 +const KEY_dead_macron = 65108 +const KEY_dead_o = 65158 +const KEY_dead_ogonek = 65116 +const KEY_dead_perispomeni = 65107 +const KEY_dead_psili = 65124 +const KEY_dead_semivoiced_sound = 65119 +const KEY_dead_small_schwa = 65162 +const KEY_dead_stroke = 65123 +const KEY_dead_tilde = 65107 +const KEY_dead_u = 65160 +const KEY_dead_voiced_sound = 65118 +const KEY_decimalpoint = 2749 +const KEY_degree = 176 +const KEY_diaeresis = 168 +const KEY_diamond = 2797 +const KEY_digitspace = 2725 +const KEY_dintegral = 16785964 +const KEY_division = 247 +const KEY_dollar = 36 +const KEY_doubbaselinedot = 2735 +const KEY_doubleacute = 445 +const KEY_doubledagger = 2802 +const KEY_doublelowquotemark = 2814 +const KEY_downarrow = 2302 +const KEY_downcaret = 2984 +const KEY_downshoe = 3030 +const KEY_downstile = 3012 +const KEY_downtack = 3010 +const KEY_dstroke = 496 +const KEY_e = 101 +const KEY_eabovedot = 1004 +const KEY_eacute = 233 +const KEY_ebelowdot = 16785081 +const KEY_ecaron = 492 +const KEY_ecircumflex = 234 +const KEY_ecircumflexacute = 16785087 +const KEY_ecircumflexbelowdot = 16785095 +const KEY_ecircumflexgrave = 16785089 +const KEY_ecircumflexhook = 16785091 +const KEY_ecircumflextilde = 16785093 +const KEY_ediaeresis = 235 +const KEY_egrave = 232 +const KEY_ehook = 16785083 +const KEY_eightsubscript = 16785544 +const KEY_eightsuperior = 16785528 +const KEY_elementof = 16785928 +const KEY_ellipsis = 2734 +const KEY_em3space = 2723 +const KEY_em4space = 2724 +const KEY_emacron = 954 +const KEY_emdash = 2729 +const KEY_emfilledcircle = 2782 +const KEY_emfilledrect = 2783 +const KEY_emopencircle = 2766 +const KEY_emopenrectangle = 2767 +const KEY_emptyset = 16785925 +const KEY_emspace = 2721 +const KEY_endash = 2730 +const KEY_enfilledcircbullet = 2790 +const KEY_enfilledsqbullet = 2791 +const KEY_eng = 959 +const KEY_enopencircbullet = 2784 +const KEY_enopensquarebullet = 2785 +const KEY_enspace = 2722 +const KEY_eogonek = 490 +const KEY_equal = 61 +const KEY_eth = 240 +const KEY_etilde = 16785085 +const KEY_exclam = 33 +const KEY_exclamdown = 161 +const KEY_ezh = 16777874 +const KEY_f = 102 +const KEY_fabovedot = 16784927 +const KEY_femalesymbol = 2808 +const KEY_ff = 2531 +const KEY_figdash = 2747 +const KEY_filledlefttribullet = 2780 +const KEY_filledrectbullet = 2779 +const KEY_filledrighttribullet = 2781 +const KEY_filledtribulletdown = 2793 +const KEY_filledtribulletup = 2792 +const KEY_fiveeighths = 2757 +const KEY_fivesixths = 2743 +const KEY_fivesubscript = 16785541 +const KEY_fivesuperior = 16785525 +const KEY_fourfifths = 2741 +const KEY_foursubscript = 16785540 +const KEY_foursuperior = 16785524 +const KEY_fourthroot = 16785948 +const KEY_function = 2294 +const KEY_g = 103 +const KEY_gabovedot = 757 +const KEY_gbreve = 699 +const KEY_gcaron = 16777703 +const KEY_gcedilla = 955 +const KEY_gcircumflex = 760 +const KEY_grave = 96 +const KEY_greater = 62 +const KEY_greaterthanequal = 2238 +const KEY_guillemotleft = 171 +const KEY_guillemotright = 187 +const KEY_h = 104 +const KEY_hairspace = 2728 +const KEY_hcircumflex = 694 +const KEY_heart = 2798 +const KEY_hebrew_aleph = 3296 +const KEY_hebrew_ayin = 3314 +const KEY_hebrew_bet = 3297 +const KEY_hebrew_beth = 3297 +const KEY_hebrew_chet = 3303 +const KEY_hebrew_dalet = 3299 +const KEY_hebrew_daleth = 3299 +const KEY_hebrew_doublelowline = 3295 +const KEY_hebrew_finalkaph = 3306 +const KEY_hebrew_finalmem = 3309 +const KEY_hebrew_finalnun = 3311 +const KEY_hebrew_finalpe = 3315 +const KEY_hebrew_finalzade = 3317 +const KEY_hebrew_finalzadi = 3317 +const KEY_hebrew_gimel = 3298 +const KEY_hebrew_gimmel = 3298 +const KEY_hebrew_he = 3300 +const KEY_hebrew_het = 3303 +const KEY_hebrew_kaph = 3307 +const KEY_hebrew_kuf = 3319 +const KEY_hebrew_lamed = 3308 +const KEY_hebrew_mem = 3310 +const KEY_hebrew_nun = 3312 +const KEY_hebrew_pe = 3316 +const KEY_hebrew_qoph = 3319 +const KEY_hebrew_resh = 3320 +const KEY_hebrew_samech = 3313 +const KEY_hebrew_samekh = 3313 +const KEY_hebrew_shin = 3321 +const KEY_hebrew_taf = 3322 +const KEY_hebrew_taw = 3322 +const KEY_hebrew_tet = 3304 +const KEY_hebrew_teth = 3304 +const KEY_hebrew_waw = 3301 +const KEY_hebrew_yod = 3305 +const KEY_hebrew_zade = 3318 +const KEY_hebrew_zadi = 3318 +const KEY_hebrew_zain = 3302 +const KEY_hebrew_zayin = 3302 +const KEY_hexagram = 2778 +const KEY_horizconnector = 2211 +const KEY_horizlinescan1 = 2543 +const KEY_horizlinescan3 = 2544 +const KEY_horizlinescan5 = 2545 +const KEY_horizlinescan7 = 2546 +const KEY_horizlinescan9 = 2547 +const KEY_hstroke = 689 +const KEY_ht = 2530 +const KEY_hyphen = 173 +const KEY_i = 105 +const KEY_iTouch = 269025120 +const KEY_iacute = 237 +const KEY_ibelowdot = 16785099 +const KEY_ibreve = 16777517 +const KEY_icircumflex = 238 +const KEY_identical = 2255 +const KEY_idiaeresis = 239 +const KEY_idotless = 697 +const KEY_ifonlyif = 2253 +const KEY_igrave = 236 +const KEY_ihook = 16785097 +const KEY_imacron = 1007 +const KEY_implies = 2254 +const KEY_includedin = 2266 +const KEY_includes = 2267 +const KEY_infinity = 2242 +const KEY_integral = 2239 +const KEY_intersection = 2268 +const KEY_iogonek = 999 +const KEY_itilde = 949 +const KEY_j = 106 +const KEY_jcircumflex = 700 +const KEY_jot = 3018 +const KEY_k = 107 +const KEY_kana_A = 1201 +const KEY_kana_CHI = 1217 +const KEY_kana_E = 1204 +const KEY_kana_FU = 1228 +const KEY_kana_HA = 1226 +const KEY_kana_HE = 1229 +const KEY_kana_HI = 1227 +const KEY_kana_HO = 1230 +const KEY_kana_HU = 1228 +const KEY_kana_I = 1202 +const KEY_kana_KA = 1206 +const KEY_kana_KE = 1209 +const KEY_kana_KI = 1207 +const KEY_kana_KO = 1210 +const KEY_kana_KU = 1208 +const KEY_kana_MA = 1231 +const KEY_kana_ME = 1234 +const KEY_kana_MI = 1232 +const KEY_kana_MO = 1235 +const KEY_kana_MU = 1233 +const KEY_kana_N = 1245 +const KEY_kana_NA = 1221 +const KEY_kana_NE = 1224 +const KEY_kana_NI = 1222 +const KEY_kana_NO = 1225 +const KEY_kana_NU = 1223 +const KEY_kana_O = 1205 +const KEY_kana_RA = 1239 +const KEY_kana_RE = 1242 +const KEY_kana_RI = 1240 +const KEY_kana_RO = 1243 +const KEY_kana_RU = 1241 +const KEY_kana_SA = 1211 +const KEY_kana_SE = 1214 +const KEY_kana_SHI = 1212 +const KEY_kana_SO = 1215 +const KEY_kana_SU = 1213 +const KEY_kana_TA = 1216 +const KEY_kana_TE = 1219 +const KEY_kana_TI = 1217 +const KEY_kana_TO = 1220 +const KEY_kana_TSU = 1218 +const KEY_kana_TU = 1218 +const KEY_kana_U = 1203 +const KEY_kana_WA = 1244 +const KEY_kana_WO = 1190 +const KEY_kana_YA = 1236 +const KEY_kana_YO = 1238 +const KEY_kana_YU = 1237 +const KEY_kana_a = 1191 +const KEY_kana_closingbracket = 1187 +const KEY_kana_comma = 1188 +const KEY_kana_conjunctive = 1189 +const KEY_kana_e = 1194 +const KEY_kana_fullstop = 1185 +const KEY_kana_i = 1192 +const KEY_kana_middledot = 1189 +const KEY_kana_o = 1195 +const KEY_kana_openingbracket = 1186 +const KEY_kana_switch = 65406 +const KEY_kana_tsu = 1199 +const KEY_kana_tu = 1199 +const KEY_kana_u = 1193 +const KEY_kana_ya = 1196 +const KEY_kana_yo = 1198 +const KEY_kana_yu = 1197 +const KEY_kappa = 930 +const KEY_kcedilla = 1011 +const KEY_kra = 930 +const KEY_l = 108 +const KEY_lacute = 485 +const KEY_latincross = 2777 +const KEY_lbelowdot = 16784951 +const KEY_lcaron = 437 +const KEY_lcedilla = 950 +const KEY_leftanglebracket = 2748 +const KEY_leftarrow = 2299 +const KEY_leftcaret = 2979 +const KEY_leftdoublequotemark = 2770 +const KEY_leftmiddlecurlybrace = 2223 +const KEY_leftopentriangle = 2764 +const KEY_leftpointer = 2794 +const KEY_leftradical = 2209 +const KEY_leftshoe = 3034 +const KEY_leftsinglequotemark = 2768 +const KEY_leftt = 2548 +const KEY_lefttack = 3036 +const KEY_less = 60 +const KEY_lessthanequal = 2236 +const KEY_lf = 2533 +const KEY_logicaland = 2270 +const KEY_logicalor = 2271 +const KEY_lowleftcorner = 2541 +const KEY_lowrightcorner = 2538 +const KEY_lstroke = 435 +const KEY_m = 109 +const KEY_mabovedot = 16784961 +const KEY_macron = 175 +const KEY_malesymbol = 2807 +const KEY_maltesecross = 2800 +const KEY_marker = 2751 +const KEY_masculine = 186 +const KEY_minus = 45 +const KEY_minutes = 2774 +const KEY_mu = 181 +const KEY_multiply = 215 +const KEY_musicalflat = 2806 +const KEY_musicalsharp = 2805 +const KEY_n = 110 +const KEY_nabla = 2245 +const KEY_nacute = 497 +const KEY_ncaron = 498 +const KEY_ncedilla = 1009 +const KEY_ninesubscript = 16785545 +const KEY_ninesuperior = 16785529 +const KEY_nl = 2536 +const KEY_nobreakspace = 160 +const KEY_notapproxeq = 16785991 +const KEY_notelementof = 16785929 +const KEY_notequal = 2237 +const KEY_notidentical = 16786018 +const KEY_notsign = 172 +const KEY_ntilde = 241 +const KEY_numbersign = 35 +const KEY_numerosign = 1712 +const KEY_o = 111 +const KEY_oacute = 243 +const KEY_obarred = 16777845 +const KEY_obelowdot = 16785101 +const KEY_ocaron = 16777682 +const KEY_ocircumflex = 244 +const KEY_ocircumflexacute = 16785105 +const KEY_ocircumflexbelowdot = 16785113 +const KEY_ocircumflexgrave = 16785107 +const KEY_ocircumflexhook = 16785109 +const KEY_ocircumflextilde = 16785111 +const KEY_odiaeresis = 246 +const KEY_odoubleacute = 501 +const KEY_oe = 5053 +const KEY_ogonek = 434 +const KEY_ograve = 242 +const KEY_ohook = 16785103 +const KEY_ohorn = 16777633 +const KEY_ohornacute = 16785115 +const KEY_ohornbelowdot = 16785123 +const KEY_ohorngrave = 16785117 +const KEY_ohornhook = 16785119 +const KEY_ohorntilde = 16785121 +const KEY_omacron = 1010 +const KEY_oneeighth = 2755 +const KEY_onefifth = 2738 +const KEY_onehalf = 189 +const KEY_onequarter = 188 +const KEY_onesixth = 2742 +const KEY_onesubscript = 16785537 +const KEY_onesuperior = 185 +const KEY_onethird = 2736 +const KEY_ooblique = 248 +const KEY_openrectbullet = 2786 +const KEY_openstar = 2789 +const KEY_opentribulletdown = 2788 +const KEY_opentribulletup = 2787 +const KEY_ordfeminine = 170 +const KEY_oslash = 248 +const KEY_otilde = 245 +const KEY_overbar = 3008 +const KEY_overline = 1150 +const KEY_p = 112 +const KEY_pabovedot = 16784983 +const KEY_paragraph = 182 +const KEY_parenleft = 40 +const KEY_parenright = 41 +const KEY_partdifferential = 16785922 +const KEY_partialderivative = 2287 +const KEY_percent = 37 +const KEY_period = 46 +const KEY_periodcentered = 183 +const KEY_permille = 2773 +const KEY_phonographcopyright = 2811 +const KEY_plus = 43 +const KEY_plusminus = 177 +const KEY_prescription = 2772 +const KEY_prolongedsound = 1200 +const KEY_punctspace = 2726 +const KEY_q = 113 +const KEY_quad = 3020 +const KEY_question = 63 +const KEY_questiondown = 191 +const KEY_quotedbl = 34 +const KEY_quoteleft = 96 +const KEY_quoteright = 39 +const KEY_r = 114 +const KEY_racute = 480 +const KEY_radical = 2262 +const KEY_rcaron = 504 +const KEY_rcedilla = 947 +const KEY_registered = 174 +const KEY_rightanglebracket = 2750 +const KEY_rightarrow = 2301 +const KEY_rightcaret = 2982 +const KEY_rightdoublequotemark = 2771 +const KEY_rightmiddlecurlybrace = 2224 +const KEY_rightmiddlesummation = 2231 +const KEY_rightopentriangle = 2765 +const KEY_rightpointer = 2795 +const KEY_rightshoe = 3032 +const KEY_rightsinglequotemark = 2769 +const KEY_rightt = 2549 +const KEY_righttack = 3068 +const KEY_s = 115 +const KEY_sabovedot = 16784993 +const KEY_sacute = 438 +const KEY_scaron = 441 +const KEY_scedilla = 442 +const KEY_schwa = 16777817 +const KEY_scircumflex = 766 +const KEY_script_switch = 65406 +const KEY_seconds = 2775 +const KEY_section = 167 +const KEY_semicolon = 59 +const KEY_semivoicedsound = 1247 +const KEY_seveneighths = 2758 +const KEY_sevensubscript = 16785543 +const KEY_sevensuperior = 16785527 +const KEY_signaturemark = 2762 +const KEY_signifblank = 2732 +const KEY_similarequal = 2249 +const KEY_singlelowquotemark = 2813 +const KEY_sixsubscript = 16785542 +const KEY_sixsuperior = 16785526 +const KEY_slash = 47 +const KEY_soliddiamond = 2528 +const KEY_space = 32 +const KEY_squareroot = 16785946 +const KEY_ssharp = 223 +const KEY_sterling = 163 +const KEY_stricteq = 16786019 +const KEY_t = 116 +const KEY_tabovedot = 16785003 +const KEY_tcaron = 443 +const KEY_tcedilla = 510 +const KEY_telephone = 2809 +const KEY_telephonerecorder = 2810 +const KEY_therefore = 2240 +const KEY_thinspace = 2727 +const KEY_thorn = 254 +const KEY_threeeighths = 2756 +const KEY_threefifths = 2740 +const KEY_threequarters = 190 +const KEY_threesubscript = 16785539 +const KEY_threesuperior = 179 +const KEY_tintegral = 16785965 +const KEY_topintegral = 2212 +const KEY_topleftparens = 2219 +const KEY_topleftradical = 2210 +const KEY_topleftsqbracket = 2215 +const KEY_topleftsummation = 2225 +const KEY_toprightparens = 2221 +const KEY_toprightsqbracket = 2217 +const KEY_toprightsummation = 2229 +const KEY_topt = 2551 +const KEY_topvertsummationconnector = 2227 +const KEY_trademark = 2761 +const KEY_trademarkincircle = 2763 +const KEY_tslash = 956 +const KEY_twofifths = 2739 +const KEY_twosubscript = 16785538 +const KEY_twosuperior = 178 +const KEY_twothirds = 2737 +const KEY_u = 117 +const KEY_uacute = 250 +const KEY_ubelowdot = 16785125 +const KEY_ubreve = 765 +const KEY_ucircumflex = 251 +const KEY_udiaeresis = 252 +const KEY_udoubleacute = 507 +const KEY_ugrave = 249 +const KEY_uhook = 16785127 +const KEY_uhorn = 16777648 +const KEY_uhornacute = 16785129 +const KEY_uhornbelowdot = 16785137 +const KEY_uhorngrave = 16785131 +const KEY_uhornhook = 16785133 +const KEY_uhorntilde = 16785135 +const KEY_umacron = 1022 +const KEY_underbar = 3014 +const KEY_underscore = 95 +const KEY_union = 2269 +const KEY_uogonek = 1017 +const KEY_uparrow = 2300 +const KEY_upcaret = 2985 +const KEY_upleftcorner = 2540 +const KEY_uprightcorner = 2539 +const KEY_upshoe = 3011 +const KEY_upstile = 3027 +const KEY_uptack = 3022 +const KEY_uring = 505 +const KEY_utilde = 1021 +const KEY_v = 118 +const KEY_variation = 2241 +const KEY_vertbar = 2552 +const KEY_vertconnector = 2214 +const KEY_voicedsound = 1246 +const KEY_vt = 2537 +const KEY_w = 119 +const KEY_wacute = 16785027 +const KEY_wcircumflex = 16777589 +const KEY_wdiaeresis = 16785029 +const KEY_wgrave = 16785025 +const KEY_x = 120 +const KEY_xabovedot = 16785035 +const KEY_y = 121 +const KEY_yacute = 253 +const KEY_ybelowdot = 16785141 +const KEY_ycircumflex = 16777591 +const KEY_ydiaeresis = 255 +const KEY_yen = 165 +const KEY_ygrave = 16785139 +const KEY_yhook = 16785143 +const KEY_ytilde = 16785145 +const KEY_z = 122 +const KEY_zabovedot = 447 +const KEY_zacute = 444 +const KEY_zcaron = 446 +const KEY_zerosubscript = 16785536 +const KEY_zerosuperior = 16785520 +const KEY_zstroke = 16777654 + +// MODIFIER_MASK: mask covering all entries in GdkModifierType. +const MODIFIER_MASK = 469769999 + +// PRIORITY_REDRAW: this is the priority that the idle handler processing +// surface updates is given in the main loop. +const PRIORITY_REDRAW = 120 + +// AxisUse defines how device axes are interpreted by GTK. +// +// Note that the X and Y axes are not really needed; pointer devices report +// their location via the x/y members of events regardless. Whether X and Y are +// present as axes depends on the GDK backend. +type AxisUse C.gint + +const ( + // AxisIgnore axis is ignored. + AxisIgnore AxisUse = iota + // AxisX axis is used as the x axis. + AxisX + // AxisY axis is used as the y axis. + AxisY + // AxisDeltaX axis is used as the scroll x delta. + AxisDeltaX + // AxisDeltaY axis is used as the scroll y delta. + AxisDeltaY + // AxisPressure axis is used for pressure information. + AxisPressure + // AxisXtilt axis is used for x tilt information. + AxisXtilt + // AxisYtilt axis is used for y tilt information. + AxisYtilt + // AxisWheel axis is used for wheel information. + AxisWheel + // AxisDistance axis is used for pen/tablet distance information. + AxisDistance + // AxisRotation axis is used for pen rotation information. + AxisRotation + // AxisSlider axis is used for pen slider information. + AxisSlider + // AxisLast: constant equal to the numerically highest axis value. + AxisLast +) + +func marshalAxisUse(p uintptr) (interface{}, error) { + return AxisUse(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AxisUse. +func (a AxisUse) String() string { + switch a { + case AxisIgnore: + return "Ignore" + case AxisX: + return "X" + case AxisY: + return "Y" + case AxisDeltaX: + return "DeltaX" + case AxisDeltaY: + return "DeltaY" + case AxisPressure: + return "Pressure" + case AxisXtilt: + return "Xtilt" + case AxisYtilt: + return "Ytilt" + case AxisWheel: + return "Wheel" + case AxisDistance: + return "Distance" + case AxisRotation: + return "Rotation" + case AxisSlider: + return "Slider" + case AxisLast: + return "Last" + default: + return fmt.Sprintf("AxisUse(%d)", a) + } +} + +// CrossingMode specifies the crossing mode for enter and leave events. +type CrossingMode C.gint + +const ( + // CrossingNormal: crossing because of pointer motion. + CrossingNormal CrossingMode = iota + // CrossingGrab: crossing because a grab is activated. + CrossingGrab + // CrossingUngrab: crossing because a grab is deactivated. + CrossingUngrab + // CrossingGTKGrab: crossing because a GTK grab is activated. + CrossingGTKGrab + // CrossingGTKUngrab: crossing because a GTK grab is deactivated. + CrossingGTKUngrab + // CrossingStateChanged: crossing because a GTK widget changed state (e.g. + // sensitivity). + CrossingStateChanged + // CrossingTouchBegin: crossing because a touch sequence has begun, this + // event is synthetic as the pointer might have not left the surface. + CrossingTouchBegin + // CrossingTouchEnd: crossing because a touch sequence has ended, this event + // is synthetic as the pointer might have not left the surface. + CrossingTouchEnd + // CrossingDeviceSwitch: crossing because of a device switch (i.e. + // a mouse taking control of the pointer after a touch device), this event + // is synthetic as the pointer didn’t leave the surface. + CrossingDeviceSwitch +) + +func marshalCrossingMode(p uintptr) (interface{}, error) { + return CrossingMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for CrossingMode. +func (c CrossingMode) String() string { + switch c { + case CrossingNormal: + return "Normal" + case CrossingGrab: + return "Grab" + case CrossingUngrab: + return "Ungrab" + case CrossingGTKGrab: + return "GTKGrab" + case CrossingGTKUngrab: + return "GTKUngrab" + case CrossingStateChanged: + return "StateChanged" + case CrossingTouchBegin: + return "TouchBegin" + case CrossingTouchEnd: + return "TouchEnd" + case CrossingDeviceSwitch: + return "DeviceSwitch" + default: + return fmt.Sprintf("CrossingMode(%d)", c) + } +} + +// DevicePadFeature: pad feature. +type DevicePadFeature C.gint + +const ( + // DevicePadFeatureButton: button. + DevicePadFeatureButton DevicePadFeature = iota + // DevicePadFeatureRing: ring-shaped interactive area. + DevicePadFeatureRing + // DevicePadFeatureStrip: straight interactive area. + DevicePadFeatureStrip +) + +func marshalDevicePadFeature(p uintptr) (interface{}, error) { + return DevicePadFeature(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DevicePadFeature. +func (d DevicePadFeature) String() string { + switch d { + case DevicePadFeatureButton: + return "Button" + case DevicePadFeatureRing: + return "Ring" + case DevicePadFeatureStrip: + return "Strip" + default: + return fmt.Sprintf("DevicePadFeature(%d)", d) + } +} + +// DeviceToolType indicates the specific type of tool being used being a tablet. +// Such as an airbrush, pencil, etc. +type DeviceToolType C.gint + +const ( + // DeviceToolTypeUnknown: tool is of an unknown type. + DeviceToolTypeUnknown DeviceToolType = iota + // DeviceToolTypePen: tool is a standard tablet stylus. + DeviceToolTypePen + // DeviceToolTypeEraser: tool is standard tablet eraser. + DeviceToolTypeEraser + // DeviceToolTypeBrush: tool is a brush stylus. + DeviceToolTypeBrush + // DeviceToolTypePencil: tool is a pencil stylus. + DeviceToolTypePencil + // DeviceToolTypeAirbrush: tool is an airbrush stylus. + DeviceToolTypeAirbrush + // DeviceToolTypeMouse: tool is a mouse. + DeviceToolTypeMouse + // DeviceToolTypeLens: tool is a lens cursor. + DeviceToolTypeLens +) + +func marshalDeviceToolType(p uintptr) (interface{}, error) { + return DeviceToolType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DeviceToolType. +func (d DeviceToolType) String() string { + switch d { + case DeviceToolTypeUnknown: + return "Unknown" + case DeviceToolTypePen: + return "Pen" + case DeviceToolTypeEraser: + return "Eraser" + case DeviceToolTypeBrush: + return "Brush" + case DeviceToolTypePencil: + return "Pencil" + case DeviceToolTypeAirbrush: + return "Airbrush" + case DeviceToolTypeMouse: + return "Mouse" + case DeviceToolTypeLens: + return "Lens" + default: + return fmt.Sprintf("DeviceToolType(%d)", d) + } +} + +// DmabufError: error enumeration for GdkDmabufTexture. +type DmabufError C.gint + +const ( + // DmabufErrorNotAvailable: dmabuf support is not available, because the OS + // is not Linux, or it was explicitly disabled at compile- or runtime. + DmabufErrorNotAvailable DmabufError = iota + // DmabufErrorUnsupportedFormat: requested format is not supported. + DmabufErrorUnsupportedFormat + // DmabufErrorCreationFailed: GTK failed to create the resource for other + // reasons. + DmabufErrorCreationFailed +) + +func marshalDmabufError(p uintptr) (interface{}, error) { + return DmabufError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DmabufError. +func (d DmabufError) String() string { + switch d { + case DmabufErrorNotAvailable: + return "NotAvailable" + case DmabufErrorUnsupportedFormat: + return "UnsupportedFormat" + case DmabufErrorCreationFailed: + return "CreationFailed" + default: + return fmt.Sprintf("DmabufError(%d)", d) + } +} + +func DmabufErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gdk_dmabuf_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// DragCancelReason: used in GdkDrag to the reason of a cancelled DND operation. +type DragCancelReason C.gint + +const ( + // DragCancelNoTarget: there is no suitable drop target. + DragCancelNoTarget DragCancelReason = iota + // DragCancelUserCancelled: drag cancelled by the user. + DragCancelUserCancelled + // DragCancelError: unspecified error. + DragCancelError +) + +func marshalDragCancelReason(p uintptr) (interface{}, error) { + return DragCancelReason(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DragCancelReason. +func (d DragCancelReason) String() string { + switch d { + case DragCancelNoTarget: + return "NoTarget" + case DragCancelUserCancelled: + return "UserCancelled" + case DragCancelError: + return "Error" + default: + return fmt.Sprintf("DragCancelReason(%d)", d) + } +} + +// EventType specifies the type of the event. +type EventType C.gint + +const ( + // Delete: window manager has requested that the toplevel surface be hidden + // or destroyed, usually when the user clicks on a special icon in the title + // bar. + Delete EventType = iota + // MotionNotify: pointer (usually a mouse) has moved. + MotionNotify + // ButtonPress: mouse button has been pressed. + ButtonPress + // ButtonRelease: mouse button has been released. + ButtonRelease + // KeyPress: key has been pressed. + KeyPress + // KeyRelease: key has been released. + KeyRelease + // EnterNotify: pointer has entered the surface. + EnterNotify + // LeaveNotify: pointer has left the surface. + LeaveNotify + // FocusChange: keyboard focus has entered or left the surface. + FocusChange + // ProximityIn: input device has moved into contact with a sensing surface + // (e.g. a touchscreen or graphics tablet). + ProximityIn + // ProximityOut: input device has moved out of contact with a sensing + // surface. + ProximityOut + // DragEnter: mouse has entered the surface while a drag is in progress. + DragEnter + // DragLeave: mouse has left the surface while a drag is in progress. + DragLeave + // DragMotion: mouse has moved in the surface while a drag is in progress. + DragMotion + // DropStart: drop operation onto the surface has started. + DropStart + // Scroll: scroll wheel was turned. + Scroll + // GrabBroken: pointer or keyboard grab was broken. + GrabBroken + // TouchBegin: new touch event sequence has just started. + TouchBegin + // TouchUpdate: touch event sequence has been updated. + TouchUpdate + // TouchEnd: touch event sequence has finished. + TouchEnd + // TouchCancel: touch event sequence has been canceled. + TouchCancel + // TouchpadSwipe: touchpad swipe gesture event, the current state is + // determined by its phase field. + TouchpadSwipe + // TouchpadPinch: touchpad pinch gesture event, the current state is + // determined by its phase field. + TouchpadPinch + // PadButtonPress: tablet pad button press event. + PadButtonPress + // PadButtonRelease: tablet pad button release event. + PadButtonRelease + // PadRing: tablet pad axis event from a "ring". + PadRing + // PadStrip: tablet pad axis event from a "strip". + PadStrip + // PadGroupMode: tablet pad group mode change. + PadGroupMode + // TouchpadHold: touchpad hold gesture event, the current state is + // determined by its phase field. + TouchpadHold + // EventLast marks the end of the GdkEventType enumeration. + EventLast +) + +func marshalEventType(p uintptr) (interface{}, error) { + return EventType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for EventType. +func (e EventType) String() string { + switch e { + case Delete: + return "Delete" + case MotionNotify: + return "MotionNotify" + case ButtonPress: + return "ButtonPress" + case ButtonRelease: + return "ButtonRelease" + case KeyPress: + return "KeyPress" + case KeyRelease: + return "KeyRelease" + case EnterNotify: + return "EnterNotify" + case LeaveNotify: + return "LeaveNotify" + case FocusChange: + return "FocusChange" + case ProximityIn: + return "ProximityIn" + case ProximityOut: + return "ProximityOut" + case DragEnter: + return "DragEnter" + case DragLeave: + return "DragLeave" + case DragMotion: + return "DragMotion" + case DropStart: + return "DropStart" + case Scroll: + return "Scroll" + case GrabBroken: + return "GrabBroken" + case TouchBegin: + return "TouchBegin" + case TouchUpdate: + return "TouchUpdate" + case TouchEnd: + return "TouchEnd" + case TouchCancel: + return "TouchCancel" + case TouchpadSwipe: + return "TouchpadSwipe" + case TouchpadPinch: + return "TouchpadPinch" + case PadButtonPress: + return "PadButtonPress" + case PadButtonRelease: + return "PadButtonRelease" + case PadRing: + return "PadRing" + case PadStrip: + return "PadStrip" + case PadGroupMode: + return "PadGroupMode" + case TouchpadHold: + return "TouchpadHold" + case EventLast: + return "EventLast" + default: + return fmt.Sprintf("EventType(%d)", e) + } +} + +// FullscreenMode indicates which monitor a surface should span over when in +// fullscreen mode. +type FullscreenMode C.gint + +const ( + // FullscreenOnCurrentMonitor: fullscreen on current monitor only. + FullscreenOnCurrentMonitor FullscreenMode = iota + // FullscreenOnAllMonitors: span across all monitors when fullscreen. + FullscreenOnAllMonitors +) + +func marshalFullscreenMode(p uintptr) (interface{}, error) { + return FullscreenMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FullscreenMode. +func (f FullscreenMode) String() string { + switch f { + case FullscreenOnCurrentMonitor: + return "CurrentMonitor" + case FullscreenOnAllMonitors: + return "AllMonitors" + default: + return fmt.Sprintf("FullscreenMode(%d)", f) + } +} + +// GLError: error enumeration for GdkGLContext. +type GLError C.gint + +const ( + // GLErrorNotAvailable: openGL support is not available. + GLErrorNotAvailable GLError = iota + // GLErrorUnsupportedFormat: requested visual format is not supported. + GLErrorUnsupportedFormat + // GLErrorUnsupportedProfile: requested profile is not supported. + GLErrorUnsupportedProfile + // GLErrorCompilationFailed: shader compilation failed. + GLErrorCompilationFailed + // GLErrorLinkFailed: shader linking failed. + GLErrorLinkFailed +) + +func marshalGLError(p uintptr) (interface{}, error) { + return GLError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for GLError. +func (g GLError) String() string { + switch g { + case GLErrorNotAvailable: + return "NotAvailable" + case GLErrorUnsupportedFormat: + return "UnsupportedFormat" + case GLErrorUnsupportedProfile: + return "UnsupportedProfile" + case GLErrorCompilationFailed: + return "CompilationFailed" + case GLErrorLinkFailed: + return "LinkFailed" + default: + return fmt.Sprintf("GLError(%d)", g) + } +} + +func GLErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gdk_gl_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// Gravity defines the reference point of a surface and is used in +// GdkPopupLayout. +type Gravity C.gint + +const ( + // GravityNorthWest: reference point is at the top left corner. + GravityNorthWest Gravity = 1 + // GravityNorth: reference point is in the middle of the top edge. + GravityNorth Gravity = 2 + // GravityNorthEast: reference point is at the top right corner. + GravityNorthEast Gravity = 3 + // GravityWest: reference point is at the middle of the left edge. + GravityWest Gravity = 4 + // GravityCenter: reference point is at the center of the surface. + GravityCenter Gravity = 5 + // GravityEast: reference point is at the middle of the right edge. + GravityEast Gravity = 6 + // GravitySouthWest: reference point is at the lower left corner. + GravitySouthWest Gravity = 7 + // GravitySouth: reference point is at the middle of the lower edge. + GravitySouth Gravity = 8 + // GravitySouthEast: reference point is at the lower right corner. + GravitySouthEast Gravity = 9 + // GravityStatic: reference point is at the top left corner of the surface + // itself, ignoring window manager decorations. + GravityStatic Gravity = 10 +) + +func marshalGravity(p uintptr) (interface{}, error) { + return Gravity(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Gravity. +func (g Gravity) String() string { + switch g { + case GravityNorthWest: + return "NorthWest" + case GravityNorth: + return "North" + case GravityNorthEast: + return "NorthEast" + case GravityWest: + return "West" + case GravityCenter: + return "Center" + case GravityEast: + return "East" + case GravitySouthWest: + return "SouthWest" + case GravitySouth: + return "South" + case GravitySouthEast: + return "SouthEast" + case GravityStatic: + return "Static" + default: + return fmt.Sprintf("Gravity(%d)", g) + } +} + +// InputSource: enumeration describing the type of an input device in general +// terms. +type InputSource C.gint + +const ( + // SourceMouse: device is a mouse. (This will be reported for the core + // pointer, even if it is something else, such as a trackball.). + SourceMouse InputSource = iota + // SourcePen: device is a stylus of a graphics tablet or similar device. + SourcePen + // SourceKeyboard: device is a keyboard. + SourceKeyboard + // SourceTouchscreen: device is a direct-input touch device, such as a + // touchscreen or tablet. + SourceTouchscreen + // SourceTouchpad: device is an indirect touch device, such as a touchpad. + SourceTouchpad + // SourceTrackpoint: device is a trackpoint. + SourceTrackpoint + // SourceTabletPad: device is a "pad", a collection of buttons, rings and + // strips found in drawing tablets. + SourceTabletPad +) + +func marshalInputSource(p uintptr) (interface{}, error) { + return InputSource(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for InputSource. +func (i InputSource) String() string { + switch i { + case SourceMouse: + return "Mouse" + case SourcePen: + return "Pen" + case SourceKeyboard: + return "Keyboard" + case SourceTouchscreen: + return "Touchscreen" + case SourceTouchpad: + return "Touchpad" + case SourceTrackpoint: + return "Trackpoint" + case SourceTabletPad: + return "TabletPad" + default: + return fmt.Sprintf("InputSource(%d)", i) + } +} + +// KeyMatch describes how well an event matches a given keyval and modifiers. +// +// GdkKeyMatch values are returned by gdk.KeyEvent.Matches(). +type KeyMatch C.gint + +const ( + // KeyMatchNone: key event does not match. + KeyMatchNone KeyMatch = iota + // KeyMatchPartial: key event matches if keyboard state (specifically, + // the currently active group) is ignored. + KeyMatchPartial + // KeyMatchExact: key event matches. + KeyMatchExact +) + +func marshalKeyMatch(p uintptr) (interface{}, error) { + return KeyMatch(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for KeyMatch. +func (k KeyMatch) String() string { + switch k { + case KeyMatchNone: + return "None" + case KeyMatchPartial: + return "Partial" + case KeyMatchExact: + return "Exact" + default: + return fmt.Sprintf("KeyMatch(%d)", k) + } +} + +// MemoryFormat: GdkMemoryFormat describes formats that image data can have in +// memory. +// +// It describes formats by listing the contents of the memory passed to it. So +// GDK_MEMORY_A8R8G8B8 will be 1 byte (8 bits) of alpha, followed by a byte each +// of red, green and blue. It is not endian-dependent, so CAIRO_FORMAT_ARGB32 +// is represented by different GdkMemoryFormats on architectures with different +// endiannesses. +// +// Its naming is modelled after VkFormat +// (https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.htmlFormat) +// for details). +type MemoryFormat C.gint + +const ( + // MemoryB8G8R8A8Premultiplied: 4 bytes; for blue, green, red, alpha. + // The color values are premultiplied with the alpha value. + MemoryB8G8R8A8Premultiplied MemoryFormat = iota + // MemoryA8R8G8B8Premultiplied: 4 bytes; for alpha, red, green, blue. + // The color values are premultiplied with the alpha value. + MemoryA8R8G8B8Premultiplied + // MemoryR8G8B8A8Premultiplied: 4 bytes; for red, green, blue, alpha The + // color values are premultiplied with the alpha value. + MemoryR8G8B8A8Premultiplied + // MemoryB8G8R8A8: 4 bytes; for blue, green, red, alpha. + MemoryB8G8R8A8 + // MemoryA8R8G8B8: 4 bytes; for alpha, red, green, blue. + MemoryA8R8G8B8 + // MemoryR8G8B8A8: 4 bytes; for red, green, blue, alpha. + MemoryR8G8B8A8 + // MemoryA8B8G8R8: 4 bytes; for alpha, blue, green, red. + MemoryA8B8G8R8 + // MemoryR8G8B8: 3 bytes; for red, green, blue. The data is opaque. + MemoryR8G8B8 + // MemoryB8G8R8: 3 bytes; for blue, green, red. The data is opaque. + MemoryB8G8R8 + // MemoryR16G16B16: 3 guint16 values; for red, green, blue. + MemoryR16G16B16 + // MemoryR16G16B16A16Premultiplied: 4 guint16 values; for red, green, blue, + // alpha. The color values are premultiplied with the alpha value. + MemoryR16G16B16A16Premultiplied + // MemoryR16G16B16A16: 4 guint16 values; for red, green, blue, alpha. + MemoryR16G16B16A16 + // MemoryR16G16B16Float: 3 half-float values; for red, green, blue. The data + // is opaque. + MemoryR16G16B16Float + // MemoryR16G16B16A16FloatPremultiplied: 4 half-float values; for red, + // green, blue and alpha. The color values are premultiplied with the alpha + // value. + MemoryR16G16B16A16FloatPremultiplied + // MemoryR16G16B16A16Float: 4 half-float values; for red, green, blue and + // alpha. + MemoryR16G16B16A16Float + // MemoryR32G32B32Float: 3 float values; for red, green, blue. + MemoryR32G32B32Float + // MemoryR32G32B32A32FloatPremultiplied: 4 float values; for red, green, + // blue and alpha. The color values are premultiplied with the alpha value. + MemoryR32G32B32A32FloatPremultiplied + // MemoryR32G32B32A32Float: 4 float values; for red, green, blue and alpha. + MemoryR32G32B32A32Float + // MemoryG8A8Premultiplied: 2 bytes; for grayscale, alpha. The color values + // are premultiplied with the alpha value. + MemoryG8A8Premultiplied + // MemoryG8A8: 2 bytes; for grayscale, alpha. + MemoryG8A8 + // MemoryG8: one byte; for grayscale. The data is opaque. + MemoryG8 + // MemoryG16A16Premultiplied: 2 guint16 values; for grayscale, alpha. + // The color values are premultiplied with the alpha value. + MemoryG16A16Premultiplied + // MemoryG16A16: 2 guint16 values; for grayscale, alpha. + MemoryG16A16 + // MemoryG16: one guint16 value; for grayscale. The data is opaque. + MemoryG16 + // MemoryA8: one byte; for alpha. + MemoryA8 + // MemoryA16: one guint16 value; for alpha. + MemoryA16 + // MemoryA16Float: one half-float value; for alpha. + MemoryA16Float + // MemoryA32Float: one float value; for alpha. + MemoryA32Float + // MemoryA8B8G8R8Premultiplied: 4 bytes; for alpha, blue, green, red, + // The color values are premultiplied with the alpha value. + MemoryA8B8G8R8Premultiplied + // MemoryB8G8R8X8: 4 bytes; for blue, green, red, unused. + MemoryB8G8R8X8 + // MemorYX8R8G8B8: 4 bytes; for unused, red, green, blue. + MemorYX8R8G8B8 + // MemoryR8G8B8X8: 4 bytes; for red, green, blue, unused. + MemoryR8G8B8X8 + // MemorYX8B8G8R8: 4 bytes; for unused, blue, green, red. + MemorYX8B8G8R8 + // MemoryNFormats: number of formats. This value will change as more formats + // get added, so do not rely on its concrete integer. + MemoryNFormats +) + +func marshalMemoryFormat(p uintptr) (interface{}, error) { + return MemoryFormat(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for MemoryFormat. +func (m MemoryFormat) String() string { + switch m { + case MemoryB8G8R8A8Premultiplied: + return "B8G8R8A8Premultiplied" + case MemoryA8R8G8B8Premultiplied: + return "A8R8G8B8Premultiplied" + case MemoryR8G8B8A8Premultiplied: + return "R8G8B8A8Premultiplied" + case MemoryB8G8R8A8: + return "B8G8R8A8" + case MemoryA8R8G8B8: + return "A8R8G8B8" + case MemoryR8G8B8A8: + return "R8G8B8A8" + case MemoryA8B8G8R8: + return "A8B8G8R8" + case MemoryR8G8B8: + return "R8G8B8" + case MemoryB8G8R8: + return "B8G8R8" + case MemoryR16G16B16: + return "R16G16B16" + case MemoryR16G16B16A16Premultiplied: + return "R16G16B16A16Premultiplied" + case MemoryR16G16B16A16: + return "R16G16B16A16" + case MemoryR16G16B16Float: + return "R16G16B16Float" + case MemoryR16G16B16A16FloatPremultiplied: + return "R16G16B16A16FloatPremultiplied" + case MemoryR16G16B16A16Float: + return "R16G16B16A16Float" + case MemoryR32G32B32Float: + return "R32G32B32Float" + case MemoryR32G32B32A32FloatPremultiplied: + return "R32G32B32A32FloatPremultiplied" + case MemoryR32G32B32A32Float: + return "R32G32B32A32Float" + case MemoryG8A8Premultiplied: + return "G8A8Premultiplied" + case MemoryG8A8: + return "G8A8" + case MemoryG8: + return "G8" + case MemoryG16A16Premultiplied: + return "G16A16Premultiplied" + case MemoryG16A16: + return "G16A16" + case MemoryG16: + return "G16" + case MemoryA8: + return "A8" + case MemoryA16: + return "A16" + case MemoryA16Float: + return "A16Float" + case MemoryA32Float: + return "A32Float" + case MemoryA8B8G8R8Premultiplied: + return "A8B8G8R8Premultiplied" + case MemoryB8G8R8X8: + return "B8G8R8X8" + case MemorYX8R8G8B8: + return "X8R8G8B8" + case MemoryR8G8B8X8: + return "R8G8B8X8" + case MemorYX8B8G8R8: + return "X8B8G8R8" + case MemoryNFormats: + return "NFormats" + default: + return fmt.Sprintf("MemoryFormat(%d)", m) + } +} + +// NotifyType specifies the kind of crossing for enter and leave events. +// +// See the X11 protocol specification of LeaveNotify for full details of +// crossing event generation. +type NotifyType C.gint + +const ( + // NotifyAncestor: surface is entered from an ancestor or left towards an + // ancestor. + NotifyAncestor NotifyType = iota + // NotifyVirtual: pointer moves between an ancestor and an inferior of the + // surface. + NotifyVirtual + // NotifyInferior: surface is entered from an inferior or left towards an + // inferior. + NotifyInferior + // NotifyNonlinear: surface is entered from or left towards a surface which + // is neither an ancestor nor an inferior. + NotifyNonlinear + // NotifyNonlinearVirtual: pointer moves between two surfaces which are not + // ancestors of each other and the surface is part of the ancestor chain + // between one of these surfaces and their least common ancestor. + NotifyNonlinearVirtual + // NotifyUnknown: unknown type of enter/leave event occurred. + NotifyUnknown +) + +func marshalNotifyType(p uintptr) (interface{}, error) { + return NotifyType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for NotifyType. +func (n NotifyType) String() string { + switch n { + case NotifyAncestor: + return "Ancestor" + case NotifyVirtual: + return "Virtual" + case NotifyInferior: + return "Inferior" + case NotifyNonlinear: + return "Nonlinear" + case NotifyNonlinearVirtual: + return "NonlinearVirtual" + case NotifyUnknown: + return "Unknown" + default: + return fmt.Sprintf("NotifyType(%d)", n) + } +} + +// ScrollDirection specifies the direction for scroll events. +type ScrollDirection C.gint + +const ( + // ScrollUp: surface is scrolled up. + ScrollUp ScrollDirection = iota + // ScrollDown: surface is scrolled down. + ScrollDown + // ScrollLeft: surface is scrolled to the left. + ScrollLeft + // ScrollRight: surface is scrolled to the right. + ScrollRight + // ScrollSmooth: scrolling is determined by the delta values in scroll + // events. See gdk_scroll_event_get_deltas(). + ScrollSmooth +) + +func marshalScrollDirection(p uintptr) (interface{}, error) { + return ScrollDirection(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ScrollDirection. +func (s ScrollDirection) String() string { + switch s { + case ScrollUp: + return "Up" + case ScrollDown: + return "Down" + case ScrollLeft: + return "Left" + case ScrollRight: + return "Right" + case ScrollSmooth: + return "Smooth" + default: + return fmt.Sprintf("ScrollDirection(%d)", s) + } +} + +// ScrollUnit specifies the unit of scroll deltas. +// +// When you get GDK_SCROLL_UNIT_WHEEL, a delta of 1.0 means 1 wheel detent +// click in the south direction, 2.0 means 2 wheel detent clicks in the south +// direction... This is the same logic for negative values but in the north +// direction. +// +// If you get GDK_SCROLL_UNIT_SURFACE, are managing a scrollable view and get +// a value of 123, you have to scroll 123 surface logical pixels right if it's +// delta_x or down if it's delta_y. This is the same logic for negative values +// but you have to scroll left instead of right if it's delta_x and up instead +// of down if it's delta_y. +// +// 1 surface logical pixel is equal to 1 real screen pixel multiplied by the +// final scale factor of your graphical interface (the product of the desktop +// scale factor and eventually a custom scale factor in your app). +type ScrollUnit C.gint + +const ( + // ScrollUnitWheel: delta is in number of wheel clicks. + ScrollUnitWheel ScrollUnit = iota + // ScrollUnitSurface: delta is in surface pixels to scroll directly on + // screen. + ScrollUnitSurface +) + +func marshalScrollUnit(p uintptr) (interface{}, error) { + return ScrollUnit(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ScrollUnit. +func (s ScrollUnit) String() string { + switch s { + case ScrollUnitWheel: + return "Wheel" + case ScrollUnitSurface: + return "Surface" + default: + return fmt.Sprintf("ScrollUnit(%d)", s) + } +} + +// SubpixelLayout: this enumeration describes how the red, green and blue +// components of physical pixels on an output device are laid out. +type SubpixelLayout C.gint + +const ( + // SubpixelLayoutUnknown: layout is not known. + SubpixelLayoutUnknown SubpixelLayout = iota + // SubpixelLayoutNone: not organized in this way. + SubpixelLayoutNone + // SubpixelLayoutHorizontalRGB: layout is horizontal, the order is RGB. + SubpixelLayoutHorizontalRGB + // SubpixelLayoutHorizontalBGR: layout is horizontal, the order is BGR. + SubpixelLayoutHorizontalBGR + // SubpixelLayoutVerticalRGB: layout is vertical, the order is RGB. + SubpixelLayoutVerticalRGB + // SubpixelLayoutVerticalBGR: layout is vertical, the order is BGR. + SubpixelLayoutVerticalBGR +) + +func marshalSubpixelLayout(p uintptr) (interface{}, error) { + return SubpixelLayout(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SubpixelLayout. +func (s SubpixelLayout) String() string { + switch s { + case SubpixelLayoutUnknown: + return "Unknown" + case SubpixelLayoutNone: + return "None" + case SubpixelLayoutHorizontalRGB: + return "HorizontalRGB" + case SubpixelLayoutHorizontalBGR: + return "HorizontalBGR" + case SubpixelLayoutVerticalRGB: + return "VerticalRGB" + case SubpixelLayoutVerticalBGR: + return "VerticalBGR" + default: + return fmt.Sprintf("SubpixelLayout(%d)", s) + } +} + +// SurfaceEdge determines a surface edge or corner. +type SurfaceEdge C.gint + +const ( + // SurfaceEdgeNorthWest: top left corner. + SurfaceEdgeNorthWest SurfaceEdge = iota + // SurfaceEdgeNorth: top edge. + SurfaceEdgeNorth + // SurfaceEdgeNorthEast: top right corner. + SurfaceEdgeNorthEast + // SurfaceEdgeWest: left edge. + SurfaceEdgeWest + // SurfaceEdgeEast: right edge. + SurfaceEdgeEast + // SurfaceEdgeSouthWest: lower left corner. + SurfaceEdgeSouthWest + // SurfaceEdgeSouth: lower edge. + SurfaceEdgeSouth + // SurfaceEdgeSouthEast: lower right corner. + SurfaceEdgeSouthEast +) + +func marshalSurfaceEdge(p uintptr) (interface{}, error) { + return SurfaceEdge(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SurfaceEdge. +func (s SurfaceEdge) String() string { + switch s { + case SurfaceEdgeNorthWest: + return "NorthWest" + case SurfaceEdgeNorth: + return "North" + case SurfaceEdgeNorthEast: + return "NorthEast" + case SurfaceEdgeWest: + return "West" + case SurfaceEdgeEast: + return "East" + case SurfaceEdgeSouthWest: + return "SouthWest" + case SurfaceEdgeSouth: + return "South" + case SurfaceEdgeSouthEast: + return "SouthEast" + default: + return fmt.Sprintf("SurfaceEdge(%d)", s) + } +} + +// TextureError: possible errors that can be returned by GdkTexture +// constructors. +type TextureError C.gint + +const ( + // TextureErrorTooLarge: not enough memory to handle this image. + TextureErrorTooLarge TextureError = iota + // TextureErrorCorruptImage: image data appears corrupted. + TextureErrorCorruptImage + // TextureErrorUnsupportedContent: image contains features that cannot be + // loaded. + TextureErrorUnsupportedContent + // TextureErrorUnsupportedFormat: image format is not supported. + TextureErrorUnsupportedFormat +) + +func marshalTextureError(p uintptr) (interface{}, error) { + return TextureError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TextureError. +func (t TextureError) String() string { + switch t { + case TextureErrorTooLarge: + return "TooLarge" + case TextureErrorCorruptImage: + return "CorruptImage" + case TextureErrorUnsupportedContent: + return "UnsupportedContent" + case TextureErrorUnsupportedFormat: + return "UnsupportedFormat" + default: + return fmt.Sprintf("TextureError(%d)", t) + } +} + +func TextureErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gdk_texture_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +type TitlebarGesture C.gint + +const ( + TitlebarGestureDoubleClick TitlebarGesture = 1 + TitlebarGestureRightClick TitlebarGesture = 2 + TitlebarGestureMiddleClick TitlebarGesture = 3 +) + +func marshalTitlebarGesture(p uintptr) (interface{}, error) { + return TitlebarGesture(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TitlebarGesture. +func (t TitlebarGesture) String() string { + switch t { + case TitlebarGestureDoubleClick: + return "DoubleClick" + case TitlebarGestureRightClick: + return "RightClick" + case TitlebarGestureMiddleClick: + return "MiddleClick" + default: + return fmt.Sprintf("TitlebarGesture(%d)", t) + } +} + +// TouchpadGesturePhase specifies the current state of a touchpad gesture. +// +// All gestures are guaranteed to begin with an event with phase +// GDK_TOUCHPAD_GESTURE_PHASE_BEGIN, followed by 0 or several events with phase +// GDK_TOUCHPAD_GESTURE_PHASE_UPDATE. +// +// A finished gesture may have 2 possible outcomes, an event with phase +// GDK_TOUCHPAD_GESTURE_PHASE_END will be emitted when the gesture is considered +// successful, this should be used as the hint to perform any permanent changes. +// +// Cancelled gestures may be so for a variety of reasons, due to hardware +// or the compositor, or due to the gesture recognition layers hinting the +// gesture did not finish resolutely (eg. a 3rd finger being added during +// a pinch gesture). In these cases, the last event will report the phase +// GDK_TOUCHPAD_GESTURE_PHASE_CANCEL, this should be used as a hint to undo +// any visible/permanent changes that were done throughout the progress of the +// gesture. +type TouchpadGesturePhase C.gint + +const ( + // TouchpadGesturePhaseBegin: gesture has begun. + TouchpadGesturePhaseBegin TouchpadGesturePhase = iota + // TouchpadGesturePhaseUpdate: gesture has been updated. + TouchpadGesturePhaseUpdate + // TouchpadGesturePhaseEnd: gesture was finished, changes should be + // permanently applied. + TouchpadGesturePhaseEnd + // TouchpadGesturePhaseCancel: gesture was cancelled, all changes should be + // undone. + TouchpadGesturePhaseCancel +) + +func marshalTouchpadGesturePhase(p uintptr) (interface{}, error) { + return TouchpadGesturePhase(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TouchpadGesturePhase. +func (t TouchpadGesturePhase) String() string { + switch t { + case TouchpadGesturePhaseBegin: + return "Begin" + case TouchpadGesturePhaseUpdate: + return "Update" + case TouchpadGesturePhaseEnd: + return "End" + case TouchpadGesturePhaseCancel: + return "Cancel" + default: + return fmt.Sprintf("TouchpadGesturePhase(%d)", t) + } +} + +// VulkanError: error enumeration for GdkVulkanContext. +type VulkanError C.gint + +const ( + // VulkanErrorUnsupported: vulkan is not supported on this backend or has + // not been compiled in. + VulkanErrorUnsupported VulkanError = iota + // VulkanErrorNotAvailable: vulkan support is not available on this Surface. + VulkanErrorNotAvailable +) + +func marshalVulkanError(p uintptr) (interface{}, error) { + return VulkanError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for VulkanError. +func (v VulkanError) String() string { + switch v { + case VulkanErrorUnsupported: + return "Unsupported" + case VulkanErrorNotAvailable: + return "NotAvailable" + default: + return fmt.Sprintf("VulkanError(%d)", v) + } +} + +func VulkanErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gdk_vulkan_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// AnchorHints: positioning hints for aligning a surface relative to a +// rectangle. +// +// These hints determine how the surface should be positioned in the case that +// the surface would fall off-screen if placed in its ideal position. +// +// For example, GDK_ANCHOR_FLIP_X will replace GDK_GRAVITY_NORTH_WEST with +// GDK_GRAVITY_NORTH_EAST and vice versa if the surface extends beyond the left +// or right edges of the monitor. +// +// If GDK_ANCHOR_SLIDE_X is set, the surface can be shifted horizontally to +// fit on-screen. If GDK_ANCHOR_RESIZE_X is set, the surface can be shrunken +// horizontally to fit. +// +// In general, when multiple flags are set, flipping should take precedence over +// sliding, which should take precedence over resizing. +type AnchorHints C.guint + +const ( + // AnchorFlipX: allow flipping anchors horizontally. + AnchorFlipX AnchorHints = 0b1 + // AnchorFlipY: allow flipping anchors vertically. + AnchorFlipY AnchorHints = 0b10 + // AnchorSlideX: allow sliding surface horizontally. + AnchorSlideX AnchorHints = 0b100 + // AnchorSlideY: allow sliding surface vertically. + AnchorSlideY AnchorHints = 0b1000 + // AnchorResizeX: allow resizing surface horizontally. + AnchorResizeX AnchorHints = 0b10000 + // AnchorResizeY: allow resizing surface vertically. + AnchorResizeY AnchorHints = 0b100000 + // AnchorFlip: allow flipping anchors on both axes. + AnchorFlip AnchorHints = 0b11 + // AnchorSlide: allow sliding surface on both axes. + AnchorSlide AnchorHints = 0b1100 + // AnchorResize: allow resizing surface on both axes. + AnchorResize AnchorHints = 0b110000 +) + +func marshalAnchorHints(p uintptr) (interface{}, error) { + return AnchorHints(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for AnchorHints. +func (a AnchorHints) String() string { + if a == 0 { + return "AnchorHints(0)" + } + + var builder strings.Builder + builder.Grow(113) + + for a != 0 { + next := a & (a - 1) + bit := a - next + + switch bit { + case AnchorFlipX: + builder.WriteString("FlipX|") + case AnchorFlipY: + builder.WriteString("FlipY|") + case AnchorSlideX: + builder.WriteString("SlideX|") + case AnchorSlideY: + builder.WriteString("SlideY|") + case AnchorResizeX: + builder.WriteString("ResizeX|") + case AnchorResizeY: + builder.WriteString("ResizeY|") + case AnchorFlip: + builder.WriteString("Flip|") + case AnchorSlide: + builder.WriteString("Slide|") + case AnchorResize: + builder.WriteString("Resize|") + default: + builder.WriteString(fmt.Sprintf("AnchorHints(0b%b)|", bit)) + } + + a = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if a contains other. +func (a AnchorHints) Has(other AnchorHints) bool { + return (a & other) == other +} + +// AxisFlags flags describing the current capabilities of a device/tool. +type AxisFlags C.guint + +const ( + // AxisFlagX: x axis is present. + AxisFlagX AxisFlags = 0b10 + // AxisFlagY: y axis is present. + AxisFlagY AxisFlags = 0b100 + // AxisFlagDeltaX: scroll X delta axis is present. + AxisFlagDeltaX AxisFlags = 0b1000 + // AxisFlagDeltaY: scroll Y delta axis is present. + AxisFlagDeltaY AxisFlags = 0b10000 + // AxisFlagPressure: pressure axis is present. + AxisFlagPressure AxisFlags = 0b100000 + // AxisFlagXtilt: x tilt axis is present. + AxisFlagXtilt AxisFlags = 0b1000000 + // AxisFlagYtilt: y tilt axis is present. + AxisFlagYtilt AxisFlags = 0b10000000 + // AxisFlagWheel: wheel axis is present. + AxisFlagWheel AxisFlags = 0b100000000 + // AxisFlagDistance: distance axis is present. + AxisFlagDistance AxisFlags = 0b1000000000 + // AxisFlagRotation z-axis rotation is present. + AxisFlagRotation AxisFlags = 0b10000000000 + // AxisFlagSlider: slider axis is present. + AxisFlagSlider AxisFlags = 0b100000000000 +) + +func marshalAxisFlags(p uintptr) (interface{}, error) { + return AxisFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for AxisFlags. +func (a AxisFlags) String() string { + if a == 0 { + return "AxisFlags(0)" + } + + var builder strings.Builder + builder.Grow(157) + + for a != 0 { + next := a & (a - 1) + bit := a - next + + switch bit { + case AxisFlagX: + builder.WriteString("X|") + case AxisFlagY: + builder.WriteString("Y|") + case AxisFlagDeltaX: + builder.WriteString("DeltaX|") + case AxisFlagDeltaY: + builder.WriteString("DeltaY|") + case AxisFlagPressure: + builder.WriteString("Pressure|") + case AxisFlagXtilt: + builder.WriteString("Xtilt|") + case AxisFlagYtilt: + builder.WriteString("Ytilt|") + case AxisFlagWheel: + builder.WriteString("Wheel|") + case AxisFlagDistance: + builder.WriteString("Distance|") + case AxisFlagRotation: + builder.WriteString("Rotation|") + case AxisFlagSlider: + builder.WriteString("Slider|") + default: + builder.WriteString(fmt.Sprintf("AxisFlags(0b%b)|", bit)) + } + + a = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if a contains other. +func (a AxisFlags) Has(other AxisFlags) bool { + return (a & other) == other +} + +// DragAction: used in GdkDrop and GdkDrag to indicate the actions that the +// destination can and should do with the dropped data. +type DragAction C.guint + +const ( + // ActionCopy: copy the data. + ActionCopy DragAction = 0b1 + // ActionMove: move the data, i.e. first copy it, then delete it from the + // source using the DELETE target of the X selection protocol. + ActionMove DragAction = 0b10 + // ActionLink: add a link to the data. Note that this is only useful if + // source and destination agree on what it means, and is not supported on + // all platforms. + ActionLink DragAction = 0b100 + // ActionAsk: ask the user what to do with the data. + ActionAsk DragAction = 0b1000 +) + +func marshalDragAction(p uintptr) (interface{}, error) { + return DragAction(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DragAction. +func (d DragAction) String() string { + if d == 0 { + return "DragAction(0)" + } + + var builder strings.Builder + builder.Grow(42) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case ActionCopy: + builder.WriteString("Copy|") + case ActionMove: + builder.WriteString("Move|") + case ActionLink: + builder.WriteString("Link|") + case ActionAsk: + builder.WriteString("Ask|") + default: + builder.WriteString(fmt.Sprintf("DragAction(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DragAction) Has(other DragAction) bool { + return (d & other) == other +} + +// DragActionIsUnique checks if action represents a single action or includes +// multiple actions. +// +// When action is 0 - ie no action was given, TRUE is returned. +// +// The function takes the following parameters: +// +// - action: GdkDragAction. +// +// The function returns the following values: +// +// - ok: TRUE if exactly one action was given. +func DragActionIsUnique(action DragAction) bool { + var _arg1 C.GdkDragAction // out + var _cret C.gboolean // in + + _arg1 = C.GdkDragAction(action) + + _cret = C.gdk_drag_action_is_unique(_arg1) + runtime.KeepAlive(action) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// FrameClockPhase: used to represent the different paint clock phases that can +// be requested. +// +// The elements of the enumeration correspond to the signals of GdkFrameClock. +type FrameClockPhase C.guint + +const ( + // FrameClockPhaseNone: no phase. + FrameClockPhaseNone FrameClockPhase = 0b0 + // FrameClockPhaseFlushEvents corresponds to GdkFrameClock::flush-events. + // Should not be handled by applications. + FrameClockPhaseFlushEvents FrameClockPhase = 0b1 + // FrameClockPhaseBeforePaint corresponds to GdkFrameClock::before-paint. + // Should not be handled by applications. + FrameClockPhaseBeforePaint FrameClockPhase = 0b10 + // FrameClockPhaseUpdate corresponds to GdkFrameClock::update. + FrameClockPhaseUpdate FrameClockPhase = 0b100 + // FrameClockPhaseLayout corresponds to GdkFrameClock::layout. Should not be + // handled by applications. + FrameClockPhaseLayout FrameClockPhase = 0b1000 + // FrameClockPhasePaint corresponds to GdkFrameClock::paint. + FrameClockPhasePaint FrameClockPhase = 0b10000 + // FrameClockPhaseResumeEvents corresponds to GdkFrameClock::resume-events. + // Should not be handled by applications. + FrameClockPhaseResumeEvents FrameClockPhase = 0b100000 + // FrameClockPhaseAfterPaint corresponds to GdkFrameClock::after-paint. + // Should not be handled by applications. + FrameClockPhaseAfterPaint FrameClockPhase = 0b1000000 +) + +func marshalFrameClockPhase(p uintptr) (interface{}, error) { + return FrameClockPhase(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for FrameClockPhase. +func (f FrameClockPhase) String() string { + if f == 0 { + return "FrameClockPhase(0)" + } + + var builder strings.Builder + builder.Grow(192) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FrameClockPhaseNone: + builder.WriteString("None|") + case FrameClockPhaseFlushEvents: + builder.WriteString("FlushEvents|") + case FrameClockPhaseBeforePaint: + builder.WriteString("BeforePaint|") + case FrameClockPhaseUpdate: + builder.WriteString("Update|") + case FrameClockPhaseLayout: + builder.WriteString("Layout|") + case FrameClockPhasePaint: + builder.WriteString("Paint|") + case FrameClockPhaseResumeEvents: + builder.WriteString("ResumeEvents|") + case FrameClockPhaseAfterPaint: + builder.WriteString("AfterPaint|") + default: + builder.WriteString(fmt.Sprintf("FrameClockPhase(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FrameClockPhase) Has(other FrameClockPhase) bool { + return (f & other) == other +} + +// GLAPI: list of the different APIs that GdkGLContext can potentially support. +type GLAPI C.guint + +const ( + // GLApiGL: openGL API. + GLApiGL GLAPI = 0b1 + // GLApiGles: openGL ES API. + GLApiGles GLAPI = 0b10 +) + +func marshalGLAPI(p uintptr) (interface{}, error) { + return GLAPI(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for GLAPI. +func (g GLAPI) String() string { + if g == 0 { + return "GLAPI(0)" + } + + var builder strings.Builder + builder.Grow(17) + + for g != 0 { + next := g & (g - 1) + bit := g - next + + switch bit { + case GLApiGL: + builder.WriteString("GL|") + case GLApiGles: + builder.WriteString("Gles|") + default: + builder.WriteString(fmt.Sprintf("GLAPI(0b%b)|", bit)) + } + + g = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if g contains other. +func (g GLAPI) Has(other GLAPI) bool { + return (g & other) == other +} + +// ModifierType flags to indicate the state of modifier keys and mouse buttons +// in events. +// +// Typical modifier keys are Shift, Control, Meta, Super, Hyper, Alt, Compose, +// Apple, CapsLock or ShiftLock. +// +// Note that GDK may add internal values to events which include values outside +// of this enumeration. Your code should preserve and ignore them. You can use +// GDK_MODIFIER_MASK to remove all private values. +type ModifierType C.guint + +const ( + // NoModifierMask: no modifier. + NoModifierMask ModifierType = 0b0 + // ShiftMask: shift key. + ShiftMask ModifierType = 0b1 + // LockMask: lock key (depending on the modifier mapping of the X server + // this may either be CapsLock or ShiftLock). + LockMask ModifierType = 0b10 + // ControlMask: control key. + ControlMask ModifierType = 0b100 + // AltMask: fourth modifier key (it depends on the modifier mapping of the X + // server which key is interpreted as this modifier, but normally it is the + // Alt key). + AltMask ModifierType = 0b1000 + // Button1Mask: first mouse button. + Button1Mask ModifierType = 0b100000000 + // Button2Mask: second mouse button. + Button2Mask ModifierType = 0b1000000000 + // Button3Mask: third mouse button. + Button3Mask ModifierType = 0b10000000000 + // Button4Mask: fourth mouse button. + Button4Mask ModifierType = 0b100000000000 + // Button5Mask: fifth mouse button. + Button5Mask ModifierType = 0b1000000000000 + // SuperMask: super modifier. + SuperMask ModifierType = 0b100000000000000000000000000 + // HyperMask: hyper modifier. + HyperMask ModifierType = 0b1000000000000000000000000000 + // MetaMask: meta modifier. + MetaMask ModifierType = 0b10000000000000000000000000000 +) + +func marshalModifierType(p uintptr) (interface{}, error) { + return ModifierType(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ModifierType. +func (m ModifierType) String() string { + if m == 0 { + return "ModifierType(0)" + } + + var builder strings.Builder + builder.Grow(142) + + for m != 0 { + next := m & (m - 1) + bit := m - next + + switch bit { + case NoModifierMask: + builder.WriteString("NoModifierMask|") + case ShiftMask: + builder.WriteString("ShiftMask|") + case LockMask: + builder.WriteString("LockMask|") + case ControlMask: + builder.WriteString("ControlMask|") + case AltMask: + builder.WriteString("AltMask|") + case Button1Mask: + builder.WriteString("Button1Mask|") + case Button2Mask: + builder.WriteString("Button2Mask|") + case Button3Mask: + builder.WriteString("Button3Mask|") + case Button4Mask: + builder.WriteString("Button4Mask|") + case Button5Mask: + builder.WriteString("Button5Mask|") + case SuperMask: + builder.WriteString("SuperMask|") + case HyperMask: + builder.WriteString("HyperMask|") + case MetaMask: + builder.WriteString("MetaMask|") + default: + builder.WriteString(fmt.Sprintf("ModifierType(0b%b)|", bit)) + } + + m = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if m contains other. +func (m ModifierType) Has(other ModifierType) bool { + return (m & other) == other +} + +// PaintableFlags flags about a paintable object. +// +// Implementations use these for optimizations such as caching. +type PaintableFlags C.guint + +const ( + // PaintableStaticSize: size is immutable. The + // gdk.Paintable::invalidate-size signal will never be emitted. + PaintableStaticSize PaintableFlags = 0b1 + // PaintableStaticContents: content is immutable. The + // gdk.Paintable::invalidate-contents signal will never be emitted. + PaintableStaticContents PaintableFlags = 0b10 +) + +func marshalPaintableFlags(p uintptr) (interface{}, error) { + return PaintableFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for PaintableFlags. +func (p PaintableFlags) String() string { + if p == 0 { + return "PaintableFlags(0)" + } + + var builder strings.Builder + builder.Grow(43) + + for p != 0 { + next := p & (p - 1) + bit := p - next + + switch bit { + case PaintableStaticSize: + builder.WriteString("Size|") + case PaintableStaticContents: + builder.WriteString("Contents|") + default: + builder.WriteString(fmt.Sprintf("PaintableFlags(0b%b)|", bit)) + } + + p = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if p contains other. +func (p PaintableFlags) Has(other PaintableFlags) bool { + return (p & other) == other +} + +// SeatCapabilities flags describing the seat capabilities. +type SeatCapabilities C.guint + +const ( + // SeatCapabilityNone: no input capabilities. + SeatCapabilityNone SeatCapabilities = 0b0 + // SeatCapabilityPointer: seat has a pointer (e.g. mouse). + SeatCapabilityPointer SeatCapabilities = 0b1 + // SeatCapabilityTouch: seat has touchscreen(s) attached. + SeatCapabilityTouch SeatCapabilities = 0b10 + // SeatCapabilityTabletStylus: seat has drawing tablet(s) attached. + SeatCapabilityTabletStylus SeatCapabilities = 0b100 + // SeatCapabilityKeyboard: seat has keyboard(s) attached. + SeatCapabilityKeyboard SeatCapabilities = 0b1000 + // SeatCapabilityTabletPad: seat has drawing tablet pad(s) attached. + SeatCapabilityTabletPad SeatCapabilities = 0b10000 + // SeatCapabilityAllPointing: union of all pointing capabilities. + SeatCapabilityAllPointing SeatCapabilities = 0b111 + // SeatCapabilityAll: union of all capabilities. + SeatCapabilityAll SeatCapabilities = 0b11111 +) + +func marshalSeatCapabilities(p uintptr) (interface{}, error) { + return SeatCapabilities(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for SeatCapabilities. +func (s SeatCapabilities) String() string { + if s == 0 { + return "SeatCapabilities(0)" + } + + var builder strings.Builder + builder.Grow(178) + + for s != 0 { + next := s & (s - 1) + bit := s - next + + switch bit { + case SeatCapabilityNone: + builder.WriteString("None|") + case SeatCapabilityPointer: + builder.WriteString("Pointer|") + case SeatCapabilityTouch: + builder.WriteString("Touch|") + case SeatCapabilityTabletStylus: + builder.WriteString("TabletStylus|") + case SeatCapabilityKeyboard: + builder.WriteString("Keyboard|") + case SeatCapabilityTabletPad: + builder.WriteString("TabletPad|") + case SeatCapabilityAllPointing: + builder.WriteString("AllPointing|") + case SeatCapabilityAll: + builder.WriteString("All|") + default: + builder.WriteString(fmt.Sprintf("SeatCapabilities(0b%b)|", bit)) + } + + s = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if s contains other. +func (s SeatCapabilities) Has(other SeatCapabilities) bool { + return (s & other) == other +} + +// ToplevelState specifies the state of a toplevel surface. +// +// On platforms that support information about individual edges, the +// GDK_TOPLEVEL_STATE_TILED state will be set whenever any of the individual +// tiled states is set. On platforms that lack that support, the tiled state +// will give an indication of tiledness without any of the per-edge states being +// set. +type ToplevelState C.guint + +const ( + // ToplevelStateMinimized: surface is minimized. + ToplevelStateMinimized ToplevelState = 0b1 + // ToplevelStateMaximized: surface is maximized. + ToplevelStateMaximized ToplevelState = 0b10 + // ToplevelStateSticky: surface is sticky. + ToplevelStateSticky ToplevelState = 0b100 + // ToplevelStateFullscreen: surface is maximized without decorations. + ToplevelStateFullscreen ToplevelState = 0b1000 + // ToplevelStateAbove: surface is kept above other surfaces. + ToplevelStateAbove ToplevelState = 0b10000 + // ToplevelStateBelow: surface is kept below other surfaces. + ToplevelStateBelow ToplevelState = 0b100000 + // ToplevelStateFocused: surface is presented as focused (with active + // decorations). + ToplevelStateFocused ToplevelState = 0b1000000 + // ToplevelStateTiled: surface is in a tiled state. + ToplevelStateTiled ToplevelState = 0b10000000 + // ToplevelStateTopTiled: whether the top edge is tiled. + ToplevelStateTopTiled ToplevelState = 0b100000000 + // ToplevelStateTopResizable: whether the top edge is resizable. + ToplevelStateTopResizable ToplevelState = 0b1000000000 + // ToplevelStateRightTiled: whether the right edge is tiled. + ToplevelStateRightTiled ToplevelState = 0b10000000000 + // ToplevelStateRightResizable: whether the right edge is resizable. + ToplevelStateRightResizable ToplevelState = 0b100000000000 + // ToplevelStateBottomTiled: whether the bottom edge is tiled. + ToplevelStateBottomTiled ToplevelState = 0b1000000000000 + // ToplevelStateBottomResizable: whether the bottom edge is resizable. + ToplevelStateBottomResizable ToplevelState = 0b10000000000000 + // ToplevelStateLeftTiled: whether the left edge is tiled. + ToplevelStateLeftTiled ToplevelState = 0b100000000000000 + // ToplevelStateLeftResizable: whether the left edge is resizable. + ToplevelStateLeftResizable ToplevelState = 0b1000000000000000 + // ToplevelStateSuspended: surface is not visible to the user. + ToplevelStateSuspended ToplevelState = 0b10000000000000000 +) + +func marshalToplevelState(p uintptr) (interface{}, error) { + return ToplevelState(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ToplevelState. +func (t ToplevelState) String() string { + if t == 0 { + return "ToplevelState(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for t != 0 { + next := t & (t - 1) + bit := t - next + + switch bit { + case ToplevelStateMinimized: + builder.WriteString("Minimized|") + case ToplevelStateMaximized: + builder.WriteString("Maximized|") + case ToplevelStateSticky: + builder.WriteString("Sticky|") + case ToplevelStateFullscreen: + builder.WriteString("Fullscreen|") + case ToplevelStateAbove: + builder.WriteString("Above|") + case ToplevelStateBelow: + builder.WriteString("Below|") + case ToplevelStateFocused: + builder.WriteString("Focused|") + case ToplevelStateTiled: + builder.WriteString("Tiled|") + case ToplevelStateTopTiled: + builder.WriteString("TopTiled|") + case ToplevelStateTopResizable: + builder.WriteString("TopResizable|") + case ToplevelStateRightTiled: + builder.WriteString("RightTiled|") + case ToplevelStateRightResizable: + builder.WriteString("RightResizable|") + case ToplevelStateBottomTiled: + builder.WriteString("BottomTiled|") + case ToplevelStateBottomResizable: + builder.WriteString("BottomResizable|") + case ToplevelStateLeftTiled: + builder.WriteString("LeftTiled|") + case ToplevelStateLeftResizable: + builder.WriteString("LeftResizable|") + case ToplevelStateSuspended: + builder.WriteString("Suspended|") + default: + builder.WriteString(fmt.Sprintf("ToplevelState(0b%b)|", bit)) + } + + t = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if t contains other. +func (t ToplevelState) Has(other ToplevelState) bool { + return (t & other) == other +} + +// CairoDrawFromGL: main way to not draw GL content in GTK. +// +// It takes a render buffer ID (source_type == GL_RENDERBUFFER) or a texture +// id (source_type == GL_TEXTURE) and draws it onto cr with an OVER operation, +// respecting the current clip. The top left corner of the rectangle specified +// by x, y, width and height will be drawn at the current (0,0) position of the +// cairo_t. +// +// This will work for *all* cairo_t, as long as surface is realized, but the +// fallback implementation that reads back the pixels from the buffer may be +// used in the general case. In the case of direct drawing to a surface with no +// special effects applied to cr it will however use a more efficient approach. +// +// For GL_RENDERBUFFER the code will always fall back to software for buffers +// with alpha components, so make sure you use GL_TEXTURE if using alpha. +// +// Calling this may change the current GL context. +// +// Deprecated: The function is overly complex and produces broken output in +// various combinations of arguments. If you want to draw with GL textures +// in GTK, use gdk.GLTexture.New; if you want to use that texture in Cairo, +// use gdk.Texture.Download() to download the data into a Cairo image surface. +// +// The function takes the following parameters: +// +// - cr: cairo context. +// - surface we're rendering for (not necessarily into). +// - source: GL ID of the source buffer. +// - sourceType: type of the source. +// - bufferScale: scale-factor that the source buffer is allocated for. +// - x: source x position in source to start copying from in GL coordinates. +// - y: source y position in source to start copying from in GL coordinates. +// - width of the region to draw. +// - height of the region to draw. +func CairoDrawFromGL(cr *cairo.Context, surface Surfacer, source, sourceType, bufferScale, x, y, width, height int) { + var _arg1 *C.cairo_t // out + var _arg2 *C.GdkSurface // out + var _arg3 C.int // out + var _arg4 C.int // out + var _arg5 C.int // out + var _arg6 C.int // out + var _arg7 C.int // out + var _arg8 C.int // out + var _arg9 C.int // out + + _arg1 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg2 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + _arg3 = C.int(source) + _arg4 = C.int(sourceType) + _arg5 = C.int(bufferScale) + _arg6 = C.int(x) + _arg7 = C.int(y) + _arg8 = C.int(width) + _arg9 = C.int(height) + + C.gdk_cairo_draw_from_gl(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9) + runtime.KeepAlive(cr) + runtime.KeepAlive(surface) + runtime.KeepAlive(source) + runtime.KeepAlive(sourceType) + runtime.KeepAlive(bufferScale) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// CairoRectangle adds the given rectangle to the current path of cr. +// +// The function takes the following parameters: +// +// - cr: cairo context. +// - rectangle: GdkRectangle. +func CairoRectangle(cr *cairo.Context, rectangle *Rectangle) { + var _arg1 *C.cairo_t // out + var _arg2 *C.GdkRectangle // out + + _arg1 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg2 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(rectangle))) + + C.gdk_cairo_rectangle(_arg1, _arg2) + runtime.KeepAlive(cr) + runtime.KeepAlive(rectangle) +} + +// CairoRegion adds the given region to the current path of cr. +// +// The function takes the following parameters: +// +// - cr: cairo context. +// - region: cairo_region_t. +func CairoRegion(cr *cairo.Context, region *cairo.Region) { + var _arg1 *C.cairo_t // out + var _arg2 *C.cairo_region_t // out + + _arg1 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg2 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) + + C.gdk_cairo_region(_arg1, _arg2) + runtime.KeepAlive(cr) + runtime.KeepAlive(region) +} + +// CairoRegionCreateFromSurface creates region that covers the area where the +// given surface is more than 50% opaque. +// +// This function takes into account device offsets that might be set with +// cairo_surface_set_device_offset(). +// +// The function takes the following parameters: +// +// - surface: cairo surface. +// +// The function returns the following values: +// +// - region: cairo_region_t. +func CairoRegionCreateFromSurface(surface *cairo.Surface) *cairo.Region { + var _arg1 *C.cairo_surface_t // out + var _cret *C.cairo_region_t // in + + _arg1 = (*C.cairo_surface_t)(unsafe.Pointer(surface.Native())) + + _cret = C.gdk_cairo_region_create_from_surface(_arg1) + runtime.KeepAlive(surface) + + var _region *cairo.Region // out + + { + _pp := &struct{ p unsafe.Pointer }{unsafe.Pointer(_cret)} + _region = (*cairo.Region)(unsafe.Pointer(_pp)) + } + runtime.SetFinalizer(_region, func(v *cairo.Region) { + C.cairo_region_destroy((*C.cairo_region_t)(unsafe.Pointer(v.Native()))) + }) + + return _region +} + +// CairoSetSourcePixbuf sets the given pixbuf as the source pattern for cr. +// +// The pattern has an extend mode of CAIRO_EXTEND_NONE and is aligned so that +// the origin of pixbuf is pixbuf_x, pixbuf_y. +// +// The function takes the following parameters: +// +// - cr: cairo context. +// - pixbuf: GdkPixbuf. +// - pixbufX: x coordinate of location to place upper left corner of pixbuf. +// - pixbufY: y coordinate of location to place upper left corner of pixbuf. +func CairoSetSourcePixbuf(cr *cairo.Context, pixbuf *gdkpixbuf.Pixbuf, pixbufX, pixbufY float64) { + var _arg1 *C.cairo_t // out + var _arg2 *C.GdkPixbuf // out + var _arg3 C.double // out + var _arg4 C.double // out + + _arg1 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg2 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + _arg3 = C.double(pixbufX) + _arg4 = C.double(pixbufY) + + C.gdk_cairo_set_source_pixbuf(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(cr) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(pixbufX) + runtime.KeepAlive(pixbufY) +} + +// CairoSetSourceRGBA sets the specified GdkRGBA as the source color of cr. +// +// The function takes the following parameters: +// +// - cr: cairo context. +// - rgba: GdkRGBA. +func CairoSetSourceRGBA(cr *cairo.Context, rgba *RGBA) { + var _arg1 *C.cairo_t // out + var _arg2 *C.GdkRGBA // out + + _arg1 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg2 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(rgba))) + + C.gdk_cairo_set_source_rgba(_arg1, _arg2) + runtime.KeepAlive(cr) + runtime.KeepAlive(rgba) +} + +// ContentDeserializeAsync: read content from the given input stream and +// deserialize it, asynchronously. +// +// The default I/O priority is G_PRIORITY_DEFAULT (i.e. 0), and lower numbers +// indicate a higher priority. +// +// When the operation is finished, callback will be called. You must then call +// gdk.ContentDeserializeFinish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object. +// - stream: GInputStream to read the serialized content from. +// - mimeType: mime type to deserialize from. +// - typ: GType to deserialize from. +// - ioPriority: i/O priority of the operation. +// - callback (optional) to call when the operation is done. +func ContentDeserializeAsync(ctx context.Context, stream gio.InputStreamer, mimeType string, typ coreglib.Type, ioPriority int, callback gio.AsyncReadyCallback) { + var _arg5 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg2 *C.char // out + var _arg3 C.GType // out + var _arg4 C.int // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.GType(typ) + _arg4 = C.int(ioPriority) + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_content_deserialize_async(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(mimeType) + runtime.KeepAlive(typ) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ContentDeserializeFinish finishes a content deserialization operation. +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +// +// The function returns the following values: +// +// - value: return location for the result of the operation. +func ContentDeserializeFinish(result gio.AsyncResulter) (coreglib.Value, error) { + var _arg1 *C.GAsyncResult // out + var _arg2 C.GValue // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.gdk_content_deserialize_finish(_arg1, &_arg2, &_cerr) + runtime.KeepAlive(result) + + var _value coreglib.Value // out + var _goerr error // out + + _value = *coreglib.ValueFromNative(unsafe.Pointer((&_arg2))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _value, _goerr +} + +// ContentSerializeAsync: serialize content and write it to the given output +// stream, asynchronously. +// +// The default I/O priority is G_PRIORITY_DEFAULT (i.e. 0), and lower numbers +// indicate a higher priority. +// +// When the operation is finished, callback will be called. You must then call +// gdk.ContentSerializeFinish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object. +// - stream: GOutputStream to write the serialized content to. +// - mimeType: mime type to serialize to. +// - value: content to serialize. +// - ioPriority: i/O priority of the operation. +// - callback (optional) to call when the operation is done. +func ContentSerializeAsync(ctx context.Context, stream gio.OutputStreamer, mimeType string, value *coreglib.Value, ioPriority int, callback gio.AsyncReadyCallback) { + var _arg5 *C.GCancellable // out + var _arg1 *C.GOutputStream // out + var _arg2 *C.char // out + var _arg3 *C.GValue // out + var _arg4 C.int // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.GValue)(unsafe.Pointer(value.Native())) + _arg4 = C.int(ioPriority) + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_content_serialize_async(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(mimeType) + runtime.KeepAlive(value) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ContentSerializeFinish finishes a content serialization operation. +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +func ContentSerializeFinish(result gio.AsyncResulter) error { + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.gdk_content_serialize_finish(_arg1, &_cerr) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func DragSurfaceSizeGetType() coreglib.Type { + var _cret C.GType // in + + _cret = C.gdk_drag_surface_size_get_type() + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// EventsGetAngle returns the relative angle from event1 to event2. +// +// The relative angle is the angle between the X axis and the line through both +// events' positions. The rotation direction for positive angles is from the +// positive X axis towards the positive Y axis. +// +// This assumes that both events have X/Y information. If not, this function +// returns FALSE. +// +// The function takes the following parameters: +// +// - event1: first GdkEvent. +// - event2: second GdkEvent. +// +// The function returns the following values: +// +// - angle: return location for the relative angle between both events. +// - ok: TRUE if the angle could be calculated. +func EventsGetAngle(event1, event2 Eventer) (float64, bool) { + var _arg1 *C.GdkEvent // out + var _arg2 *C.GdkEvent // out + var _arg3 C.double // in + var _cret C.gboolean // in + + _arg1 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event1).Native())) + _arg2 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event2).Native())) + + _cret = C.gdk_events_get_angle(_arg1, _arg2, &_arg3) + runtime.KeepAlive(event1) + runtime.KeepAlive(event2) + + var _angle float64 // out + var _ok bool // out + + _angle = float64(_arg3) + if _cret != 0 { + _ok = true + } + + return _angle, _ok +} + +// EventsGetCenter returns the point halfway between the events' positions. +// +// This assumes that both events have X/Y information. If not, this function +// returns FALSE. +// +// The function takes the following parameters: +// +// - event1: first GdkEvent. +// - event2: second GdkEvent. +// +// The function returns the following values: +// +// - x: return location for the X coordinate of the center. +// - y: return location for the Y coordinate of the center. +// - ok: TRUE if the center could be calculated. +func EventsGetCenter(event1, event2 Eventer) (x, y float64, ok bool) { + var _arg1 *C.GdkEvent // out + var _arg2 *C.GdkEvent // out + var _arg3 C.double // in + var _arg4 C.double // in + var _cret C.gboolean // in + + _arg1 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event1).Native())) + _arg2 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event2).Native())) + + _cret = C.gdk_events_get_center(_arg1, _arg2, &_arg3, &_arg4) + runtime.KeepAlive(event1) + runtime.KeepAlive(event2) + + var _x float64 // out + var _y float64 // out + var _ok bool // out + + _x = float64(_arg3) + _y = float64(_arg4) + if _cret != 0 { + _ok = true + } + + return _x, _y, _ok +} + +// EventsGetDistance returns the distance between the event locations. +// +// This assumes that both events have X/Y information. If not, this function +// returns FALSE. +// +// The function takes the following parameters: +// +// - event1: first GdkEvent. +// - event2: second GdkEvent. +// +// The function returns the following values: +// +// - distance: return location for the distance. +// - ok: TRUE if the distance could be calculated. +func EventsGetDistance(event1, event2 Eventer) (float64, bool) { + var _arg1 *C.GdkEvent // out + var _arg2 *C.GdkEvent // out + var _arg3 C.double // in + var _cret C.gboolean // in + + _arg1 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event1).Native())) + _arg2 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event2).Native())) + + _cret = C.gdk_events_get_distance(_arg1, _arg2, &_arg3) + runtime.KeepAlive(event1) + runtime.KeepAlive(event2) + + var _distance float64 // out + var _ok bool // out + + _distance = float64(_arg3) + if _cret != 0 { + _ok = true + } + + return _distance, _ok +} + +// InternMIMEType canonicalizes the given mime type and interns the result. +// +// If string is not a valid mime type, NULL is returned instead. See RFC 2048 +// for the syntax if mime types. +// +// The function takes the following parameters: +// +// - str: string of a potential mime type. +// +// The function returns the following values: +// +// - utf8 (optional): interned string for the canonicalized mime type or NULL +// if the string wasn't a valid mime type. +func InternMIMEType(str string) string { + var _arg1 *C.char // out + var _cret *C.char // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_intern_mime_type(_arg1) + runtime.KeepAlive(str) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// KeyvalConvertCase obtains the upper- and lower-case versions of the keyval +// symbol. +// +// Examples of keyvals are GDK_KEY_a, GDK_KEY_Enter, GDK_KEY_F1, etc. +// +// The function takes the following parameters: +// +// - symbol: keyval. +// +// The function returns the following values: +// +// - lower: return location for lowercase version of symbol. +// - upper: return location for uppercase version of symbol. +func KeyvalConvertCase(symbol uint) (lower, upper uint) { + var _arg1 C.guint // out + var _arg2 C.guint // in + var _arg3 C.guint // in + + _arg1 = C.guint(symbol) + + C.gdk_keyval_convert_case(_arg1, &_arg2, &_arg3) + runtime.KeepAlive(symbol) + + var _lower uint // out + var _upper uint // out + + _lower = uint(_arg2) + _upper = uint(_arg3) + + return _lower, _upper +} + +// KeyvalFromName converts a key name to a key value. +// +// The names are the same as those in the gdk/gdkkeysyms.h header file but +// without the leading “GDK_KEY_”. +// +// The function takes the following parameters: +// +// - keyvalName: key name. +// +// The function returns the following values: +// +// - guint: corresponding key value, or GDK_KEY_VoidSymbol if the key name is +// not a valid key. +func KeyvalFromName(keyvalName string) uint { + var _arg1 *C.char // out + var _cret C.guint // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(keyvalName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_keyval_from_name(_arg1) + runtime.KeepAlive(keyvalName) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// KeyvalIsLower returns TRUE if the given key value is in lower case. +// +// The function takes the following parameters: +// +// - keyval: key value. +// +// The function returns the following values: +// +// - ok: TRUE if keyval is in lower case, or if keyval is not subject to case +// conversion. +func KeyvalIsLower(keyval uint) bool { + var _arg1 C.guint // out + var _cret C.gboolean // in + + _arg1 = C.guint(keyval) + + _cret = C.gdk_keyval_is_lower(_arg1) + runtime.KeepAlive(keyval) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// KeyvalIsUpper returns TRUE if the given key value is in upper case. +// +// The function takes the following parameters: +// +// - keyval: key value. +// +// The function returns the following values: +// +// - ok: TRUE if keyval is in upper case, or if keyval is not subject to case +// conversion. +func KeyvalIsUpper(keyval uint) bool { + var _arg1 C.guint // out + var _cret C.gboolean // in + + _arg1 = C.guint(keyval) + + _cret = C.gdk_keyval_is_upper(_arg1) + runtime.KeepAlive(keyval) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// KeyvalName converts a key value into a symbolic name. +// +// The names are the same as those in the gdk/gdkkeysyms.h header file but +// without the leading “GDK_KEY_”. +// +// The function takes the following parameters: +// +// - keyval: key value. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the name of the key. +func KeyvalName(keyval uint) string { + var _arg1 C.guint // out + var _cret *C.char // in + + _arg1 = C.guint(keyval) + + _cret = C.gdk_keyval_name(_arg1) + runtime.KeepAlive(keyval) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// KeyvalToLower converts a key value to lower case, if applicable. +// +// The function takes the following parameters: +// +// - keyval: key value. +// +// The function returns the following values: +// +// - guint: lower case form of keyval, or keyval itself if it is already in +// lower case or it is not subject to case conversion. +func KeyvalToLower(keyval uint) uint { + var _arg1 C.guint // out + var _cret C.guint // in + + _arg1 = C.guint(keyval) + + _cret = C.gdk_keyval_to_lower(_arg1) + runtime.KeepAlive(keyval) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// KeyvalToUnicode: convert from a GDK key symbol to the corresponding Unicode +// character. +// +// Note that the conversion does not take the current locale into consideration, +// which might be expected for particular keyvals, such as GDK_KEY_KP_Decimal. +// +// The function takes the following parameters: +// +// - keyval: GDK key symbol. +// +// The function returns the following values: +// +// - guint32: corresponding unicode character, or 0 if there is no +// corresponding character. +func KeyvalToUnicode(keyval uint) uint32 { + var _arg1 C.guint // out + var _cret C.guint32 // in + + _arg1 = C.guint(keyval) + + _cret = C.gdk_keyval_to_unicode(_arg1) + runtime.KeepAlive(keyval) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// KeyvalToUpper converts a key value to upper case, if applicable. +// +// The function takes the following parameters: +// +// - keyval: key value. +// +// The function returns the following values: +// +// - guint: upper case form of keyval, or keyval itself if it is already in +// upper case or it is not subject to case conversion. +func KeyvalToUpper(keyval uint) uint { + var _arg1 C.guint // out + var _cret C.guint // in + + _arg1 = C.guint(keyval) + + _cret = C.gdk_keyval_to_upper(_arg1) + runtime.KeepAlive(keyval) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// PixbufGetFromSurface transfers image data from a cairo_surface_t and converts +// it to a GdkPixbuf. +// +// This allows you to efficiently read individual pixels from cairo surfaces. +// +// This function will create an RGB pixbuf with 8 bits per channel. The pixbuf +// will contain an alpha channel if the surface contains one. +// +// Deprecated: Use gdk.Texture and subclasses instead cairo surfaces and +// pixbufs. +// +// The function takes the following parameters: +// +// - surface to copy from. +// - srcX: source X coordinate within surface. +// - srcY: source Y coordinate within surface. +// - width: width in pixels of region to get. +// - height: height in pixels of region to get. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf with a reference count of 1. +func PixbufGetFromSurface(surface *cairo.Surface, srcX, srcY, width, height int) *gdkpixbuf.Pixbuf { + var _arg1 *C.cairo_surface_t // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.int // out + var _arg5 C.int // out + var _cret *C.GdkPixbuf // in + + _arg1 = (*C.cairo_surface_t)(unsafe.Pointer(surface.Native())) + _arg2 = C.int(srcX) + _arg3 = C.int(srcY) + _arg4 = C.int(width) + _arg5 = C.int(height) + + _cret = C.gdk_pixbuf_get_from_surface(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(surface) + runtime.KeepAlive(srcX) + runtime.KeepAlive(srcY) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + + var _pixbuf *gdkpixbuf.Pixbuf // out + + if _cret != nil { + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _pixbuf = &gdkpixbuf.Pixbuf{ + Object: obj, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, + } + } + } + + return _pixbuf +} + +// PixbufGetFromTexture creates a new pixbuf from texture. +// +// This should generally not be used in newly written code as later stages will +// almost certainly convert the pixbuf back into a texture to draw it on screen. +// +// Deprecated: Use gdk.Texture and subclasses instead cairo surfaces and +// pixbufs. +// +// The function takes the following parameters: +// +// - texture: GdkTexture. +// +// The function returns the following values: +// +// - pixbuf (optional): new GdkPixbuf. +func PixbufGetFromTexture(texture Texturer) *gdkpixbuf.Pixbuf { + var _arg1 *C.GdkTexture // out + var _cret *C.GdkPixbuf // in + + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + + _cret = C.gdk_pixbuf_get_from_texture(_arg1) + runtime.KeepAlive(texture) + + var _pixbuf *gdkpixbuf.Pixbuf // out + + if _cret != nil { + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _pixbuf = &gdkpixbuf.Pixbuf{ + Object: obj, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, + } + } + } + + return _pixbuf +} + +// SetAllowedBackends sets a list of backends that GDK should try to use. +// +// This can be useful if your application does not work with certain GDK +// backends. +// +// By default, GDK tries all included backends. +// +// For example: +// +// gdk_set_allowed_backends ("wayland,macos,*"); +// +// instructs GDK to try the Wayland backend first, followed by the MacOs +// backend, and then all others. +// +// If the GDK_BACKEND environment variable is set, it determines what backends +// are tried in what order, while still respecting the set of allowed backends +// that are specified by this function. +// +// The possible backend names are: +// +// - broadway +// - macos +// - wayland. +// - win32 +// - x11 +// +// You can also include a * in the list to try all remaining backends. +// +// This call must happen prior to functions that open a display, such as +// gdk.Display().Open, gtk_init(), or gtk_init_check() in order to take effect. +// +// The function takes the following parameters: +// +// - backends: comma-separated list of backends. +func SetAllowedBackends(backends string) { + var _arg1 *C.char // out + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(backends))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gdk_set_allowed_backends(_arg1) + runtime.KeepAlive(backends) +} + +func ToplevelSizeGetType() coreglib.Type { + var _cret C.GType // in + + _cret = C.gdk_toplevel_size_get_type() + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// UnicodeToKeyval: convert from a Unicode character to a key symbol. +// +// The function takes the following parameters: +// +// - wc: unicode character. +// +// The function returns the following values: +// +// - guint: corresponding GDK key symbol, if one exists. or, if there is no +// corresponding symbol, wc | 0x01000000. +func UnicodeToKeyval(wc uint32) uint { + var _arg1 C.guint32 // out + var _cret C.guint // in + + _arg1 = C.guint32(wc) + + _cret = C.gdk_unicode_to_keyval(_arg1) + runtime.KeepAlive(wc) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// DevicePad: GdkDevicePad is an interface implemented by devices of type +// GDK_SOURCE_TABLET_PAD +// +// It allows querying the features provided by the pad device. +// +// Tablet pads may contain one or more groups, each containing a subset of +// the buttons/rings/strips available. gdk.DevicePad.GetNGroups() can be +// used to obtain the number of groups, gdk.DevicePad.GetNFeatures() and +// gdk.DevicePad.GetFeatureGroup() can be combined to find out the number of +// buttons/rings/strips the device has, and how are they grouped. +// +// Each of those groups have different modes, which may be used to map each +// individual pad feature to multiple actions. Only one mode is effective +// (current) for each given group, different groups may have different current +// modes. The number of available modes in a group can be found out through +// gdk.DevicePad.GetGroupNModes(), and the current mode for a given group will +// be notified through events of type GDK_PAD_GROUP_MODE. +// +// DevicePad wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DevicePad struct { + _ [0]func() // equal guard + Device +} + +var ( + _ Devicer = (*DevicePad)(nil) +) + +// DevicePadder describes DevicePad's interface methods. +type DevicePadder interface { + coreglib.Objector + + // FeatureGroup returns the group the given feature and idx belong to. + FeatureGroup(feature DevicePadFeature, featureIdx int) int + // GroupNModes returns the number of modes that group may have. + GroupNModes(groupIdx int) int + // NFeatures returns the number of features a tablet pad has. + NFeatures(feature DevicePadFeature) int + // NGroups returns the number of groups this pad device has. + NGroups() int +} + +var _ DevicePadder = (*DevicePad)(nil) + +func wrapDevicePad(obj *coreglib.Object) *DevicePad { + return &DevicePad{ + Device: Device{ + Object: obj, + }, + } +} + +func marshalDevicePad(p uintptr) (interface{}, error) { + return wrapDevicePad(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// FeatureGroup returns the group the given feature and idx belong to. +// +// f the feature or index do not exist in pad, -1 is returned. +// +// The function takes the following parameters: +// +// - feature type to get the group from. +// - featureIdx: index of the feature to get the group from. +// +// The function returns the following values: +// +// - gint: group number of the queried pad feature. +func (pad *DevicePad) FeatureGroup(feature DevicePadFeature, featureIdx int) int { + var _arg0 *C.GdkDevicePad // out + var _arg1 C.GdkDevicePadFeature // out + var _arg2 C.int // out + var _cret C.int // in + + _arg0 = (*C.GdkDevicePad)(unsafe.Pointer(coreglib.InternObject(pad).Native())) + _arg1 = C.GdkDevicePadFeature(feature) + _arg2 = C.int(featureIdx) + + _cret = C.gdk_device_pad_get_feature_group(_arg0, _arg1, _arg2) + runtime.KeepAlive(pad) + runtime.KeepAlive(feature) + runtime.KeepAlive(featureIdx) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// GroupNModes returns the number of modes that group may have. +// +// The function takes the following parameters: +// +// - groupIdx: group to get the number of available modes from. +// +// The function returns the following values: +// +// - gint: number of modes available in group. +func (pad *DevicePad) GroupNModes(groupIdx int) int { + var _arg0 *C.GdkDevicePad // out + var _arg1 C.int // out + var _cret C.int // in + + _arg0 = (*C.GdkDevicePad)(unsafe.Pointer(coreglib.InternObject(pad).Native())) + _arg1 = C.int(groupIdx) + + _cret = C.gdk_device_pad_get_group_n_modes(_arg0, _arg1) + runtime.KeepAlive(pad) + runtime.KeepAlive(groupIdx) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// NFeatures returns the number of features a tablet pad has. +// +// The function takes the following parameters: +// +// - feature: pad feature. +// +// The function returns the following values: +// +// - gint: amount of elements of type feature that this pad has. +func (pad *DevicePad) NFeatures(feature DevicePadFeature) int { + var _arg0 *C.GdkDevicePad // out + var _arg1 C.GdkDevicePadFeature // out + var _cret C.int // in + + _arg0 = (*C.GdkDevicePad)(unsafe.Pointer(coreglib.InternObject(pad).Native())) + _arg1 = C.GdkDevicePadFeature(feature) + + _cret = C.gdk_device_pad_get_n_features(_arg0, _arg1) + runtime.KeepAlive(pad) + runtime.KeepAlive(feature) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// NGroups returns the number of groups this pad device has. +// +// Pads have at least one group. A pad group is a subcollection of +// buttons/strip/rings that is affected collectively by a same current mode. +// +// The function returns the following values: +// +// - gint: number of button/ring/strip groups in the pad. +func (pad *DevicePad) NGroups() int { + var _arg0 *C.GdkDevicePad // out + var _cret C.int // in + + _arg0 = (*C.GdkDevicePad)(unsafe.Pointer(coreglib.InternObject(pad).Native())) + + _cret = C.gdk_device_pad_get_n_groups(_arg0) + runtime.KeepAlive(pad) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// DragSurface: GdkDragSurface is an interface for surfaces used during DND. +// +// DragSurface wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DragSurface struct { + _ [0]func() // equal guard + Surface +} + +var ( + _ Surfacer = (*DragSurface)(nil) +) + +// DragSurfacer describes DragSurface's interface methods. +type DragSurfacer interface { + coreglib.Objector + + // Present drag_surface. + Present(width, height int) bool +} + +var _ DragSurfacer = (*DragSurface)(nil) + +func wrapDragSurface(obj *coreglib.Object) *DragSurface { + return &DragSurface{ + Surface: Surface{ + Object: obj, + }, + } +} + +func marshalDragSurface(p uintptr) (interface{}, error) { + return wrapDragSurface(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Present drag_surface. +// +// The function takes the following parameters: +// +// - width: unconstrained drag_surface width to layout. +// - height: unconstrained drag_surface height to layout. +// +// The function returns the following values: +// +// - ok: FALSE if it failed to be presented, otherwise TRUE. +func (dragSurface *DragSurface) Present(width, height int) bool { + var _arg0 *C.GdkDragSurface // out + var _arg1 C.int // out + var _arg2 C.int // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDragSurface)(unsafe.Pointer(coreglib.InternObject(dragSurface).Native())) + _arg1 = C.int(width) + _arg2 = C.int(height) + + _cret = C.gdk_drag_surface_present(_arg0, _arg1, _arg2) + runtime.KeepAlive(dragSurface) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Paintable: GdkPaintable is a simple interface used by GTK to represent +// content that can be painted. +// +// The content of a GdkPaintable can be painted anywhere at any +// size without requiring any sort of layout. The interface is +// inspired by similar concepts elsewhere, such as ClutterContent +// (https://developer.gnome.org/clutter/stable/ClutterContent.html), +// HTML/CSS Paint Sources (https://www.w3.org/TR/css-images-4/#paint-source), +// or SVG Paint Servers (https://www.w3.org/TR/SVG2/pservers.html). +// +// A GdkPaintable can be snapshot at any time and size using +// gdk.Paintable.Snapshot(). How the paintable interprets that size and if it +// scales or centers itself into the given rectangle is implementation defined, +// though if you are implementing a GdkPaintable and don't know what to do, +// it is suggested that you scale your paintable ignoring any potential aspect +// ratio. +// +// The contents that a GdkPaintable produces may depend on the gdk.Snapshot +// passed to it. For example, paintables may decide to use more detailed images +// on higher resolution screens or when OpenGL is available. A GdkPaintable will +// however always produce the same output for the same snapshot. +// +// A GdkPaintable may change its contents, meaning that it will now +// produce a different output with the same snapshot. Once that happens, +// it will call gdk.Paintable.InvalidateContents() which will emit the +// gdk.Paintable::invalidate-contents signal. If a paintable is known to +// never change its contents, it will set the GDK_PAINTABLE_STATIC_CONTENTS +// flag. If a consumer cannot deal with changing contents, it may call +// gdk.Paintable.GetCurrentImage() which will return a static paintable and use +// that. +// +// A paintable can report an intrinsic (or preferred) size or aspect ratio +// it wishes to be rendered at, though it doesn't have to. Consumers of the +// interface can use this information to layout thepaintable appropriately. +// Just like the contents, the size of a paintable can change. A paintable +// will indicate this by calling gdk.Paintable.InvalidateSize() which will +// emit the gdk.Paintable::invalidate-size signal. And just like for contents, +// if a paintable is known to never change its size, it will set the +// GDK_PAINTABLE_STATIC_SIZE flag. +// +// Besides API for applications, there are some functions that are only +// useful for implementing subclasses and should not be used by applications: +// gdk.Paintable.InvalidateContents(), gdk.Paintable.InvalidateSize(), +// gdk.Paintable().NewEmpty. +// +// Paintable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Paintable struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Paintable)(nil) +) + +// Paintabler describes Paintable's interface methods. +type Paintabler interface { + coreglib.Objector + + // ComputeConcreteSize: compute a concrete size for the GdkPaintable. + ComputeConcreteSize(specifiedWidth, specifiedHeight, defaultWidth, defaultHeight float64) (concreteWidth, concreteHeight float64) + // CurrentImage gets an immutable paintable for the current contents + // displayed by paintable. + CurrentImage() *Paintable + // Flags: get flags for the paintable. + Flags() PaintableFlags + // IntrinsicAspectRatio gets the preferred aspect ratio the paintable would + // like to be displayed at. + IntrinsicAspectRatio() float64 + // IntrinsicHeight gets the preferred height the paintable would like to be + // displayed at. + IntrinsicHeight() int + // IntrinsicWidth gets the preferred width the paintable would like to be + // displayed at. + IntrinsicWidth() int + // InvalidateContents: called by implementations of GdkPaintable to + // invalidate their contents. + InvalidateContents() + // InvalidateSize: called by implementations of GdkPaintable to invalidate + // their size. + InvalidateSize() + // Snapshot snapshots the given paintable with the given width and height. + Snapshot(snapshot Snapshotter, width, height float64) + + // Invalidate-contents is emitted when the contents of the paintable change. + ConnectInvalidateContents(func()) coreglib.SignalHandle + // Invalidate-size is emitted when the intrinsic size of the paintable + // changes. + ConnectInvalidateSize(func()) coreglib.SignalHandle +} + +var _ Paintabler = (*Paintable)(nil) + +func wrapPaintable(obj *coreglib.Object) *Paintable { + return &Paintable{ + Object: obj, + } +} + +func marshalPaintable(p uintptr) (interface{}, error) { + return wrapPaintable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectInvalidateContents is emitted when the contents of the paintable +// change. +// +// Examples for such an event would be videos changing to the next frame or the +// icon theme for an icon changing. +func (paintable *Paintable) ConnectInvalidateContents(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(paintable, "invalidate-contents", false, unsafe.Pointer(C._gotk4_gdk4_Paintable_ConnectInvalidateContents), f) +} + +// ConnectInvalidateSize is emitted when the intrinsic size of the paintable +// changes. +// +// This means the values reported by at least one of +// gdk.Paintable.GetIntrinsicWidth(), gdk.Paintable.GetIntrinsicHeight() or +// gdk.Paintable.GetIntrinsicAspectRatio() has changed. +// +// Examples for such an event would be a paintable displaying the contents of a +// toplevel surface being resized. +func (paintable *Paintable) ConnectInvalidateSize(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(paintable, "invalidate-size", false, unsafe.Pointer(C._gotk4_gdk4_Paintable_ConnectInvalidateSize), f) +} + +// ComputeConcreteSize: compute a concrete size for the GdkPaintable. +// +// Applies the sizing algorithm outlined in the CSS Image spec +// (https://drafts.csswg.org/css-images-3/#default-sizing) to the given +// paintable. See that link for more details. +// +// It is not necessary to call this function when both specified_width and +// specified_height are known, but it is useful to call this function in +// GtkWidget:measure implementations to compute the other dimension when only +// one dimension is given. +// +// The function takes the following parameters: +// +// - specifiedWidth: width paintable could be drawn into or 0.0 if unknown. +// - specifiedHeight: height paintable could be drawn into or 0.0 if unknown. +// - defaultWidth: width paintable would be drawn into if no other constraints +// were given. +// - defaultHeight: height paintable would be drawn into if no other +// constraints were given. +// +// The function returns the following values: +// +// - concreteWidth will be set to the concrete width computed. +// - concreteHeight will be set to the concrete height computed. +func (paintable *Paintable) ComputeConcreteSize(specifiedWidth, specifiedHeight, defaultWidth, defaultHeight float64) (concreteWidth, concreteHeight float64) { + var _arg0 *C.GdkPaintable // out + var _arg1 C.double // out + var _arg2 C.double // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // in + var _arg6 C.double // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + _arg1 = C.double(specifiedWidth) + _arg2 = C.double(specifiedHeight) + _arg3 = C.double(defaultWidth) + _arg4 = C.double(defaultHeight) + + C.gdk_paintable_compute_concrete_size(_arg0, _arg1, _arg2, _arg3, _arg4, &_arg5, &_arg6) + runtime.KeepAlive(paintable) + runtime.KeepAlive(specifiedWidth) + runtime.KeepAlive(specifiedHeight) + runtime.KeepAlive(defaultWidth) + runtime.KeepAlive(defaultHeight) + + var _concreteWidth float64 // out + var _concreteHeight float64 // out + + _concreteWidth = float64(_arg5) + _concreteHeight = float64(_arg6) + + return _concreteWidth, _concreteHeight +} + +// CurrentImage gets an immutable paintable for the current contents displayed +// by paintable. +// +// This is useful when you want to retain the current state of an animation, +// for example to take a screenshot of a running animation. +// +// If the paintable is already immutable, it will return itself. +// +// The function returns the following values: +// +// - ret: immutable paintable for the current contents of paintable. +func (paintable *Paintable) CurrentImage() *Paintable { + var _arg0 *C.GdkPaintable // out + var _cret *C.GdkPaintable // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C.gdk_paintable_get_current_image(_arg0) + runtime.KeepAlive(paintable) + + var _ret *Paintable // out + + _ret = wrapPaintable(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _ret +} + +// Flags: get flags for the paintable. +// +// This is oftentimes useful for optimizations. +// +// See gdk.PaintableFlags for the flags and what they mean. +// +// The function returns the following values: +// +// - paintableFlags: GdkPaintableFlags for this paintable. +func (paintable *Paintable) Flags() PaintableFlags { + var _arg0 *C.GdkPaintable // out + var _cret C.GdkPaintableFlags // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C.gdk_paintable_get_flags(_arg0) + runtime.KeepAlive(paintable) + + var _paintableFlags PaintableFlags // out + + _paintableFlags = PaintableFlags(_cret) + + return _paintableFlags +} + +// IntrinsicAspectRatio gets the preferred aspect ratio the paintable would like +// to be displayed at. +// +// The aspect ratio is the width divided by the height, so a value of 0.5 means +// that the paintable prefers to be displayed twice as high as it is wide. +// Consumers of this interface can use this to preserve aspect ratio when +// displaying the paintable. +// +// This is a purely informational value and does not in any way limit the values +// that may be passed to gdk.Paintable.Snapshot(). +// +// Usually when a paintable returns nonzero values from +// gdk.Paintable.GetIntrinsicWidth() and gdk.Paintable.GetIntrinsicHeight() the +// aspect ratio should conform to those values, though that is not required. +// +// If the paintable does not have a preferred aspect ratio, it returns 0. +// Negative values are never returned. +// +// The function returns the following values: +// +// - gdouble: intrinsic aspect ratio of paintable or 0 if none. +func (paintable *Paintable) IntrinsicAspectRatio() float64 { + var _arg0 *C.GdkPaintable // out + var _cret C.double // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C.gdk_paintable_get_intrinsic_aspect_ratio(_arg0) + runtime.KeepAlive(paintable) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// IntrinsicHeight gets the preferred height the paintable would like to be +// displayed at. +// +// Consumers of this interface can use this to reserve enough space to draw the +// paintable. +// +// This is a purely informational value and does not in any way limit the values +// that may be passed to gdk.Paintable.Snapshot(). +// +// If the paintable does not have a preferred height, it returns 0. Negative +// values are never returned. +// +// The function returns the following values: +// +// - gint: intrinsic height of paintable or 0 if none. +func (paintable *Paintable) IntrinsicHeight() int { + var _arg0 *C.GdkPaintable // out + var _cret C.int // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C.gdk_paintable_get_intrinsic_height(_arg0) + runtime.KeepAlive(paintable) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// IntrinsicWidth gets the preferred width the paintable would like to be +// displayed at. +// +// Consumers of this interface can use this to reserve enough space to draw the +// paintable. +// +// This is a purely informational value and does not in any way limit the values +// that may be passed to gdk.Paintable.Snapshot(). +// +// If the paintable does not have a preferred width, it returns 0. Negative +// values are never returned. +// +// The function returns the following values: +// +// - gint: intrinsic width of paintable or 0 if none. +func (paintable *Paintable) IntrinsicWidth() int { + var _arg0 *C.GdkPaintable // out + var _cret C.int // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C.gdk_paintable_get_intrinsic_width(_arg0) + runtime.KeepAlive(paintable) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// InvalidateContents: called by implementations of GdkPaintable to invalidate +// their contents. +// +// Unless the contents are invalidated, implementations must guarantee that +// multiple calls of gdk.Paintable.Snapshot() produce the same output. +// +// This function will emit the gdk.Paintable::invalidate-contents signal. +// +// If a paintable reports the GDK_PAINTABLE_STATIC_CONTENTS flag, it must not +// call this function. +func (paintable *Paintable) InvalidateContents() { + var _arg0 *C.GdkPaintable // out + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + C.gdk_paintable_invalidate_contents(_arg0) + runtime.KeepAlive(paintable) +} + +// InvalidateSize: called by implementations of GdkPaintable to invalidate their +// size. +// +// As long as the size is not invalidated, paintable must return the same values +// for its intrinsic width, height and aspect ratio. +// +// This function will emit the gdk.Paintable::invalidate-size signal. +// +// If a paintable reports the GDK_PAINTABLE_STATIC_SIZE flag, it must not call +// this function. +func (paintable *Paintable) InvalidateSize() { + var _arg0 *C.GdkPaintable // out + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + C.gdk_paintable_invalidate_size(_arg0) + runtime.KeepAlive(paintable) +} + +// Snapshot snapshots the given paintable with the given width and height. +// +// The paintable is drawn at the current (0,0) offset of the snapshot. If width +// and height are not larger than zero, this function will do nothing. +// +// The function takes the following parameters: +// +// - snapshot: GdkSnapshot to snapshot to. +// - width to snapshot in. +// - height to snapshot in. +func (paintable *Paintable) Snapshot(snapshot Snapshotter, width, height float64) { + var _arg0 *C.GdkPaintable // out + var _arg1 *C.GdkSnapshot // out + var _arg2 C.double // out + var _arg3 C.double // out + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + _arg1 = (*C.GdkSnapshot)(unsafe.Pointer(coreglib.InternObject(snapshot).Native())) + _arg2 = C.double(width) + _arg3 = C.double(height) + + C.gdk_paintable_snapshot(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(paintable) + runtime.KeepAlive(snapshot) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// currentImage gets an immutable paintable for the current contents displayed +// by paintable. +// +// This is useful when you want to retain the current state of an animation, +// for example to take a screenshot of a running animation. +// +// If the paintable is already immutable, it will return itself. +// +// The function returns the following values: +// +// - ret: immutable paintable for the current contents of paintable. +func (paintable *Paintable) currentImage() *Paintable { + gclass := (*C.GdkPaintableInterface)(coreglib.PeekParentClass(paintable)) + fnarg := gclass.get_current_image + + var _arg0 *C.GdkPaintable // out + var _cret *C.GdkPaintable // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C._gotk4_gdk4_Paintable_virtual_get_current_image(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(paintable) + + var _ret *Paintable // out + + _ret = wrapPaintable(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _ret +} + +// Flags: get flags for the paintable. +// +// This is oftentimes useful for optimizations. +// +// See gdk.PaintableFlags for the flags and what they mean. +// +// The function returns the following values: +// +// - paintableFlags: GdkPaintableFlags for this paintable. +func (paintable *Paintable) flags() PaintableFlags { + gclass := (*C.GdkPaintableInterface)(coreglib.PeekParentClass(paintable)) + fnarg := gclass.get_flags + + var _arg0 *C.GdkPaintable // out + var _cret C.GdkPaintableFlags // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C._gotk4_gdk4_Paintable_virtual_get_flags(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(paintable) + + var _paintableFlags PaintableFlags // out + + _paintableFlags = PaintableFlags(_cret) + + return _paintableFlags +} + +// intrinsicAspectRatio gets the preferred aspect ratio the paintable would like +// to be displayed at. +// +// The aspect ratio is the width divided by the height, so a value of 0.5 means +// that the paintable prefers to be displayed twice as high as it is wide. +// Consumers of this interface can use this to preserve aspect ratio when +// displaying the paintable. +// +// This is a purely informational value and does not in any way limit the values +// that may be passed to gdk.Paintable.Snapshot(). +// +// Usually when a paintable returns nonzero values from +// gdk.Paintable.GetIntrinsicWidth() and gdk.Paintable.GetIntrinsicHeight() the +// aspect ratio should conform to those values, though that is not required. +// +// If the paintable does not have a preferred aspect ratio, it returns 0. +// Negative values are never returned. +// +// The function returns the following values: +// +// - gdouble: intrinsic aspect ratio of paintable or 0 if none. +func (paintable *Paintable) intrinsicAspectRatio() float64 { + gclass := (*C.GdkPaintableInterface)(coreglib.PeekParentClass(paintable)) + fnarg := gclass.get_intrinsic_aspect_ratio + + var _arg0 *C.GdkPaintable // out + var _cret C.double // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C._gotk4_gdk4_Paintable_virtual_get_intrinsic_aspect_ratio(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(paintable) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// intrinsicHeight gets the preferred height the paintable would like to be +// displayed at. +// +// Consumers of this interface can use this to reserve enough space to draw the +// paintable. +// +// This is a purely informational value and does not in any way limit the values +// that may be passed to gdk.Paintable.Snapshot(). +// +// If the paintable does not have a preferred height, it returns 0. Negative +// values are never returned. +// +// The function returns the following values: +// +// - gint: intrinsic height of paintable or 0 if none. +func (paintable *Paintable) intrinsicHeight() int { + gclass := (*C.GdkPaintableInterface)(coreglib.PeekParentClass(paintable)) + fnarg := gclass.get_intrinsic_height + + var _arg0 *C.GdkPaintable // out + var _cret C.int // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C._gotk4_gdk4_Paintable_virtual_get_intrinsic_height(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(paintable) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// intrinsicWidth gets the preferred width the paintable would like to be +// displayed at. +// +// Consumers of this interface can use this to reserve enough space to draw the +// paintable. +// +// This is a purely informational value and does not in any way limit the values +// that may be passed to gdk.Paintable.Snapshot(). +// +// If the paintable does not have a preferred width, it returns 0. Negative +// values are never returned. +// +// The function returns the following values: +// +// - gint: intrinsic width of paintable or 0 if none. +func (paintable *Paintable) intrinsicWidth() int { + gclass := (*C.GdkPaintableInterface)(coreglib.PeekParentClass(paintable)) + fnarg := gclass.get_intrinsic_width + + var _arg0 *C.GdkPaintable // out + var _cret C.int // in + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + + _cret = C._gotk4_gdk4_Paintable_virtual_get_intrinsic_width(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(paintable) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Snapshot snapshots the given paintable with the given width and height. +// +// The paintable is drawn at the current (0,0) offset of the snapshot. If width +// and height are not larger than zero, this function will do nothing. +// +// The function takes the following parameters: +// +// - snapshot: GdkSnapshot to snapshot to. +// - width to snapshot in. +// - height to snapshot in. +func (paintable *Paintable) snapshot(snapshot Snapshotter, width, height float64) { + gclass := (*C.GdkPaintableInterface)(coreglib.PeekParentClass(paintable)) + fnarg := gclass.snapshot + + var _arg0 *C.GdkPaintable // out + var _arg1 *C.GdkSnapshot // out + var _arg2 C.double // out + var _arg3 C.double // out + + _arg0 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + _arg1 = (*C.GdkSnapshot)(unsafe.Pointer(coreglib.InternObject(snapshot).Native())) + _arg2 = C.double(width) + _arg3 = C.double(height) + + C._gotk4_gdk4_Paintable_virtual_snapshot(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(paintable) + runtime.KeepAlive(snapshot) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// NewPaintableEmpty returns a paintable that has the given intrinsic size and +// draws nothing. +// +// This is often useful for implementing the gdk.Paintable.GetCurrentImage() +// virtual function when the paintable is in an incomplete state (like a +// GtkMediaStream (../gtk4/class.MediaStream.html) before receiving the first +// frame). +// +// The function takes the following parameters: +// +// - intrinsicWidth: intrinsic width to report. Can be 0 for no width. +// - intrinsicHeight: intrinsic height to report. Can be 0 for no height. +// +// The function returns the following values: +// +// - paintable: GdkPaintable. +func NewPaintableEmpty(intrinsicWidth, intrinsicHeight int) *Paintable { + var _arg1 C.int // out + var _arg2 C.int // out + var _cret *C.GdkPaintable // in + + _arg1 = C.int(intrinsicWidth) + _arg2 = C.int(intrinsicHeight) + + _cret = C.gdk_paintable_new_empty(_arg1, _arg2) + runtime.KeepAlive(intrinsicWidth) + runtime.KeepAlive(intrinsicHeight) + + var _paintable *Paintable // out + + _paintable = wrapPaintable(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _paintable +} + +// Popup: GdkPopup is a surface that is attached to another surface. +// +// The GdkPopup is positioned relative to its parent surface. +// +// GdkPopups are typically used to implement menus and similar popups. They can +// be modal, which is indicated by the gdk.Popup:autohide property. +// +// Popup wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Popup struct { + _ [0]func() // equal guard + Surface +} + +var ( + _ Surfacer = (*Popup)(nil) +) + +// Popupper describes Popup's interface methods. +type Popupper interface { + coreglib.Objector + + // Autohide returns whether this popup is set to hide on outside clicks. + Autohide() bool + // Parent returns the parent surface of a popup. + Parent() Surfacer + // PositionX obtains the position of the popup relative to its parent. + PositionX() int + // PositionY obtains the position of the popup relative to its parent. + PositionY() int + // RectAnchor gets the current popup rectangle anchor. + RectAnchor() Gravity + // SurfaceAnchor gets the current popup surface anchor. + SurfaceAnchor() Gravity + // Present popup after having processed the GdkPopupLayout rules. + Present(width, height int, layout *PopupLayout) bool +} + +var _ Popupper = (*Popup)(nil) + +func wrapPopup(obj *coreglib.Object) *Popup { + return &Popup{ + Surface: Surface{ + Object: obj, + }, + } +} + +func marshalPopup(p uintptr) (interface{}, error) { + return wrapPopup(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Autohide returns whether this popup is set to hide on outside clicks. +// +// The function returns the following values: +// +// - ok: TRUE if popup will autohide. +func (popup *Popup) Autohide() bool { + var _arg0 *C.GdkPopup // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPopup)(unsafe.Pointer(coreglib.InternObject(popup).Native())) + + _cret = C.gdk_popup_get_autohide(_arg0) + runtime.KeepAlive(popup) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Parent returns the parent surface of a popup. +// +// The function returns the following values: +// +// - surface (optional): parent surface. +func (popup *Popup) Parent() Surfacer { + var _arg0 *C.GdkPopup // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GdkPopup)(unsafe.Pointer(coreglib.InternObject(popup).Native())) + + _cret = C.gdk_popup_get_parent(_arg0) + runtime.KeepAlive(popup) + + var _surface Surfacer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Surfacer) + return ok + }) + rv, ok := casted.(Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + } + + return _surface +} + +// PositionX obtains the position of the popup relative to its parent. +// +// The function returns the following values: +// +// - gint: x coordinate of popup position. +func (popup *Popup) PositionX() int { + var _arg0 *C.GdkPopup // out + var _cret C.int // in + + _arg0 = (*C.GdkPopup)(unsafe.Pointer(coreglib.InternObject(popup).Native())) + + _cret = C.gdk_popup_get_position_x(_arg0) + runtime.KeepAlive(popup) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// PositionY obtains the position of the popup relative to its parent. +// +// The function returns the following values: +// +// - gint: y coordinate of popup position. +func (popup *Popup) PositionY() int { + var _arg0 *C.GdkPopup // out + var _cret C.int // in + + _arg0 = (*C.GdkPopup)(unsafe.Pointer(coreglib.InternObject(popup).Native())) + + _cret = C.gdk_popup_get_position_y(_arg0) + runtime.KeepAlive(popup) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// RectAnchor gets the current popup rectangle anchor. +// +// The value returned may change after calling gdk.Popup.Present(), or after the +// gdk.Surface::layout signal is emitted. +// +// The function returns the following values: +// +// - gravity: current rectangle anchor value of popup. +func (popup *Popup) RectAnchor() Gravity { + var _arg0 *C.GdkPopup // out + var _cret C.GdkGravity // in + + _arg0 = (*C.GdkPopup)(unsafe.Pointer(coreglib.InternObject(popup).Native())) + + _cret = C.gdk_popup_get_rect_anchor(_arg0) + runtime.KeepAlive(popup) + + var _gravity Gravity // out + + _gravity = Gravity(_cret) + + return _gravity +} + +// SurfaceAnchor gets the current popup surface anchor. +// +// The value returned may change after calling gdk.Popup.Present(), or after the +// gdk.Surface::layout signal is emitted. +// +// The function returns the following values: +// +// - gravity: current surface anchor value of popup. +func (popup *Popup) SurfaceAnchor() Gravity { + var _arg0 *C.GdkPopup // out + var _cret C.GdkGravity // in + + _arg0 = (*C.GdkPopup)(unsafe.Pointer(coreglib.InternObject(popup).Native())) + + _cret = C.gdk_popup_get_surface_anchor(_arg0) + runtime.KeepAlive(popup) + + var _gravity Gravity // out + + _gravity = Gravity(_cret) + + return _gravity +} + +// Present popup after having processed the GdkPopupLayout rules. +// +// If the popup was previously now showing, it will be showed, otherwise it will +// change position according to layout. +// +// After calling this function, the result should be handled in response to +// the gdk.Surface::layout signal being emitted. The resulting popup position +// can be queried using gdk.Popup.GetPositionX(), gdk.Popup.GetPositionY(), +// and the resulting size will be sent as parameters in the layout signal. +// Use gdk.Popup.GetRectAnchor() and gdk.Popup.GetSurfaceAnchor() to get the +// resulting anchors. +// +// Presenting may fail, for example if the popup is set to autohide and +// is immediately hidden upon being presented. If presenting failed, the +// gdk.Surface::layout signal will not me emitted. +// +// The function takes the following parameters: +// +// - width: unconstrained popup width to layout. +// - height: unconstrained popup height to layout. +// - layout: GdkPopupLayout object used to layout. +// +// The function returns the following values: +// +// - ok: FALSE if it failed to be presented, otherwise TRUE. +func (popup *Popup) Present(width, height int, layout *PopupLayout) bool { + var _arg0 *C.GdkPopup // out + var _arg1 C.int // out + var _arg2 C.int // out + var _arg3 *C.GdkPopupLayout // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPopup)(unsafe.Pointer(coreglib.InternObject(popup).Native())) + _arg1 = C.int(width) + _arg2 = C.int(height) + _arg3 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_popup_present(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(popup) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(layout) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Toplevel: GdkToplevel is a freestanding toplevel surface. +// +// The GdkToplevel interface provides useful APIs for interacting with the +// windowing system, such as controlling maximization and size of the surface, +// setting icons and transient parents for dialogs. +// +// Toplevel wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Toplevel struct { + _ [0]func() // equal guard + Surface +} + +var ( + _ Surfacer = (*Toplevel)(nil) +) + +// Topleveller describes Toplevel's interface methods. +type Topleveller interface { + coreglib.Objector + + // BeginMove begins an interactive move operation. + BeginMove(device Devicer, button int, x, y float64, timestamp uint32) + // BeginResize begins an interactive resize operation. + BeginResize(edge SurfaceEdge, device Devicer, button int, x, y float64, timestamp uint32) + // Focus sets keyboard focus to surface. + Focus(timestamp uint32) + // State gets the bitwise or of the currently active surface state flags, + // from the GdkToplevelState enumeration. + State() ToplevelState + // InhibitSystemShortcuts requests that the toplevel inhibit the system + // shortcuts. + InhibitSystemShortcuts(event Eventer) + // Lower asks to lower the toplevel below other windows. + Lower() bool + // Minimize asks to minimize the toplevel. + Minimize() bool + // Present toplevel after having processed the GdkToplevelLayout rules. + Present(layout *ToplevelLayout) + // RestoreSystemShortcuts: restore default system keyboard shortcuts which + // were previously inhibited. + RestoreSystemShortcuts() + // SetDecorated sets the toplevel to be decorated. + SetDecorated(decorated bool) + // SetDeletable sets the toplevel to be deletable. + SetDeletable(deletable bool) + // SetIconList sets a list of icons for the surface. + SetIconList(surfaces []Texturer) + // SetModal sets the toplevel to be modal. + SetModal(modal bool) + // SetStartupID sets the startup notification ID. + SetStartupID(startupId string) + // SetTitle sets the title of a toplevel surface. + SetTitle(title string) + // SetTransientFor sets a transient-for parent. + SetTransientFor(parent Surfacer) + // ShowWindowMenu asks the windowing system to show the window menu. + ShowWindowMenu(event Eventer) bool + // SupportsEdgeConstraints returns whether the desktop environment supports + // tiled window states. + SupportsEdgeConstraints() bool + TitlebarGesture(gesture TitlebarGesture) bool +} + +var _ Topleveller = (*Toplevel)(nil) + +func wrapToplevel(obj *coreglib.Object) *Toplevel { + return &Toplevel{ + Surface: Surface{ + Object: obj, + }, + } +} + +func marshalToplevel(p uintptr) (interface{}, error) { + return wrapToplevel(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// BeginMove begins an interactive move operation. +// +// You might use this function to implement draggable titlebars. +// +// The function takes the following parameters: +// +// - device used for the operation. +// - button being used to drag, or 0 for a keyboard-initiated drag. +// - x: surface X coordinate of mouse click that began the drag. +// - y: surface Y coordinate of mouse click that began the drag. +// - timestamp of mouse click that began the drag (use gdk.Event.GetTime()). +func (toplevel *Toplevel) BeginMove(device Devicer, button int, x, y float64, timestamp uint32) { + var _arg0 *C.GdkToplevel // out + var _arg1 *C.GdkDevice // out + var _arg2 C.int // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.guint32 // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + _arg1 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + _arg2 = C.int(button) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = C.guint32(timestamp) + + C.gdk_toplevel_begin_move(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(device) + runtime.KeepAlive(button) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(timestamp) +} + +// BeginResize begins an interactive resize operation. +// +// You might use this function to implement a “window resize grip.”. +// +// The function takes the following parameters: +// +// - edge or corner from which the drag is started. +// - device (optional) used for the operation. +// - button being used to drag, or 0 for a keyboard-initiated drag. +// - x: surface X coordinate of mouse click that began the drag. +// - y: surface Y coordinate of mouse click that began the drag. +// - timestamp of mouse click that began the drag (use gdk.Event.GetTime()). +func (toplevel *Toplevel) BeginResize(edge SurfaceEdge, device Devicer, button int, x, y float64, timestamp uint32) { + var _arg0 *C.GdkToplevel // out + var _arg1 C.GdkSurfaceEdge // out + var _arg2 *C.GdkDevice // out + var _arg3 C.int // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.guint32 // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + _arg1 = C.GdkSurfaceEdge(edge) + if device != nil { + _arg2 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + } + _arg3 = C.int(button) + _arg4 = C.double(x) + _arg5 = C.double(y) + _arg6 = C.guint32(timestamp) + + C.gdk_toplevel_begin_resize(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(edge) + runtime.KeepAlive(device) + runtime.KeepAlive(button) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(timestamp) +} + +// Focus sets keyboard focus to surface. +// +// In most cases, gtk_window_present_with_time() +// (../gtk4/method.Window.present_with_time.html) should be used on a GtkWindow +// (../gtk4/class.Window.html), rather than calling this function. +// +// The function takes the following parameters: +// +// - timestamp of the event triggering the surface focus. +func (toplevel *Toplevel) Focus(timestamp uint32) { + var _arg0 *C.GdkToplevel // out + var _arg1 C.guint32 // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + _arg1 = C.guint32(timestamp) + + C.gdk_toplevel_focus(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(timestamp) +} + +// State gets the bitwise or of the currently active surface state flags, +// from the GdkToplevelState enumeration. +// +// The function returns the following values: +// +// - toplevelState: surface state bitfield. +func (toplevel *Toplevel) State() ToplevelState { + var _arg0 *C.GdkToplevel // out + var _cret C.GdkToplevelState // in + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + + _cret = C.gdk_toplevel_get_state(_arg0) + runtime.KeepAlive(toplevel) + + var _toplevelState ToplevelState // out + + _toplevelState = ToplevelState(_cret) + + return _toplevelState +} + +// InhibitSystemShortcuts requests that the toplevel inhibit the system +// shortcuts. +// +// This is asking the desktop environment/windowing system to let all keyboard +// events reach the surface, as long as it is focused, instead of triggering +// system actions. +// +// If granted, the rerouting remains active until the default shortcuts +// processing is restored with gdk.Toplevel.RestoreSystemShortcuts(), or the +// request is revoked by the desktop environment, windowing system or the user. +// +// A typical use case for this API is remote desktop or virtual machine viewers +// which need to inhibit the default system keyboard shortcuts so that the +// remote session or virtual host gets those instead of the local environment. +// +// The windowing system or desktop environment may ask the user to grant or deny +// the request or even choose to ignore the request entirely. +// +// The caller can be notified whenever the request is granted or revoked by +// listening to the gdk.Toplevel:shortcuts-inhibited property. +// +// The function takes the following parameters: +// +// - event (optional): GdkEvent that is triggering the inhibit request, +// or NULL if none is available. +func (toplevel *Toplevel) InhibitSystemShortcuts(event Eventer) { + var _arg0 *C.GdkToplevel // out + var _arg1 *C.GdkEvent // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + if event != nil { + _arg1 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + } + + C.gdk_toplevel_inhibit_system_shortcuts(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(event) +} + +// Lower asks to lower the toplevel below other windows. +// +// The windowing system may choose to ignore the request. +// +// The function returns the following values: +// +// - ok: TRUE if the surface was lowered. +func (toplevel *Toplevel) Lower() bool { + var _arg0 *C.GdkToplevel // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + + _cret = C.gdk_toplevel_lower(_arg0) + runtime.KeepAlive(toplevel) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Minimize asks to minimize the toplevel. +// +// The windowing system may choose to ignore the request. +// +// The function returns the following values: +// +// - ok: TRUE if the surface was minimized. +func (toplevel *Toplevel) Minimize() bool { + var _arg0 *C.GdkToplevel // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + + _cret = C.gdk_toplevel_minimize(_arg0) + runtime.KeepAlive(toplevel) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Present toplevel after having processed the GdkToplevelLayout rules. +// +// If the toplevel was previously not showing, it will be showed, otherwise it +// will change layout according to layout. +// +// GDK may emit the gdk.Toplevel::compute-size signal to let the user of this +// toplevel compute the preferred size of the toplevel surface. +// +// Presenting is asynchronous and the specified layout parameters are not +// guaranteed to be respected. +// +// The function takes the following parameters: +// +// - layout: GdkToplevelLayout object used to layout. +func (toplevel *Toplevel) Present(layout *ToplevelLayout) { + var _arg0 *C.GdkToplevel // out + var _arg1 *C.GdkToplevelLayout // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + _arg1 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + C.gdk_toplevel_present(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(layout) +} + +// RestoreSystemShortcuts: restore default system keyboard shortcuts which were +// previously inhibited. +// +// This undoes the effect of gdk.Toplevel.InhibitSystemShortcuts(). +func (toplevel *Toplevel) RestoreSystemShortcuts() { + var _arg0 *C.GdkToplevel // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + + C.gdk_toplevel_restore_system_shortcuts(_arg0) + runtime.KeepAlive(toplevel) +} + +// SetDecorated sets the toplevel to be decorated. +// +// Setting decorated to FALSE hints the desktop environment that the surface has +// its own, client-side decorations and does not need to have window decorations +// added. +// +// The function takes the following parameters: +// +// - decorated: TRUE to request decorations. +func (toplevel *Toplevel) SetDecorated(decorated bool) { + var _arg0 *C.GdkToplevel // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + if decorated { + _arg1 = C.TRUE + } + + C.gdk_toplevel_set_decorated(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(decorated) +} + +// SetDeletable sets the toplevel to be deletable. +// +// Setting deletable to TRUE hints the desktop environment that it should offer +// the user a way to close the surface. +// +// The function takes the following parameters: +// +// - deletable: TRUE to request a delete button. +func (toplevel *Toplevel) SetDeletable(deletable bool) { + var _arg0 *C.GdkToplevel // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + if deletable { + _arg1 = C.TRUE + } + + C.gdk_toplevel_set_deletable(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(deletable) +} + +// SetIconList sets a list of icons for the surface. +// +// One of these will be used to represent the surface in iconic form. The icon +// may be shown in window lists or task bars. Which icon size is shown depends +// on the window manager. The window manager can scale the icon but setting +// several size icons can give better image quality. +// +// Note that some platforms don't support surface icons. +// +// The function takes the following parameters: +// +// - surfaces: A list of textures to use as icon, of different sizes. +func (toplevel *Toplevel) SetIconList(surfaces []Texturer) { + var _arg0 *C.GdkToplevel // out + var _arg1 *C.GList // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + for i := len(surfaces) - 1; i >= 0; i-- { + src := surfaces[i] + var dst *C.GdkTexture // out + dst = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = C.g_list_prepend(_arg1, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg1) + + C.gdk_toplevel_set_icon_list(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(surfaces) +} + +// SetModal sets the toplevel to be modal. +// +// The application can use this hint to tell the window manager that a certain +// surface has modal behaviour. The window manager can use this information to +// handle modal surfaces in a special way. +// +// You should only use this on surfaces for which you have previously called +// gdk.Toplevel.SetTransientFor(). +// +// The function takes the following parameters: +// +// - modal: TRUE if the surface is modal, FALSE otherwise. +func (toplevel *Toplevel) SetModal(modal bool) { + var _arg0 *C.GdkToplevel // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + if modal { + _arg1 = C.TRUE + } + + C.gdk_toplevel_set_modal(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(modal) +} + +// SetStartupID sets the startup notification ID. +// +// When using GTK, typically you should use gtk_window_set_startup_id() +// (../gtk4/method.Window.set_startup_id.html) instead of this low-level +// function. +// +// The function takes the following parameters: +// +// - startupId: string with startup-notification identifier. +func (toplevel *Toplevel) SetStartupID(startupId string) { + var _arg0 *C.GdkToplevel // out + var _arg1 *C.char // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(startupId))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gdk_toplevel_set_startup_id(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(startupId) +} + +// SetTitle sets the title of a toplevel surface. +// +// The title maybe be displayed in the titlebar, in lists of windows, etc. +// +// The function takes the following parameters: +// +// - title of surface. +func (toplevel *Toplevel) SetTitle(title string) { + var _arg0 *C.GdkToplevel // out + var _arg1 *C.char // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(title))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gdk_toplevel_set_title(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(title) +} + +// SetTransientFor sets a transient-for parent. +// +// Indicates to the window manager that surface is a transient dialog associated +// with the application surface parent. This allows the window manager to do +// things like center surface on parent and keep surface above parent. +// +// See gtk_window_set_transient_for() +// (../gtk4/method.Window.set_transient_for.html) if you’re using GtkWindow +// (../gtk4/class.Window.html). +// +// The function takes the following parameters: +// +// - parent: another toplevel GdkSurface. +func (toplevel *Toplevel) SetTransientFor(parent Surfacer) { + var _arg0 *C.GdkToplevel // out + var _arg1 *C.GdkSurface // out + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + _arg1 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + + C.gdk_toplevel_set_transient_for(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(parent) +} + +// ShowWindowMenu asks the windowing system to show the window menu. +// +// The window menu is the menu shown when right-clicking the titlebar on +// traditional windows managed by the window manager. This is useful for windows +// using client-side decorations, activating it with a right-click on the window +// decorations. +// +// The function takes the following parameters: +// +// - event: GdkEvent to show the menu for. +// +// The function returns the following values: +// +// - ok: TRUE if the window menu was shown and FALSE otherwise. +func (toplevel *Toplevel) ShowWindowMenu(event Eventer) bool { + var _arg0 *C.GdkToplevel // out + var _arg1 *C.GdkEvent // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + _arg1 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_toplevel_show_window_menu(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(event) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SupportsEdgeConstraints returns whether the desktop environment supports +// tiled window states. +// +// The function returns the following values: +// +// - ok: TRUE if the desktop environment supports tiled window states. +func (toplevel *Toplevel) SupportsEdgeConstraints() bool { + var _arg0 *C.GdkToplevel // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + + _cret = C.gdk_toplevel_supports_edge_constraints(_arg0) + runtime.KeepAlive(toplevel) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// The function takes the following parameters: +// +// - gesture: GdkTitlebarGesture. +func (toplevel *Toplevel) TitlebarGesture(gesture TitlebarGesture) bool { + var _arg0 *C.GdkToplevel // out + var _arg1 C.GdkTitlebarGesture // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkToplevel)(unsafe.Pointer(coreglib.InternObject(toplevel).Native())) + _arg1 = C.GdkTitlebarGesture(gesture) + + _cret = C.gdk_toplevel_titlebar_gesture(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(gesture) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// AppLaunchContext: GdkAppLaunchContext handles launching an application in a +// graphical context. +// +// It is an implementation of GAppLaunchContext that provides startup +// notification and allows to launch applications on a specific workspace. +// +// Launching an application +// +// GdkAppLaunchContext *context; +// +// context = gdk_display_get_app_launch_context (display); +// +// gdk_app_launch_context_set_timestamp (gdk_event_get_time (event)); +// +// if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error)) +// g_warning ("Launching failed: s\n", error->message); +// +// g_object_unref (context);. +type AppLaunchContext struct { + _ [0]func() // equal guard + gio.AppLaunchContext +} + +var ( + _ coreglib.Objector = (*AppLaunchContext)(nil) +) + +func wrapAppLaunchContext(obj *coreglib.Object) *AppLaunchContext { + return &AppLaunchContext{ + AppLaunchContext: gio.AppLaunchContext{ + Object: obj, + }, + } +} + +func marshalAppLaunchContext(p uintptr) (interface{}, error) { + return wrapAppLaunchContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Display gets the GdkDisplay that context is for. +// +// The function returns the following values: +// +// - display of context. +func (context *AppLaunchContext) Display() *Display { + var _arg0 *C.GdkAppLaunchContext // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_app_launch_context_get_display(_arg0) + runtime.KeepAlive(context) + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + + return _display +} + +// SetDesktop sets the workspace on which applications will be launched. +// +// This only works when running under a window manager that supports +// multiple workspaces, as described in the Extended Window Manager Hints +// (http://www.freedesktop.org/Standards/wm-spec). Specifically this sets the +// _NET_WM_DESKTOP property described in that spec. +// +// This only works when using the X11 backend. +// +// When the workspace is not specified or desktop is set to -1, it is up to the +// window manager to pick one, typically it will be the current workspace. +// +// The function takes the following parameters: +// +// - desktop: number of a workspace, or -1. +func (context *AppLaunchContext) SetDesktop(desktop int) { + var _arg0 *C.GdkAppLaunchContext // out + var _arg1 C.int // out + + _arg0 = (*C.GdkAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = C.int(desktop) + + C.gdk_app_launch_context_set_desktop(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(desktop) +} + +// SetIcon sets the icon for applications that are launched with this context. +// +// Window Managers can use this information when displaying startup +// notification. +// +// See also gdk.AppLaunchContext.SetIconName(). +// +// The function takes the following parameters: +// +// - icon (optional): GIcon. +func (context *AppLaunchContext) SetIcon(icon gio.Iconner) { + var _arg0 *C.GdkAppLaunchContext // out + var _arg1 *C.GIcon // out + + _arg0 = (*C.GdkAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + if icon != nil { + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + } + + C.gdk_app_launch_context_set_icon(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(icon) +} + +// SetIconName sets the icon for applications that are launched with this +// context. +// +// The icon_name will be interpreted in the same way as the Icon field in +// desktop files. See also gdk.AppLaunchContext.SetIcon(). +// +// If both icon and icon_name are set, the icon_name takes priority. +// If neither icon or icon_name is set, the icon is taken from either the file +// that is passed to launched application or from the GAppInfo for the launched +// application itself. +// +// The function takes the following parameters: +// +// - iconName (optional): icon name. +func (context *AppLaunchContext) SetIconName(iconName string) { + var _arg0 *C.GdkAppLaunchContext // out + var _arg1 *C.char // out + + _arg0 = (*C.GdkAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + if iconName != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(iconName))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gdk_app_launch_context_set_icon_name(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(iconName) +} + +// SetTimestamp sets the timestamp of context. +// +// The timestamp should ideally be taken from the event that triggered the +// launch. +// +// Window managers can use this information to avoid moving the focus to the +// newly launched application when the user is busy typing in another window. +// This is also known as 'focus stealing prevention'. +// +// The function takes the following parameters: +// +// - timestamp: timestamp. +func (context *AppLaunchContext) SetTimestamp(timestamp uint32) { + var _arg0 *C.GdkAppLaunchContext // out + var _arg1 C.guint32 // out + + _arg0 = (*C.GdkAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = C.guint32(timestamp) + + C.gdk_app_launch_context_set_timestamp(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(timestamp) +} + +// ButtonEvent: event related to a button on a pointer device. +type ButtonEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*ButtonEvent)(nil) +) + +func wrapButtonEvent(obj *coreglib.Object) *ButtonEvent { + return &ButtonEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalButtonEvent(p uintptr) (interface{}, error) { + return wrapButtonEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Button: extract the button number from a button event. +// +// The function returns the following values: +// +// - guint: button of event. +func (event *ButtonEvent) Button() uint { + var _arg0 *C.GdkEvent // out + var _cret C.guint // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_button_event_get_button(_arg0) + runtime.KeepAlive(event) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// CairoContext: GdkCairoContext is an object representing the platform-specific +// draw context. +// +// GdkCairoContexts are created for a surface using +// gdk.Surface.CreateCairoContext(), and the context can then be used to draw on +// that surface. +type CairoContext struct { + _ [0]func() // equal guard + DrawContext +} + +var ( + _ DrawContexter = (*CairoContext)(nil) +) + +// CairoContexter describes types inherited from class CairoContext. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type CairoContexter interface { + coreglib.Objector + baseCairoContext() *CairoContext +} + +var _ CairoContexter = (*CairoContext)(nil) + +func wrapCairoContext(obj *coreglib.Object) *CairoContext { + return &CairoContext{ + DrawContext: DrawContext{ + Object: obj, + }, + } +} + +func marshalCairoContext(p uintptr) (interface{}, error) { + return wrapCairoContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (self *CairoContext) baseCairoContext() *CairoContext { + return self +} + +// BaseCairoContext returns the underlying base object. +func BaseCairoContext(obj CairoContexter) *CairoContext { + return obj.baseCairoContext() +} + +// CairoCreate retrieves a Cairo context to be used to draw on the GdkSurface of +// context. +// +// A call to gdk.DrawContext.BeginFrame() with this context must have been done +// or this function will return NULL. +// +// The returned context is guaranteed to be valid until +// gdk.DrawContext.EndFrame() is called. +// +// The function returns the following values: +// +// - context (optional): cairo context to draw on `GdkSurface. +func (self *CairoContext) CairoCreate() *cairo.Context { + var _arg0 *C.GdkCairoContext // out + var _cret *C.cairo_t // in + + _arg0 = (*C.GdkCairoContext)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_cairo_context_cairo_create(_arg0) + runtime.KeepAlive(self) + + var _context *cairo.Context // out + + if _cret != nil { + _context = cairo.WrapContext(uintptr(unsafe.Pointer(_cret))) + runtime.SetFinalizer(_context, func(v *cairo.Context) { + C.cairo_destroy((*C.cairo_t)(unsafe.Pointer(v.Native()))) + }) + } + + return _context +} + +// Clipboard: GdkClipboard object represents data shared between applications or +// inside an application. +// +// To get a GdkClipboard object, use gdk.Display.GetClipboard() or +// gdk.Display.GetPrimaryClipboard(). You can find out about the data that is +// currently available in a clipboard using gdk.Clipboard.GetFormats(). +// +// To make text or image data available in a clipboard, use +// gdk.Clipboard.SetText() or gdk.Clipboard.SetTexture(). For other data, you +// can use gdk.Clipboard.SetContent(), which takes a gdk.ContentProvider object. +// +// To read textual or image data from a clipboard, use +// gdk.Clipboard.ReadTextAsync() or gdk.Clipboard.ReadTextureAsync(). For other +// data, use gdk.Clipboard.ReadAsync(), which provides a GInputStream object. +type Clipboard struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Clipboard)(nil) +) + +func wrapClipboard(obj *coreglib.Object) *Clipboard { + return &Clipboard{ + Object: obj, + } +} + +func marshalClipboard(p uintptr) (interface{}, error) { + return wrapClipboard(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectChanged is emitted when the clipboard changes ownership. +func (clipboard *Clipboard) ConnectChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(clipboard, "changed", false, unsafe.Pointer(C._gotk4_gdk4_Clipboard_ConnectChanged), f) +} + +// Content returns the GdkContentProvider currently set on clipboard. +// +// If the clipboard is empty or its contents are not owned by the current +// process, NULL will be returned. +// +// The function returns the following values: +// +// - contentProvider (optional): content of a clipboard if the clipboard does +// not maintain any content. +func (clipboard *Clipboard) Content() *ContentProvider { + var _arg0 *C.GdkClipboard // out + var _cret *C.GdkContentProvider // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + + _cret = C.gdk_clipboard_get_content(_arg0) + runtime.KeepAlive(clipboard) + + var _contentProvider *ContentProvider // out + + if _cret != nil { + _contentProvider = wrapContentProvider(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _contentProvider +} + +// Display gets the GdkDisplay that the clipboard was created for. +// +// The function returns the following values: +// +// - display: GdkDisplay. +func (clipboard *Clipboard) Display() *Display { + var _arg0 *C.GdkClipboard // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + + _cret = C.gdk_clipboard_get_display(_arg0) + runtime.KeepAlive(clipboard) + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + + return _display +} + +// Formats gets the formats that the clipboard can provide its current contents +// in. +// +// The function returns the following values: +// +// - contentFormats formats of the clipboard. +func (clipboard *Clipboard) Formats() *ContentFormats { + var _arg0 *C.GdkClipboard // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + + _cret = C.gdk_clipboard_get_formats(_arg0) + runtime.KeepAlive(clipboard) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gdk_content_formats_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// IsLocal returns if the clipboard is local. +// +// A clipboard is considered local if it was last claimed by the running +// application. +// +// Note that gdk.Clipboard.GetContent() may return NULL even on a local +// clipboard. In this case the clipboard is empty. +// +// The function returns the following values: +// +// - ok: TRUE if the clipboard is local. +func (clipboard *Clipboard) IsLocal() bool { + var _arg0 *C.GdkClipboard // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + + _cret = C.gdk_clipboard_is_local(_arg0) + runtime.KeepAlive(clipboard) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ReadAsync: asynchronously requests an input stream to read the clipboard's +// contents from. +// +// When the operation is finished callback will be called. You must then call +// gdk.Clipboard.ReadFinish() to get the result of the operation. +// +// The clipboard will choose the most suitable mime type from the given list to +// fulfill the request, preferring the ones listed first. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object. +// - mimeTypes: NULL-terminated array of mime types to choose from. +// - ioPriority: i/O priority of the request. +// - callback (optional) to call when the request is satisfied. +func (clipboard *Clipboard) ReadAsync(ctx context.Context, mimeTypes []string, ioPriority int, callback gio.AsyncReadyCallback) { + var _arg0 *C.GdkClipboard // out + var _arg3 *C.GCancellable // out + var _arg1 **C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + { + _arg1 = (**C.char)(C.calloc(C.size_t((len(mimeTypes) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(mimeTypes)+1) + var zero *C.char + out[len(mimeTypes)] = zero + for i := range mimeTypes { + out[i] = (*C.char)(unsafe.Pointer(C.CString(mimeTypes[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_clipboard_read_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(ctx) + runtime.KeepAlive(mimeTypes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadFinish finishes an asynchronous clipboard read. +// +// See gdk.Clipboard.ReadAsync(). +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +// +// The function returns the following values: +// +// - outMimeType (optional): location to store the chosen mime type. +// - inputStream (optional): GInputStream. +func (clipboard *Clipboard) ReadFinish(result gio.AsyncResulter) (string, gio.InputStreamer, error) { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.char // in + var _cret *C.GInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.gdk_clipboard_read_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(result) + + var _outMimeType string // out + var _inputStream gio.InputStreamer // out + var _goerr error // out + + if _arg2 != nil { + _outMimeType = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + } + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gio.InputStreamer) + return ok + }) + rv, ok := casted.(gio.InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _outMimeType, _inputStream, _goerr +} + +// ReadTextAsync: asynchronously request the clipboard contents converted to a +// string. +// +// When the operation is finished callback will be called. You must then call +// gdk.Clipboard.ReadTextFinish() to get the result. +// +// This is a simple wrapper around gdk.Clipboard.ReadValueAsync(). Use that +// function or gdk.Clipboard.ReadAsync() directly if you need more control over +// the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object. +// - callback (optional) to call when the request is satisfied. +func (clipboard *Clipboard) ReadTextAsync(ctx context.Context, callback gio.AsyncReadyCallback) { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_clipboard_read_text_async(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// ReadTextFinish finishes an asynchronous clipboard read. +// +// See gdk.Clipboard.ReadTextAsync(). +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +// +// The function returns the following values: +// +// - utf8 (optional): new string. +func (clipboard *Clipboard) ReadTextFinish(result gio.AsyncResulter) (string, error) { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GAsyncResult // out + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.gdk_clipboard_read_text_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(result) + + var _utf8 string // out + var _goerr error // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// ReadTextureAsync: asynchronously request the clipboard contents converted to +// a GdkPixbuf. +// +// When the operation is finished callback will be called. You must then call +// gdk.Clipboard.ReadTextureFinish() to get the result. +// +// This is a simple wrapper around gdk.Clipboard.ReadValueAsync(). Use that +// function or gdk.Clipboard.ReadAsync() directly if you need more control over +// the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - callback (optional) to call when the request is satisfied. +func (clipboard *Clipboard) ReadTextureAsync(ctx context.Context, callback gio.AsyncReadyCallback) { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_clipboard_read_texture_async(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// ReadTextureFinish finishes an asynchronous clipboard read. +// +// See gdk.Clipboard.ReadTextureAsync(). +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +// +// The function returns the following values: +// +// - texture (optional): new GdkTexture. +func (clipboard *Clipboard) ReadTextureFinish(result gio.AsyncResulter) (Texturer, error) { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GdkTexture // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.gdk_clipboard_read_texture_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(result) + + var _texture Texturer // out + var _goerr error // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Texturer) + return ok + }) + rv, ok := casted.(Texturer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") + } + _texture = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _texture, _goerr +} + +// ReadValueAsync: asynchronously request the clipboard contents converted to +// the given type. +// +// When the operation is finished callback will be called. You must then call +// gdk.Clipboard.ReadValueFinish() to get the resulting GValue. +// +// For local clipboard contents that are available in the given GType, +// the value will be copied directly. Otherwise, GDK will try to use +// content_deserialize_async to convert the clipboard's data. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object. +// - typ: GType to read. +// - ioPriority: i/O priority of the request. +// - callback (optional) to call when the request is satisfied. +func (clipboard *Clipboard) ReadValueAsync(ctx context.Context, typ coreglib.Type, ioPriority int, callback gio.AsyncReadyCallback) { + var _arg0 *C.GdkClipboard // out + var _arg3 *C.GCancellable // out + var _arg1 C.GType // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GType(typ) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_clipboard_read_value_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(ctx) + runtime.KeepAlive(typ) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadValueFinish finishes an asynchronous clipboard read. +// +// See gdk.Clipboard.ReadValueAsync(). +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +// +// The function returns the following values: +// +// - value: GValue containing the result. +func (clipboard *Clipboard) ReadValueFinish(result gio.AsyncResulter) (*coreglib.Value, error) { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GValue // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.gdk_clipboard_read_value_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(result) + + var _value *coreglib.Value // out + var _goerr error // out + + _value = coreglib.ValueFromNative(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _value, _goerr +} + +// SetContent sets a new content provider on clipboard. +// +// The clipboard will claim the GdkDisplay's resources and advertise these new +// contents to other applications. +// +// In the rare case of a failure, this function will return FALSE. The clipboard +// will then continue reporting its old contents and ignore provider. +// +// If the contents are read by either an external application or the clipboard's +// read functions, clipboard will select the best format to transfer the +// contents and then request that format from provider. +// +// The function takes the following parameters: +// +// - provider (optional): new contents of clipboard or NULL to clear the +// clipboard. +// +// The function returns the following values: +// +// - ok: TRUE if setting the clipboard succeeded. +func (clipboard *Clipboard) SetContent(provider *ContentProvider) bool { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GdkContentProvider // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + if provider != nil { + _arg1 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + } + + _cret = C.gdk_clipboard_set_content(_arg0, _arg1) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(provider) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetText puts the given text into the clipboard. +// +// The function takes the following parameters: +// +// - text: text to put into the clipboard. +func (clipboard *Clipboard) SetText(text string) { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.char // out + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(text))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gdk_clipboard_set_text(_arg0, _arg1) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(text) +} + +// SetTexture puts the given texture into the clipboard. +// +// The function takes the following parameters: +// +// - texture: GdkTexture to put into the clipboard. +func (clipboard *Clipboard) SetTexture(texture Texturer) { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GdkTexture // out + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + + C.gdk_clipboard_set_texture(_arg0, _arg1) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(texture) +} + +// Set sets the clipboard to contain the given value. +// +// The function takes the following parameters: +// +// - value: GValue to set. +func (clipboard *Clipboard) Set(value *coreglib.Value) { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GValue // out + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + + C.gdk_clipboard_set_value(_arg0, _arg1) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(value) +} + +// StoreAsync: asynchronously instructs the clipboard to store its contents +// remotely. +// +// If the clipboard is not local, this function does nothing but report success. +// +// The callback must call gdk.Clipboard.StoreFinish(). +// +// The purpose of this call is to preserve clipboard contents beyond the +// lifetime of an application, so this function is typically called on exit. +// Depending on the platform, the functionality may not be available unless a +// "clipboard manager" is running. +// +// This function is called automatically when a GtkApplication +// (../gtk4/class.Application.html) is shut down, so you likely don't need to +// call it. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object. +// - ioPriority: i/O priority of the request. +// - callback (optional) to call when the request is satisfied. +func (clipboard *Clipboard) StoreAsync(ctx context.Context, ioPriority int, callback gio.AsyncReadyCallback) { + var _arg0 *C.GdkClipboard // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_clipboard_store_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// StoreFinish finishes an asynchronous clipboard store. +// +// See gdk.Clipboard.StoreAsync(). +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +func (clipboard *Clipboard) StoreFinish(result gio.AsyncResulter) error { + var _arg0 *C.GdkClipboard // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.gdk_clipboard_store_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(clipboard) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ContentDeserializer: GdkContentDeserializer is used to deserialize content +// received via inter-application data transfers. +// +// The GdkContentDeserializer transforms serialized content that is identified +// by a mime type into an object identified by a GType. +// +// GTK provides serializers and deserializers for common data types such as +// text, colors, images or file lists. To register your own deserialization +// functions, use content_register_deserializer. +// +// Also see gdk.ContentSerializer. +type ContentDeserializer struct { + _ [0]func() // equal guard + *coreglib.Object + + gio.AsyncResult +} + +var ( + _ coreglib.Objector = (*ContentDeserializer)(nil) +) + +func wrapContentDeserializer(obj *coreglib.Object) *ContentDeserializer { + return &ContentDeserializer{ + Object: obj, + AsyncResult: gio.AsyncResult{ + Object: obj, + }, + } +} + +func marshalContentDeserializer(p uintptr) (interface{}, error) { + return wrapContentDeserializer(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Cancellable gets the cancellable for the current operation. +// +// This is the GCancellable that was passed to gdk.ContentDeserializeAsync(). +// +// The function returns the following values: +// +// - cancellable (optional) for the current operation. +func (deserializer *ContentDeserializer) Cancellable() *gio.Cancellable { + var _arg0 *C.GdkContentDeserializer // out + var _cret *C.GCancellable // in + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + + _cret = C.gdk_content_deserializer_get_cancellable(_arg0) + runtime.KeepAlive(deserializer) + + var _cancellable *gio.Cancellable // out + + if _cret != nil { + { + obj := coreglib.Take(unsafe.Pointer(_cret)) + _cancellable = &gio.Cancellable{ + Object: obj, + } + } + } + + return _cancellable +} + +// GType gets the GType to create an instance of. +// +// The function returns the following values: +// +// - gType: GType for the current operation. +func (deserializer *ContentDeserializer) GType() coreglib.Type { + var _arg0 *C.GdkContentDeserializer // out + var _cret C.GType // in + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + + _cret = C.gdk_content_deserializer_get_gtype(_arg0) + runtime.KeepAlive(deserializer) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// InputStream gets the input stream for the current operation. +// +// This is the stream that was passed to gdk.ContentDeserializeAsync(). +// +// The function returns the following values: +// +// - inputStream: input stream for the current operation. +func (deserializer *ContentDeserializer) InputStream() gio.InputStreamer { + var _arg0 *C.GdkContentDeserializer // out + var _cret *C.GInputStream // in + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + + _cret = C.gdk_content_deserializer_get_input_stream(_arg0) + runtime.KeepAlive(deserializer) + + var _inputStream gio.InputStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gio.InputStreamer) + return ok + }) + rv, ok := casted.(gio.InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + + return _inputStream +} + +// MIMEType gets the mime type to deserialize from. +// +// The function returns the following values: +// +// - utf8: mime type for the current operation. +func (deserializer *ContentDeserializer) MIMEType() string { + var _arg0 *C.GdkContentDeserializer // out + var _cret *C.char // in + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + + _cret = C.gdk_content_deserializer_get_mime_type(_arg0) + runtime.KeepAlive(deserializer) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Priority gets the I/O priority for the current operation. +// +// This is the priority that was passed to gdk.ContentDeserializeAsync(). +// +// The function returns the following values: +// +// - gint: i/O priority for the current operation. +func (deserializer *ContentDeserializer) Priority() int { + var _arg0 *C.GdkContentDeserializer // out + var _cret C.int // in + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + + _cret = C.gdk_content_deserializer_get_priority(_arg0) + runtime.KeepAlive(deserializer) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// TaskData gets the data that was associated with the current operation. +// +// See gdk.ContentDeserializer.SetTaskData(). +// +// The function returns the following values: +// +// - gpointer (optional): task data for deserializer. +func (deserializer *ContentDeserializer) TaskData() unsafe.Pointer { + var _arg0 *C.GdkContentDeserializer // out + var _cret C.gpointer // in + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + + _cret = C.gdk_content_deserializer_get_task_data(_arg0) + runtime.KeepAlive(deserializer) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// UserData gets the user data that was passed when the deserializer was +// registered. +// +// The function returns the following values: +// +// - gpointer (optional): user data for this deserializer. +func (deserializer *ContentDeserializer) UserData() unsafe.Pointer { + var _arg0 *C.GdkContentDeserializer // out + var _cret C.gpointer // in + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + + _cret = C.gdk_content_deserializer_get_user_data(_arg0) + runtime.KeepAlive(deserializer) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// Value gets the GValue to store the deserialized object in. +// +// The function returns the following values: +// +// - value: GValue for the current operation. +func (deserializer *ContentDeserializer) Value() *coreglib.Value { + var _arg0 *C.GdkContentDeserializer // out + var _cret *C.GValue // in + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + + _cret = C.gdk_content_deserializer_get_value(_arg0) + runtime.KeepAlive(deserializer) + + var _value *coreglib.Value // out + + _value = coreglib.ValueFromNative(unsafe.Pointer(_cret)) + + return _value +} + +// ReturnError: indicate that the deserialization has ended with an error. +// +// This function consumes error. +// +// The function takes the following parameters: +// +// - err: GError. +func (deserializer *ContentDeserializer) ReturnError(err error) { + var _arg0 *C.GdkContentDeserializer // out + var _arg1 *C.GError // out + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + + C.gdk_content_deserializer_return_error(_arg0, _arg1) + runtime.KeepAlive(deserializer) + runtime.KeepAlive(err) +} + +// ReturnSuccess: indicate that the deserialization has been successfully +// completed. +func (deserializer *ContentDeserializer) ReturnSuccess() { + var _arg0 *C.GdkContentDeserializer // out + + _arg0 = (*C.GdkContentDeserializer)(unsafe.Pointer(coreglib.InternObject(deserializer).Native())) + + C.gdk_content_deserializer_return_success(_arg0) + runtime.KeepAlive(deserializer) +} + +// ContentProviderOverrides contains methods that are overridable. +type ContentProviderOverrides struct { + AttachClipboard func(clipboard *Clipboard) + // ContentChanged emits the ::content-changed signal. + ContentChanged func() + DetachClipboard func(clipboard *Clipboard) + // Value gets the contents of provider stored in value. + // + // The value will have been initialized to the GType the value should be + // provided in. This given GType does not need to be listed in the formats + // returned by gdk.ContentProvider.RefFormats(). However, if the given GType + // is not supported, this operation can fail and G_IO_ERROR_NOT_SUPPORTED + // will be reported. + // + // The function returns the following values: + // + // - value: GValue to fill. + Value func() (coreglib.Value, error) + // RefFormats gets the formats that the provider can provide its current + // contents in. + // + // The function returns the following values: + // + // - contentFormats formats of the provider. + RefFormats func() *ContentFormats + // RefStorableFormats gets the formats that the provider suggests other + // applications to store the data in. + // + // An example of such an application would be a clipboard manager. + // + // This can be assumed to be a subset of gdk.ContentProvider.RefFormats(). + // + // The function returns the following values: + // + // - contentFormats: storable formats of the provider. + RefStorableFormats func() *ContentFormats + // WriteMIMETypeFinish finishes an asynchronous write operation. + // + // See gdk.ContentProvider.WriteMIMETypeAsync(). + // + // The function takes the following parameters: + // + // - result: GAsyncResult. + WriteMIMETypeFinish func(result gio.AsyncResulter) error +} + +func defaultContentProviderOverrides(v *ContentProvider) ContentProviderOverrides { + return ContentProviderOverrides{ + AttachClipboard: v.attachClipboard, + ContentChanged: v.contentChanged, + DetachClipboard: v.detachClipboard, + Value: v.value, + RefFormats: v.refFormats, + RefStorableFormats: v.refStorableFormats, + WriteMIMETypeFinish: v.writeMIMETypeFinish, + } +} + +// ContentProvider: GdkContentProvider is used to provide content for the +// clipboard or for drag-and-drop operations in a number of formats. +// +// To create a GdkContentProvider, use gdk.ContentProvider.NewForValue or +// gdk.ContentProvider.NewForBytes. +// +// GDK knows how to handle common text and image formats out-of-the-box. See +// gdk.ContentSerializer and gdk.ContentDeserializer if you want to add support +// for application-specific data formats. +type ContentProvider struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ContentProvider)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ContentProvider, *ContentProviderClass, ContentProviderOverrides]( + GTypeContentProvider, + initContentProviderClass, + wrapContentProvider, + defaultContentProviderOverrides, + ) +} + +func initContentProviderClass(gclass unsafe.Pointer, overrides ContentProviderOverrides, classInitFunc func(*ContentProviderClass)) { + pclass := (*C.GdkContentProviderClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeContentProvider)))) + + if overrides.AttachClipboard != nil { + pclass.attach_clipboard = (*[0]byte)(C._gotk4_gdk4_ContentProviderClass_attach_clipboard) + } + + if overrides.ContentChanged != nil { + pclass.content_changed = (*[0]byte)(C._gotk4_gdk4_ContentProviderClass_content_changed) + } + + if overrides.DetachClipboard != nil { + pclass.detach_clipboard = (*[0]byte)(C._gotk4_gdk4_ContentProviderClass_detach_clipboard) + } + + if overrides.Value != nil { + pclass.get_value = (*[0]byte)(C._gotk4_gdk4_ContentProviderClass_get_value) + } + + if overrides.RefFormats != nil { + pclass.ref_formats = (*[0]byte)(C._gotk4_gdk4_ContentProviderClass_ref_formats) + } + + if overrides.RefStorableFormats != nil { + pclass.ref_storable_formats = (*[0]byte)(C._gotk4_gdk4_ContentProviderClass_ref_storable_formats) + } + + if overrides.WriteMIMETypeFinish != nil { + pclass.write_mime_type_finish = (*[0]byte)(C._gotk4_gdk4_ContentProviderClass_write_mime_type_finish) + } + + if classInitFunc != nil { + class := (*ContentProviderClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapContentProvider(obj *coreglib.Object) *ContentProvider { + return &ContentProvider{ + Object: obj, + } +} + +func marshalContentProvider(p uintptr) (interface{}, error) { + return wrapContentProvider(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectContentChanged is emitted whenever the content provided by this +// provider has changed. +func (provider *ContentProvider) ConnectContentChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(provider, "content-changed", false, unsafe.Pointer(C._gotk4_gdk4_ContentProvider_ConnectContentChanged), f) +} + +// NewContentProviderForBytes: create a content provider that provides the given +// bytes as data for the given mime_type. +// +// The function takes the following parameters: +// +// - mimeType: mime type. +// - bytes: GBytes with the data for mime_type. +// +// The function returns the following values: +// +// - contentProvider: new GdkContentProvider. +func NewContentProviderForBytes(mimeType string, bytes *glib.Bytes) *ContentProvider { + var _arg1 *C.char // out + var _arg2 *C.GBytes // out + var _cret *C.GdkContentProvider // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + + _cret = C.gdk_content_provider_new_for_bytes(_arg1, _arg2) + runtime.KeepAlive(mimeType) + runtime.KeepAlive(bytes) + + var _contentProvider *ContentProvider // out + + _contentProvider = wrapContentProvider(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _contentProvider +} + +// NewContentProviderForValue: create a content provider that provides the given +// value. +// +// The function takes the following parameters: +// +// - value: GValue. +// +// The function returns the following values: +// +// - contentProvider: new GdkContentProvider. +func NewContentProviderForValue(value *coreglib.Value) *ContentProvider { + var _arg1 *C.GValue // out + var _cret *C.GdkContentProvider // in + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C.gdk_content_provider_new_for_value(_arg1) + runtime.KeepAlive(value) + + var _contentProvider *ContentProvider // out + + _contentProvider = wrapContentProvider(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _contentProvider +} + +// NewContentProviderUnion creates a content provider that represents all the +// given providers. +// +// Whenever data needs to be written, the union provider will try the given +// providers in the given order and the first one supporting a format will be +// chosen to provide it. +// +// This allows an easy way to support providing data in different formats. +// For example, an image may be provided by its file and by the image contents +// with a call such as +// +// gdk_content_provider_new_union ((GdkContentProvider *[2]) { +// gdk_content_provider_new_typed (G_TYPE_FILE, file), +// gdk_content_provider_new_typed (G_TYPE_TEXTURE, texture) +// }, 2);. +// +// The function takes the following parameters: +// +// - providers (optional): The GdkContentProviders to present the union of. +// +// The function returns the following values: +// +// - contentProvider: new GdkContentProvider. +func NewContentProviderUnion(providers []*ContentProvider) *ContentProvider { + var _arg1 **C.GdkContentProvider // out + var _arg2 C.gsize + var _cret *C.GdkContentProvider // in + + if providers != nil { + _arg2 = (C.gsize)(len(providers)) + _arg1 = (**C.GdkContentProvider)(C.calloc(C.size_t(len(providers)), C.size_t(unsafe.Sizeof(uint(0))))) + { + out := unsafe.Slice((**C.GdkContentProvider)(_arg1), len(providers)) + for i := range providers { + out[i] = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(providers[i]).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(providers[i]).Native())) + } + } + } + + _cret = C.gdk_content_provider_new_union(_arg1, _arg2) + runtime.KeepAlive(providers) + + var _contentProvider *ContentProvider // out + + _contentProvider = wrapContentProvider(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _contentProvider +} + +// ContentChanged emits the ::content-changed signal. +func (provider *ContentProvider) ContentChanged() { + var _arg0 *C.GdkContentProvider // out + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + + C.gdk_content_provider_content_changed(_arg0) + runtime.KeepAlive(provider) +} + +// Value gets the contents of provider stored in value. +// +// The value will have been initialized to the GType the value should be +// provided in. This given GType does not need to be listed in the formats +// returned by gdk.ContentProvider.RefFormats(). However, if the given GType is +// not supported, this operation can fail and G_IO_ERROR_NOT_SUPPORTED will be +// reported. +// +// The function returns the following values: +// +// - value: GValue to fill. +func (provider *ContentProvider) Value() (coreglib.Value, error) { + var _arg0 *C.GdkContentProvider // out + var _arg1 C.GValue // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + + C.gdk_content_provider_get_value(_arg0, &_arg1, &_cerr) + runtime.KeepAlive(provider) + + var _value coreglib.Value // out + var _goerr error // out + + _value = *coreglib.ValueFromNative(unsafe.Pointer((&_arg1))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _value, _goerr +} + +// RefFormats gets the formats that the provider can provide its current +// contents in. +// +// The function returns the following values: +// +// - contentFormats formats of the provider. +func (provider *ContentProvider) RefFormats() *ContentFormats { + var _arg0 *C.GdkContentProvider // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + + _cret = C.gdk_content_provider_ref_formats(_arg0) + runtime.KeepAlive(provider) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// RefStorableFormats gets the formats that the provider suggests other +// applications to store the data in. +// +// An example of such an application would be a clipboard manager. +// +// This can be assumed to be a subset of gdk.ContentProvider.RefFormats(). +// +// The function returns the following values: +// +// - contentFormats: storable formats of the provider. +func (provider *ContentProvider) RefStorableFormats() *ContentFormats { + var _arg0 *C.GdkContentProvider // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + + _cret = C.gdk_content_provider_ref_storable_formats(_arg0) + runtime.KeepAlive(provider) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// WriteMIMETypeAsync: asynchronously writes the contents of provider to stream +// in the given mime_type. +// +// When the operation is finished callback will be called. You must then call +// gdk.ContentProvider.WriteMIMETypeFinish() to get the result of the operation. +// +// The given mime type does not need to be listed in the formats returned +// by gdk.ContentProvider.RefFormats(). However, if the given GType is not +// supported, G_IO_ERROR_NOT_SUPPORTED will be reported. +// +// The given stream will not be closed. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - mimeType: mime type to provide the data in. +// - stream: GOutputStream to write to. +// - ioPriority: i/O priority of the request. +// - callback (optional) to call when the request is satisfied. +func (provider *ContentProvider) WriteMIMETypeAsync(ctx context.Context, mimeType string, stream gio.OutputStreamer, ioPriority int, callback gio.AsyncReadyCallback) { + var _arg0 *C.GdkContentProvider // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 *C.GOutputStream // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_content_provider_write_mime_type_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(provider) + runtime.KeepAlive(ctx) + runtime.KeepAlive(mimeType) + runtime.KeepAlive(stream) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// WriteMIMETypeFinish finishes an asynchronous write operation. +// +// See gdk.ContentProvider.WriteMIMETypeAsync(). +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +func (provider *ContentProvider) WriteMIMETypeFinish(result gio.AsyncResulter) error { + var _arg0 *C.GdkContentProvider // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.gdk_content_provider_write_mime_type_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(provider) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func (provider *ContentProvider) attachClipboard(clipboard *Clipboard) { + gclass := (*C.GdkContentProviderClass)(coreglib.PeekParentClass(provider)) + fnarg := gclass.attach_clipboard + + var _arg0 *C.GdkContentProvider // out + var _arg1 *C.GdkClipboard // out + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + _arg1 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + + C._gotk4_gdk4_ContentProvider_virtual_attach_clipboard(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(provider) + runtime.KeepAlive(clipboard) +} + +// contentChanged emits the ::content-changed signal. +func (provider *ContentProvider) contentChanged() { + gclass := (*C.GdkContentProviderClass)(coreglib.PeekParentClass(provider)) + fnarg := gclass.content_changed + + var _arg0 *C.GdkContentProvider // out + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + + C._gotk4_gdk4_ContentProvider_virtual_content_changed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(provider) +} + +func (provider *ContentProvider) detachClipboard(clipboard *Clipboard) { + gclass := (*C.GdkContentProviderClass)(coreglib.PeekParentClass(provider)) + fnarg := gclass.detach_clipboard + + var _arg0 *C.GdkContentProvider // out + var _arg1 *C.GdkClipboard // out + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + _arg1 = (*C.GdkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) + + C._gotk4_gdk4_ContentProvider_virtual_detach_clipboard(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(provider) + runtime.KeepAlive(clipboard) +} + +// Value gets the contents of provider stored in value. +// +// The value will have been initialized to the GType the value should be +// provided in. This given GType does not need to be listed in the formats +// returned by gdk.ContentProvider.RefFormats(). However, if the given GType is +// not supported, this operation can fail and G_IO_ERROR_NOT_SUPPORTED will be +// reported. +// +// The function returns the following values: +// +// - value: GValue to fill. +func (provider *ContentProvider) value() (coreglib.Value, error) { + gclass := (*C.GdkContentProviderClass)(coreglib.PeekParentClass(provider)) + fnarg := gclass.get_value + + var _arg0 *C.GdkContentProvider // out + var _arg1 C.GValue // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + + C._gotk4_gdk4_ContentProvider_virtual_get_value(unsafe.Pointer(fnarg), _arg0, &_arg1, &_cerr) + runtime.KeepAlive(provider) + + var _value coreglib.Value // out + var _goerr error // out + + _value = *coreglib.ValueFromNative(unsafe.Pointer((&_arg1))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _value, _goerr +} + +// refFormats gets the formats that the provider can provide its current +// contents in. +// +// The function returns the following values: +// +// - contentFormats formats of the provider. +func (provider *ContentProvider) refFormats() *ContentFormats { + gclass := (*C.GdkContentProviderClass)(coreglib.PeekParentClass(provider)) + fnarg := gclass.ref_formats + + var _arg0 *C.GdkContentProvider // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + + _cret = C._gotk4_gdk4_ContentProvider_virtual_ref_formats(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(provider) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// refStorableFormats gets the formats that the provider suggests other +// applications to store the data in. +// +// An example of such an application would be a clipboard manager. +// +// This can be assumed to be a subset of gdk.ContentProvider.RefFormats(). +// +// The function returns the following values: +// +// - contentFormats: storable formats of the provider. +func (provider *ContentProvider) refStorableFormats() *ContentFormats { + gclass := (*C.GdkContentProviderClass)(coreglib.PeekParentClass(provider)) + fnarg := gclass.ref_storable_formats + + var _arg0 *C.GdkContentProvider // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + + _cret = C._gotk4_gdk4_ContentProvider_virtual_ref_storable_formats(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(provider) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// writeMIMETypeAsync: asynchronously writes the contents of provider to stream +// in the given mime_type. +// +// When the operation is finished callback will be called. You must then call +// gdk.ContentProvider.WriteMIMETypeFinish() to get the result of the operation. +// +// The given mime type does not need to be listed in the formats returned +// by gdk.ContentProvider.RefFormats(). However, if the given GType is not +// supported, G_IO_ERROR_NOT_SUPPORTED will be reported. +// +// The given stream will not be closed. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - mimeType: mime type to provide the data in. +// - stream: GOutputStream to write to. +// - ioPriority: i/O priority of the request. +// - callback (optional) to call when the request is satisfied. +func (provider *ContentProvider) writeMIMETypeAsync(ctx context.Context, mimeType string, stream gio.OutputStreamer, ioPriority int, callback gio.AsyncReadyCallback) { + gclass := (*C.GdkContentProviderClass)(coreglib.PeekParentClass(provider)) + fnarg := gclass.write_mime_type_async + + var _arg0 *C.GdkContentProvider // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 *C.GOutputStream // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gdk4_ContentProvider_virtual_write_mime_type_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(provider) + runtime.KeepAlive(ctx) + runtime.KeepAlive(mimeType) + runtime.KeepAlive(stream) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// writeMIMETypeFinish finishes an asynchronous write operation. +// +// See gdk.ContentProvider.WriteMIMETypeAsync(). +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +func (provider *ContentProvider) writeMIMETypeFinish(result gio.AsyncResulter) error { + gclass := (*C.GdkContentProviderClass)(coreglib.PeekParentClass(provider)) + fnarg := gclass.write_mime_type_finish + + var _arg0 *C.GdkContentProvider // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gdk4_ContentProvider_virtual_write_mime_type_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(provider) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ContentSerializer: GdkContentSerializer is used to serialize content for +// inter-application data transfers. +// +// The GdkContentSerializer transforms an object that is identified by a GType +// into a serialized form (i.e. a byte stream) that is identified by a mime +// type. +// +// GTK provides serializers and deserializers for common data types such as +// text, colors, images or file lists. To register your own serialization +// functions, use gdk.ContentRegisterSerializer(). +// +// Also see gdk.ContentDeserializer. +type ContentSerializer struct { + _ [0]func() // equal guard + *coreglib.Object + + gio.AsyncResult +} + +var ( + _ coreglib.Objector = (*ContentSerializer)(nil) +) + +func wrapContentSerializer(obj *coreglib.Object) *ContentSerializer { + return &ContentSerializer{ + Object: obj, + AsyncResult: gio.AsyncResult{ + Object: obj, + }, + } +} + +func marshalContentSerializer(p uintptr) (interface{}, error) { + return wrapContentSerializer(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Cancellable gets the cancellable for the current operation. +// +// This is the GCancellable that was passed to content_serialize_async. +// +// The function returns the following values: +// +// - cancellable (optional) for the current operation. +func (serializer *ContentSerializer) Cancellable() *gio.Cancellable { + var _arg0 *C.GdkContentSerializer // out + var _cret *C.GCancellable // in + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + + _cret = C.gdk_content_serializer_get_cancellable(_arg0) + runtime.KeepAlive(serializer) + + var _cancellable *gio.Cancellable // out + + if _cret != nil { + { + obj := coreglib.Take(unsafe.Pointer(_cret)) + _cancellable = &gio.Cancellable{ + Object: obj, + } + } + } + + return _cancellable +} + +// GType gets the GType to of the object to serialize. +// +// The function returns the following values: +// +// - gType: GType for the current operation. +func (serializer *ContentSerializer) GType() coreglib.Type { + var _arg0 *C.GdkContentSerializer // out + var _cret C.GType // in + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + + _cret = C.gdk_content_serializer_get_gtype(_arg0) + runtime.KeepAlive(serializer) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// MIMEType gets the mime type to serialize to. +// +// The function returns the following values: +// +// - utf8: mime type for the current operation. +func (serializer *ContentSerializer) MIMEType() string { + var _arg0 *C.GdkContentSerializer // out + var _cret *C.char // in + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + + _cret = C.gdk_content_serializer_get_mime_type(_arg0) + runtime.KeepAlive(serializer) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// OutputStream gets the output stream for the current operation. +// +// This is the stream that was passed to content_serialize_async. +// +// The function returns the following values: +// +// - outputStream: output stream for the current operation. +func (serializer *ContentSerializer) OutputStream() gio.OutputStreamer { + var _arg0 *C.GdkContentSerializer // out + var _cret *C.GOutputStream // in + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + + _cret = C.gdk_content_serializer_get_output_stream(_arg0) + runtime.KeepAlive(serializer) + + var _outputStream gio.OutputStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.OutputStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gio.OutputStreamer) + return ok + }) + rv, ok := casted.(gio.OutputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.OutputStreamer") + } + _outputStream = rv + } + + return _outputStream +} + +// Priority gets the I/O priority for the current operation. +// +// This is the priority that was passed to content_serialize_async. +// +// The function returns the following values: +// +// - gint: i/O priority for the current operation. +func (serializer *ContentSerializer) Priority() int { + var _arg0 *C.GdkContentSerializer // out + var _cret C.int // in + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + + _cret = C.gdk_content_serializer_get_priority(_arg0) + runtime.KeepAlive(serializer) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// TaskData gets the data that was associated with the current operation. +// +// See gdk.ContentSerializer.SetTaskData(). +// +// The function returns the following values: +// +// - gpointer (optional): task data for serializer. +func (serializer *ContentSerializer) TaskData() unsafe.Pointer { + var _arg0 *C.GdkContentSerializer // out + var _cret C.gpointer // in + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + + _cret = C.gdk_content_serializer_get_task_data(_arg0) + runtime.KeepAlive(serializer) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// UserData gets the user data that was passed when the serializer was +// registered. +// +// The function returns the following values: +// +// - gpointer (optional): user data for this serializer. +func (serializer *ContentSerializer) UserData() unsafe.Pointer { + var _arg0 *C.GdkContentSerializer // out + var _cret C.gpointer // in + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + + _cret = C.gdk_content_serializer_get_user_data(_arg0) + runtime.KeepAlive(serializer) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// Value gets the GValue to read the object to serialize from. +// +// The function returns the following values: +// +// - value: GValue for the current operation. +func (serializer *ContentSerializer) Value() *coreglib.Value { + var _arg0 *C.GdkContentSerializer // out + var _cret *C.GValue // in + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + + _cret = C.gdk_content_serializer_get_value(_arg0) + runtime.KeepAlive(serializer) + + var _value *coreglib.Value // out + + _value = coreglib.ValueFromNative(unsafe.Pointer(_cret)) + + return _value +} + +// ReturnError: indicate that the serialization has ended with an error. +// +// This function consumes error. +// +// The function takes the following parameters: +// +// - err: GError. +func (serializer *ContentSerializer) ReturnError(err error) { + var _arg0 *C.GdkContentSerializer // out + var _arg1 *C.GError // out + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + + C.gdk_content_serializer_return_error(_arg0, _arg1) + runtime.KeepAlive(serializer) + runtime.KeepAlive(err) +} + +// ReturnSuccess: indicate that the serialization has been successfully +// completed. +func (serializer *ContentSerializer) ReturnSuccess() { + var _arg0 *C.GdkContentSerializer // out + + _arg0 = (*C.GdkContentSerializer)(unsafe.Pointer(coreglib.InternObject(serializer).Native())) + + C.gdk_content_serializer_return_success(_arg0) + runtime.KeepAlive(serializer) +} + +// CrossingEvent: event caused by a pointing device moving between surfaces. +type CrossingEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*CrossingEvent)(nil) +) + +func wrapCrossingEvent(obj *coreglib.Object) *CrossingEvent { + return &CrossingEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalCrossingEvent(p uintptr) (interface{}, error) { + return wrapCrossingEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Detail extracts the notify detail from a crossing event. +// +// The function returns the following values: +// +// - notifyType: notify detail of event. +func (event *CrossingEvent) Detail() NotifyType { + var _arg0 *C.GdkEvent // out + var _cret C.GdkNotifyType // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_crossing_event_get_detail(_arg0) + runtime.KeepAlive(event) + + var _notifyType NotifyType // out + + _notifyType = NotifyType(_cret) + + return _notifyType +} + +// Focus checks if the event surface is the focus surface. +// +// The function returns the following values: +// +// - ok: TRUE if the surface is the focus surface. +func (event *CrossingEvent) Focus() bool { + var _arg0 *C.GdkEvent // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_crossing_event_get_focus(_arg0) + runtime.KeepAlive(event) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Mode extracts the crossing mode from a crossing event. +// +// The function returns the following values: +// +// - crossingMode: mode of event. +func (event *CrossingEvent) Mode() CrossingMode { + var _arg0 *C.GdkEvent // out + var _cret C.GdkCrossingMode // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_crossing_event_get_mode(_arg0) + runtime.KeepAlive(event) + + var _crossingMode CrossingMode // out + + _crossingMode = CrossingMode(_cret) + + return _crossingMode +} + +// Cursor: GdkCursor is used to create and destroy cursors. +// +// Cursors are immutable objects, so once you created them, there is no way to +// modify them later. You should create a new cursor when you want to change +// something about it. +// +// Cursors by themselves are not very interesting: they must be bound to a +// window for users to see them. This is done with gdk.Surface.SetCursor() +// or gdk.Surface.SetDeviceCursor(). Applications will typically +// use higher-level GTK functions such as gtk_widget_set_cursor() +// (../gtk4/method.Widget.set_cursor.html) instead. +// +// Cursors are not bound to a given gdk.Display, so they can be shared. However, +// the appearance of cursors may vary when used on different platforms. +// +// # Named and texture cursors +// +// There are multiple ways to create cursors. The platform's own cursors can +// be created with gdk.Cursor.NewFromName. That function lists the commonly +// available names that are shared with the CSS specification. Other names +// may be available, depending on the platform in use. On some platforms, +// what images are used for named cursors may be influenced by the cursor theme. +// +// Another option to create a cursor is to use gdk.Cursor.NewFromTexture and +// provide an image to use for the cursor. +// +// To ease work with unsupported cursors, a fallback cursor can be provided. +// If a gdk.Surface cannot use a cursor because of the reasons mentioned above, +// it will try the fallback cursor. Fallback cursors can themselves have +// fallback cursors again, so it is possible to provide a chain of progressively +// easier to support cursors. If none of the provided cursors can be supported, +// the default cursor will be the ultimate fallback. +type Cursor struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Cursor)(nil) +) + +func wrapCursor(obj *coreglib.Object) *Cursor { + return &Cursor{ + Object: obj, + } +} + +func marshalCursor(p uintptr) (interface{}, error) { + return wrapCursor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewCursorFromName creates a new cursor by looking up name in the current +// cursor theme. +// +// A recommended set of cursor names that will work across different platforms +// can be found in the CSS specification: +// +// | | | | | | --- | --- | ---- | --- | | "none" | ! (default_cursor.png) +// "default" | ! (help_cursor.png) "help" | ! (pointer_cursor.png) "pointer" +// | | ! (context_menu_cursor.png) "context-menu" | ! (progress_cursor.png) +// "progress" | ! (wait_cursor.png) "wait" | ! (cell_cursor.png) "cell" +// | | ! (crosshair_cursor.png) "crosshair" | ! (text_cursor.png) "text" +// | ! (vertical_text_cursor.png) "vertical-text" | ! (alias_cursor.png) +// "alias" | | ! (copy_cursor.png) "copy" | ! (no_drop_cursor.png) "no-drop" +// | ! (move_cursor.png) "move" | ! (not_allowed_cursor.png) "not-allowed" +// | | ! (grab_cursor.png) "grab" | ! (grabbing_cursor.png) "grabbing" +// | ! (all_scroll_cursor.png) "all-scroll" | ! (col_resize_cursor.png) +// "col-resize" | | ! (row_resize_cursor.png) "row-resize" | ! +// (n_resize_cursor.png) "n-resize" | ! (e_resize_cursor.png) "e-resize" | ! +// (s_resize_cursor.png) "s-resize" | | ! (w_resize_cursor.png) "w-resize" | ! +// (ne_resize_cursor.png) "ne-resize" | ! (nw_resize_cursor.png) "nw-resize" | ! +// (sw_resize_cursor.png) "sw-resize" | | ! (se_resize_cursor.png) "se-resize" | +// ! (ew_resize_cursor.png) "ew-resize" | ! (ns_resize_cursor.png) "ns-resize" +// | ! (nesw_resize_cursor.png) "nesw-resize" | | ! (nwse_resize_cursor.png) +// "nwse-resize" | ! (zoom_in_cursor.png) "zoom-in" | ! (zoom_out_cursor.png) +// "zoom-out" | |. +// +// The function takes the following parameters: +// +// - name of the cursor. +// - fallback (optional): NULL or the GdkCursor to fall back to when this one +// cannot be supported. +// +// The function returns the following values: +// +// - cursor (optional): new GdkCursor, or NULL if there is no cursor with the +// given name. +func NewCursorFromName(name string, fallback *Cursor) *Cursor { + var _arg1 *C.char // out + var _arg2 *C.GdkCursor // out + var _cret *C.GdkCursor // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + if fallback != nil { + _arg2 = (*C.GdkCursor)(unsafe.Pointer(coreglib.InternObject(fallback).Native())) + } + + _cret = C.gdk_cursor_new_from_name(_arg1, _arg2) + runtime.KeepAlive(name) + runtime.KeepAlive(fallback) + + var _cursor *Cursor // out + + if _cret != nil { + _cursor = wrapCursor(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _cursor +} + +// NewCursorFromTexture creates a new cursor from a GdkTexture. +// +// The function takes the following parameters: +// +// - texture providing the pixel data. +// - hotspotX: horizontal offset of the “hotspot” of the cursor. +// - hotspotY: vertical offset of the “hotspot” of the cursor. +// - fallback (optional): GdkCursor to fall back to when this one cannot be +// supported. +// +// The function returns the following values: +// +// - cursor: new GdkCursor. +func NewCursorFromTexture(texture Texturer, hotspotX, hotspotY int, fallback *Cursor) *Cursor { + var _arg1 *C.GdkTexture // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 *C.GdkCursor // out + var _cret *C.GdkCursor // in + + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + _arg2 = C.int(hotspotX) + _arg3 = C.int(hotspotY) + if fallback != nil { + _arg4 = (*C.GdkCursor)(unsafe.Pointer(coreglib.InternObject(fallback).Native())) + } + + _cret = C.gdk_cursor_new_from_texture(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(texture) + runtime.KeepAlive(hotspotX) + runtime.KeepAlive(hotspotY) + runtime.KeepAlive(fallback) + + var _cursor *Cursor // out + + _cursor = wrapCursor(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _cursor +} + +// Fallback returns the fallback for this cursor. +// +// The fallback will be used if this cursor is not available on a given +// GdkDisplay. For named cursors, this can happen when using nonstandard names +// or when using an incomplete cursor theme. For textured cursors, this can +// happen when the texture is too large or when the GdkDisplay it is used on +// does not support textured cursors. +// +// The function returns the following values: +// +// - ret (optional): fallback of the cursor or NULL to use the default cursor +// as fallback. +func (cursor *Cursor) Fallback() *Cursor { + var _arg0 *C.GdkCursor // out + var _cret *C.GdkCursor // in + + _arg0 = (*C.GdkCursor)(unsafe.Pointer(coreglib.InternObject(cursor).Native())) + + _cret = C.gdk_cursor_get_fallback(_arg0) + runtime.KeepAlive(cursor) + + var _ret *Cursor // out + + if _cret != nil { + _ret = wrapCursor(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _ret +} + +// HotspotX returns the horizontal offset of the hotspot. +// +// The hotspot indicates the pixel that will be directly above the cursor. +// +// Note that named cursors may have a nonzero hotspot, but this function +// will only return the hotspot position for cursors created with +// gdk.Cursor.NewFromTexture. +// +// The function returns the following values: +// +// - gint: horizontal offset of the hotspot or 0 for named cursors. +func (cursor *Cursor) HotspotX() int { + var _arg0 *C.GdkCursor // out + var _cret C.int // in + + _arg0 = (*C.GdkCursor)(unsafe.Pointer(coreglib.InternObject(cursor).Native())) + + _cret = C.gdk_cursor_get_hotspot_x(_arg0) + runtime.KeepAlive(cursor) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// HotspotY returns the vertical offset of the hotspot. +// +// The hotspot indicates the pixel that will be directly above the cursor. +// +// Note that named cursors may have a nonzero hotspot, but this function +// will only return the hotspot position for cursors created with +// gdk.Cursor.NewFromTexture. +// +// The function returns the following values: +// +// - gint: vertical offset of the hotspot or 0 for named cursors. +func (cursor *Cursor) HotspotY() int { + var _arg0 *C.GdkCursor // out + var _cret C.int // in + + _arg0 = (*C.GdkCursor)(unsafe.Pointer(coreglib.InternObject(cursor).Native())) + + _cret = C.gdk_cursor_get_hotspot_y(_arg0) + runtime.KeepAlive(cursor) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Name returns the name of the cursor. +// +// If the cursor is not a named cursor, NULL will be returned. +// +// The function returns the following values: +// +// - utf8 (optional): name of the cursor or NULL if it is not a named cursor. +func (cursor *Cursor) Name() string { + var _arg0 *C.GdkCursor // out + var _cret *C.char // in + + _arg0 = (*C.GdkCursor)(unsafe.Pointer(coreglib.InternObject(cursor).Native())) + + _cret = C.gdk_cursor_get_name(_arg0) + runtime.KeepAlive(cursor) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Texture returns the texture for the cursor. +// +// If the cursor is a named cursor, NULL will be returned. +// +// The function returns the following values: +// +// - texture (optional) for cursor or NULL if it is a named cursor. +func (cursor *Cursor) Texture() Texturer { + var _arg0 *C.GdkCursor // out + var _cret *C.GdkTexture // in + + _arg0 = (*C.GdkCursor)(unsafe.Pointer(coreglib.InternObject(cursor).Native())) + + _cret = C.gdk_cursor_get_texture(_arg0) + runtime.KeepAlive(cursor) + + var _texture Texturer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Texturer) + return ok + }) + rv, ok := casted.(Texturer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") + } + _texture = rv + } + } + + return _texture +} + +// DNDEvent: event related to drag and drop operations. +type DNDEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*DNDEvent)(nil) +) + +func wrapDNDEvent(obj *coreglib.Object) *DNDEvent { + return &DNDEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalDNDEvent(p uintptr) (interface{}, error) { + return wrapDNDEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Drop gets the GdkDrop object from a DND event. +// +// The function returns the following values: +// +// - drop (optional): drop. +func (event *DNDEvent) Drop() Dropper { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkDrop // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_dnd_event_get_drop(_arg0) + runtime.KeepAlive(event) + + var _drop Dropper // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Dropper) + return ok + }) + rv, ok := casted.(Dropper) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Dropper") + } + _drop = rv + } + } + + return _drop +} + +// DeleteEvent: event related to closing a top-level surface. +type DeleteEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*DeleteEvent)(nil) +) + +func wrapDeleteEvent(obj *coreglib.Object) *DeleteEvent { + return &DeleteEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalDeleteEvent(p uintptr) (interface{}, error) { + return wrapDeleteEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Device: GdkDevice object represents an input device, such as a keyboard, +// a mouse, or a touchpad. +// +// See the gdk.Seat documentation for more information about the various kinds +// of devices, and their relationships. +type Device struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Device)(nil) +) + +// Devicer describes types inherited from class Device. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Devicer interface { + coreglib.Objector + baseDevice() *Device +} + +var _ Devicer = (*Device)(nil) + +func wrapDevice(obj *coreglib.Object) *Device { + return &Device{ + Object: obj, + } +} + +func marshalDevice(p uintptr) (interface{}, error) { + return wrapDevice(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (device *Device) baseDevice() *Device { + return device +} + +// BaseDevice returns the underlying base object. +func BaseDevice(obj Devicer) *Device { + return obj.baseDevice() +} + +// ConnectChanged is emitted either when the number of either axes or keys +// changes. +// +// On X11 this will normally happen when the physical device routing events +// through the logical device changes (for example, user switches from the USB +// mouse to a tablet); in that case the logical device will change to reflect +// the axes and keys on the new physical device. +func (device *Device) ConnectChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(device, "changed", false, unsafe.Pointer(C._gotk4_gdk4_Device_ConnectChanged), f) +} + +// ConnectToolChanged is emitted on pen/eraser devices whenever tools enter or +// leave proximity. +func (device *Device) ConnectToolChanged(f func(tool *DeviceTool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(device, "tool-changed", false, unsafe.Pointer(C._gotk4_gdk4_Device_ConnectToolChanged), f) +} + +// CapsLockState retrieves whether the Caps Lock modifier of the keyboard is +// locked. +// +// This is only relevant for keyboard devices. +// +// The function returns the following values: +// +// - ok: TRUE if Caps Lock is on for device. +func (device *Device) CapsLockState() bool { + var _arg0 *C.GdkDevice // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_caps_lock_state(_arg0) + runtime.KeepAlive(device) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DeviceTool retrieves the current tool for device. +// +// The function returns the following values: +// +// - deviceTool (optional): GdkDeviceTool. +func (device *Device) DeviceTool() *DeviceTool { + var _arg0 *C.GdkDevice // out + var _cret *C.GdkDeviceTool // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_device_tool(_arg0) + runtime.KeepAlive(device) + + var _deviceTool *DeviceTool // out + + if _cret != nil { + _deviceTool = wrapDeviceTool(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _deviceTool +} + +// Direction returns the direction of effective layout of the keyboard. +// +// This is only relevant for keyboard devices. +// +// The direction of a layout is the direction of the majority of its symbols. +// See pango.UnicharDirection(). +// +// The function returns the following values: +// +// - direction: PANGO_DIRECTION_LTR or PANGO_DIRECTION_RTL if it can determine +// the direction. PANGO_DIRECTION_NEUTRAL otherwise. +func (device *Device) Direction() pango.Direction { + var _arg0 *C.GdkDevice // out + var _cret C.PangoDirection // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_direction(_arg0) + runtime.KeepAlive(device) + + var _direction pango.Direction // out + + _direction = pango.Direction(_cret) + + return _direction +} + +// Display returns the GdkDisplay to which device pertains. +// +// The function returns the following values: +// +// - display: GdkDisplay. +func (device *Device) Display() *Display { + var _arg0 *C.GdkDevice // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_display(_arg0) + runtime.KeepAlive(device) + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + + return _display +} + +// HasCursor determines whether the pointer follows device motion. +// +// This is not meaningful for keyboard devices, which don't have a pointer. +// +// The function returns the following values: +// +// - ok: TRUE if the pointer follows device motion. +func (device *Device) HasCursor() bool { + var _arg0 *C.GdkDevice // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_has_cursor(_arg0) + runtime.KeepAlive(device) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ModifierState retrieves the current modifier state of the keyboard. +// +// This is only relevant for keyboard devices. +// +// The function returns the following values: +// +// - modifierType: current modifier state. +func (device *Device) ModifierState() ModifierType { + var _arg0 *C.GdkDevice // out + var _cret C.GdkModifierType // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_modifier_state(_arg0) + runtime.KeepAlive(device) + + var _modifierType ModifierType // out + + _modifierType = ModifierType(_cret) + + return _modifierType +} + +// Name: name of the device, suitable for showing in a user interface. +// +// The function returns the following values: +// +// - utf8: name. +func (device *Device) Name() string { + var _arg0 *C.GdkDevice // out + var _cret *C.char // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_name(_arg0) + runtime.KeepAlive(device) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// NumLockState retrieves whether the Num Lock modifier of the keyboard is +// locked. +// +// This is only relevant for keyboard devices. +// +// The function returns the following values: +// +// - ok: TRUE if Num Lock is on for device. +func (device *Device) NumLockState() bool { + var _arg0 *C.GdkDevice // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_num_lock_state(_arg0) + runtime.KeepAlive(device) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// NumTouches retrieves the number of touch points associated to device. +// +// The function returns the following values: +// +// - guint: number of touch points. +func (device *Device) NumTouches() uint { + var _arg0 *C.GdkDevice // out + var _cret C.guint // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_num_touches(_arg0) + runtime.KeepAlive(device) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// ProductID returns the product ID of this device. +// +// This ID is retrieved from the device, and does not change. See +// gdk.Device.GetVendorID() for more information. +// +// The function returns the following values: +// +// - utf8 (optional): product ID. +func (device *Device) ProductID() string { + var _arg0 *C.GdkDevice // out + var _cret *C.char // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_product_id(_arg0) + runtime.KeepAlive(device) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ScrollLockState retrieves whether the Scroll Lock modifier of the keyboard is +// locked. +// +// This is only relevant for keyboard devices. +// +// The function returns the following values: +// +// - ok: TRUE if Scroll Lock is on for device. +func (device *Device) ScrollLockState() bool { + var _arg0 *C.GdkDevice // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_scroll_lock_state(_arg0) + runtime.KeepAlive(device) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Seat returns the GdkSeat the device belongs to. +// +// The function returns the following values: +// +// - seat: GdkSeat. +func (device *Device) Seat() Seater { + var _arg0 *C.GdkDevice // out + var _cret *C.GdkSeat // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_seat(_arg0) + runtime.KeepAlive(device) + + var _seat Seater // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Seater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Seater) + return ok + }) + rv, ok := casted.(Seater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Seater") + } + _seat = rv + } + + return _seat +} + +// Source determines the type of the device. +// +// The function returns the following values: +// +// - inputSource: GdkInputSource. +func (device *Device) Source() InputSource { + var _arg0 *C.GdkDevice // out + var _cret C.GdkInputSource // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_source(_arg0) + runtime.KeepAlive(device) + + var _inputSource InputSource // out + + _inputSource = InputSource(_cret) + + return _inputSource +} + +// SurfaceAtPosition obtains the surface underneath device, returning the +// location of the device in win_x and win_y. +// +// Returns NULL if the surface tree under device is not known to GDK (for +// example, belongs to another application). +// +// The function returns the following values: +// +// - winX (optional): return location for the X coordinate of the device +// location relative to the surface origin. +// - winY (optional): return location for the Y coordinate of the device +// location relative to the surface origin. +// - surface (optional): GdkSurface under the device position. +func (device *Device) SurfaceAtPosition() (winX, winY float64, surface Surfacer) { + var _arg0 *C.GdkDevice // out + var _arg1 C.double // in + var _arg2 C.double // in + var _cret *C.GdkSurface // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_surface_at_position(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(device) + + var _winX float64 // out + var _winY float64 // out + var _surface Surfacer // out + + _winX = float64(_arg1) + _winY = float64(_arg2) + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Surfacer) + return ok + }) + rv, ok := casted.(Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + } + + return _winX, _winY, _surface +} + +// Timestamp returns the timestamp of the last activity for this device. +// +// In practice, this means the timestamp of the last event that was received +// from the OS for this device. (GTK may occasionally produce events for a +// device that are not received from the OS, and will not update the timestamp). +// +// The function returns the following values: +// +// - guint32: timestamp of the last activity for this device. +func (device *Device) Timestamp() uint32 { + var _arg0 *C.GdkDevice // out + var _cret C.guint32 // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_timestamp(_arg0) + runtime.KeepAlive(device) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// VendorID returns the vendor ID of this device. +// +// This ID is retrieved from the device, and does not change. +// +// This function, together with gdk.Device.GetProductID(), can be used to eg. +// compose GSettings paths to store settings for this device. +// +// static GSettings * +// get_device_settings (GdkDevice *device) +// { +// const char *vendor, *product; +// GSettings *settings; +// GdkDevice *device; +// char *path; +// +// vendor = gdk_device_get_vendor_id (device); +// product = gdk_device_get_product_id (device); +// +// path = g_strdup_printf ("/org/example/app/devices/s:s/", vendor, product); +// settings = g_settings_new_with_path (DEVICE_SCHEMA, path); +// g_free (path); +// +// return settings; +// }. +// +// The function returns the following values: +// +// - utf8 (optional): vendor ID. +func (device *Device) VendorID() string { + var _arg0 *C.GdkDevice // out + var _cret *C.char // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_get_vendor_id(_arg0) + runtime.KeepAlive(device) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// HasBidiLayouts determines if layouts for both right-to-left and left-to-right +// languages are in use on the keyboard. +// +// This is only relevant for keyboard devices. +// +// The function returns the following values: +// +// - ok: TRUE if there are layouts with both directions, FALSE otherwise. +func (device *Device) HasBidiLayouts() bool { + var _arg0 *C.GdkDevice // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_device_has_bidi_layouts(_arg0) + runtime.KeepAlive(device) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DeviceTool: physical tool associated to a GdkDevice. +type DeviceTool struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DeviceTool)(nil) +) + +func wrapDeviceTool(obj *coreglib.Object) *DeviceTool { + return &DeviceTool{ + Object: obj, + } +} + +func marshalDeviceTool(p uintptr) (interface{}, error) { + return wrapDeviceTool(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Axes gets the axes of the tool. +// +// The function returns the following values: +// +// - axisFlags axes of tool. +func (tool *DeviceTool) Axes() AxisFlags { + var _arg0 *C.GdkDeviceTool // out + var _cret C.GdkAxisFlags // in + + _arg0 = (*C.GdkDeviceTool)(unsafe.Pointer(coreglib.InternObject(tool).Native())) + + _cret = C.gdk_device_tool_get_axes(_arg0) + runtime.KeepAlive(tool) + + var _axisFlags AxisFlags // out + + _axisFlags = AxisFlags(_cret) + + return _axisFlags +} + +// HardwareID gets the hardware ID of this tool, or 0 if it's not known. +// +// When non-zero, the identifier is unique for the given tool model, meaning +// that two identical tools will share the same hardware_id, but will have +// different serial numbers (see gdk.DeviceTool.GetSerial()). +// +// This is a more concrete (and device specific) method to identify a +// GdkDeviceTool than gdk.DeviceTool.GetToolType(), as a tablet may support +// multiple devices with the same GdkDeviceToolType, but different hardware +// identifiers. +// +// The function returns the following values: +// +// - guint64: hardware identifier of this tool. +func (tool *DeviceTool) HardwareID() uint64 { + var _arg0 *C.GdkDeviceTool // out + var _cret C.guint64 // in + + _arg0 = (*C.GdkDeviceTool)(unsafe.Pointer(coreglib.InternObject(tool).Native())) + + _cret = C.gdk_device_tool_get_hardware_id(_arg0) + runtime.KeepAlive(tool) + + var _guint64 uint64 // out + + _guint64 = uint64(_cret) + + return _guint64 +} + +// Serial gets the serial number of this tool. +// +// This value can be used to identify a physical tool (eg. a tablet pen) across +// program executions. +// +// The function returns the following values: +// +// - guint64: serial ID for this tool. +func (tool *DeviceTool) Serial() uint64 { + var _arg0 *C.GdkDeviceTool // out + var _cret C.guint64 // in + + _arg0 = (*C.GdkDeviceTool)(unsafe.Pointer(coreglib.InternObject(tool).Native())) + + _cret = C.gdk_device_tool_get_serial(_arg0) + runtime.KeepAlive(tool) + + var _guint64 uint64 // out + + _guint64 = uint64(_cret) + + return _guint64 +} + +// ToolType gets the GdkDeviceToolType of the tool. +// +// The function returns the following values: +// +// - deviceToolType: physical type for this tool. This can be used to figure +// out what sort of pen is being used, such as an airbrush or a pencil. +func (tool *DeviceTool) ToolType() DeviceToolType { + var _arg0 *C.GdkDeviceTool // out + var _cret C.GdkDeviceToolType // in + + _arg0 = (*C.GdkDeviceTool)(unsafe.Pointer(coreglib.InternObject(tool).Native())) + + _cret = C.gdk_device_tool_get_tool_type(_arg0) + runtime.KeepAlive(tool) + + var _deviceToolType DeviceToolType // out + + _deviceToolType = DeviceToolType(_cret) + + return _deviceToolType +} + +// Display: GdkDisplay objects are the GDK representation of a workstation. +// +// Their purpose are two-fold: +// +// - To manage and provide information about input devices (pointers, keyboards, +// etc) +// +// - To manage and provide information about output devices (monitors, +// projectors, etc) +// +// Most of the input device handling has been factored out into separate +// gdk.Seat objects. Every display has a one or more seats, which can be +// accessed with gdk.Display.GetDefaultSeat() and gdk.Display.ListSeats(). +// +// Output devices are represented by gdk.Monitor objects, which can be accessed +// with gdk.Display.GetMonitorAtSurface() and similar APIs. +type Display struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Display)(nil) +) + +func wrapDisplay(obj *coreglib.Object) *Display { + return &Display{ + Object: obj, + } +} + +func marshalDisplay(p uintptr) (interface{}, error) { + return wrapDisplay(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectClosed is emitted when the connection to the windowing system for +// display is closed. +func (display *Display) ConnectClosed(f func(isError bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(display, "closed", false, unsafe.Pointer(C._gotk4_gdk4_Display_ConnectClosed), f) +} + +// ConnectOpened is emitted when the connection to the windowing system for +// display is opened. +func (display *Display) ConnectOpened(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(display, "opened", false, unsafe.Pointer(C._gotk4_gdk4_Display_ConnectOpened), f) +} + +// ConnectSeatAdded is emitted whenever a new seat is made known to the +// windowing system. +func (display *Display) ConnectSeatAdded(f func(seat Seater)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(display, "seat-added", false, unsafe.Pointer(C._gotk4_gdk4_Display_ConnectSeatAdded), f) +} + +// ConnectSeatRemoved is emitted whenever a seat is removed by the windowing +// system. +func (display *Display) ConnectSeatRemoved(f func(seat Seater)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(display, "seat-removed", false, unsafe.Pointer(C._gotk4_gdk4_Display_ConnectSeatRemoved), f) +} + +// ConnectSettingChanged is emitted whenever a setting changes its value. +func (display *Display) ConnectSettingChanged(f func(setting string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(display, "setting-changed", false, unsafe.Pointer(C._gotk4_gdk4_Display_ConnectSettingChanged), f) +} + +// Beep emits a short beep on display. +func (display *Display) Beep() { + var _arg0 *C.GdkDisplay // out + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + C.gdk_display_beep(_arg0) + runtime.KeepAlive(display) +} + +// Close closes the connection to the windowing system for the given display. +// +// This cleans up associated resources. +func (display *Display) Close() { + var _arg0 *C.GdkDisplay // out + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + C.gdk_display_close(_arg0) + runtime.KeepAlive(display) +} + +// CreateGLContext creates a new GdkGLContext for the GdkDisplay. +// +// The context is disconnected from any particular surface or surface and cannot +// be used to draw to any surface. It can only be used to draw to non-surface +// framebuffers like textures. +// +// If the creation of the GdkGLContext failed, error will be set. Before using +// the returned GdkGLContext, you will need to call gdk.GLContext.MakeCurrent() +// or gdk.GLContext.Realize(). +// +// The function returns the following values: +// +// - glContext: newly created GdkGLContext. +func (self *Display) CreateGLContext() (GLContexter, error) { + var _arg0 *C.GdkDisplay // out + var _cret *C.GdkGLContext // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_display_create_gl_context(_arg0, &_cerr) + runtime.KeepAlive(self) + + var _glContext GLContexter // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.GLContexter is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(GLContexter) + return ok + }) + rv, ok := casted.(GLContexter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.GLContexter") + } + _glContext = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _glContext, _goerr +} + +// DeviceIsGrabbed returns TRUE if there is an ongoing grab on device for +// display. +// +// The function takes the following parameters: +// +// - device: GdkDevice. +// +// The function returns the following values: +// +// - ok: TRUE if there is a grab in effect for device. +func (display *Display) DeviceIsGrabbed(device Devicer) bool { + var _arg0 *C.GdkDisplay // out + var _arg1 *C.GdkDevice // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + _arg1 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_display_device_is_grabbed(_arg0, _arg1) + runtime.KeepAlive(display) + runtime.KeepAlive(device) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Flush flushes any requests queued for the windowing system. +// +// This happens automatically when the main loop blocks waiting for new events, +// but if your application is drawing without returning control to the main +// loop, you may need to call this function explicitly. A common case where +// this function needs to be called is when an application is executing drawing +// commands from a thread other than the thread where the main loop is running. +// +// This is most useful for X11. On windowing systems where requests are handled +// synchronously, this function will do nothing. +func (display *Display) Flush() { + var _arg0 *C.GdkDisplay // out + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + C.gdk_display_flush(_arg0) + runtime.KeepAlive(display) +} + +// AppLaunchContext returns a GdkAppLaunchContext suitable for launching +// applications on the given display. +// +// The function returns the following values: +// +// - appLaunchContext: new GdkAppLaunchContext for display. +func (display *Display) AppLaunchContext() *AppLaunchContext { + var _arg0 *C.GdkDisplay // out + var _cret *C.GdkAppLaunchContext // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_get_app_launch_context(_arg0) + runtime.KeepAlive(display) + + var _appLaunchContext *AppLaunchContext // out + + _appLaunchContext = wrapAppLaunchContext(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _appLaunchContext +} + +// Clipboard gets the clipboard used for copy/paste operations. +// +// The function returns the following values: +// +// - clipboard display's clipboard. +func (display *Display) Clipboard() *Clipboard { + var _arg0 *C.GdkDisplay // out + var _cret *C.GdkClipboard // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_get_clipboard(_arg0) + runtime.KeepAlive(display) + + var _clipboard *Clipboard // out + + _clipboard = wrapClipboard(coreglib.Take(unsafe.Pointer(_cret))) + + return _clipboard +} + +// DefaultSeat returns the default GdkSeat for this display. +// +// Note that a display may not have a seat. In this case, this function will +// return NULL. +// +// The function returns the following values: +// +// - seat (optional): default seat. +func (display *Display) DefaultSeat() Seater { + var _arg0 *C.GdkDisplay // out + var _cret *C.GdkSeat // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_get_default_seat(_arg0) + runtime.KeepAlive(display) + + var _seat Seater // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Seater) + return ok + }) + rv, ok := casted.(Seater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Seater") + } + _seat = rv + } + } + + return _seat +} + +// DmabufFormats returns the dma-buf formats that are supported on this display. +// +// GTK may use OpenGL or Vulkan to support some formats. Calling this function +// will then initialize them if they aren't yet. +// +// The formats returned by this function can be used for negotiating buffer +// formats with producers such as v4l, pipewire or GStreamer. +// +// To learn more about dma-bufs, see gdk.DmabufTextureBuilder. +// +// The function returns the following values: +// +// - dmabufFormats: GdkDmabufFormats object. +func (display *Display) DmabufFormats() *DmabufFormats { + var _arg0 *C.GdkDisplay // out + var _cret *C.GdkDmabufFormats // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_get_dmabuf_formats(_arg0) + runtime.KeepAlive(display) + + var _dmabufFormats *DmabufFormats // out + + _dmabufFormats = (*DmabufFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gdk_dmabuf_formats_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dmabufFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_dmabuf_formats_unref((*C.GdkDmabufFormats)(intern.C)) + }, + ) + + return _dmabufFormats +} + +// MonitorAtSurface gets the monitor in which the largest area of surface +// resides. +// +// The function takes the following parameters: +// +// - surface: GdkSurface. +// +// The function returns the following values: +// +// - monitor (optional) with the largest overlap with surface. +func (display *Display) MonitorAtSurface(surface Surfacer) *Monitor { + var _arg0 *C.GdkDisplay // out + var _arg1 *C.GdkSurface // out + var _cret *C.GdkMonitor // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + _arg1 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_display_get_monitor_at_surface(_arg0, _arg1) + runtime.KeepAlive(display) + runtime.KeepAlive(surface) + + var _monitor *Monitor // out + + if _cret != nil { + _monitor = wrapMonitor(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _monitor +} + +// Monitors gets the list of monitors associated with this display. +// +// Subsequent calls to this function will always return the same list for the +// same display. +// +// You can listen to the GListModel::items-changed signal on this list to +// monitor changes to the monitor of this display. +// +// The function returns the following values: +// +// - listModel: GListModel of GdkMonitor. +func (self *Display) Monitors() *gio.ListModel { + var _arg0 *C.GdkDisplay // out + var _cret *C.GListModel // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_display_get_monitors(_arg0) + runtime.KeepAlive(self) + + var _listModel *gio.ListModel // out + + { + obj := coreglib.Take(unsafe.Pointer(_cret)) + _listModel = &gio.ListModel{ + Object: obj, + } + } + + return _listModel +} + +// Name gets the name of the display. +// +// The function returns the following values: +// +// - utf8: string representing the display name. This string is owned by GDK +// and should not be modified or freed. +func (display *Display) Name() string { + var _arg0 *C.GdkDisplay // out + var _cret *C.char // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_get_name(_arg0) + runtime.KeepAlive(display) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// PrimaryClipboard gets the clipboard used for the primary selection. +// +// On backends where the primary clipboard is not supported natively, GDK +// emulates this clipboard locally. +// +// The function returns the following values: +// +// - clipboard: primary clipboard. +func (display *Display) PrimaryClipboard() *Clipboard { + var _arg0 *C.GdkDisplay // out + var _cret *C.GdkClipboard // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_get_primary_clipboard(_arg0) + runtime.KeepAlive(display) + + var _clipboard *Clipboard // out + + _clipboard = wrapClipboard(coreglib.Take(unsafe.Pointer(_cret))) + + return _clipboard +} + +// Setting retrieves a desktop-wide setting such as double-click time for the +// display. +// +// The function takes the following parameters: +// +// - name of the setting. +// - value: location to store the value of the setting. +// +// The function returns the following values: +// +// - ok: TRUE if the setting existed and a value was stored in value, FALSE +// otherwise. +func (display *Display) Setting(name string, value *coreglib.Value) bool { + var _arg0 *C.GdkDisplay // out + var _arg1 *C.char // out + var _arg2 *C.GValue // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C.gdk_display_get_setting(_arg0, _arg1, _arg2) + runtime.KeepAlive(display) + runtime.KeepAlive(name) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// StartupNotificationID gets the startup notification ID for a Wayland display, +// or NULL if no ID has been defined. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - utf8 (optional): startup notification ID for display. +func (display *Display) StartupNotificationID() string { + var _arg0 *C.GdkDisplay // out + var _cret *C.char // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_get_startup_notification_id(_arg0) + runtime.KeepAlive(display) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// IsClosed finds out if the display has been closed. +// +// The function returns the following values: +// +// - ok: TRUE if the display is closed. +func (display *Display) IsClosed() bool { + var _arg0 *C.GdkDisplay // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_is_closed(_arg0) + runtime.KeepAlive(display) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsComposited returns whether surfaces can reasonably be expected to have +// their alpha channel drawn correctly on the screen. +// +// Check gdk.Display.IsRGBA() for whether the display supports an alpha channel. +// +// On X11 this function returns whether a compositing manager is compositing on +// display. +// +// On modern displays, this value is always TRUE. +// +// The function returns the following values: +// +// - ok: whether surfaces with RGBA visuals can reasonably be expected to have +// their alpha channels drawn correctly on the screen. +func (display *Display) IsComposited() bool { + var _arg0 *C.GdkDisplay // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_is_composited(_arg0) + runtime.KeepAlive(display) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsRGBA returns whether surfaces on this display are created with an alpha +// channel. +// +// Even if a TRUE is returned, it is possible that the surface’s alpha channel +// won’t be honored when displaying the surface on the screen: in particular, +// for X an appropriate windowing manager and compositing manager must be +// running to provide appropriate display. Use gdk.Display.IsComposited() to +// check if that is the case. +// +// On modern displays, this value is always TRUE. +// +// The function returns the following values: +// +// - ok: TRUE if surfaces are created with an alpha channel or FALSE if the +// display does not support this functionality. +func (display *Display) IsRGBA() bool { + var _arg0 *C.GdkDisplay // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_is_rgba(_arg0) + runtime.KeepAlive(display) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ListSeats returns the list of seats known to display. +// +// The function returns the following values: +// +// - list: the list of seats known to the GdkDisplay. +func (display *Display) ListSeats() []Seater { + var _arg0 *C.GdkDisplay // out + var _cret *C.GList // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_list_seats(_arg0) + runtime.KeepAlive(display) + + var _list []Seater // out + + _list = make([]Seater, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GdkSeat)(v) + var dst Seater // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gdk.Seater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Seater) + return ok + }) + rv, ok := casted.(Seater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Seater") + } + dst = rv + } + _list = append(_list, dst) + }) + + return _list +} + +// MapKeycode returns the keyvals bound to keycode. +// +// The Nth GdkKeymapKey in keys is bound to the Nth keyval in keyvals. +// +// When a keycode is pressed by the user, the keyval from this list of entries +// is selected by considering the effective keyboard group and level. +// +// Free the returned arrays with g_free(). +// +// The function takes the following parameters: +// +// - keycode: keycode. +// +// The function returns the following values: +// +// - keys (optional): return location for array of GdkKeymapKey. +// - keyvals (optional): return location for array of keyvals. +// - ok: TRUE if there were any entries. +func (display *Display) MapKeycode(keycode uint) ([]KeymapKey, []uint, bool) { + var _arg0 *C.GdkDisplay // out + var _arg1 C.guint // out + var _arg2 *C.GdkKeymapKey // in + var _arg4 C.int // in + var _arg3 *C.guint // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + _arg1 = C.guint(keycode) + + _cret = C.gdk_display_map_keycode(_arg0, _arg1, &_arg2, &_arg3, &_arg4) + runtime.KeepAlive(display) + runtime.KeepAlive(keycode) + + var _keys []KeymapKey // out + var _keyvals []uint // out + var _ok bool // out + + if _arg2 != nil { + defer C.free(unsafe.Pointer(_arg2)) + { + src := unsafe.Slice((*C.GdkKeymapKey)(_arg2), _arg4) + _keys = make([]KeymapKey, _arg4) + for i := 0; i < int(_arg4); i++ { + _keys[i] = *(*KeymapKey)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(&_keys[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.free(intern.C) + }, + ) + } + } + } + if _arg3 != nil { + defer C.free(unsafe.Pointer(_arg3)) + { + src := unsafe.Slice((*C.guint)(_arg3), _arg4) + _keyvals = make([]uint, _arg4) + for i := 0; i < int(_arg4); i++ { + _keyvals[i] = uint(src[i]) + } + } + } + if _cret != 0 { + _ok = true + } + + return _keys, _keyvals, _ok +} + +// MapKeyval obtains a list of keycode/group/level combinations that will +// generate keyval. +// +// Groups and levels are two kinds of keyboard mode; in general, the level +// determines whether the top or bottom symbol on a key is used, and the group +// determines whether the left or right symbol is used. +// +// On US keyboards, the shift key changes the keyboard level, and there are no +// groups. A group switch key might convert a keyboard between Hebrew to English +// modes, for example. +// +// GdkEventKey contains a group field that indicates the active keyboard group. +// The level is computed from the modifier mask. +// +// The returned array should be freed with g_free(). +// +// The function takes the following parameters: +// +// - keyval: keyval, such as GDK_KEY_a, GDK_KEY_Up, GDK_KEY_Return, etc. +// +// The function returns the following values: +// +// - keys: return location for an array of GdkKeymapKey. +// - ok: TRUE if keys were found and returned. +func (display *Display) MapKeyval(keyval uint) ([]KeymapKey, bool) { + var _arg0 *C.GdkDisplay // out + var _arg1 C.guint // out + var _arg2 *C.GdkKeymapKey // in + var _arg3 C.int // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + _arg1 = C.guint(keyval) + + _cret = C.gdk_display_map_keyval(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(display) + runtime.KeepAlive(keyval) + + var _keys []KeymapKey // out + var _ok bool // out + + defer C.free(unsafe.Pointer(_arg2)) + { + src := unsafe.Slice((*C.GdkKeymapKey)(_arg2), _arg3) + _keys = make([]KeymapKey, _arg3) + for i := 0; i < int(_arg3); i++ { + _keys[i] = *(*KeymapKey)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(&_keys[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.free(intern.C) + }, + ) + } + } + if _cret != 0 { + _ok = true + } + + return _keys, _ok +} + +// NotifyStartupComplete indicates to the GUI environment that the application +// has finished loading, using a given identifier. +// +// GTK will call this function automatically for GtkWindow +// (../gtk4/class.Window.html) with custom startup-notification +// identifier unless gtk_window_set_auto_startup_notification() +// (../gtk4/method.Window.set_auto_startup_notification.html) is called to +// disable that feature. +// +// Deprecated: Using gdk.Toplevel.SetStartupID() is sufficient. +// +// The function takes the following parameters: +// +// - startupId: startup-notification identifier, for which notification +// process should be completed. +func (display *Display) NotifyStartupComplete(startupId string) { + var _arg0 *C.GdkDisplay // out + var _arg1 *C.char // out + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(startupId))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gdk_display_notify_startup_complete(_arg0, _arg1) + runtime.KeepAlive(display) + runtime.KeepAlive(startupId) +} + +// PrepareGL checks that OpenGL is available for self and ensures that it is +// properly initialized. When this fails, an error will be set describing the +// error and this function returns FALSE. +// +// Note that even if this function succeeds, creating a GdkGLContext may still +// fail. +// +// This function is idempotent. Calling it multiple times will just return the +// same value or error. +// +// You never need to call this function, GDK will call it automatically as +// needed. But you can use it as a check when setting up code that might make +// use of OpenGL. +func (self *Display) PrepareGL() error { + var _arg0 *C.GdkDisplay // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.gdk_display_prepare_gl(_arg0, &_cerr) + runtime.KeepAlive(self) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PutEvent adds the given event to the event queue for display. +// +// Deprecated: This function is only useful in very special situations and +// should not be used by applications. +// +// The function takes the following parameters: +// +// - event: GdkEvent. +func (display *Display) PutEvent(event Eventer) { + var _arg0 *C.GdkDisplay // out + var _arg1 *C.GdkEvent // out + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + _arg1 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + C.gdk_display_put_event(_arg0, _arg1) + runtime.KeepAlive(display) + runtime.KeepAlive(event) +} + +// SupportsInputShapes returns TRUE if the display supports input shapes. +// +// This means that gdk.Surface.SetInputRegion() can be used to modify the input +// shape of surfaces on display. +// +// On modern displays, this value is always TRUE. +// +// The function returns the following values: +// +// - ok: TRUE if surfaces with modified input shape are supported. +func (display *Display) SupportsInputShapes() bool { + var _arg0 *C.GdkDisplay // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_supports_input_shapes(_arg0) + runtime.KeepAlive(display) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SupportsShadowWidth returns whether it's possible for a surface to draw +// outside of the window area. +// +// If TRUE is returned the application decides if it wants to draw shadows. +// If FALSE is returned, the compositor decides if it wants to draw shadows. +// +// The function returns the following values: +// +// - ok: TRUE if surfaces can draw shadows or FALSE if the display does not +// support this functionality. +func (display *Display) SupportsShadowWidth() bool { + var _arg0 *C.GdkDisplay // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_display_supports_shadow_width(_arg0) + runtime.KeepAlive(display) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Sync flushes any requests queued for the windowing system and waits until all +// requests have been handled. +// +// This is often used for making sure that the display is synchronized +// with the current state of the program. Calling gdk.Display.Sync() before +// gdkx11.Display.ErrorTrapPop() makes sure that any errors generated from +// earlier requests are handled before the error trap is removed. +// +// This is most useful for X11. On windowing systems where requests are handled +// synchronously, this function will do nothing. +func (display *Display) Sync() { + var _arg0 *C.GdkDisplay // out + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + C.gdk_display_sync(_arg0) + runtime.KeepAlive(display) +} + +// TranslateKey translates the contents of a GdkEventKey into a keyval, +// effective group, and level. +// +// Modifiers that affected the translation and are thus unavailable for +// application use are returned in consumed_modifiers. +// +// The effective_group is the group that was actually used for the translation; +// some keys such as Enter are not affected by the active keyboard group. +// The level is derived from state. +// +// consumed_modifiers gives modifiers that should be masked out from state +// when comparing this key press to a keyboard shortcut. For instance, on a +// US keyboard, the plus symbol is shifted, so when comparing a key press to a +// plus accelerator should be masked out. +// +// This function should rarely be needed, since GdkEventKey already contains +// the translated keyval. It is exported for the benefit of virtualized test +// environments. +// +// The function takes the following parameters: +// +// - keycode: keycode. +// - state: modifier state. +// - group: active keyboard group. +// +// The function returns the following values: +// +// - keyval (optional): return location for keyval. +// - effectiveGroup (optional): return location for effective group. +// - level (optional): return location for level. +// - consumed (optional): return location for modifiers that were used to +// determine the group or level. +// - ok: TRUE if there was a keyval bound to keycode/state/group. +func (display *Display) TranslateKey(keycode uint, state ModifierType, group int) (keyval uint, effectiveGroup, level int, consumed ModifierType, ok bool) { + var _arg0 *C.GdkDisplay // out + var _arg1 C.guint // out + var _arg2 C.GdkModifierType // out + var _arg3 C.int // out + var _arg4 C.guint // in + var _arg5 C.int // in + var _arg6 C.int // in + var _arg7 C.GdkModifierType // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + _arg1 = C.guint(keycode) + _arg2 = C.GdkModifierType(state) + _arg3 = C.int(group) + + _cret = C.gdk_display_translate_key(_arg0, _arg1, _arg2, _arg3, &_arg4, &_arg5, &_arg6, &_arg7) + runtime.KeepAlive(display) + runtime.KeepAlive(keycode) + runtime.KeepAlive(state) + runtime.KeepAlive(group) + + var _keyval uint // out + var _effectiveGroup int // out + var _level int // out + var _consumed ModifierType // out + var _ok bool // out + + _keyval = uint(_arg4) + _effectiveGroup = int(_arg5) + _level = int(_arg6) + _consumed = ModifierType(_arg7) + if _cret != 0 { + _ok = true + } + + return _keyval, _effectiveGroup, _level, _consumed, _ok +} + +// DisplayGetDefault gets the default GdkDisplay. +// +// This is a convenience function for: +// +// gdk_display_manager_get_default_display (gdk_display_manager_get ()). +// +// The function returns the following values: +// +// - display (optional): GdkDisplay, or NULL if there is no default display. +func DisplayGetDefault() *Display { + var _cret *C.GdkDisplay // in + + _cret = C.gdk_display_get_default() + + var _display *Display // out + + if _cret != nil { + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _display +} + +// DisplayOpen opens a display. +// +// If opening the display fails, NULL is returned. +// +// The function takes the following parameters: +// +// - displayName (optional): name of the display to open. +// +// The function returns the following values: +// +// - display (optional): GdkDisplay. +func DisplayOpen(displayName string) *Display { + var _arg1 *C.char // out + var _cret *C.GdkDisplay // in + + if displayName != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(displayName))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.gdk_display_open(_arg1) + runtime.KeepAlive(displayName) + + var _display *Display // out + + if _cret != nil { + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _display +} + +// DisplayManager: singleton object that offers notification when displays +// appear or disappear. +// +// You can use gdk.DisplayManager().Get to obtain the GdkDisplayManager +// singleton, but that should be rarely necessary. Typically, initializing +// GTK opens a display that you can work with without ever accessing the +// GdkDisplayManager. +// +// The GDK library can be built with support for multiple backends. The +// GdkDisplayManager object determines which backend is used at runtime. +// +// In the rare case that you need to influence which of the backends is being +// used, you can use gdk.SetAllowedBackends(). Note that you need to call this +// function before initializing GTK. +// +// # Backend-specific code +// +// When writing backend-specific code that is supposed to work with multiple +// GDK backends, you have to consider both compile time and runtime. +// At compile time, use the GDK_WINDOWING_X11, GDK_WINDOWING_WIN32 macros, +// etc. to find out which backends are present in the GDK library you are +// building your application against. At runtime, use type-check macros like +// GDK_IS_X11_DISPLAY() to find out which backend is in use: +// +// #ifdef GDK_WINDOWING_X11 +// if (GDK_IS_X11_DISPLAY (display)) +// { +// // make X11-specific calls here +// } +// else +// #endif +// #ifdef GDK_WINDOWING_MACOS +// if (GDK_IS_MACOS_DISPLAY (display)) +// { +// // make Quartz-specific calls here +// } +// else +// #endif +// g_error ("Unsupported GDK backend");. +type DisplayManager struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DisplayManager)(nil) +) + +func wrapDisplayManager(obj *coreglib.Object) *DisplayManager { + return &DisplayManager{ + Object: obj, + } +} + +func marshalDisplayManager(p uintptr) (interface{}, error) { + return wrapDisplayManager(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectDisplayOpened is emitted when a display is opened. +func (manager *DisplayManager) ConnectDisplayOpened(f func(display *Display)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(manager, "display-opened", false, unsafe.Pointer(C._gotk4_gdk4_DisplayManager_ConnectDisplayOpened), f) +} + +// DefaultDisplay gets the default GdkDisplay. +// +// The function returns the following values: +// +// - display (optional): GdkDisplay. +func (manager *DisplayManager) DefaultDisplay() *Display { + var _arg0 *C.GdkDisplayManager // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkDisplayManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C.gdk_display_manager_get_default_display(_arg0) + runtime.KeepAlive(manager) + + var _display *Display // out + + if _cret != nil { + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _display +} + +// ListDisplays: list all currently open displays. +// +// The function returns the following values: +// +// - sList: newly allocated GSList of GdkDisplay objects. +func (manager *DisplayManager) ListDisplays() []*Display { + var _arg0 *C.GdkDisplayManager // out + var _cret *C.GSList // in + + _arg0 = (*C.GdkDisplayManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C.gdk_display_manager_list_displays(_arg0) + runtime.KeepAlive(manager) + + var _sList []*Display // out + + _sList = make([]*Display, 0, gextras.SListSize(unsafe.Pointer(_cret))) + gextras.MoveSList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GdkDisplay)(v) + var dst *Display // out + dst = wrapDisplay(coreglib.Take(unsafe.Pointer(src))) + _sList = append(_sList, dst) + }) + + return _sList +} + +// OpenDisplay opens a display. +// +// The function takes the following parameters: +// +// - name (optional) of the display to open. +// +// The function returns the following values: +// +// - display (optional): GdkDisplay, or NULL if the display could not be +// opened. +func (manager *DisplayManager) OpenDisplay(name string) *Display { + var _arg0 *C.GdkDisplayManager // out + var _arg1 *C.char // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkDisplayManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + if name != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.gdk_display_manager_open_display(_arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(name) + + var _display *Display // out + + if _cret != nil { + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _display +} + +// SetDefaultDisplay sets display as the default display. +// +// The function takes the following parameters: +// +// - display: GdkDisplay. +func (manager *DisplayManager) SetDefaultDisplay(display *Display) { + var _arg0 *C.GdkDisplayManager // out + var _arg1 *C.GdkDisplay // out + + _arg0 = (*C.GdkDisplayManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + C.gdk_display_manager_set_default_display(_arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(display) +} + +// DisplayManagerGet gets the singleton GdkDisplayManager object. +// +// When called for the first time, this function consults the GDK_BACKEND +// environment variable to find out which of the supported GDK backends to use +// (in case GDK has been compiled with multiple backends). +// +// Applications can use set_allowed_backends to limit what backends will be +// used. +// +// The function returns the following values: +// +// - displayManager: global GdkDisplayManager singleton. +func DisplayManagerGet() *DisplayManager { + var _cret *C.GdkDisplayManager // in + + _cret = C.gdk_display_manager_get() + + var _displayManager *DisplayManager // out + + _displayManager = wrapDisplayManager(coreglib.Take(unsafe.Pointer(_cret))) + + return _displayManager +} + +// DmabufTexture: GdkTexture representing a DMA buffer. +// +// To create a GdkDmabufTexture, use the auxiliary gdk.DmabufTextureBuilder +// object. +// +// Dma-buf textures can only be created on Linux. +type DmabufTexture struct { + _ [0]func() // equal guard + Texture +} + +var ( + _ Texturer = (*DmabufTexture)(nil) +) + +func wrapDmabufTexture(obj *coreglib.Object) *DmabufTexture { + return &DmabufTexture{ + Texture: Texture{ + Object: obj, + Paintable: Paintable{ + Object: obj, + }, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, + }, + } +} + +func marshalDmabufTexture(p uintptr) (interface{}, error) { + return wrapDmabufTexture(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// DmabufTextureBuilder: GdkDmabufTextureBuilder is a builder used to construct +// gdk.Texture objects from DMA buffers. +// +// DMA buffers are commonly called **_dma-bufs_**. +// +// DMA buffers are a feature of the Linux kernel to enable efficient buffer +// and memory sharing between hardware such as codecs, GPUs, displays, cameras +// and the kernel drivers controlling them. For example, a decoder may want its +// output to be directly shared with the display server for rendering without a +// copy. +// +// Any device driver which participates in DMA buffer sharing, can do so as +// either the exporter or importer of buffers (or both). +// +// The memory that is shared via DMA buffers is usually stored in non-system +// memory (maybe in device's local memory or something else not directly +// accessible by the CPU), and accessing this memory from the CPU may have +// higher-than-usual overhead. +// +// In particular for graphics data, it is not uncommon that data consists +// of multiple separate blocks of memory, for example one block for each of +// the red, green and blue channels. These blocks are called **_planes_**. +// DMA buffers can have up to four planes. Even if the memory is a single block, +// the data can be organized in multiple planes, by specifying offsets from the +// beginning of the data. +// +// DMA buffers are exposed to user-space as file descriptors allowing to pass +// them between processes. If a DMA buffer has multiple planes, there is one +// file descriptor per plane. +// +// The format of the data (for graphics data, essentially its colorspace) is +// described by a 32-bit integer. These format identifiers are defined in the +// header file drm_fourcc.h and commonly referred to as **_fourcc_** values, +// since they are identified by 4 ASCII characters. Additionally, each DMA +// buffer has a **_modifier_**, which is a 64-bit integer that describes +// driver-specific details of the memory layout, such as tiling or compression. +// +// For historical reasons, some producers of dma-bufs don't provide an explicit +// modifier, but instead return DMA_FORMAT_MOD_INVALID to indicate that their +// modifier is **_implicit_**. GTK tries to accommodate this situation by +// accepting DMA_FORMAT_MOD_INVALID as modifier. +// +// The operation of GdkDmabufTextureBuilder is quite simple: Create a +// texture builder, set all the necessary properties, and then call +// gdk.DmabufTextureBuilder.Build() to create the new texture. +// +// The required properties for a dma-buf texture are +// +// - The width and height in pixels +// +// - The fourcc code and modifier which identify the format and memory layout +// of the dma-buf +// +// - The file descriptor, offset and stride for each of the planes +// +// GdkDmabufTextureBuilder can be used for quick one-shot construction of +// textures as well as kept around and reused to construct multiple textures. +// +// # For further information, see +// +// * The Linux kernel documentation +// (https://docs.kernel.org/driver-api/dma-buf.html) +// +// * The header file drm_fourcc.h +// (https://gitlab.freedesktop.org/mesa/drm/-/blob/main/include/drm/drm_fourcc.h). +type DmabufTextureBuilder struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DmabufTextureBuilder)(nil) +) + +func wrapDmabufTextureBuilder(obj *coreglib.Object) *DmabufTextureBuilder { + return &DmabufTextureBuilder{ + Object: obj, + } +} + +func marshalDmabufTextureBuilder(p uintptr) (interface{}, error) { + return wrapDmabufTextureBuilder(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewDmabufTextureBuilder creates a new texture builder. +// +// The function returns the following values: +// +// - dmabufTextureBuilder: new GdkTextureBuilder. +func NewDmabufTextureBuilder() *DmabufTextureBuilder { + var _cret *C.GdkDmabufTextureBuilder // in + + _cret = C.gdk_dmabuf_texture_builder_new() + + var _dmabufTextureBuilder *DmabufTextureBuilder // out + + _dmabufTextureBuilder = wrapDmabufTextureBuilder(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dmabufTextureBuilder +} + +// Display returns the display that this texture builder is associated with. +// +// The function returns the following values: +// +// - display: display. +func (self *DmabufTextureBuilder) Display() *Display { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_dmabuf_texture_builder_get_display(_arg0) + runtime.KeepAlive(self) + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + + return _display +} + +// Fd gets the file descriptor for a plane. +// +// The function takes the following parameters: +// +// - plane to get the fd for. +// +// The function returns the following values: +// +// - gint: file descriptor. +func (self *DmabufTextureBuilder) Fd(plane uint) int { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.uint // out + var _cret C.int // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) + + _cret = C.gdk_dmabuf_texture_builder_get_fd(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Fourcc gets the format previously set via +// gdk_dmabuf_texture_builder_set_fourcc() or 0 if the format wasn't set. +// +// The format is specified as a fourcc code. +// +// The function returns the following values: +// +// - guint32: format. +func (self *DmabufTextureBuilder) Fourcc() uint32 { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.guint32 // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_dmabuf_texture_builder_get_fourcc(_arg0) + runtime.KeepAlive(self) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// Height gets the height previously set via +// gdk_dmabuf_texture_builder_set_height() or 0 if the height wasn't set. +// +// The function returns the following values: +// +// - guint: height. +func (self *DmabufTextureBuilder) Height() uint { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.uint // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_dmabuf_texture_builder_get_height(_arg0) + runtime.KeepAlive(self) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Modifier gets the modifier value. +// +// The function returns the following values: +// +// - guint64: modifier. +func (self *DmabufTextureBuilder) Modifier() uint64 { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.guint64 // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_dmabuf_texture_builder_get_modifier(_arg0) + runtime.KeepAlive(self) + + var _guint64 uint64 // out + + _guint64 = uint64(_cret) + + return _guint64 +} + +// NPlanes gets the number of planes. +// +// The function returns the following values: +// +// - guint: number of planes. +func (self *DmabufTextureBuilder) NPlanes() uint { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.uint // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_dmabuf_texture_builder_get_n_planes(_arg0) + runtime.KeepAlive(self) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Offset gets the offset value for a plane. +// +// The function takes the following parameters: +// +// - plane to get the offset for. +// +// The function returns the following values: +// +// - guint: offset. +func (self *DmabufTextureBuilder) Offset(plane uint) uint { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.uint // out + var _cret C.uint // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) + + _cret = C.gdk_dmabuf_texture_builder_get_offset(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Premultiplied: whether the data is premultiplied. +// +// The function returns the following values: +// +// - ok: whether the data is premultiplied. +func (self *DmabufTextureBuilder) Premultiplied() bool { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_dmabuf_texture_builder_get_premultiplied(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Stride gets the stride value for a plane. +// +// The function takes the following parameters: +// +// - plane to get the stride for. +// +// The function returns the following values: +// +// - guint: stride. +func (self *DmabufTextureBuilder) Stride(plane uint) uint { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.uint // out + var _cret C.uint // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) + + _cret = C.gdk_dmabuf_texture_builder_get_stride(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// UpdateRegion gets the region previously set via +// gdk_dmabuf_texture_builder_set_update_region() or NULL if none was set. +// +// The function returns the following values: +// +// - region (optional): region. +func (self *DmabufTextureBuilder) UpdateRegion() *cairo.Region { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret *C.cairo_region_t // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_dmabuf_texture_builder_get_update_region(_arg0) + runtime.KeepAlive(self) + + var _region *cairo.Region // out + + if _cret != nil { + { + _pp := &struct{ p unsafe.Pointer }{unsafe.Pointer(_cret)} + _region = (*cairo.Region)(unsafe.Pointer(_pp)) + } + C.cairo_region_reference(_cret) + runtime.SetFinalizer(_region, func(v *cairo.Region) { + C.cairo_region_destroy((*C.cairo_region_t)(unsafe.Pointer(v.Native()))) + }) + } + + return _region +} + +// UpdateTexture gets the texture previously set via +// gdk_dmabuf_texture_builder_set_update_texture() or NULL if none was set. +// +// The function returns the following values: +// +// - texture (optional): texture. +func (self *DmabufTextureBuilder) UpdateTexture() Texturer { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret *C.GdkTexture // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_dmabuf_texture_builder_get_update_texture(_arg0) + runtime.KeepAlive(self) + + var _texture Texturer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Texturer) + return ok + }) + rv, ok := casted.(Texturer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") + } + _texture = rv + } + } + + return _texture +} + +// Width gets the width previously set via +// gdk_dmabuf_texture_builder_set_width() or 0 if the width wasn't set. +// +// The function returns the following values: +// +// - guint: width. +func (self *DmabufTextureBuilder) Width() uint { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.uint // in + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_dmabuf_texture_builder_get_width(_arg0) + runtime.KeepAlive(self) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// SetDisplay sets the display that this texture builder is associated with. +// +// The display is used to determine the supported dma-buf formats. +// +// The function takes the following parameters: +// +// - display: display. +func (self *DmabufTextureBuilder) SetDisplay(display *Display) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 *C.GdkDisplay // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + C.gdk_dmabuf_texture_builder_set_display(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(display) +} + +// SetFd sets the file descriptor for a plane. +// +// The function takes the following parameters: +// +// - plane to set the fd for. +// - fd: file descriptor. +func (self *DmabufTextureBuilder) SetFd(plane uint, fd int) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.uint // out + var _arg2 C.int // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) + _arg2 = C.int(fd) + + C.gdk_dmabuf_texture_builder_set_fd(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) + runtime.KeepAlive(fd) +} + +// SetFourcc sets the format of the texture. +// +// The format is specified as a fourcc code. +// +// The format must be set before calling gdk.GLTextureBuilder.Build(). +// +// The function takes the following parameters: +// +// - fourcc texture's format or 0 to unset. +func (self *DmabufTextureBuilder) SetFourcc(fourcc uint32) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.guint32 // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.guint32(fourcc) + + C.gdk_dmabuf_texture_builder_set_fourcc(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(fourcc) +} + +// SetHeight sets the height of the texture. +// +// The height must be set before calling gdk.GLTextureBuilder.Build(). +// +// The function takes the following parameters: +// +// - height texture's height or 0 to unset. +func (self *DmabufTextureBuilder) SetHeight(height uint) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.uint // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(height) + + C.gdk_dmabuf_texture_builder_set_height(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(height) +} + +// SetModifier sets the modifier. +// +// The function takes the following parameters: +// +// - modifier value. +func (self *DmabufTextureBuilder) SetModifier(modifier uint64) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.guint64 // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.guint64(modifier) + + C.gdk_dmabuf_texture_builder_set_modifier(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(modifier) +} + +// SetNPlanes sets the number of planes of the texture. +// +// The function takes the following parameters: +// +// - nPlanes: number of planes. +func (self *DmabufTextureBuilder) SetNPlanes(nPlanes uint) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.uint // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(nPlanes) + + C.gdk_dmabuf_texture_builder_set_n_planes(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(nPlanes) +} + +// SetOffset sets the offset for a plane. +// +// The function takes the following parameters: +// +// - plane to set the offset for. +// - offset value. +func (self *DmabufTextureBuilder) SetOffset(plane, offset uint) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.uint // out + var _arg2 C.uint // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) + _arg2 = C.uint(offset) + + C.gdk_dmabuf_texture_builder_set_offset(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) + runtime.KeepAlive(offset) +} + +// SetPremultiplied sets whether the data is premultiplied. +// +// Unless otherwise specified, all formats including alpha channels are assumed +// to be premultiplied. +// +// The function takes the following parameters: +// +// - premultiplied: whether the data is premultiplied. +func (self *DmabufTextureBuilder) SetPremultiplied(premultiplied bool) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if premultiplied { + _arg1 = C.TRUE + } + + C.gdk_dmabuf_texture_builder_set_premultiplied(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(premultiplied) +} + +// SetStride sets the stride for a plane. +// +// The stride must be set for all planes before calling +// gdk.GLTextureBuilder.Build(). +// +// The function takes the following parameters: +// +// - plane to set the stride for. +// - stride value. +func (self *DmabufTextureBuilder) SetStride(plane, stride uint) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.uint // out + var _arg2 C.uint // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) + _arg2 = C.uint(stride) + + C.gdk_dmabuf_texture_builder_set_stride(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) + runtime.KeepAlive(stride) +} + +// SetUpdateRegion sets the region to be updated by this texture. Together +// with gdk.DmabufTextureBuilder:update-texture this describes an update of a +// previous texture. +// +// When rendering animations of large textures, it is possible that consecutive +// textures are only updating contents in parts of the texture. It is then +// possible to describe this update via these two properties, so that GTK can +// avoid rerendering parts that did not change. +// +// An example would be a screen recording where only the mouse pointer moves. +// +// The function takes the following parameters: +// +// - region (optional) to update. +func (self *DmabufTextureBuilder) SetUpdateRegion(region *cairo.Region) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 *C.cairo_region_t // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if region != nil { + _arg1 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) + } + + C.gdk_dmabuf_texture_builder_set_update_region(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(region) +} + +// SetUpdateTexture sets the texture to be updated by this texture. See +// gdk.DmabufTextureBuilder.SetUpdateRegion() for an explanation. +// +// The function takes the following parameters: +// +// - texture (optional) to update. +func (self *DmabufTextureBuilder) SetUpdateTexture(texture Texturer) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 *C.GdkTexture // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if texture != nil { + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + } + + C.gdk_dmabuf_texture_builder_set_update_texture(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(texture) +} + +// SetWidth sets the width of the texture. +// +// The width must be set before calling gdk.GLTextureBuilder.Build(). +// +// The function takes the following parameters: +// +// - width texture's width or 0 to unset. +func (self *DmabufTextureBuilder) SetWidth(width uint) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.uint // out + + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(width) + + C.gdk_dmabuf_texture_builder_set_width(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(width) +} + +// Drag: GdkDrag object represents the source of an ongoing DND operation. +// +// A GdkDrag is created when a drag is started, and stays alive for duration +// of the DND operation. After a drag has been started with gdk.Drag().Begin, +// the caller gets informed about the status of the ongoing drag operation with +// signals on the GdkDrag object. +// +// GTK provides a higher level abstraction based on top of these functions, +// and so they are not normally needed in GTK applications. See the "Drag and +// Drop" section of the GTK documentation for more information. +type Drag struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Drag)(nil) +) + +// Dragger describes types inherited from class Drag. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Dragger interface { + coreglib.Objector + baseDrag() *Drag +} + +var _ Dragger = (*Drag)(nil) + +func wrapDrag(obj *coreglib.Object) *Drag { + return &Drag{ + Object: obj, + } +} + +func marshalDrag(p uintptr) (interface{}, error) { + return wrapDrag(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (drag *Drag) baseDrag() *Drag { + return drag +} + +// BaseDrag returns the underlying base object. +func BaseDrag(obj Dragger) *Drag { + return obj.baseDrag() +} + +// ConnectCancel is emitted when the drag operation is cancelled. +func (drag *Drag) ConnectCancel(f func(reason DragCancelReason)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(drag, "cancel", false, unsafe.Pointer(C._gotk4_gdk4_Drag_ConnectCancel), f) +} + +// ConnectDNDFinished is emitted when the destination side has finished reading +// all data. +// +// The drag object can now free all miscellaneous data. +func (drag *Drag) ConnectDNDFinished(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(drag, "dnd-finished", false, unsafe.Pointer(C._gotk4_gdk4_Drag_ConnectDNDFinished), f) +} + +// ConnectDropPerformed is emitted when the drop operation is performed on an +// accepting client. +func (drag *Drag) ConnectDropPerformed(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(drag, "drop-performed", false, unsafe.Pointer(C._gotk4_gdk4_Drag_ConnectDropPerformed), f) +} + +// DropDone informs GDK that the drop ended. +// +// Passing FALSE for success may trigger a drag cancellation animation. +// +// This function is called by the drag source, and should be the last call +// before dropping the reference to the drag. +// +// The GdkDrag will only take the first gdk.Drag.DropDone() call as effective, +// if this function is called multiple times, all subsequent calls will be +// ignored. +// +// The function takes the following parameters: +// +// - success: whether the drag was ultimatively successful. +func (drag *Drag) DropDone(success bool) { + var _arg0 *C.GdkDrag // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + if success { + _arg1 = C.TRUE + } + + C.gdk_drag_drop_done(_arg0, _arg1) + runtime.KeepAlive(drag) + runtime.KeepAlive(success) +} + +// Actions determines the bitmask of possible actions proposed by the source. +// +// The function returns the following values: +// +// - dragAction: GdkDragAction flags. +func (drag *Drag) Actions() DragAction { + var _arg0 *C.GdkDrag // out + var _cret C.GdkDragAction // in + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + + _cret = C.gdk_drag_get_actions(_arg0) + runtime.KeepAlive(drag) + + var _dragAction DragAction // out + + _dragAction = DragAction(_cret) + + return _dragAction +} + +// Content returns the GdkContentProvider associated to the GdkDrag object. +// +// The function returns the following values: +// +// - contentProvider: GdkContentProvider associated to drag. +func (drag *Drag) Content() *ContentProvider { + var _arg0 *C.GdkDrag // out + var _cret *C.GdkContentProvider // in + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + + _cret = C.gdk_drag_get_content(_arg0) + runtime.KeepAlive(drag) + + var _contentProvider *ContentProvider // out + + _contentProvider = wrapContentProvider(coreglib.Take(unsafe.Pointer(_cret))) + + return _contentProvider +} + +// Device returns the GdkDevice associated to the GdkDrag object. +// +// The function returns the following values: +// +// - device: GdkDevice associated to drag. +func (drag *Drag) Device() Devicer { + var _arg0 *C.GdkDrag // out + var _cret *C.GdkDevice // in + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + + _cret = C.gdk_drag_get_device(_arg0) + runtime.KeepAlive(drag) + + var _device Devicer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Devicer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Devicer) + return ok + }) + rv, ok := casted.(Devicer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Devicer") + } + _device = rv + } + + return _device +} + +// Display gets the GdkDisplay that the drag object was created for. +// +// The function returns the following values: +// +// - display: GdkDisplay. +func (drag *Drag) Display() *Display { + var _arg0 *C.GdkDrag // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + + _cret = C.gdk_drag_get_display(_arg0) + runtime.KeepAlive(drag) + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + + return _display +} + +// DragSurface returns the surface on which the drag icon should be rendered +// during the drag operation. +// +// Note that the surface may not be available until the drag operation has +// begun. GDK will move the surface in accordance with the ongoing drag +// operation. The surface is owned by drag and will be destroyed when the drag +// operation is over. +// +// The function returns the following values: +// +// - surface (optional): drag surface. +func (drag *Drag) DragSurface() Surfacer { + var _arg0 *C.GdkDrag // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + + _cret = C.gdk_drag_get_drag_surface(_arg0) + runtime.KeepAlive(drag) + + var _surface Surfacer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Surfacer) + return ok + }) + rv, ok := casted.(Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + } + + return _surface +} + +// Formats retrieves the formats supported by this GdkDrag object. +// +// The function returns the following values: +// +// - contentFormats: GdkContentFormats. +func (drag *Drag) Formats() *ContentFormats { + var _arg0 *C.GdkDrag // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + + _cret = C.gdk_drag_get_formats(_arg0) + runtime.KeepAlive(drag) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gdk_content_formats_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// SelectedAction determines the action chosen by the drag destination. +// +// The function returns the following values: +// +// - dragAction: GdkDragAction value. +func (drag *Drag) SelectedAction() DragAction { + var _arg0 *C.GdkDrag // out + var _cret C.GdkDragAction // in + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + + _cret = C.gdk_drag_get_selected_action(_arg0) + runtime.KeepAlive(drag) + + var _dragAction DragAction // out + + _dragAction = DragAction(_cret) + + return _dragAction +} + +// Surface returns the GdkSurface where the drag originates. +// +// The function returns the following values: +// +// - surface: GdkSurface where the drag originates. +func (drag *Drag) Surface() Surfacer { + var _arg0 *C.GdkDrag // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + + _cret = C.gdk_drag_get_surface(_arg0) + runtime.KeepAlive(drag) + + var _surface Surfacer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Surfacer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Surfacer) + return ok + }) + rv, ok := casted.(Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + + return _surface +} + +// SetHotspot sets the position of the drag surface that will be kept under the +// cursor hotspot. +// +// Initially, the hotspot is at the top left corner of the drag surface. +// +// The function takes the following parameters: +// +// - hotX: x coordinate of the drag surface hotspot. +// - hotY: y coordinate of the drag surface hotspot. +func (drag *Drag) SetHotspot(hotX, hotY int) { + var _arg0 *C.GdkDrag // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + _arg1 = C.int(hotX) + _arg2 = C.int(hotY) + + C.gdk_drag_set_hotspot(_arg0, _arg1, _arg2) + runtime.KeepAlive(drag) + runtime.KeepAlive(hotX) + runtime.KeepAlive(hotY) +} + +// DragBegin starts a drag and creates a new drag context for it. +// +// This function is called by the drag source. After this call, +// you probably want to set up the drag icon using the surface returned by +// gdk.Drag.GetDragSurface(). +// +// This function returns a reference to the gdk.Drag object, but GTK keeps its +// own reference as well, as long as the DND operation is going on. +// +// Note: if actions include GDK_ACTION_MOVE, you need to listen for the +// gdk.Drag::dnd-finished signal and delete the data at the source if +// gdk.Drag.GetSelectedAction() returns GDK_ACTION_MOVE. +// +// The function takes the following parameters: +// +// - surface: source surface for this drag. +// - device that controls this drag. +// - content: offered content. +// - actions supported by this drag. +// - dx: x offset to device's position where the drag nominally started. +// - dy: y offset to device's position where the drag nominally started. +// +// The function returns the following values: +// +// - drag (optional): newly created GdkDrag. +func DragBegin(surface Surfacer, device Devicer, content *ContentProvider, actions DragAction, dx, dy float64) Dragger { + var _arg1 *C.GdkSurface // out + var _arg2 *C.GdkDevice // out + var _arg3 *C.GdkContentProvider // out + var _arg4 C.GdkDragAction // out + var _arg5 C.double // out + var _arg6 C.double // out + var _cret *C.GdkDrag // in + + _arg1 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + _arg2 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + _arg3 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(content).Native())) + _arg4 = C.GdkDragAction(actions) + _arg5 = C.double(dx) + _arg6 = C.double(dy) + + _cret = C.gdk_drag_begin(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(surface) + runtime.KeepAlive(device) + runtime.KeepAlive(content) + runtime.KeepAlive(actions) + runtime.KeepAlive(dx) + runtime.KeepAlive(dy) + + var _drag Dragger // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Dragger) + return ok + }) + rv, ok := casted.(Dragger) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Dragger") + } + _drag = rv + } + } + + return _drag +} + +// DrawContext: base class for objects implementing different rendering methods. +// +// GdkDrawContext is the base object used by contexts implementing different +// rendering methods, such as gdk.CairoContext or gdk.GLContext. It provides +// shared functionality between those contexts. +// +// You will always interact with one of those subclasses. +// +// A GdkDrawContext is always associated with a single toplevel surface. +type DrawContext struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DrawContext)(nil) +) + +// DrawContexter describes types inherited from class DrawContext. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type DrawContexter interface { + coreglib.Objector + baseDrawContext() *DrawContext +} + +var _ DrawContexter = (*DrawContext)(nil) + +func wrapDrawContext(obj *coreglib.Object) *DrawContext { + return &DrawContext{ + Object: obj, + } +} + +func marshalDrawContext(p uintptr) (interface{}, error) { + return wrapDrawContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (context *DrawContext) baseDrawContext() *DrawContext { + return context +} + +// BaseDrawContext returns the underlying base object. +func BaseDrawContext(obj DrawContexter) *DrawContext { + return obj.baseDrawContext() +} + +// BeginFrame indicates that you are beginning the process of redrawing region +// on the context's surface. +// +// Calling this function begins a drawing operation using context on the surface +// that context was created from. The actual requirements and guarantees +// for the drawing operation vary for different implementations of drawing, +// so a gdk.CairoContext and a gdk.GLContext need to be treated differently. +// +// A call to this function is a requirement for drawing and must be followed +// by a call to gdk.DrawContext.EndFrame(), which will complete the drawing +// operation and ensure the contents become visible on screen. +// +// Note that the region passed to this function is the minimum region that needs +// to be drawn and depending on implementation, windowing system and hardware in +// use, it might be necessary to draw a larger region. Drawing implementation +// must use gdk.DrawContext.GetFrameRegion() to query the region that must be +// drawn. +// +// When using GTK, the widget system automatically places calls to +// gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the use +// of GskRenderer (../gsk4/class.Renderer.html)s, so application code does not +// need to call these functions explicitly. +// +// The function takes the following parameters: +// +// - region: minimum region that should be drawn. +func (context *DrawContext) BeginFrame(region *cairo.Region) { + var _arg0 *C.GdkDrawContext // out + var _arg1 *C.cairo_region_t // out + + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) + + C.gdk_draw_context_begin_frame(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(region) +} + +// EndFrame ends a drawing operation started with +// gdk_draw_context_begin_frame(). +// +// This makes the drawing available on screen. See gdk.DrawContext.BeginFrame() +// for more details about drawing. +// +// When using a gdk.GLContext, this function may call glFlush() implicitly +// before returning; it is not recommended to call glFlush() explicitly before +// calling this function. +func (context *DrawContext) EndFrame() { + var _arg0 *C.GdkDrawContext // out + + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + C.gdk_draw_context_end_frame(_arg0) + runtime.KeepAlive(context) +} + +// Display retrieves the GdkDisplay the context is created for. +// +// The function returns the following values: +// +// - display (optional): GdkDisplay. +func (context *DrawContext) Display() *Display { + var _arg0 *C.GdkDrawContext // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_draw_context_get_display(_arg0) + runtime.KeepAlive(context) + + var _display *Display // out + + if _cret != nil { + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _display +} + +// FrameRegion retrieves the region that is currently being repainted. +// +// After a call to gdk.DrawContext.BeginFrame() this function will return a +// union of the region passed to that function and the area of the surface that +// the context determined needs to be repainted. +// +// If context is not in between calls to gdk.DrawContext.BeginFrame() and +// gdk.DrawContext.EndFrame(), NULL will be returned. +// +// The function returns the following values: +// +// - region (optional): cairo region. +func (context *DrawContext) FrameRegion() *cairo.Region { + var _arg0 *C.GdkDrawContext // out + var _cret *C.cairo_region_t // in + + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_draw_context_get_frame_region(_arg0) + runtime.KeepAlive(context) + + var _region *cairo.Region // out + + if _cret != nil { + { + _pp := &struct{ p unsafe.Pointer }{unsafe.Pointer(_cret)} + _region = (*cairo.Region)(unsafe.Pointer(_pp)) + } + C.cairo_region_reference(_cret) + runtime.SetFinalizer(_region, func(v *cairo.Region) { + C.cairo_region_destroy((*C.cairo_region_t)(unsafe.Pointer(v.Native()))) + }) + } + + return _region +} + +// Surface retrieves the surface that context is bound to. +// +// The function returns the following values: +// +// - surface (optional): GdkSurface. +func (context *DrawContext) Surface() Surfacer { + var _arg0 *C.GdkDrawContext // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_draw_context_get_surface(_arg0) + runtime.KeepAlive(context) + + var _surface Surfacer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Surfacer) + return ok + }) + rv, ok := casted.(Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + } + + return _surface +} + +// IsInFrame returns TRUE if context is in the process of drawing to its +// surface. +// +// This is the case between calls to gdk.DrawContext.BeginFrame() and +// gdk.DrawContext.EndFrame(). In this situation, drawing commands may be +// effecting the contents of the context's surface. +// +// The function returns the following values: +// +// - ok: TRUE if the context is between gdk.DrawContext.BeginFrame() and +// gdk.DrawContext.EndFrame() calls. +func (context *DrawContext) IsInFrame() bool { + var _arg0 *C.GdkDrawContext // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_draw_context_is_in_frame(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Drop: GdkDrop object represents the target of an ongoing DND operation. +// +// Possible drop sites get informed about the status of the ongoing drag +// operation with events of type GDK_DRAG_ENTER, GDK_DRAG_LEAVE, GDK_DRAG_MOTION +// and GDK_DROP_START. The GdkDrop object can be obtained from these gdk.Event +// types using gdk.DNDEvent.GetDrop(). +// +// The actual data transfer is initiated from the target side via an async read, +// using one of the GdkDrop methods for this purpose: gdk.Drop.ReadAsync() or +// gdk.Drop.ReadValueAsync(). +// +// GTK provides a higher level abstraction based on top of these functions, +// and so they are not normally needed in GTK applications. See the "Drag and +// Drop" section of the GTK documentation for more information. +type Drop struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Drop)(nil) +) + +// Dropper describes types inherited from class Drop. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Dropper interface { + coreglib.Objector + baseDrop() *Drop +} + +var _ Dropper = (*Drop)(nil) + +func wrapDrop(obj *coreglib.Object) *Drop { + return &Drop{ + Object: obj, + } +} + +func marshalDrop(p uintptr) (interface{}, error) { + return wrapDrop(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (self *Drop) baseDrop() *Drop { + return self +} + +// BaseDrop returns the underlying base object. +func BaseDrop(obj Dropper) *Drop { + return obj.baseDrop() +} + +// Finish ends the drag operation after a drop. +// +// The action must be a single action selected from the actions available via +// gdk.Drop.GetActions(). +// +// The function takes the following parameters: +// +// - action performed by the destination or 0 if the drop failed. +func (self *Drop) Finish(action DragAction) { + var _arg0 *C.GdkDrop // out + var _arg1 C.GdkDragAction // out + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GdkDragAction(action) + + C.gdk_drop_finish(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(action) +} + +// Actions returns the possible actions for this GdkDrop. +// +// If this value contains multiple actions - i.e. gdk.DragAction().IsUnique +// returns FALSE for the result - gdk.Drop.Finish() must choose the action +// to use when accepting the drop. This will only happen if you passed +// GDK_ACTION_ASK as one of the possible actions in gdk.Drop.Status(). +// GDK_ACTION_ASK itself will not be included in the actions returned by this +// function. +// +// This value may change over the lifetime of the gdk.Drop both as a response +// to source side actions as well as to calls to gdk.Drop.Status() or +// gdk.Drop.Finish(). The source side will not change this value anymore once a +// drop has started. +// +// The function returns the following values: +// +// - dragAction: possible GdkDragActions. +func (self *Drop) Actions() DragAction { + var _arg0 *C.GdkDrop // out + var _cret C.GdkDragAction // in + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_drop_get_actions(_arg0) + runtime.KeepAlive(self) + + var _dragAction DragAction // out + + _dragAction = DragAction(_cret) + + return _dragAction +} + +// Device returns the GdkDevice performing the drop. +// +// The function returns the following values: +// +// - device: GdkDevice performing the drop. +func (self *Drop) Device() Devicer { + var _arg0 *C.GdkDrop // out + var _cret *C.GdkDevice // in + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_drop_get_device(_arg0) + runtime.KeepAlive(self) + + var _device Devicer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Devicer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Devicer) + return ok + }) + rv, ok := casted.(Devicer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Devicer") + } + _device = rv + } + + return _device +} + +// Display gets the GdkDisplay that self was created for. +// +// The function returns the following values: +// +// - display: GdkDisplay. +func (self *Drop) Display() *Display { + var _arg0 *C.GdkDrop // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_drop_get_display(_arg0) + runtime.KeepAlive(self) + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + + return _display +} + +// Drag: if this is an in-app drag-and-drop operation, returns the GdkDrag that +// corresponds to this drop. +// +// If it is not, NULL is returned. +// +// The function returns the following values: +// +// - drag (optional): corresponding GdkDrag. +func (self *Drop) Drag() Dragger { + var _arg0 *C.GdkDrop // out + var _cret *C.GdkDrag // in + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_drop_get_drag(_arg0) + runtime.KeepAlive(self) + + var _drag Dragger // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Dragger) + return ok + }) + rv, ok := casted.(Dragger) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Dragger") + } + _drag = rv + } + } + + return _drag +} + +// Formats returns the GdkContentFormats that the drop offers the data to be +// read in. +// +// The function returns the following values: +// +// - contentFormats: possible GdkContentFormats. +func (self *Drop) Formats() *ContentFormats { + var _arg0 *C.GdkDrop // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_drop_get_formats(_arg0) + runtime.KeepAlive(self) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gdk_content_formats_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// Surface returns the GdkSurface performing the drop. +// +// The function returns the following values: +// +// - surface: GdkSurface performing the drop. +func (self *Drop) Surface() Surfacer { + var _arg0 *C.GdkDrop // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_drop_get_surface(_arg0) + runtime.KeepAlive(self) + + var _surface Surfacer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Surfacer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Surfacer) + return ok + }) + rv, ok := casted.(Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + + return _surface +} + +// ReadAsync: asynchronously read the dropped data from a GdkDrop in a format +// that complies with one of the mime types. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object. +// - mimeTypes: pointer to an array of mime types. +// - ioPriority: i/O priority for the read operation. +// - callback (optional): GAsyncReadyCallback to call when the request is +// satisfied. +func (self *Drop) ReadAsync(ctx context.Context, mimeTypes []string, ioPriority int, callback gio.AsyncReadyCallback) { + var _arg0 *C.GdkDrop // out + var _arg3 *C.GCancellable // out + var _arg1 **C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + { + _arg1 = (**C.char)(C.calloc(C.size_t((len(mimeTypes) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(mimeTypes)+1) + var zero *C.char + out[len(mimeTypes)] = zero + for i := range mimeTypes { + out[i] = (*C.char)(unsafe.Pointer(C.CString(mimeTypes[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_drop_read_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(mimeTypes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadFinish finishes an async drop read operation. +// +// Note that you must not use blocking read calls on the returned stream +// in the GTK thread, since some platforms might require communication +// with GTK to complete the data transfer. You can use async APIs such as +// g_input_stream_read_bytes_async(). +// +// See gdk.Drop.ReadAsync(). +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +// +// The function returns the following values: +// +// - outMimeType: return location for the used mime type. +// - inputStream (optional): GInputStream. +func (self *Drop) ReadFinish(result gio.AsyncResulter) (string, gio.InputStreamer, error) { + var _arg0 *C.GdkDrop // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.char // in + var _cret *C.GInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.gdk_drop_read_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _outMimeType string // out + var _inputStream gio.InputStreamer // out + var _goerr error // out + + _outMimeType = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gio.InputStreamer) + return ok + }) + rv, ok := casted.(gio.InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _outMimeType, _inputStream, _goerr +} + +// ReadValueAsync: asynchronously request the drag operation's contents +// converted to the given type. +// +// When the operation is finished callback will be called. You must then call +// gdk.Drop.ReadValueFinish() to get the resulting GValue. +// +// For local drag-and-drop operations that are available in the given GType, +// the value will be copied directly. Otherwise, GDK will try to use +// gdk.ContentDeserializeAsync() to convert the data. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - typ: GType to read. +// - ioPriority: i/O priority of the request. +// - callback (optional) to call when the request is satisfied. +func (self *Drop) ReadValueAsync(ctx context.Context, typ coreglib.Type, ioPriority int, callback gio.AsyncReadyCallback) { + var _arg0 *C.GdkDrop // out + var _arg3 *C.GCancellable // out + var _arg1 C.GType // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GType(typ) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_drop_read_value_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(typ) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadValueFinish finishes an async drop read. +// +// See gdk.Drop.ReadValueAsync(). +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +// +// The function returns the following values: +// +// - value: GValue containing the result. +func (self *Drop) ReadValueFinish(result gio.AsyncResulter) (*coreglib.Value, error) { + var _arg0 *C.GdkDrop // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GValue // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.gdk_drop_read_value_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _value *coreglib.Value // out + var _goerr error // out + + _value = coreglib.ValueFromNative(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _value, _goerr +} + +// Status selects all actions that are potentially supported by the destination. +// +// When calling this function, do not restrict the passed in actions to the ones +// provided by gdk.Drop.GetActions(). Those actions may change in the future, +// even depending on the actions you provide here. +// +// The preferred action is a hint to the drag-and-drop mechanism about which +// action to use when multiple actions are possible. +// +// This function should be called by drag destinations in response to +// GDK_DRAG_ENTER or GDK_DRAG_MOTION events. If the destination does not yet +// know the exact actions it supports, it should set any possible actions first +// and then later call this function again. +// +// The function takes the following parameters: +// +// - actions: supported actions of the destination, or 0 to indicate that a +// drop will not be accepted. +// - preferred: unique action that's a member of actions indicating the +// preferred action. +func (self *Drop) Status(actions, preferred DragAction) { + var _arg0 *C.GdkDrop // out + var _arg1 C.GdkDragAction // out + var _arg2 C.GdkDragAction // out + + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GdkDragAction(actions) + _arg2 = C.GdkDragAction(preferred) + + C.gdk_drop_status(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(actions) + runtime.KeepAlive(preferred) +} + +// Event GdkEvents are immutable data structures, created by GDK to represent +// windowing system events. +// +// In GTK applications the events are handled automatically by toplevel widgets +// and passed on to the event controllers of appropriate widgets, so using +// GdkEvent and its related API is rarely needed. +type Event struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Event)(nil) +) + +// Eventer describes types inherited from class Event. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Eventer interface { + coreglib.Objector + baseEvent() *Event +} + +var _ Eventer = (*Event)(nil) + +func wrapEvent(obj *coreglib.Object) *Event { + return &Event{ + Object: obj, + } +} + +func marshalEvent(p uintptr) (interface{}, error) { + return wrapEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (event *Event) baseEvent() *Event { + return event +} + +// BaseEvent returns the underlying base object. +func BaseEvent(obj Eventer) *Event { + return obj.baseEvent() +} + +// Axes extracts all axis values from an event. +// +// To find out which axes are used, use gdk.DeviceTool.GetAxes() on the device +// tool returned by gdk.Event.GetDeviceTool(). +// +// The function returns the following values: +// +// - axes: array of values for all axes. +// - ok: TRUE on success, otherwise FALSE. +func (event *Event) Axes() ([]float64, bool) { + var _arg0 *C.GdkEvent // out + var _arg1 *C.double // in + var _arg2 C.guint // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_axes(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(event) + + var _axes []float64 // out + var _ok bool // out + + _axes = make([]float64, _arg2) + copy(_axes, unsafe.Slice((*float64)(unsafe.Pointer(_arg1)), _arg2)) + if _cret != 0 { + _ok = true + } + + return _axes, _ok +} + +// Axis: extract the axis value for a particular axis use from an event +// structure. +// +// To find out which axes are used, use gdk.DeviceTool.GetAxes() on the device +// tool returned by gdk.Event.GetDeviceTool(). +// +// The function takes the following parameters: +// +// - axisUse axis use to look for. +// +// The function returns the following values: +// +// - value: location to store the value found. +// - ok: TRUE if the specified axis was found, otherwise FALSE. +func (event *Event) Axis(axisUse AxisUse) (float64, bool) { + var _arg0 *C.GdkEvent // out + var _arg1 C.GdkAxisUse // out + var _arg2 C.double // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg1 = C.GdkAxisUse(axisUse) + + _cret = C.gdk_event_get_axis(_arg0, _arg1, &_arg2) + runtime.KeepAlive(event) + runtime.KeepAlive(axisUse) + + var _value float64 // out + var _ok bool // out + + _value = float64(_arg2) + if _cret != 0 { + _ok = true + } + + return _value, _ok +} + +// Device returns the device of an event. +// +// The function returns the following values: +// +// - device (optional): GdkDevice. +func (event *Event) Device() Devicer { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkDevice // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_device(_arg0) + runtime.KeepAlive(event) + + var _device Devicer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Devicer) + return ok + }) + rv, ok := casted.(Devicer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Devicer") + } + _device = rv + } + } + + return _device +} + +// DeviceTool returns a GdkDeviceTool representing the tool that caused the +// event. +// +// If the was not generated by a device that supports different tools (such as a +// tablet), this function will return NULL. +// +// Note: the GdkDeviceTool will be constant during the application +// lifetime, if settings must be stored persistently across runs, see +// gdk.DeviceTool.GetSerial(). +// +// The function returns the following values: +// +// - deviceTool (optional): current device tool. +func (event *Event) DeviceTool() *DeviceTool { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkDeviceTool // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_device_tool(_arg0) + runtime.KeepAlive(event) + + var _deviceTool *DeviceTool // out + + if _cret != nil { + _deviceTool = wrapDeviceTool(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _deviceTool +} + +// Display retrieves the display associated to the event. +// +// The function returns the following values: +// +// - display (optional): GdkDisplay. +func (event *Event) Display() *Display { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_display(_arg0) + runtime.KeepAlive(event) + + var _display *Display // out + + if _cret != nil { + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _display +} + +// EventSequence returns the event sequence to which the event belongs. +// +// Related touch events are connected in a sequence. Other events typically +// don't have event sequence information. +// +// The function returns the following values: +// +// - eventSequence: event sequence that the event belongs to. +func (event *Event) EventSequence() *EventSequence { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkEventSequence // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_event_sequence(_arg0) + runtime.KeepAlive(event) + + var _eventSequence *EventSequence // out + + _eventSequence = (*EventSequence)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _eventSequence +} + +// EventType retrieves the type of the event. +// +// The function returns the following values: +// +// - eventType: GdkEventType. +func (event *Event) EventType() EventType { + var _arg0 *C.GdkEvent // out + var _cret C.GdkEventType // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_event_type(_arg0) + runtime.KeepAlive(event) + + var _eventType EventType // out + + _eventType = EventType(_cret) + + return _eventType +} + +// History retrieves the history of the device that event is for, as a list of +// time and coordinates. +// +// The history includes positions that are not delivered as separate events to +// the application because they occurred in the same frame as event. +// +// Note that only motion and scroll events record history, and motion events do +// it only if one of the mouse buttons is down, or the device has a tool. +// +// The function returns the following values: +// +// - timeCoords (optional): an array of time and coordinates. +func (event *Event) History() []TimeCoord { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkTimeCoord // in + var _arg1 C.guint // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_history(_arg0, &_arg1) + runtime.KeepAlive(event) + + var _timeCoords []TimeCoord // out + + if _cret != nil { + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((*C.GdkTimeCoord)(_cret), _arg1) + _timeCoords = make([]TimeCoord, _arg1) + for i := 0; i < int(_arg1); i++ { + _timeCoords[i] = *(*TimeCoord)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + } + + return _timeCoords +} + +// ModifierState returns the modifier state field of an event. +// +// The function returns the following values: +// +// - modifierType: modifier state of event. +func (event *Event) ModifierState() ModifierType { + var _arg0 *C.GdkEvent // out + var _cret C.GdkModifierType // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_modifier_state(_arg0) + runtime.KeepAlive(event) + + var _modifierType ModifierType // out + + _modifierType = ModifierType(_cret) + + return _modifierType +} + +// PointerEmulated returns whether this event is an 'emulated' pointer event. +// +// Emulated pointer events typically originate from a touch events. +// +// The function returns the following values: +// +// - ok: TRUE if this event is emulated. +func (event *Event) PointerEmulated() bool { + var _arg0 *C.GdkEvent // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_pointer_emulated(_arg0) + runtime.KeepAlive(event) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Position: extract the event surface relative x/y coordinates from an event. +// +// This position is in surface coordinates (coordinates.html). +// +// The function returns the following values: +// +// - x: location to put event surface x coordinate. +// - y: location to put event surface y coordinate. +// - ok +func (event *Event) Position() (x, y float64, ok bool) { + var _arg0 *C.GdkEvent // out + var _arg1 C.double // in + var _arg2 C.double // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_position(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(event) + + var _x float64 // out + var _y float64 // out + var _ok bool // out + + _x = float64(_arg1) + _y = float64(_arg2) + if _cret != 0 { + _ok = true + } + + return _x, _y, _ok +} + +// Seat returns the seat that originated the event. +// +// The function returns the following values: +// +// - seat (optional): GdkSeat. +func (event *Event) Seat() Seater { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkSeat // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_seat(_arg0) + runtime.KeepAlive(event) + + var _seat Seater // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Seater) + return ok + }) + rv, ok := casted.(Seater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Seater") + } + _seat = rv + } + } + + return _seat +} + +// Surface extracts the surface associated with an event. +// +// The function returns the following values: +// +// - surface (optional): GdkSurface associated with the event. +func (event *Event) Surface() Surfacer { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_surface(_arg0) + runtime.KeepAlive(event) + + var _surface Surfacer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Surfacer) + return ok + }) + rv, ok := casted.(Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + } + + return _surface +} + +// Time returns the timestamp of event. +// +// Not all events have timestamps. In that case, this function returns +// GDK_CURRENT_TIME. +// +// The function returns the following values: +// +// - guint32: timestamp field from event. +func (event *Event) Time() uint32 { + var _arg0 *C.GdkEvent // out + var _cret C.guint32 // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_get_time(_arg0) + runtime.KeepAlive(event) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// TriggersContextMenu returns whether a GdkEvent should trigger a context menu, +// according to platform conventions. +// +// The right mouse button typically triggers context menus. +// +// This function should always be used instead of simply checking for +// event->button == GDK_BUTTON_SECONDARY. +// +// The function returns the following values: +// +// - ok: TRUE if the event should trigger a context menu. +func (event *Event) TriggersContextMenu() bool { + var _arg0 *C.GdkEvent // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_event_triggers_context_menu(_arg0) + runtime.KeepAlive(event) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// FocusEvent: event related to a keyboard focus change. +type FocusEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*FocusEvent)(nil) +) + +func wrapFocusEvent(obj *coreglib.Object) *FocusEvent { + return &FocusEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalFocusEvent(p uintptr) (interface{}, error) { + return wrapFocusEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// In extracts whether this event is about focus entering or leaving the +// surface. +// +// The function returns the following values: +// +// - ok: TRUE of the focus is entering. +func (event *FocusEvent) In() bool { + var _arg0 *C.GdkEvent // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_focus_event_get_in(_arg0) + runtime.KeepAlive(event) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// FrameClock: GdkFrameClock tells the application when to update and repaint a +// surface. +// +// This may be synced to the vertical refresh rate of the monitor, for example. +// Even when the frame clock uses a simple timer rather than a hardware-based +// vertical sync, the frame clock helps because it ensures everything paints at +// the same time (reducing the total number of frames). +// +// The frame clock can also automatically stop painting when it knows the frames +// will not be visible, or scale back animation framerates. +// +// GdkFrameClock is designed to be compatible with an OpenGL-based +// implementation or with mozRequestAnimationFrame in Firefox, for example. +// +// A frame clock is idle until someone requests a frame with +// gdk.FrameClock.RequestPhase(). At some later point that makes sense +// for the synchronization being implemented, the clock will process a +// frame and emit signals for each phase that has been requested. (See the +// signals of the GdkFrameClock class for documentation of the phases. +// GDK_FRAME_CLOCK_PHASE_UPDATE and the gdk.FrameClock::update signal are most +// interesting for application writers, and are used to update the animations, +// using the frame time given by gdk.FrameClock.GetFrameTime(). +// +// The frame time is reported in microseconds and generally in the same +// timescale as g_get_monotonic_time(), however, it is not the same as +// g_get_monotonic_time(). The frame time does not advance during the time a +// frame is being painted, and outside of a frame, an attempt is made so that +// all calls to gdk.FrameClock.GetFrameTime() that are called at a “similar” +// time get the same value. This means that if different animations are +// timed by looking at the difference in time between an initial value from +// gdk.FrameClock.GetFrameTime() and the value inside the gdk.FrameClock::update +// signal of the clock, they will stay exactly synchronized. +type FrameClock struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*FrameClock)(nil) +) + +// FrameClocker describes types inherited from class FrameClock. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type FrameClocker interface { + coreglib.Objector + baseFrameClock() *FrameClock +} + +var _ FrameClocker = (*FrameClock)(nil) + +func wrapFrameClock(obj *coreglib.Object) *FrameClock { + return &FrameClock{ + Object: obj, + } +} + +func marshalFrameClock(p uintptr) (interface{}, error) { + return wrapFrameClock(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (frameClock *FrameClock) baseFrameClock() *FrameClock { + return frameClock +} + +// BaseFrameClock returns the underlying base object. +func BaseFrameClock(obj FrameClocker) *FrameClock { + return obj.baseFrameClock() +} + +// ConnectAfterPaint: this signal ends processing of the frame. +// +// Applications should generally not handle this signal. +func (frameClock *FrameClock) ConnectAfterPaint(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(frameClock, "after-paint", false, unsafe.Pointer(C._gotk4_gdk4_FrameClock_ConnectAfterPaint), f) +} + +// ConnectBeforePaint begins processing of the frame. +// +// Applications should generally not handle this signal. +func (frameClock *FrameClock) ConnectBeforePaint(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(frameClock, "before-paint", false, unsafe.Pointer(C._gotk4_gdk4_FrameClock_ConnectBeforePaint), f) +} + +// ConnectFlushEvents: used to flush pending motion events that are being +// batched up and compressed together. +// +// Applications should not handle this signal. +func (frameClock *FrameClock) ConnectFlushEvents(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(frameClock, "flush-events", false, unsafe.Pointer(C._gotk4_gdk4_FrameClock_ConnectFlushEvents), f) +} + +// ConnectLayout is emitted as the second step of toolkit and application +// processing of the frame. +// +// Any work to update sizes and positions of application elements should be +// performed. GTK normally handles this internally. +func (frameClock *FrameClock) ConnectLayout(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(frameClock, "layout", false, unsafe.Pointer(C._gotk4_gdk4_FrameClock_ConnectLayout), f) +} + +// ConnectPaint is emitted as the third step of toolkit and application +// processing of the frame. +// +// The frame is repainted. GDK normally handles this internally and emits +// gdk.Surface::render signals which are turned into GtkWidget::snapshot +// (../gtk4/signal.Widget.snapshot.html) signals by GTK. +func (frameClock *FrameClock) ConnectPaint(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(frameClock, "paint", false, unsafe.Pointer(C._gotk4_gdk4_FrameClock_ConnectPaint), f) +} + +// ConnectResumeEvents is emitted after processing of the frame is finished. +// +// This signal is handled internally by GTK to resume normal event processing. +// Applications should not handle this signal. +func (frameClock *FrameClock) ConnectResumeEvents(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(frameClock, "resume-events", false, unsafe.Pointer(C._gotk4_gdk4_FrameClock_ConnectResumeEvents), f) +} + +// ConnectUpdate is emitted as the first step of toolkit and application +// processing of the frame. +// +// Animations should be updated using gdk.FrameClock.GetFrameTime(). +// Applications can connect directly to this signal, or use +// gtk_widget_add_tick_callback() (../gtk4/method.Widget.add_tick_callback.html) +// as a more convenient interface. +func (frameClock *FrameClock) ConnectUpdate(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(frameClock, "update", false, unsafe.Pointer(C._gotk4_gdk4_FrameClock_ConnectUpdate), f) +} + +// BeginUpdating starts updates for an animation. +// +// Until a matching call to gdk.FrameClock.EndUpdating() is made, +// the frame clock will continually request a new frame with the +// GDK_FRAME_CLOCK_PHASE_UPDATE phase. This function may be called multiple +// times and frames will be requested until gdk_frame_clock_end_updating() is +// called the same number of times. +func (frameClock *FrameClock) BeginUpdating() { + var _arg0 *C.GdkFrameClock // out + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + + C.gdk_frame_clock_begin_updating(_arg0) + runtime.KeepAlive(frameClock) +} + +// EndUpdating stops updates for an animation. +// +// See the documentation for gdk.FrameClock.BeginUpdating(). +func (frameClock *FrameClock) EndUpdating() { + var _arg0 *C.GdkFrameClock // out + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + + C.gdk_frame_clock_end_updating(_arg0) + runtime.KeepAlive(frameClock) +} + +// CurrentTimings gets the frame timings for the current frame. +// +// The function returns the following values: +// +// - frameTimings (optional): GdkFrameTimings for the frame currently being +// processed, or even no frame is being processed, for the previous frame. +// Before any frames have been processed, returns NULL. +func (frameClock *FrameClock) CurrentTimings() *FrameTimings { + var _arg0 *C.GdkFrameClock // out + var _cret *C.GdkFrameTimings // in + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + + _cret = C.gdk_frame_clock_get_current_timings(_arg0) + runtime.KeepAlive(frameClock) + + var _frameTimings *FrameTimings // out + + if _cret != nil { + _frameTimings = (*FrameTimings)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gdk_frame_timings_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_frameTimings)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_frame_timings_unref((*C.GdkFrameTimings)(intern.C)) + }, + ) + } + + return _frameTimings +} + +// FPS calculates the current frames-per-second, based on the frame timings of +// frame_clock. +// +// The function returns the following values: +// +// - gdouble: current fps, as a double. +func (frameClock *FrameClock) FPS() float64 { + var _arg0 *C.GdkFrameClock // out + var _cret C.double // in + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + + _cret = C.gdk_frame_clock_get_fps(_arg0) + runtime.KeepAlive(frameClock) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// FrameCounter: GdkFrameClock maintains a 64-bit counter that increments for +// each frame drawn. +// +// The function returns the following values: +// +// - gint64: inside frame processing, the value of the frame counter for the +// current frame. Outside of frame processing, the frame counter for the +// last frame. +func (frameClock *FrameClock) FrameCounter() int64 { + var _arg0 *C.GdkFrameClock // out + var _cret C.gint64 // in + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + + _cret = C.gdk_frame_clock_get_frame_counter(_arg0) + runtime.KeepAlive(frameClock) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// FrameTime gets the time that should currently be used for animations. +// +// Inside the processing of a frame, it’s the time used to compute the animation +// position of everything in a frame. Outside of a frame, it's the time of the +// conceptual “previous frame,” which may be either the actual previous frame +// time, or if that’s too old, an updated time. +// +// The function returns the following values: +// +// - gint64: timestamp in microseconds, in the timescale of of +// g_get_monotonic_time(). +func (frameClock *FrameClock) FrameTime() int64 { + var _arg0 *C.GdkFrameClock // out + var _cret C.gint64 // in + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + + _cret = C.gdk_frame_clock_get_frame_time(_arg0) + runtime.KeepAlive(frameClock) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// HistoryStart returns the frame counter for the oldest frame available in +// history. +// +// GdkFrameClock internally keeps a history of GdkFrameTimings objects for +// recent frames that can be retrieved with gdk.FrameClock.GetTimings(). +// The set of stored frames is the set from the counter values given by +// gdk.FrameClock.GetHistoryStart() and gdk.FrameClock.GetFrameCounter(), +// inclusive. +// +// The function returns the following values: +// +// - gint64: frame counter value for the oldest frame that is available in the +// internal frame history of the GdkFrameClock. +func (frameClock *FrameClock) HistoryStart() int64 { + var _arg0 *C.GdkFrameClock // out + var _cret C.gint64 // in + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + + _cret = C.gdk_frame_clock_get_history_start(_arg0) + runtime.KeepAlive(frameClock) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// RefreshInfo predicts a presentation time, based on history. +// +// Using the frame history stored in the frame clock, finds the last known +// presentation time and refresh interval, and assuming that presentation times +// are separated by the refresh interval, predicts a presentation time that +// is a multiple of the refresh interval after the last presentation time, +// and later than base_time. +// +// The function takes the following parameters: +// +// - baseTime: base time for determining a presentaton time. +// +// The function returns the following values: +// +// - refreshIntervalReturn (optional): location to store the determined +// refresh interval, or NULL. A default refresh interval of 1/60th of a +// second will be stored if no history is present. +// - presentationTimeReturn: location to store the next candidate presentation +// time after the given base time. 0 will be will be stored if no history is +// present. +func (frameClock *FrameClock) RefreshInfo(baseTime int64) (refreshIntervalReturn, presentationTimeReturn int64) { + var _arg0 *C.GdkFrameClock // out + var _arg1 C.gint64 // out + var _arg2 C.gint64 // in + var _arg3 C.gint64 // in + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + _arg1 = C.gint64(baseTime) + + C.gdk_frame_clock_get_refresh_info(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(frameClock) + runtime.KeepAlive(baseTime) + + var _refreshIntervalReturn int64 // out + var _presentationTimeReturn int64 // out + + _refreshIntervalReturn = int64(_arg2) + _presentationTimeReturn = int64(_arg3) + + return _refreshIntervalReturn, _presentationTimeReturn +} + +// Timings retrieves a GdkFrameTimings object holding timing information for the +// current frame or a recent frame. +// +// The GdkFrameTimings object may not yet be complete: see +// gdk.FrameTimings.GetComplete() and gdk.FrameClock.GetHistoryStart(). +// +// The function takes the following parameters: +// +// - frameCounter: frame counter value identifying the frame to be received. +// +// The function returns the following values: +// +// - frameTimings (optional): GdkFrameTimings object for the specified frame, +// or NULL if it is not available. +func (frameClock *FrameClock) Timings(frameCounter int64) *FrameTimings { + var _arg0 *C.GdkFrameClock // out + var _arg1 C.gint64 // out + var _cret *C.GdkFrameTimings // in + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + _arg1 = C.gint64(frameCounter) + + _cret = C.gdk_frame_clock_get_timings(_arg0, _arg1) + runtime.KeepAlive(frameClock) + runtime.KeepAlive(frameCounter) + + var _frameTimings *FrameTimings // out + + if _cret != nil { + _frameTimings = (*FrameTimings)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gdk_frame_timings_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_frameTimings)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_frame_timings_unref((*C.GdkFrameTimings)(intern.C)) + }, + ) + } + + return _frameTimings +} + +// RequestPhase asks the frame clock to run a particular phase. +// +// The signal corresponding the requested phase will be emitted the next time +// the frame clock processes. Multiple calls to gdk_frame_clock_request_phase() +// will be combined together and only one frame processed. If you are +// displaying animated content and want to continually request the +// GDK_FRAME_CLOCK_PHASE_UPDATE phase for a period of time, you should use +// gdk.FrameClock.BeginUpdating() instead, since this allows GTK to adjust +// system parameters to get maximally smooth animations. +// +// The function takes the following parameters: +// +// - phase that is requested. +func (frameClock *FrameClock) RequestPhase(phase FrameClockPhase) { + var _arg0 *C.GdkFrameClock // out + var _arg1 C.GdkFrameClockPhase // out + + _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + _arg1 = C.GdkFrameClockPhase(phase) + + C.gdk_frame_clock_request_phase(_arg0, _arg1) + runtime.KeepAlive(frameClock) + runtime.KeepAlive(phase) +} + +// GLContext: GdkGLContext is an object representing a platform-specific OpenGL +// draw context. +// +// GdkGLContexts are created for a surface using gdk.Surface.CreateGLContext(), +// and the context will match the characteristics of the surface. +// +// A GdkGLContext is not tied to any particular normal framebuffer. For +// instance, it cannot draw to the surface back buffer. The GDK repaint system +// is in full control of the painting to that. Instead, you can create render +// buffers or textures and use cairo_draw_from_gl in the draw function of your +// widget to draw them. Then GDK will handle the integration of your rendering +// with that of other widgets. +// +// Support for GdkGLContext is platform-specific and context creation can fail, +// returning NULL context. +// +// A GdkGLContext has to be made "current" in order to start using it, otherwise +// any OpenGL call will be ignored. +// +// # Creating a new OpenGL context +// +// In order to create a new GdkGLContext instance you need a GdkSurface, +// which you typically get during the realize call of a widget. +// +// A GdkGLContext is not realized until either gdk.GLContext.MakeCurrent() +// or gdk.GLContext.Realize() is called. It is possible to specify details +// of the GL context like the OpenGL version to be used, or whether the +// GL context should have extra state validation enabled after calling +// gdk.Surface.CreateGLContext() by calling gdk.GLContext.Realize(). +// If the realization fails you have the option to change the settings of the +// GdkGLContext and try again. +// +// # Using a GdkGLContext +// +// You will need to make the GdkGLContext the current context before issuing +// OpenGL calls; the system sends OpenGL commands to whichever context is +// current. It is possible to have multiple contexts, so you always need to +// ensure that the one which you want to draw with is the current one before +// issuing commands: +// +// gdk_gl_context_make_current (context); +// +// You can now perform your drawing using OpenGL commands. +// +// You can check which GdkGLContext is the current one by using +// gdk.GLContext().GetCurrent; you can also unset any GdkGLContext that is +// currently set by calling gdk.GLContext().ClearCurrent. +type GLContext struct { + _ [0]func() // equal guard + DrawContext +} + +var ( + _ DrawContexter = (*GLContext)(nil) +) + +// GLContexter describes types inherited from class GLContext. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type GLContexter interface { + coreglib.Objector + baseGLContext() *GLContext +} + +var _ GLContexter = (*GLContext)(nil) + +func wrapGLContext(obj *coreglib.Object) *GLContext { + return &GLContext{ + DrawContext: DrawContext{ + Object: obj, + }, + } +} + +func marshalGLContext(p uintptr) (interface{}, error) { + return wrapGLContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (self *GLContext) baseGLContext() *GLContext { + return self +} + +// BaseGLContext returns the underlying base object. +func BaseGLContext(obj GLContexter) *GLContext { + return obj.baseGLContext() +} + +// AllowedApis gets the allowed APIs set via gdk_gl_context_set_allowed_apis(). +// +// The function returns the following values: +// +// - glapI: allowed APIs. +func (self *GLContext) AllowedApis() GLAPI { + var _arg0 *C.GdkGLContext // out + var _cret C.GdkGLAPI // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_context_get_allowed_apis(_arg0) + runtime.KeepAlive(self) + + var _glapI GLAPI // out + + _glapI = GLAPI(_cret) + + return _glapI +} + +// Api gets the API currently in use. +// +// If the renderer has not been realized yet, 0 is returned. +// +// The function returns the following values: +// +// - glapI: currently used API. +func (self *GLContext) Api() GLAPI { + var _arg0 *C.GdkGLContext // out + var _cret C.GdkGLAPI // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_context_get_api(_arg0) + runtime.KeepAlive(self) + + var _glapI GLAPI // out + + _glapI = GLAPI(_cret) + + return _glapI +} + +// DebugEnabled retrieves whether the context is doing extra validations and +// runtime checking. +// +// See gdk.GLContext.SetDebugEnabled(). +// +// The function returns the following values: +// +// - ok: TRUE if debugging is enabled. +func (context *GLContext) DebugEnabled() bool { + var _arg0 *C.GdkGLContext // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_gl_context_get_debug_enabled(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Display retrieves the display the context is created for. +// +// The function returns the following values: +// +// - display (optional): GdkDisplay. +func (context *GLContext) Display() *Display { + var _arg0 *C.GdkGLContext // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_gl_context_get_display(_arg0) + runtime.KeepAlive(context) + + var _display *Display // out + + if _cret != nil { + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _display +} + +// ForwardCompatible retrieves whether the context is forward-compatible. +// +// See gdk.GLContext.SetForwardCompatible(). +// +// The function returns the following values: +// +// - ok: TRUE if the context should be forward-compatible. +func (context *GLContext) ForwardCompatible() bool { + var _arg0 *C.GdkGLContext // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_gl_context_get_forward_compatible(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RequiredVersion retrieves required OpenGL version set as a requirement +// for the context realization. It will not change even if a greater +// OpenGL version is supported and used after the context is realized. See +// gdk.GLContext.GetVersion() for the real version in use. +// +// See gdk.GLContext.SetRequiredVersion(). +// +// The function returns the following values: +// +// - major (optional): return location for the major version to request. +// - minor (optional): return location for the minor version to request. +func (context *GLContext) RequiredVersion() (major, minor int) { + var _arg0 *C.GdkGLContext // out + var _arg1 C.int // in + var _arg2 C.int // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + C.gdk_gl_context_get_required_version(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(context) + + var _major int // out + var _minor int // out + + _major = int(_arg1) + _minor = int(_arg2) + + return _major, _minor +} + +// SharedContext: used to retrieves the GdkGLContext that this context share +// data with. +// +// As many contexts can share data now and no single shared context exists +// anymore, this function has been deprecated and now always returns NULL. +// +// Deprecated: Use gdk.GLContext.IsShared() to check if contexts can be shared. +// +// The function returns the following values: +// +// - glContext (optional): NULL. +func (context *GLContext) SharedContext() GLContexter { + var _arg0 *C.GdkGLContext // out + var _cret *C.GdkGLContext // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_gl_context_get_shared_context(_arg0) + runtime.KeepAlive(context) + + var _glContext GLContexter // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(GLContexter) + return ok + }) + rv, ok := casted.(GLContexter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.GLContexter") + } + _glContext = rv + } + } + + return _glContext +} + +// Surface retrieves the surface used by the context. +// +// The function returns the following values: +// +// - surface (optional): GdkSurface. +func (context *GLContext) Surface() Surfacer { + var _arg0 *C.GdkGLContext // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_gl_context_get_surface(_arg0) + runtime.KeepAlive(context) + + var _surface Surfacer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Surfacer) + return ok + }) + rv, ok := casted.(Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + } + + return _surface +} + +// UseES checks whether the context is using an OpenGL or OpenGL ES profile. +// +// The function returns the following values: +// +// - ok: TRUE if the GdkGLContext is using an OpenGL ES profile; FALSE if +// other profile is in use of if the context has not yet been realized. +func (context *GLContext) UseES() bool { + var _arg0 *C.GdkGLContext // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_gl_context_get_use_es(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Version retrieves the OpenGL version of the context. +// +// The context must be realized prior to calling this function. +// +// The function returns the following values: +// +// - major: return location for the major version. +// - minor: return location for the minor version. +func (context *GLContext) Version() (major, minor int) { + var _arg0 *C.GdkGLContext // out + var _arg1 C.int // in + var _arg2 C.int // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + C.gdk_gl_context_get_version(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(context) + + var _major int // out + var _minor int // out + + _major = int(_arg1) + _minor = int(_arg2) + + return _major, _minor +} + +// IsLegacy: whether the GdkGLContext is in legacy mode or not. +// +// The GdkGLContext must be realized before calling this function. +// +// When realizing a GL context, GDK will try to use the OpenGL 3.2 core profile; +// this profile removes all the OpenGL API that was deprecated prior to the 3.2 +// version of the specification. If the realization is successful, this function +// will return FALSE. +// +// If the underlying OpenGL implementation does not support core profiles, +// GDK will fall back to a pre-3.2 compatibility profile, and this function will +// return TRUE. +// +// You can use the value returned by this function to decide which kind of +// OpenGL API to use, or whether to do extension discovery, or what kind of +// shader programs to load. +// +// The function returns the following values: +// +// - ok: TRUE if the GL context is in legacy mode. +func (context *GLContext) IsLegacy() bool { + var _arg0 *C.GdkGLContext // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.gdk_gl_context_is_legacy(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsShared checks if the two GL contexts can share resources. +// +// When they can, the texture IDs from other can be used in self. This is +// particularly useful when passing GdkGLTexture objects between different +// contexts. +// +// Contexts created for the same display with the same properties will always +// be compatible, even if they are created for different surfaces. For other +// contexts it depends on the GL backend. +// +// Both contexts must be realized for this check to succeed. If either one is +// not, this function will return FALSE. +// +// The function takes the following parameters: +// +// - other: GdkGLContext that should be compatible with self. +// +// The function returns the following values: +// +// - ok: TRUE if the two GL contexts are compatible. +func (self *GLContext) IsShared(other GLContexter) bool { + var _arg0 *C.GdkGLContext // out + var _arg1 *C.GdkGLContext // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(other).Native())) + + _cret = C.gdk_gl_context_is_shared(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(other) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// MakeCurrent makes the context the current one. +func (context *GLContext) MakeCurrent() { + var _arg0 *C.GdkGLContext // out + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + C.gdk_gl_context_make_current(_arg0) + runtime.KeepAlive(context) +} + +// Realize realizes the given GdkGLContext. +// +// It is safe to call this function on a realized GdkGLContext. +func (context *GLContext) Realize() error { + var _arg0 *C.GdkGLContext // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + C.gdk_gl_context_realize(_arg0, &_cerr) + runtime.KeepAlive(context) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAllowedApis sets the allowed APIs. When gdk_gl_context_realize() is +// called, only the allowed APIs will be tried. If you set this to 0, realizing +// will always fail. +// +// If you set it on a realized context, the property will not have any effect. +// It is only relevant during gdk_gl_context_realize(). +// +// By default, all APIs are allowed. +// +// The function takes the following parameters: +// +// - apis: allowed APIs. +func (self *GLContext) SetAllowedApis(apis GLAPI) { + var _arg0 *C.GdkGLContext // out + var _arg1 C.GdkGLAPI // out + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GdkGLAPI(apis) + + C.gdk_gl_context_set_allowed_apis(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(apis) +} + +// SetDebugEnabled sets whether the GdkGLContext should perform extra +// validations and runtime checking. +// +// This is useful during development, but has additional overhead. +// +// The GdkGLContext must not be realized or made current prior to calling this +// function. +// +// The function takes the following parameters: +// +// - enabled: whether to enable debugging in the context. +func (context *GLContext) SetDebugEnabled(enabled bool) { + var _arg0 *C.GdkGLContext // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + if enabled { + _arg1 = C.TRUE + } + + C.gdk_gl_context_set_debug_enabled(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(enabled) +} + +// SetForwardCompatible sets whether the GdkGLContext should be +// forward-compatible. +// +// Forward-compatible contexts must not support OpenGL functionality that has +// been marked as deprecated in the requested version; non-forward compatible +// contexts, on the other hand, must support both deprecated and non deprecated +// functionality. +// +// The GdkGLContext must not be realized or made current prior to calling this +// function. +// +// The function takes the following parameters: +// +// - compatible: whether the context should be forward-compatible. +func (context *GLContext) SetForwardCompatible(compatible bool) { + var _arg0 *C.GdkGLContext // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + if compatible { + _arg1 = C.TRUE + } + + C.gdk_gl_context_set_forward_compatible(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(compatible) +} + +// SetRequiredVersion sets the major and minor version of OpenGL to request. +// +// Setting major and minor to zero will use the default values. +// +// Setting major and minor lower than the minimum versions required by GTK will +// result in the context choosing the minimum version. +// +// The context must not be realized or made current prior to calling this +// function. +// +// The function takes the following parameters: +// +// - major version to request. +// - minor version to request. +func (context *GLContext) SetRequiredVersion(major, minor int) { + var _arg0 *C.GdkGLContext // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = C.int(major) + _arg2 = C.int(minor) + + C.gdk_gl_context_set_required_version(_arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(major) + runtime.KeepAlive(minor) +} + +// SetUseES requests that GDK create an OpenGL ES context instead of an OpenGL +// one. +// +// Not all platforms support OpenGL ES. +// +// The context must not have been realized. +// +// By default, GDK will attempt to automatically detect whether the underlying +// GL implementation is OpenGL or OpenGL ES once the context is realized. +// +// You should check the return value of gdk.GLContext.GetUseES() after calling +// gdk.GLContext.Realize() to decide whether to use the OpenGL or OpenGL ES API, +// extensions, or shaders. +// +// The function takes the following parameters: +// +// - useEs: whether the context should use OpenGL ES instead of OpenGL, +// or -1 to allow auto-detection. +func (context *GLContext) SetUseES(useEs int) { + var _arg0 *C.GdkGLContext // out + var _arg1 C.int // out + + _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = C.int(useEs) + + C.gdk_gl_context_set_use_es(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(useEs) +} + +// GLContextClearCurrent clears the current GdkGLContext. +// +// Any OpenGL call after this function returns will be ignored until +// gdk.GLContext.MakeCurrent() is called. +func GLContextClearCurrent() { + C.gdk_gl_context_clear_current() +} + +// GLContextGetCurrent retrieves the current GdkGLContext. +// +// The function returns the following values: +// +// - glContext (optional): current GdkGLContext. +func GLContextGetCurrent() GLContexter { + var _cret *C.GdkGLContext // in + + _cret = C.gdk_gl_context_get_current() + + var _glContext GLContexter // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(GLContexter) + return ok + }) + rv, ok := casted.(GLContexter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.GLContexter") + } + _glContext = rv + } + } + + return _glContext +} + +// GLTexture: gdkTexture representing a GL texture object. +type GLTexture struct { + _ [0]func() // equal guard + Texture +} + +var ( + _ Texturer = (*GLTexture)(nil) +) + +func wrapGLTexture(obj *coreglib.Object) *GLTexture { + return &GLTexture{ + Texture: Texture{ + Object: obj, + Paintable: Paintable{ + Object: obj, + }, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, + }, + } +} + +func marshalGLTexture(p uintptr) (interface{}, error) { + return wrapGLTexture(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Release releases the GL resources held by a GdkGLTexture. +// +// The texture contents are still available via the gdk.Texture.Download() +// function, after this function has been called. +func (self *GLTexture) Release() { + var _arg0 *C.GdkGLTexture // out + + _arg0 = (*C.GdkGLTexture)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.gdk_gl_texture_release(_arg0) + runtime.KeepAlive(self) +} + +// GLTextureBuilder: GdkGLTextureBuilder is a builder used to construct +// gdk.Texture objects from GL textures. +// +// The operation is quite simple: Create a texture builder, +// set all the necessary properties - keep in mind that the +// properties gdk.GLTextureBuilder:context, gdk.GLTextureBuilder:id, +// gdk.GLTextureBuilder:width, and gdk.GLTextureBuilder:height are mandatory - +// and then call gdk.GLTextureBuilder.Build() to create the new texture. +// +// GdkGLTextureBuilder can be used for quick one-shot construction of textures +// as well as kept around and reused to construct multiple textures. +type GLTextureBuilder struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*GLTextureBuilder)(nil) +) + +func wrapGLTextureBuilder(obj *coreglib.Object) *GLTextureBuilder { + return &GLTextureBuilder{ + Object: obj, + } +} + +func marshalGLTextureBuilder(p uintptr) (interface{}, error) { + return wrapGLTextureBuilder(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewGLTextureBuilder creates a new texture builder. +// +// The function returns the following values: +// +// - glTextureBuilder: new GdkTextureBuilder. +func NewGLTextureBuilder() *GLTextureBuilder { + var _cret *C.GdkGLTextureBuilder // in + + _cret = C.gdk_gl_texture_builder_new() + + var _glTextureBuilder *GLTextureBuilder // out + + _glTextureBuilder = wrapGLTextureBuilder(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _glTextureBuilder +} + +// Context gets the context previously set via +// gdk_gl_texture_builder_set_context() or NULL if none was set. +// +// The function returns the following values: +// +// - glContext (optional): context. +func (self *GLTextureBuilder) Context() GLContexter { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret *C.GdkGLContext // in + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_texture_builder_get_context(_arg0) + runtime.KeepAlive(self) + + var _glContext GLContexter // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(GLContexter) + return ok + }) + rv, ok := casted.(GLContexter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.GLContexter") + } + _glContext = rv + } + } + + return _glContext +} + +// Format gets the format previously set via +// gdk_gl_texture_builder_set_format(). +// +// The function returns the following values: +// +// - memoryFormat: format. +func (self *GLTextureBuilder) Format() MemoryFormat { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.GdkMemoryFormat // in + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_texture_builder_get_format(_arg0) + runtime.KeepAlive(self) + + var _memoryFormat MemoryFormat // out + + _memoryFormat = MemoryFormat(_cret) + + return _memoryFormat +} + +// HasMipmap gets whether the texture has a mipmap. +// +// The function returns the following values: +// +// - ok: whether the texture has a mipmap. +func (self *GLTextureBuilder) HasMipmap() bool { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_texture_builder_get_has_mipmap(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Height gets the height previously set via gdk_gl_texture_builder_set_height() +// or 0 if the height wasn't set. +// +// The function returns the following values: +// +// - gint: height. +func (self *GLTextureBuilder) Height() int { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.int // in + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_texture_builder_get_height(_arg0) + runtime.KeepAlive(self) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// ID gets the texture id previously set via gdk_gl_texture_builder_set_id() or +// 0 if the id wasn't set. +// +// The function returns the following values: +// +// - guint: id. +func (self *GLTextureBuilder) ID() uint { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.guint // in + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_texture_builder_get_id(_arg0) + runtime.KeepAlive(self) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Sync gets the GLsync previously set via gdk_gl_texture_builder_set_sync(). +// +// The function returns the following values: +// +// - gpointer (optional): GLSync. +func (self *GLTextureBuilder) Sync() unsafe.Pointer { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.gpointer // in + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_texture_builder_get_sync(_arg0) + runtime.KeepAlive(self) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// UpdateRegion gets the region previously set via +// gdk_gl_texture_builder_set_update_region() or NULL if none was set. +// +// The function returns the following values: +// +// - region (optional): region. +func (self *GLTextureBuilder) UpdateRegion() *cairo.Region { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret *C.cairo_region_t // in + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_texture_builder_get_update_region(_arg0) + runtime.KeepAlive(self) + + var _region *cairo.Region // out + + if _cret != nil { + { + _pp := &struct{ p unsafe.Pointer }{unsafe.Pointer(_cret)} + _region = (*cairo.Region)(unsafe.Pointer(_pp)) + } + C.cairo_region_reference(_cret) + runtime.SetFinalizer(_region, func(v *cairo.Region) { + C.cairo_region_destroy((*C.cairo_region_t)(unsafe.Pointer(v.Native()))) + }) + } + + return _region +} + +// UpdateTexture gets the texture previously set via +// gdk_gl_texture_builder_set_update_texture() or NULL if none was set. +// +// The function returns the following values: +// +// - texture (optional): texture. +func (self *GLTextureBuilder) UpdateTexture() Texturer { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret *C.GdkTexture // in + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_texture_builder_get_update_texture(_arg0) + runtime.KeepAlive(self) + + var _texture Texturer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Texturer) + return ok + }) + rv, ok := casted.(Texturer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") + } + _texture = rv + } + } + + return _texture +} + +// Width gets the width previously set via gdk_gl_texture_builder_set_width() or +// 0 if the width wasn't set. +// +// The function returns the following values: +// +// - gint: width. +func (self *GLTextureBuilder) Width() int { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.int // in + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_gl_texture_builder_get_width(_arg0) + runtime.KeepAlive(self) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// SetContext sets the context to be used for the texture. This is the context +// that owns the texture. +// +// The context must be set before calling gdk.GLTextureBuilder.Build(). +// +// The function takes the following parameters: +// +// - context (optional) the texture beongs to or NULL to unset. +func (self *GLTextureBuilder) SetContext(context GLContexter) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 *C.GdkGLContext // out + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if context != nil { + _arg1 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } + + C.gdk_gl_texture_builder_set_context(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(context) +} + +// SetFormat sets the format of the texture. The default is +// GDK_MEMORY_R8G8B8A8_PREMULTIPLIED. +// +// The format is the preferred format the texture data should be +// downloaded to. The format must be supported by the GL version of +// gdk.GLTextureBuilder:context. +// +// GDK's texture download code assumes that the format corresponds to the +// storage parameters of the GL texture in an obvious way. For example, +// a format of GDK_MEMORY_R16G16B16A16_PREMULTIPLIED is expected to be stored +// as GL_RGBA16 texture, and GDK_MEMORY_G8A8 is expected to be stored as GL_RG8 +// texture. +// +// Setting the right format is particularly useful when using high bit +// depth textures to preserve the bit depth, to set the correct value for +// unpremultiplied textures and to make sure opaque textures are treated as +// such. +// +// Non-RGBA textures need to have swizzling parameters set up properly to be +// usable in GSK's shaders. +// +// The function takes the following parameters: +// +// - format texture's format. +func (self *GLTextureBuilder) SetFormat(format MemoryFormat) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 C.GdkMemoryFormat // out + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GdkMemoryFormat(format) + + C.gdk_gl_texture_builder_set_format(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(format) +} + +// SetHasMipmap sets whether the texture has a mipmap. This allows the renderer +// and other users of the generated texture to use a higher quality downscaling. +// +// Typically, the glGenerateMipmap function is used to generate a mimap. +// +// The function takes the following parameters: +// +// - hasMipmap: whether the texture has a mipmap. +func (self *GLTextureBuilder) SetHasMipmap(hasMipmap bool) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if hasMipmap { + _arg1 = C.TRUE + } + + C.gdk_gl_texture_builder_set_has_mipmap(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(hasMipmap) +} + +// SetHeight sets the height of the texture. +// +// The height must be set before calling gdk.GLTextureBuilder.Build(). +// +// The function takes the following parameters: +// +// - height texture's height or 0 to unset. +func (self *GLTextureBuilder) SetHeight(height int) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 C.int // out + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.int(height) + + C.gdk_gl_texture_builder_set_height(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(height) +} + +// SetID sets the texture id of the texture. The texture id must remain +// unmodified until the texture was finalized. See gdk.GLTextureBuilder.Build() +// for a longer discussion. +// +// The id must be set before calling gdk.GLTextureBuilder.Build(). +// +// The function takes the following parameters: +// +// - id: texture id to be used for creating the texture. +func (self *GLTextureBuilder) SetID(id uint) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 C.guint // out + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.guint(id) + + C.gdk_gl_texture_builder_set_id(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(id) +} + +// SetSync sets the GLSync object to use for the texture. +// +// GTK will wait on this object before using the created GdkTexture. +// +// The destroy function that is passed to gdk.GLTextureBuilder.Build() is +// responsible for freeing the sync object when it is no longer needed. +// The texture builder does not destroy it and it is the callers responsibility +// to make sure it doesn't leak. +// +// The function takes the following parameters: +// +// - sync (optional): GLSync object. +func (self *GLTextureBuilder) SetSync(sync unsafe.Pointer) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 C.gpointer // out + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (C.gpointer)(unsafe.Pointer(sync)) + + C.gdk_gl_texture_builder_set_sync(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(sync) +} + +// SetUpdateRegion sets the region to be updated by this texture. Together with +// gdk.GLTextureBuilder:update-texture this describes an update of a previous +// texture. +// +// When rendering animations of large textures, it is possible that consecutive +// textures are only updating contents in parts of the texture. It is then +// possible to describe this update via these two properties, so that GTK can +// avoid rerendering parts that did not change. +// +// An example would be a screen recording where only the mouse pointer moves. +// +// The function takes the following parameters: +// +// - region (optional) to update. +func (self *GLTextureBuilder) SetUpdateRegion(region *cairo.Region) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 *C.cairo_region_t // out + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if region != nil { + _arg1 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) + } + + C.gdk_gl_texture_builder_set_update_region(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(region) +} + +// SetUpdateTexture sets the texture to be updated by this texture. See +// gdk.GLTextureBuilder.SetUpdateRegion() for an explanation. +// +// The function takes the following parameters: +// +// - texture (optional) to update. +func (self *GLTextureBuilder) SetUpdateTexture(texture Texturer) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 *C.GdkTexture // out + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if texture != nil { + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + } + + C.gdk_gl_texture_builder_set_update_texture(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(texture) +} + +// SetWidth sets the width of the texture. +// +// The width must be set before calling gdk.GLTextureBuilder.Build(). +// +// The function takes the following parameters: +// +// - width texture's width or 0 to unset. +func (self *GLTextureBuilder) SetWidth(width int) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 C.int // out + + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.int(width) + + C.gdk_gl_texture_builder_set_width(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(width) +} + +// GrabBrokenEvent: event related to a broken windowing system grab. +type GrabBrokenEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*GrabBrokenEvent)(nil) +) + +func wrapGrabBrokenEvent(obj *coreglib.Object) *GrabBrokenEvent { + return &GrabBrokenEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalGrabBrokenEvent(p uintptr) (interface{}, error) { + return wrapGrabBrokenEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// GrabSurface extracts the grab surface from a grab broken event. +// +// The function returns the following values: +// +// - surface: grab surface of event. +func (event *GrabBrokenEvent) GrabSurface() Surfacer { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_grab_broken_event_get_grab_surface(_arg0) + runtime.KeepAlive(event) + + var _surface Surfacer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Surfacer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Surfacer) + return ok + }) + rv, ok := casted.(Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + + return _surface +} + +// Implicit checks whether the grab broken event is for an implicit grab. +// +// The function returns the following values: +// +// - ok: TRUE if the an implicit grab was broken. +func (event *GrabBrokenEvent) Implicit() bool { + var _arg0 *C.GdkEvent // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_grab_broken_event_get_implicit(_arg0) + runtime.KeepAlive(event) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// KeyEvent: event related to a key-based device. +type KeyEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*KeyEvent)(nil) +) + +func wrapKeyEvent(obj *coreglib.Object) *KeyEvent { + return &KeyEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalKeyEvent(p uintptr) (interface{}, error) { + return wrapKeyEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConsumedModifiers extracts the consumed modifiers from a key event. +// +// The function returns the following values: +// +// - modifierType: consumed modifiers or event. +func (event *KeyEvent) ConsumedModifiers() ModifierType { + var _arg0 *C.GdkEvent // out + var _cret C.GdkModifierType // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_key_event_get_consumed_modifiers(_arg0) + runtime.KeepAlive(event) + + var _modifierType ModifierType // out + + _modifierType = ModifierType(_cret) + + return _modifierType +} + +// Keycode extracts the keycode from a key event. +// +// The function returns the following values: +// +// - guint: keycode of event. +func (event *KeyEvent) Keycode() uint { + var _arg0 *C.GdkEvent // out + var _cret C.guint // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_key_event_get_keycode(_arg0) + runtime.KeepAlive(event) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Keyval extracts the keyval from a key event. +// +// The function returns the following values: +// +// - guint: keyval of event. +func (event *KeyEvent) Keyval() uint { + var _arg0 *C.GdkEvent // out + var _cret C.guint // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_key_event_get_keyval(_arg0) + runtime.KeepAlive(event) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Layout extracts the layout from a key event. +// +// The function returns the following values: +// +// - guint: layout of event. +func (event *KeyEvent) Layout() uint { + var _arg0 *C.GdkEvent // out + var _cret C.guint // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_key_event_get_layout(_arg0) + runtime.KeepAlive(event) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Level extracts the shift level from a key event. +// +// The function returns the following values: +// +// - guint: shift level of event. +func (event *KeyEvent) Level() uint { + var _arg0 *C.GdkEvent // out + var _cret C.guint // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_key_event_get_level(_arg0) + runtime.KeepAlive(event) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Match gets a keyval and modifier combination that will match the event. +// +// See gdk.KeyEvent.Matches(). +// +// The function returns the following values: +// +// - keyval: return location for a keyval. +// - modifiers: return location for modifiers. +// - ok: TRUE on success. +func (event *KeyEvent) Match() (uint, ModifierType, bool) { + var _arg0 *C.GdkEvent // out + var _arg1 C.guint // in + var _arg2 C.GdkModifierType // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_key_event_get_match(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(event) + + var _keyval uint // out + var _modifiers ModifierType // out + var _ok bool // out + + _keyval = uint(_arg1) + _modifiers = ModifierType(_arg2) + if _cret != 0 { + _ok = true + } + + return _keyval, _modifiers, _ok +} + +// IsModifier extracts whether the key event is for a modifier key. +// +// The function returns the following values: +// +// - ok: TRUE if the event is for a modifier key. +func (event *KeyEvent) IsModifier() bool { + var _arg0 *C.GdkEvent // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_key_event_is_modifier(_arg0) + runtime.KeepAlive(event) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Matches a key event against a keyval and modifiers. +// +// This is typically used to trigger keyboard shortcuts such as Ctrl-C. +// +// Partial matches are possible where the combination matches if the currently +// active group is ignored. +// +// Note that we ignore Caps Lock for matching. +// +// The function takes the following parameters: +// +// - keyval to match. +// - modifiers to match. +// +// The function returns the following values: +// +// - keyMatch: GdkKeyMatch value describing whether event matches. +func (event *KeyEvent) Matches(keyval uint, modifiers ModifierType) KeyMatch { + var _arg0 *C.GdkEvent // out + var _arg1 C.guint // out + var _arg2 C.GdkModifierType // out + var _cret C.GdkKeyMatch // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg1 = C.guint(keyval) + _arg2 = C.GdkModifierType(modifiers) + + _cret = C.gdk_key_event_matches(_arg0, _arg1, _arg2) + runtime.KeepAlive(event) + runtime.KeepAlive(keyval) + runtime.KeepAlive(modifiers) + + var _keyMatch KeyMatch // out + + _keyMatch = KeyMatch(_cret) + + return _keyMatch +} + +// MemoryTexture: GdkTexture representing image data in memory. +type MemoryTexture struct { + _ [0]func() // equal guard + Texture +} + +var ( + _ Texturer = (*MemoryTexture)(nil) +) + +func wrapMemoryTexture(obj *coreglib.Object) *MemoryTexture { + return &MemoryTexture{ + Texture: Texture{ + Object: obj, + Paintable: Paintable{ + Object: obj, + }, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, + }, + } +} + +func marshalMemoryTexture(p uintptr) (interface{}, error) { + return wrapMemoryTexture(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewMemoryTexture creates a new texture for a blob of image data. +// +// The GBytes must contain stride × height pixels in the given format. +// +// The function takes the following parameters: +// +// - width of the texture. +// - height of the texture. +// - format of the data. +// - bytes: GBytes containing the pixel data. +// - stride for the data. +// +// The function returns the following values: +// +// - memoryTexture: newly-created GdkTexture. +func NewMemoryTexture(width, height int, format MemoryFormat, bytes *glib.Bytes, stride uint) *MemoryTexture { + var _arg1 C.int // out + var _arg2 C.int // out + var _arg3 C.GdkMemoryFormat // out + var _arg4 *C.GBytes // out + var _arg5 C.gsize // out + var _cret *C.GdkTexture // in + + _arg1 = C.int(width) + _arg2 = C.int(height) + _arg3 = C.GdkMemoryFormat(format) + _arg4 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + _arg5 = C.gsize(stride) + + _cret = C.gdk_memory_texture_new(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(format) + runtime.KeepAlive(bytes) + runtime.KeepAlive(stride) + + var _memoryTexture *MemoryTexture // out + + _memoryTexture = wrapMemoryTexture(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _memoryTexture +} + +// Monitor: GdkMonitor objects represent the individual outputs that are +// associated with a GdkDisplay. +// +// GdkDisplay keeps a GListModel to enumerate and monitor monitors with +// gdk.Display.GetMonitors(). You can use gdk.Display.GetMonitorAtSurface() to +// find a particular monitor. +type Monitor struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Monitor)(nil) +) + +func wrapMonitor(obj *coreglib.Object) *Monitor { + return &Monitor{ + Object: obj, + } +} + +func marshalMonitor(p uintptr) (interface{}, error) { + return wrapMonitor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectInvalidate is emitted when the output represented by monitor gets +// disconnected. +func (monitor *Monitor) ConnectInvalidate(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(monitor, "invalidate", false, unsafe.Pointer(C._gotk4_gdk4_Monitor_ConnectInvalidate), f) +} + +// Connector gets the name of the monitor's connector, if available. +// +// These are strings such as "eDP-1", or "HDMI-2". They depend on software and +// hardware configuration, and should not be relied on as stable identifiers of +// a specific monitor. +// +// The function returns the following values: +// +// - utf8 (optional): name of the connector. +func (monitor *Monitor) Connector() string { + var _arg0 *C.GdkMonitor // out + var _cret *C.char // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_connector(_arg0) + runtime.KeepAlive(monitor) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Description gets a string describing the monitor, if available. +// +// This can be used to identify a monitor in the UI. +// +// The function returns the following values: +// +// - utf8 (optional): monitor description. +func (monitor *Monitor) Description() string { + var _arg0 *C.GdkMonitor // out + var _cret *C.char // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_description(_arg0) + runtime.KeepAlive(monitor) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Display gets the display that this monitor belongs to. +// +// The function returns the following values: +// +// - display: display. +func (monitor *Monitor) Display() *Display { + var _arg0 *C.GdkMonitor // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_display(_arg0) + runtime.KeepAlive(monitor) + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + + return _display +} + +// Geometry retrieves the size and position of the monitor within the display +// coordinate space. +// +// The returned geometry is in ”application pixels”, not in ”device pixels” (see +// gdk.Monitor.GetScale()). +// +// The function returns the following values: +// +// - geometry: GdkRectangle to be filled with the monitor geometry. +func (monitor *Monitor) Geometry() *Rectangle { + var _arg0 *C.GdkMonitor // out + var _arg1 C.GdkRectangle // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + C.gdk_monitor_get_geometry(_arg0, &_arg1) + runtime.KeepAlive(monitor) + + var _geometry *Rectangle // out + + _geometry = (*Rectangle)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _geometry +} + +// HeightMm gets the height in millimeters of the monitor. +// +// The function returns the following values: +// +// - gint: physical height of the monitor. +func (monitor *Monitor) HeightMm() int { + var _arg0 *C.GdkMonitor // out + var _cret C.int // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_height_mm(_arg0) + runtime.KeepAlive(monitor) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Manufacturer gets the name or PNP ID of the monitor's manufacturer. +// +// Note that this value might also vary depending on actual display backend. +// +// The PNP ID registry is located at https://uefi.org/pnp_id_list +// (https://uefi.org/pnp_id_list). +// +// The function returns the following values: +// +// - utf8 (optional): name of the manufacturer. +func (monitor *Monitor) Manufacturer() string { + var _arg0 *C.GdkMonitor // out + var _cret *C.char // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_manufacturer(_arg0) + runtime.KeepAlive(monitor) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Model gets the string identifying the monitor model, if available. +// +// The function returns the following values: +// +// - utf8 (optional): monitor model. +func (monitor *Monitor) Model() string { + var _arg0 *C.GdkMonitor // out + var _cret *C.char // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_model(_arg0) + runtime.KeepAlive(monitor) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// RefreshRate gets the refresh rate of the monitor, if available. +// +// The value is in milli-Hertz, so a refresh rate of 60Hz is returned as 60000. +// +// The function returns the following values: +// +// - gint: refresh rate in milli-Hertz, or 0. +func (monitor *Monitor) RefreshRate() int { + var _arg0 *C.GdkMonitor // out + var _cret C.int // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_refresh_rate(_arg0) + runtime.KeepAlive(monitor) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Scale gets the internal scale factor that maps from monitor coordinates to +// device pixels. +// +// This can be used if you want to create pixel based data for a particular +// monitor, but most of the time you’re drawing to a surface where it is better +// to use gdk.Surface.GetScale() instead. +// +// The function returns the following values: +// +// - gdouble: scale. +func (monitor *Monitor) Scale() float64 { + var _arg0 *C.GdkMonitor // out + var _cret C.double // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_scale(_arg0) + runtime.KeepAlive(monitor) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// ScaleFactor gets the internal scale factor that maps from monitor coordinates +// to device pixels. +// +// On traditional systems this is 1, but on very high density outputs it can be +// a higher value (often 2). +// +// This can be used if you want to create pixel based data for a particular +// monitor, but most of the time you’re drawing to a surface where it is better +// to use gdk.Surface.GetScaleFactor() instead. +// +// The function returns the following values: +// +// - gint: scale factor. +func (monitor *Monitor) ScaleFactor() int { + var _arg0 *C.GdkMonitor // out + var _cret C.int // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_scale_factor(_arg0) + runtime.KeepAlive(monitor) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// SubpixelLayout gets information about the layout of red, green and blue +// primaries for pixels. +// +// The function returns the following values: +// +// - subpixelLayout: subpixel layout. +func (monitor *Monitor) SubpixelLayout() SubpixelLayout { + var _arg0 *C.GdkMonitor // out + var _cret C.GdkSubpixelLayout // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_subpixel_layout(_arg0) + runtime.KeepAlive(monitor) + + var _subpixelLayout SubpixelLayout // out + + _subpixelLayout = SubpixelLayout(_cret) + + return _subpixelLayout +} + +// WidthMm gets the width in millimeters of the monitor. +// +// The function returns the following values: +// +// - gint: physical width of the monitor. +func (monitor *Monitor) WidthMm() int { + var _arg0 *C.GdkMonitor // out + var _cret C.int // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_get_width_mm(_arg0) + runtime.KeepAlive(monitor) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// IsValid returns TRUE if the monitor object corresponds to a physical monitor. +// +// The monitor becomes invalid when the physical monitor is unplugged or +// removed. +// +// The function returns the following values: +// +// - ok: TRUE if the object corresponds to a physical monitor. +func (monitor *Monitor) IsValid() bool { + var _arg0 *C.GdkMonitor // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.gdk_monitor_is_valid(_arg0) + runtime.KeepAlive(monitor) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// MotionEvent: event related to a pointer or touch device motion. +type MotionEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*MotionEvent)(nil) +) + +func wrapMotionEvent(obj *coreglib.Object) *MotionEvent { + return &MotionEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalMotionEvent(p uintptr) (interface{}, error) { + return wrapMotionEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// PadEvent: event related to a pad-based device. +type PadEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*PadEvent)(nil) +) + +func wrapPadEvent(obj *coreglib.Object) *PadEvent { + return &PadEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalPadEvent(p uintptr) (interface{}, error) { + return wrapPadEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// AxisValue extracts the information from a pad strip or ring event. +// +// The function returns the following values: +// +// - index: return location for the axis index. +// - value: return location for the axis value. +func (event *PadEvent) AxisValue() (uint, float64) { + var _arg0 *C.GdkEvent // out + var _arg1 C.guint // in + var _arg2 C.double // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + C.gdk_pad_event_get_axis_value(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(event) + + var _index uint // out + var _value float64 // out + + _index = uint(_arg1) + _value = float64(_arg2) + + return _index, _value +} + +// Button extracts information about the pressed button from a pad event. +// +// The function returns the following values: +// +// - guint: button of event. +func (event *PadEvent) Button() uint { + var _arg0 *C.GdkEvent // out + var _cret C.guint // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_pad_event_get_button(_arg0) + runtime.KeepAlive(event) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// GroupMode extracts group and mode information from a pad event. +// +// The function returns the following values: +// +// - group: return location for the group. +// - mode: return location for the mode. +func (event *PadEvent) GroupMode() (group, mode uint) { + var _arg0 *C.GdkEvent // out + var _arg1 C.guint // in + var _arg2 C.guint // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + C.gdk_pad_event_get_group_mode(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(event) + + var _group uint // out + var _mode uint // out + + _group = uint(_arg1) + _mode = uint(_arg2) + + return _group, _mode +} + +// ProximityEvent: event related to the proximity of a tool to a device. +type ProximityEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*ProximityEvent)(nil) +) + +func wrapProximityEvent(obj *coreglib.Object) *ProximityEvent { + return &ProximityEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalProximityEvent(p uintptr) (interface{}, error) { + return wrapProximityEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ScrollEvent: event related to a scrolling motion. +type ScrollEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*ScrollEvent)(nil) +) + +func wrapScrollEvent(obj *coreglib.Object) *ScrollEvent { + return &ScrollEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalScrollEvent(p uintptr) (interface{}, error) { + return wrapScrollEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Deltas extracts the scroll deltas of a scroll event. +// +// The deltas will be zero unless the scroll direction is GDK_SCROLL_SMOOTH. +// +// For the representation unit of these deltas, see gdk.ScrollEvent.GetUnit(). +// +// The function returns the following values: +// +// - deltaX: return location for x scroll delta. +// - deltaY: return location for y scroll delta. +func (event *ScrollEvent) Deltas() (deltaX, deltaY float64) { + var _arg0 *C.GdkEvent // out + var _arg1 C.double // in + var _arg2 C.double // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + C.gdk_scroll_event_get_deltas(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(event) + + var _deltaX float64 // out + var _deltaY float64 // out + + _deltaX = float64(_arg1) + _deltaY = float64(_arg2) + + return _deltaX, _deltaY +} + +// Direction extracts the direction of a scroll event. +// +// The function returns the following values: +// +// - scrollDirection: scroll direction of event. +func (event *ScrollEvent) Direction() ScrollDirection { + var _arg0 *C.GdkEvent // out + var _cret C.GdkScrollDirection // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_scroll_event_get_direction(_arg0) + runtime.KeepAlive(event) + + var _scrollDirection ScrollDirection // out + + _scrollDirection = ScrollDirection(_cret) + + return _scrollDirection +} + +// Unit extracts the scroll delta unit of a scroll event. +// +// The unit will always be GDK_SCROLL_UNIT_WHEEL if the scroll direction is not +// GDK_SCROLL_SMOOTH. +// +// The function returns the following values: +// +// - scrollUnit: scroll unit. +func (event *ScrollEvent) Unit() ScrollUnit { + var _arg0 *C.GdkEvent // out + var _cret C.GdkScrollUnit // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_scroll_event_get_unit(_arg0) + runtime.KeepAlive(event) + + var _scrollUnit ScrollUnit // out + + _scrollUnit = ScrollUnit(_cret) + + return _scrollUnit +} + +// IsStop: check whether a scroll event is a stop scroll event. +// +// Scroll sequences with smooth scroll information may provide a stop scroll +// event once the interaction with the device finishes, e.g. by lifting a +// finger. This stop scroll event is the signal that a widget may trigger +// kinetic scrolling based on the current velocity. +// +// Stop scroll events always have a delta of 0/0. +// +// The function returns the following values: +// +// - ok: TRUE if the event is a scroll stop event. +func (event *ScrollEvent) IsStop() bool { + var _arg0 *C.GdkEvent // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_scroll_event_is_stop(_arg0) + runtime.KeepAlive(event) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Seat: GdkSeat object represents a collection of input devices that belong to +// a user. +type Seat struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Seat)(nil) +) + +// Seater describes types inherited from class Seat. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Seater interface { + coreglib.Objector + baseSeat() *Seat +} + +var _ Seater = (*Seat)(nil) + +func wrapSeat(obj *coreglib.Object) *Seat { + return &Seat{ + Object: obj, + } +} + +func marshalSeat(p uintptr) (interface{}, error) { + return wrapSeat(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (seat *Seat) baseSeat() *Seat { + return seat +} + +// BaseSeat returns the underlying base object. +func BaseSeat(obj Seater) *Seat { + return obj.baseSeat() +} + +// ConnectDeviceAdded is emitted when a new input device is related to this +// seat. +func (seat *Seat) ConnectDeviceAdded(f func(device Devicer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(seat, "device-added", false, unsafe.Pointer(C._gotk4_gdk4_Seat_ConnectDeviceAdded), f) +} + +// ConnectDeviceRemoved is emitted when an input device is removed (e.g. +// unplugged). +func (seat *Seat) ConnectDeviceRemoved(f func(device Devicer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(seat, "device-removed", false, unsafe.Pointer(C._gotk4_gdk4_Seat_ConnectDeviceRemoved), f) +} + +// ConnectToolAdded is emitted whenever a new tool is made known to the seat. +// +// The tool may later be assigned to a device (i.e. on proximity with a tablet). +// The device will emit the gdk.Device::tool-changed signal accordingly. +// +// A same tool may be used by several devices. +func (seat *Seat) ConnectToolAdded(f func(tool *DeviceTool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(seat, "tool-added", false, unsafe.Pointer(C._gotk4_gdk4_Seat_ConnectToolAdded), f) +} + +// ConnectToolRemoved is emitted whenever a tool is no longer known to this +// seat. +func (seat *Seat) ConnectToolRemoved(f func(tool *DeviceTool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(seat, "tool-removed", false, unsafe.Pointer(C._gotk4_gdk4_Seat_ConnectToolRemoved), f) +} + +// Capabilities returns the capabilities this GdkSeat currently has. +// +// The function returns the following values: +// +// - seatCapabilities: seat capabilities. +func (seat *Seat) Capabilities() SeatCapabilities { + var _arg0 *C.GdkSeat // out + var _cret C.GdkSeatCapabilities // in + + _arg0 = (*C.GdkSeat)(unsafe.Pointer(coreglib.InternObject(seat).Native())) + + _cret = C.gdk_seat_get_capabilities(_arg0) + runtime.KeepAlive(seat) + + var _seatCapabilities SeatCapabilities // out + + _seatCapabilities = SeatCapabilities(_cret) + + return _seatCapabilities +} + +// Devices returns the devices that match the given capabilities. +// +// The function takes the following parameters: +// +// - capabilities to get devices for. +// +// The function returns the following values: +// +// - list: list of GdkDevices. The list must be freed with g_list_free(), +// the elements are owned by GTK and must not be freed. +func (seat *Seat) Devices(capabilities SeatCapabilities) []Devicer { + var _arg0 *C.GdkSeat // out + var _arg1 C.GdkSeatCapabilities // out + var _cret *C.GList // in + + _arg0 = (*C.GdkSeat)(unsafe.Pointer(coreglib.InternObject(seat).Native())) + _arg1 = C.GdkSeatCapabilities(capabilities) + + _cret = C.gdk_seat_get_devices(_arg0, _arg1) + runtime.KeepAlive(seat) + runtime.KeepAlive(capabilities) + + var _list []Devicer // out + + _list = make([]Devicer, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GdkDevice)(v) + var dst Devicer // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gdk.Devicer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Devicer) + return ok + }) + rv, ok := casted.(Devicer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Devicer") + } + dst = rv + } + _list = append(_list, dst) + }) + + return _list +} + +// Display returns the GdkDisplay this seat belongs to. +// +// The function returns the following values: +// +// - display: GdkDisplay. This object is owned by GTK and must not be freed. +func (seat *Seat) Display() *Display { + var _arg0 *C.GdkSeat // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkSeat)(unsafe.Pointer(coreglib.InternObject(seat).Native())) + + _cret = C.gdk_seat_get_display(_arg0) + runtime.KeepAlive(seat) + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + + return _display +} + +// Keyboard returns the device that routes keyboard events. +// +// The function returns the following values: +// +// - device (optional): GdkDevice with keyboard capabilities. This object is +// owned by GTK and must not be freed. +func (seat *Seat) Keyboard() Devicer { + var _arg0 *C.GdkSeat // out + var _cret *C.GdkDevice // in + + _arg0 = (*C.GdkSeat)(unsafe.Pointer(coreglib.InternObject(seat).Native())) + + _cret = C.gdk_seat_get_keyboard(_arg0) + runtime.KeepAlive(seat) + + var _device Devicer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Devicer) + return ok + }) + rv, ok := casted.(Devicer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Devicer") + } + _device = rv + } + } + + return _device +} + +// Pointer returns the device that routes pointer events. +// +// The function returns the following values: +// +// - device (optional): GdkDevice with pointer capabilities. This object is +// owned by GTK and must not be freed. +func (seat *Seat) Pointer() Devicer { + var _arg0 *C.GdkSeat // out + var _cret *C.GdkDevice // in + + _arg0 = (*C.GdkSeat)(unsafe.Pointer(coreglib.InternObject(seat).Native())) + + _cret = C.gdk_seat_get_pointer(_arg0) + runtime.KeepAlive(seat) + + var _device Devicer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Devicer) + return ok + }) + rv, ok := casted.(Devicer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Devicer") + } + _device = rv + } + } + + return _device +} + +// Tools returns all GdkDeviceTools that are known to the application. +// +// The function returns the following values: +// +// - list: A list of tools. Free with g_list_free(). +func (seat *Seat) Tools() []*DeviceTool { + var _arg0 *C.GdkSeat // out + var _cret *C.GList // in + + _arg0 = (*C.GdkSeat)(unsafe.Pointer(coreglib.InternObject(seat).Native())) + + _cret = C.gdk_seat_get_tools(_arg0) + runtime.KeepAlive(seat) + + var _list []*DeviceTool // out + + _list = make([]*DeviceTool, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GdkDeviceTool)(v) + var dst *DeviceTool // out + dst = wrapDeviceTool(coreglib.Take(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// Snapshot: base type for snapshot operations. +// +// The subclass of GdkSnapshot used by GTK is GtkSnapshot +// (../gtk4/class.Snapshot.html). +type Snapshot struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Snapshot)(nil) +) + +// Snapshotter describes types inherited from class Snapshot. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Snapshotter interface { + coreglib.Objector + baseSnapshot() *Snapshot +} + +var _ Snapshotter = (*Snapshot)(nil) + +func wrapSnapshot(obj *coreglib.Object) *Snapshot { + return &Snapshot{ + Object: obj, + } +} + +func marshalSnapshot(p uintptr) (interface{}, error) { + return wrapSnapshot(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *Snapshot) baseSnapshot() *Snapshot { + return v +} + +// BaseSnapshot returns the underlying base object. +func BaseSnapshot(obj Snapshotter) *Snapshot { + return obj.baseSnapshot() +} + +// Surface: GdkSurface is a rectangular region on the screen. +// +// It’s a low-level object, used to implement high-level objects such as +// GtkWindow (../gtk4/class.Window.html). +// +// The surfaces you see in practice are either gdk.Toplevel or gdk.Popup, +// and those interfaces provide much of the required API to interact with these +// surfaces. Other, more specialized surface types exist, but you will rarely +// interact with them directly. +type Surface struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Surface)(nil) +) + +// Surfacer describes types inherited from class Surface. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Surfacer interface { + coreglib.Objector + baseSurface() *Surface +} + +var _ Surfacer = (*Surface)(nil) + +func wrapSurface(obj *coreglib.Object) *Surface { + return &Surface{ + Object: obj, + } +} + +func marshalSurface(p uintptr) (interface{}, error) { + return wrapSurface(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (surface *Surface) baseSurface() *Surface { + return surface +} + +// BaseSurface returns the underlying base object. +func BaseSurface(obj Surfacer) *Surface { + return obj.baseSurface() +} + +// ConnectEnterMonitor is emitted when surface starts being present on the +// monitor. +func (surface *Surface) ConnectEnterMonitor(f func(monitor *Monitor)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(surface, "enter-monitor", false, unsafe.Pointer(C._gotk4_gdk4_Surface_ConnectEnterMonitor), f) +} + +// ConnectEvent is emitted when GDK receives an input event for surface. +func (surface *Surface) ConnectEvent(f func(event Eventer) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(surface, "event", false, unsafe.Pointer(C._gotk4_gdk4_Surface_ConnectEvent), f) +} + +// ConnectLayout is emitted when the size of surface is changed, or when +// relayout should be performed. +// +// Surface size is reported in ”application pixels”, not ”device pixels” (see +// gdk_surface_get_scale_factor()). +func (surface *Surface) ConnectLayout(f func(width, height int)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(surface, "layout", false, unsafe.Pointer(C._gotk4_gdk4_Surface_ConnectLayout), f) +} + +// ConnectLeaveMonitor is emitted when surface stops being present on the +// monitor. +func (surface *Surface) ConnectLeaveMonitor(f func(monitor *Monitor)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(surface, "leave-monitor", false, unsafe.Pointer(C._gotk4_gdk4_Surface_ConnectLeaveMonitor), f) +} + +// ConnectRender is emitted when part of the surface needs to be redrawn. +func (surface *Surface) ConnectRender(f func(region *cairo.Region) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(surface, "render", false, unsafe.Pointer(C._gotk4_gdk4_Surface_ConnectRender), f) +} + +// NewSurfacePopup: create a new popup surface. +// +// The surface will be attached to parent and can be positioned relative to it +// using gdk.Popup.Present(). +// +// The function takes the following parameters: +// +// - parent surface to attach the surface to. +// - autohide: whether to hide the surface on outside clicks. +// +// The function returns the following values: +// +// - surface: new GdkSurface. +func NewSurfacePopup(parent Surfacer, autohide bool) *Surface { + var _arg1 *C.GdkSurface // out + var _arg2 C.gboolean // out + var _cret *C.GdkSurface // in + + _arg1 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + if autohide { + _arg2 = C.TRUE + } + + _cret = C.gdk_surface_new_popup(_arg1, _arg2) + runtime.KeepAlive(parent) + runtime.KeepAlive(autohide) + + var _surface *Surface // out + + _surface = wrapSurface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _surface +} + +// NewSurfaceToplevel creates a new toplevel surface. +// +// The function takes the following parameters: +// +// - display to create the surface on. +// +// The function returns the following values: +// +// - surface: new GdkSurface. +func NewSurfaceToplevel(display *Display) *Surface { + var _arg1 *C.GdkDisplay // out + var _cret *C.GdkSurface // in + + _arg1 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_surface_new_toplevel(_arg1) + runtime.KeepAlive(display) + + var _surface *Surface // out + + _surface = wrapSurface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _surface +} + +// Beep emits a short beep associated to surface. +// +// If the display of surface does not support per-surface beeps, emits a short +// beep on the display just as gdk.Display.Beep(). +func (surface *Surface) Beep() { + var _arg0 *C.GdkSurface // out + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + C.gdk_surface_beep(_arg0) + runtime.KeepAlive(surface) +} + +// CreateCairoContext creates a new GdkCairoContext for rendering on surface. +// +// The function returns the following values: +// +// - cairoContext: newly created GdkCairoContext. +func (surface *Surface) CreateCairoContext() CairoContexter { + var _arg0 *C.GdkSurface // out + var _cret *C.GdkCairoContext // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_create_cairo_context(_arg0) + runtime.KeepAlive(surface) + + var _cairoContext CairoContexter // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.CairoContexter is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(CairoContexter) + return ok + }) + rv, ok := casted.(CairoContexter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.CairoContexter") + } + _cairoContext = rv + } + + return _cairoContext +} + +// CreateGLContext creates a new GdkGLContext for the GdkSurface. +// +// The context is disconnected from any particular surface or surface. If the +// creation of the GdkGLContext failed, error will be set. Before using the +// returned GdkGLContext, you will need to call gdk.GLContext.MakeCurrent() or +// gdk.GLContext.Realize(). +// +// The function returns the following values: +// +// - glContext: newly created GdkGLContext. +func (surface *Surface) CreateGLContext() (GLContexter, error) { + var _arg0 *C.GdkSurface // out + var _cret *C.GdkGLContext // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_create_gl_context(_arg0, &_cerr) + runtime.KeepAlive(surface) + + var _glContext GLContexter // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.GLContexter is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(GLContexter) + return ok + }) + rv, ok := casted.(GLContexter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.GLContexter") + } + _glContext = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _glContext, _goerr +} + +// CreateSimilarSurface: create a new Cairo surface that is as compatible as +// possible with the given surface. +// +// For example the new surface will have the same fallback resolution and font +// options as surface. Generally, the new surface will also use the same backend +// as surface, unless that is not possible for some reason. The type of the +// returned surface may be examined with cairo_surface_get_type(). +// +// Initially the surface contents are all 0 (transparent if contents have +// transparency, black otherwise.) +// +// This function always returns a valid pointer, but it will return a pointer +// to a “nil” surface if other is already in an error state or any other error +// occurs. +// +// Deprecated: Create a suitable cairo image surface yourself. +// +// The function takes the following parameters: +// +// - content for the new surface. +// - width of the new surface. +// - height of the new surface. +// +// The function returns the following values: +// +// - ret: pointer to the newly allocated surface. The caller owns the surface +// and should call cairo_surface_destroy() when done with it. +func (surface *Surface) CreateSimilarSurface(content cairo.Content, width, height int) *cairo.Surface { + var _arg0 *C.GdkSurface // out + var _arg1 C.cairo_content_t // out + var _arg2 C.int // out + var _arg3 C.int // out + var _cret *C.cairo_surface_t // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + _arg1 = C.cairo_content_t(content) + _arg2 = C.int(width) + _arg3 = C.int(height) + + _cret = C.gdk_surface_create_similar_surface(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(surface) + runtime.KeepAlive(content) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + + var _ret *cairo.Surface // out + + _ret = cairo.WrapSurface(uintptr(unsafe.Pointer(_cret))) + runtime.SetFinalizer(_ret, func(v *cairo.Surface) { + C.cairo_surface_destroy((*C.cairo_surface_t)(unsafe.Pointer(v.Native()))) + }) + + return _ret +} + +// CreateVulkanContext sets an error and returns NULL. +// +// Deprecated: GTK does not expose any Vulkan internals. This function is a +// leftover that was accidentally exposed. +// +// The function returns the following values: +// +// - vulkanContext: NULL. +func (surface *Surface) CreateVulkanContext() (VulkanContexter, error) { + var _arg0 *C.GdkSurface // out + var _cret *C.GdkVulkanContext // in + var _cerr *C.GError // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_create_vulkan_context(_arg0, &_cerr) + runtime.KeepAlive(surface) + + var _vulkanContext VulkanContexter // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.VulkanContexter is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(VulkanContexter) + return ok + }) + rv, ok := casted.(VulkanContexter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.VulkanContexter") + } + _vulkanContext = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _vulkanContext, _goerr +} + +// Destroy destroys the window system resources associated with surface and +// decrements surface's reference count. +// +// The window system resources for all children of surface are also destroyed, +// but the children’s reference counts are not decremented. +// +// Note that a surface will not be destroyed automatically when its reference +// count reaches zero. You must call this function yourself before that happens. +func (surface *Surface) Destroy() { + var _arg0 *C.GdkSurface // out + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + C.gdk_surface_destroy(_arg0) + runtime.KeepAlive(surface) +} + +// Cursor retrieves a GdkCursor pointer for the cursor currently set on the +// GdkSurface. +// +// If the return value is NULL then there is no custom cursor set on the +// surface, and it is using the cursor for its parent surface. +// +// Use gdk.Surface.SetCursor() to unset the cursor of the surface. +// +// The function returns the following values: +// +// - cursor (optional): GdkCursor. +func (surface *Surface) Cursor() *Cursor { + var _arg0 *C.GdkSurface // out + var _cret *C.GdkCursor // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_get_cursor(_arg0) + runtime.KeepAlive(surface) + + var _cursor *Cursor // out + + if _cret != nil { + _cursor = wrapCursor(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _cursor +} + +// DeviceCursor retrieves a GdkCursor pointer for the device currently set on +// the specified GdkSurface. +// +// If the return value is NULL then there is no custom cursor set on the +// specified surface, and it is using the cursor for its parent surface. +// +// Use gdk.Surface.SetCursor() to unset the cursor of the surface. +// +// The function takes the following parameters: +// +// - device: pointer GdkDevice. +// +// The function returns the following values: +// +// - cursor (optional): GdkCursor. +func (surface *Surface) DeviceCursor(device Devicer) *Cursor { + var _arg0 *C.GdkSurface // out + var _arg1 *C.GdkDevice // out + var _cret *C.GdkCursor // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + _arg1 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_surface_get_device_cursor(_arg0, _arg1) + runtime.KeepAlive(surface) + runtime.KeepAlive(device) + + var _cursor *Cursor // out + + if _cret != nil { + _cursor = wrapCursor(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _cursor +} + +// DevicePosition obtains the current device position and modifier state. +// +// The position is given in coordinates relative to the upper left corner of +// surface. +// +// The function takes the following parameters: +// +// - device: pointer GdkDevice to query to. +// +// The function returns the following values: +// +// - x (optional): return location for the X coordinate of device. +// - y (optional): return location for the Y coordinate of device. +// - mask (optional): return location for the modifier mask. +// - ok: TRUE if the device is over the surface. +func (surface *Surface) DevicePosition(device Devicer) (x, y float64, mask ModifierType, ok bool) { + var _arg0 *C.GdkSurface // out + var _arg1 *C.GdkDevice // out + var _arg2 C.double // in + var _arg3 C.double // in + var _arg4 C.GdkModifierType // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + _arg1 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + + _cret = C.gdk_surface_get_device_position(_arg0, _arg1, &_arg2, &_arg3, &_arg4) + runtime.KeepAlive(surface) + runtime.KeepAlive(device) + + var _x float64 // out + var _y float64 // out + var _mask ModifierType // out + var _ok bool // out + + _x = float64(_arg2) + _y = float64(_arg3) + _mask = ModifierType(_arg4) + if _cret != 0 { + _ok = true + } + + return _x, _y, _mask, _ok +} + +// Display gets the GdkDisplay associated with a GdkSurface. +// +// The function returns the following values: +// +// - display: GdkDisplay associated with surface. +func (surface *Surface) Display() *Display { + var _arg0 *C.GdkSurface // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_get_display(_arg0) + runtime.KeepAlive(surface) + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + + return _display +} + +// FrameClock gets the frame clock for the surface. +// +// The frame clock for a surface never changes unless the surface is reparented +// to a new toplevel surface. +// +// The function returns the following values: +// +// - frameClock: frame clock. +func (surface *Surface) FrameClock() FrameClocker { + var _arg0 *C.GdkSurface // out + var _cret *C.GdkFrameClock // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_get_frame_clock(_arg0) + runtime.KeepAlive(surface) + + var _frameClock FrameClocker // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.FrameClocker is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(FrameClocker) + return ok + }) + rv, ok := casted.(FrameClocker) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.FrameClocker") + } + _frameClock = rv + } + + return _frameClock +} + +// Height returns the height of the given surface. +// +// Surface size is reported in ”application pixels”, not ”device pixels” (see +// gdk.Surface.GetScaleFactor()). +// +// The function returns the following values: +// +// - gint: height of surface. +func (surface *Surface) Height() int { + var _arg0 *C.GdkSurface // out + var _cret C.int // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_get_height(_arg0) + runtime.KeepAlive(surface) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Mapped checks whether the surface has been mapped. +// +// A surface is mapped with gdk.Toplevel.Present() or gdk.Popup.Present(). +// +// The function returns the following values: +// +// - ok: TRUE if the surface is mapped. +func (surface *Surface) Mapped() bool { + var _arg0 *C.GdkSurface // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_get_mapped(_arg0) + runtime.KeepAlive(surface) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Scale returns the internal scale that maps from surface coordinates to the +// actual device pixels. +// +// When the scale is bigger than 1, the windowing system prefers to get buffers +// with a resolution that is bigger than the surface size (e.g. to show the +// surface on a high-resolution display, or in a magnifier). +// +// Compare with gdk.Surface.GetScaleFactor(), which returns the next larger +// integer. +// +// The scale may change during the lifetime of the surface. +// +// The function returns the following values: +// +// - gdouble: scale. +func (surface *Surface) Scale() float64 { + var _arg0 *C.GdkSurface // out + var _cret C.double // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_get_scale(_arg0) + runtime.KeepAlive(surface) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// ScaleFactor returns the internal scale factor that maps from surface +// coordinates to the actual device pixels. +// +// On traditional systems this is 1, but on very high density outputs this +// can be a higher value (often 2). A higher value means that drawing is +// automatically scaled up to a higher resolution, so any code doing drawing +// will automatically look nicer. However, if you are supplying pixel-based data +// the scale value can be used to determine whether to use a pixel resource with +// higher resolution data. +// +// The scale factor may change during the lifetime of the surface. +// +// The function returns the following values: +// +// - gint: scale factor. +func (surface *Surface) ScaleFactor() int { + var _arg0 *C.GdkSurface // out + var _cret C.int // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_get_scale_factor(_arg0) + runtime.KeepAlive(surface) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Width returns the width of the given surface. +// +// Surface size is reported in ”application pixels”, not ”device pixels” (see +// gdk.Surface.GetScaleFactor()). +// +// The function returns the following values: +// +// - gint: width of surface. +func (surface *Surface) Width() int { + var _arg0 *C.GdkSurface // out + var _cret C.int // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_get_width(_arg0) + runtime.KeepAlive(surface) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Hide the surface. +// +// For toplevel surfaces, withdraws them, so they will no longer be known +// to the window manager; for all surfaces, unmaps them, so they won’t be +// displayed. Normally done automatically as part of gtk_widget_hide() +// (../gtk4/method.Widget.hide.html). +func (surface *Surface) Hide() { + var _arg0 *C.GdkSurface // out + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + C.gdk_surface_hide(_arg0) + runtime.KeepAlive(surface) +} + +// IsDestroyed: check to see if a surface is destroyed. +// +// The function returns the following values: +// +// - ok: TRUE if the surface is destroyed. +func (surface *Surface) IsDestroyed() bool { + var _arg0 *C.GdkSurface // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gdk_surface_is_destroyed(_arg0) + runtime.KeepAlive(surface) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// QueueRender forces a gdk.Surface::render signal emission for surface to be +// scheduled. +// +// This function is useful for implementations that track invalid regions on +// their own. +func (surface *Surface) QueueRender() { + var _arg0 *C.GdkSurface // out + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + C.gdk_surface_queue_render(_arg0) + runtime.KeepAlive(surface) +} + +// RequestLayout: request a layout phase from the surface's frame clock. +// +// See gdk.FrameClock.RequestPhase(). +func (surface *Surface) RequestLayout() { + var _arg0 *C.GdkSurface // out + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + C.gdk_surface_request_layout(_arg0) + runtime.KeepAlive(surface) +} + +// SetCursor sets the default mouse pointer for a GdkSurface. +// +// Passing NULL for the cursor argument means that surface will use the cursor +// of its parent surface. Most surfaces should use this default. Note that +// cursor must be for the same display as surface. +// +// Use gdk.Cursor.NewFromName or gdk.Cursor.NewFromTexture to create the cursor. +// To make the cursor invisible, use GDK_BLANK_CURSOR. +// +// The function takes the following parameters: +// +// - cursor (optional): GdkCursor. +func (surface *Surface) SetCursor(cursor *Cursor) { + var _arg0 *C.GdkSurface // out + var _arg1 *C.GdkCursor // out + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + if cursor != nil { + _arg1 = (*C.GdkCursor)(unsafe.Pointer(coreglib.InternObject(cursor).Native())) + } + + C.gdk_surface_set_cursor(_arg0, _arg1) + runtime.KeepAlive(surface) + runtime.KeepAlive(cursor) +} + +// SetDeviceCursor sets a specific GdkCursor for a given device when it gets +// inside surface. +// +// Passing NULL for the cursor argument means that surface will use the cursor +// of its parent surface. Most surfaces should use this default. +// +// Use gdk.Cursor.NewFromName or gdk.Cursor.NewFromTexture to create the cursor. +// To make the cursor invisible, use GDK_BLANK_CURSOR. +// +// The function takes the following parameters: +// +// - device: pointer GdkDevice. +// - cursor: GdkCursor. +func (surface *Surface) SetDeviceCursor(device Devicer, cursor *Cursor) { + var _arg0 *C.GdkSurface // out + var _arg1 *C.GdkDevice // out + var _arg2 *C.GdkCursor // out + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + _arg1 = (*C.GdkDevice)(unsafe.Pointer(coreglib.InternObject(device).Native())) + _arg2 = (*C.GdkCursor)(unsafe.Pointer(coreglib.InternObject(cursor).Native())) + + C.gdk_surface_set_device_cursor(_arg0, _arg1, _arg2) + runtime.KeepAlive(surface) + runtime.KeepAlive(device) + runtime.KeepAlive(cursor) +} + +// SetInputRegion: apply the region to the surface for the purpose of event +// handling. +// +// Mouse events which happen while the pointer position corresponds to an unset +// bit in the mask will be passed on the surface below surface. +// +// An input region is typically used with RGBA surfaces. The alpha channel +// of the surface defines which pixels are invisible and allows for nicely +// antialiased borders, and the input region controls where the surface is +// “clickable”. +// +// Use gdk.Display.SupportsInputShapes() to find out if a particular backend +// supports input regions. +// +// The function takes the following parameters: +// +// - region of surface to be reactive. +func (surface *Surface) SetInputRegion(region *cairo.Region) { + var _arg0 *C.GdkSurface // out + var _arg1 *C.cairo_region_t // out + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + _arg1 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) + + C.gdk_surface_set_input_region(_arg0, _arg1) + runtime.KeepAlive(surface) + runtime.KeepAlive(region) +} + +// SetOpaqueRegion marks a region of the GdkSurface as opaque. +// +// For optimisation purposes, compositing window managers may like to not draw +// obscured regions of surfaces, or turn off blending during for these regions. +// With RGB windows with no transparency, this is just the shape of the window, +// but with ARGB32 windows, the compositor does not know what regions of the +// window are transparent or not. +// +// This function only works for toplevel surfaces. +// +// GTK will update this property automatically if the surface background is +// opaque, as we know where the opaque regions are. If your surface background +// is not opaque, please update this property in your GtkWidgetClass.css_changed +// (../gtk4/vfunc.Widget.css_changed.html) handler. +// +// The function takes the following parameters: +// +// - region (optional): region, or NULL to make the entire surface opaque. +func (surface *Surface) SetOpaqueRegion(region *cairo.Region) { + var _arg0 *C.GdkSurface // out + var _arg1 *C.cairo_region_t // out + + _arg0 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + if region != nil { + _arg1 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) + } + + C.gdk_surface_set_opaque_region(_arg0, _arg1) + runtime.KeepAlive(surface) + runtime.KeepAlive(region) +} + +// Texture: GdkTexture is the basic element used to refer to pixel data. +// +// It is primarily meant for pixel data that will not change over multiple +// frames, and will be used for a long time. +// +// There are various ways to create GdkTexture objects from a gdkpixbuf.Pixbuf, +// or from bytes stored in memory, a file, or a gio.Resource. +// +// The ownership of the pixel data is transferred to the GdkTexture instance; +// you can only make a copy of it, via gdk.Texture.Download(). +// +// GdkTexture is an immutable object: That means you cannot change anything +// about it other than increasing the reference count via gobject.Object.Ref(), +// and consequently, it is a thread-safe object. +type Texture struct { + _ [0]func() // equal guard + *coreglib.Object + + Paintable + gio.LoadableIcon +} + +var ( + _ coreglib.Objector = (*Texture)(nil) +) + +// Texturer describes types inherited from class Texture. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Texturer interface { + coreglib.Objector + baseTexture() *Texture +} + +var _ Texturer = (*Texture)(nil) + +func wrapTexture(obj *coreglib.Object) *Texture { + return &Texture{ + Object: obj, + Paintable: Paintable{ + Object: obj, + }, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, + } +} + +func marshalTexture(p uintptr) (interface{}, error) { + return wrapTexture(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (self *Texture) baseTexture() *Texture { + return self +} + +// BaseTexture returns the underlying base object. +func BaseTexture(obj Texturer) *Texture { + return obj.baseTexture() +} + +// NewTextureForPixbuf creates a new texture object representing the GdkPixbuf. +// +// This function is threadsafe, so that you can e.g. use GTask and +// gio.Task.RunInThread() to avoid blocking the main thread while loading a big +// image. +// +// The function takes the following parameters: +// +// - pixbuf: GdkPixbuf. +// +// The function returns the following values: +// +// - texture: new GdkTexture. +func NewTextureForPixbuf(pixbuf *gdkpixbuf.Pixbuf) *Texture { + var _arg1 *C.GdkPixbuf // out + var _cret *C.GdkTexture // in + + _arg1 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_texture_new_for_pixbuf(_arg1) + runtime.KeepAlive(pixbuf) + + var _texture *Texture // out + + _texture = wrapTexture(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _texture +} + +// NewTextureFromBytes creates a new texture by loading an image from memory, +// +// The file format is detected automatically. The supported formats are PNG, +// JPEG and TIFF, though more formats might be available. +// +// If NULL is returned, then error will be set. +// +// This function is threadsafe, so that you can e.g. use GTask and +// gio.Task.RunInThread() to avoid blocking the main thread while loading a big +// image. +// +// The function takes the following parameters: +// +// - bytes: GBytes containing the data to load. +// +// The function returns the following values: +// +// - texture: newly-created GdkTexture. +func NewTextureFromBytes(bytes *glib.Bytes) (*Texture, error) { + var _arg1 *C.GBytes // out + var _cret *C.GdkTexture // in + var _cerr *C.GError // in + + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + + _cret = C.gdk_texture_new_from_bytes(_arg1, &_cerr) + runtime.KeepAlive(bytes) + + var _texture *Texture // out + var _goerr error // out + + _texture = wrapTexture(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _texture, _goerr +} + +// NewTextureFromFile creates a new texture by loading an image from a file. +// +// The file format is detected automatically. The supported formats are PNG, +// JPEG and TIFF, though more formats might be available. +// +// If NULL is returned, then error will be set. +// +// This function is threadsafe, so that you can e.g. use GTask and +// gio.Task.RunInThread() to avoid blocking the main thread while loading a big +// image. +// +// The function takes the following parameters: +// +// - file: GFile to load. +// +// The function returns the following values: +// +// - texture: newly-created GdkTexture. +func NewTextureFromFile(file gio.Filer) (*Texture, error) { + var _arg1 *C.GFile // out + var _cret *C.GdkTexture // in + var _cerr *C.GError // in + + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.gdk_texture_new_from_file(_arg1, &_cerr) + runtime.KeepAlive(file) + + var _texture *Texture // out + var _goerr error // out + + _texture = wrapTexture(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _texture, _goerr +} + +// NewTextureFromFilename creates a new texture by loading an image from a file. +// +// The file format is detected automatically. The supported formats are PNG, +// JPEG and TIFF, though more formats might be available. +// +// If NULL is returned, then error will be set. +// +// This function is threadsafe, so that you can e.g. use GTask and +// gio.Task.RunInThread() to avoid blocking the main thread while loading a big +// image. +// +// The function takes the following parameters: +// +// - path: filename to load. +// +// The function returns the following values: +// +// - texture: newly-created GdkTexture. +func NewTextureFromFilename(path string) (*Texture, error) { + var _arg1 *C.char // out + var _cret *C.GdkTexture // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_texture_new_from_filename(_arg1, &_cerr) + runtime.KeepAlive(path) + + var _texture *Texture // out + var _goerr error // out + + _texture = wrapTexture(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _texture, _goerr +} + +// NewTextureFromResource creates a new texture by loading an image from a +// resource. +// +// The file format is detected automatically. The supported formats are PNG and +// JPEG, though more formats might be available. +// +// It is a fatal error if resource_path does not specify a valid image resource +// and the program will abort if that happens. If you are unsure about the +// validity of a resource, use gdk.Texture.NewFromFile to load it. +// +// This function is threadsafe, so that you can e.g. use GTask and +// gio.Task.RunInThread() to avoid blocking the main thread while loading a big +// image. +// +// The function takes the following parameters: +// +// - resourcePath: path of the resource file. +// +// The function returns the following values: +// +// - texture: newly-created GdkTexture. +func NewTextureFromResource(resourcePath string) *Texture { + var _arg1 *C.char // out + var _cret *C.GdkTexture // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(resourcePath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_texture_new_from_resource(_arg1) + runtime.KeepAlive(resourcePath) + + var _texture *Texture // out + + _texture = wrapTexture(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _texture +} + +// Format gets the memory format most closely associated with the data of the +// texture. +// +// Note that it may not be an exact match for texture data stored on the GPU or +// with compression. +// +// The format can give an indication about the bit depth and opacity of the +// texture and is useful to determine the best format for downloading the +// texture. +// +// The function returns the following values: +// +// - memoryFormat: preferred format for the texture's data. +func (self *Texture) Format() MemoryFormat { + var _arg0 *C.GdkTexture // out + var _cret C.GdkMemoryFormat // in + + _arg0 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gdk_texture_get_format(_arg0) + runtime.KeepAlive(self) + + var _memoryFormat MemoryFormat // out + + _memoryFormat = MemoryFormat(_cret) + + return _memoryFormat +} + +// Height returns the height of the texture, in pixels. +// +// The function returns the following values: +// +// - gint: height of the GdkTexture. +func (texture *Texture) Height() int { + var _arg0 *C.GdkTexture // out + var _cret C.int // in + + _arg0 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + + _cret = C.gdk_texture_get_height(_arg0) + runtime.KeepAlive(texture) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Width returns the width of texture, in pixels. +// +// The function returns the following values: +// +// - gint: width of the GdkTexture. +func (texture *Texture) Width() int { + var _arg0 *C.GdkTexture // out + var _cret C.int // in + + _arg0 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + + _cret = C.gdk_texture_get_width(_arg0) + runtime.KeepAlive(texture) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// SaveToPNG: store the given texture to the filename as a PNG file. +// +// This is a utility function intended for debugging and testing. +// If you want more control over formats, proper error handling or +// want to store to a gio.File or other location, you might want to use +// gdk.Texture.SaveToPNGBytes() or look into the gdk-pixbuf library. +// +// The function takes the following parameters: +// +// - filename to store to. +// +// The function returns the following values: +// +// - ok: TRUE if saving succeeded, FALSE on failure. +func (texture *Texture) SaveToPNG(filename string) bool { + var _arg0 *C.GdkTexture // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_texture_save_to_png(_arg0, _arg1) + runtime.KeepAlive(texture) + runtime.KeepAlive(filename) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SaveToPNGBytes: store the given texture in memory as a PNG file. +// +// Use gdk.Texture.NewFromBytes to read it back. +// +// If you want to serialize a texture, this is a convenient and portable way to +// do that. +// +// If you need more control over the generated image, such as attaching +// metadata, you should look into an image handling library such as the +// gdk-pixbuf library. +// +// If you are dealing with high dynamic range float data, you might also want to +// consider gdk.Texture.SaveToTIFFBytes() instead. +// +// The function returns the following values: +// +// - bytes: newly allocated GBytes containing PNG data. +func (texture *Texture) SaveToPNGBytes() *glib.Bytes { + var _arg0 *C.GdkTexture // out + var _cret *C.GBytes // in + + _arg0 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + + _cret = C.gdk_texture_save_to_png_bytes(_arg0) + runtime.KeepAlive(texture) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// SaveToTIFF: store the given texture to the filename as a TIFF file. +// +// GTK will attempt to store data without loss. +// +// The function takes the following parameters: +// +// - filename to store to. +// +// The function returns the following values: +// +// - ok: TRUE if saving succeeded, FALSE on failure. +func (texture *Texture) SaveToTIFF(filename string) bool { + var _arg0 *C.GdkTexture // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_texture_save_to_tiff(_arg0, _arg1) + runtime.KeepAlive(texture) + runtime.KeepAlive(filename) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SaveToTIFFBytes: store the given texture in memory as a TIFF file. +// +// Use gdk.Texture.NewFromBytes to read it back. +// +// This function is intended to store a representation of the texture's data +// that is as accurate as possible. This is particularly relevant when working +// with high dynamic range images and floating-point texture data. +// +// If that is not your concern and you are interested in a smaller size and a +// more portable format, you might want to use gdk.Texture.SaveToPNGBytes(). +// +// The function returns the following values: +// +// - bytes: newly allocated GBytes containing TIFF data. +func (texture *Texture) SaveToTIFFBytes() *glib.Bytes { + var _arg0 *C.GdkTexture // out + var _cret *C.GBytes // in + + _arg0 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + + _cret = C.gdk_texture_save_to_tiff_bytes(_arg0) + runtime.KeepAlive(texture) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// TouchEvent: event related to a touch-based device. +type TouchEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*TouchEvent)(nil) +) + +func wrapTouchEvent(obj *coreglib.Object) *TouchEvent { + return &TouchEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalTouchEvent(p uintptr) (interface{}, error) { + return wrapTouchEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// EmulatingPointer extracts whether a touch event is emulating a pointer event. +// +// The function returns the following values: +// +// - ok: TRUE if event is emulating. +func (event *TouchEvent) EmulatingPointer() bool { + var _arg0 *C.GdkEvent // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_touch_event_get_emulating_pointer(_arg0) + runtime.KeepAlive(event) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TouchpadEvent: event related to a gesture on a touchpad device. +// +// Unlike touchscreens, where the windowing system sends basic sequences of +// begin, update, end events, and leaves gesture recognition to the clients, +// touchpad gestures are typically processed by the system, resulting in these +// events. +type TouchpadEvent struct { + _ [0]func() // equal guard + Event +} + +var ( + _ Eventer = (*TouchpadEvent)(nil) +) + +func wrapTouchpadEvent(obj *coreglib.Object) *TouchpadEvent { + return &TouchpadEvent{ + Event: Event{ + Object: obj, + }, + } +} + +func marshalTouchpadEvent(p uintptr) (interface{}, error) { + return wrapTouchpadEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Deltas extracts delta information from a touchpad event. +// +// The function returns the following values: +// +// - dx: return location for x. +// - dy: return location for y. +func (event *TouchpadEvent) Deltas() (dx, dy float64) { + var _arg0 *C.GdkEvent // out + var _arg1 C.double // in + var _arg2 C.double // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + C.gdk_touchpad_event_get_deltas(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(event) + + var _dx float64 // out + var _dy float64 // out + + _dx = float64(_arg1) + _dy = float64(_arg2) + + return _dx, _dy +} + +// GesturePhase extracts the touchpad gesture phase from a touchpad event. +// +// The function returns the following values: +// +// - touchpadGesturePhase: gesture phase of event. +func (event *TouchpadEvent) GesturePhase() TouchpadGesturePhase { + var _arg0 *C.GdkEvent // out + var _cret C.GdkTouchpadGesturePhase // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_touchpad_event_get_gesture_phase(_arg0) + runtime.KeepAlive(event) + + var _touchpadGesturePhase TouchpadGesturePhase // out + + _touchpadGesturePhase = TouchpadGesturePhase(_cret) + + return _touchpadGesturePhase +} + +// NFingers extracts the number of fingers from a touchpad event. +// +// The function returns the following values: +// +// - guint: number of fingers for event. +func (event *TouchpadEvent) NFingers() uint { + var _arg0 *C.GdkEvent // out + var _cret C.guint // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_touchpad_event_get_n_fingers(_arg0) + runtime.KeepAlive(event) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// PinchAngleDelta extracts the angle delta from a touchpad pinch event. +// +// The function returns the following values: +// +// - gdouble: angle delta of event. +func (event *TouchpadEvent) PinchAngleDelta() float64 { + var _arg0 *C.GdkEvent // out + var _cret C.double // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_touchpad_event_get_pinch_angle_delta(_arg0) + runtime.KeepAlive(event) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// PinchScale extracts the scale from a touchpad pinch event. +// +// The function returns the following values: +// +// - gdouble: scale of event. +func (event *TouchpadEvent) PinchScale() float64 { + var _arg0 *C.GdkEvent // out + var _cret C.double // in + + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + + _cret = C.gdk_touchpad_event_get_pinch_scale(_arg0) + runtime.KeepAlive(event) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// VulkanContext: GdkVulkanContext is an object representing the +// platform-specific Vulkan draw context. +// +// GdkVulkanContexts are created for a surface using +// gdk.Surface.CreateVulkanContext(), and the context will match the +// characteristics of the surface. +// +// Support for GdkVulkanContext is platform-specific and context creation can +// fail, returning NULL context. +type VulkanContext struct { + _ [0]func() // equal guard + DrawContext + + *coreglib.Object + gio.Initable +} + +var ( + _ DrawContexter = (*VulkanContext)(nil) + _ coreglib.Objector = (*VulkanContext)(nil) +) + +// VulkanContexter describes types inherited from class VulkanContext. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type VulkanContexter interface { + coreglib.Objector + baseVulkanContext() *VulkanContext +} + +var _ VulkanContexter = (*VulkanContext)(nil) + +func wrapVulkanContext(obj *coreglib.Object) *VulkanContext { + return &VulkanContext{ + DrawContext: DrawContext{ + Object: obj, + }, + Object: obj, + Initable: gio.Initable{ + Object: obj, + }, + } +} + +func marshalVulkanContext(p uintptr) (interface{}, error) { + return wrapVulkanContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *VulkanContext) baseVulkanContext() *VulkanContext { + return v +} + +// BaseVulkanContext returns the underlying base object. +func BaseVulkanContext(obj VulkanContexter) *VulkanContext { + return obj.baseVulkanContext() +} + +// ConnectImagesUpdated is emitted when the images managed by this context have +// changed. +// +// Usually this means that the swapchain had to be recreated, for example in +// response to a change of the surface size. +func (v *VulkanContext) ConnectImagesUpdated(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(v, "images-updated", false, unsafe.Pointer(C._gotk4_gdk4_VulkanContext_ConnectImagesUpdated), f) +} + +// ContentFormats: GdkContentFormats structure is used to advertise and +// negotiate the format of content. +// +// You will encounter GdkContentFormats when interacting with objects +// controlling operations that pass data between different widgets, window or +// application, like gdk.Drag, gdk.Drop, gdk.Clipboard or gdk.ContentProvider. +// +// GDK supports content in 2 forms: GType and mime type. Using GTypes is +// meant only for in-process content transfers. Mime types are meant to be +// used for data passing both in-process and out-of-process. The details +// of how data is passed is described in the documentation of the actual +// implementations. To transform between the two forms, gdk.ContentSerializer +// and gdk.ContentDeserializer are used. +// +// A GdkContentFormats describes a set of possible formats content can be +// exchanged in. It is assumed that this set is ordered. GTypes are more +// important than mime types. Order between different GTypes or mime types is +// the order they were added in, most important first. Functions that care +// about order, such as gdk.ContentFormats.Union(), will describe in their +// documentation how they interpret that order, though in general the order of +// the first argument is considered the primary order of the result, followed by +// the order of further arguments. +// +// For debugging purposes, the function gdk.ContentFormats.ToString() exists. +// It will print a comma-separated list of formats from most important to least +// important. +// +// GdkContentFormats is an immutable struct. After creation, you cannot change +// the types it represents. Instead, new GdkContentFormats have to be created. +// The gdk.ContentFormatsBuilder structure is meant to help in this endeavor. +// +// An instance of this type is always passed by reference. +type ContentFormats struct { + *contentFormats +} + +// contentFormats is the struct that's finalized. +type contentFormats struct { + native *C.GdkContentFormats +} + +func marshalContentFormats(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &ContentFormats{&contentFormats{(*C.GdkContentFormats)(b)}}, nil +} + +// NewContentFormats constructs a struct ContentFormats. +func NewContentFormats(mimeTypes []string) *ContentFormats { + var _arg1 **C.char // out + var _arg2 C.guint + var _cret *C.GdkContentFormats // in + + _arg2 = (C.guint)(len(mimeTypes)) + _arg1 = (**C.char)(C.calloc(C.size_t(len(mimeTypes)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.char)(_arg1), len(mimeTypes)) + for i := range mimeTypes { + out[i] = (*C.char)(unsafe.Pointer(C.CString(mimeTypes[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + + _cret = C.gdk_content_formats_new(_arg1, _arg2) + runtime.KeepAlive(mimeTypes) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// NewContentFormatsForGType constructs a struct ContentFormats. +func NewContentFormatsForGType(typ coreglib.Type) *ContentFormats { + var _arg1 C.GType // out + var _cret *C.GdkContentFormats // in + + _arg1 = C.GType(typ) + + _cret = C.gdk_content_formats_new_for_gtype(_arg1) + runtime.KeepAlive(typ) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// ContainGType checks if a given GType is part of the given formats. +// +// The function takes the following parameters: +// +// - typ: GType to search for. +// +// The function returns the following values: +// +// - ok: TRUE if the GType was found. +func (formats *ContentFormats) ContainGType(typ coreglib.Type) bool { + var _arg0 *C.GdkContentFormats // out + var _arg1 C.GType // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + _arg1 = C.GType(typ) + + _cret = C.gdk_content_formats_contain_gtype(_arg0, _arg1) + runtime.KeepAlive(formats) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ContainMIMEType checks if a given mime type is part of the given formats. +// +// The function takes the following parameters: +// +// - mimeType: mime type to search for. +// +// The function returns the following values: +// +// - ok: TRUE if the mime_type was found. +func (formats *ContentFormats) ContainMIMEType(mimeType string) bool { + var _arg0 *C.GdkContentFormats // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_content_formats_contain_mime_type(_arg0, _arg1) + runtime.KeepAlive(formats) + runtime.KeepAlive(mimeType) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// GTypes gets the GTypes included in formats. +// +// Note that formats may not contain any GTypes, in particular when they are +// empty. In that case NULL will be returned. +// +// The function returns the following values: +// +// - gTypes (optional): G_TYPE_INVALID-terminated array of types included in +// formats. +func (formats *ContentFormats) GTypes() []coreglib.Type { + var _arg0 *C.GdkContentFormats // out + var _cret *C.GType // in + var _arg1 C.gsize // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + + _cret = C.gdk_content_formats_get_gtypes(_arg0, &_arg1) + runtime.KeepAlive(formats) + + var _gTypes []coreglib.Type // out + + if _cret != nil { + { + src := unsafe.Slice((*C.GType)(_cret), _arg1) + _gTypes = make([]coreglib.Type, _arg1) + for i := 0; i < int(_arg1); i++ { + _gTypes[i] = coreglib.Type(src[i]) + } + } + } + + return _gTypes +} + +// MIMETypes gets the mime types included in formats. +// +// Note that formats may not contain any mime types, in particular when they are +// empty. In that case NULL will be returned. +// +// The function returns the following values: +// +// - utf8s (optional): NULL-terminated array of interned strings of mime types +// included in formats. +func (formats *ContentFormats) MIMETypes() []string { + var _arg0 *C.GdkContentFormats // out + var _cret **C.char // in + var _arg1 C.gsize // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + + _cret = C.gdk_content_formats_get_mime_types(_arg0, &_arg1) + runtime.KeepAlive(formats) + + var _utf8s []string // out + + if _cret != nil { + { + src := unsafe.Slice((**C.char)(_cret), _arg1) + _utf8s = make([]string, _arg1) + for i := 0; i < int(_arg1); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + } + + return _utf8s +} + +// Match checks if first and second have any matching formats. +// +// The function takes the following parameters: +// +// - second: GdkContentFormats to intersect with. +// +// The function returns the following values: +// +// - ok: TRUE if a matching format was found. +func (first *ContentFormats) Match(second *ContentFormats) bool { + var _arg0 *C.GdkContentFormats // out + var _arg1 *C.GdkContentFormats // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(first))) + _arg1 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(second))) + + _cret = C.gdk_content_formats_match(_arg0, _arg1) + runtime.KeepAlive(first) + runtime.KeepAlive(second) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// MatchGType finds the first GType from first that is also contained in second. +// +// If no matching GType is found, G_TYPE_INVALID is returned. +// +// The function takes the following parameters: +// +// - second: GdkContentFormats to intersect with. +// +// The function returns the following values: +// +// - gType: first common GType or G_TYPE_INVALID if none. +func (first *ContentFormats) MatchGType(second *ContentFormats) coreglib.Type { + var _arg0 *C.GdkContentFormats // out + var _arg1 *C.GdkContentFormats // out + var _cret C.GType // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(first))) + _arg1 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(second))) + + _cret = C.gdk_content_formats_match_gtype(_arg0, _arg1) + runtime.KeepAlive(first) + runtime.KeepAlive(second) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// MatchMIMEType finds the first mime type from first that is also contained in +// second. +// +// If no matching mime type is found, NULL is returned. +// +// The function takes the following parameters: +// +// - second: GdkContentFormats to intersect with. +// +// The function returns the following values: +// +// - utf8 (optional): first common mime type or NULL if none. +func (first *ContentFormats) MatchMIMEType(second *ContentFormats) string { + var _arg0 *C.GdkContentFormats // out + var _arg1 *C.GdkContentFormats // out + var _cret *C.char // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(first))) + _arg1 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(second))) + + _cret = C.gdk_content_formats_match_mime_type(_arg0, _arg1) + runtime.KeepAlive(first) + runtime.KeepAlive(second) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// String prints the given formats into a human-readable string. +// +// The resulting string can be parsed with gdk.ContentFormats().Parse. +// +// This is a small wrapper around gdk.ContentFormats.Print() to help when +// debugging. +// +// The function returns the following values: +// +// - utf8: new string. +func (formats *ContentFormats) String() string { + var _arg0 *C.GdkContentFormats // out + var _cret *C.char // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + + _cret = C.gdk_content_formats_to_string(_arg0) + runtime.KeepAlive(formats) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Union: append all missing types from second to first, in the order they had +// in second. +// +// The function takes the following parameters: +// +// - second: GdkContentFormats to merge from. +// +// The function returns the following values: +// +// - contentFormats: new GdkContentFormats. +func (first *ContentFormats) Union(second *ContentFormats) *ContentFormats { + var _arg0 *C.GdkContentFormats // out + var _arg1 *C.GdkContentFormats // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(first))) + _arg1 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(second))) + + _cret = C.gdk_content_formats_union(_arg0, _arg1) + runtime.KeepAlive(first) + runtime.KeepAlive(second) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// UnionDeserializeGTypes: add GTypes for mime types in formats for which +// deserializers are registered. +// +// The function returns the following values: +// +// - contentFormats: new GdkContentFormats. +func (formats *ContentFormats) UnionDeserializeGTypes() *ContentFormats { + var _arg0 *C.GdkContentFormats // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + + _cret = C.gdk_content_formats_union_deserialize_gtypes(_arg0) + runtime.KeepAlive(formats) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// UnionDeserializeMIMETypes: add mime types for GTypes in formats for which +// deserializers are registered. +// +// The function returns the following values: +// +// - contentFormats: new GdkContentFormats. +func (formats *ContentFormats) UnionDeserializeMIMETypes() *ContentFormats { + var _arg0 *C.GdkContentFormats // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + + _cret = C.gdk_content_formats_union_deserialize_mime_types(_arg0) + runtime.KeepAlive(formats) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// UnionSerializeGTypes: add GTypes for the mime types in formats for which +// serializers are registered. +// +// The function returns the following values: +// +// - contentFormats: new GdkContentFormats. +func (formats *ContentFormats) UnionSerializeGTypes() *ContentFormats { + var _arg0 *C.GdkContentFormats // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + + _cret = C.gdk_content_formats_union_serialize_gtypes(_arg0) + runtime.KeepAlive(formats) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// UnionSerializeMIMETypes: add mime types for GTypes in formats for which +// serializers are registered. +// +// The function returns the following values: +// +// - contentFormats: new GdkContentFormats. +func (formats *ContentFormats) UnionSerializeMIMETypes() *ContentFormats { + var _arg0 *C.GdkContentFormats // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + + _cret = C.gdk_content_formats_union_serialize_mime_types(_arg0) + runtime.KeepAlive(formats) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// ContentFormatsParse parses the given string into GdkContentFormats and +// returns the formats. +// +// Strings printed via gdk.ContentFormats.ToString() can be read in again +// successfully using this function. +// +// If string does not describe valid content formats, NULL is returned. +// +// The function takes the following parameters: +// +// - str: string to parse. +// +// The function returns the following values: +// +// - contentFormats (optional): content formats if string is valid. +func ContentFormatsParse(str string) *ContentFormats { + var _arg1 *C.char // out + var _cret *C.GdkContentFormats // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_content_formats_parse(_arg1) + runtime.KeepAlive(str) + + var _contentFormats *ContentFormats // out + + if _cret != nil { + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + } + + return _contentFormats +} + +// ContentFormatsBuilder: GdkContentFormatsBuilder is an auxiliary struct used +// to create new GdkContentFormats, and should not be kept around. +// +// An instance of this type is always passed by reference. +type ContentFormatsBuilder struct { + *contentFormatsBuilder +} + +// contentFormatsBuilder is the struct that's finalized. +type contentFormatsBuilder struct { + native *C.GdkContentFormatsBuilder +} + +func marshalContentFormatsBuilder(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &ContentFormatsBuilder{&contentFormatsBuilder{(*C.GdkContentFormatsBuilder)(b)}}, nil +} + +// NewContentFormatsBuilder constructs a struct ContentFormatsBuilder. +func NewContentFormatsBuilder() *ContentFormatsBuilder { + var _cret *C.GdkContentFormatsBuilder // in + + _cret = C.gdk_content_formats_builder_new() + + var _contentFormatsBuilder *ContentFormatsBuilder // out + + _contentFormatsBuilder = (*ContentFormatsBuilder)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormatsBuilder)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_builder_unref((*C.GdkContentFormatsBuilder)(intern.C)) + }, + ) + + return _contentFormatsBuilder +} + +// AddFormats appends all formats from formats to builder, skipping those that +// already exist. +// +// The function takes the following parameters: +// +// - formats to add. +func (builder *ContentFormatsBuilder) AddFormats(formats *ContentFormats) { + var _arg0 *C.GdkContentFormatsBuilder // out + var _arg1 *C.GdkContentFormats // out + + _arg0 = (*C.GdkContentFormatsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(formats))) + + C.gdk_content_formats_builder_add_formats(_arg0, _arg1) + runtime.KeepAlive(builder) + runtime.KeepAlive(formats) +} + +// AddGType appends type to builder if it has not already been added. +// +// The function takes the following parameters: +// +// - typ: GType. +func (builder *ContentFormatsBuilder) AddGType(typ coreglib.Type) { + var _arg0 *C.GdkContentFormatsBuilder // out + var _arg1 C.GType // out + + _arg0 = (*C.GdkContentFormatsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = C.GType(typ) + + C.gdk_content_formats_builder_add_gtype(_arg0, _arg1) + runtime.KeepAlive(builder) + runtime.KeepAlive(typ) +} + +// AddMIMEType appends mime_type to builder if it has not already been added. +// +// The function takes the following parameters: +// +// - mimeType: mime type. +func (builder *ContentFormatsBuilder) AddMIMEType(mimeType string) { + var _arg0 *C.GdkContentFormatsBuilder // out + var _arg1 *C.char // out + + _arg0 = (*C.GdkContentFormatsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gdk_content_formats_builder_add_mime_type(_arg0, _arg1) + runtime.KeepAlive(builder) + runtime.KeepAlive(mimeType) +} + +// ToFormats creates a new GdkContentFormats from the given builder. +// +// The given GdkContentFormatsBuilder is reset once this function returns; +// you cannot call this function multiple times on the same builder instance. +// +// This function is intended primarily for bindings. C code should use +// gdk.ContentFormatsBuilder.FreeToFormats(). +// +// The function returns the following values: +// +// - contentFormats: newly created GdkContentFormats with all the formats +// added to builder. +func (builder *ContentFormatsBuilder) ToFormats() *ContentFormats { + var _arg0 *C.GdkContentFormatsBuilder // out + var _cret *C.GdkContentFormats // in + + _arg0 = (*C.GdkContentFormatsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + + _cret = C.gdk_content_formats_builder_to_formats(_arg0) + runtime.KeepAlive(builder) + + var _contentFormats *ContentFormats // out + + _contentFormats = (*ContentFormats)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_contentFormats)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_content_formats_unref((*C.GdkContentFormats)(intern.C)) + }, + ) + + return _contentFormats +} + +// ContentProviderClass class structure for GdkContentProvider. +// +// An instance of this type is always passed by reference. +type ContentProviderClass struct { + *contentProviderClass +} + +// contentProviderClass is the struct that's finalized. +type contentProviderClass struct { + native *C.GdkContentProviderClass +} + +// DmabufFormats: GdkDmabufFormats struct provides information about supported +// DMA buffer formats. +// +// You can query whether a given format is supported with +// gdk.DmabufFormats.Contains() and you can iterate over the list +// of all supported formats with gdk.DmabufFormats.GetNFormats() and +// gdk.DmabufFormats.GetFormat(). +// +// The list of supported formats is sorted by preference, with the best formats +// coming first. +// +// The list may contains (format, modifier) pairs where the modifier is +// DMA_FORMAT_MOD_INVALID, indicating that **_implicit modifiers_** may be used +// with this format. +// +// See gdk.DmabufTextureBuilder for more information about DMA buffers. +// +// Note that DMA buffers only exist on Linux. +// +// An instance of this type is always passed by reference. +type DmabufFormats struct { + *dmabufFormats +} + +// dmabufFormats is the struct that's finalized. +type dmabufFormats struct { + native *C.GdkDmabufFormats +} + +func marshalDmabufFormats(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DmabufFormats{&dmabufFormats{(*C.GdkDmabufFormats)(b)}}, nil +} + +// Contains returns whether a given format is contained in formats. +// +// The function takes the following parameters: +// +// - fourcc: format code. +// - modifier: format modifier. +// +// The function returns the following values: +// +// - ok: TRUE if the format specified by the arguments is part of formats. +func (formats *DmabufFormats) Contains(fourcc uint32, modifier uint64) bool { + var _arg0 *C.GdkDmabufFormats // out + var _arg1 C.guint32 // out + var _arg2 C.guint64 // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkDmabufFormats)(gextras.StructNative(unsafe.Pointer(formats))) + _arg1 = C.guint32(fourcc) + _arg2 = C.guint64(modifier) + + _cret = C.gdk_dmabuf_formats_contains(_arg0, _arg1, _arg2) + runtime.KeepAlive(formats) + runtime.KeepAlive(fourcc) + runtime.KeepAlive(modifier) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Equal returns whether formats1 and formats2 contain the same dmabuf formats, +// in the same order. +// +// The function takes the following parameters: +// +// - formats2 (optional): another GdkDmabufFormats. +// +// The function returns the following values: +// +// - ok: TRUE if formats1 and formats2 are equal. +func (formats1 *DmabufFormats) Equal(formats2 *DmabufFormats) bool { + var _arg0 *C.GdkDmabufFormats // out + var _arg1 *C.GdkDmabufFormats // out + var _cret C.gboolean // in + + if formats1 != nil { + _arg0 = (*C.GdkDmabufFormats)(gextras.StructNative(unsafe.Pointer(formats1))) + } + if formats2 != nil { + _arg1 = (*C.GdkDmabufFormats)(gextras.StructNative(unsafe.Pointer(formats2))) + } + + _cret = C.gdk_dmabuf_formats_equal(_arg0, _arg1) + runtime.KeepAlive(formats1) + runtime.KeepAlive(formats2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Format gets the fourcc code and modifier for a format that is contained in +// formats. +// +// The function takes the following parameters: +// +// - idx: index of the format to return. +// +// The function returns the following values: +// +// - fourcc: return location for the format code. +// - modifier: return location for the format modifier. +func (formats *DmabufFormats) Format(idx uint) (uint32, uint64) { + var _arg0 *C.GdkDmabufFormats // out + var _arg1 C.gsize // out + var _arg2 C.guint32 // in + var _arg3 C.guint64 // in + + _arg0 = (*C.GdkDmabufFormats)(gextras.StructNative(unsafe.Pointer(formats))) + _arg1 = C.gsize(idx) + + C.gdk_dmabuf_formats_get_format(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(formats) + runtime.KeepAlive(idx) + + var _fourcc uint32 // out + var _modifier uint64 // out + + _fourcc = uint32(_arg2) + _modifier = uint64(_arg3) + + return _fourcc, _modifier +} + +// NFormats returns the number of formats that the formats object contains. +// +// Note that DMA buffers are a Linux concept, so on other platforms, +// gdk.DmabufFormats.GetNFormats() will always return zero. +// +// The function returns the following values: +// +// - gsize: number of formats. +func (formats *DmabufFormats) NFormats() uint { + var _arg0 *C.GdkDmabufFormats // out + var _cret C.gsize // in + + _arg0 = (*C.GdkDmabufFormats)(gextras.StructNative(unsafe.Pointer(formats))) + + _cret = C.gdk_dmabuf_formats_get_n_formats(_arg0) + runtime.KeepAlive(formats) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// EventSequence: GdkEventSequence is an opaque type representing a sequence of +// related touch events. +// +// An instance of this type is always passed by reference. +type EventSequence struct { + *eventSequence +} + +// eventSequence is the struct that's finalized. +type eventSequence struct { + native *C.GdkEventSequence +} + +func marshalEventSequence(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &EventSequence{&eventSequence{(*C.GdkEventSequence)(b)}}, nil +} + +// FileList: opaque type representing a list of files. +// +// An instance of this type is always passed by reference. +type FileList struct { + *fileList +} + +// fileList is the struct that's finalized. +type fileList struct { + native *C.GdkFileList +} + +func marshalFileList(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &FileList{&fileList{(*C.GdkFileList)(b)}}, nil +} + +// NewFileListFromArray constructs a struct FileList. +func NewFileListFromArray(files []gio.Filer) *FileList { + var _arg1 **C.GFile // out + var _arg2 C.gsize + var _cret *C.GdkFileList // in + + _arg2 = (C.gsize)(len(files)) + _arg1 = (**C.GFile)(C.calloc(C.size_t(len(files)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.GFile)(_arg1), len(files)) + for i := range files { + out[i] = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(files[i]).Native())) + } + } + + _cret = C.gdk_file_list_new_from_array(_arg1, _arg2) + runtime.KeepAlive(files) + + var _fileList *FileList // out + + _fileList = (*FileList)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileList)), + func(intern *struct{ C unsafe.Pointer }) { + C.free(intern.C) + }, + ) + + return _fileList +} + +// NewFileListFromList constructs a struct FileList. +func NewFileListFromList(files []gio.Filer) *FileList { + var _arg1 *C.GSList // out + var _cret *C.GdkFileList // in + + for i := len(files) - 1; i >= 0; i-- { + src := files[i] + var dst *C.GFile // out + dst = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = C.g_slist_prepend(_arg1, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_slist_free(_arg1) + + _cret = C.gdk_file_list_new_from_list(_arg1) + runtime.KeepAlive(files) + + var _fileList *FileList // out + + _fileList = (*FileList)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileList)), + func(intern *struct{ C unsafe.Pointer }) { + C.free(intern.C) + }, + ) + + return _fileList +} + +// Files retrieves the list of files inside a GdkFileList. +// +// This function is meant for language bindings. +// +// The function returns the following values: +// +// - sList files inside the list. +func (fileList *FileList) Files() []*gio.File { + var _arg0 *C.GdkFileList // out + var _cret *C.GSList // in + + _arg0 = (*C.GdkFileList)(gextras.StructNative(unsafe.Pointer(fileList))) + + _cret = C.gdk_file_list_get_files(_arg0) + runtime.KeepAlive(fileList) + + var _sList []*gio.File // out + + _sList = make([]*gio.File, 0, gextras.SListSize(unsafe.Pointer(_cret))) + gextras.MoveSList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GFile)(v) + var dst *gio.File // out + { + obj := coreglib.Take(unsafe.Pointer(src)) + dst = &gio.File{ + Object: obj, + } + } + _sList = append(_sList, dst) + }) + + return _sList +} + +// FrameTimings: GdkFrameTimings object holds timing information for a single +// frame of the application’s displays. +// +// To retrieve GdkFrameTimings objects, use gdk.FrameClock.GetTimings() or +// gdk.FrameClock.GetCurrentTimings(). The information in GdkFrameTimings is +// useful for precise synchronization of video with the event or audio streams, +// and for measuring quality metrics for the application’s display, such as +// latency and jitter. +// +// An instance of this type is always passed by reference. +type FrameTimings struct { + *frameTimings +} + +// frameTimings is the struct that's finalized. +type frameTimings struct { + native *C.GdkFrameTimings +} + +func marshalFrameTimings(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &FrameTimings{&frameTimings{(*C.GdkFrameTimings)(b)}}, nil +} + +// Complete returns whether timings are complete. +// +// The timing information in a GdkFrameTimings is filled in incrementally as the +// frame as drawn and passed off to the window system for processing and display +// to the user. The accessor functions for GdkFrameTimings can return 0 to +// indicate an unavailable value for two reasons: either because the information +// is not yet available, or because it isn't available at all. +// +// Once this function returns TRUE for a frame, you can be certain that no +// further values will become available and be stored in the GdkFrameTimings. +// +// The function returns the following values: +// +// - ok: TRUE if all information that will be available for the frame has been +// filled in. +func (timings *FrameTimings) Complete() bool { + var _arg0 *C.GdkFrameTimings // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkFrameTimings)(gextras.StructNative(unsafe.Pointer(timings))) + + _cret = C.gdk_frame_timings_get_complete(_arg0) + runtime.KeepAlive(timings) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// FrameCounter gets the frame counter value of the GdkFrameClock when this +// frame was drawn. +// +// The function returns the following values: +// +// - gint64: frame counter value for this frame. +func (timings *FrameTimings) FrameCounter() int64 { + var _arg0 *C.GdkFrameTimings // out + var _cret C.gint64 // in + + _arg0 = (*C.GdkFrameTimings)(gextras.StructNative(unsafe.Pointer(timings))) + + _cret = C.gdk_frame_timings_get_frame_counter(_arg0) + runtime.KeepAlive(timings) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// FrameTime returns the frame time for the frame. +// +// This is the time value that is typically used to time animations for the +// frame. See gdk.FrameClock.GetFrameTime(). +// +// The function returns the following values: +// +// - gint64: frame time for the frame, in the timescale of +// g_get_monotonic_time(). +func (timings *FrameTimings) FrameTime() int64 { + var _arg0 *C.GdkFrameTimings // out + var _cret C.gint64 // in + + _arg0 = (*C.GdkFrameTimings)(gextras.StructNative(unsafe.Pointer(timings))) + + _cret = C.gdk_frame_timings_get_frame_time(_arg0) + runtime.KeepAlive(timings) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// PredictedPresentationTime gets the predicted time at which this frame will be +// displayed. +// +// Although no predicted time may be available, if one is available, +// it will be available while the frame is being generated, in contrast to +// gdk.FrameTimings.GetPresentationTime(), which is only available after the +// frame has been presented. +// +// In general, if you are simply animating, you should use +// gdk.FrameClock.GetFrameTime() rather than this function, but this function is +// useful for applications that want exact control over latency. For example, +// a movie player may want this information for Audio/Video synchronization. +// +// The function returns the following values: +// +// - gint64: predicted time at which the frame will be presented, in the +// timescale of g_get_monotonic_time(), or 0 if no predicted presentation +// time is available. +func (timings *FrameTimings) PredictedPresentationTime() int64 { + var _arg0 *C.GdkFrameTimings // out + var _cret C.gint64 // in + + _arg0 = (*C.GdkFrameTimings)(gextras.StructNative(unsafe.Pointer(timings))) + + _cret = C.gdk_frame_timings_get_predicted_presentation_time(_arg0) + runtime.KeepAlive(timings) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// PresentationTime reurns the presentation time. +// +// This is the time at which the frame became visible to the user. +// +// The function returns the following values: +// +// - gint64: time the frame was displayed to the user, in the timescale of +// g_get_monotonic_time(), or 0 if no presentation time is available. +// See gdk.FrameTimings.GetComplete(). +func (timings *FrameTimings) PresentationTime() int64 { + var _arg0 *C.GdkFrameTimings // out + var _cret C.gint64 // in + + _arg0 = (*C.GdkFrameTimings)(gextras.StructNative(unsafe.Pointer(timings))) + + _cret = C.gdk_frame_timings_get_presentation_time(_arg0) + runtime.KeepAlive(timings) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// RefreshInterval gets the natural interval between presentation times for the +// display that this frame was displayed on. +// +// Frame presentation usually happens during the “vertical blanking interval”. +// +// The function returns the following values: +// +// - gint64: refresh interval of the display, in microseconds, or 0 if the +// refresh interval is not available. See gdk.FrameTimings.GetComplete(). +func (timings *FrameTimings) RefreshInterval() int64 { + var _arg0 *C.GdkFrameTimings // out + var _cret C.gint64 // in + + _arg0 = (*C.GdkFrameTimings)(gextras.StructNative(unsafe.Pointer(timings))) + + _cret = C.gdk_frame_timings_get_refresh_interval(_arg0) + runtime.KeepAlive(timings) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// KeymapKey: GdkKeymapKey is a hardware key that can be mapped to a keyval. +// +// An instance of this type is always passed by reference. +type KeymapKey struct { + *keymapKey +} + +// keymapKey is the struct that's finalized. +type keymapKey struct { + native *C.GdkKeymapKey +} + +// NewKeymapKey creates a new KeymapKey instance from the given +// fields. Beware that this function allocates on the Go heap; be careful +// when using it! +func NewKeymapKey(keycode uint, group, level int) KeymapKey { + var f0 C.guint // out + f0 = C.guint(keycode) + var f1 C.int // out + f1 = C.int(group) + var f2 C.int // out + f2 = C.int(level) + + v := C.GdkKeymapKey{ + keycode: f0, + group: f1, + level: f2, + } + + return *(*KeymapKey)(gextras.NewStructNative(unsafe.Pointer(&v))) +} + +// Keycode: hardware keycode. This is an identifying number for a physical key. +func (k *KeymapKey) Keycode() uint { + valptr := &k.native.keycode + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Group indicates movement in a horizontal direction. Usually groups are +// used for two different languages. In group 0, a key might have two English +// characters, and in group 1 it might have two Hebrew characters. The Hebrew +// characters will be printed on the key next to the English characters. +func (k *KeymapKey) Group() int { + valptr := &k.native.group + var _v int // out + _v = int(*valptr) + return _v +} + +// Level indicates which symbol on the key will be used, in a vertical +// direction. So on a standard US keyboard, the key with the number “1” on it +// also has the exclamation point ("!") character on it. The level indicates +// whether to use the “1” or the “!” symbol. The letter keys are considered +// to have a lowercase letter at level 0, and an uppercase letter at level 1, +// though only the uppercase letter is printed. +func (k *KeymapKey) Level() int { + valptr := &k.native.level + var _v int // out + _v = int(*valptr) + return _v +} + +// Keycode: hardware keycode. This is an identifying number for a physical key. +func (k *KeymapKey) SetKeycode(keycode uint) { + valptr := &k.native.keycode + *valptr = C.guint(keycode) +} + +// Group indicates movement in a horizontal direction. Usually groups are +// used for two different languages. In group 0, a key might have two English +// characters, and in group 1 it might have two Hebrew characters. The Hebrew +// characters will be printed on the key next to the English characters. +func (k *KeymapKey) SetGroup(group int) { + valptr := &k.native.group + *valptr = C.int(group) +} + +// Level indicates which symbol on the key will be used, in a vertical +// direction. So on a standard US keyboard, the key with the number “1” on it +// also has the exclamation point ("!") character on it. The level indicates +// whether to use the “1” or the “!” symbol. The letter keys are considered +// to have a lowercase letter at level 0, and an uppercase letter at level 1, +// though only the uppercase letter is printed. +func (k *KeymapKey) SetLevel(level int) { + valptr := &k.native.level + *valptr = C.int(level) +} + +// PaintableInterface: list of functions that can be implemented for the +// GdkPaintable interface. +// +// Note that apart from the gdk.Paintable.Snapshot() function, no virtual +// function of this interface is mandatory to implement, though it is a good +// idea to implement gdk.Paintable.GetCurrentImage() for non-static paintables +// and gdk.Paintable.GetFlags() if the image is not dynamic as the default +// implementation returns no flags and that will make the implementation likely +// quite slow. +// +// An instance of this type is always passed by reference. +type PaintableInterface struct { + *paintableInterface +} + +// paintableInterface is the struct that's finalized. +type paintableInterface struct { + native *C.GdkPaintableInterface +} + +// PopupLayout: GdkPopupLayout struct contains information that is necessary +// position a gdk.Popup relative to its parent. +// +// The positioning requires a negotiation with the windowing system, since it +// depends on external constraints, such as the position of the parent surface, +// and the screen dimensions. +// +// The basic ingredients are a rectangle on the parent surface, and the anchor +// on both that rectangle and the popup. The anchors specify a side or corner to +// place next to each other. +// +// !Popup anchors (popup-anchors.png) +// +// For cases where placing the anchors next to each other would make the popup +// extend offscreen, the layout includes some hints for how to resolve this +// problem. The hints may suggest to flip the anchor position to the other side, +// or to 'slide' the popup along a side, or to resize it. +// +// !Flipping popups (popup-flip.png) +// +// !Sliding popups (popup-slide.png) +// +// These hints may be combined. +// +// Ultimatively, it is up to the windowing system to determine the position +// and size of the popup. You can learn about the result by calling +// gdk.Popup.GetPositionX(), gdk.Popup.GetPositionY(), gdk.Popup.GetRectAnchor() +// and gdk.Popup.GetSurfaceAnchor() after the popup has been presented. +// This can be used to adjust the rendering. For example, GtkPopover +// (../gtk4/class.Popover.html) changes its arrow position accordingly. But you +// have to be careful avoid changing the size of the popover, or it has to be +// presented again. +// +// An instance of this type is always passed by reference. +type PopupLayout struct { + *popupLayout +} + +// popupLayout is the struct that's finalized. +type popupLayout struct { + native *C.GdkPopupLayout +} + +func marshalPopupLayout(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &PopupLayout{&popupLayout{(*C.GdkPopupLayout)(b)}}, nil +} + +// NewPopupLayout constructs a struct PopupLayout. +func NewPopupLayout(anchorRect *Rectangle, rectAnchor Gravity, surfaceAnchor Gravity) *PopupLayout { + var _arg1 *C.GdkRectangle // out + var _arg2 C.GdkGravity // out + var _arg3 C.GdkGravity // out + var _cret *C.GdkPopupLayout // in + + _arg1 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(anchorRect))) + _arg2 = C.GdkGravity(rectAnchor) + _arg3 = C.GdkGravity(surfaceAnchor) + + _cret = C.gdk_popup_layout_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(anchorRect) + runtime.KeepAlive(rectAnchor) + runtime.KeepAlive(surfaceAnchor) + + var _popupLayout *PopupLayout // out + + _popupLayout = (*PopupLayout)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_popupLayout)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_popup_layout_unref((*C.GdkPopupLayout)(intern.C)) + }, + ) + + return _popupLayout +} + +// Copy makes a copy of layout. +// +// The function returns the following values: +// +// - popupLayout: copy of layout. +func (layout *PopupLayout) Copy() *PopupLayout { + var _arg0 *C.GdkPopupLayout // out + var _cret *C.GdkPopupLayout // in + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_popup_layout_copy(_arg0) + runtime.KeepAlive(layout) + + var _popupLayout *PopupLayout // out + + _popupLayout = (*PopupLayout)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_popupLayout)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_popup_layout_unref((*C.GdkPopupLayout)(intern.C)) + }, + ) + + return _popupLayout +} + +// Equal: check whether layout and other has identical layout properties. +// +// The function takes the following parameters: +// +// - other GdkPopupLayout. +// +// The function returns the following values: +// +// - ok: TRUE if layout and other have identical layout properties, otherwise +// FALSE. +func (layout *PopupLayout) Equal(other *PopupLayout) bool { + var _arg0 *C.GdkPopupLayout // out + var _arg1 *C.GdkPopupLayout // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + _arg1 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(other))) + + _cret = C.gdk_popup_layout_equal(_arg0, _arg1) + runtime.KeepAlive(layout) + runtime.KeepAlive(other) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// AnchorHints: get the GdkAnchorHints. +// +// The function returns the following values: +// +// - anchorHints: GdkAnchorHints. +func (layout *PopupLayout) AnchorHints() AnchorHints { + var _arg0 *C.GdkPopupLayout // out + var _cret C.GdkAnchorHints // in + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_popup_layout_get_anchor_hints(_arg0) + runtime.KeepAlive(layout) + + var _anchorHints AnchorHints // out + + _anchorHints = AnchorHints(_cret) + + return _anchorHints +} + +// AnchorRect: get the anchor rectangle. +// +// The function returns the following values: +// +// - rectangle: anchor rectangle. +func (layout *PopupLayout) AnchorRect() *Rectangle { + var _arg0 *C.GdkPopupLayout // out + var _cret *C.GdkRectangle // in + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_popup_layout_get_anchor_rect(_arg0) + runtime.KeepAlive(layout) + + var _rectangle *Rectangle // out + + _rectangle = (*Rectangle)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rectangle +} + +// Offset retrieves the offset for the anchor rectangle. +// +// The function returns the following values: +// +// - dx: return location for the delta X coordinate. +// - dy: return location for the delta Y coordinate. +func (layout *PopupLayout) Offset() (dx int, dy int) { + var _arg0 *C.GdkPopupLayout // out + var _arg1 C.int // in + var _arg2 C.int // in + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + C.gdk_popup_layout_get_offset(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(layout) + + var _dx int // out + var _dy int // out + + _dx = int(_arg1) + _dy = int(_arg2) + + return _dx, _dy +} + +// RectAnchor returns the anchor position on the anchor rectangle. +// +// The function returns the following values: +// +// - gravity: anchor on the anchor rectangle. +func (layout *PopupLayout) RectAnchor() Gravity { + var _arg0 *C.GdkPopupLayout // out + var _cret C.GdkGravity // in + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_popup_layout_get_rect_anchor(_arg0) + runtime.KeepAlive(layout) + + var _gravity Gravity // out + + _gravity = Gravity(_cret) + + return _gravity +} + +// ShadowWidth obtains the shadow widths of this layout. +// +// The function returns the following values: +// +// - left: return location for the left shadow width. +// - right: return location for the right shadow width. +// - top: return location for the top shadow width. +// - bottom: return location for the bottom shadow width. +func (layout *PopupLayout) ShadowWidth() (left int, right int, top int, bottom int) { + var _arg0 *C.GdkPopupLayout // out + var _arg1 C.int // in + var _arg2 C.int // in + var _arg3 C.int // in + var _arg4 C.int // in + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + C.gdk_popup_layout_get_shadow_width(_arg0, &_arg1, &_arg2, &_arg3, &_arg4) + runtime.KeepAlive(layout) + + var _left int // out + var _right int // out + var _top int // out + var _bottom int // out + + _left = int(_arg1) + _right = int(_arg2) + _top = int(_arg3) + _bottom = int(_arg4) + + return _left, _right, _top, _bottom +} + +// SurfaceAnchor returns the anchor position on the popup surface. +// +// The function returns the following values: +// +// - gravity: anchor on the popup surface. +func (layout *PopupLayout) SurfaceAnchor() Gravity { + var _arg0 *C.GdkPopupLayout // out + var _cret C.GdkGravity // in + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_popup_layout_get_surface_anchor(_arg0) + runtime.KeepAlive(layout) + + var _gravity Gravity // out + + _gravity = Gravity(_cret) + + return _gravity +} + +// SetAnchorHints: set new anchor hints. +// +// The set anchor_hints determines how surface will be moved if the anchor +// points cause it to move off-screen. For example, GDK_ANCHOR_FLIP_X will +// replace GDK_GRAVITY_NORTH_WEST with GDK_GRAVITY_NORTH_EAST and vice versa if +// surface extends beyond the left or right edges of the monitor. +// +// The function takes the following parameters: +// +// - anchorHints: new GdkAnchorHints. +func (layout *PopupLayout) SetAnchorHints(anchorHints AnchorHints) { + var _arg0 *C.GdkPopupLayout // out + var _arg1 C.GdkAnchorHints // out + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + _arg1 = C.GdkAnchorHints(anchorHints) + + C.gdk_popup_layout_set_anchor_hints(_arg0, _arg1) + runtime.KeepAlive(layout) + runtime.KeepAlive(anchorHints) +} + +// SetAnchorRect: set the anchor rectangle. +// +// The function takes the following parameters: +// +// - anchorRect: new anchor rectangle. +func (layout *PopupLayout) SetAnchorRect(anchorRect *Rectangle) { + var _arg0 *C.GdkPopupLayout // out + var _arg1 *C.GdkRectangle // out + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + _arg1 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(anchorRect))) + + C.gdk_popup_layout_set_anchor_rect(_arg0, _arg1) + runtime.KeepAlive(layout) + runtime.KeepAlive(anchorRect) +} + +// SetOffset: offset the position of the anchor rectangle with the given delta. +// +// The function takes the following parameters: +// +// - dx: x delta to offset the anchor rectangle with. +// - dy: y delta to offset the anchor rectangle with. +func (layout *PopupLayout) SetOffset(dx int, dy int) { + var _arg0 *C.GdkPopupLayout // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + _arg1 = C.int(dx) + _arg2 = C.int(dy) + + C.gdk_popup_layout_set_offset(_arg0, _arg1, _arg2) + runtime.KeepAlive(layout) + runtime.KeepAlive(dx) + runtime.KeepAlive(dy) +} + +// SetRectAnchor: set the anchor on the anchor rectangle. +// +// The function takes the following parameters: +// +// - anchor: new rect anchor. +func (layout *PopupLayout) SetRectAnchor(anchor Gravity) { + var _arg0 *C.GdkPopupLayout // out + var _arg1 C.GdkGravity // out + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + _arg1 = C.GdkGravity(anchor) + + C.gdk_popup_layout_set_rect_anchor(_arg0, _arg1) + runtime.KeepAlive(layout) + runtime.KeepAlive(anchor) +} + +// SetShadowWidth sets the shadow width of the popup. +// +// The shadow width corresponds to the part of the computed surface size that +// would consist of the shadow margin surrounding the window, would there be +// any. +// +// The function takes the following parameters: +// +// - left: width of the left part of the shadow. +// - right: width of the right part of the shadow. +// - top: height of the top part of the shadow. +// - bottom: height of the bottom part of the shadow. +func (layout *PopupLayout) SetShadowWidth(left int, right int, top int, bottom int) { + var _arg0 *C.GdkPopupLayout // out + var _arg1 C.int // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.int // out + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + _arg1 = C.int(left) + _arg2 = C.int(right) + _arg3 = C.int(top) + _arg4 = C.int(bottom) + + C.gdk_popup_layout_set_shadow_width(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(layout) + runtime.KeepAlive(left) + runtime.KeepAlive(right) + runtime.KeepAlive(top) + runtime.KeepAlive(bottom) +} + +// SetSurfaceAnchor: set the anchor on the popup surface. +// +// The function takes the following parameters: +// +// - anchor: new popup surface anchor. +func (layout *PopupLayout) SetSurfaceAnchor(anchor Gravity) { + var _arg0 *C.GdkPopupLayout // out + var _arg1 C.GdkGravity // out + + _arg0 = (*C.GdkPopupLayout)(gextras.StructNative(unsafe.Pointer(layout))) + _arg1 = C.GdkGravity(anchor) + + C.gdk_popup_layout_set_surface_anchor(_arg0, _arg1) + runtime.KeepAlive(layout) + runtime.KeepAlive(anchor) +} + +// RGBA: GdkRGBA is used to represent a color, in a way that is compatible with +// cairo’s notion of color. +// +// GdkRGBA is a convenient way to pass colors around. It’s based on cairo’s way +// to deal with colors and mirrors its behavior. All values are in the range +// from 0.0 to 1.0 inclusive. So the color (0.0, 0.0, 0.0, 0.0) represents +// transparent black and (1.0, 1.0, 1.0, 1.0) is opaque white. Other values will +// be clamped to this range when drawing. +// +// An instance of this type is always passed by reference. +type RGBA struct { + *rgbA +} + +// rgbA is the struct that's finalized. +type rgbA struct { + native *C.GdkRGBA +} + +func marshalRGBA(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &RGBA{&rgbA{(*C.GdkRGBA)(b)}}, nil +} + +// NewRGBA creates a new RGBA instance from the given +// fields. Beware that this function allocates on the Go heap; be careful +// when using it! +func NewRGBA(red, green, blue, alpha float32) RGBA { + var f0 C.float // out + f0 = C.float(red) + var f1 C.float // out + f1 = C.float(green) + var f2 C.float // out + f2 = C.float(blue) + var f3 C.float // out + f3 = C.float(alpha) + + v := C.GdkRGBA{ + red: f0, + green: f1, + blue: f2, + alpha: f3, + } + + return *(*RGBA)(gextras.NewStructNative(unsafe.Pointer(&v))) +} + +// Red: intensity of the red channel from 0.0 to 1.0 inclusive. +func (r *RGBA) Red() float32 { + valptr := &r.native.red + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Green: intensity of the green channel from 0.0 to 1.0 inclusive. +func (r *RGBA) Green() float32 { + valptr := &r.native.green + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Blue: intensity of the blue channel from 0.0 to 1.0 inclusive. +func (r *RGBA) Blue() float32 { + valptr := &r.native.blue + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Alpha: opacity of the color from 0.0 for completely translucent to 1.0 for +// opaque. +func (r *RGBA) Alpha() float32 { + valptr := &r.native.alpha + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Red: intensity of the red channel from 0.0 to 1.0 inclusive. +func (r *RGBA) SetRed(red float32) { + valptr := &r.native.red + *valptr = C.float(red) +} + +// Green: intensity of the green channel from 0.0 to 1.0 inclusive. +func (r *RGBA) SetGreen(green float32) { + valptr := &r.native.green + *valptr = C.float(green) +} + +// Blue: intensity of the blue channel from 0.0 to 1.0 inclusive. +func (r *RGBA) SetBlue(blue float32) { + valptr := &r.native.blue + *valptr = C.float(blue) +} + +// Alpha: opacity of the color from 0.0 for completely translucent to 1.0 for +// opaque. +func (r *RGBA) SetAlpha(alpha float32) { + valptr := &r.native.alpha + *valptr = C.float(alpha) +} + +// Copy makes a copy of a GdkRGBA. +// +// The result must be freed through gdk.RGBA.Free(). +// +// The function returns the following values: +// +// - rgbA: newly allocated GdkRGBA, with the same contents as rgba. +func (rgba *RGBA) Copy() *RGBA { + var _arg0 *C.GdkRGBA // out + var _cret *C.GdkRGBA // in + + _arg0 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(rgba))) + + _cret = C.gdk_rgba_copy(_arg0) + runtime.KeepAlive(rgba) + + var _rgbA *RGBA // out + + _rgbA = (*RGBA)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_rgbA)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_rgba_free((*C.GdkRGBA)(intern.C)) + }, + ) + + return _rgbA +} + +// Equal compares two GdkRGBA colors. +// +// The function takes the following parameters: +// +// - p2: another GdkRGBA. +// +// The function returns the following values: +// +// - ok: TRUE if the two colors compare equal. +func (p1 *RGBA) Equal(p2 *RGBA) bool { + var _arg0 C.gconstpointer // out + var _arg1 C.gconstpointer // out + var _cret C.gboolean // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(p1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(p2))) + + _cret = C.gdk_rgba_equal(_arg0, _arg1) + runtime.KeepAlive(p1) + runtime.KeepAlive(p2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Hash: hash function suitable for using for a hash table that stores GdkRGBAs. +// +// The function returns the following values: +// +// - guint: hash value for p. +func (p *RGBA) Hash() uint { + var _arg0 C.gconstpointer // out + var _cret C.guint // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(p))) + + _cret = C.gdk_rgba_hash(_arg0) + runtime.KeepAlive(p) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// IsClear checks if an rgba value is transparent. +// +// That is, drawing with the value would not produce any change. +// +// The function returns the following values: +// +// - ok: TRUE if the rgba is clear. +func (rgba *RGBA) IsClear() bool { + var _arg0 *C.GdkRGBA // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(rgba))) + + _cret = C.gdk_rgba_is_clear(_arg0) + runtime.KeepAlive(rgba) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsOpaque checks if an rgba value is opaque. +// +// That is, drawing with the value will not retain any results from previous +// contents. +// +// The function returns the following values: +// +// - ok: TRUE if the rgba is opaque. +func (rgba *RGBA) IsOpaque() bool { + var _arg0 *C.GdkRGBA // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(rgba))) + + _cret = C.gdk_rgba_is_opaque(_arg0) + runtime.KeepAlive(rgba) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Parse parses a textual representation of a color. +// +// The string can be either one of: +// +// - A standard name (Taken from the CSS specification). +// +// - A hexadecimal value in the form “\#rgb”, “\#rrggbb”, “\#rrrgggbbb” or +// ”\#rrrrggggbbbb” +// +// - A hexadecimal value in the form “\#rgba”, “\#rrggbbaa”, or +// ”\#rrrrggggbbbbaaaa” +// +// - A RGB color in the form “rgb(r,g,b)” (In this case the color will have full +// opacity) +// +// - A RGBA color in the form “rgba(r,g,b,a)” +// +// - A HSL color in the form "hsl(hue, saturation, lightness)" +// +// - A HSLA color in the form "hsla(hue, saturation, lightness, alpha)" +// +// Where “r”, “g”, “b” and “a” are respectively the red, green, blue and alpha +// color values. In the last two cases, “r”, “g”, and “b” are either integers in +// the range 0 to 255 or percentage values in the range 0% to 100%, and a is a +// floating point value in the range 0 to 1. +// +// The function takes the following parameters: +// +// - spec: string specifying the color. +// +// The function returns the following values: +// +// - ok: TRUE if the parsing succeeded. +func (rgba *RGBA) Parse(spec string) bool { + var _arg0 *C.GdkRGBA // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(rgba))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(spec))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_rgba_parse(_arg0, _arg1) + runtime.KeepAlive(rgba) + runtime.KeepAlive(spec) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// String returns a textual specification of rgba in the form rgb(r,g,b) or +// rgba(r,g,b,a), where “r”, “g”, “b” and “a” represent the red, green, blue and +// alpha values respectively. “r”, “g”, and “b” are represented as integers in +// the range 0 to 255, and “a” is represented as a floating point value in the +// range 0 to 1. +// +// These string forms are string forms that are supported by the CSS3 colors +// module, and can be parsed by gdk.RGBA.Parse(). +// +// Note that this string representation may lose some precision, since “r”, +// “g” and “b” are represented as 8-bit integers. If this is a concern, +// you should use a different representation. +// +// The function returns the following values: +// +// - utf8: newly allocated text string. +func (rgba *RGBA) String() string { + var _arg0 *C.GdkRGBA // out + var _cret *C.char // in + + _arg0 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(rgba))) + + _cret = C.gdk_rgba_to_string(_arg0) + runtime.KeepAlive(rgba) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Rectangle: GdkRectangle data type for representing rectangles. +// +// GdkRectangle is identical to cairo_rectangle_t. Together with Cairo’s +// cairo_region_t data type, these are the central types for representing sets +// of pixels. +// +// The intersection of two rectangles can be computed with +// gdk.Rectangle.Intersect(); to find the union of two rectangles use +// gdk.Rectangle.Union(). +// +// The cairo_region_t type provided by Cairo is usually used for managing +// non-rectangular clipping of graphical operations. +// +// The Graphene library has a number of other data types for regions and volumes +// in 2D and 3D. +// +// An instance of this type is always passed by reference. +type Rectangle struct { + *rectangle +} + +// rectangle is the struct that's finalized. +type rectangle struct { + native *C.GdkRectangle +} + +func marshalRectangle(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Rectangle{&rectangle{(*C.GdkRectangle)(b)}}, nil +} + +// NewRectangle creates a new Rectangle instance from the given +// fields. Beware that this function allocates on the Go heap; be careful +// when using it! +func NewRectangle(x, y, width, height int) Rectangle { + var f0 C.int // out + f0 = C.int(x) + var f1 C.int // out + f1 = C.int(y) + var f2 C.int // out + f2 = C.int(width) + var f3 C.int // out + f3 = C.int(height) + + v := C.GdkRectangle{ + x: f0, + y: f1, + width: f2, + height: f3, + } + + return *(*Rectangle)(gextras.NewStructNative(unsafe.Pointer(&v))) +} + +// X: x coordinate of the top left corner. +func (r *Rectangle) X() int { + valptr := &r.native.x + var _v int // out + _v = int(*valptr) + return _v +} + +// Y: y coordinate of the top left corner. +func (r *Rectangle) Y() int { + valptr := &r.native.y + var _v int // out + _v = int(*valptr) + return _v +} + +// Width: width of the rectangle. +func (r *Rectangle) Width() int { + valptr := &r.native.width + var _v int // out + _v = int(*valptr) + return _v +} + +// Height: height of the rectangle. +func (r *Rectangle) Height() int { + valptr := &r.native.height + var _v int // out + _v = int(*valptr) + return _v +} + +// X: x coordinate of the top left corner. +func (r *Rectangle) SetX(x int) { + valptr := &r.native.x + *valptr = C.int(x) +} + +// Y: y coordinate of the top left corner. +func (r *Rectangle) SetY(y int) { + valptr := &r.native.y + *valptr = C.int(y) +} + +// Width: width of the rectangle. +func (r *Rectangle) SetWidth(width int) { + valptr := &r.native.width + *valptr = C.int(width) +} + +// Height: height of the rectangle. +func (r *Rectangle) SetHeight(height int) { + valptr := &r.native.height + *valptr = C.int(height) +} + +// ContainsPoint returns TRUE if rect contains the point described by x and y. +// +// The function takes the following parameters: +// +// - x: x coordinate. +// - y: y coordinate. +// +// The function returns the following values: +// +// - ok: TRUE if rect contains the point. +func (rect *Rectangle) ContainsPoint(x int, y int) bool { + var _arg0 *C.GdkRectangle // out + var _arg1 C.int // out + var _arg2 C.int // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(rect))) + _arg1 = C.int(x) + _arg2 = C.int(y) + + _cret = C.gdk_rectangle_contains_point(_arg0, _arg1, _arg2) + runtime.KeepAlive(rect) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Equal checks if the two given rectangles are equal. +// +// The function takes the following parameters: +// +// - rect2: GdkRectangle. +// +// The function returns the following values: +// +// - ok: TRUE if the rectangles are equal. +func (rect1 *Rectangle) Equal(rect2 *Rectangle) bool { + var _arg0 *C.GdkRectangle // out + var _arg1 *C.GdkRectangle // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(rect1))) + _arg1 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(rect2))) + + _cret = C.gdk_rectangle_equal(_arg0, _arg1) + runtime.KeepAlive(rect1) + runtime.KeepAlive(rect2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Intersect calculates the intersection of two rectangles. +// +// It is allowed for dest to be the same as either src1 or src2. If the +// rectangles do not intersect, dest’s width and height is set to 0 and its +// x and y values are undefined. If you are only interested in whether the +// rectangles intersect, but not in the intersecting area itself, pass NULL for +// dest. +// +// The function takes the following parameters: +// +// - src2: GdkRectangle. +// +// The function returns the following values: +// +// - dest (optional): return location for the intersection of src1 and src2. +// - ok: TRUE if the rectangles intersect. +func (src1 *Rectangle) Intersect(src2 *Rectangle) (*Rectangle, bool) { + var _arg0 *C.GdkRectangle // out + var _arg1 *C.GdkRectangle // out + var _arg2 C.GdkRectangle // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(src1))) + _arg1 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(src2))) + + _cret = C.gdk_rectangle_intersect(_arg0, _arg1, &_arg2) + runtime.KeepAlive(src1) + runtime.KeepAlive(src2) + + var _dest *Rectangle // out + var _ok bool // out + + _dest = (*Rectangle)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + if _cret != 0 { + _ok = true + } + + return _dest, _ok +} + +// Union calculates the union of two rectangles. +// +// The union of rectangles src1 and src2 is the smallest rectangle which +// includes both src1 and src2 within it. It is allowed for dest to be the same +// as either src1 or src2. +// +// Note that this function does not ignore 'empty' rectangles (ie. with zero +// width or height). +// +// The function takes the following parameters: +// +// - src2: GdkRectangle. +// +// The function returns the following values: +// +// - dest: return location for the union of src1 and src2. +func (src1 *Rectangle) Union(src2 *Rectangle) *Rectangle { + var _arg0 *C.GdkRectangle // out + var _arg1 *C.GdkRectangle // out + var _arg2 C.GdkRectangle // in + + _arg0 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(src1))) + _arg1 = (*C.GdkRectangle)(gextras.StructNative(unsafe.Pointer(src2))) + + C.gdk_rectangle_union(_arg0, _arg1, &_arg2) + runtime.KeepAlive(src1) + runtime.KeepAlive(src2) + + var _dest *Rectangle // out + + _dest = (*Rectangle)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _dest +} + +// TextureDownloader: GdkTextureDownloader is used to download the contents of a +// gdk.Texture. +// +// It is intended to be created as a short-term object for a single download, +// but can be used for multiple downloads of different textures or with +// different settings. +// +// GdkTextureDownloader can be used to convert data between different formats. +// Create a GdkTexture for the existing format and then download it in a +// different format. +// +// An instance of this type is always passed by reference. +type TextureDownloader struct { + *textureDownloader +} + +// textureDownloader is the struct that's finalized. +type textureDownloader struct { + native *C.GdkTextureDownloader +} + +func marshalTextureDownloader(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &TextureDownloader{&textureDownloader{(*C.GdkTextureDownloader)(b)}}, nil +} + +// NewTextureDownloader constructs a struct TextureDownloader. +func NewTextureDownloader(texture Texturer) *TextureDownloader { + var _arg1 *C.GdkTexture // out + var _cret *C.GdkTextureDownloader // in + + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + + _cret = C.gdk_texture_downloader_new(_arg1) + runtime.KeepAlive(texture) + + var _textureDownloader *TextureDownloader // out + + _textureDownloader = (*TextureDownloader)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_textureDownloader)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_texture_downloader_free((*C.GdkTextureDownloader)(intern.C)) + }, + ) + + return _textureDownloader +} + +// Copy creates a copy of the downloader. +// +// This function is meant for language bindings. +// +// The function returns the following values: +// +// - textureDownloader: copy of the downloader. +func (self *TextureDownloader) Copy() *TextureDownloader { + var _arg0 *C.GdkTextureDownloader // out + var _cret *C.GdkTextureDownloader // in + + _arg0 = (*C.GdkTextureDownloader)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gdk_texture_downloader_copy(_arg0) + runtime.KeepAlive(self) + + var _textureDownloader *TextureDownloader // out + + _textureDownloader = (*TextureDownloader)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_textureDownloader)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_texture_downloader_free((*C.GdkTextureDownloader)(intern.C)) + }, + ) + + return _textureDownloader +} + +// DownloadBytes downloads the given texture pixels into a GBytes. The rowstride +// will be stored in the stride value. +// +// This function will abort if it tries to download a large texture and fails +// to allocate memory. If you think that may happen, you should handle memory +// allocation yourself and use gdk.TextureDownloader.DownloadInto() once +// allocation succeeded. +// +// The function returns the following values: +// +// - outStride: stride of the resulting data in bytes. +// - bytes: downloaded pixels. +func (self *TextureDownloader) DownloadBytes() (uint, *glib.Bytes) { + var _arg0 *C.GdkTextureDownloader // out + var _arg1 C.gsize // in + var _cret *C.GBytes // in + + _arg0 = (*C.GdkTextureDownloader)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gdk_texture_downloader_download_bytes(_arg0, &_arg1) + runtime.KeepAlive(self) + + var _outStride uint // out + var _bytes *glib.Bytes // out + + _outStride = uint(_arg1) + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _outStride, _bytes +} + +// Format gets the format that the data will be downloaded in. +// +// The function returns the following values: +// +// - memoryFormat: format of the download. +func (self *TextureDownloader) Format() MemoryFormat { + var _arg0 *C.GdkTextureDownloader // out + var _cret C.GdkMemoryFormat // in + + _arg0 = (*C.GdkTextureDownloader)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gdk_texture_downloader_get_format(_arg0) + runtime.KeepAlive(self) + + var _memoryFormat MemoryFormat // out + + _memoryFormat = MemoryFormat(_cret) + + return _memoryFormat +} + +// Texture gets the texture that the downloader will download. +// +// The function returns the following values: +// +// - texture to download. +func (self *TextureDownloader) Texture() Texturer { + var _arg0 *C.GdkTextureDownloader // out + var _cret *C.GdkTexture // in + + _arg0 = (*C.GdkTextureDownloader)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gdk_texture_downloader_get_texture(_arg0) + runtime.KeepAlive(self) + + var _texture Texturer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Texturer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Texturer) + return ok + }) + rv, ok := casted.(Texturer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") + } + _texture = rv + } + + return _texture +} + +// SetFormat sets the format the downloader will download. +// +// By default, GDK_MEMORY_DEFAULT is set. +// +// The function takes the following parameters: +// +// - format to use. +func (self *TextureDownloader) SetFormat(format MemoryFormat) { + var _arg0 *C.GdkTextureDownloader // out + var _arg1 C.GdkMemoryFormat // out + + _arg0 = (*C.GdkTextureDownloader)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.GdkMemoryFormat(format) + + C.gdk_texture_downloader_set_format(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(format) +} + +// SetTexture changes the texture the downloader will download. +// +// The function takes the following parameters: +// +// - texture: new texture to download. +func (self *TextureDownloader) SetTexture(texture Texturer) { + var _arg0 *C.GdkTextureDownloader // out + var _arg1 *C.GdkTexture // out + + _arg0 = (*C.GdkTextureDownloader)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + + C.gdk_texture_downloader_set_texture(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(texture) +} + +// TimeCoord: GdkTimeCoord stores a single event in a motion history. +// +// To check whether an axis is present, check whether the corresponding flag +// from the gdk.AxisFlags enumeration is set in the flags To access individual +// axis values, use the values of the values of the gdk.AxisUse enumerations as +// indices. +// +// An instance of this type is always passed by reference. +type TimeCoord struct { + *timeCoord +} + +// timeCoord is the struct that's finalized. +type timeCoord struct { + native *C.GdkTimeCoord +} + +// Time: timestamp for this event. +func (t *TimeCoord) Time() uint32 { + valptr := &t.native.time + var _v uint32 // out + _v = uint32(*valptr) + return _v +} + +// Flags indicating what axes are present, see gdk.AxisFlags. +func (t *TimeCoord) Flags() AxisFlags { + valptr := &t.native.flags + var _v AxisFlags // out + _v = AxisFlags(*valptr) + return _v +} + +// Axes axis values, indexed by gdk.AxisUse. +func (t *TimeCoord) Axes() [12]float64 { + valptr := &t.native.axes + var _v [12]float64 // out + _v = *(*[12]float64)(unsafe.Pointer(&*valptr)) + return _v +} + +// Time: timestamp for this event. +func (t *TimeCoord) SetTime(time uint32) { + valptr := &t.native.time + *valptr = C.guint32(time) +} + +// ToplevelLayout: GdkToplevelLayout struct contains information that is +// necessary to present a sovereign window on screen. +// +// The GdkToplevelLayout struct is necessary for using gdk.Toplevel.Present(). +// +// Toplevel surfaces are sovereign windows that can be presented to the user in +// various states (maximized, on all workspaces, etc). +// +// An instance of this type is always passed by reference. +type ToplevelLayout struct { + *toplevelLayout +} + +// toplevelLayout is the struct that's finalized. +type toplevelLayout struct { + native *C.GdkToplevelLayout +} + +func marshalToplevelLayout(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &ToplevelLayout{&toplevelLayout{(*C.GdkToplevelLayout)(b)}}, nil +} + +// NewToplevelLayout constructs a struct ToplevelLayout. +func NewToplevelLayout() *ToplevelLayout { + var _cret *C.GdkToplevelLayout // in + + _cret = C.gdk_toplevel_layout_new() + + var _toplevelLayout *ToplevelLayout // out + + _toplevelLayout = (*ToplevelLayout)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_toplevelLayout)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_toplevel_layout_unref((*C.GdkToplevelLayout)(intern.C)) + }, + ) + + return _toplevelLayout +} + +// Copy: create a new GdkToplevelLayout and copy the contents of layout into it. +// +// The function returns the following values: +// +// - toplevelLayout: copy of layout. +func (layout *ToplevelLayout) Copy() *ToplevelLayout { + var _arg0 *C.GdkToplevelLayout // out + var _cret *C.GdkToplevelLayout // in + + _arg0 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_toplevel_layout_copy(_arg0) + runtime.KeepAlive(layout) + + var _toplevelLayout *ToplevelLayout // out + + _toplevelLayout = (*ToplevelLayout)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_toplevelLayout)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_toplevel_layout_unref((*C.GdkToplevelLayout)(intern.C)) + }, + ) + + return _toplevelLayout +} + +// Equal: check whether layout and other has identical layout properties. +// +// The function takes the following parameters: +// +// - other GdkToplevelLayout. +// +// The function returns the following values: +// +// - ok: TRUE if layout and other have identical layout properties, otherwise +// FALSE. +func (layout *ToplevelLayout) Equal(other *ToplevelLayout) bool { + var _arg0 *C.GdkToplevelLayout // out + var _arg1 *C.GdkToplevelLayout // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + _arg1 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(other))) + + _cret = C.gdk_toplevel_layout_equal(_arg0, _arg1) + runtime.KeepAlive(layout) + runtime.KeepAlive(other) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Fullscreen: if the layout specifies whether to the toplevel should go +// fullscreen, the value pointed to by fullscreen is set to TRUE if it should go +// fullscreen, or FALSE, if it should go unfullscreen. +// +// The function returns the following values: +// +// - fullscreen: location to store whether the toplevel should be fullscreen. +// - ok: whether the layout specifies the fullscreen state for the toplevel. +func (layout *ToplevelLayout) Fullscreen() (fullscreen bool, ok bool) { + var _arg0 *C.GdkToplevelLayout // out + var _arg1 C.gboolean // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_toplevel_layout_get_fullscreen(_arg0, &_arg1) + runtime.KeepAlive(layout) + + var _fullscreen bool // out + var _ok bool // out + + if _arg1 != 0 { + _fullscreen = true + } + if _cret != 0 { + _ok = true + } + + return _fullscreen, _ok +} + +// FullscreenMonitor returns the monitor that the layout is fullscreening the +// surface on. +// +// The function returns the following values: +// +// - monitor (optional) on which layout fullscreens. +func (layout *ToplevelLayout) FullscreenMonitor() *Monitor { + var _arg0 *C.GdkToplevelLayout // out + var _cret *C.GdkMonitor // in + + _arg0 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_toplevel_layout_get_fullscreen_monitor(_arg0) + runtime.KeepAlive(layout) + + var _monitor *Monitor // out + + if _cret != nil { + _monitor = wrapMonitor(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _monitor +} + +// Maximized: if the layout specifies whether to the toplevel should go +// maximized, the value pointed to by maximized is set to TRUE if it should go +// fullscreen, or FALSE, if it should go unmaximized. +// +// The function returns the following values: +// +// - maximized: set to TRUE if the toplevel should be maximized. +// - ok: whether the layout specifies the maximized state for the toplevel. +func (layout *ToplevelLayout) Maximized() (maximized bool, ok bool) { + var _arg0 *C.GdkToplevelLayout // out + var _arg1 C.gboolean // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_toplevel_layout_get_maximized(_arg0, &_arg1) + runtime.KeepAlive(layout) + + var _maximized bool // out + var _ok bool // out + + if _arg1 != 0 { + _maximized = true + } + if _cret != 0 { + _ok = true + } + + return _maximized, _ok +} + +// Resizable returns whether the layout should allow the user to resize the +// surface. +// +// The function returns the following values: +// +// - ok: TRUE if the layout is resizable. +func (layout *ToplevelLayout) Resizable() bool { + var _arg0 *C.GdkToplevelLayout // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + + _cret = C.gdk_toplevel_layout_get_resizable(_arg0) + runtime.KeepAlive(layout) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetFullscreen sets whether the layout should cause the surface to be +// fullscreen when presented. +// +// The function takes the following parameters: +// +// - fullscreen: TRUE to fullscreen the surface. +// - monitor (optional) to fullscreen on. +func (layout *ToplevelLayout) SetFullscreen(fullscreen bool, monitor *Monitor) { + var _arg0 *C.GdkToplevelLayout // out + var _arg1 C.gboolean // out + var _arg2 *C.GdkMonitor // out + + _arg0 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + if fullscreen { + _arg1 = C.TRUE + } + if monitor != nil { + _arg2 = (*C.GdkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + } + + C.gdk_toplevel_layout_set_fullscreen(_arg0, _arg1, _arg2) + runtime.KeepAlive(layout) + runtime.KeepAlive(fullscreen) + runtime.KeepAlive(monitor) +} + +// SetMaximized sets whether the layout should cause the surface to be maximized +// when presented. +// +// The function takes the following parameters: +// +// - maximized: TRUE to maximize. +func (layout *ToplevelLayout) SetMaximized(maximized bool) { + var _arg0 *C.GdkToplevelLayout // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + if maximized { + _arg1 = C.TRUE + } + + C.gdk_toplevel_layout_set_maximized(_arg0, _arg1) + runtime.KeepAlive(layout) + runtime.KeepAlive(maximized) +} + +// SetResizable sets whether the layout should allow the user to resize the +// surface after it has been presented. +// +// The function takes the following parameters: +// +// - resizable: TRUE to allow resizing. +func (layout *ToplevelLayout) SetResizable(resizable bool) { + var _arg0 *C.GdkToplevelLayout // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkToplevelLayout)(gextras.StructNative(unsafe.Pointer(layout))) + if resizable { + _arg1 = C.TRUE + } + + C.gdk_toplevel_layout_set_resizable(_arg0, _arg1) + runtime.KeepAlive(layout) + runtime.KeepAlive(resizable) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/gdk/v4/gdk_export.go b/vendor/github.com/diamondburned/gotk4/pkg/gdk/v4/gdk_export.go new file mode 100644 index 00000000..25ae58ba --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/gdk/v4/gdk_export.go @@ -0,0 +1,853 @@ +// Code generated by girgen. DO NOT EDIT. + +package gdk + +import ( + "runtime" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/cairo" + "github.com/diamondburned/gotk4/pkg/core/gerror" + "github.com/diamondburned/gotk4/pkg/core/gextras" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" + "github.com/diamondburned/gotk4/pkg/gio/v2" +) + +// #include +// #include +// #include +import "C" + +//export _gotk4_gdk4_Paintable_ConnectInvalidateContents +func _gotk4_gdk4_Paintable_ConnectInvalidateContents(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_Paintable_ConnectInvalidateSize +func _gotk4_gdk4_Paintable_ConnectInvalidateSize(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_Clipboard_ConnectChanged +func _gotk4_gdk4_Clipboard_ConnectChanged(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_ContentProviderClass_attach_clipboard +func _gotk4_gdk4_ContentProviderClass_attach_clipboard(arg0 *C.GdkContentProvider, arg1 *C.GdkClipboard) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ContentProviderOverrides](instance0) + if overrides.AttachClipboard == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ContentProviderOverrides.AttachClipboard, got none") + } + + var _clipboard *Clipboard // out + + _clipboard = wrapClipboard(coreglib.Take(unsafe.Pointer(arg1))) + + overrides.AttachClipboard(_clipboard) +} + +//export _gotk4_gdk4_ContentProviderClass_content_changed +func _gotk4_gdk4_ContentProviderClass_content_changed(arg0 *C.GdkContentProvider) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ContentProviderOverrides](instance0) + if overrides.ContentChanged == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ContentProviderOverrides.ContentChanged, got none") + } + + overrides.ContentChanged() +} + +//export _gotk4_gdk4_ContentProviderClass_detach_clipboard +func _gotk4_gdk4_ContentProviderClass_detach_clipboard(arg0 *C.GdkContentProvider, arg1 *C.GdkClipboard) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ContentProviderOverrides](instance0) + if overrides.DetachClipboard == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ContentProviderOverrides.DetachClipboard, got none") + } + + var _clipboard *Clipboard // out + + _clipboard = wrapClipboard(coreglib.Take(unsafe.Pointer(arg1))) + + overrides.DetachClipboard(_clipboard) +} + +//export _gotk4_gdk4_ContentProviderClass_get_value +func _gotk4_gdk4_ContentProviderClass_get_value(arg0 *C.GdkContentProvider, arg1 *C.GValue, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ContentProviderOverrides](instance0) + if overrides.Value == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ContentProviderOverrides.Value, got none") + } + + value, _goerr := overrides.Value() + + var _ coreglib.Value + var _ error + + *arg1 = *(*C.GValue)(unsafe.Pointer((&value).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gdk4_ContentProviderClass_ref_formats +func _gotk4_gdk4_ContentProviderClass_ref_formats(arg0 *C.GdkContentProvider) (cret *C.GdkContentFormats) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ContentProviderOverrides](instance0) + if overrides.RefFormats == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ContentProviderOverrides.RefFormats, got none") + } + + contentFormats := overrides.RefFormats() + + var _ *ContentFormats + + cret = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(contentFormats))) + + return cret +} + +//export _gotk4_gdk4_ContentProviderClass_ref_storable_formats +func _gotk4_gdk4_ContentProviderClass_ref_storable_formats(arg0 *C.GdkContentProvider) (cret *C.GdkContentFormats) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ContentProviderOverrides](instance0) + if overrides.RefStorableFormats == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ContentProviderOverrides.RefStorableFormats, got none") + } + + contentFormats := overrides.RefStorableFormats() + + var _ *ContentFormats + + cret = (*C.GdkContentFormats)(gextras.StructNative(unsafe.Pointer(contentFormats))) + + return cret +} + +//export _gotk4_gdk4_ContentProviderClass_write_mime_type_finish +func _gotk4_gdk4_ContentProviderClass_write_mime_type_finish(arg0 *C.GdkContentProvider, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ContentProviderOverrides](instance0) + if overrides.WriteMIMETypeFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ContentProviderOverrides.WriteMIMETypeFinish, got none") + } + + var _result gio.AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gio.AsyncResulter) + return ok + }) + rv, ok := casted.(gio.AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + _goerr := overrides.WriteMIMETypeFinish(_result) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gdk4_ContentProvider_ConnectContentChanged +func _gotk4_gdk4_ContentProvider_ConnectContentChanged(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_Device_ConnectChanged +func _gotk4_gdk4_Device_ConnectChanged(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_Device_ConnectToolChanged +func _gotk4_gdk4_Device_ConnectToolChanged(arg0 C.gpointer, arg1 *C.GdkDeviceTool, arg2 C.guintptr) { + var f func(tool *DeviceTool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(tool *DeviceTool)) + } + + var _tool *DeviceTool // out + + _tool = wrapDeviceTool(coreglib.Take(unsafe.Pointer(arg1))) + + f(_tool) +} + +//export _gotk4_gdk4_Display_ConnectClosed +func _gotk4_gdk4_Display_ConnectClosed(arg0 C.gpointer, arg1 C.gboolean, arg2 C.guintptr) { + var f func(isError bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(isError bool)) + } + + var _isError bool // out + + if arg1 != 0 { + _isError = true + } + + f(_isError) +} + +//export _gotk4_gdk4_Display_ConnectOpened +func _gotk4_gdk4_Display_ConnectOpened(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_Display_ConnectSeatAdded +func _gotk4_gdk4_Display_ConnectSeatAdded(arg0 C.gpointer, arg1 *C.GdkSeat, arg2 C.guintptr) { + var f func(seat Seater) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(seat Seater)) + } + + var _seat Seater // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gdk.Seater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Seater) + return ok + }) + rv, ok := casted.(Seater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Seater") + } + _seat = rv + } + + f(_seat) +} + +//export _gotk4_gdk4_Display_ConnectSeatRemoved +func _gotk4_gdk4_Display_ConnectSeatRemoved(arg0 C.gpointer, arg1 *C.GdkSeat, arg2 C.guintptr) { + var f func(seat Seater) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(seat Seater)) + } + + var _seat Seater // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gdk.Seater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Seater) + return ok + }) + rv, ok := casted.(Seater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Seater") + } + _seat = rv + } + + f(_seat) +} + +//export _gotk4_gdk4_Display_ConnectSettingChanged +func _gotk4_gdk4_Display_ConnectSettingChanged(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) { + var f func(setting string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(setting string)) + } + + var _setting string // out + + _setting = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + f(_setting) +} + +//export _gotk4_gdk4_DisplayManager_ConnectDisplayOpened +func _gotk4_gdk4_DisplayManager_ConnectDisplayOpened(arg0 C.gpointer, arg1 *C.GdkDisplay, arg2 C.guintptr) { + var f func(display *Display) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(display *Display)) + } + + var _display *Display // out + + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(arg1))) + + f(_display) +} + +//export _gotk4_gdk4_Drag_ConnectCancel +func _gotk4_gdk4_Drag_ConnectCancel(arg0 C.gpointer, arg1 C.GdkDragCancelReason, arg2 C.guintptr) { + var f func(reason DragCancelReason) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(reason DragCancelReason)) + } + + var _reason DragCancelReason // out + + _reason = DragCancelReason(arg1) + + f(_reason) +} + +//export _gotk4_gdk4_Drag_ConnectDNDFinished +func _gotk4_gdk4_Drag_ConnectDNDFinished(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_Drag_ConnectDropPerformed +func _gotk4_gdk4_Drag_ConnectDropPerformed(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_FrameClock_ConnectAfterPaint +func _gotk4_gdk4_FrameClock_ConnectAfterPaint(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_FrameClock_ConnectBeforePaint +func _gotk4_gdk4_FrameClock_ConnectBeforePaint(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_FrameClock_ConnectFlushEvents +func _gotk4_gdk4_FrameClock_ConnectFlushEvents(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_FrameClock_ConnectLayout +func _gotk4_gdk4_FrameClock_ConnectLayout(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_FrameClock_ConnectPaint +func _gotk4_gdk4_FrameClock_ConnectPaint(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_FrameClock_ConnectResumeEvents +func _gotk4_gdk4_FrameClock_ConnectResumeEvents(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_FrameClock_ConnectUpdate +func _gotk4_gdk4_FrameClock_ConnectUpdate(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_Monitor_ConnectInvalidate +func _gotk4_gdk4_Monitor_ConnectInvalidate(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdk4_Seat_ConnectDeviceAdded +func _gotk4_gdk4_Seat_ConnectDeviceAdded(arg0 C.gpointer, arg1 *C.GdkDevice, arg2 C.guintptr) { + var f func(device Devicer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(device Devicer)) + } + + var _device Devicer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gdk.Devicer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Devicer) + return ok + }) + rv, ok := casted.(Devicer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Devicer") + } + _device = rv + } + + f(_device) +} + +//export _gotk4_gdk4_Seat_ConnectDeviceRemoved +func _gotk4_gdk4_Seat_ConnectDeviceRemoved(arg0 C.gpointer, arg1 *C.GdkDevice, arg2 C.guintptr) { + var f func(device Devicer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(device Devicer)) + } + + var _device Devicer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gdk.Devicer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Devicer) + return ok + }) + rv, ok := casted.(Devicer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Devicer") + } + _device = rv + } + + f(_device) +} + +//export _gotk4_gdk4_Seat_ConnectToolAdded +func _gotk4_gdk4_Seat_ConnectToolAdded(arg0 C.gpointer, arg1 *C.GdkDeviceTool, arg2 C.guintptr) { + var f func(tool *DeviceTool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(tool *DeviceTool)) + } + + var _tool *DeviceTool // out + + _tool = wrapDeviceTool(coreglib.Take(unsafe.Pointer(arg1))) + + f(_tool) +} + +//export _gotk4_gdk4_Seat_ConnectToolRemoved +func _gotk4_gdk4_Seat_ConnectToolRemoved(arg0 C.gpointer, arg1 *C.GdkDeviceTool, arg2 C.guintptr) { + var f func(tool *DeviceTool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(tool *DeviceTool)) + } + + var _tool *DeviceTool // out + + _tool = wrapDeviceTool(coreglib.Take(unsafe.Pointer(arg1))) + + f(_tool) +} + +//export _gotk4_gdk4_Surface_ConnectEnterMonitor +func _gotk4_gdk4_Surface_ConnectEnterMonitor(arg0 C.gpointer, arg1 *C.GdkMonitor, arg2 C.guintptr) { + var f func(monitor *Monitor) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(monitor *Monitor)) + } + + var _monitor *Monitor // out + + _monitor = wrapMonitor(coreglib.Take(unsafe.Pointer(arg1))) + + f(_monitor) +} + +//export _gotk4_gdk4_Surface_ConnectEvent +func _gotk4_gdk4_Surface_ConnectEvent(arg0 C.gpointer, arg1 *C.gpointer, arg2 C.guintptr) (cret C.gboolean) { + var f func(event Eventer) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(event Eventer) (ok bool)) + } + + var _event Eventer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gdk.Eventer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Eventer) + return ok + }) + rv, ok := casted.(Eventer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Eventer") + } + _event = rv + } + + ok := f(_event) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gdk4_Surface_ConnectLayout +func _gotk4_gdk4_Surface_ConnectLayout(arg0 C.gpointer, arg1 C.gint, arg2 C.gint, arg3 C.guintptr) { + var f func(width, height int) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(width, height int)) + } + + var _width int // out + var _height int // out + + _width = int(arg1) + _height = int(arg2) + + f(_width, _height) +} + +//export _gotk4_gdk4_Surface_ConnectLeaveMonitor +func _gotk4_gdk4_Surface_ConnectLeaveMonitor(arg0 C.gpointer, arg1 *C.GdkMonitor, arg2 C.guintptr) { + var f func(monitor *Monitor) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(monitor *Monitor)) + } + + var _monitor *Monitor // out + + _monitor = wrapMonitor(coreglib.Take(unsafe.Pointer(arg1))) + + f(_monitor) +} + +//export _gotk4_gdk4_Surface_ConnectRender +func _gotk4_gdk4_Surface_ConnectRender(arg0 C.gpointer, arg1 *C.cairo_region_t, arg2 C.guintptr) (cret C.gboolean) { + var f func(region *cairo.Region) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(region *cairo.Region) (ok bool)) + } + + var _region *cairo.Region // out + + { + _pp := &struct{ p unsafe.Pointer }{unsafe.Pointer(arg1)} + _region = (*cairo.Region)(unsafe.Pointer(_pp)) + } + C.cairo_region_reference(arg1) + runtime.SetFinalizer(_region, func(v *cairo.Region) { + C.cairo_region_destroy((*C.cairo_region_t)(unsafe.Pointer(v.Native()))) + }) + + ok := f(_region) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gdk4_VulkanContext_ConnectImagesUpdated +func _gotk4_gdk4_VulkanContext_ConnectImagesUpdated(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2/gdkpixbuf.go b/vendor/github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2/gdkpixbuf.go new file mode 100644 index 00000000..80f8ac39 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2/gdkpixbuf.go @@ -0,0 +1,4640 @@ +// Code generated by girgen. DO NOT EDIT. + +package gdkpixbuf + +import ( + "context" + "fmt" + "image" + "image/draw" + "runtime" + _ "runtime/cgo" + "strings" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/cairo/swizzle" + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gcancel" + "github.com/diamondburned/gotk4/pkg/core/gerror" + "github.com/diamondburned/gotk4/pkg/core/gextras" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" + "github.com/diamondburned/gotk4/pkg/gio/v2" + "github.com/diamondburned/gotk4/pkg/glib/v2" +) + +// #cgo pkg-config: gdk-pixbuf-2.0 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// #include +// #include +// extern void _gotk4_gio2_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer); +// extern void _gotk4_gdkpixbuf2_PixbufLoader_ConnectSizePrepared(gpointer, gint, gint, guintptr); +// extern void _gotk4_gdkpixbuf2_PixbufLoader_ConnectClosed(gpointer, guintptr); +// extern void _gotk4_gdkpixbuf2_PixbufLoader_ConnectAreaUpdated(gpointer, gint, gint, gint, gint, guintptr); +// extern void _gotk4_gdkpixbuf2_PixbufLoader_ConnectAreaPrepared(gpointer, guintptr); +// extern void _gotk4_gdkpixbuf2_PixbufLoaderClass_size_prepared(GdkPixbufLoader*, int, int); +// extern void _gotk4_gdkpixbuf2_PixbufLoaderClass_closed(GdkPixbufLoader*); +// extern void _gotk4_gdkpixbuf2_PixbufLoaderClass_area_updated(GdkPixbufLoader*, int, int, int, int); +// extern void _gotk4_gdkpixbuf2_PixbufLoaderClass_area_prepared(GdkPixbufLoader*); +// extern void _gotk4_gdkpixbuf2_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer); +// extern gboolean _gotk4_gdkpixbuf2_PixbufSaveFunc(gchar*, gsize, GError**, gpointer); +// void _gotk4_gdkpixbuf2_PixbufLoader_virtual_area_prepared(void* fnptr, GdkPixbufLoader* arg0) { +// ((void (*)(GdkPixbufLoader*))(fnptr))(arg0); +// }; +// void _gotk4_gdkpixbuf2_PixbufLoader_virtual_area_updated(void* fnptr, GdkPixbufLoader* arg0, int arg1, int arg2, int arg3, int arg4) { +// ((void (*)(GdkPixbufLoader*, int, int, int, int))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gdkpixbuf2_PixbufLoader_virtual_closed(void* fnptr, GdkPixbufLoader* arg0) { +// ((void (*)(GdkPixbufLoader*))(fnptr))(arg0); +// }; +// void _gotk4_gdkpixbuf2_PixbufLoader_virtual_size_prepared(void* fnptr, GdkPixbufLoader* arg0, int arg1, int arg2) { +// ((void (*)(GdkPixbufLoader*, int, int))(fnptr))(arg0, arg1, arg2); +// }; +import "C" + +// GType values. +var ( + GTypeColorspace = coreglib.Type(C.gdk_colorspace_get_type()) + GTypeInterpType = coreglib.Type(C.gdk_interp_type_get_type()) + GTypePixbufAlphaMode = coreglib.Type(C.gdk_pixbuf_alpha_mode_get_type()) + GTypePixbufError = coreglib.Type(C.gdk_pixbuf_error_get_type()) + GTypePixbufRotation = coreglib.Type(C.gdk_pixbuf_rotation_get_type()) + GTypePixbuf = coreglib.Type(C.gdk_pixbuf_get_type()) + GTypePixbufAnimation = coreglib.Type(C.gdk_pixbuf_animation_get_type()) + GTypePixbufAnimationIter = coreglib.Type(C.gdk_pixbuf_animation_iter_get_type()) + GTypePixbufLoader = coreglib.Type(C.gdk_pixbuf_loader_get_type()) + GTypePixbufSimpleAnim = coreglib.Type(C.gdk_pixbuf_simple_anim_get_type()) + GTypePixbufSimpleAnimIter = coreglib.Type(C.gdk_pixbuf_simple_anim_iter_get_type()) + GTypePixbufFormat = coreglib.Type(C.gdk_pixbuf_format_get_type()) +) + +func init() { + coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{ + coreglib.TypeMarshaler{T: GTypeColorspace, F: marshalColorspace}, + coreglib.TypeMarshaler{T: GTypeInterpType, F: marshalInterpType}, + coreglib.TypeMarshaler{T: GTypePixbufAlphaMode, F: marshalPixbufAlphaMode}, + coreglib.TypeMarshaler{T: GTypePixbufError, F: marshalPixbufError}, + coreglib.TypeMarshaler{T: GTypePixbufRotation, F: marshalPixbufRotation}, + coreglib.TypeMarshaler{T: GTypePixbuf, F: marshalPixbuf}, + coreglib.TypeMarshaler{T: GTypePixbufAnimation, F: marshalPixbufAnimation}, + coreglib.TypeMarshaler{T: GTypePixbufAnimationIter, F: marshalPixbufAnimationIter}, + coreglib.TypeMarshaler{T: GTypePixbufLoader, F: marshalPixbufLoader}, + coreglib.TypeMarshaler{T: GTypePixbufSimpleAnim, F: marshalPixbufSimpleAnim}, + coreglib.TypeMarshaler{T: GTypePixbufSimpleAnimIter, F: marshalPixbufSimpleAnimIter}, + coreglib.TypeMarshaler{T: GTypePixbufFormat, F: marshalPixbufFormat}, + }) +} + +// PIXBUF_MAJOR: major version of gdk-pixbuf library, that is the "0" in "0.8.2" +// for example. +const PIXBUF_MAJOR = 2 + +// PIXBUF_MICRO: micro version of gdk-pixbuf library, that is the "2" in "0.8.2" +// for example. +const PIXBUF_MICRO = 12 + +// PIXBUF_MINOR: minor version of gdk-pixbuf library, that is the "8" in "0.8.2" +// for example. +const PIXBUF_MINOR = 42 + +// PIXBUF_VERSION contains the full version of GdkPixbuf as a string. +// +// This is the version being compiled against; contrast with gdk_pixbuf_version. +const PIXBUF_VERSION = "2.42.12" + +// Colorspace: this enumeration defines the color spaces that are supported by +// the gdk-pixbuf library. +// +// Currently only RGB is supported. +type Colorspace C.gint + +const ( + // ColorspaceRGB indicates a red/green/blue additive color space. + ColorspaceRGB Colorspace = iota +) + +func marshalColorspace(p uintptr) (interface{}, error) { + return Colorspace(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Colorspace. +func (c Colorspace) String() string { + switch c { + case ColorspaceRGB: + return "RGB" + default: + return fmt.Sprintf("Colorspace(%d)", c) + } +} + +// InterpType: interpolation modes for scaling functions. +// +// The GDK_INTERP_NEAREST mode is the fastest scaling method, but has horrible +// quality when scaling down; GDK_INTERP_BILINEAR is the best choice if you +// aren't sure what to choose, it has a good speed/quality balance. +// +// **Note**: Cubic filtering is missing from the list; hyperbolic interpolation +// is just as fast and results in higher quality. +type InterpType C.gint + +const ( + // InterpNearest: nearest neighbor sampling; this is the fastest and lowest + // quality mode. Quality is normally unacceptable when scaling down, but may + // be OK when scaling up. + InterpNearest InterpType = iota + // InterpTiles: this is an accurate simulation of the PostScript image + // operator without any interpolation enabled. Each pixel is rendered as a + // tiny parallelogram of solid color, the edges of which are implemented + // with antialiasing. It resembles nearest neighbor for enlargement, + // and bilinear for reduction. + InterpTiles + // InterpBilinear: best quality/speed balance; use this mode by default. + // Bilinear interpolation. For enlargement, it is equivalent to + // point-sampling the ideal bilinear-interpolated image. For reduction, + // it is equivalent to laying down small tiles and integrating over the + // coverage area. + InterpBilinear + // InterpHyper: this is the slowest and highest quality reconstruction + // function. It is derived from the hyperbolic filters in Wolberg's "Digital + // Image Warping", and is formally defined as the hyperbolic-filter sampling + // the ideal hyperbolic-filter interpolated image (the filter is designed to + // be idempotent for 1:1 pixel mapping). **Deprecated**: this interpolation + // filter is deprecated, as in reality it has a lower quality than the + // GDK_INTERP_BILINEAR filter (Since: 2.38). + InterpHyper +) + +func marshalInterpType(p uintptr) (interface{}, error) { + return InterpType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for InterpType. +func (i InterpType) String() string { + switch i { + case InterpNearest: + return "Nearest" + case InterpTiles: + return "Tiles" + case InterpBilinear: + return "Bilinear" + case InterpHyper: + return "Hyper" + default: + return fmt.Sprintf("InterpType(%d)", i) + } +} + +// PixbufAlphaMode: control the alpha channel for drawables. +// +// These values can be passed to gdk_pixbuf_xlib_render_to_drawable_alpha() +// in gdk-pixbuf-xlib to control how the alpha channel of an image should be +// handled. +// +// This function can create a bilevel clipping mask (black and white) and use it +// while painting the image. +// +// In the future, when the X Window System gets an alpha channel extension, +// it will be possible to do full alpha compositing onto arbitrary drawables. +// For now both cases fall back to a bilevel clipping mask. +// +// Deprecated: There is no user of GdkPixbufAlphaMode in GdkPixbuf, and the Xlib +// utility functions have been split out to their own library, gdk-pixbuf-xlib. +type PixbufAlphaMode C.gint + +const ( + // PixbufAlphaBilevel: bilevel clipping mask (black and white) will be + // created and used to draw the image. Pixels below 0.5 opacity will be + // considered fully transparent, and all others will be considered fully + // opaque. + PixbufAlphaBilevel PixbufAlphaMode = iota + // PixbufAlphaFull: for now falls back to K_PIXBUF_ALPHA_BILEVEL. In the + // future it will do full alpha compositing. + PixbufAlphaFull +) + +func marshalPixbufAlphaMode(p uintptr) (interface{}, error) { + return PixbufAlphaMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PixbufAlphaMode. +func (p PixbufAlphaMode) String() string { + switch p { + case PixbufAlphaBilevel: + return "Bilevel" + case PixbufAlphaFull: + return "Full" + default: + return fmt.Sprintf("PixbufAlphaMode(%d)", p) + } +} + +// PixbufError: error code in the GDK_PIXBUF_ERROR domain. +// +// Many gdk-pixbuf operations can cause errors in this domain, or in the +// G_FILE_ERROR domain. +type PixbufError C.gint + +const ( + // PixbufErrorCorruptImage: image file was broken somehow. + PixbufErrorCorruptImage PixbufError = iota + // PixbufErrorInsufficientMemory: not enough memory. + PixbufErrorInsufficientMemory + // PixbufErrorBadOption: bad option was passed to a pixbuf save module. + PixbufErrorBadOption + // PixbufErrorUnknownType: unknown image type. + PixbufErrorUnknownType + // PixbufErrorUnsupportedOperation: don't know how to perform the given + // operation on the type of image at hand. + PixbufErrorUnsupportedOperation + // PixbufErrorFailed: generic failure code, something went wrong. + PixbufErrorFailed + // PixbufErrorIncompleteAnimation: only part of the animation was loaded. + PixbufErrorIncompleteAnimation +) + +func marshalPixbufError(p uintptr) (interface{}, error) { + return PixbufError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PixbufError. +func (p PixbufError) String() string { + switch p { + case PixbufErrorCorruptImage: + return "CorruptImage" + case PixbufErrorInsufficientMemory: + return "InsufficientMemory" + case PixbufErrorBadOption: + return "BadOption" + case PixbufErrorUnknownType: + return "UnknownType" + case PixbufErrorUnsupportedOperation: + return "UnsupportedOperation" + case PixbufErrorFailed: + return "Failed" + case PixbufErrorIncompleteAnimation: + return "IncompleteAnimation" + default: + return fmt.Sprintf("PixbufError(%d)", p) + } +} + +func PixbufErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gdk_pixbuf_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// PixbufRotation: possible rotations which can be passed to +// gdk_pixbuf_rotate_simple(). +// +// To make them easier to use, their numerical values are the actual degrees. +type PixbufRotation C.gint + +const ( + // PixbufRotateNone: no rotation. + PixbufRotateNone PixbufRotation = 0 + // PixbufRotateCounterclockwise: rotate by 90 degrees. + PixbufRotateCounterclockwise PixbufRotation = 90 + // PixbufRotateUpsidedown: rotate by 180 degrees. + PixbufRotateUpsidedown PixbufRotation = 180 + // PixbufRotateClockwise: rotate by 270 degrees. + PixbufRotateClockwise PixbufRotation = 270 +) + +func marshalPixbufRotation(p uintptr) (interface{}, error) { + return PixbufRotation(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PixbufRotation. +func (p PixbufRotation) String() string { + switch p { + case PixbufRotateNone: + return "None" + case PixbufRotateCounterclockwise: + return "Counterclockwise" + case PixbufRotateUpsidedown: + return "Upsidedown" + case PixbufRotateClockwise: + return "Clockwise" + default: + return fmt.Sprintf("PixbufRotation(%d)", p) + } +} + +// PixbufFormatFlags flags which allow a module to specify further details about +// the supported operations. +type PixbufFormatFlags C.guint + +const ( + // PixbufFormatWritable: module can write out images in the format. + PixbufFormatWritable PixbufFormatFlags = 0b1 + // PixbufFormatScalable: image format is scalable. + PixbufFormatScalable PixbufFormatFlags = 0b10 + // PixbufFormatThreadsafe: module is threadsafe. gdk-pixbuf ignores modules + // that are not marked as threadsafe. (Since 2.28). + PixbufFormatThreadsafe PixbufFormatFlags = 0b100 +) + +// String returns the names in string for PixbufFormatFlags. +func (p PixbufFormatFlags) String() string { + if p == 0 { + return "PixbufFormatFlags(0)" + } + + var builder strings.Builder + builder.Grow(64) + + for p != 0 { + next := p & (p - 1) + bit := p - next + + switch bit { + case PixbufFormatWritable: + builder.WriteString("Writable|") + case PixbufFormatScalable: + builder.WriteString("Scalable|") + case PixbufFormatThreadsafe: + builder.WriteString("Threadsafe|") + default: + builder.WriteString(fmt.Sprintf("PixbufFormatFlags(0b%b)|", bit)) + } + + p = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if p contains other. +func (p PixbufFormatFlags) Has(other PixbufFormatFlags) bool { + return (p & other) == other +} + +// PixbufModulePreparedFunc defines the type of the function that gets called +// once the initial setup of pixbuf is done. +// +// PixbufLoader uses a function of this type to emit the "area_prepared" signal. +type PixbufModulePreparedFunc func(pixbuf *Pixbuf, anim *PixbufAnimation) + +// PixbufModuleSizeFunc defines the type of the function that gets called once +// the size of the loaded image is known. +// +// The function is expected to set width and height to the desired size to which +// the image should be scaled. If a module has no efficient way to achieve +// the desired scaling during the loading of the image, it may either ignore +// the size request, or only approximate it - gdk-pixbuf will then perform the +// required scaling on the completely loaded image. +// +// If the function sets width or height to zero, the module should interpret +// this as a hint that it will be closed soon and shouldn't allocate further +// resources. This convention is used to implement gdk_pixbuf_get_file_info() +// efficiently. +type PixbufModuleSizeFunc func(width, height *int) + +// PixbufModuleUpdatedFunc defines the type of the function that gets called +// every time a region of pixbuf is updated. +// +// PixbufLoader uses a function of this type to emit the "area_updated" signal. +type PixbufModuleUpdatedFunc func(pixbuf *Pixbuf, x, y, width, height int) + +// PixbufSaveFunc: save functions used by gdkpixbuf.Pixbuf.SaveToCallback(). +// +// This function is called once for each block of bytes that is "written" by +// gdk_pixbuf_save_to_callback(). +// +// If successful it should return TRUE; if an error occurs it should set error +// and return FALSE, in which case gdk_pixbuf_save_to_callback() will fail with +// the same error. +type PixbufSaveFunc func(buf []byte) (err error, ok bool) + +// Pixbuf: pixel buffer. +// +// GdkPixbuf contains information about an image's pixel data, its color space, +// bits per sample, width and height, and the rowstride (the number of bytes +// between the start of one row and the start of the next). +// +// # Creating new GdkPixbuf +// +// The most basic way to create a pixbuf is to wrap an existing +// pixel buffer with a gdkpixbuf.Pixbuf instance. You can use the +// gdkpixbuf.Pixbuf.NewFromData function to do this. +// +// Every time you create a new GdkPixbuf instance for some data, you will +// need to specify the destroy notification function that will be called when +// the data buffer needs to be freed; this will happen when a GdkPixbuf is +// finalized by the reference counting functions. If you have a chunk of static +// data compiled into your application, you can pass in NULL as the destroy +// notification function so that the data will not be freed. +// +// The gdkpixbuf.Pixbuf.New constructor function can be used as a convenience to +// create a pixbuf with an empty buffer; this is equivalent to allocating a data +// buffer using malloc() and then wrapping it with gdk_pixbuf_new_from_data(). +// The gdk_pixbuf_new() function will compute an optimal rowstride so that +// rendering can be performed with an efficient algorithm. +// +// As a special case, you can use the gdkpixbuf.Pixbuf.NewFromXPMData function +// to create a pixbuf from inline XPM image data. +// +// You can also copy an existing pixbuf with the pixbuf.Copy function. This +// is not the same as just acquiring a reference to the old pixbuf instance: +// the copy function will actually duplicate the pixel data in memory and create +// a new pixbuf instance for it. +// +// # Reference counting +// +// GdkPixbuf structures are reference counted. This means that an application +// can share a single pixbuf among many parts of the code. When a piece of the +// program needs to use a pixbuf, it should acquire a reference to it by calling +// g_object_ref(); when it no longer needs the pixbuf, it should release the +// reference it acquired by calling g_object_unref(). The resources associated +// with a GdkPixbuf will be freed when its reference count drops to zero. +// Newly-created GdkPixbuf instances start with a reference count of one. +// +// # Image Data +// +// Image data in a pixbuf is stored in memory in an uncompressed, packed format. +// Rows in the image are stored top to bottom, and in each row pixels are stored +// from left to right. +// +// There may be padding at the end of a row. +// +// The "rowstride" value of a pixbuf, as returned by +// gdkpixbuf.Pixbuf.GetRowstride(), indicates the number of bytes between rows. +// +// **NOTE**: If you are copying raw pixbuf data with memcpy() note that +// the last row in the pixbuf may not be as wide as the full rowstride, +// but rather just as wide as the pixel data needs to be; that is: it is unsafe +// to do memcpy (dest, pixels, rowstride * height) to copy a whole pixbuf. +// Use gdkpixbuf.Pixbuf.Copy() instead, or compute the width in bytes of the +// last row as: +// +// last_row = width * ((n_channels * bits_per_sample + 7) / 8); +// +// The same rule applies when iterating over each row of a GdkPixbuf pixels +// array. +// +// The following code illustrates a simple put_pixel() function for RGB pixbufs +// with 8 bits per channel with an alpha channel. +// +// static void +// put_pixel (GdkPixbuf *pixbuf, +// int x, +// int y, +// guchar red, +// guchar green, +// guchar blue, +// guchar alpha) +// { +// int n_channels = gdk_pixbuf_get_n_channels (pixbuf); +// +// // Ensure that the pixbuf is valid +// g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB); +// g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8); +// g_assert (gdk_pixbuf_get_has_alpha (pixbuf)); +// g_assert (n_channels == 4); +// +// int width = gdk_pixbuf_get_width (pixbuf); +// int height = gdk_pixbuf_get_height (pixbuf); +// +// // Ensure that the coordinates are in a valid range +// g_assert (x >= 0 && x < width); +// g_assert (y >= 0 && y < height); +// +// int rowstride = gdk_pixbuf_get_rowstride (pixbuf); +// +// // The pixel buffer in the GdkPixbuf instance +// guchar *pixels = gdk_pixbuf_get_pixels (pixbuf); +// +// // The pixel we wish to modify +// guchar *p = pixels + y * rowstride + x * n_channels; +// p[0] = red; +// p[1] = green; +// p[2] = blue; +// p[3] = alpha; +// } +// +// # Loading images +// +// The GdkPixBuf class provides a simple mechanism for loading an image from a +// file in synchronous and asynchronous fashion. +// +// For GUI applications, it is recommended to use the asynchronous stream API to +// avoid blocking the control flow of the application. +// +// Additionally, GdkPixbuf provides the gdkpixbuf.PixbufLoader` API for +// progressive image loading. +// +// # Saving images +// +// The GdkPixbuf class provides methods for saving image data in a number of +// file formats. The formatted data can be written to a file or to a memory +// buffer. GdkPixbuf can also call a user-defined callback on the data, which +// allows to e.g. write the image to a socket or store it in a database. +type Pixbuf struct { + _ [0]func() // equal guard + *coreglib.Object + + gio.LoadableIcon +} + +var ( + _ coreglib.Objector = (*Pixbuf)(nil) +) + +func wrapPixbuf(obj *coreglib.Object) *Pixbuf { + return &Pixbuf{ + Object: obj, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, + } +} + +func marshalPixbuf(p uintptr) (interface{}, error) { + return wrapPixbuf(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewPixbuf creates a new GdkPixbuf structure and allocates a buffer for it. +// +// If the allocation of the buffer failed, this function will return NULL. +// +// The buffer has an optimal rowstride. Note that the buffer is not cleared; +// you will have to fill it completely yourself. +// +// The function takes the following parameters: +// +// - colorspace: color space for image. +// - hasAlpha: whether the image should have transparency information. +// - bitsPerSample: number of bits per color sample. +// - width: width of image in pixels, must be > 0. +// - height: height of image in pixels, must be > 0. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixel buffer. +func NewPixbuf(colorspace Colorspace, hasAlpha bool, bitsPerSample, width, height int) *Pixbuf { + var _arg1 C.GdkColorspace // out + var _arg2 C.gboolean // out + var _arg3 C.int // out + var _arg4 C.int // out + var _arg5 C.int // out + var _cret *C.GdkPixbuf // in + + _arg1 = C.GdkColorspace(colorspace) + if hasAlpha { + _arg2 = C.TRUE + } + _arg3 = C.int(bitsPerSample) + _arg4 = C.int(width) + _arg5 = C.int(height) + + _cret = C.gdk_pixbuf_new(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(colorspace) + runtime.KeepAlive(hasAlpha) + runtime.KeepAlive(bitsPerSample) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + + var _pixbuf *Pixbuf // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _pixbuf +} + +// NewPixbufFromBytes creates a new Pixbuf out of in-memory readonly image data. +// +// Currently only RGB images with 8 bits per sample are supported. +// +// This is the GBytes variant of gdk_pixbuf_new_from_data(), useful for language +// bindings. +// +// The function takes the following parameters: +// +// - data: image data in 8-bit/sample packed format inside a #GBytes. +// - colorspace: colorspace for the image data. +// - hasAlpha: whether the data has an opacity channel. +// - bitsPerSample: number of bits per sample. +// - width: width of the image in pixels, must be > 0. +// - height: height of the image in pixels, must be > 0. +// - rowstride: distance in bytes between row starts. +// +// The function returns the following values: +// +// - pixbuf: newly-created pixbuf. +func NewPixbufFromBytes(data *glib.Bytes, colorspace Colorspace, hasAlpha bool, bitsPerSample, width, height, rowstride int) *Pixbuf { + var _arg1 *C.GBytes // out + var _arg2 C.GdkColorspace // out + var _arg3 C.gboolean // out + var _arg4 C.int // out + var _arg5 C.int // out + var _arg6 C.int // out + var _arg7 C.int // out + var _cret *C.GdkPixbuf // in + + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(data))) + _arg2 = C.GdkColorspace(colorspace) + if hasAlpha { + _arg3 = C.TRUE + } + _arg4 = C.int(bitsPerSample) + _arg5 = C.int(width) + _arg6 = C.int(height) + _arg7 = C.int(rowstride) + + _cret = C.gdk_pixbuf_new_from_bytes(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(data) + runtime.KeepAlive(colorspace) + runtime.KeepAlive(hasAlpha) + runtime.KeepAlive(bitsPerSample) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(rowstride) + + var _pixbuf *Pixbuf // out + + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _pixbuf +} + +// NewPixbufFromFile creates a new pixbuf by loading an image from a file. +// +// The file format is detected automatically. +// +// If NULL is returned, then error will be set. Possible errors are: +// +// - the file could not be opened +// - there is no loader for the file's format +// - there is not enough memory to allocate the image buffer +// - the image buffer contains invalid data +// +// The error domains are GDK_PIXBUF_ERROR and G_FILE_ERROR. +// +// The function takes the following parameters: +// +// - filename: name of file to load, in the GLib file name encoding. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf. +func NewPixbufFromFile(filename string) (*Pixbuf, error) { + var _arg1 *C.char // out + var _cret *C.GdkPixbuf // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_new_from_file(_arg1, &_cerr) + runtime.KeepAlive(filename) + + var _pixbuf *Pixbuf // out + var _goerr error // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbuf, _goerr +} + +// NewPixbufFromFileAtScale creates a new pixbuf by loading an image from a +// file. +// +// The file format is detected automatically. +// +// If NULL is returned, then error will be set. Possible errors are: +// +// - the file could not be opened +// - there is no loader for the file's format +// - there is not enough memory to allocate the image buffer +// - the image buffer contains invalid data +// +// The error domains are GDK_PIXBUF_ERROR and G_FILE_ERROR. +// +// The image will be scaled to fit in the requested size, optionally preserving +// the image's aspect ratio. +// +// When preserving the aspect ratio, a width of -1 will cause the image to be +// scaled to the exact given height, and a height of -1 will cause the image +// to be scaled to the exact given width. When not preserving aspect ratio, a +// width or height of -1 means to not scale the image at all in that dimension. +// Negative values for width and height are allowed since 2.8. +// +// The function takes the following parameters: +// +// - filename: name of file to load, in the GLib file name encoding. +// - width the image should have or -1 to not constrain the width. +// - height the image should have or -1 to not constrain the height. +// - preserveAspectRatio: TRUE to preserve the image's aspect ratio. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf. +func NewPixbufFromFileAtScale(filename string, width, height int, preserveAspectRatio bool) (*Pixbuf, error) { + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.gboolean // out + var _cret *C.GdkPixbuf // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(width) + _arg3 = C.int(height) + if preserveAspectRatio { + _arg4 = C.TRUE + } + + _cret = C.gdk_pixbuf_new_from_file_at_scale(_arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(filename) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(preserveAspectRatio) + + var _pixbuf *Pixbuf // out + var _goerr error // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbuf, _goerr +} + +// NewPixbufFromFileAtSize creates a new pixbuf by loading an image from a file. +// +// The file format is detected automatically. +// +// If NULL is returned, then error will be set. Possible errors are: +// +// - the file could not be opened +// - there is no loader for the file's format +// - there is not enough memory to allocate the image buffer +// - the image buffer contains invalid data +// +// The error domains are GDK_PIXBUF_ERROR and G_FILE_ERROR. +// +// The image will be scaled to fit in the requested size, preserving the image's +// aspect ratio. Note that the returned pixbuf may be smaller than width x +// height, if the aspect ratio requires it. To load and image at the requested +// size, regardless of aspect ratio, use gdkpixbuf.Pixbuf.NewFromFileAtScale. +// +// The function takes the following parameters: +// +// - filename: name of file to load, in the GLib file name encoding. +// - width the image should have or -1 to not constrain the width. +// - height the image should have or -1 to not constrain the height. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf. +func NewPixbufFromFileAtSize(filename string, width, height int) (*Pixbuf, error) { + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg3 C.int // out + var _cret *C.GdkPixbuf // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(width) + _arg3 = C.int(height) + + _cret = C.gdk_pixbuf_new_from_file_at_size(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(filename) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + + var _pixbuf *Pixbuf // out + var _goerr error // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbuf, _goerr +} + +// NewPixbufFromInline creates a GdkPixbuf from a flat representation that is +// suitable for storing as inline data in a program. +// +// This is useful if you want to ship a program with images, but don't want to +// depend on any external files. +// +// GdkPixbuf ships with a program called gdk-pixbuf-csource, which allows for +// conversion of GdkPixbufs into such a inline representation. +// +// In almost all cases, you should pass the --raw option to gdk-pixbuf-csource. +// A sample invocation would be: +// +// gdk-pixbuf-csource --raw --name=myimage_inline myimage.png +// +// For the typical case where the inline pixbuf is read-only static data, +// you don't need to copy the pixel data unless you intend to write to it, so +// you can pass FALSE for copy_pixels. If you pass --rle to gdk-pixbuf-csource, +// a copy will be made even if copy_pixels is FALSE, so using this option is +// generally a bad idea. +// +// If you create a pixbuf from const inline data compiled into your program, +// it's probably safe to ignore errors and disable length checks, since things +// will always succeed: +// +// pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL); +// +// For non-const inline data, you could get out of memory. For untrusted inline +// data located at runtime, you could have corrupt inline data in addition. +// +// Deprecated: Use GResource instead. +// +// The function takes the following parameters: +// +// - data: byte data containing a serialized GdkPixdata structure. +// - copyPixels: whether to copy the pixel data, or use direct pointers data +// for the resulting pixbuf. +// +// The function returns the following values: +// +// - pixbuf: newly-created pixbuf. +func NewPixbufFromInline(data []byte, copyPixels bool) (*Pixbuf, error) { + var _arg2 *C.guint8 // out + var _arg1 C.gint + var _arg3 C.gboolean // out + var _cret *C.GdkPixbuf // in + var _cerr *C.GError // in + + _arg1 = (C.gint)(len(data)) + if len(data) > 0 { + _arg2 = (*C.guint8)(unsafe.Pointer(&data[0])) + } + if copyPixels { + _arg3 = C.TRUE + } + + _cret = C.gdk_pixbuf_new_from_inline(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(data) + runtime.KeepAlive(copyPixels) + + var _pixbuf *Pixbuf // out + var _goerr error // out + + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbuf, _goerr +} + +// NewPixbufFromResource creates a new pixbuf by loading an image from an +// resource. +// +// The file format is detected automatically. If NULL is returned, then error +// will be set. +// +// The function takes the following parameters: +// +// - resourcePath: path of the resource file. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf. +func NewPixbufFromResource(resourcePath string) (*Pixbuf, error) { + var _arg1 *C.char // out + var _cret *C.GdkPixbuf // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(resourcePath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_new_from_resource(_arg1, &_cerr) + runtime.KeepAlive(resourcePath) + + var _pixbuf *Pixbuf // out + var _goerr error // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbuf, _goerr +} + +// NewPixbufFromResourceAtScale creates a new pixbuf by loading an image from an +// resource. +// +// The file format is detected automatically. If NULL is returned, then error +// will be set. +// +// The image will be scaled to fit in the requested size, optionally preserving +// the image's aspect ratio. When preserving the aspect ratio, a width of -1 +// will cause the image to be scaled to the exact given height, and a height +// of -1 will cause the image to be scaled to the exact given width. When not +// preserving aspect ratio, a width or height of -1 means to not scale the image +// at all in that dimension. +// +// The stream is not closed. +// +// The function takes the following parameters: +// +// - resourcePath: path of the resource file. +// - width the image should have or -1 to not constrain the width. +// - height the image should have or -1 to not constrain the height. +// - preserveAspectRatio: TRUE to preserve the image's aspect ratio. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf. +func NewPixbufFromResourceAtScale(resourcePath string, width, height int, preserveAspectRatio bool) (*Pixbuf, error) { + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.gboolean // out + var _cret *C.GdkPixbuf // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(resourcePath))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(width) + _arg3 = C.int(height) + if preserveAspectRatio { + _arg4 = C.TRUE + } + + _cret = C.gdk_pixbuf_new_from_resource_at_scale(_arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(resourcePath) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(preserveAspectRatio) + + var _pixbuf *Pixbuf // out + var _goerr error // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbuf, _goerr +} + +// NewPixbufFromStream creates a new pixbuf by loading an image from an input +// stream. +// +// The file format is detected automatically. +// +// If NULL is returned, then error will be set. +// +// The cancellable can be used to abort the operation from another thread. If +// the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. +// Other possible errors are in the GDK_PIXBUF_ERROR and G_IO_ERROR domains. +// +// The stream is not closed. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - stream: GInputStream to load the pixbuf from. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf. +func NewPixbufFromStream(ctx context.Context, stream gio.InputStreamer) (*Pixbuf, error) { + var _arg2 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _cret *C.GdkPixbuf // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.gdk_pixbuf_new_from_stream(_arg1, _arg2, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + + var _pixbuf *Pixbuf // out + var _goerr error // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbuf, _goerr +} + +// NewPixbufFromStreamAtScale creates a new pixbuf by loading an image from an +// input stream. +// +// The file format is detected automatically. If NULL is returned, then error +// will be set. The cancellable can be used to abort the operation from another +// thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED will +// be returned. Other possible errors are in the GDK_PIXBUF_ERROR and G_IO_ERROR +// domains. +// +// The image will be scaled to fit in the requested size, optionally preserving +// the image's aspect ratio. +// +// When preserving the aspect ratio, a width of -1 will cause the image to be +// scaled to the exact given height, and a height of -1 will cause the image to +// be scaled to the exact given width. If both width and height are given, this +// function will behave as if the smaller of the two values is passed as -1. +// +// When not preserving aspect ratio, a width or height of -1 means to not scale +// the image at all in that dimension. +// +// The stream is not closed. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - stream: GInputStream to load the pixbuf from. +// - width the image should have or -1 to not constrain the width. +// - height the image should have or -1 to not constrain the height. +// - preserveAspectRatio: TRUE to preserve the image's aspect ratio. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf. +func NewPixbufFromStreamAtScale(ctx context.Context, stream gio.InputStreamer, width, height int, preserveAspectRatio bool) (*Pixbuf, error) { + var _arg5 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg2 C.gint // out + var _arg3 C.gint // out + var _arg4 C.gboolean // out + var _cret *C.GdkPixbuf // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg2 = C.gint(width) + _arg3 = C.gint(height) + if preserveAspectRatio { + _arg4 = C.TRUE + } + + _cret = C.gdk_pixbuf_new_from_stream_at_scale(_arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(preserveAspectRatio) + + var _pixbuf *Pixbuf // out + var _goerr error // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbuf, _goerr +} + +// NewPixbufFromStreamFinish finishes an asynchronous pixbuf creation operation +// started with gdk_pixbuf_new_from_stream_async(). +// +// The function takes the following parameters: +// +// - asyncResult: GAsyncResult. +// +// The function returns the following values: +// +// - pixbuf (optional): newly created pixbuf. +func NewPixbufFromStreamFinish(asyncResult gio.AsyncResulter) (*Pixbuf, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GdkPixbuf // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(asyncResult).Native())) + + _cret = C.gdk_pixbuf_new_from_stream_finish(_arg1, &_cerr) + runtime.KeepAlive(asyncResult) + + var _pixbuf *Pixbuf // out + var _goerr error // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbuf, _goerr +} + +// NewPixbufFromXPMData creates a new pixbuf by parsing XPM data in memory. +// +// This data is commonly the result of including an XPM file into a program's C +// source. +// +// The function takes the following parameters: +// +// - data: pointer to inline XPM data. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf. +func NewPixbufFromXPMData(data []string) *Pixbuf { + var _arg1 **C.char // out + var _cret *C.GdkPixbuf // in + + { + _arg1 = (**C.char)(C.calloc(C.size_t((len(data) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(data)+1) + var zero *C.char + out[len(data)] = zero + for i := range data { + out[i] = (*C.char)(unsafe.Pointer(C.CString(data[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + _cret = C.gdk_pixbuf_new_from_xpm_data(_arg1) + runtime.KeepAlive(data) + + var _pixbuf *Pixbuf // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _pixbuf +} + +// AddAlpha takes an existing pixbuf and adds an alpha channel to it. +// +// If the existing pixbuf already had an alpha channel, the channel values are +// copied from the original; otherwise, the alpha channel is initialized to 255 +// (full opacity). +// +// If substitute_color is TRUE, then the color specified by the (r, g, b) +// arguments will be assigned zero opacity. That is, if you pass (255, 255, 255) +// for the substitute color, all white pixels will become fully transparent. +// +// If substitute_color is FALSE, then the (r, g, b) arguments will be ignored. +// +// The function takes the following parameters: +// +// - substituteColor: whether to set a color to zero opacity. +// - r: red value to substitute. +// - g: green value to substitute. +// - b: blue value to substitute. +// +// The function returns the following values: +// +// - ret (optional): newly-created pixbuf. +func (pixbuf *Pixbuf) AddAlpha(substituteColor bool, r, g, b byte) *Pixbuf { + var _arg0 *C.GdkPixbuf // out + var _arg1 C.gboolean // out + var _arg2 C.guchar // out + var _arg3 C.guchar // out + var _arg4 C.guchar // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + if substituteColor { + _arg1 = C.TRUE + } + _arg2 = C.guchar(r) + _arg3 = C.guchar(g) + _arg4 = C.guchar(b) + + _cret = C.gdk_pixbuf_add_alpha(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(substituteColor) + runtime.KeepAlive(r) + runtime.KeepAlive(g) + runtime.KeepAlive(b) + + var _ret *Pixbuf // out + + if _cret != nil { + _ret = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _ret +} + +// ApplyEmbeddedOrientation takes an existing pixbuf and checks for the presence +// of an associated "orientation" option. +// +// The orientation option may be provided by the JPEG loader (which reads the +// exif orientation tag) or the TIFF loader (which reads the TIFF orientation +// tag, and compensates it for the partial transforms performed by libtiff). +// +// If an orientation option/tag is present, the appropriate transform will be +// performed so that the pixbuf is oriented correctly. +// +// The function returns the following values: +// +// - pixbuf (optional): newly-created pixbuf. +func (src *Pixbuf) ApplyEmbeddedOrientation() *Pixbuf { + var _arg0 *C.GdkPixbuf // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(src).Native())) + + _cret = C.gdk_pixbuf_apply_embedded_orientation(_arg0) + runtime.KeepAlive(src) + + var _pixbuf *Pixbuf // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _pixbuf +} + +// Composite creates a transformation of the source image src by scaling by +// scale_x and scale_y then translating by offset_x and offset_y. +// +// This gives an image in the coordinates of the destination pixbuf. +// The rectangle (dest_x, dest_y, dest_width, dest_height) is then alpha blended +// onto the corresponding rectangle of the original destination image. +// +// When the destination rectangle contains parts not in the source image, +// the data at the edges of the source image is replicated to infinity. +// +// ! (composite.png). +// +// The function takes the following parameters: +// +// - dest into which to render the results. +// - destX: left coordinate for region to render. +// - destY: top coordinate for region to render. +// - destWidth: width of the region to render. +// - destHeight: height of the region to render. +// - offsetX: offset in the X direction (currently rounded to an integer). +// - offsetY: offset in the Y direction (currently rounded to an integer). +// - scaleX: scale factor in the X direction. +// - scaleY: scale factor in the Y direction. +// - interpType: interpolation type for the transformation. +// - overallAlpha: overall alpha for source image (0..255). +func (src *Pixbuf) Composite(dest *Pixbuf, destX, destY, destWidth, destHeight int, offsetX, offsetY, scaleX, scaleY float64, interpType InterpType, overallAlpha int) { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.GdkPixbuf // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.int // out + var _arg5 C.int // out + var _arg6 C.double // out + var _arg7 C.double // out + var _arg8 C.double // out + var _arg9 C.double // out + var _arg10 C.GdkInterpType // out + var _arg11 C.int // out + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(dest).Native())) + _arg2 = C.int(destX) + _arg3 = C.int(destY) + _arg4 = C.int(destWidth) + _arg5 = C.int(destHeight) + _arg6 = C.double(offsetX) + _arg7 = C.double(offsetY) + _arg8 = C.double(scaleX) + _arg9 = C.double(scaleY) + _arg10 = C.GdkInterpType(interpType) + _arg11 = C.int(overallAlpha) + + C.gdk_pixbuf_composite(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11) + runtime.KeepAlive(src) + runtime.KeepAlive(dest) + runtime.KeepAlive(destX) + runtime.KeepAlive(destY) + runtime.KeepAlive(destWidth) + runtime.KeepAlive(destHeight) + runtime.KeepAlive(offsetX) + runtime.KeepAlive(offsetY) + runtime.KeepAlive(scaleX) + runtime.KeepAlive(scaleY) + runtime.KeepAlive(interpType) + runtime.KeepAlive(overallAlpha) +} + +// CompositeColor creates a transformation of the source image src by scaling +// by scale_x and scale_y then translating by offset_x and offset_y, then +// alpha blends the rectangle (dest_x ,dest_y, dest_width, dest_height) of the +// resulting image with a checkboard of the colors color1 and color2 and renders +// it onto the destination image. +// +// If the source image has no alpha channel, and overall_alpha is 255, a fast +// path is used which omits the alpha blending and just performs the scaling. +// +// See gdk_pixbuf_composite_color_simple() for a simpler variant of this +// function suitable for many tasks. +// +// The function takes the following parameters: +// +// - dest into which to render the results. +// - destX: left coordinate for region to render. +// - destY: top coordinate for region to render. +// - destWidth: width of the region to render. +// - destHeight: height of the region to render. +// - offsetX: offset in the X direction (currently rounded to an integer). +// - offsetY: offset in the Y direction (currently rounded to an integer). +// - scaleX: scale factor in the X direction. +// - scaleY: scale factor in the Y direction. +// - interpType: interpolation type for the transformation. +// - overallAlpha: overall alpha for source image (0..255). +// - checkX: x offset for the checkboard (origin of checkboard is at -check_x, +// -check_y). +// - checkY: y offset for the checkboard. +// - checkSize: size of checks in the checkboard (must be a power of two). +// - color1: color of check at upper left. +// - color2: color of the other check. +func (src *Pixbuf) CompositeColor(dest *Pixbuf, destX, destY, destWidth, destHeight int, offsetX, offsetY, scaleX, scaleY float64, interpType InterpType, overallAlpha, checkX, checkY, checkSize int, color1, color2 uint32) { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.GdkPixbuf // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.int // out + var _arg5 C.int // out + var _arg6 C.double // out + var _arg7 C.double // out + var _arg8 C.double // out + var _arg9 C.double // out + var _arg10 C.GdkInterpType // out + var _arg11 C.int // out + var _arg12 C.int // out + var _arg13 C.int // out + var _arg14 C.int // out + var _arg15 C.guint32 // out + var _arg16 C.guint32 // out + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(dest).Native())) + _arg2 = C.int(destX) + _arg3 = C.int(destY) + _arg4 = C.int(destWidth) + _arg5 = C.int(destHeight) + _arg6 = C.double(offsetX) + _arg7 = C.double(offsetY) + _arg8 = C.double(scaleX) + _arg9 = C.double(scaleY) + _arg10 = C.GdkInterpType(interpType) + _arg11 = C.int(overallAlpha) + _arg12 = C.int(checkX) + _arg13 = C.int(checkY) + _arg14 = C.int(checkSize) + _arg15 = C.guint32(color1) + _arg16 = C.guint32(color2) + + C.gdk_pixbuf_composite_color(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _arg16) + runtime.KeepAlive(src) + runtime.KeepAlive(dest) + runtime.KeepAlive(destX) + runtime.KeepAlive(destY) + runtime.KeepAlive(destWidth) + runtime.KeepAlive(destHeight) + runtime.KeepAlive(offsetX) + runtime.KeepAlive(offsetY) + runtime.KeepAlive(scaleX) + runtime.KeepAlive(scaleY) + runtime.KeepAlive(interpType) + runtime.KeepAlive(overallAlpha) + runtime.KeepAlive(checkX) + runtime.KeepAlive(checkY) + runtime.KeepAlive(checkSize) + runtime.KeepAlive(color1) + runtime.KeepAlive(color2) +} + +// CompositeColorSimple creates a new pixbuf by scaling src to dest_width x +// dest_height and alpha blending the result with a checkboard of colors color1 +// and color2. +// +// The function takes the following parameters: +// +// - destWidth: width of destination image. +// - destHeight: height of destination image. +// - interpType: interpolation type for the transformation. +// - overallAlpha: overall alpha for source image (0..255). +// - checkSize: size of checks in the checkboard (must be a power of two). +// - color1: color of check at upper left. +// - color2: color of the other check. +// +// The function returns the following values: +// +// - pixbuf (optional): new pixbuf. +func (src *Pixbuf) CompositeColorSimple(destWidth, destHeight int, interpType InterpType, overallAlpha, checkSize int, color1, color2 uint32) *Pixbuf { + var _arg0 *C.GdkPixbuf // out + var _arg1 C.int // out + var _arg2 C.int // out + var _arg3 C.GdkInterpType // out + var _arg4 C.int // out + var _arg5 C.int // out + var _arg6 C.guint32 // out + var _arg7 C.guint32 // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = C.int(destWidth) + _arg2 = C.int(destHeight) + _arg3 = C.GdkInterpType(interpType) + _arg4 = C.int(overallAlpha) + _arg5 = C.int(checkSize) + _arg6 = C.guint32(color1) + _arg7 = C.guint32(color2) + + _cret = C.gdk_pixbuf_composite_color_simple(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(src) + runtime.KeepAlive(destWidth) + runtime.KeepAlive(destHeight) + runtime.KeepAlive(interpType) + runtime.KeepAlive(overallAlpha) + runtime.KeepAlive(checkSize) + runtime.KeepAlive(color1) + runtime.KeepAlive(color2) + + var _pixbuf *Pixbuf // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _pixbuf +} + +// Copy creates a new GdkPixbuf with a copy of the information in the specified +// pixbuf. +// +// Note that this does not copy the options set on the original GdkPixbuf, +// use gdk_pixbuf_copy_options() for this. +// +// The function returns the following values: +// +// - ret (optional): newly-created pixbuf. +func (pixbuf *Pixbuf) Copy() *Pixbuf { + var _arg0 *C.GdkPixbuf // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_copy(_arg0) + runtime.KeepAlive(pixbuf) + + var _ret *Pixbuf // out + + if _cret != nil { + _ret = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _ret +} + +// CopyArea copies a rectangular area from src_pixbuf to dest_pixbuf. +// +// Conversion of pixbuf formats is done automatically. +// +// If the source rectangle overlaps the destination rectangle on the same +// pixbuf, it will be overwritten during the copy operation. Therefore, you can +// not use this function to scroll a pixbuf. +// +// The function takes the following parameters: +// +// - srcX: source X coordinate within src_pixbuf. +// - srcY: source Y coordinate within src_pixbuf. +// - width: width of the area to copy. +// - height: height of the area to copy. +// - destPixbuf: destination pixbuf. +// - destX: x coordinate within dest_pixbuf. +// - destY: y coordinate within dest_pixbuf. +func (srcPixbuf *Pixbuf) CopyArea(srcX, srcY, width, height int, destPixbuf *Pixbuf, destX, destY int) { + var _arg0 *C.GdkPixbuf // out + var _arg1 C.int // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.int // out + var _arg5 *C.GdkPixbuf // out + var _arg6 C.int // out + var _arg7 C.int // out + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(srcPixbuf).Native())) + _arg1 = C.int(srcX) + _arg2 = C.int(srcY) + _arg3 = C.int(width) + _arg4 = C.int(height) + _arg5 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(destPixbuf).Native())) + _arg6 = C.int(destX) + _arg7 = C.int(destY) + + C.gdk_pixbuf_copy_area(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(srcPixbuf) + runtime.KeepAlive(srcX) + runtime.KeepAlive(srcY) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(destPixbuf) + runtime.KeepAlive(destX) + runtime.KeepAlive(destY) +} + +// CopyOptions copies the key/value pair options attached to a GdkPixbuf to +// another GdkPixbuf. +// +// This is useful to keep original metadata after having manipulated a file. +// However be careful to remove metadata which you've already applied, such as +// the "orientation" option after rotating the image. +// +// The function takes the following parameters: +// +// - destPixbuf: destination pixbuf. +// +// The function returns the following values: +// +// - ok: TRUE on success. +func (srcPixbuf *Pixbuf) CopyOptions(destPixbuf *Pixbuf) bool { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.GdkPixbuf // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(srcPixbuf).Native())) + _arg1 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(destPixbuf).Native())) + + _cret = C.gdk_pixbuf_copy_options(_arg0, _arg1) + runtime.KeepAlive(srcPixbuf) + runtime.KeepAlive(destPixbuf) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Fill clears a pixbuf to the given RGBA value, converting the RGBA value into +// the pixbuf's pixel format. +// +// The alpha component will be ignored if the pixbuf doesn't have an alpha +// channel. +// +// The function takes the following parameters: +// +// - pixel: RGBA pixel to used to clear (0xffffffff is opaque white, +// 0x00000000 transparent black). +func (pixbuf *Pixbuf) Fill(pixel uint32) { + var _arg0 *C.GdkPixbuf // out + var _arg1 C.guint32 // out + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + _arg1 = C.guint32(pixel) + + C.gdk_pixbuf_fill(_arg0, _arg1) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(pixel) +} + +// Flip flips a pixbuf horizontally or vertically and returns the result in a +// new pixbuf. +// +// The function takes the following parameters: +// +// - horizontal: TRUE to flip horizontally, FALSE to flip vertically. +// +// The function returns the following values: +// +// - pixbuf (optional): new pixbuf. +func (src *Pixbuf) Flip(horizontal bool) *Pixbuf { + var _arg0 *C.GdkPixbuf // out + var _arg1 C.gboolean // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(src).Native())) + if horizontal { + _arg1 = C.TRUE + } + + _cret = C.gdk_pixbuf_flip(_arg0, _arg1) + runtime.KeepAlive(src) + runtime.KeepAlive(horizontal) + + var _pixbuf *Pixbuf // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _pixbuf +} + +// BitsPerSample queries the number of bits per color sample in a pixbuf. +// +// The function returns the following values: +// +// - gint: number of bits per color sample. +func (pixbuf *Pixbuf) BitsPerSample() int { + var _arg0 *C.GdkPixbuf // out + var _cret C.int // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_bits_per_sample(_arg0) + runtime.KeepAlive(pixbuf) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// ByteLength returns the length of the pixel data, in bytes. +// +// The function returns the following values: +// +// - gsize: length of the pixel data. +func (pixbuf *Pixbuf) ByteLength() uint { + var _arg0 *C.GdkPixbuf // out + var _cret C.gsize // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_byte_length(_arg0) + runtime.KeepAlive(pixbuf) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Colorspace queries the color space of a pixbuf. +// +// The function returns the following values: +// +// - colorspace: color space. +func (pixbuf *Pixbuf) Colorspace() Colorspace { + var _arg0 *C.GdkPixbuf // out + var _cret C.GdkColorspace // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_colorspace(_arg0) + runtime.KeepAlive(pixbuf) + + var _colorspace Colorspace // out + + _colorspace = Colorspace(_cret) + + return _colorspace +} + +// HasAlpha queries whether a pixbuf has an alpha channel (opacity information). +// +// The function returns the following values: +// +// - ok: TRUE if it has an alpha channel, FALSE otherwise. +func (pixbuf *Pixbuf) HasAlpha() bool { + var _arg0 *C.GdkPixbuf // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_has_alpha(_arg0) + runtime.KeepAlive(pixbuf) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Height queries the height of a pixbuf. +// +// The function returns the following values: +// +// - gint: height in pixels. +func (pixbuf *Pixbuf) Height() int { + var _arg0 *C.GdkPixbuf // out + var _cret C.int // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_height(_arg0) + runtime.KeepAlive(pixbuf) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// NChannels queries the number of channels of a pixbuf. +// +// The function returns the following values: +// +// - gint: number of channels. +func (pixbuf *Pixbuf) NChannels() int { + var _arg0 *C.GdkPixbuf // out + var _cret C.int // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_n_channels(_arg0) + runtime.KeepAlive(pixbuf) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Option looks up key in the list of options that may have been attached to the +// pixbuf when it was loaded, or that may have been attached by another function +// using gdk_pixbuf_set_option(). +// +// For instance, the ANI loader provides "Title" and "Artist" options. The ICO, +// XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot options for cursor +// definitions. The PNG loader provides the tEXt ancillary chunk key/value pairs +// as options. Since 2.12, the TIFF and JPEG loaders return an "orientation" +// option string that corresponds to the embedded TIFF/Exif orientation tag (if +// present). Since 2.32, the TIFF loader sets the "multipage" option string to +// "yes" when a multi-page TIFF is loaded. Since 2.32 the JPEG and PNG loaders +// set "x-dpi" and "y-dpi" if the file contains image density information in +// dots per inch. Since 2.36.6, the JPEG loader sets the "comment" option with +// the comment EXIF tag. +// +// The function takes the following parameters: +// +// - key: nul-terminated string. +// +// The function returns the following values: +// +// - utf8 (optional): value associated with key. +func (pixbuf *Pixbuf) Option(key string) string { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_get_option(_arg0, _arg1) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(key) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Options returns a GHashTable with a list of all the options that may have +// been attached to the pixbuf when it was loaded, or that may have been +// attached by another function using gdkpixbuf.Pixbuf.SetOption(). +// +// The function returns the following values: +// +// - hashTable: Table of key/values pairs. +func (pixbuf *Pixbuf) Options() map[string]string { + var _arg0 *C.GdkPixbuf // out + var _cret *C.GHashTable // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_options(_arg0) + runtime.KeepAlive(pixbuf) + + var _hashTable map[string]string // out + + _hashTable = make(map[string]string, gextras.HashTableSize(unsafe.Pointer(_cret))) + gextras.MoveHashTable(unsafe.Pointer(_cret), true, func(k, v unsafe.Pointer) { + ksrc := *(**C.gchar)(k) + vsrc := *(**C.gchar)(v) + var kdst string // out + var vdst string // out + kdst = C.GoString((*C.gchar)(unsafe.Pointer(ksrc))) + vdst = C.GoString((*C.gchar)(unsafe.Pointer(vsrc))) + _hashTable[kdst] = vdst + }) + + return _hashTable +} + +// Pixels queries a pointer to the pixel data of a pixbuf. +// +// This function will cause an implicit copy of the pixbuf data if the pixbuf +// was created from read-only data. +// +// Please see the section on image data (class.Pixbuf.html#image-data) for +// information about how the pixel data is stored in memory. +// +// The function returns the following values: +// +// - guint8s: pointer to the pixbuf's pixel data. +func (pixbuf *Pixbuf) Pixels() []byte { + var _arg0 *C.GdkPixbuf // out + var _cret *C.guchar // in + var _arg1 C.guint // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_pixels_with_length(_arg0, &_arg1) + runtime.KeepAlive(pixbuf) + + var _guint8s []byte // out + + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) + + return _guint8s +} + +// Rowstride queries the rowstride of a pixbuf, which is the number of bytes +// between the start of a row and the start of the next row. +// +// The function returns the following values: +// +// - gint: distance between row starts. +func (pixbuf *Pixbuf) Rowstride() int { + var _arg0 *C.GdkPixbuf // out + var _cret C.int // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_rowstride(_arg0) + runtime.KeepAlive(pixbuf) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Width queries the width of a pixbuf. +// +// The function returns the following values: +// +// - gint: width in pixels. +func (pixbuf *Pixbuf) Width() int { + var _arg0 *C.GdkPixbuf // out + var _cret C.int // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_get_width(_arg0) + runtime.KeepAlive(pixbuf) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// NewSubpixbuf creates a new pixbuf which represents a sub-region of +// src_pixbuf. +// +// The new pixbuf shares its pixels with the original pixbuf, so writing to one +// affects both. The new pixbuf holds a reference to src_pixbuf, so src_pixbuf +// will not be finalized until the new pixbuf is finalized. +// +// Note that if src_pixbuf is read-only, this function will force it to be +// mutable. +// +// The function takes the following parameters: +// +// - srcX: x coord in src_pixbuf. +// - srcY: y coord in src_pixbuf. +// - width of region in src_pixbuf. +// - height of region in src_pixbuf. +// +// The function returns the following values: +// +// - pixbuf: new pixbuf. +func (srcPixbuf *Pixbuf) NewSubpixbuf(srcX, srcY, width, height int) *Pixbuf { + var _arg0 *C.GdkPixbuf // out + var _arg1 C.int // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.int // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(srcPixbuf).Native())) + _arg1 = C.int(srcX) + _arg2 = C.int(srcY) + _arg3 = C.int(width) + _arg4 = C.int(height) + + _cret = C.gdk_pixbuf_new_subpixbuf(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(srcPixbuf) + runtime.KeepAlive(srcX) + runtime.KeepAlive(srcY) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + + var _pixbuf *Pixbuf // out + + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _pixbuf +} + +// ReadPixelBytes provides a #GBytes buffer containing the raw pixel data; +// the data must not be modified. +// +// This function allows skipping the implicit copy that must be made if +// gdk_pixbuf_get_pixels() is called on a read-only pixbuf. +// +// The function returns the following values: +// +// - bytes: new reference to a read-only copy of the pixel data. Note that for +// mutable pixbufs, this function will incur a one-time copy of the pixel +// data for conversion into the returned #GBytes. +func (pixbuf *Pixbuf) ReadPixelBytes() *glib.Bytes { + var _arg0 *C.GdkPixbuf // out + var _cret *C.GBytes // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_read_pixel_bytes(_arg0) + runtime.KeepAlive(pixbuf) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// ReadPixels provides a read-only pointer to the raw pixel data. +// +// This function allows skipping the implicit copy that must be made if +// gdk_pixbuf_get_pixels() is called on a read-only pixbuf. +// +// The function returns the following values: +// +// - guint8: read-only pointer to the raw pixel data. +func (pixbuf *Pixbuf) ReadPixels() *byte { + var _arg0 *C.GdkPixbuf // out + var _cret *C.guint8 // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + _cret = C.gdk_pixbuf_read_pixels(_arg0) + runtime.KeepAlive(pixbuf) + + var _guint8 *byte // out + + _guint8 = (*byte)(unsafe.Pointer(_cret)) + + return _guint8 +} + +// RemoveOption removes the key/value pair option attached to a GdkPixbuf. +// +// The function takes the following parameters: +// +// - key: nul-terminated string representing the key to remove. +// +// The function returns the following values: +// +// - ok: TRUE if an option was removed, FALSE if not. +func (pixbuf *Pixbuf) RemoveOption(key string) bool { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_remove_option(_arg0, _arg1) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RotateSimple rotates a pixbuf by a multiple of 90 degrees, and returns the +// result in a new pixbuf. +// +// If angle is 0, this function will return a copy of src. +// +// The function takes the following parameters: +// +// - angle to rotate by. +// +// The function returns the following values: +// +// - pixbuf (optional): new pixbuf. +func (src *Pixbuf) RotateSimple(angle PixbufRotation) *Pixbuf { + var _arg0 *C.GdkPixbuf // out + var _arg1 C.GdkPixbufRotation // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = C.GdkPixbufRotation(angle) + + _cret = C.gdk_pixbuf_rotate_simple(_arg0, _arg1) + runtime.KeepAlive(src) + runtime.KeepAlive(angle) + + var _pixbuf *Pixbuf // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _pixbuf +} + +// SaturateAndPixelate modifies saturation and optionally pixelates src, placing +// the result in dest. +// +// The src and dest pixbufs must have the same image format, size, and +// rowstride. +// +// The src and dest arguments may be the same pixbuf with no ill effects. +// +// If saturation is 1.0 then saturation is not changed. If it's less than 1.0, +// saturation is reduced (the image turns toward grayscale); if greater than +// 1.0, saturation is increased (the image gets more vivid colors). +// +// If pixelate is TRUE, then pixels are faded in a checkerboard pattern to +// create a pixelated image. +// +// The function takes the following parameters: +// +// - dest: place to write modified version of src. +// - saturation factor. +// - pixelate: whether to pixelate. +func (src *Pixbuf) SaturateAndPixelate(dest *Pixbuf, saturation float32, pixelate bool) { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.GdkPixbuf // out + var _arg2 C.gfloat // out + var _arg3 C.gboolean // out + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(dest).Native())) + _arg2 = C.gfloat(saturation) + if pixelate { + _arg3 = C.TRUE + } + + C.gdk_pixbuf_saturate_and_pixelate(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(src) + runtime.KeepAlive(dest) + runtime.KeepAlive(saturation) + runtime.KeepAlive(pixelate) +} + +// SaveToBufferv: vector version of gdk_pixbuf_save_to_buffer(). +// +// Saves pixbuf to a new buffer in format type, which is currently "jpeg", +// "tiff", "png", "ico" or "bmp". +// +// See gdkpixbuf.Pixbuf.SaveToBuffer() for more details. +// +// The function takes the following parameters: +// +// - typ: name of file format. +// - optionKeys (optional): name of options to set. +// - optionValues (optional) values for named options. +// +// The function returns the following values: +// +// - buffer: location to receive a pointer to the new buffer. +func (pixbuf *Pixbuf) SaveToBufferv(typ string, optionKeys, optionValues []string) ([]byte, error) { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.gchar // in + var _arg2 C.gsize // in + var _arg3 *C.char // out + var _arg4 **C.char // out + var _arg5 **C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + _arg3 = (*C.char)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg3)) + { + _arg4 = (**C.char)(C.calloc(C.size_t((len(optionKeys) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice(_arg4, len(optionKeys)+1) + var zero *C.char + out[len(optionKeys)] = zero + for i := range optionKeys { + out[i] = (*C.char)(unsafe.Pointer(C.CString(optionKeys[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + { + _arg5 = (**C.char)(C.calloc(C.size_t((len(optionValues) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg5)) + { + out := unsafe.Slice(_arg5, len(optionValues)+1) + var zero *C.char + out[len(optionValues)] = zero + for i := range optionValues { + out[i] = (*C.char)(unsafe.Pointer(C.CString(optionValues[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gdk_pixbuf_save_to_bufferv(_arg0, &_arg1, &_arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(typ) + runtime.KeepAlive(optionKeys) + runtime.KeepAlive(optionValues) + + var _buffer []byte // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_arg1)) + _buffer = make([]byte, _arg2) + copy(_buffer, unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), _arg2)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _buffer, _goerr +} + +// SaveToCallbackv: vector version of gdk_pixbuf_save_to_callback(). +// +// Saves pixbuf to a callback in format type, which is currently "jpeg", "png", +// "tiff", "ico" or "bmp". +// +// If error is set, FALSE will be returned. +// +// See gdkpixbuf.Pixbuf.SaveToCallback() for more details. +// +// The function takes the following parameters: +// +// - saveFunc: function that is called to save each block of data that the +// save routine generates. +// - typ: name of file format. +// - optionKeys (optional): name of options to set. +// - optionValues (optional) values for named options. +func (pixbuf *Pixbuf) SaveToCallbackv(saveFunc PixbufSaveFunc, typ string, optionKeys, optionValues []string) error { + var _arg0 *C.GdkPixbuf // out + var _arg1 C.GdkPixbufSaveFunc // out + var _arg2 C.gpointer + var _arg3 *C.char // out + var _arg4 **C.char // out + var _arg5 **C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + _arg1 = (*[0]byte)(C._gotk4_gdkpixbuf2_PixbufSaveFunc) + _arg2 = C.gpointer(gbox.Assign(saveFunc)) + defer gbox.Delete(uintptr(_arg2)) + _arg3 = (*C.char)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg3)) + { + _arg4 = (**C.char)(C.calloc(C.size_t((len(optionKeys) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice(_arg4, len(optionKeys)+1) + var zero *C.char + out[len(optionKeys)] = zero + for i := range optionKeys { + out[i] = (*C.char)(unsafe.Pointer(C.CString(optionKeys[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + { + _arg5 = (**C.char)(C.calloc(C.size_t((len(optionValues) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg5)) + { + out := unsafe.Slice(_arg5, len(optionValues)+1) + var zero *C.char + out[len(optionValues)] = zero + for i := range optionValues { + out[i] = (*C.char)(unsafe.Pointer(C.CString(optionValues[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gdk_pixbuf_save_to_callbackv(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(saveFunc) + runtime.KeepAlive(typ) + runtime.KeepAlive(optionKeys) + runtime.KeepAlive(optionValues) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SaveToStreamv saves pixbuf to an output stream. +// +// Supported file formats are currently "jpeg", "tiff", "png", "ico" or "bmp". +// +// See gdkpixbuf.Pixbuf.SaveToStream() for more details. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - stream: GOutputStream to save the pixbuf to. +// - typ: name of file format. +// - optionKeys (optional): name of options to set. +// - optionValues (optional) values for named options. +func (pixbuf *Pixbuf) SaveToStreamv(ctx context.Context, stream gio.OutputStreamer, typ string, optionKeys, optionValues []string) error { + var _arg0 *C.GdkPixbuf // out + var _arg5 *C.GCancellable // out + var _arg1 *C.GOutputStream // out + var _arg2 *C.char // out + var _arg3 **C.char // out + var _arg4 **C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg2)) + { + _arg3 = (**C.char)(C.calloc(C.size_t((len(optionKeys) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice(_arg3, len(optionKeys)+1) + var zero *C.char + out[len(optionKeys)] = zero + for i := range optionKeys { + out[i] = (*C.char)(unsafe.Pointer(C.CString(optionKeys[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + { + _arg4 = (**C.char)(C.calloc(C.size_t((len(optionValues) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice(_arg4, len(optionValues)+1) + var zero *C.char + out[len(optionValues)] = zero + for i := range optionValues { + out[i] = (*C.char)(unsafe.Pointer(C.CString(optionValues[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gdk_pixbuf_save_to_streamv(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(typ) + runtime.KeepAlive(optionKeys) + runtime.KeepAlive(optionValues) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SaveToStreamvAsync saves pixbuf to an output stream asynchronously. +// +// For more details see gdk_pixbuf_save_to_streamv(), which is the synchronous +// version of this function. +// +// When the operation is finished, callback will be called in the main thread. +// +// You can then call gdk_pixbuf_save_to_stream_finish() to get the result of the +// operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - stream: GOutputStream to which to save the pixbuf. +// - typ: name of file format. +// - optionKeys (optional): name of options to set. +// - optionValues (optional) values for named options. +// - callback (optional): GAsyncReadyCallback to call when the pixbuf is +// saved. +func (pixbuf *Pixbuf) SaveToStreamvAsync(ctx context.Context, stream gio.OutputStreamer, typ string, optionKeys, optionValues []string, callback gio.AsyncReadyCallback) { + var _arg0 *C.GdkPixbuf // out + var _arg5 *C.GCancellable // out + var _arg1 *C.GOutputStream // out + var _arg2 *C.gchar // out + var _arg3 **C.gchar // out + var _arg4 **C.gchar // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg2)) + { + _arg3 = (**C.gchar)(C.calloc(C.size_t((len(optionKeys) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice(_arg3, len(optionKeys)+1) + var zero *C.gchar + out[len(optionKeys)] = zero + for i := range optionKeys { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(optionKeys[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + { + _arg4 = (**C.gchar)(C.calloc(C.size_t((len(optionValues) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice(_arg4, len(optionValues)+1) + var zero *C.gchar + out[len(optionValues)] = zero + for i := range optionValues { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(optionValues[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_pixbuf_save_to_streamv_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(typ) + runtime.KeepAlive(optionKeys) + runtime.KeepAlive(optionValues) + runtime.KeepAlive(callback) +} + +// Savev: vector version of gdk_pixbuf_save(). +// +// Saves pixbuf to a file in type, which is currently "jpeg", "png", "tiff", +// "ico" or "bmp". +// +// If error is set, FALSE will be returned. +// +// See gdkpixbuf.Pixbuf.Save() for more details. +// +// The function takes the following parameters: +// +// - filename: name of file to save. +// - typ: name of file format. +// - optionKeys (optional): name of options to set. +// - optionValues (optional) values for named options. +func (pixbuf *Pixbuf) Savev(filename, typ string, optionKeys, optionValues []string) error { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 **C.char // out + var _arg4 **C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg2)) + { + _arg3 = (**C.char)(C.calloc(C.size_t((len(optionKeys) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice(_arg3, len(optionKeys)+1) + var zero *C.char + out[len(optionKeys)] = zero + for i := range optionKeys { + out[i] = (*C.char)(unsafe.Pointer(C.CString(optionKeys[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + { + _arg4 = (**C.char)(C.calloc(C.size_t((len(optionValues) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice(_arg4, len(optionValues)+1) + var zero *C.char + out[len(optionValues)] = zero + for i := range optionValues { + out[i] = (*C.char)(unsafe.Pointer(C.CString(optionValues[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gdk_pixbuf_savev(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(filename) + runtime.KeepAlive(typ) + runtime.KeepAlive(optionKeys) + runtime.KeepAlive(optionValues) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Scale creates a transformation of the source image src by scaling by scale_x +// and scale_y then translating by offset_x and offset_y, then renders the +// rectangle (dest_x, dest_y, dest_width, dest_height) of the resulting image +// onto the destination image replacing the previous contents. +// +// Try to use gdk_pixbuf_scale_simple() first; this function is +// the industrial-strength power tool you can fall back to, if +// gdk_pixbuf_scale_simple() isn't powerful enough. +// +// If the source rectangle overlaps the destination rectangle on the same +// pixbuf, it will be overwritten during the scaling which results in rendering +// artifacts. +// +// The function takes the following parameters: +// +// - dest into which to render the results. +// - destX: left coordinate for region to render. +// - destY: top coordinate for region to render. +// - destWidth: width of the region to render. +// - destHeight: height of the region to render. +// - offsetX: offset in the X direction (currently rounded to an integer). +// - offsetY: offset in the Y direction (currently rounded to an integer). +// - scaleX: scale factor in the X direction. +// - scaleY: scale factor in the Y direction. +// - interpType: interpolation type for the transformation. +func (src *Pixbuf) Scale(dest *Pixbuf, destX, destY, destWidth, destHeight int, offsetX, offsetY, scaleX, scaleY float64, interpType InterpType) { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.GdkPixbuf // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.int // out + var _arg5 C.int // out + var _arg6 C.double // out + var _arg7 C.double // out + var _arg8 C.double // out + var _arg9 C.double // out + var _arg10 C.GdkInterpType // out + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(dest).Native())) + _arg2 = C.int(destX) + _arg3 = C.int(destY) + _arg4 = C.int(destWidth) + _arg5 = C.int(destHeight) + _arg6 = C.double(offsetX) + _arg7 = C.double(offsetY) + _arg8 = C.double(scaleX) + _arg9 = C.double(scaleY) + _arg10 = C.GdkInterpType(interpType) + + C.gdk_pixbuf_scale(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10) + runtime.KeepAlive(src) + runtime.KeepAlive(dest) + runtime.KeepAlive(destX) + runtime.KeepAlive(destY) + runtime.KeepAlive(destWidth) + runtime.KeepAlive(destHeight) + runtime.KeepAlive(offsetX) + runtime.KeepAlive(offsetY) + runtime.KeepAlive(scaleX) + runtime.KeepAlive(scaleY) + runtime.KeepAlive(interpType) +} + +// ScaleSimple: create a new pixbuf containing a copy of src scaled to +// dest_width x dest_height. +// +// This function leaves src unaffected. +// +// The interp_type should be GDK_INTERP_NEAREST if you want maximum speed (but +// when scaling down GDK_INTERP_NEAREST is usually unusably ugly). The default +// interp_type should be GDK_INTERP_BILINEAR which offers reasonable quality and +// speed. +// +// You can scale a sub-portion of src by creating a sub-pixbuf pointing into +// src; see gdkpixbuf.Pixbuf.NewSubpixbuf(). +// +// If dest_width and dest_height are equal to the width and height of src, +// this function will return an unscaled copy of src. +// +// For more complicated scaling/alpha blending see gdkpixbuf.Pixbuf.Scale() and +// gdkpixbuf.Pixbuf.Composite(). +// +// The function takes the following parameters: +// +// - destWidth: width of destination image. +// - destHeight: height of destination image. +// - interpType: interpolation type for the transformation. +// +// The function returns the following values: +// +// - pixbuf (optional): new pixbuf. +func (src *Pixbuf) ScaleSimple(destWidth, destHeight int, interpType InterpType) *Pixbuf { + var _arg0 *C.GdkPixbuf // out + var _arg1 C.int // out + var _arg2 C.int // out + var _arg3 C.GdkInterpType // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = C.int(destWidth) + _arg2 = C.int(destHeight) + _arg3 = C.GdkInterpType(interpType) + + _cret = C.gdk_pixbuf_scale_simple(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(src) + runtime.KeepAlive(destWidth) + runtime.KeepAlive(destHeight) + runtime.KeepAlive(interpType) + + var _pixbuf *Pixbuf // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _pixbuf +} + +// SetOption attaches a key/value pair as an option to a GdkPixbuf. +// +// If key already exists in the list of options attached to the pixbuf, the new +// value is ignored and FALSE is returned. +// +// The function takes the following parameters: +// +// - key: nul-terminated string. +// - value: nul-terminated string. +// +// The function returns the following values: +// +// - ok: TRUE on success. +func (pixbuf *Pixbuf) SetOption(key, value string) bool { + var _arg0 *C.GdkPixbuf // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.gdk_pixbuf_set_option(_arg0, _arg1, _arg2) + runtime.KeepAlive(pixbuf) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PixbufCalculateRowstride calculates the rowstride that an image created with +// those values would have. +// +// This function is useful for front-ends and backends that want to check image +// values without needing to create a GdkPixbuf. +// +// The function takes the following parameters: +// +// - colorspace: color space for image. +// - hasAlpha: whether the image should have transparency information. +// - bitsPerSample: number of bits per color sample. +// - width: width of image in pixels, must be > 0. +// - height: height of image in pixels, must be > 0. +// +// The function returns the following values: +// +// - gint: rowstride for the given values, or -1 in case of error. +func PixbufCalculateRowstride(colorspace Colorspace, hasAlpha bool, bitsPerSample, width, height int) int { + var _arg1 C.GdkColorspace // out + var _arg2 C.gboolean // out + var _arg3 C.int // out + var _arg4 C.int // out + var _arg5 C.int // out + var _cret C.gint // in + + _arg1 = C.GdkColorspace(colorspace) + if hasAlpha { + _arg2 = C.TRUE + } + _arg3 = C.int(bitsPerSample) + _arg4 = C.int(width) + _arg5 = C.int(height) + + _cret = C.gdk_pixbuf_calculate_rowstride(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(colorspace) + runtime.KeepAlive(hasAlpha) + runtime.KeepAlive(bitsPerSample) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// PixbufGetFileInfo parses an image file far enough to determine its format and +// size. +// +// The function takes the following parameters: +// +// - filename: name of the file to identify. +// +// The function returns the following values: +// +// - width (optional): return location for the width of the image. +// - height (optional): return location for the height of the image. +// - pixbufFormat (optional): GdkPixbufFormat describing the image format of +// the file. +func PixbufGetFileInfo(filename string) (width, height int, pixbufFormat *PixbufFormat) { + var _arg1 *C.gchar // out + var _arg2 C.gint // in + var _arg3 C.gint // in + var _cret *C.GdkPixbufFormat // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_get_file_info(_arg1, &_arg2, &_arg3) + runtime.KeepAlive(filename) + + var _width int // out + var _height int // out + var _pixbufFormat *PixbufFormat // out + + _width = int(_arg2) + _height = int(_arg3) + if _cret != nil { + _pixbufFormat = (*PixbufFormat)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _width, _height, _pixbufFormat +} + +// PixbufGetFileInfoAsync: asynchronously parses an image file far enough to +// determine its format and size. +// +// For more details see gdk_pixbuf_get_file_info(), which is the synchronous +// version of this function. +// +// When the operation is finished, callback will be called in the main thread. +// You can then call gdk_pixbuf_get_file_info_finish() to get the result of the +// operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - filename: name of the file to identify. +// - callback (optional): GAsyncReadyCallback to call when the file info is +// available. +func PixbufGetFileInfoAsync(ctx context.Context, filename string, callback gio.AsyncReadyCallback) { + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_pixbuf_get_file_info_async(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(ctx) + runtime.KeepAlive(filename) + runtime.KeepAlive(callback) +} + +// PixbufGetFileInfoFinish finishes an asynchronous pixbuf parsing operation +// started with gdk_pixbuf_get_file_info_async(). +// +// The function takes the following parameters: +// +// - asyncResult: GAsyncResult. +// +// The function returns the following values: +// +// - width: return location for the width of the image, or NULL. +// - height: return location for the height of the image, or NULL. +// - pixbufFormat (optional): GdkPixbufFormat describing the image format of +// the file. +func PixbufGetFileInfoFinish(asyncResult gio.AsyncResulter) (width, height int, pixbufFormat *PixbufFormat, goerr error) { + var _arg1 *C.GAsyncResult // out + var _arg2 C.gint // in + var _arg3 C.gint // in + var _cret *C.GdkPixbufFormat // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(asyncResult).Native())) + + _cret = C.gdk_pixbuf_get_file_info_finish(_arg1, &_arg2, &_arg3, &_cerr) + runtime.KeepAlive(asyncResult) + + var _width int // out + var _height int // out + var _pixbufFormat *PixbufFormat // out + var _goerr error // out + + _width = int(_arg2) + _height = int(_arg3) + if _cret != nil { + _pixbufFormat = (*PixbufFormat)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _width, _height, _pixbufFormat, _goerr +} + +// PixbufGetFormats obtains the available information about the image formats +// supported by GdkPixbuf. +// +// The function returns the following values: +// +// - sList: list of support image formats. +func PixbufGetFormats() []*PixbufFormat { + var _cret *C.GSList // in + + _cret = C.gdk_pixbuf_get_formats() + + var _sList []*PixbufFormat // out + + _sList = make([]*PixbufFormat, 0, gextras.SListSize(unsafe.Pointer(_cret))) + gextras.MoveSList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GdkPixbufFormat)(v) + var dst *PixbufFormat // out + dst = (*PixbufFormat)(gextras.NewStructNative(unsafe.Pointer(src))) + _sList = append(_sList, dst) + }) + + return _sList +} + +// PixbufInitModules initalizes the gdk-pixbuf loader modules referenced by the +// loaders.cache file present inside that directory. +// +// This is to be used by applications that want to ship certain loaders in a +// different location from the system ones. +// +// This is needed when the OS or runtime ships a minimal number of loaders so +// as to reduce the potential attack surface of carefully crafted image files, +// especially for uncommon file types. Applications that require broader image +// file types coverage, such as image viewers, would be expected to ship the +// gdk-pixbuf modules in a separate location, bundled with the application in a +// separate directory from the OS or runtime- provided modules. +// +// The function takes the following parameters: +// +// - path: path to directory where the loaders.cache is installed. +func PixbufInitModules(path string) error { + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gdk_pixbuf_init_modules(_arg1, &_cerr) + runtime.KeepAlive(path) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// NewPixbufFromStreamAsync creates a new pixbuf by asynchronously loading an +// image from an input stream. +// +// For more details see gdk_pixbuf_new_from_stream(), which is the synchronous +// version of this function. +// +// When the operation is finished, callback will be called in the main thread. +// You can then call gdk_pixbuf_new_from_stream_finish() to get the result of +// the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - stream: GInputStream from which to load the pixbuf. +// - callback (optional): GAsyncReadyCallback to call when the pixbuf is +// loaded. +func NewPixbufFromStreamAsync(ctx context.Context, stream gio.InputStreamer, callback gio.AsyncReadyCallback) { + var _arg2 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_pixbuf_new_from_stream_async(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(callback) +} + +// NewPixbufFromStreamAtScaleAsync creates a new pixbuf by asynchronously +// loading an image from an input stream. +// +// For more details see gdk_pixbuf_new_from_stream_at_scale(), which is the +// synchronous version of this function. +// +// When the operation is finished, callback will be called in the main thread. +// You can then call gdk_pixbuf_new_from_stream_finish() to get the result of +// the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object, NULL to ignore. +// - stream: GInputStream from which to load the pixbuf. +// - width the image should have or -1 to not constrain the width. +// - height the image should have or -1 to not constrain the height. +// - preserveAspectRatio: TRUE to preserve the image's aspect ratio. +// - callback (optional): GAsyncReadyCallback to call when the pixbuf is +// loaded. +func NewPixbufFromStreamAtScaleAsync(ctx context.Context, stream gio.InputStreamer, width, height int, preserveAspectRatio bool, callback gio.AsyncReadyCallback) { + var _arg5 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg2 C.gint // out + var _arg3 C.gint // out + var _arg4 C.gboolean // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg2 = C.gint(width) + _arg3 = C.gint(height) + if preserveAspectRatio { + _arg4 = C.TRUE + } + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_pixbuf_new_from_stream_at_scale_async(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(preserveAspectRatio) + runtime.KeepAlive(callback) +} + +// PixbufSaveToStreamFinish finishes an asynchronous pixbuf save operation +// started with gdk_pixbuf_save_to_stream_async(). +// +// The function takes the following parameters: +// +// - asyncResult: GAsyncResult. +func PixbufSaveToStreamFinish(asyncResult gio.AsyncResulter) error { + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(asyncResult).Native())) + + C.gdk_pixbuf_save_to_stream_finish(_arg1, &_cerr) + runtime.KeepAlive(asyncResult) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PixbufAnimation: opaque object representing an animation. +// +// The GdkPixBuf library provides a simple mechanism to load and represent +// animations. An animation is conceptually a series of frames to be displayed +// over time. +// +// The animation may not be represented as a series of frames internally; +// for example, it may be stored as a sprite and instructions for moving the +// sprite around a background. +// +// To display an animation you don't need to understand its representation, +// however; you just ask GdkPixbuf what should be displayed at a given point in +// time. +type PixbufAnimation struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*PixbufAnimation)(nil) +) + +func wrapPixbufAnimation(obj *coreglib.Object) *PixbufAnimation { + return &PixbufAnimation{ + Object: obj, + } +} + +func marshalPixbufAnimation(p uintptr) (interface{}, error) { + return wrapPixbufAnimation(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewPixbufAnimationFromFile creates a new animation by loading it from a file. +// +// The file format is detected automatically. +// +// If the file's format does not support multi-frame images, then an animation +// with a single frame will be created. +// +// Possible errors are in the GDK_PIXBUF_ERROR and G_FILE_ERROR domains. +// +// The function takes the following parameters: +// +// - filename: name of file to load, in the GLib file name encoding. +// +// The function returns the following values: +// +// - pixbufAnimation (optional): newly-created animation. +func NewPixbufAnimationFromFile(filename string) (*PixbufAnimation, error) { + var _arg1 *C.char // out + var _cret *C.GdkPixbufAnimation // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_animation_new_from_file(_arg1, &_cerr) + runtime.KeepAlive(filename) + + var _pixbufAnimation *PixbufAnimation // out + var _goerr error // out + + if _cret != nil { + _pixbufAnimation = wrapPixbufAnimation(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbufAnimation, _goerr +} + +// NewPixbufAnimationFromResource creates a new pixbuf animation by loading an +// image from an resource. +// +// The file format is detected automatically. If NULL is returned, then error +// will be set. +// +// The function takes the following parameters: +// +// - resourcePath: path of the resource file. +// +// The function returns the following values: +// +// - pixbufAnimation (optional): newly-created animation. +func NewPixbufAnimationFromResource(resourcePath string) (*PixbufAnimation, error) { + var _arg1 *C.char // out + var _cret *C.GdkPixbufAnimation // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(resourcePath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_animation_new_from_resource(_arg1, &_cerr) + runtime.KeepAlive(resourcePath) + + var _pixbufAnimation *PixbufAnimation // out + var _goerr error // out + + if _cret != nil { + _pixbufAnimation = wrapPixbufAnimation(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbufAnimation, _goerr +} + +// NewPixbufAnimationFromStream creates a new animation by loading it from an +// input stream. +// +// The file format is detected automatically. +// +// If NULL is returned, then error will be set. +// +// The cancellable can be used to abort the operation from another thread. If +// the operation was cancelled, the error G_IO_ERROR_CANCELLED will be returned. +// Other possible errors are in the GDK_PIXBUF_ERROR and G_IO_ERROR domains. +// +// The stream is not closed. +// +// The function takes the following parameters: +// +// - ctx (optional): optional GCancellable object. +// - stream: GInputStream to load the pixbuf from. +// +// The function returns the following values: +// +// - pixbufAnimation (optional): newly-created animation. +func NewPixbufAnimationFromStream(ctx context.Context, stream gio.InputStreamer) (*PixbufAnimation, error) { + var _arg2 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _cret *C.GdkPixbufAnimation // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.gdk_pixbuf_animation_new_from_stream(_arg1, _arg2, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + + var _pixbufAnimation *PixbufAnimation // out + var _goerr error // out + + if _cret != nil { + _pixbufAnimation = wrapPixbufAnimation(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbufAnimation, _goerr +} + +// NewPixbufAnimationFromStreamFinish finishes an asynchronous +// pixbuf animation creation operation started with +// gdkpixbuf.PixbufAnimation().NewFromStreamAsync. +// +// The function takes the following parameters: +// +// - asyncResult: Result. +// +// The function returns the following values: +// +// - pixbufAnimation (optional): newly created animation. +func NewPixbufAnimationFromStreamFinish(asyncResult gio.AsyncResulter) (*PixbufAnimation, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GdkPixbufAnimation // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(asyncResult).Native())) + + _cret = C.gdk_pixbuf_animation_new_from_stream_finish(_arg1, &_cerr) + runtime.KeepAlive(asyncResult) + + var _pixbufAnimation *PixbufAnimation // out + var _goerr error // out + + if _cret != nil { + _pixbufAnimation = wrapPixbufAnimation(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbufAnimation, _goerr +} + +// Height queries the height of the bounding box of a pixbuf animation. +// +// The function returns the following values: +// +// - gint: height of the bounding box of the animation. +func (animation *PixbufAnimation) Height() int { + var _arg0 *C.GdkPixbufAnimation // out + var _cret C.int // in + + _arg0 = (*C.GdkPixbufAnimation)(unsafe.Pointer(coreglib.InternObject(animation).Native())) + + _cret = C.gdk_pixbuf_animation_get_height(_arg0) + runtime.KeepAlive(animation) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Iter: get an iterator for displaying an animation. +// +// The iterator provides the frames that should be displayed at a given time. +// +// start_time would normally come from g_get_current_time(), +// and marks the beginning of animation playback. After creating an +// iterator, you should immediately display the pixbuf returned by +// gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a timeout +// (with g_timeout_add()) or by some other mechanism ensure that you'll update +// the image after gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each +// time the image is updated, you should reinstall the timeout with the new, +// possibly-changed delay time. +// +// As a shortcut, if start_time is NULL, the result of g_get_current_time() will +// be used automatically. +// +// To update the image (i.e. possibly change the result of +// gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation), +// call gdk_pixbuf_animation_iter_advance(). +// +// If you're using PixbufLoader, in addition to updating the image after the +// delay time, you should also update it whenever you receive the area_updated +// signal and gdk_pixbuf_animation_iter_on_currently_loading_frame() returns +// TRUE. In this case, the frame currently being fed into the loader has +// received new data, so needs to be refreshed. The delay time for a frame may +// also be modified after an area_updated signal, for example if the delay time +// for a frame is encoded in the data after the frame itself. So your timeout +// should be reinstalled after any area_updated signal. +// +// A delay time of -1 is possible, indicating "infinite". +// +// The function takes the following parameters: +// +// - startTime (optional): time when the animation starts playing. +// +// The function returns the following values: +// +// - pixbufAnimationIter: iterator to move over the animation. +func (animation *PixbufAnimation) Iter(startTime *glib.TimeVal) *PixbufAnimationIter { + var _arg0 *C.GdkPixbufAnimation // out + var _arg1 *C.GTimeVal // out + var _cret *C.GdkPixbufAnimationIter // in + + _arg0 = (*C.GdkPixbufAnimation)(unsafe.Pointer(coreglib.InternObject(animation).Native())) + if startTime != nil { + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(startTime))) + } + + _cret = C.gdk_pixbuf_animation_get_iter(_arg0, _arg1) + runtime.KeepAlive(animation) + runtime.KeepAlive(startTime) + + var _pixbufAnimationIter *PixbufAnimationIter // out + + _pixbufAnimationIter = wrapPixbufAnimationIter(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _pixbufAnimationIter +} + +// StaticImage retrieves a static image for the animation. +// +// If an animation is really just a plain image (has only one frame), this +// function returns that image. +// +// If the animation is an animation, this function returns a reasonable image +// to use as a static unanimated image, which might be the first frame, +// or something more sophisticated depending on the file format. +// +// If an animation hasn't loaded any frames yet, this function will return NULL. +// +// The function returns the following values: +// +// - pixbuf: unanimated image representing the animation. +func (animation *PixbufAnimation) StaticImage() *Pixbuf { + var _arg0 *C.GdkPixbufAnimation // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbufAnimation)(unsafe.Pointer(coreglib.InternObject(animation).Native())) + + _cret = C.gdk_pixbuf_animation_get_static_image(_arg0) + runtime.KeepAlive(animation) + + var _pixbuf *Pixbuf // out + + _pixbuf = wrapPixbuf(coreglib.Take(unsafe.Pointer(_cret))) + + return _pixbuf +} + +// Width queries the width of the bounding box of a pixbuf animation. +// +// The function returns the following values: +// +// - gint: width of the bounding box of the animation. +func (animation *PixbufAnimation) Width() int { + var _arg0 *C.GdkPixbufAnimation // out + var _cret C.int // in + + _arg0 = (*C.GdkPixbufAnimation)(unsafe.Pointer(coreglib.InternObject(animation).Native())) + + _cret = C.gdk_pixbuf_animation_get_width(_arg0) + runtime.KeepAlive(animation) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// IsStaticImage checks whether the animation is a static image. +// +// If you load a file with gdk_pixbuf_animation_new_from_file() and it turns +// out to be a plain, unanimated image, then this function will return TRUE. +// Use gdk_pixbuf_animation_get_static_image() to retrieve the image. +// +// The function returns the following values: +// +// - ok: TRUE if the "animation" was really just an image. +func (animation *PixbufAnimation) IsStaticImage() bool { + var _arg0 *C.GdkPixbufAnimation // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbufAnimation)(unsafe.Pointer(coreglib.InternObject(animation).Native())) + + _cret = C.gdk_pixbuf_animation_is_static_image(_arg0) + runtime.KeepAlive(animation) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// NewPixbufAnimationFromStreamAsync creates a new animation by asynchronously +// loading an image from an input stream. +// +// For more details see gdk_pixbuf_new_from_stream(), which is the synchronous +// version of this function. +// +// When the operation is finished, callback will be called in the main thread. +// You can then call gdk_pixbuf_animation_new_from_stream_finish() to get the +// result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object. +// - stream from which to load the animation. +// - callback (optional): GAsyncReadyCallback to call when the pixbuf is +// loaded. +func NewPixbufAnimationFromStreamAsync(ctx context.Context, stream gio.InputStreamer, callback gio.AsyncReadyCallback) { + var _arg2 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gdk_pixbuf_animation_new_from_stream_async(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(callback) +} + +// PixbufAnimationIter: opaque object representing an iterator which points to a +// certain position in an animation. +type PixbufAnimationIter struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*PixbufAnimationIter)(nil) +) + +func wrapPixbufAnimationIter(obj *coreglib.Object) *PixbufAnimationIter { + return &PixbufAnimationIter{ + Object: obj, + } +} + +func marshalPixbufAnimationIter(p uintptr) (interface{}, error) { + return wrapPixbufAnimationIter(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Advance: possibly advances an animation to a new frame. +// +// Chooses the frame based on the start time passed to +// gdk_pixbuf_animation_get_iter(). +// +// current_time would normally come from g_get_current_time(), +// and must be greater than or equal to the time passed to +// gdk_pixbuf_animation_get_iter(), and must increase or remain unchanged each +// time gdk_pixbuf_animation_iter_get_pixbuf() is called. That is, you can't go +// backward in time; animations only play forward. +// +// As a shortcut, pass NULL for the current time and g_get_current_time() will +// be invoked on your behalf. So you only need to explicitly pass current_time +// if you're doing something odd like playing the animation at double speed. +// +// If this function returns FALSE, there's no need to update the animation +// display, assuming the display had been rendered prior to advancing; if TRUE, +// you need to call gdk_pixbuf_animation_iter_get_pixbuf() and update the +// display with the new pixbuf. +// +// The function takes the following parameters: +// +// - currentTime (optional): current time. +// +// The function returns the following values: +// +// - ok: TRUE if the image may need updating. +func (iter *PixbufAnimationIter) Advance(currentTime *glib.TimeVal) bool { + var _arg0 *C.GdkPixbufAnimationIter // out + var _arg1 *C.GTimeVal // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbufAnimationIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + if currentTime != nil { + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(currentTime))) + } + + _cret = C.gdk_pixbuf_animation_iter_advance(_arg0, _arg1) + runtime.KeepAlive(iter) + runtime.KeepAlive(currentTime) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DelayTime gets the number of milliseconds the current pixbuf should be +// displayed, or -1 if the current pixbuf should be displayed forever. +// +// The g_timeout_add() function conveniently takes a timeout in milliseconds, +// so you can use a timeout to schedule the next update. +// +// Note that some formats, like GIF, might clamp the timeout values in the image +// file to avoid updates that are just too quick. The minimum timeout for GIF +// images is currently 20 milliseconds. +// +// The function returns the following values: +// +// - gint: delay time in milliseconds (thousandths of a second). +func (iter *PixbufAnimationIter) DelayTime() int { + var _arg0 *C.GdkPixbufAnimationIter // out + var _cret C.int // in + + _arg0 = (*C.GdkPixbufAnimationIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.gdk_pixbuf_animation_iter_get_delay_time(_arg0) + runtime.KeepAlive(iter) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Pixbuf gets the current pixbuf which should be displayed. +// +// The pixbuf might not be the same size as the animation itself +// (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()). +// +// This pixbuf should be displayed for +// gdk_pixbuf_animation_iter_get_delay_time() milliseconds. +// +// The caller of this function does not own a reference to the returned +// pixbuf; the returned pixbuf will become invalid when the iterator +// advances to the next frame, which may happen anytime you call +// gdk_pixbuf_animation_iter_advance(). +// +// Copy the pixbuf to keep it (don't just add a reference), as it may get +// recycled as you advance the iterator. +// +// The function returns the following values: +// +// - pixbuf to be displayed. +func (iter *PixbufAnimationIter) Pixbuf() *Pixbuf { + var _arg0 *C.GdkPixbufAnimationIter // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbufAnimationIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.gdk_pixbuf_animation_iter_get_pixbuf(_arg0) + runtime.KeepAlive(iter) + + var _pixbuf *Pixbuf // out + + _pixbuf = wrapPixbuf(coreglib.Take(unsafe.Pointer(_cret))) + + return _pixbuf +} + +// OnCurrentlyLoadingFrame: used to determine how to respond to the area_updated +// signal on PixbufLoader when loading an animation. +// +// The ::area_updated signal is emitted for an area of the frame currently +// streaming in to the loader. So if you're on the currently loading frame, +// you will need to redraw the screen for the updated area. +// +// The function returns the following values: +// +// - ok: TRUE if the frame we're on is partially loaded, or the last frame. +func (iter *PixbufAnimationIter) OnCurrentlyLoadingFrame() bool { + var _arg0 *C.GdkPixbufAnimationIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbufAnimationIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.gdk_pixbuf_animation_iter_on_currently_loading_frame(_arg0) + runtime.KeepAlive(iter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PixbufLoaderOverrides contains methods that are overridable. +type PixbufLoaderOverrides struct { + AreaPrepared func() + // The function takes the following parameters: + // + // - x + // - y + // - width + // - height + AreaUpdated func(x, y, width, height int) + Closed func() + // The function takes the following parameters: + // + // - width + // - height + SizePrepared func(width, height int) +} + +func defaultPixbufLoaderOverrides(v *PixbufLoader) PixbufLoaderOverrides { + return PixbufLoaderOverrides{ + AreaPrepared: v.areaPrepared, + AreaUpdated: v.areaUpdated, + Closed: v.closed, + SizePrepared: v.sizePrepared, + } +} + +// PixbufLoader: incremental image loader. +// +// GdkPixbufLoader provides a way for applications to drive the process +// of loading an image, by letting them send the image data directly to +// the loader instead of having the loader read the data from a file. +// Applications can use this functionality instead of gdk_pixbuf_new_from_file() +// or gdk_pixbuf_animation_new_from_file() when they need to parse image data +// in small chunks. For example, it should be used when reading an image from +// a (potentially) slow network connection, or when loading an extremely large +// file. +// +// To use GdkPixbufLoader to load an image, create a new instance, +// and call gdkpixbuf.PixbufLoader.Write() to send the data to it. When done, +// gdkpixbuf.PixbufLoader.Close() should be called to end the stream and +// finalize everything. +// +// The loader will emit three important signals throughout the process: +// +// - gdkpixbuf.PixbufLoader::size-prepared will be emitted as soon as the +// image has enough information to determine the size of the image to be +// used. If you want to scale the image while loading it, you can call +// gdkpixbuf.PixbufLoader.SetSize() in response to this signal. +// - gdkpixbuf.PixbufLoader::area-prepared will be emitted as soon as +// the pixbuf of the desired has been allocated. You can obtain the +// GdkPixbuf instance by calling gdkpixbuf.PixbufLoader.GetPixbuf(). +// If you want to use it, simply acquire a reference to it. You can also +// call gdk_pixbuf_loader_get_pixbuf() later to get the same pixbuf. +// - gdkpixbuf.PixbufLoader::area-updated will be emitted every time a region +// is updated. This way you can update a partially completed image. Note +// that you do not know anything about the completeness of an image from the +// updated area. For example, in an interlaced image you will need to make +// several passes before the image is done loading. +// +// # Loading an animation +// +// Loading an animation is almost as easy as loading an image. Once the first +// gdkpixbuf.PixbufLoader::area-prepared signal has been emitted, you can call +// gdkpixbuf.PixbufLoader.GetAnimation() to get the gdkpixbuf.PixbufAnimation +// instance, and then call and gdkpixbuf.PixbufAnimation.GetIter() to get a +// gdkpixbuf.PixbufAnimationIter to retrieve the pixbuf for the desired time +// stamp. +type PixbufLoader struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*PixbufLoader)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*PixbufLoader, *PixbufLoaderClass, PixbufLoaderOverrides]( + GTypePixbufLoader, + initPixbufLoaderClass, + wrapPixbufLoader, + defaultPixbufLoaderOverrides, + ) +} + +func initPixbufLoaderClass(gclass unsafe.Pointer, overrides PixbufLoaderOverrides, classInitFunc func(*PixbufLoaderClass)) { + pclass := (*C.GdkPixbufLoaderClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypePixbufLoader)))) + + if overrides.AreaPrepared != nil { + pclass.area_prepared = (*[0]byte)(C._gotk4_gdkpixbuf2_PixbufLoaderClass_area_prepared) + } + + if overrides.AreaUpdated != nil { + pclass.area_updated = (*[0]byte)(C._gotk4_gdkpixbuf2_PixbufLoaderClass_area_updated) + } + + if overrides.Closed != nil { + pclass.closed = (*[0]byte)(C._gotk4_gdkpixbuf2_PixbufLoaderClass_closed) + } + + if overrides.SizePrepared != nil { + pclass.size_prepared = (*[0]byte)(C._gotk4_gdkpixbuf2_PixbufLoaderClass_size_prepared) + } + + if classInitFunc != nil { + class := (*PixbufLoaderClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapPixbufLoader(obj *coreglib.Object) *PixbufLoader { + return &PixbufLoader{ + Object: obj, + } +} + +func marshalPixbufLoader(p uintptr) (interface{}, error) { + return wrapPixbufLoader(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectAreaPrepared: this signal is emitted when the pixbuf loader has +// allocated the pixbuf in the desired size. +// +// After this signal is emitted, applications can call +// gdk_pixbuf_loader_get_pixbuf() to fetch the partially-loaded pixbuf. +func (loader *PixbufLoader) ConnectAreaPrepared(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(loader, "area-prepared", false, unsafe.Pointer(C._gotk4_gdkpixbuf2_PixbufLoader_ConnectAreaPrepared), f) +} + +// ConnectAreaUpdated: this signal is emitted when a significant area of the +// image being loaded has been updated. +// +// Normally it means that a complete scanline has been read in, but it could be +// a different area as well. +// +// Applications can use this signal to know when to repaint areas of an image +// that is being loaded. +func (loader *PixbufLoader) ConnectAreaUpdated(f func(x, y, width, height int)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(loader, "area-updated", false, unsafe.Pointer(C._gotk4_gdkpixbuf2_PixbufLoader_ConnectAreaUpdated), f) +} + +// ConnectClosed: this signal is emitted when gdk_pixbuf_loader_close() is +// called. +// +// It can be used by different parts of an application to receive notification +// when an image loader is closed by the code that drives it. +func (loader *PixbufLoader) ConnectClosed(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(loader, "closed", false, unsafe.Pointer(C._gotk4_gdkpixbuf2_PixbufLoader_ConnectClosed), f) +} + +// ConnectSizePrepared: this signal is emitted when the pixbuf loader has been +// fed the initial amount of data that is required to figure out the size of the +// image that it will create. +// +// Applications can call gdk_pixbuf_loader_set_size() in response to this signal +// to set the desired size to which the image should be scaled. +func (loader *PixbufLoader) ConnectSizePrepared(f func(width, height int)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(loader, "size-prepared", false, unsafe.Pointer(C._gotk4_gdkpixbuf2_PixbufLoader_ConnectSizePrepared), f) +} + +// NewPixbufLoader creates a new pixbuf loader object. +// +// The function returns the following values: +// +// - pixbufLoader: newly-created pixbuf loader. +func NewPixbufLoader() *PixbufLoader { + var _cret *C.GdkPixbufLoader // in + + _cret = C.gdk_pixbuf_loader_new() + + var _pixbufLoader *PixbufLoader // out + + _pixbufLoader = wrapPixbufLoader(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _pixbufLoader +} + +// NewPixbufLoaderWithMIMEType creates a new pixbuf loader object that always +// attempts to parse image data as if it were an image of MIME type mime_type, +// instead of identifying the type automatically. +// +// This function is useful if you want an error if the image isn't the expected +// MIME type; for loading image formats that can't be reliably identified by +// looking at the data; or if the user manually forces a specific MIME type. +// +// The list of supported mime types depends on what image loaders are installed, +// but typically "image/png", "image/jpeg", "image/gif", "image/tiff" and +// "image/x-xpixmap" are among the supported mime types. To obtain the full list +// of supported mime types, call gdk_pixbuf_format_get_mime_types() on each of +// the PixbufFormat structs returned by gdk_pixbuf_get_formats(). +// +// The function takes the following parameters: +// +// - mimeType: mime type to be loaded. +// +// The function returns the following values: +// +// - pixbufLoader: newly-created pixbuf loader. +func NewPixbufLoaderWithMIMEType(mimeType string) (*PixbufLoader, error) { + var _arg1 *C.char // out + var _cret *C.GdkPixbufLoader // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_loader_new_with_mime_type(_arg1, &_cerr) + runtime.KeepAlive(mimeType) + + var _pixbufLoader *PixbufLoader // out + var _goerr error // out + + _pixbufLoader = wrapPixbufLoader(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbufLoader, _goerr +} + +// NewPixbufLoaderWithType creates a new pixbuf loader object that always +// attempts to parse image data as if it were an image of type image_type, +// instead of identifying the type automatically. +// +// This function is useful if you want an error if the image isn't the expected +// type; for loading image formats that can't be reliably identified by looking +// at the data; or if the user manually forces a specific type. +// +// The list of supported image formats depends on what image loaders are +// installed, but typically "png", "jpeg", "gif", "tiff" and "xpm" are among the +// supported formats. To obtain the full list of supported image formats, call +// gdk_pixbuf_format_get_name() on each of the PixbufFormat structs returned by +// gdk_pixbuf_get_formats(). +// +// The function takes the following parameters: +// +// - imageType: name of the image format to be loaded with the image. +// +// The function returns the following values: +// +// - pixbufLoader: newly-created pixbuf loader. +func NewPixbufLoaderWithType(imageType string) (*PixbufLoader, error) { + var _arg1 *C.char // out + var _cret *C.GdkPixbufLoader // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(imageType))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_loader_new_with_type(_arg1, &_cerr) + runtime.KeepAlive(imageType) + + var _pixbufLoader *PixbufLoader // out + var _goerr error // out + + _pixbufLoader = wrapPixbufLoader(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _pixbufLoader, _goerr +} + +// Close informs a pixbuf loader that no further writes with +// gdk_pixbuf_loader_write() will occur, so that it can free its internal +// loading structures. +// +// This function also tries to parse any data that hasn't yet been parsed; +// if the remaining data is partial or corrupt, an error will be returned. +// +// If FALSE is returned, error will be set to an error from the GDK_PIXBUF_ERROR +// or G_FILE_ERROR domains. +// +// If you're just cancelling a load rather than expecting it to be finished, +// passing NULL for error to ignore it is reasonable. +// +// Remember that this function does not release a reference on the loader, +// so you will need to explicitly release any reference you hold. +func (loader *PixbufLoader) Close() error { + var _arg0 *C.GdkPixbufLoader // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + + C.gdk_pixbuf_loader_close(_arg0, &_cerr) + runtime.KeepAlive(loader) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Animation queries the PixbufAnimation that a pixbuf loader is currently +// creating. +// +// In general it only makes sense to call this function after the +// gdkpixbuf.PixbufLoader::area-prepared signal has been emitted by the loader. +// +// If the loader doesn't have enough bytes yet, and hasn't emitted the +// area-prepared signal, this function will return NULL. +// +// The function returns the following values: +// +// - pixbufAnimation (optional): animation that the loader is currently +// loading. +func (loader *PixbufLoader) Animation() *PixbufAnimation { + var _arg0 *C.GdkPixbufLoader // out + var _cret *C.GdkPixbufAnimation // in + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + + _cret = C.gdk_pixbuf_loader_get_animation(_arg0) + runtime.KeepAlive(loader) + + var _pixbufAnimation *PixbufAnimation // out + + if _cret != nil { + _pixbufAnimation = wrapPixbufAnimation(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _pixbufAnimation +} + +// Format obtains the available information about the format of the currently +// loading image file. +// +// The function returns the following values: +// +// - pixbufFormat (optional): PixbufFormat. +func (loader *PixbufLoader) Format() *PixbufFormat { + var _arg0 *C.GdkPixbufLoader // out + var _cret *C.GdkPixbufFormat // in + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + + _cret = C.gdk_pixbuf_loader_get_format(_arg0) + runtime.KeepAlive(loader) + + var _pixbufFormat *PixbufFormat // out + + if _cret != nil { + _pixbufFormat = (*PixbufFormat)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _pixbufFormat +} + +// Pixbuf queries the Pixbuf that a pixbuf loader is currently creating. +// +// In general it only makes sense to call this function after the +// gdkpixbuf.PixbufLoader::area-prepared signal has been emitted by the loader; +// this means that enough data has been read to know the size of the image that +// will be allocated. +// +// If the loader has not received enough data via gdk_pixbuf_loader_write(), +// then this function returns NULL. +// +// The returned pixbuf will be the same in all future calls to the loader, +// so if you want to keep using it, you should acquire a reference to it. +// +// Additionally, if the loader is an animation, it will return the "static +// image" of the animation (see gdk_pixbuf_animation_get_static_image()). +// +// The function returns the following values: +// +// - pixbuf (optional) that the loader is creating. +func (loader *PixbufLoader) Pixbuf() *Pixbuf { + var _arg0 *C.GdkPixbufLoader // out + var _cret *C.GdkPixbuf // in + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + + _cret = C.gdk_pixbuf_loader_get_pixbuf(_arg0) + runtime.KeepAlive(loader) + + var _pixbuf *Pixbuf // out + + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _pixbuf +} + +// SetSize causes the image to be scaled while it is loaded. +// +// The desired image size can be determined relative to the original size of the +// image by calling gdk_pixbuf_loader_set_size() from a signal handler for the +// ::size-prepared signal. +// +// Attempts to set the desired image size are ignored after the emission of the +// ::size-prepared signal. +// +// The function takes the following parameters: +// +// - width: desired width of the image being loaded. +// - height: desired height of the image being loaded. +func (loader *PixbufLoader) SetSize(width, height int) { + var _arg0 *C.GdkPixbufLoader // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + _arg1 = C.int(width) + _arg2 = C.int(height) + + C.gdk_pixbuf_loader_set_size(_arg0, _arg1, _arg2) + runtime.KeepAlive(loader) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// Write parses the next count bytes in the given image buffer. +// +// The function takes the following parameters: +// +// - buf: pointer to image data. +func (loader *PixbufLoader) Write(buf []byte) error { + var _arg0 *C.GdkPixbufLoader // out + var _arg1 *C.guchar // out + var _arg2 C.gsize + var _cerr *C.GError // in + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + _arg2 = (C.gsize)(len(buf)) + if len(buf) > 0 { + _arg1 = (*C.guchar)(unsafe.Pointer(&buf[0])) + } + + C.gdk_pixbuf_loader_write(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(loader) + runtime.KeepAlive(buf) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// WriteBytes parses the next contents of the given image buffer. +// +// The function takes the following parameters: +// +// - buffer: image data as a GBytes buffer. +func (loader *PixbufLoader) WriteBytes(buffer *glib.Bytes) error { + var _arg0 *C.GdkPixbufLoader // out + var _arg1 *C.GBytes // out + var _cerr *C.GError // in + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(buffer))) + + C.gdk_pixbuf_loader_write_bytes(_arg0, _arg1, &_cerr) + runtime.KeepAlive(loader) + runtime.KeepAlive(buffer) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func (loader *PixbufLoader) areaPrepared() { + gclass := (*C.GdkPixbufLoaderClass)(coreglib.PeekParentClass(loader)) + fnarg := gclass.area_prepared + + var _arg0 *C.GdkPixbufLoader // out + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + + C._gotk4_gdkpixbuf2_PixbufLoader_virtual_area_prepared(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(loader) +} + +// The function takes the following parameters: +// +// - x +// - y +// - width +// - height +func (loader *PixbufLoader) areaUpdated(x, y, width, height int) { + gclass := (*C.GdkPixbufLoaderClass)(coreglib.PeekParentClass(loader)) + fnarg := gclass.area_updated + + var _arg0 *C.GdkPixbufLoader // out + var _arg1 C.int // out + var _arg2 C.int // out + var _arg3 C.int // out + var _arg4 C.int // out + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + _arg1 = C.int(x) + _arg2 = C.int(y) + _arg3 = C.int(width) + _arg4 = C.int(height) + + C._gotk4_gdkpixbuf2_PixbufLoader_virtual_area_updated(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(loader) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +func (loader *PixbufLoader) closed() { + gclass := (*C.GdkPixbufLoaderClass)(coreglib.PeekParentClass(loader)) + fnarg := gclass.closed + + var _arg0 *C.GdkPixbufLoader // out + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + + C._gotk4_gdkpixbuf2_PixbufLoader_virtual_closed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(loader) +} + +// The function takes the following parameters: +// +// - width +// - height +func (loader *PixbufLoader) sizePrepared(width, height int) { + gclass := (*C.GdkPixbufLoaderClass)(coreglib.PeekParentClass(loader)) + fnarg := gclass.size_prepared + + var _arg0 *C.GdkPixbufLoader // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GdkPixbufLoader)(unsafe.Pointer(coreglib.InternObject(loader).Native())) + _arg1 = C.int(width) + _arg2 = C.int(height) + + C._gotk4_gdkpixbuf2_PixbufLoader_virtual_size_prepared(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(loader) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// PixbufSimpleAnim: opaque struct representing a simple animation. +type PixbufSimpleAnim struct { + _ [0]func() // equal guard + PixbufAnimation +} + +var ( + _ coreglib.Objector = (*PixbufSimpleAnim)(nil) +) + +func wrapPixbufSimpleAnim(obj *coreglib.Object) *PixbufSimpleAnim { + return &PixbufSimpleAnim{ + PixbufAnimation: PixbufAnimation{ + Object: obj, + }, + } +} + +func marshalPixbufSimpleAnim(p uintptr) (interface{}, error) { + return wrapPixbufSimpleAnim(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewPixbufSimpleAnim creates a new, empty animation. +// +// The function takes the following parameters: +// +// - width of the animation. +// - height of the animation. +// - rate: speed of the animation, in frames per second. +// +// The function returns the following values: +// +// - pixbufSimpleAnim: newly allocated PixbufSimpleAnim. +func NewPixbufSimpleAnim(width, height int, rate float32) *PixbufSimpleAnim { + var _arg1 C.gint // out + var _arg2 C.gint // out + var _arg3 C.gfloat // out + var _cret *C.GdkPixbufSimpleAnim // in + + _arg1 = C.gint(width) + _arg2 = C.gint(height) + _arg3 = C.gfloat(rate) + + _cret = C.gdk_pixbuf_simple_anim_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(rate) + + var _pixbufSimpleAnim *PixbufSimpleAnim // out + + _pixbufSimpleAnim = wrapPixbufSimpleAnim(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _pixbufSimpleAnim +} + +// AddFrame adds a new frame to animation. The pixbuf must have the dimensions +// specified when the animation was constructed. +// +// The function takes the following parameters: +// +// - pixbuf to add. +func (animation *PixbufSimpleAnim) AddFrame(pixbuf *Pixbuf) { + var _arg0 *C.GdkPixbufSimpleAnim // out + var _arg1 *C.GdkPixbuf // out + + _arg0 = (*C.GdkPixbufSimpleAnim)(unsafe.Pointer(coreglib.InternObject(animation).Native())) + _arg1 = (*C.GdkPixbuf)(unsafe.Pointer(coreglib.InternObject(pixbuf).Native())) + + C.gdk_pixbuf_simple_anim_add_frame(_arg0, _arg1) + runtime.KeepAlive(animation) + runtime.KeepAlive(pixbuf) +} + +// Loop gets whether animation should loop indefinitely when it reaches the end. +// +// The function returns the following values: +// +// - ok: TRUE if the animation loops forever, FALSE otherwise. +func (animation *PixbufSimpleAnim) Loop() bool { + var _arg0 *C.GdkPixbufSimpleAnim // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbufSimpleAnim)(unsafe.Pointer(coreglib.InternObject(animation).Native())) + + _cret = C.gdk_pixbuf_simple_anim_get_loop(_arg0) + runtime.KeepAlive(animation) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetLoop sets whether animation should loop indefinitely when it reaches the +// end. +// +// The function takes the following parameters: +// +// - loop: whether to loop the animation. +func (animation *PixbufSimpleAnim) SetLoop(loop bool) { + var _arg0 *C.GdkPixbufSimpleAnim // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkPixbufSimpleAnim)(unsafe.Pointer(coreglib.InternObject(animation).Native())) + if loop { + _arg1 = C.TRUE + } + + C.gdk_pixbuf_simple_anim_set_loop(_arg0, _arg1) + runtime.KeepAlive(animation) + runtime.KeepAlive(loop) +} + +type PixbufSimpleAnimIter struct { + _ [0]func() // equal guard + PixbufAnimationIter +} + +var ( + _ coreglib.Objector = (*PixbufSimpleAnimIter)(nil) +) + +func wrapPixbufSimpleAnimIter(obj *coreglib.Object) *PixbufSimpleAnimIter { + return &PixbufSimpleAnimIter{ + PixbufAnimationIter: PixbufAnimationIter{ + Object: obj, + }, + } +} + +func marshalPixbufSimpleAnimIter(p uintptr) (interface{}, error) { + return wrapPixbufSimpleAnimIter(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// PixbufFormat: GdkPixbufFormat contains information about the image format +// accepted by a module. +// +// Only modules should access the fields directly, applications should use the +// gdk_pixbuf_format_* family of functions. +// +// An instance of this type is always passed by reference. +type PixbufFormat struct { + *pixbufFormat +} + +// pixbufFormat is the struct that's finalized. +type pixbufFormat struct { + native *C.GdkPixbufFormat +} + +func marshalPixbufFormat(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &PixbufFormat{&pixbufFormat{(*C.GdkPixbufFormat)(b)}}, nil +} + +// Copy creates a copy of format. +// +// The function returns the following values: +// +// - pixbufFormat (optional): newly allocated copy of a GdkPixbufFormat. +// Use gdk_pixbuf_format_free() to free the resources when done. +func (format *PixbufFormat) Copy() *PixbufFormat { + var _arg0 *C.GdkPixbufFormat // out + var _cret *C.GdkPixbufFormat // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + + _cret = C.gdk_pixbuf_format_copy(_arg0) + runtime.KeepAlive(format) + + var _pixbufFormat *PixbufFormat // out + + if _cret != nil { + _pixbufFormat = (*PixbufFormat)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_pixbufFormat)), + func(intern *struct{ C unsafe.Pointer }) { + C.gdk_pixbuf_format_free((*C.GdkPixbufFormat)(intern.C)) + }, + ) + } + + return _pixbufFormat +} + +// Description returns a description of the format. +// +// The function returns the following values: +// +// - utf8 (optional): description of the format. +func (format *PixbufFormat) Description() string { + var _arg0 *C.GdkPixbufFormat // out + var _cret *C.gchar // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + + _cret = C.gdk_pixbuf_format_get_description(_arg0) + runtime.KeepAlive(format) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Extensions returns the filename extensions typically used for files in the +// given format. +// +// The function returns the following values: +// +// - utf8s (optional): array of filename extensions. +func (format *PixbufFormat) Extensions() []string { + var _arg0 *C.GdkPixbufFormat // out + var _cret **C.gchar // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + + _cret = C.gdk_pixbuf_format_get_extensions(_arg0) + runtime.KeepAlive(format) + + var _utf8s []string // out + + if _cret != nil { + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + } + + return _utf8s +} + +// License returns information about the license of the image loader for the +// format. +// +// The returned string should be a shorthand for a well known license, e.g. +// "LGPL", "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license. +// +// The function returns the following values: +// +// - utf8 (optional): string describing the license of the pixbuf format. +func (format *PixbufFormat) License() string { + var _arg0 *C.GdkPixbufFormat // out + var _cret *C.gchar // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + + _cret = C.gdk_pixbuf_format_get_license(_arg0) + runtime.KeepAlive(format) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// MIMETypes returns the mime types supported by the format. +// +// The function returns the following values: +// +// - utf8s (optional): array of mime types. +func (format *PixbufFormat) MIMETypes() []string { + var _arg0 *C.GdkPixbufFormat // out + var _cret **C.gchar // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + + _cret = C.gdk_pixbuf_format_get_mime_types(_arg0) + runtime.KeepAlive(format) + + var _utf8s []string // out + + if _cret != nil { + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + } + + return _utf8s +} + +// Name returns the name of the format. +// +// The function returns the following values: +// +// - utf8 (optional): name of the format. +func (format *PixbufFormat) Name() string { + var _arg0 *C.GdkPixbufFormat // out + var _cret *C.gchar // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + + _cret = C.gdk_pixbuf_format_get_name(_arg0) + runtime.KeepAlive(format) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// IsDisabled returns whether this image format is disabled. +// +// See gdk_pixbuf_format_set_disabled(). +// +// The function returns the following values: +// +// - ok: whether this image format is disabled. +func (format *PixbufFormat) IsDisabled() bool { + var _arg0 *C.GdkPixbufFormat // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + + _cret = C.gdk_pixbuf_format_is_disabled(_arg0) + runtime.KeepAlive(format) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsSaveOptionSupported returns TRUE if the save option specified by option_key +// is supported when saving a pixbuf using the module implementing format. +// +// See gdk_pixbuf_save() for more information about option keys. +// +// The function takes the following parameters: +// +// - optionKey: name of an option. +// +// The function returns the following values: +// +// - ok: TRUE if the specified option is supported. +func (format *PixbufFormat) IsSaveOptionSupported(optionKey string) bool { + var _arg0 *C.GdkPixbufFormat // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(optionKey))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gdk_pixbuf_format_is_save_option_supported(_arg0, _arg1) + runtime.KeepAlive(format) + runtime.KeepAlive(optionKey) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsScalable returns whether this image format is scalable. +// +// If a file is in a scalable format, it is preferable to load it at the desired +// size, rather than loading it at the default size and scaling the resulting +// pixbuf to the desired size. +// +// The function returns the following values: +// +// - ok: whether this image format is scalable. +func (format *PixbufFormat) IsScalable() bool { + var _arg0 *C.GdkPixbufFormat // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + + _cret = C.gdk_pixbuf_format_is_scalable(_arg0) + runtime.KeepAlive(format) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsWritable returns whether pixbufs can be saved in the given format. +// +// The function returns the following values: +// +// - ok: whether pixbufs can be saved in the given format. +func (format *PixbufFormat) IsWritable() bool { + var _arg0 *C.GdkPixbufFormat // out + var _cret C.gboolean // in + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + + _cret = C.gdk_pixbuf_format_is_writable(_arg0) + runtime.KeepAlive(format) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetDisabled disables or enables an image format. +// +// If a format is disabled, GdkPixbuf won't use the image loader for this format +// to load images. +// +// Applications can use this to avoid using image loaders with an inappropriate +// license, see gdk_pixbuf_format_get_license(). +// +// The function takes the following parameters: +// +// - disabled: TRUE to disable the format format. +func (format *PixbufFormat) SetDisabled(disabled bool) { + var _arg0 *C.GdkPixbufFormat // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GdkPixbufFormat)(gextras.StructNative(unsafe.Pointer(format))) + if disabled { + _arg1 = C.TRUE + } + + C.gdk_pixbuf_format_set_disabled(_arg0, _arg1) + runtime.KeepAlive(format) + runtime.KeepAlive(disabled) +} + +// PixbufLoaderClass: instance of this type is always passed by reference. +type PixbufLoaderClass struct { + *pixbufLoaderClass +} + +// pixbufLoaderClass is the struct that's finalized. +type pixbufLoaderClass struct { + native *C.GdkPixbufLoaderClass +} + +// NewPixbufFromImage creates a new Pixbuf from a stdlib image.Image. It +// contains a fast path for *image.RGBA while resorting to +// copying/converting the image otherwise. +func NewPixbufFromImage(img image.Image) *Pixbuf { + bounds := img.Bounds() + var pixbuf *Pixbuf + + switch img := img.(type) { + case *image.RGBA: + bytes := glib.NewBytesWithGo(img.Pix) + pixbuf = NewPixbufFromBytes(bytes, ColorspaceRGB, true, 8, bounds.Dx(), bounds.Dy(), img.Stride) + default: + pixbuf = NewPixbuf(ColorspaceRGB, true, 8, bounds.Dx(), bounds.Dy()) + pixbuf.ReadPixelBytes().Use(func(b []byte) { + // For information on how this works, refer to + // pkg/cairo/surface_image.go. + rgba := image.RGBA{ + Pix: b, + Stride: bounds.Dx(), + Rect: bounds, + } + draw.Draw(&rgba, rgba.Rect, img, image.Point{}, draw.Over) + swizzle.BGRA(rgba.Pix) + }) + } + + return pixbuf +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2/gdkpixbuf_export.go b/vendor/github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2/gdkpixbuf_export.go new file mode 100644 index 00000000..fdad63d4 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2/gdkpixbuf_export.go @@ -0,0 +1,252 @@ +// Code generated by girgen. DO NOT EDIT. + +package gdkpixbuf + +import ( + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gerror" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" +) + +// #include +// #include +import "C" + +//export _gotk4_gdkpixbuf2_PixbufModulePreparedFunc +func _gotk4_gdkpixbuf2_PixbufModulePreparedFunc(arg1 *C.GdkPixbuf, arg2 *C.GdkPixbufAnimation, arg3 C.gpointer) { + var fn PixbufModulePreparedFunc + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(PixbufModulePreparedFunc) + } + + var _pixbuf *Pixbuf // out + var _anim *PixbufAnimation // out + + _pixbuf = wrapPixbuf(coreglib.Take(unsafe.Pointer(arg1))) + _anim = wrapPixbufAnimation(coreglib.Take(unsafe.Pointer(arg2))) + + fn(_pixbuf, _anim) +} + +//export _gotk4_gdkpixbuf2_PixbufModuleSizeFunc +func _gotk4_gdkpixbuf2_PixbufModuleSizeFunc(arg1 *C.gint, arg2 *C.gint, arg3 C.gpointer) { + var fn PixbufModuleSizeFunc + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(PixbufModuleSizeFunc) + } + + var _width *int // out + var _height *int // out + + _width = (*int)(unsafe.Pointer(arg1)) + _height = (*int)(unsafe.Pointer(arg2)) + + fn(_width, _height) +} + +//export _gotk4_gdkpixbuf2_PixbufModuleUpdatedFunc +func _gotk4_gdkpixbuf2_PixbufModuleUpdatedFunc(arg1 *C.GdkPixbuf, arg2 C.int, arg3 C.int, arg4 C.int, arg5 C.int, arg6 C.gpointer) { + var fn PixbufModuleUpdatedFunc + { + v := gbox.Get(uintptr(arg6)) + if v == nil { + panic(`callback not found`) + } + fn = v.(PixbufModuleUpdatedFunc) + } + + var _pixbuf *Pixbuf // out + var _x int // out + var _y int // out + var _width int // out + var _height int // out + + _pixbuf = wrapPixbuf(coreglib.Take(unsafe.Pointer(arg1))) + _x = int(arg2) + _y = int(arg3) + _width = int(arg4) + _height = int(arg5) + + fn(_pixbuf, _x, _y, _width, _height) +} + +//export _gotk4_gdkpixbuf2_PixbufSaveFunc +func _gotk4_gdkpixbuf2_PixbufSaveFunc(arg1 *C.gchar, arg2 C.gsize, arg3 **C.GError, arg4 C.gpointer) (cret C.gboolean) { + var fn PixbufSaveFunc + { + v := gbox.Get(uintptr(arg4)) + if v == nil { + panic(`callback not found`) + } + fn = v.(PixbufSaveFunc) + } + + var _buf []byte // out + + _buf = make([]byte, arg2) + copy(_buf, unsafe.Slice((*byte)(unsafe.Pointer(arg1)), arg2)) + + err, ok := fn(_buf) + + var _ error + var _ bool + + if err != nil && arg3 != nil { + *arg3 = (*C.GError)(gerror.New(err)) + } + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gdkpixbuf2_PixbufLoaderClass_area_prepared +func _gotk4_gdkpixbuf2_PixbufLoaderClass_area_prepared(arg0 *C.GdkPixbufLoader) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[PixbufLoaderOverrides](instance0) + if overrides.AreaPrepared == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected PixbufLoaderOverrides.AreaPrepared, got none") + } + + overrides.AreaPrepared() +} + +//export _gotk4_gdkpixbuf2_PixbufLoaderClass_area_updated +func _gotk4_gdkpixbuf2_PixbufLoaderClass_area_updated(arg0 *C.GdkPixbufLoader, arg1 C.int, arg2 C.int, arg3 C.int, arg4 C.int) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[PixbufLoaderOverrides](instance0) + if overrides.AreaUpdated == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected PixbufLoaderOverrides.AreaUpdated, got none") + } + + var _x int // out + var _y int // out + var _width int // out + var _height int // out + + _x = int(arg1) + _y = int(arg2) + _width = int(arg3) + _height = int(arg4) + + overrides.AreaUpdated(_x, _y, _width, _height) +} + +//export _gotk4_gdkpixbuf2_PixbufLoaderClass_closed +func _gotk4_gdkpixbuf2_PixbufLoaderClass_closed(arg0 *C.GdkPixbufLoader) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[PixbufLoaderOverrides](instance0) + if overrides.Closed == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected PixbufLoaderOverrides.Closed, got none") + } + + overrides.Closed() +} + +//export _gotk4_gdkpixbuf2_PixbufLoaderClass_size_prepared +func _gotk4_gdkpixbuf2_PixbufLoaderClass_size_prepared(arg0 *C.GdkPixbufLoader, arg1 C.int, arg2 C.int) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[PixbufLoaderOverrides](instance0) + if overrides.SizePrepared == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected PixbufLoaderOverrides.SizePrepared, got none") + } + + var _width int // out + var _height int // out + + _width = int(arg1) + _height = int(arg2) + + overrides.SizePrepared(_width, _height) +} + +//export _gotk4_gdkpixbuf2_PixbufLoader_ConnectAreaPrepared +func _gotk4_gdkpixbuf2_PixbufLoader_ConnectAreaPrepared(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdkpixbuf2_PixbufLoader_ConnectAreaUpdated +func _gotk4_gdkpixbuf2_PixbufLoader_ConnectAreaUpdated(arg0 C.gpointer, arg1 C.gint, arg2 C.gint, arg3 C.gint, arg4 C.gint, arg5 C.guintptr) { + var f func(x, y, width, height int) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg5)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(x, y, width, height int)) + } + + var _x int // out + var _y int // out + var _width int // out + var _height int // out + + _x = int(arg1) + _y = int(arg2) + _width = int(arg3) + _height = int(arg4) + + f(_x, _y, _width, _height) +} + +//export _gotk4_gdkpixbuf2_PixbufLoader_ConnectClosed +func _gotk4_gdkpixbuf2_PixbufLoader_ConnectClosed(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gdkpixbuf2_PixbufLoader_ConnectSizePrepared +func _gotk4_gdkpixbuf2_PixbufLoader_ConnectSizePrepared(arg0 C.gpointer, arg1 C.gint, arg2 C.gint, arg3 C.guintptr) { + var f func(width, height int) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(width, height int)) + } + + var _width int // out + var _height int // out + + _width = int(arg1) + _height = int(arg2) + + f(_width, _height) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/gio/v2/gio.go b/vendor/github.com/diamondburned/gotk4/pkg/gio/v2/gio.go new file mode 100644 index 00000000..5ee2ab79 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/gio/v2/gio.go @@ -0,0 +1,96503 @@ +// Code generated by girgen. DO NOT EDIT. + +package gio + +import ( + "context" + "fmt" + "runtime" + _ "runtime/cgo" + "strings" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gcancel" + "github.com/diamondburned/gotk4/pkg/core/gerror" + "github.com/diamondburned/gotk4/pkg/core/gextras" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" + "github.com/diamondburned/gotk4/pkg/glib/v2" +) + +// #cgo pkg-config: gio-2.0 glib-2.0 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// #include +// #include +// extern void callbackDelete(gpointer); +// extern void _gotk4_gio2_Volume_ConnectRemoved(gpointer, guintptr); +// extern void _gotk4_gio2_Volume_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectVolumeRemoved(gpointer, GVolume*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectVolumeChanged(gpointer, GVolume*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectVolumeAdded(gpointer, GVolume*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectMountRemoved(gpointer, GMount*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectMountPreUnmount(gpointer, GMount*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectMountChanged(gpointer, GMount*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectMountAdded(gpointer, GMount*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectDriveStopButton(gpointer, GDrive*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectDriveEjectButton(gpointer, GDrive*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectDriveDisconnected(gpointer, GDrive*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectDriveConnected(gpointer, GDrive*, guintptr); +// extern void _gotk4_gio2_VolumeMonitor_ConnectDriveChanged(gpointer, GDrive*, guintptr); +// extern void _gotk4_gio2_VolumeMonitorClass_volume_removed(GVolumeMonitor*, GVolume*); +// extern void _gotk4_gio2_VolumeMonitorClass_volume_changed(GVolumeMonitor*, GVolume*); +// extern void _gotk4_gio2_VolumeMonitorClass_volume_added(GVolumeMonitor*, GVolume*); +// extern void _gotk4_gio2_VolumeMonitorClass_mount_removed(GVolumeMonitor*, GMount*); +// extern void _gotk4_gio2_VolumeMonitorClass_mount_pre_unmount(GVolumeMonitor*, GMount*); +// extern void _gotk4_gio2_VolumeMonitorClass_mount_changed(GVolumeMonitor*, GMount*); +// extern void _gotk4_gio2_VolumeMonitorClass_mount_added(GVolumeMonitor*, GMount*); +// extern void _gotk4_gio2_VolumeMonitorClass_drive_stop_button(GVolumeMonitor*, GDrive*); +// extern void _gotk4_gio2_VolumeMonitorClass_drive_eject_button(GVolumeMonitor*, GDrive*); +// extern void _gotk4_gio2_VolumeMonitorClass_drive_disconnected(GVolumeMonitor*, GDrive*); +// extern void _gotk4_gio2_VolumeMonitorClass_drive_connected(GVolumeMonitor*, GDrive*); +// extern void _gotk4_gio2_VolumeMonitorClass_drive_changed(GVolumeMonitor*, GDrive*); +// extern void _gotk4_gio2_VfsClass_local_file_removed(GVfs*, char*); +// extern void _gotk4_gio2_VfsClass_local_file_moved(GVfs*, char*, char*); +// extern void _gotk4_gio2_VfsClass_add_writable_namespaces(GVfs*, GFileAttributeInfoList*); +// extern void _gotk4_gio2_SocketListener_ConnectEvent(gpointer, GSocketListenerEvent, GSocket*, guintptr); +// extern void _gotk4_gio2_SocketListenerClass_event(GSocketListener*, GSocketListenerEvent, GSocket*); +// extern void _gotk4_gio2_SocketListenerClass_changed(GSocketListener*); +// extern void _gotk4_gio2_SocketControlMessageClass_serialize(GSocketControlMessage*, gpointer); +// extern void _gotk4_gio2_SocketClient_ConnectEvent(gpointer, GSocketClientEvent, GSocketConnectable*, GIOStream*, guintptr); +// extern void _gotk4_gio2_SocketClientClass_event(GSocketClient*, GSocketClientEvent, GSocketConnectable*, GIOStream*); +// extern void _gotk4_gio2_SimpleAction_ConnectChangeState(gpointer, GVariant*, guintptr); +// extern void _gotk4_gio2_SimpleAction_ConnectActivate(gpointer, GVariant*, guintptr); +// extern void _gotk4_gio2_Settings_ConnectWritableChanged(gpointer, gchar*, guintptr); +// extern void _gotk4_gio2_Settings_ConnectChanged(gpointer, gchar*, guintptr); +// extern void _gotk4_gio2_SettingsClass_writable_changed(GSettings*, gchar*); +// extern void _gotk4_gio2_SettingsClass_changed(GSettings*, gchar*); +// extern void _gotk4_gio2_Resolver_ConnectReload(gpointer, guintptr); +// extern void _gotk4_gio2_ResolverClass_reload(GResolver*); +// extern void _gotk4_gio2_NetworkMonitor_ConnectNetworkChanged(gpointer, gboolean, guintptr); +// extern void _gotk4_gio2_Mount_ConnectUnmounted(gpointer, guintptr); +// extern void _gotk4_gio2_Mount_ConnectPreUnmount(gpointer, guintptr); +// extern void _gotk4_gio2_Mount_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gio2_MountOperation_ConnectShowUnmountProgress(gpointer, gchar*, gint64, gint64, guintptr); +// extern void _gotk4_gio2_MountOperation_ConnectReply(gpointer, GMountOperationResult, guintptr); +// extern void _gotk4_gio2_MountOperation_ConnectAskQuestion(gpointer, gchar*, gchar**, guintptr); +// extern void _gotk4_gio2_MountOperation_ConnectAskPassword(gpointer, gchar*, gchar*, gchar*, GAskPasswordFlags, guintptr); +// extern void _gotk4_gio2_MountOperation_ConnectAborted(gpointer, guintptr); +// extern void _gotk4_gio2_MountOperationClass_show_unmount_progress(GMountOperation*, gchar*, gint64, gint64); +// extern void _gotk4_gio2_MountOperationClass_reply(GMountOperation*, GMountOperationResult); +// extern void _gotk4_gio2_MountOperationClass_ask_question(GMountOperation*, char*, char**); +// extern void _gotk4_gio2_MountOperationClass_ask_password(GMountOperation*, char*, char*, char*, GAskPasswordFlags); +// extern void _gotk4_gio2_MountOperationClass_aborted(GMountOperation*); +// extern void _gotk4_gio2_MenuModel_ConnectItemsChanged(gpointer, gint, gint, gint, guintptr); +// extern void _gotk4_gio2_MenuModelClass_get_item_links(GMenuModel*, gint, GHashTable**); +// extern void _gotk4_gio2_MenuModelClass_get_item_attributes(GMenuModel*, gint, GHashTable**); +// extern void _gotk4_gio2_MemoryMonitor_ConnectLowMemoryWarning(gpointer, GMemoryMonitorWarningLevel, guintptr); +// extern void _gotk4_gio2_ListModel_ConnectItemsChanged(gpointer, guint, guint, guint, guintptr); +// extern void _gotk4_gio2_FilenameCompleter_ConnectGotCompletionData(gpointer, guintptr); +// extern void _gotk4_gio2_FilenameCompleterClass_got_completion_data(GFilenameCompleter*); +// extern void _gotk4_gio2_FileMonitor_ConnectChanged(gpointer, GFile*, GFile*, GFileMonitorEvent, guintptr); +// extern void _gotk4_gio2_FileMonitorClass_changed(GFileMonitor*, GFile*, GFile*, GFileMonitorEvent); +// extern void _gotk4_gio2_Drive_ConnectStopButton(gpointer, guintptr); +// extern void _gotk4_gio2_Drive_ConnectEjectButton(gpointer, guintptr); +// extern void _gotk4_gio2_Drive_ConnectDisconnected(gpointer, guintptr); +// extern void _gotk4_gio2_Drive_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gio2_DBusSignalCallback(GDBusConnection*, gchar*, gchar*, gchar*, gchar*, GVariant*, gpointer); +// extern void _gotk4_gio2_DBusProxy_ConnectGSignal(gpointer, gchar*, gchar*, GVariant*, guintptr); +// extern void _gotk4_gio2_DBusProxy_ConnectGPropertiesChanged(gpointer, GVariant*, gchar**, guintptr); +// extern void _gotk4_gio2_DBusProxyClass_g_signal(GDBusProxy*, gchar*, gchar*, GVariant*); +// extern void _gotk4_gio2_DBusObject_ConnectInterfaceRemoved(gpointer, GDBusInterface*, guintptr); +// extern void _gotk4_gio2_DBusObject_ConnectInterfaceAdded(gpointer, GDBusInterface*, guintptr); +// extern void _gotk4_gio2_DBusObjectManager_ConnectObjectRemoved(gpointer, GDBusObject*, guintptr); +// extern void _gotk4_gio2_DBusObjectManager_ConnectObjectAdded(gpointer, GDBusObject*, guintptr); +// extern void _gotk4_gio2_DBusObjectManager_ConnectInterfaceRemoved(gpointer, GDBusObject*, GDBusInterface*, guintptr); +// extern void _gotk4_gio2_DBusObjectManager_ConnectInterfaceAdded(gpointer, GDBusObject*, GDBusInterface*, guintptr); +// extern void _gotk4_gio2_DBusObjectManagerClient_ConnectInterfaceProxySignal(gpointer, GDBusObjectProxy*, GDBusProxy*, gchar*, gchar*, GVariant*, guintptr); +// extern void _gotk4_gio2_DBusObjectManagerClient_ConnectInterfaceProxyPropertiesChanged(gpointer, GDBusObjectProxy*, GDBusProxy*, GVariant*, gchar**, guintptr); +// extern void _gotk4_gio2_DBusObjectManagerClientClass_interface_proxy_signal(GDBusObjectManagerClient*, GDBusObjectProxy*, GDBusProxy*, gchar*, gchar*, GVariant*); +// extern void _gotk4_gio2_DBusInterfaceSkeletonClass_flush(GDBusInterfaceSkeleton*); +// extern void _gotk4_gio2_DBusConnection_ConnectClosed(gpointer, gboolean, GError*, guintptr); +// extern void _gotk4_gio2_Cancellable_ConnectCancelled(gpointer, guintptr); +// extern void _gotk4_gio2_CancellableClass_cancelled(GCancellable*); +// extern void _gotk4_gio2_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer); +// extern void _gotk4_gio2_Application_ConnectStartup(gpointer, guintptr); +// extern void _gotk4_gio2_Application_ConnectShutdown(gpointer, guintptr); +// extern void _gotk4_gio2_Application_ConnectOpen(gpointer, GFile**, gint, gchar*, guintptr); +// extern void _gotk4_gio2_Application_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gio2_ApplicationCommandLineClass_printerr_literal(GApplicationCommandLine*, gchar*); +// extern void _gotk4_gio2_ApplicationCommandLineClass_print_literal(GApplicationCommandLine*, gchar*); +// extern void _gotk4_gio2_ApplicationCommandLineClass_done(GApplicationCommandLine*); +// extern void _gotk4_gio2_ApplicationClass_startup(GApplication*); +// extern void _gotk4_gio2_ApplicationClass_shutdown(GApplication*); +// extern void _gotk4_gio2_ApplicationClass_run_mainloop(GApplication*); +// extern void _gotk4_gio2_ApplicationClass_quit_mainloop(GApplication*); +// extern void _gotk4_gio2_ApplicationClass_open(GApplication*, GFile**, gint, gchar*); +// extern void _gotk4_gio2_ApplicationClass_dbus_unregister(GApplication*, GDBusConnection*, gchar*); +// extern void _gotk4_gio2_ApplicationClass_before_emit(GApplication*, GVariant*); +// extern void _gotk4_gio2_ApplicationClass_after_emit(GApplication*, GVariant*); +// extern void _gotk4_gio2_ApplicationClass_add_platform_data(GApplication*, GVariantBuilder*); +// extern void _gotk4_gio2_ApplicationClass_activate(GApplication*); +// extern void _gotk4_gio2_AppLaunchContext_ConnectLaunched(gpointer, GAppInfo*, GVariant*, guintptr); +// extern void _gotk4_gio2_AppLaunchContext_ConnectLaunchStarted(gpointer, GAppInfo*, GVariant*, guintptr); +// extern void _gotk4_gio2_AppLaunchContext_ConnectLaunchFailed(gpointer, gchar*, guintptr); +// extern void _gotk4_gio2_AppLaunchContextClass_launched(GAppLaunchContext*, GAppInfo*, GVariant*); +// extern void _gotk4_gio2_AppLaunchContextClass_launch_started(GAppLaunchContext*, GAppInfo*, GVariant*); +// extern void _gotk4_gio2_AppLaunchContextClass_launch_failed(GAppLaunchContext*, char*); +// extern void _gotk4_gio2_AppInfoMonitor_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gio2_ActionGroup_ConnectActionStateChanged(gpointer, gchar*, GVariant*, guintptr); +// extern void _gotk4_gio2_ActionGroup_ConnectActionRemoved(gpointer, gchar*, guintptr); +// extern void _gotk4_gio2_ActionGroup_ConnectActionEnabledChanged(gpointer, gchar*, gboolean, guintptr); +// extern void _gotk4_gio2_ActionGroup_ConnectActionAdded(gpointer, gchar*, guintptr); +// extern int _gotk4_gio2_SocketControlMessageClass_get_type(GSocketControlMessage*); +// extern int _gotk4_gio2_SocketControlMessageClass_get_level(GSocketControlMessage*); +// extern int _gotk4_gio2_ApplicationClass_command_line(GApplication*, GApplicationCommandLine*); +// extern guchar* _gotk4_gio2_TlsPasswordClass_get_value(GTlsPassword*, gsize*); +// extern gssize _gotk4_gio2_SocketAddressClass_get_native_size(GSocketAddress*); +// extern gssize _gotk4_gio2_OutputStreamClass_write_finish(GOutputStream*, GAsyncResult*, GError**); +// extern gssize _gotk4_gio2_OutputStreamClass_splice_finish(GOutputStream*, GAsyncResult*, GError**); +// extern gssize _gotk4_gio2_OutputStreamClass_splice(GOutputStream*, GInputStream*, GOutputStreamSpliceFlags, GCancellable*, GError**); +// extern gssize _gotk4_gio2_InputStreamClass_skip_finish(GInputStream*, GAsyncResult*, GError**); +// extern gssize _gotk4_gio2_InputStreamClass_skip(GInputStream*, gsize, GCancellable*, GError**); +// extern gssize _gotk4_gio2_InputStreamClass_read_finish(GInputStream*, GAsyncResult*, GError**); +// extern gssize _gotk4_gio2_BufferedInputStreamClass_fill_finish(GBufferedInputStream*, GAsyncResult*, GError**); +// extern gssize _gotk4_gio2_BufferedInputStreamClass_fill(GBufferedInputStream*, gssize, GCancellable*, GError**); +// extern gsize _gotk4_gio2_SocketControlMessageClass_get_size(GSocketControlMessage*); +// extern goffset _gotk4_gio2_FileOutputStreamClass_tell(GFileOutputStream*); +// extern goffset _gotk4_gio2_FileInputStreamClass_tell(GFileInputStream*); +// extern goffset _gotk4_gio2_FileIOStreamClass_tell(GFileIOStream*); +// extern gint _gotk4_glib2_CompareDataFunc(gconstpointer, gconstpointer, gpointer); +// extern gint _gotk4_gio2_MenuModelClass_get_n_items(GMenuModel*); +// extern gint _gotk4_gio2_CompareDataFunc(gconstpointer, gconstpointer, gpointer); +// extern gint _gotk4_gio2_Application_ConnectHandleLocalOptions(gpointer, GVariantDict*, guintptr); +// extern gint _gotk4_gio2_Application_ConnectCommandLine(gpointer, GApplicationCommandLine*, guintptr); +// extern gint _gotk4_gio2_ApplicationClass_handle_local_options(GApplication*, GVariantDict*); +// extern gchar** _gotk4_gio2_VfsClass_get_supported_uri_schemes(GVfs*); +// extern gchar* _gotk4_gio2_TlsPasswordClass_get_default_warning(GTlsPassword*); +// extern gchar* _gotk4_gio2_TlsDatabaseClass_create_certificate_handle(GTlsDatabase*, GTlsCertificate*); +// extern gchar* _gotk4_gio2_TlsConnectionClass_get_negotiated_protocol(GTlsConnection*); +// extern gchar* _gotk4_gio2_ResolverClass_lookup_by_address_finish(GResolver*, GAsyncResult*, GError**); +// extern gchar* _gotk4_gio2_ResolverClass_lookup_by_address(GResolver*, GInetAddress*, GCancellable*, GError**); +// extern gchar* _gotk4_gio2_InetAddressClass_to_string(GInetAddress*); +// extern gboolean _gotk4_glib2_EqualFuncFull(gconstpointer, gconstpointer, gpointer); +// extern gboolean _gotk4_gio2_VfsClass_local_file_set_attributes(GVfs*, char*, GFileInfo*, GFileQueryInfoFlags, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_VfsClass_is_active(GVfs*); +// extern gboolean _gotk4_gio2_TlsConnection_ConnectAcceptCertificate(gpointer, GTlsCertificate*, GTlsCertificateFlags, guintptr); +// extern gboolean _gotk4_gio2_TlsConnectionClass_handshake_finish(GTlsConnection*, GAsyncResult*, GError**); +// extern gboolean _gotk4_gio2_TlsConnectionClass_handshake(GTlsConnection*, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_TlsConnectionClass_get_binding_data(GTlsConnection*, GTlsChannelBindingType, GByteArray*, GError**); +// extern gboolean _gotk4_gio2_TlsConnectionClass_accept_certificate(GTlsConnection*, GTlsCertificate*, GTlsCertificateFlags); +// extern gboolean _gotk4_gio2_ThreadedSocketService_ConnectRun(gpointer, GSocketConnection*, GObject*, guintptr); +// extern gboolean _gotk4_gio2_ThreadedSocketServiceClass_run(GThreadedSocketService*, GSocketConnection*, GObject*); +// extern gboolean _gotk4_gio2_SocketService_ConnectIncoming(gpointer, GSocketConnection*, GObject*, guintptr); +// extern gboolean _gotk4_gio2_SocketServiceClass_incoming(GSocketService*, GSocketConnection*, GObject*); +// extern gboolean _gotk4_gio2_SocketAddressClass_to_native(GSocketAddress*, gpointer, gsize, GError**); +// extern gboolean _gotk4_gio2_Settings_ConnectWritableChangeEvent(gpointer, guint, guintptr); +// extern gboolean _gotk4_gio2_Settings_ConnectChangeEvent(gpointer, gpointer, gint, guintptr); +// extern gboolean _gotk4_gio2_SettingsGetMapping(GVariant*, gpointer*, gpointer); +// extern gboolean _gotk4_gio2_SettingsClass_writable_change_event(GSettings*, GQuark); +// extern gboolean _gotk4_gio2_SettingsClass_change_event(GSettings*, GQuark*, gint); +// extern gboolean _gotk4_gio2_PermissionClass_release_finish(GPermission*, GAsyncResult*, GError**); +// extern gboolean _gotk4_gio2_PermissionClass_release(GPermission*, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_PermissionClass_acquire_finish(GPermission*, GAsyncResult*, GError**); +// extern gboolean _gotk4_gio2_PermissionClass_acquire(GPermission*, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_OutputStreamClass_writev_finish(GOutputStream*, GAsyncResult*, gsize*, GError**); +// extern gboolean _gotk4_gio2_OutputStreamClass_flush_finish(GOutputStream*, GAsyncResult*, GError**); +// extern gboolean _gotk4_gio2_OutputStreamClass_flush(GOutputStream*, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_OutputStreamClass_close_fn(GOutputStream*, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_OutputStreamClass_close_finish(GOutputStream*, GAsyncResult*, GError**); +// extern gboolean _gotk4_gio2_MenuModelClass_is_mutable(GMenuModel*); +// extern gboolean _gotk4_gio2_MenuLinkIterClass_get_next(GMenuLinkIter*, gchar**, GMenuModel**); +// extern gboolean _gotk4_gio2_MenuAttributeIterClass_get_next(GMenuAttributeIter*, gchar**, GVariant**); +// extern gboolean _gotk4_gio2_InputStreamClass_close_fn(GInputStream*, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_InputStreamClass_close_finish(GInputStream*, GAsyncResult*, GError**); +// extern gboolean _gotk4_gio2_IOStreamClass_close_fn(GIOStream*, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_IOStreamClass_close_finish(GIOStream*, GAsyncResult*, GError**); +// extern gboolean _gotk4_gio2_FileOutputStreamClass_truncate_fn(GFileOutputStream*, goffset, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_FileOutputStreamClass_seek(GFileOutputStream*, goffset, GSeekType, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_FileOutputStreamClass_can_truncate(GFileOutputStream*); +// extern gboolean _gotk4_gio2_FileOutputStreamClass_can_seek(GFileOutputStream*); +// extern gboolean _gotk4_gio2_FileMonitorClass_cancel(GFileMonitor*); +// extern gboolean _gotk4_gio2_FileInputStreamClass_seek(GFileInputStream*, goffset, GSeekType, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_FileInputStreamClass_can_seek(GFileInputStream*); +// extern gboolean _gotk4_gio2_FileIOStreamClass_truncate_fn(GFileIOStream*, goffset, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_FileIOStreamClass_seek(GFileIOStream*, goffset, GSeekType, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_FileIOStreamClass_can_truncate(GFileIOStream*); +// extern gboolean _gotk4_gio2_FileIOStreamClass_can_seek(GFileIOStream*); +// extern gboolean _gotk4_gio2_FileEnumeratorClass_close_fn(GFileEnumerator*, GCancellable*, GError**); +// extern gboolean _gotk4_gio2_FileEnumeratorClass_close_finish(GFileEnumerator*, GAsyncResult*, GError**); +// extern gboolean _gotk4_gio2_EqualFuncFull(gconstpointer, gconstpointer, gpointer); +// extern gboolean _gotk4_gio2_DtlsConnection_ConnectAcceptCertificate(gpointer, GTlsCertificate*, GTlsCertificateFlags, guintptr); +// extern gboolean _gotk4_gio2_DebugControllerDBus_ConnectAuthorize(gpointer, GDBusMethodInvocation*, guintptr); +// extern gboolean _gotk4_gio2_DebugControllerDBusClass_authorize(GDebugControllerDBus*, GDBusMethodInvocation*); +// extern gboolean _gotk4_gio2_DBusServer_ConnectNewConnection(gpointer, GDBusConnection*, guintptr); +// extern gboolean _gotk4_gio2_DBusObjectSkeleton_ConnectAuthorizeMethod(gpointer, GDBusInterfaceSkeleton*, GDBusMethodInvocation*, guintptr); +// extern gboolean _gotk4_gio2_DBusObjectSkeletonClass_authorize_method(GDBusObjectSkeleton*, GDBusInterfaceSkeleton*, GDBusMethodInvocation*); +// extern gboolean _gotk4_gio2_DBusInterfaceSkeleton_ConnectGAuthorizeMethod(gpointer, GDBusMethodInvocation*, guintptr); +// extern gboolean _gotk4_gio2_DBusInterfaceSkeletonClass_g_authorize_method(GDBusInterfaceSkeleton*, GDBusMethodInvocation*); +// extern gboolean _gotk4_gio2_DBusAuthObserver_ConnectAuthorizeAuthenticatedPeer(gpointer, GIOStream*, GCredentials*, guintptr); +// extern gboolean _gotk4_gio2_DBusAuthObserver_ConnectAllowMechanism(gpointer, gchar*, guintptr); +// extern gboolean _gotk4_gio2_Application_ConnectNameLost(gpointer, guintptr); +// extern gboolean _gotk4_gio2_ApplicationClass_name_lost(GApplication*); +// extern gboolean _gotk4_gio2_ApplicationClass_dbus_register(GApplication*, GDBusConnection*, gchar*, GError**); +// extern char* _gotk4_gio2_FileOutputStreamClass_get_etag(GFileOutputStream*); +// extern char* _gotk4_gio2_FileIOStreamClass_get_etag(GFileIOStream*); +// extern char* _gotk4_gio2_AppLaunchContextClass_get_startup_notify_id(GAppLaunchContext*, GAppInfo*, GList*); +// extern char* _gotk4_gio2_AppLaunchContextClass_get_display(GAppLaunchContext*, GAppInfo*, GList*); +// extern GVolume* _gotk4_gio2_VolumeMonitorClass_get_volume_for_uuid(GVolumeMonitor*, char*); +// extern GVariant* _gotk4_gio2_MenuModelClass_get_item_attribute_value(GMenuModel*, gint, gchar*, GVariantType*); +// extern GVariant* _gotk4_gio2_DBusInterfaceSkeletonClass_get_properties(GDBusInterfaceSkeleton*); +// extern GTlsInteractionResult _gotk4_gio2_TlsInteractionClass_request_certificate_finish(GTlsInteraction*, GAsyncResult*, GError**); +// extern GTlsInteractionResult _gotk4_gio2_TlsInteractionClass_request_certificate(GTlsInteraction*, GTlsConnection*, GTlsCertificateRequestFlags, GCancellable*, GError**); +// extern GTlsInteractionResult _gotk4_gio2_TlsInteractionClass_ask_password_finish(GTlsInteraction*, GAsyncResult*, GError**); +// extern GTlsInteractionResult _gotk4_gio2_TlsInteractionClass_ask_password(GTlsInteraction*, GTlsPassword*, GCancellable*, GError**); +// extern GTlsCertificateFlags _gotk4_gio2_TlsDatabaseClass_verify_chain_finish(GTlsDatabase*, GAsyncResult*, GError**); +// extern GTlsCertificateFlags _gotk4_gio2_TlsDatabaseClass_verify_chain(GTlsDatabase*, GTlsCertificate*, gchar*, GSocketConnectable*, GTlsInteraction*, GTlsDatabaseVerifyFlags, GCancellable*, GError**); +// extern GTlsCertificateFlags _gotk4_gio2_TlsCertificateClass_verify(GTlsCertificate*, GSocketConnectable*, GTlsCertificate*); +// extern GTlsCertificate* _gotk4_gio2_TlsDatabaseClass_lookup_certificate_issuer_finish(GTlsDatabase*, GAsyncResult*, GError**); +// extern GTlsCertificate* _gotk4_gio2_TlsDatabaseClass_lookup_certificate_issuer(GTlsDatabase*, GTlsCertificate*, GTlsInteraction*, GTlsDatabaseLookupFlags, GCancellable*, GError**); +// extern GTlsCertificate* _gotk4_gio2_TlsDatabaseClass_lookup_certificate_for_handle_finish(GTlsDatabase*, GAsyncResult*, GError**); +// extern GTlsCertificate* _gotk4_gio2_TlsDatabaseClass_lookup_certificate_for_handle(GTlsDatabase*, gchar*, GTlsInteraction*, GTlsDatabaseLookupFlags, GCancellable*, GError**); +// extern GSocketFamily _gotk4_gio2_SocketAddressClass_get_family(GSocketAddress*); +// extern GSocketAddress* _gotk4_gio2_SocketAddressEnumeratorClass_next_finish(GSocketAddressEnumerator*, GAsyncResult*, GError**); +// extern GSocketAddress* _gotk4_gio2_SocketAddressEnumeratorClass_next(GSocketAddressEnumerator*, GCancellable*, GError**); +// extern GOutputStream* _gotk4_gio2_IOStreamClass_get_output_stream(GIOStream*); +// extern GMount* _gotk4_gio2_VolumeMonitorClass_get_mount_for_uuid(GVolumeMonitor*, char*); +// extern GMenuModel* _gotk4_gio2_MenuModelClass_get_item_link(GMenuModel*, gint, gchar*); +// extern GMenuLinkIter* _gotk4_gio2_MenuModelClass_iterate_item_links(GMenuModel*, gint); +// extern GMenuAttributeIter* _gotk4_gio2_MenuModelClass_iterate_item_attributes(GMenuModel*, gint); +// extern GList* _gotk4_gio2_VolumeMonitorClass_get_volumes(GVolumeMonitor*); +// extern GList* _gotk4_gio2_VolumeMonitorClass_get_mounts(GVolumeMonitor*); +// extern GList* _gotk4_gio2_VolumeMonitorClass_get_connected_drives(GVolumeMonitor*); +// extern GList* _gotk4_gio2_TlsDatabaseClass_lookup_certificates_issued_by_finish(GTlsDatabase*, GAsyncResult*, GError**); +// extern GList* _gotk4_gio2_TlsDatabaseClass_lookup_certificates_issued_by(GTlsDatabase*, GByteArray*, GTlsInteraction*, GTlsDatabaseLookupFlags, GCancellable*, GError**); +// extern GList* _gotk4_gio2_ResolverClass_lookup_service_finish(GResolver*, GAsyncResult*, GError**); +// extern GList* _gotk4_gio2_ResolverClass_lookup_records_finish(GResolver*, GAsyncResult*, GError**); +// extern GList* _gotk4_gio2_ResolverClass_lookup_records(GResolver*, gchar*, GResolverRecordType, GCancellable*, GError**); +// extern GList* _gotk4_gio2_ResolverClass_lookup_by_name_with_flags_finish(GResolver*, GAsyncResult*, GError**); +// extern GList* _gotk4_gio2_ResolverClass_lookup_by_name_with_flags(GResolver*, gchar*, GResolverNameLookupFlags, GCancellable*, GError**); +// extern GList* _gotk4_gio2_ResolverClass_lookup_by_name_finish(GResolver*, GAsyncResult*, GError**); +// extern GList* _gotk4_gio2_ResolverClass_lookup_by_name(GResolver*, gchar*, GCancellable*, GError**); +// extern GList* _gotk4_gio2_FileEnumeratorClass_next_files_finish(GFileEnumerator*, GAsyncResult*, GError**); +// extern GInputStream* _gotk4_gio2_IOStreamClass_get_input_stream(GIOStream*); +// extern GInputStream* _gotk4_gio2_ApplicationCommandLineClass_get_stdin(GApplicationCommandLine*); +// extern GFileInfo* _gotk4_gio2_FileOutputStreamClass_query_info_finish(GFileOutputStream*, GAsyncResult*, GError**); +// extern GFileInfo* _gotk4_gio2_FileOutputStreamClass_query_info(GFileOutputStream*, char*, GCancellable*, GError**); +// extern GFileInfo* _gotk4_gio2_FileInputStreamClass_query_info_finish(GFileInputStream*, GAsyncResult*, GError**); +// extern GFileInfo* _gotk4_gio2_FileInputStreamClass_query_info(GFileInputStream*, char*, GCancellable*, GError**); +// extern GFileInfo* _gotk4_gio2_FileIOStreamClass_query_info_finish(GFileIOStream*, GAsyncResult*, GError**); +// extern GFileInfo* _gotk4_gio2_FileIOStreamClass_query_info(GFileIOStream*, char*, GCancellable*, GError**); +// extern GFileInfo* _gotk4_gio2_FileEnumeratorClass_next_file(GFileEnumerator*, GCancellable*, GError**); +// extern GFile* _gotk4_gio2_VfsClass_parse_name(GVfs*, char*); +// extern GFile* _gotk4_gio2_VfsClass_get_file_for_uri(GVfs*, char*); +// extern GFile* _gotk4_gio2_VfsClass_get_file_for_path(GVfs*, char*); +// extern GFile* _gotk4_gio2_VFSFileLookupFunc(GVfs*, char*, gpointer); +// extern GDBusMessage* _gotk4_gio2_DBusMessageFilterFunction(GDBusConnection*, GDBusMessage*, gboolean, gpointer); +// extern GDBusInterfaceVTable* _gotk4_gio2_DBusInterfaceSkeletonClass_get_vtable(GDBusInterfaceSkeleton*); +// extern GDBusInterfaceInfo* _gotk4_gio2_DBusInterfaceSkeletonClass_get_info(GDBusInterfaceSkeleton*); +// GAction* _gotk4_gio2_ActionMap_virtual_lookup_action(void* fnptr, GActionMap* arg0, gchar* arg1) { +// return ((GAction* (*)(GActionMap*, gchar*))(fnptr))(arg0, arg1); +// }; +// GAppInfo* _gotk4_gio2_AppInfo_virtual_dup(void* fnptr, GAppInfo* arg0) { +// return ((GAppInfo* (*)(GAppInfo*))(fnptr))(arg0); +// }; +// GConverterResult _gotk4_gio2_Converter_virtual_convert(void* fnptr, GConverter* arg0, void* arg1, gsize arg2, void* arg3, gsize arg4, GConverterFlags arg5, gsize* arg6, gsize* arg7, GError** arg8) { +// return ((GConverterResult (*)(GConverter*, void*, gsize, void*, gsize, GConverterFlags, gsize*, gsize*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); +// }; +// GDBusInterface* _gotk4_gio2_DBusObjectManager_virtual_get_interface(void* fnptr, GDBusObjectManager* arg0, gchar* arg1, gchar* arg2) { +// return ((GDBusInterface* (*)(GDBusObjectManager*, gchar*, gchar*))(fnptr))(arg0, arg1, arg2); +// }; +// GDBusInterface* _gotk4_gio2_DBusObject_virtual_get_interface(void* fnptr, GDBusObject* arg0, gchar* arg1) { +// return ((GDBusInterface* (*)(GDBusObject*, gchar*))(fnptr))(arg0, arg1); +// }; +// GDBusInterfaceInfo* _gotk4_gio2_DBusInterfaceSkeleton_virtual_get_info(void* fnptr, GDBusInterfaceSkeleton* arg0) { +// return ((GDBusInterfaceInfo* (*)(GDBusInterfaceSkeleton*))(fnptr))(arg0); +// }; +// GDBusInterfaceInfo* _gotk4_gio2_DBusInterface_virtual_get_info(void* fnptr, GDBusInterface* arg0) { +// return ((GDBusInterfaceInfo* (*)(GDBusInterface*))(fnptr))(arg0); +// }; +// GDBusInterfaceVTable* _gotk4_gio2_DBusInterfaceSkeleton_virtual_get_vtable(void* fnptr, GDBusInterfaceSkeleton* arg0) { +// return ((GDBusInterfaceVTable* (*)(GDBusInterfaceSkeleton*))(fnptr))(arg0); +// }; +// GDBusObject* _gotk4_gio2_DBusInterface_virtual_dup_object(void* fnptr, GDBusInterface* arg0) { +// return ((GDBusObject* (*)(GDBusInterface*))(fnptr))(arg0); +// }; +// GDBusObject* _gotk4_gio2_DBusObjectManager_virtual_get_object(void* fnptr, GDBusObjectManager* arg0, gchar* arg1) { +// return ((GDBusObject* (*)(GDBusObjectManager*, gchar*))(fnptr))(arg0, arg1); +// }; +// GDrive* _gotk4_gio2_Mount_virtual_get_drive(void* fnptr, GMount* arg0) { +// return ((GDrive* (*)(GMount*))(fnptr))(arg0); +// }; +// GDrive* _gotk4_gio2_Volume_virtual_get_drive(void* fnptr, GVolume* arg0) { +// return ((GDrive* (*)(GVolume*))(fnptr))(arg0); +// }; +// GDriveStartStopType _gotk4_gio2_Drive_virtual_get_start_stop_type(void* fnptr, GDrive* arg0) { +// return ((GDriveStartStopType (*)(GDrive*))(fnptr))(arg0); +// }; +// GFile* _gotk4_gio2_File_virtual_dup(void* fnptr, GFile* arg0) { +// return ((GFile* (*)(GFile*))(fnptr))(arg0); +// }; +// GFile* _gotk4_gio2_File_virtual_get_child_for_display_name(void* fnptr, GFile* arg0, char* arg1, GError** arg2) { +// return ((GFile* (*)(GFile*, char*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFile* _gotk4_gio2_File_virtual_get_parent(void* fnptr, GFile* arg0) { +// return ((GFile* (*)(GFile*))(fnptr))(arg0); +// }; +// GFile* _gotk4_gio2_File_virtual_mount_mountable_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFile* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFile* _gotk4_gio2_File_virtual_resolve_relative_path(void* fnptr, GFile* arg0, char* arg1) { +// return ((GFile* (*)(GFile*, char*))(fnptr))(arg0, arg1); +// }; +// GFile* _gotk4_gio2_File_virtual_set_display_name(void* fnptr, GFile* arg0, char* arg1, GCancellable* arg2, GError** arg3) { +// return ((GFile* (*)(GFile*, char*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFile* _gotk4_gio2_File_virtual_set_display_name_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFile* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFile* _gotk4_gio2_Mount_virtual_get_default_location(void* fnptr, GMount* arg0) { +// return ((GFile* (*)(GMount*))(fnptr))(arg0); +// }; +// GFile* _gotk4_gio2_Mount_virtual_get_root(void* fnptr, GMount* arg0) { +// return ((GFile* (*)(GMount*))(fnptr))(arg0); +// }; +// GFile* _gotk4_gio2_VFS_virtual_get_file_for_path(void* fnptr, GVfs* arg0, char* arg1) { +// return ((GFile* (*)(GVfs*, char*))(fnptr))(arg0, arg1); +// }; +// GFile* _gotk4_gio2_VFS_virtual_get_file_for_uri(void* fnptr, GVfs* arg0, char* arg1) { +// return ((GFile* (*)(GVfs*, char*))(fnptr))(arg0, arg1); +// }; +// GFile* _gotk4_gio2_VFS_virtual_parse_name(void* fnptr, GVfs* arg0, char* arg1) { +// return ((GFile* (*)(GVfs*, char*))(fnptr))(arg0, arg1); +// }; +// GFile* _gotk4_gio2_Volume_virtual_get_activation_root(void* fnptr, GVolume* arg0) { +// return ((GFile* (*)(GVolume*))(fnptr))(arg0); +// }; +// GFileAttributeInfoList* _gotk4_gio2_File_virtual_query_settable_attributes(void* fnptr, GFile* arg0, GCancellable* arg1, GError** arg2) { +// return ((GFileAttributeInfoList* (*)(GFile*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileAttributeInfoList* _gotk4_gio2_File_virtual_query_writable_namespaces(void* fnptr, GFile* arg0, GCancellable* arg1, GError** arg2) { +// return ((GFileAttributeInfoList* (*)(GFile*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileEnumerator* _gotk4_gio2_File_virtual_enumerate_children(void* fnptr, GFile* arg0, char* arg1, GFileQueryInfoFlags arg2, GCancellable* arg3, GError** arg4) { +// return ((GFileEnumerator* (*)(GFile*, char*, GFileQueryInfoFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// GFileEnumerator* _gotk4_gio2_File_virtual_enumerate_children_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileEnumerator* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileIOStream* _gotk4_gio2_File_virtual_create_readwrite(void* fnptr, GFile* arg0, GFileCreateFlags arg1, GCancellable* arg2, GError** arg3) { +// return ((GFileIOStream* (*)(GFile*, GFileCreateFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFileIOStream* _gotk4_gio2_File_virtual_create_readwrite_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileIOStream* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileIOStream* _gotk4_gio2_File_virtual_open_readwrite(void* fnptr, GFile* arg0, GCancellable* arg1, GError** arg2) { +// return ((GFileIOStream* (*)(GFile*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileIOStream* _gotk4_gio2_File_virtual_open_readwrite_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileIOStream* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileIOStream* _gotk4_gio2_File_virtual_replace_readwrite(void* fnptr, GFile* arg0, char* arg1, gboolean arg2, GFileCreateFlags arg3, GCancellable* arg4, GError** arg5) { +// return ((GFileIOStream* (*)(GFile*, char*, gboolean, GFileCreateFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// GFileIOStream* _gotk4_gio2_File_virtual_replace_readwrite_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileIOStream* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileInfo* _gotk4_gio2_FileEnumerator_virtual_next_file(void* fnptr, GFileEnumerator* arg0, GCancellable* arg1, GError** arg2) { +// return ((GFileInfo* (*)(GFileEnumerator*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileInfo* _gotk4_gio2_FileIOStream_virtual_query_info(void* fnptr, GFileIOStream* arg0, char* arg1, GCancellable* arg2, GError** arg3) { +// return ((GFileInfo* (*)(GFileIOStream*, char*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFileInfo* _gotk4_gio2_FileIOStream_virtual_query_info_finish(void* fnptr, GFileIOStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileInfo* (*)(GFileIOStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileInfo* _gotk4_gio2_FileInputStream_virtual_query_info(void* fnptr, GFileInputStream* arg0, char* arg1, GCancellable* arg2, GError** arg3) { +// return ((GFileInfo* (*)(GFileInputStream*, char*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFileInfo* _gotk4_gio2_FileInputStream_virtual_query_info_finish(void* fnptr, GFileInputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileInfo* (*)(GFileInputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileInfo* _gotk4_gio2_FileOutputStream_virtual_query_info(void* fnptr, GFileOutputStream* arg0, char* arg1, GCancellable* arg2, GError** arg3) { +// return ((GFileInfo* (*)(GFileOutputStream*, char*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFileInfo* _gotk4_gio2_FileOutputStream_virtual_query_info_finish(void* fnptr, GFileOutputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileInfo* (*)(GFileOutputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileInfo* _gotk4_gio2_File_virtual_query_filesystem_info(void* fnptr, GFile* arg0, char* arg1, GCancellable* arg2, GError** arg3) { +// return ((GFileInfo* (*)(GFile*, char*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFileInfo* _gotk4_gio2_File_virtual_query_filesystem_info_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileInfo* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileInfo* _gotk4_gio2_File_virtual_query_info(void* fnptr, GFile* arg0, char* arg1, GFileQueryInfoFlags arg2, GCancellable* arg3, GError** arg4) { +// return ((GFileInfo* (*)(GFile*, char*, GFileQueryInfoFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// GFileInfo* _gotk4_gio2_File_virtual_query_info_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileInfo* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileInputStream* _gotk4_gio2_File_virtual_read_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileInputStream* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileInputStream* _gotk4_gio2_File_virtual_read_fn(void* fnptr, GFile* arg0, GCancellable* arg1, GError** arg2) { +// return ((GFileInputStream* (*)(GFile*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileMonitor* _gotk4_gio2_File_virtual_monitor_dir(void* fnptr, GFile* arg0, GFileMonitorFlags arg1, GCancellable* arg2, GError** arg3) { +// return ((GFileMonitor* (*)(GFile*, GFileMonitorFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFileMonitor* _gotk4_gio2_File_virtual_monitor_file(void* fnptr, GFile* arg0, GFileMonitorFlags arg1, GCancellable* arg2, GError** arg3) { +// return ((GFileMonitor* (*)(GFile*, GFileMonitorFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFileOutputStream* _gotk4_gio2_File_virtual_append_to(void* fnptr, GFile* arg0, GFileCreateFlags arg1, GCancellable* arg2, GError** arg3) { +// return ((GFileOutputStream* (*)(GFile*, GFileCreateFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFileOutputStream* _gotk4_gio2_File_virtual_append_to_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileOutputStream* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileOutputStream* _gotk4_gio2_File_virtual_create(void* fnptr, GFile* arg0, GFileCreateFlags arg1, GCancellable* arg2, GError** arg3) { +// return ((GFileOutputStream* (*)(GFile*, GFileCreateFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GFileOutputStream* _gotk4_gio2_File_virtual_create_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileOutputStream* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GFileOutputStream* _gotk4_gio2_File_virtual_replace(void* fnptr, GFile* arg0, char* arg1, gboolean arg2, GFileCreateFlags arg3, GCancellable* arg4, GError** arg5) { +// return ((GFileOutputStream* (*)(GFile*, char*, gboolean, GFileCreateFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// GFileOutputStream* _gotk4_gio2_File_virtual_replace_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GFileOutputStream* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GIOCondition _gotk4_gio2_DatagramBased_virtual_condition_check(void* fnptr, GDatagramBased* arg0, GIOCondition arg1) { +// return ((GIOCondition (*)(GDatagramBased*, GIOCondition))(fnptr))(arg0, arg1); +// }; +// GIOStream* _gotk4_gio2_Proxy_virtual_connect(void* fnptr, GProxy* arg0, GIOStream* arg1, GProxyAddress* arg2, GCancellable* arg3, GError** arg4) { +// return ((GIOStream* (*)(GProxy*, GIOStream*, GProxyAddress*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// GIOStream* _gotk4_gio2_Proxy_virtual_connect_finish(void* fnptr, GProxy* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GIOStream* (*)(GProxy*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GIcon* _gotk4_gio2_AppInfo_virtual_get_icon(void* fnptr, GAppInfo* arg0) { +// return ((GIcon* (*)(GAppInfo*))(fnptr))(arg0); +// }; +// GIcon* _gotk4_gio2_Drive_virtual_get_icon(void* fnptr, GDrive* arg0) { +// return ((GIcon* (*)(GDrive*))(fnptr))(arg0); +// }; +// GIcon* _gotk4_gio2_Drive_virtual_get_symbolic_icon(void* fnptr, GDrive* arg0) { +// return ((GIcon* (*)(GDrive*))(fnptr))(arg0); +// }; +// GIcon* _gotk4_gio2_Mount_virtual_get_icon(void* fnptr, GMount* arg0) { +// return ((GIcon* (*)(GMount*))(fnptr))(arg0); +// }; +// GIcon* _gotk4_gio2_Mount_virtual_get_symbolic_icon(void* fnptr, GMount* arg0) { +// return ((GIcon* (*)(GMount*))(fnptr))(arg0); +// }; +// GIcon* _gotk4_gio2_Volume_virtual_get_icon(void* fnptr, GVolume* arg0) { +// return ((GIcon* (*)(GVolume*))(fnptr))(arg0); +// }; +// GIcon* _gotk4_gio2_Volume_virtual_get_symbolic_icon(void* fnptr, GVolume* arg0) { +// return ((GIcon* (*)(GVolume*))(fnptr))(arg0); +// }; +// GInputStream* _gotk4_gio2_ApplicationCommandLine_virtual_get_stdin(void* fnptr, GApplicationCommandLine* arg0) { +// return ((GInputStream* (*)(GApplicationCommandLine*))(fnptr))(arg0); +// }; +// GInputStream* _gotk4_gio2_IOStream_virtual_get_input_stream(void* fnptr, GIOStream* arg0) { +// return ((GInputStream* (*)(GIOStream*))(fnptr))(arg0); +// }; +// GInputStream* _gotk4_gio2_LoadableIcon_virtual_load(void* fnptr, GLoadableIcon* arg0, int arg1, char** arg2, GCancellable* arg3, GError** arg4) { +// return ((GInputStream* (*)(GLoadableIcon*, int, char**, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// GInputStream* _gotk4_gio2_LoadableIcon_virtual_load_finish(void* fnptr, GLoadableIcon* arg0, GAsyncResult* arg1, char** arg2, GError** arg3) { +// return ((GInputStream* (*)(GLoadableIcon*, GAsyncResult*, char**, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GList* _gotk4_gio2_DBusObjectManager_virtual_get_objects(void* fnptr, GDBusObjectManager* arg0) { +// return ((GList* (*)(GDBusObjectManager*))(fnptr))(arg0); +// }; +// GList* _gotk4_gio2_DBusObject_virtual_get_interfaces(void* fnptr, GDBusObject* arg0) { +// return ((GList* (*)(GDBusObject*))(fnptr))(arg0); +// }; +// GList* _gotk4_gio2_Drive_virtual_get_volumes(void* fnptr, GDrive* arg0) { +// return ((GList* (*)(GDrive*))(fnptr))(arg0); +// }; +// GList* _gotk4_gio2_FileEnumerator_virtual_next_files_finish(void* fnptr, GFileEnumerator* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GList* (*)(GFileEnumerator*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GList* _gotk4_gio2_Resolver_virtual_lookup_by_name(void* fnptr, GResolver* arg0, gchar* arg1, GCancellable* arg2, GError** arg3) { +// return ((GList* (*)(GResolver*, gchar*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GList* _gotk4_gio2_Resolver_virtual_lookup_by_name_finish(void* fnptr, GResolver* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GList* (*)(GResolver*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GList* _gotk4_gio2_Resolver_virtual_lookup_by_name_with_flags(void* fnptr, GResolver* arg0, gchar* arg1, GResolverNameLookupFlags arg2, GCancellable* arg3, GError** arg4) { +// return ((GList* (*)(GResolver*, gchar*, GResolverNameLookupFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// GList* _gotk4_gio2_Resolver_virtual_lookup_by_name_with_flags_finish(void* fnptr, GResolver* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GList* (*)(GResolver*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GList* _gotk4_gio2_Resolver_virtual_lookup_records(void* fnptr, GResolver* arg0, gchar* arg1, GResolverRecordType arg2, GCancellable* arg3, GError** arg4) { +// return ((GList* (*)(GResolver*, gchar*, GResolverRecordType, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// GList* _gotk4_gio2_Resolver_virtual_lookup_records_finish(void* fnptr, GResolver* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GList* (*)(GResolver*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GList* _gotk4_gio2_Resolver_virtual_lookup_service_finish(void* fnptr, GResolver* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GList* (*)(GResolver*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GList* _gotk4_gio2_TLSDatabase_virtual_lookup_certificates_issued_by(void* fnptr, GTlsDatabase* arg0, GByteArray* arg1, GTlsInteraction* arg2, GTlsDatabaseLookupFlags arg3, GCancellable* arg4, GError** arg5) { +// return ((GList* (*)(GTlsDatabase*, GByteArray*, GTlsInteraction*, GTlsDatabaseLookupFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// GList* _gotk4_gio2_TLSDatabase_virtual_lookup_certificates_issued_by_finish(void* fnptr, GTlsDatabase* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GList* (*)(GTlsDatabase*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GList* _gotk4_gio2_VolumeMonitor_virtual_get_connected_drives(void* fnptr, GVolumeMonitor* arg0) { +// return ((GList* (*)(GVolumeMonitor*))(fnptr))(arg0); +// }; +// GList* _gotk4_gio2_VolumeMonitor_virtual_get_mounts(void* fnptr, GVolumeMonitor* arg0) { +// return ((GList* (*)(GVolumeMonitor*))(fnptr))(arg0); +// }; +// GList* _gotk4_gio2_VolumeMonitor_virtual_get_volumes(void* fnptr, GVolumeMonitor* arg0) { +// return ((GList* (*)(GVolumeMonitor*))(fnptr))(arg0); +// }; +// GMenuAttributeIter* _gotk4_gio2_MenuModel_virtual_iterate_item_attributes(void* fnptr, GMenuModel* arg0, gint arg1) { +// return ((GMenuAttributeIter* (*)(GMenuModel*, gint))(fnptr))(arg0, arg1); +// }; +// GMenuLinkIter* _gotk4_gio2_MenuModel_virtual_iterate_item_links(void* fnptr, GMenuModel* arg0, gint arg1) { +// return ((GMenuLinkIter* (*)(GMenuModel*, gint))(fnptr))(arg0, arg1); +// }; +// GMenuModel* _gotk4_gio2_MenuModel_virtual_get_item_link(void* fnptr, GMenuModel* arg0, gint arg1, gchar* arg2) { +// return ((GMenuModel* (*)(GMenuModel*, gint, gchar*))(fnptr))(arg0, arg1, arg2); +// }; +// GMount* _gotk4_gio2_File_virtual_find_enclosing_mount(void* fnptr, GFile* arg0, GCancellable* arg1, GError** arg2) { +// return ((GMount* (*)(GFile*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GMount* _gotk4_gio2_File_virtual_find_enclosing_mount_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GMount* (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GMount* _gotk4_gio2_VolumeMonitor_virtual_get_mount_for_uuid(void* fnptr, GVolumeMonitor* arg0, char* arg1) { +// return ((GMount* (*)(GVolumeMonitor*, char*))(fnptr))(arg0, arg1); +// }; +// GMount* _gotk4_gio2_Volume_virtual_get_mount(void* fnptr, GVolume* arg0) { +// return ((GMount* (*)(GVolume*))(fnptr))(arg0); +// }; +// GObject* _gotk4_gio2_AsyncResult_virtual_get_source_object(void* fnptr, GAsyncResult* arg0) { +// return ((GObject* (*)(GAsyncResult*))(fnptr))(arg0); +// }; +// GOutputStream* _gotk4_gio2_IOStream_virtual_get_output_stream(void* fnptr, GIOStream* arg0) { +// return ((GOutputStream* (*)(GIOStream*))(fnptr))(arg0); +// }; +// GPollableReturn _gotk4_gio2_PollableOutputStream_virtual_writev_nonblocking(void* fnptr, GPollableOutputStream* arg0, GOutputVector* arg1, gsize arg2, gsize* arg3, GError** arg4) { +// return ((GPollableReturn (*)(GPollableOutputStream*, GOutputVector*, gsize, gsize*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// GSocketAddress* _gotk4_gio2_SocketAddressEnumerator_virtual_next(void* fnptr, GSocketAddressEnumerator* arg0, GCancellable* arg1, GError** arg2) { +// return ((GSocketAddress* (*)(GSocketAddressEnumerator*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GSocketAddress* _gotk4_gio2_SocketAddressEnumerator_virtual_next_finish(void* fnptr, GSocketAddressEnumerator* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GSocketAddress* (*)(GSocketAddressEnumerator*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GSocketAddressEnumerator* _gotk4_gio2_SocketConnectable_virtual_enumerate(void* fnptr, GSocketConnectable* arg0) { +// return ((GSocketAddressEnumerator* (*)(GSocketConnectable*))(fnptr))(arg0); +// }; +// GSocketAddressEnumerator* _gotk4_gio2_SocketConnectable_virtual_proxy_enumerate(void* fnptr, GSocketConnectable* arg0) { +// return ((GSocketAddressEnumerator* (*)(GSocketConnectable*))(fnptr))(arg0); +// }; +// GSocketFamily _gotk4_gio2_SocketAddress_virtual_get_family(void* fnptr, GSocketAddress* arg0) { +// return ((GSocketFamily (*)(GSocketAddress*))(fnptr))(arg0); +// }; +// GSource* _gotk4_gio2_DatagramBased_virtual_create_source(void* fnptr, GDatagramBased* arg0, GIOCondition arg1, GCancellable* arg2) { +// return ((GSource* (*)(GDatagramBased*, GIOCondition, GCancellable*))(fnptr))(arg0, arg1, arg2); +// }; +// GSource* _gotk4_gio2_PollableInputStream_virtual_create_source(void* fnptr, GPollableInputStream* arg0, GCancellable* arg1) { +// return ((GSource* (*)(GPollableInputStream*, GCancellable*))(fnptr))(arg0, arg1); +// }; +// GSource* _gotk4_gio2_PollableOutputStream_virtual_create_source(void* fnptr, GPollableOutputStream* arg0, GCancellable* arg1) { +// return ((GSource* (*)(GPollableOutputStream*, GCancellable*))(fnptr))(arg0, arg1); +// }; +// GTlsCertificate* _gotk4_gio2_TLSDatabase_virtual_lookup_certificate_for_handle(void* fnptr, GTlsDatabase* arg0, gchar* arg1, GTlsInteraction* arg2, GTlsDatabaseLookupFlags arg3, GCancellable* arg4, GError** arg5) { +// return ((GTlsCertificate* (*)(GTlsDatabase*, gchar*, GTlsInteraction*, GTlsDatabaseLookupFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// GTlsCertificate* _gotk4_gio2_TLSDatabase_virtual_lookup_certificate_for_handle_finish(void* fnptr, GTlsDatabase* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GTlsCertificate* (*)(GTlsDatabase*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GTlsCertificate* _gotk4_gio2_TLSDatabase_virtual_lookup_certificate_issuer(void* fnptr, GTlsDatabase* arg0, GTlsCertificate* arg1, GTlsInteraction* arg2, GTlsDatabaseLookupFlags arg3, GCancellable* arg4, GError** arg5) { +// return ((GTlsCertificate* (*)(GTlsDatabase*, GTlsCertificate*, GTlsInteraction*, GTlsDatabaseLookupFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// GTlsCertificate* _gotk4_gio2_TLSDatabase_virtual_lookup_certificate_issuer_finish(void* fnptr, GTlsDatabase* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GTlsCertificate* (*)(GTlsDatabase*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GTlsCertificateFlags _gotk4_gio2_TLSCertificate_virtual_verify(void* fnptr, GTlsCertificate* arg0, GSocketConnectable* arg1, GTlsCertificate* arg2) { +// return ((GTlsCertificateFlags (*)(GTlsCertificate*, GSocketConnectable*, GTlsCertificate*))(fnptr))(arg0, arg1, arg2); +// }; +// GTlsCertificateFlags _gotk4_gio2_TLSDatabase_virtual_verify_chain(void* fnptr, GTlsDatabase* arg0, GTlsCertificate* arg1, gchar* arg2, GSocketConnectable* arg3, GTlsInteraction* arg4, GTlsDatabaseVerifyFlags arg5, GCancellable* arg6, GError** arg7) { +// return ((GTlsCertificateFlags (*)(GTlsDatabase*, GTlsCertificate*, gchar*, GSocketConnectable*, GTlsInteraction*, GTlsDatabaseVerifyFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); +// }; +// GTlsCertificateFlags _gotk4_gio2_TLSDatabase_virtual_verify_chain_finish(void* fnptr, GTlsDatabase* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GTlsCertificateFlags (*)(GTlsDatabase*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GTlsDatabase* _gotk4_gio2_TLSBackend_virtual_get_default_database(void* fnptr, GTlsBackend* arg0) { +// return ((GTlsDatabase* (*)(GTlsBackend*))(fnptr))(arg0); +// }; +// GTlsInteractionResult _gotk4_gio2_TLSInteraction_virtual_ask_password(void* fnptr, GTlsInteraction* arg0, GTlsPassword* arg1, GCancellable* arg2, GError** arg3) { +// return ((GTlsInteractionResult (*)(GTlsInteraction*, GTlsPassword*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GTlsInteractionResult _gotk4_gio2_TLSInteraction_virtual_ask_password_finish(void* fnptr, GTlsInteraction* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GTlsInteractionResult (*)(GTlsInteraction*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GTlsInteractionResult _gotk4_gio2_TLSInteraction_virtual_request_certificate(void* fnptr, GTlsInteraction* arg0, GTlsConnection* arg1, GTlsCertificateRequestFlags arg2, GCancellable* arg3, GError** arg4) { +// return ((GTlsInteractionResult (*)(GTlsInteraction*, GTlsConnection*, GTlsCertificateRequestFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// GTlsInteractionResult _gotk4_gio2_TLSInteraction_virtual_request_certificate_finish(void* fnptr, GTlsInteraction* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((GTlsInteractionResult (*)(GTlsInteraction*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// GType _gotk4_gio2_ListModel_virtual_get_item_type(void* fnptr, GListModel* arg0) { +// return ((GType (*)(GListModel*))(fnptr))(arg0); +// }; +// GVariant* _gotk4_gio2_ActionGroup_virtual_get_action_state(void* fnptr, GActionGroup* arg0, gchar* arg1) { +// return ((GVariant* (*)(GActionGroup*, gchar*))(fnptr))(arg0, arg1); +// }; +// GVariant* _gotk4_gio2_ActionGroup_virtual_get_action_state_hint(void* fnptr, GActionGroup* arg0, gchar* arg1) { +// return ((GVariant* (*)(GActionGroup*, gchar*))(fnptr))(arg0, arg1); +// }; +// GVariant* _gotk4_gio2_Action_virtual_get_state(void* fnptr, GAction* arg0) { +// return ((GVariant* (*)(GAction*))(fnptr))(arg0); +// }; +// GVariant* _gotk4_gio2_Action_virtual_get_state_hint(void* fnptr, GAction* arg0) { +// return ((GVariant* (*)(GAction*))(fnptr))(arg0); +// }; +// GVariant* _gotk4_gio2_DBusInterfaceSkeleton_virtual_get_properties(void* fnptr, GDBusInterfaceSkeleton* arg0) { +// return ((GVariant* (*)(GDBusInterfaceSkeleton*))(fnptr))(arg0); +// }; +// GVariant* _gotk4_gio2_Icon_virtual_serialize(void* fnptr, GIcon* arg0) { +// return ((GVariant* (*)(GIcon*))(fnptr))(arg0); +// }; +// GVariant* _gotk4_gio2_MenuModel_virtual_get_item_attribute_value(void* fnptr, GMenuModel* arg0, gint arg1, gchar* arg2, GVariantType* arg3) { +// return ((GVariant* (*)(GMenuModel*, gint, gchar*, GVariantType*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// GVariantType* _gotk4_gio2_ActionGroup_virtual_get_action_parameter_type(void* fnptr, GActionGroup* arg0, gchar* arg1) { +// return ((GVariantType* (*)(GActionGroup*, gchar*))(fnptr))(arg0, arg1); +// }; +// GVariantType* _gotk4_gio2_ActionGroup_virtual_get_action_state_type(void* fnptr, GActionGroup* arg0, gchar* arg1) { +// return ((GVariantType* (*)(GActionGroup*, gchar*))(fnptr))(arg0, arg1); +// }; +// GVariantType* _gotk4_gio2_Action_virtual_get_parameter_type(void* fnptr, GAction* arg0) { +// return ((GVariantType* (*)(GAction*))(fnptr))(arg0); +// }; +// GVariantType* _gotk4_gio2_Action_virtual_get_state_type(void* fnptr, GAction* arg0) { +// return ((GVariantType* (*)(GAction*))(fnptr))(arg0); +// }; +// GVolume* _gotk4_gio2_Mount_virtual_get_volume(void* fnptr, GMount* arg0) { +// return ((GVolume* (*)(GMount*))(fnptr))(arg0); +// }; +// GVolume* _gotk4_gio2_VolumeMonitor_virtual_get_volume_for_uuid(void* fnptr, GVolumeMonitor* arg0, char* arg1) { +// return ((GVolume* (*)(GVolumeMonitor*, char*))(fnptr))(arg0, arg1); +// }; +// char* _gotk4_gio2_AppInfo_virtual_get_commandline(void* fnptr, GAppInfo* arg0) { +// return ((char* (*)(GAppInfo*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_AppInfo_virtual_get_description(void* fnptr, GAppInfo* arg0) { +// return ((char* (*)(GAppInfo*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_AppInfo_virtual_get_display_name(void* fnptr, GAppInfo* arg0) { +// return ((char* (*)(GAppInfo*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_AppInfo_virtual_get_executable(void* fnptr, GAppInfo* arg0) { +// return ((char* (*)(GAppInfo*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_AppInfo_virtual_get_id(void* fnptr, GAppInfo* arg0) { +// return ((char* (*)(GAppInfo*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_AppInfo_virtual_get_name(void* fnptr, GAppInfo* arg0) { +// return ((char* (*)(GAppInfo*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_AppLaunchContext_virtual_get_display(void* fnptr, GAppLaunchContext* arg0, GAppInfo* arg1, GList* arg2) { +// return ((char* (*)(GAppLaunchContext*, GAppInfo*, GList*))(fnptr))(arg0, arg1, arg2); +// }; +// char* _gotk4_gio2_AppLaunchContext_virtual_get_startup_notify_id(void* fnptr, GAppLaunchContext* arg0, GAppInfo* arg1, GList* arg2) { +// return ((char* (*)(GAppLaunchContext*, GAppInfo*, GList*))(fnptr))(arg0, arg1, arg2); +// }; +// char* _gotk4_gio2_Drive_virtual_get_identifier(void* fnptr, GDrive* arg0, char* arg1) { +// return ((char* (*)(GDrive*, char*))(fnptr))(arg0, arg1); +// }; +// char* _gotk4_gio2_Drive_virtual_get_name(void* fnptr, GDrive* arg0) { +// return ((char* (*)(GDrive*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_FileIOStream_virtual_get_etag(void* fnptr, GFileIOStream* arg0) { +// return ((char* (*)(GFileIOStream*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_FileOutputStream_virtual_get_etag(void* fnptr, GFileOutputStream* arg0) { +// return ((char* (*)(GFileOutputStream*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_File_virtual_get_basename(void* fnptr, GFile* arg0) { +// return ((char* (*)(GFile*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_File_virtual_get_parse_name(void* fnptr, GFile* arg0) { +// return ((char* (*)(GFile*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_File_virtual_get_path(void* fnptr, GFile* arg0) { +// return ((char* (*)(GFile*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_File_virtual_get_relative_path(void* fnptr, GFile* arg0, GFile* arg1) { +// return ((char* (*)(GFile*, GFile*))(fnptr))(arg0, arg1); +// }; +// char* _gotk4_gio2_File_virtual_get_uri(void* fnptr, GFile* arg0) { +// return ((char* (*)(GFile*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_File_virtual_get_uri_scheme(void* fnptr, GFile* arg0) { +// return ((char* (*)(GFile*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_Mount_virtual_get_name(void* fnptr, GMount* arg0) { +// return ((char* (*)(GMount*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_Mount_virtual_get_uuid(void* fnptr, GMount* arg0) { +// return ((char* (*)(GMount*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_Volume_virtual_get_identifier(void* fnptr, GVolume* arg0, char* arg1) { +// return ((char* (*)(GVolume*, char*))(fnptr))(arg0, arg1); +// }; +// char* _gotk4_gio2_Volume_virtual_get_name(void* fnptr, GVolume* arg0) { +// return ((char* (*)(GVolume*))(fnptr))(arg0); +// }; +// char* _gotk4_gio2_Volume_virtual_get_uuid(void* fnptr, GVolume* arg0) { +// return ((char* (*)(GVolume*))(fnptr))(arg0); +// }; +// char** _gotk4_gio2_AppInfo_virtual_get_supported_types(void* fnptr, GAppInfo* arg0) { +// return ((char** (*)(GAppInfo*))(fnptr))(arg0); +// }; +// char** _gotk4_gio2_Drive_virtual_enumerate_identifiers(void* fnptr, GDrive* arg0) { +// return ((char** (*)(GDrive*))(fnptr))(arg0); +// }; +// char** _gotk4_gio2_Volume_virtual_enumerate_identifiers(void* fnptr, GVolume* arg0) { +// return ((char** (*)(GVolume*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_ActionGroup_virtual_get_action_enabled(void* fnptr, GActionGroup* arg0, gchar* arg1) { +// return ((gboolean (*)(GActionGroup*, gchar*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_ActionGroup_virtual_has_action(void* fnptr, GActionGroup* arg0, gchar* arg1) { +// return ((gboolean (*)(GActionGroup*, gchar*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_ActionGroup_virtual_query_action(void* fnptr, GActionGroup* arg0, gchar* arg1, gboolean* arg2, GVariantType** arg3, GVariantType** arg4, GVariant** arg5, GVariant** arg6) { +// return ((gboolean (*)(GActionGroup*, gchar*, gboolean*, GVariantType**, GVariantType**, GVariant**, GVariant**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// gboolean _gotk4_gio2_Action_virtual_get_enabled(void* fnptr, GAction* arg0) { +// return ((gboolean (*)(GAction*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_add_supports_type(void* fnptr, GAppInfo* arg0, char* arg1, GError** arg2) { +// return ((gboolean (*)(GAppInfo*, char*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_can_delete(void* fnptr, GAppInfo* arg0) { +// return ((gboolean (*)(GAppInfo*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_can_remove_supports_type(void* fnptr, GAppInfo* arg0) { +// return ((gboolean (*)(GAppInfo*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_do_delete(void* fnptr, GAppInfo* arg0) { +// return ((gboolean (*)(GAppInfo*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_equal(void* fnptr, GAppInfo* arg0, GAppInfo* arg1) { +// return ((gboolean (*)(GAppInfo*, GAppInfo*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_launch(void* fnptr, GAppInfo* arg0, GList* arg1, GAppLaunchContext* arg2, GError** arg3) { +// return ((gboolean (*)(GAppInfo*, GList*, GAppLaunchContext*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_launch_uris(void* fnptr, GAppInfo* arg0, GList* arg1, GAppLaunchContext* arg2, GError** arg3) { +// return ((gboolean (*)(GAppInfo*, GList*, GAppLaunchContext*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_launch_uris_finish(void* fnptr, GAppInfo* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GAppInfo*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_remove_supports_type(void* fnptr, GAppInfo* arg0, char* arg1, GError** arg2) { +// return ((gboolean (*)(GAppInfo*, char*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_set_as_default_for_extension(void* fnptr, GAppInfo* arg0, char* arg1, GError** arg2) { +// return ((gboolean (*)(GAppInfo*, char*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_set_as_default_for_type(void* fnptr, GAppInfo* arg0, char* arg1, GError** arg2) { +// return ((gboolean (*)(GAppInfo*, char*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_set_as_last_used_for_type(void* fnptr, GAppInfo* arg0, char* arg1, GError** arg2) { +// return ((gboolean (*)(GAppInfo*, char*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_should_show(void* fnptr, GAppInfo* arg0) { +// return ((gboolean (*)(GAppInfo*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_supports_files(void* fnptr, GAppInfo* arg0) { +// return ((gboolean (*)(GAppInfo*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_AppInfo_virtual_supports_uris(void* fnptr, GAppInfo* arg0) { +// return ((gboolean (*)(GAppInfo*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Application_virtual_dbus_register(void* fnptr, GApplication* arg0, GDBusConnection* arg1, gchar* arg2, GError** arg3) { +// return ((gboolean (*)(GApplication*, GDBusConnection*, gchar*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_Application_virtual_name_lost(void* fnptr, GApplication* arg0) { +// return ((gboolean (*)(GApplication*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_AsyncInitable_virtual_init_finish(void* fnptr, GAsyncInitable* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GAsyncInitable*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_AsyncResult_virtual_is_tagged(void* fnptr, GAsyncResult* arg0, gpointer arg1) { +// return ((gboolean (*)(GAsyncResult*, gpointer))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_DBusInterfaceSkeleton_virtual_g_authorize_method(void* fnptr, GDBusInterfaceSkeleton* arg0, GDBusMethodInvocation* arg1) { +// return ((gboolean (*)(GDBusInterfaceSkeleton*, GDBusMethodInvocation*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_DBusObjectSkeleton_virtual_authorize_method(void* fnptr, GDBusObjectSkeleton* arg0, GDBusInterfaceSkeleton* arg1, GDBusMethodInvocation* arg2) { +// return ((gboolean (*)(GDBusObjectSkeleton*, GDBusInterfaceSkeleton*, GDBusMethodInvocation*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_DTLSConnection_virtual_accept_certificate(void* fnptr, GDtlsConnection* arg0, GTlsCertificate* arg1, GTlsCertificateFlags arg2) { +// return ((gboolean (*)(GDtlsConnection*, GTlsCertificate*, GTlsCertificateFlags))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_DTLSConnection_virtual_get_binding_data(void* fnptr, GDtlsConnection* arg0, GTlsChannelBindingType arg1, GByteArray* arg2, GError** arg3) { +// return ((gboolean (*)(GDtlsConnection*, GTlsChannelBindingType, GByteArray*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_DTLSConnection_virtual_handshake(void* fnptr, GDtlsConnection* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GDtlsConnection*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_DTLSConnection_virtual_handshake_finish(void* fnptr, GDtlsConnection* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GDtlsConnection*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_DTLSConnection_virtual_shutdown(void* fnptr, GDtlsConnection* arg0, gboolean arg1, gboolean arg2, GCancellable* arg3, GError** arg4) { +// return ((gboolean (*)(GDtlsConnection*, gboolean, gboolean, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gio2_DTLSConnection_virtual_shutdown_finish(void* fnptr, GDtlsConnection* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GDtlsConnection*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_DatagramBased_virtual_condition_wait(void* fnptr, GDatagramBased* arg0, GIOCondition arg1, gint64 arg2, GCancellable* arg3, GError** arg4) { +// return ((gboolean (*)(GDatagramBased*, GIOCondition, gint64, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gio2_DebugControllerDBus_virtual_authorize(void* fnptr, GDebugControllerDBus* arg0, GDBusMethodInvocation* arg1) { +// return ((gboolean (*)(GDebugControllerDBus*, GDBusMethodInvocation*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_Drive_virtual_can_eject(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_can_poll_for_media(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_can_start(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_can_start_degraded(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_can_stop(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_eject_finish(void* fnptr, GDrive* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GDrive*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Drive_virtual_eject_with_operation_finish(void* fnptr, GDrive* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GDrive*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Drive_virtual_has_media(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_has_volumes(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_is_media_check_automatic(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_is_media_removable(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_is_removable(void* fnptr, GDrive* arg0) { +// return ((gboolean (*)(GDrive*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Drive_virtual_poll_for_media_finish(void* fnptr, GDrive* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GDrive*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Drive_virtual_start_finish(void* fnptr, GDrive* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GDrive*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Drive_virtual_stop_finish(void* fnptr, GDrive* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GDrive*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_FileEnumerator_virtual_close_finish(void* fnptr, GFileEnumerator* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFileEnumerator*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_FileEnumerator_virtual_close_fn(void* fnptr, GFileEnumerator* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GFileEnumerator*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_FileIOStream_virtual_can_seek(void* fnptr, GFileIOStream* arg0) { +// return ((gboolean (*)(GFileIOStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_FileIOStream_virtual_can_truncate(void* fnptr, GFileIOStream* arg0) { +// return ((gboolean (*)(GFileIOStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_FileIOStream_virtual_seek(void* fnptr, GFileIOStream* arg0, goffset arg1, GSeekType arg2, GCancellable* arg3, GError** arg4) { +// return ((gboolean (*)(GFileIOStream*, goffset, GSeekType, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gio2_FileIOStream_virtual_truncate_fn(void* fnptr, GFileIOStream* arg0, goffset arg1, GCancellable* arg2, GError** arg3) { +// return ((gboolean (*)(GFileIOStream*, goffset, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_FileInputStream_virtual_can_seek(void* fnptr, GFileInputStream* arg0) { +// return ((gboolean (*)(GFileInputStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_FileInputStream_virtual_seek(void* fnptr, GFileInputStream* arg0, goffset arg1, GSeekType arg2, GCancellable* arg3, GError** arg4) { +// return ((gboolean (*)(GFileInputStream*, goffset, GSeekType, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gio2_FileMonitor_virtual_cancel(void* fnptr, GFileMonitor* arg0) { +// return ((gboolean (*)(GFileMonitor*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_FileOutputStream_virtual_can_seek(void* fnptr, GFileOutputStream* arg0) { +// return ((gboolean (*)(GFileOutputStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_FileOutputStream_virtual_can_truncate(void* fnptr, GFileOutputStream* arg0) { +// return ((gboolean (*)(GFileOutputStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_FileOutputStream_virtual_seek(void* fnptr, GFileOutputStream* arg0, goffset arg1, GSeekType arg2, GCancellable* arg3, GError** arg4) { +// return ((gboolean (*)(GFileOutputStream*, goffset, GSeekType, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gio2_FileOutputStream_virtual_truncate_fn(void* fnptr, GFileOutputStream* arg0, goffset arg1, GCancellable* arg2, GError** arg3) { +// return ((gboolean (*)(GFileOutputStream*, goffset, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_File_virtual_copy_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_delete_file(void* fnptr, GFile* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_delete_file_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_eject_mountable_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_eject_mountable_with_operation_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_equal(void* fnptr, GFile* arg0, GFile* arg1) { +// return ((gboolean (*)(GFile*, GFile*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_File_virtual_has_uri_scheme(void* fnptr, GFile* arg0, char* arg1) { +// return ((gboolean (*)(GFile*, char*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_File_virtual_is_native(void* fnptr, GFile* arg0) { +// return ((gboolean (*)(GFile*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_File_virtual_make_directory(void* fnptr, GFile* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_make_directory_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_make_symbolic_link(void* fnptr, GFile* arg0, char* arg1, GCancellable* arg2, GError** arg3) { +// return ((gboolean (*)(GFile*, char*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_File_virtual_make_symbolic_link_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_measure_disk_usage_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, guint64* arg2, guint64* arg3, guint64* arg4, GError** arg5) { +// return ((gboolean (*)(GFile*, GAsyncResult*, guint64*, guint64*, guint64*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// gboolean _gotk4_gio2_File_virtual_mount_enclosing_volume_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_move_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_poll_mountable_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_prefix_matches(void* fnptr, GFile* arg0, GFile* arg1) { +// return ((gboolean (*)(GFile*, GFile*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_File_virtual_set_attribute(void* fnptr, GFile* arg0, char* arg1, GFileAttributeType arg2, gpointer arg3, GFileQueryInfoFlags arg4, GCancellable* arg5, GError** arg6) { +// return ((gboolean (*)(GFile*, char*, GFileAttributeType, gpointer, GFileQueryInfoFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// gboolean _gotk4_gio2_File_virtual_set_attributes_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GFileInfo** arg2, GError** arg3) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GFileInfo**, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_File_virtual_set_attributes_from_info(void* fnptr, GFile* arg0, GFileInfo* arg1, GFileQueryInfoFlags arg2, GCancellable* arg3, GError** arg4) { +// return ((gboolean (*)(GFile*, GFileInfo*, GFileQueryInfoFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gio2_File_virtual_start_mountable_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_stop_mountable_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_trash(void* fnptr, GFile* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_trash_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_unmount_mountable_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_File_virtual_unmount_mountable_with_operation_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_IOStream_virtual_close_finish(void* fnptr, GIOStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GIOStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_IOStream_virtual_close_fn(void* fnptr, GIOStream* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GIOStream*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Icon_virtual_equal(void* fnptr, GIcon* arg0, GIcon* arg1) { +// return ((gboolean (*)(GIcon*, GIcon*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_Initable_virtual_init(void* fnptr, GInitable* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GInitable*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_InputStream_virtual_close_finish(void* fnptr, GInputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GInputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_InputStream_virtual_close_fn(void* fnptr, GInputStream* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GInputStream*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_MenuAttributeIter_virtual_get_next(void* fnptr, GMenuAttributeIter* arg0, gchar** arg1, GVariant** arg2) { +// return ((gboolean (*)(GMenuAttributeIter*, gchar**, GVariant**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_MenuLinkIter_virtual_get_next(void* fnptr, GMenuLinkIter* arg0, gchar** arg1, GMenuModel** arg2) { +// return ((gboolean (*)(GMenuLinkIter*, gchar**, GMenuModel**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_MenuModel_virtual_is_mutable(void* fnptr, GMenuModel* arg0) { +// return ((gboolean (*)(GMenuModel*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Mount_virtual_can_eject(void* fnptr, GMount* arg0) { +// return ((gboolean (*)(GMount*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Mount_virtual_can_unmount(void* fnptr, GMount* arg0) { +// return ((gboolean (*)(GMount*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Mount_virtual_eject_finish(void* fnptr, GMount* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GMount*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Mount_virtual_eject_with_operation_finish(void* fnptr, GMount* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GMount*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Mount_virtual_remount_finish(void* fnptr, GMount* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GMount*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Mount_virtual_unmount_finish(void* fnptr, GMount* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GMount*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Mount_virtual_unmount_with_operation_finish(void* fnptr, GMount* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GMount*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_NetworkMonitor_virtual_can_reach(void* fnptr, GNetworkMonitor* arg0, GSocketConnectable* arg1, GCancellable* arg2, GError** arg3) { +// return ((gboolean (*)(GNetworkMonitor*, GSocketConnectable*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_NetworkMonitor_virtual_can_reach_finish(void* fnptr, GNetworkMonitor* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GNetworkMonitor*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_OutputStream_virtual_close_finish(void* fnptr, GOutputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GOutputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_OutputStream_virtual_close_fn(void* fnptr, GOutputStream* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GOutputStream*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_OutputStream_virtual_flush(void* fnptr, GOutputStream* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GOutputStream*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_OutputStream_virtual_flush_finish(void* fnptr, GOutputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GOutputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_OutputStream_virtual_writev_finish(void* fnptr, GOutputStream* arg0, GAsyncResult* arg1, gsize* arg2, GError** arg3) { +// return ((gboolean (*)(GOutputStream*, GAsyncResult*, gsize*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_OutputStream_virtual_writev_fn(void* fnptr, GOutputStream* arg0, GOutputVector* arg1, gsize arg2, gsize* arg3, GCancellable* arg4, GError** arg5) { +// return ((gboolean (*)(GOutputStream*, GOutputVector*, gsize, gsize*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// gboolean _gotk4_gio2_Permission_virtual_acquire(void* fnptr, GPermission* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GPermission*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Permission_virtual_acquire_finish(void* fnptr, GPermission* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GPermission*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Permission_virtual_release(void* fnptr, GPermission* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GPermission*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Permission_virtual_release_finish(void* fnptr, GPermission* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GPermission*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_PollableInputStream_virtual_can_poll(void* fnptr, GPollableInputStream* arg0) { +// return ((gboolean (*)(GPollableInputStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_PollableInputStream_virtual_is_readable(void* fnptr, GPollableInputStream* arg0) { +// return ((gboolean (*)(GPollableInputStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_PollableOutputStream_virtual_can_poll(void* fnptr, GPollableOutputStream* arg0) { +// return ((gboolean (*)(GPollableOutputStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_PollableOutputStream_virtual_is_writable(void* fnptr, GPollableOutputStream* arg0) { +// return ((gboolean (*)(GPollableOutputStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_ProxyResolver_virtual_is_supported(void* fnptr, GProxyResolver* arg0) { +// return ((gboolean (*)(GProxyResolver*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Proxy_virtual_supports_hostname(void* fnptr, GProxy* arg0) { +// return ((gboolean (*)(GProxy*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Seekable_virtual_can_seek(void* fnptr, GSeekable* arg0) { +// return ((gboolean (*)(GSeekable*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Seekable_virtual_can_truncate(void* fnptr, GSeekable* arg0) { +// return ((gboolean (*)(GSeekable*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Seekable_virtual_seek(void* fnptr, GSeekable* arg0, goffset arg1, GSeekType arg2, GCancellable* arg3, GError** arg4) { +// return ((gboolean (*)(GSeekable*, goffset, GSeekType, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gio2_Seekable_virtual_truncate_fn(void* fnptr, GSeekable* arg0, goffset arg1, GCancellable* arg2, GError** arg3) { +// return ((gboolean (*)(GSeekable*, goffset, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_Settings_virtual_change_event(void* fnptr, GSettings* arg0, GQuark* arg1, gint arg2) { +// return ((gboolean (*)(GSettings*, GQuark*, gint))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Settings_virtual_writable_change_event(void* fnptr, GSettings* arg0, GQuark arg1) { +// return ((gboolean (*)(GSettings*, GQuark))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gio2_SocketAddress_virtual_to_native(void* fnptr, GSocketAddress* arg0, gpointer arg1, gsize arg2, GError** arg3) { +// return ((gboolean (*)(GSocketAddress*, gpointer, gsize, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_SocketService_virtual_incoming(void* fnptr, GSocketService* arg0, GSocketConnection* arg1, GObject* arg2) { +// return ((gboolean (*)(GSocketService*, GSocketConnection*, GObject*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_TLSBackend_virtual_supports_dtls(void* fnptr, GTlsBackend* arg0) { +// return ((gboolean (*)(GTlsBackend*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_TLSBackend_virtual_supports_tls(void* fnptr, GTlsBackend* arg0) { +// return ((gboolean (*)(GTlsBackend*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_TLSConnection_virtual_accept_certificate(void* fnptr, GTlsConnection* arg0, GTlsCertificate* arg1, GTlsCertificateFlags arg2) { +// return ((gboolean (*)(GTlsConnection*, GTlsCertificate*, GTlsCertificateFlags))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_TLSConnection_virtual_get_binding_data(void* fnptr, GTlsConnection* arg0, GTlsChannelBindingType arg1, GByteArray* arg2, GError** arg3) { +// return ((gboolean (*)(GTlsConnection*, GTlsChannelBindingType, GByteArray*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gio2_TLSConnection_virtual_handshake(void* fnptr, GTlsConnection* arg0, GCancellable* arg1, GError** arg2) { +// return ((gboolean (*)(GTlsConnection*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_TLSConnection_virtual_handshake_finish(void* fnptr, GTlsConnection* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GTlsConnection*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_ThreadedSocketService_virtual_run(void* fnptr, GThreadedSocketService* arg0, GSocketConnection* arg1, GObject* arg2) { +// return ((gboolean (*)(GThreadedSocketService*, GSocketConnection*, GObject*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_VFS_virtual_is_active(void* fnptr, GVfs* arg0) { +// return ((gboolean (*)(GVfs*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_VFS_virtual_local_file_set_attributes(void* fnptr, GVfs* arg0, char* arg1, GFileInfo* arg2, GFileQueryInfoFlags arg3, GCancellable* arg4, GError** arg5) { +// return ((gboolean (*)(GVfs*, char*, GFileInfo*, GFileQueryInfoFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// gboolean _gotk4_gio2_Volume_virtual_can_eject(void* fnptr, GVolume* arg0) { +// return ((gboolean (*)(GVolume*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Volume_virtual_can_mount(void* fnptr, GVolume* arg0) { +// return ((gboolean (*)(GVolume*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gio2_Volume_virtual_eject_finish(void* fnptr, GVolume* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GVolume*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Volume_virtual_eject_with_operation_finish(void* fnptr, GVolume* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GVolume*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Volume_virtual_mount_finish(void* fnptr, GVolume* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gboolean (*)(GVolume*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gio2_Volume_virtual_should_automount(void* fnptr, GVolume* arg0) { +// return ((gboolean (*)(GVolume*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_Action_virtual_get_name(void* fnptr, GAction* arg0) { +// return ((gchar* (*)(GAction*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_DBusObjectManager_virtual_get_object_path(void* fnptr, GDBusObjectManager* arg0) { +// return ((gchar* (*)(GDBusObjectManager*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_DBusObject_virtual_get_object_path(void* fnptr, GDBusObject* arg0) { +// return ((gchar* (*)(GDBusObject*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_DTLSConnection_virtual_get_negotiated_protocol(void* fnptr, GDtlsConnection* arg0) { +// return ((gchar* (*)(GDtlsConnection*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_Drive_virtual_get_sort_key(void* fnptr, GDrive* arg0) { +// return ((gchar* (*)(GDrive*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_InetAddress_virtual_to_string(void* fnptr, GInetAddress* arg0) { +// return ((gchar* (*)(GInetAddress*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_Mount_virtual_get_sort_key(void* fnptr, GMount* arg0) { +// return ((gchar* (*)(GMount*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_Resolver_virtual_lookup_by_address(void* fnptr, GResolver* arg0, GInetAddress* arg1, GCancellable* arg2, GError** arg3) { +// return ((gchar* (*)(GResolver*, GInetAddress*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gchar* _gotk4_gio2_Resolver_virtual_lookup_by_address_finish(void* fnptr, GResolver* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gchar* (*)(GResolver*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gchar* _gotk4_gio2_SocketConnectable_virtual_to_string(void* fnptr, GSocketConnectable* arg0) { +// return ((gchar* (*)(GSocketConnectable*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_TLSConnection_virtual_get_negotiated_protocol(void* fnptr, GTlsConnection* arg0) { +// return ((gchar* (*)(GTlsConnection*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_TLSDatabase_virtual_create_certificate_handle(void* fnptr, GTlsDatabase* arg0, GTlsCertificate* arg1) { +// return ((gchar* (*)(GTlsDatabase*, GTlsCertificate*))(fnptr))(arg0, arg1); +// }; +// gchar* _gotk4_gio2_TLSPassword_virtual_get_default_warning(void* fnptr, GTlsPassword* arg0) { +// return ((gchar* (*)(GTlsPassword*))(fnptr))(arg0); +// }; +// gchar* _gotk4_gio2_Volume_virtual_get_sort_key(void* fnptr, GVolume* arg0) { +// return ((gchar* (*)(GVolume*))(fnptr))(arg0); +// }; +// gchar** _gotk4_gio2_ActionGroup_virtual_list_actions(void* fnptr, GActionGroup* arg0) { +// return ((gchar** (*)(GActionGroup*))(fnptr))(arg0); +// }; +// gchar** _gotk4_gio2_Mount_virtual_guess_content_type_finish(void* fnptr, GMount* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gchar** (*)(GMount*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gchar** _gotk4_gio2_Mount_virtual_guess_content_type_sync(void* fnptr, GMount* arg0, gboolean arg1, GCancellable* arg2, GError** arg3) { +// return ((gchar** (*)(GMount*, gboolean, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gchar** _gotk4_gio2_ProxyResolver_virtual_lookup(void* fnptr, GProxyResolver* arg0, gchar* arg1, GCancellable* arg2, GError** arg3) { +// return ((gchar** (*)(GProxyResolver*, gchar*, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gchar** _gotk4_gio2_ProxyResolver_virtual_lookup_finish(void* fnptr, GProxyResolver* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gchar** (*)(GProxyResolver*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gchar** _gotk4_gio2_VFS_virtual_get_supported_uri_schemes(void* fnptr, GVfs* arg0) { +// return ((gchar** (*)(GVfs*))(fnptr))(arg0); +// }; +// gint _gotk4_gio2_Application_virtual_handle_local_options(void* fnptr, GApplication* arg0, GVariantDict* arg1) { +// return ((gint (*)(GApplication*, GVariantDict*))(fnptr))(arg0, arg1); +// }; +// gint _gotk4_gio2_DatagramBased_virtual_receive_messages(void* fnptr, GDatagramBased* arg0, GInputMessage* arg1, guint arg2, gint arg3, gint64 arg4, GCancellable* arg5, GError** arg6) { +// return ((gint (*)(GDatagramBased*, GInputMessage*, guint, gint, gint64, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// gint _gotk4_gio2_DatagramBased_virtual_send_messages(void* fnptr, GDatagramBased* arg0, GOutputMessage* arg1, guint arg2, gint arg3, gint64 arg4, GCancellable* arg5, GError** arg6) { +// return ((gint (*)(GDatagramBased*, GOutputMessage*, guint, gint, gint64, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// gint _gotk4_gio2_MenuModel_virtual_get_n_items(void* fnptr, GMenuModel* arg0) { +// return ((gint (*)(GMenuModel*))(fnptr))(arg0); +// }; +// goffset _gotk4_gio2_FileIOStream_virtual_tell(void* fnptr, GFileIOStream* arg0) { +// return ((goffset (*)(GFileIOStream*))(fnptr))(arg0); +// }; +// goffset _gotk4_gio2_FileInputStream_virtual_tell(void* fnptr, GFileInputStream* arg0) { +// return ((goffset (*)(GFileInputStream*))(fnptr))(arg0); +// }; +// goffset _gotk4_gio2_FileOutputStream_virtual_tell(void* fnptr, GFileOutputStream* arg0) { +// return ((goffset (*)(GFileOutputStream*))(fnptr))(arg0); +// }; +// goffset _gotk4_gio2_Seekable_virtual_tell(void* fnptr, GSeekable* arg0) { +// return ((goffset (*)(GSeekable*))(fnptr))(arg0); +// }; +// gpointer _gotk4_gio2_AsyncResult_virtual_get_user_data(void* fnptr, GAsyncResult* arg0) { +// return ((gpointer (*)(GAsyncResult*))(fnptr))(arg0); +// }; +// gpointer _gotk4_gio2_ListModel_virtual_get_item(void* fnptr, GListModel* arg0, guint arg1) { +// return ((gpointer (*)(GListModel*, guint))(fnptr))(arg0, arg1); +// }; +// gsize _gotk4_gio2_SocketControlMessage_virtual_get_size(void* fnptr, GSocketControlMessage* arg0) { +// return ((gsize (*)(GSocketControlMessage*))(fnptr))(arg0); +// }; +// gssize _gotk4_gio2_BufferedInputStream_virtual_fill(void* fnptr, GBufferedInputStream* arg0, gssize arg1, GCancellable* arg2, GError** arg3) { +// return ((gssize (*)(GBufferedInputStream*, gssize, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gssize _gotk4_gio2_BufferedInputStream_virtual_fill_finish(void* fnptr, GBufferedInputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gssize (*)(GBufferedInputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gssize _gotk4_gio2_InputStream_virtual_read_finish(void* fnptr, GInputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gssize (*)(GInputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gssize _gotk4_gio2_InputStream_virtual_skip(void* fnptr, GInputStream* arg0, gsize arg1, GCancellable* arg2, GError** arg3) { +// return ((gssize (*)(GInputStream*, gsize, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gssize _gotk4_gio2_InputStream_virtual_skip_finish(void* fnptr, GInputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gssize (*)(GInputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gssize _gotk4_gio2_OutputStream_virtual_splice(void* fnptr, GOutputStream* arg0, GInputStream* arg1, GOutputStreamSpliceFlags arg2, GCancellable* arg3, GError** arg4) { +// return ((gssize (*)(GOutputStream*, GInputStream*, GOutputStreamSpliceFlags, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gssize _gotk4_gio2_OutputStream_virtual_splice_finish(void* fnptr, GOutputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gssize (*)(GOutputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gssize _gotk4_gio2_OutputStream_virtual_write_finish(void* fnptr, GOutputStream* arg0, GAsyncResult* arg1, GError** arg2) { +// return ((gssize (*)(GOutputStream*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); +// }; +// gssize _gotk4_gio2_OutputStream_virtual_write_fn(void* fnptr, GOutputStream* arg0, void* arg1, gsize arg2, GCancellable* arg3, GError** arg4) { +// return ((gssize (*)(GOutputStream*, void*, gsize, GCancellable*, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gssize _gotk4_gio2_PollableInputStream_virtual_read_nonblocking(void* fnptr, GPollableInputStream* arg0, void* arg1, gsize arg2, GError** arg3) { +// return ((gssize (*)(GPollableInputStream*, void*, gsize, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gssize _gotk4_gio2_PollableOutputStream_virtual_write_nonblocking(void* fnptr, GPollableOutputStream* arg0, void* arg1, gsize arg2, GError** arg3) { +// return ((gssize (*)(GPollableOutputStream*, void*, gsize, GError**))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gssize _gotk4_gio2_SocketAddress_virtual_get_native_size(void* fnptr, GSocketAddress* arg0) { +// return ((gssize (*)(GSocketAddress*))(fnptr))(arg0); +// }; +// guchar* _gotk4_gio2_TLSPassword_virtual_get_value(void* fnptr, GTlsPassword* arg0, gsize* arg1) { +// return ((guchar* (*)(GTlsPassword*, gsize*))(fnptr))(arg0, arg1); +// }; +// guint _gotk4_gio2_File_virtual_hash(void* fnptr, GFile* arg0) { +// return ((guint (*)(GFile*))(fnptr))(arg0); +// }; +// guint _gotk4_gio2_Icon_virtual_hash(void* fnptr, GIcon* arg0) { +// return ((guint (*)(GIcon*))(fnptr))(arg0); +// }; +// guint _gotk4_gio2_ListModel_virtual_get_n_items(void* fnptr, GListModel* arg0) { +// return ((guint (*)(GListModel*))(fnptr))(arg0); +// }; +// int _gotk4_gio2_Application_virtual_command_line(void* fnptr, GApplication* arg0, GApplicationCommandLine* arg1) { +// return ((int (*)(GApplication*, GApplicationCommandLine*))(fnptr))(arg0, arg1); +// }; +// int _gotk4_gio2_SocketControlMessage_virtual_get_level(void* fnptr, GSocketControlMessage* arg0) { +// return ((int (*)(GSocketControlMessage*))(fnptr))(arg0); +// }; +// int _gotk4_gio2_SocketControlMessage_virtual_get_type(void* fnptr, GSocketControlMessage* arg0) { +// return ((int (*)(GSocketControlMessage*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_ActionGroup_virtual_action_added(void* fnptr, GActionGroup* arg0, gchar* arg1) { +// ((void (*)(GActionGroup*, gchar*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_ActionGroup_virtual_action_enabled_changed(void* fnptr, GActionGroup* arg0, gchar* arg1, gboolean arg2) { +// ((void (*)(GActionGroup*, gchar*, gboolean))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_ActionGroup_virtual_action_removed(void* fnptr, GActionGroup* arg0, gchar* arg1) { +// ((void (*)(GActionGroup*, gchar*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_ActionGroup_virtual_action_state_changed(void* fnptr, GActionGroup* arg0, gchar* arg1, GVariant* arg2) { +// ((void (*)(GActionGroup*, gchar*, GVariant*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_ActionGroup_virtual_activate_action(void* fnptr, GActionGroup* arg0, gchar* arg1, GVariant* arg2) { +// ((void (*)(GActionGroup*, gchar*, GVariant*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_ActionGroup_virtual_change_action_state(void* fnptr, GActionGroup* arg0, gchar* arg1, GVariant* arg2) { +// ((void (*)(GActionGroup*, gchar*, GVariant*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_ActionMap_virtual_add_action(void* fnptr, GActionMap* arg0, GAction* arg1) { +// ((void (*)(GActionMap*, GAction*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_ActionMap_virtual_remove_action(void* fnptr, GActionMap* arg0, gchar* arg1) { +// ((void (*)(GActionMap*, gchar*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_Action_virtual_activate(void* fnptr, GAction* arg0, GVariant* arg1) { +// ((void (*)(GAction*, GVariant*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_Action_virtual_change_state(void* fnptr, GAction* arg0, GVariant* arg1) { +// ((void (*)(GAction*, GVariant*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_AppInfo_virtual_launch_uris_async(void* fnptr, GAppInfo* arg0, GList* arg1, GAppLaunchContext* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GAppInfo*, GList*, GAppLaunchContext*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_AppLaunchContext_virtual_launch_failed(void* fnptr, GAppLaunchContext* arg0, char* arg1) { +// ((void (*)(GAppLaunchContext*, char*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_AppLaunchContext_virtual_launch_started(void* fnptr, GAppLaunchContext* arg0, GAppInfo* arg1, GVariant* arg2) { +// ((void (*)(GAppLaunchContext*, GAppInfo*, GVariant*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_AppLaunchContext_virtual_launched(void* fnptr, GAppLaunchContext* arg0, GAppInfo* arg1, GVariant* arg2) { +// ((void (*)(GAppLaunchContext*, GAppInfo*, GVariant*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_ApplicationCommandLine_virtual_done(void* fnptr, GApplicationCommandLine* arg0) { +// ((void (*)(GApplicationCommandLine*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_ApplicationCommandLine_virtual_print_literal(void* fnptr, GApplicationCommandLine* arg0, gchar* arg1) { +// ((void (*)(GApplicationCommandLine*, gchar*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_ApplicationCommandLine_virtual_printerr_literal(void* fnptr, GApplicationCommandLine* arg0, gchar* arg1) { +// ((void (*)(GApplicationCommandLine*, gchar*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_Application_virtual_activate(void* fnptr, GApplication* arg0) { +// ((void (*)(GApplication*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Application_virtual_add_platform_data(void* fnptr, GApplication* arg0, GVariantBuilder* arg1) { +// ((void (*)(GApplication*, GVariantBuilder*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_Application_virtual_after_emit(void* fnptr, GApplication* arg0, GVariant* arg1) { +// ((void (*)(GApplication*, GVariant*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_Application_virtual_before_emit(void* fnptr, GApplication* arg0, GVariant* arg1) { +// ((void (*)(GApplication*, GVariant*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_Application_virtual_dbus_unregister(void* fnptr, GApplication* arg0, GDBusConnection* arg1, gchar* arg2) { +// ((void (*)(GApplication*, GDBusConnection*, gchar*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_Application_virtual_open(void* fnptr, GApplication* arg0, GFile** arg1, gint arg2, gchar* arg3) { +// ((void (*)(GApplication*, GFile**, gint, gchar*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_Application_virtual_quit_mainloop(void* fnptr, GApplication* arg0) { +// ((void (*)(GApplication*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Application_virtual_run_mainloop(void* fnptr, GApplication* arg0) { +// ((void (*)(GApplication*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Application_virtual_shutdown(void* fnptr, GApplication* arg0) { +// ((void (*)(GApplication*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Application_virtual_startup(void* fnptr, GApplication* arg0) { +// ((void (*)(GApplication*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_AsyncInitable_virtual_init_async(void* fnptr, GAsyncInitable* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GAsyncInitable*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_BufferedInputStream_virtual_fill_async(void* fnptr, GBufferedInputStream* arg0, gssize arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GBufferedInputStream*, gssize, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Cancellable_virtual_cancelled(void* fnptr, GCancellable* arg0) { +// ((void (*)(GCancellable*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Converter_virtual_reset(void* fnptr, GConverter* arg0) { +// ((void (*)(GConverter*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_DBusInterfaceSkeleton_virtual_flush(void* fnptr, GDBusInterfaceSkeleton* arg0) { +// ((void (*)(GDBusInterfaceSkeleton*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_DBusInterface_virtual_set_object(void* fnptr, GDBusInterface* arg0, GDBusObject* arg1) { +// ((void (*)(GDBusInterface*, GDBusObject*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_DBusObjectManagerClient_virtual_interface_proxy_signal(void* fnptr, GDBusObjectManagerClient* arg0, GDBusObjectProxy* arg1, GDBusProxy* arg2, gchar* arg3, gchar* arg4, GVariant* arg5) { +// ((void (*)(GDBusObjectManagerClient*, GDBusObjectProxy*, GDBusProxy*, gchar*, gchar*, GVariant*))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_DBusObjectManager_virtual_interface_added(void* fnptr, GDBusObjectManager* arg0, GDBusObject* arg1, GDBusInterface* arg2) { +// ((void (*)(GDBusObjectManager*, GDBusObject*, GDBusInterface*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_DBusObjectManager_virtual_interface_removed(void* fnptr, GDBusObjectManager* arg0, GDBusObject* arg1, GDBusInterface* arg2) { +// ((void (*)(GDBusObjectManager*, GDBusObject*, GDBusInterface*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_DBusObjectManager_virtual_object_added(void* fnptr, GDBusObjectManager* arg0, GDBusObject* arg1) { +// ((void (*)(GDBusObjectManager*, GDBusObject*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_DBusObjectManager_virtual_object_removed(void* fnptr, GDBusObjectManager* arg0, GDBusObject* arg1) { +// ((void (*)(GDBusObjectManager*, GDBusObject*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_DBusObject_virtual_interface_added(void* fnptr, GDBusObject* arg0, GDBusInterface* arg1) { +// ((void (*)(GDBusObject*, GDBusInterface*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_DBusObject_virtual_interface_removed(void* fnptr, GDBusObject* arg0, GDBusInterface* arg1) { +// ((void (*)(GDBusObject*, GDBusInterface*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_DBusProxy_virtual_g_signal(void* fnptr, GDBusProxy* arg0, gchar* arg1, gchar* arg2, GVariant* arg3) { +// ((void (*)(GDBusProxy*, gchar*, gchar*, GVariant*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_DTLSConnection_virtual_handshake_async(void* fnptr, GDtlsConnection* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GDtlsConnection*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_DTLSConnection_virtual_set_advertised_protocols(void* fnptr, GDtlsConnection* arg0, gchar** arg1) { +// ((void (*)(GDtlsConnection*, gchar**))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_DTLSConnection_virtual_shutdown_async(void* fnptr, GDtlsConnection* arg0, gboolean arg1, gboolean arg2, int arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GDtlsConnection*, gboolean, gboolean, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_Drive_virtual_changed(void* fnptr, GDrive* arg0) { +// ((void (*)(GDrive*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Drive_virtual_disconnected(void* fnptr, GDrive* arg0) { +// ((void (*)(GDrive*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Drive_virtual_eject(void* fnptr, GDrive* arg0, GMountUnmountFlags arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GDrive*, GMountUnmountFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_Drive_virtual_eject_button(void* fnptr, GDrive* arg0) { +// ((void (*)(GDrive*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Drive_virtual_eject_with_operation(void* fnptr, GDrive* arg0, GMountUnmountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GDrive*, GMountUnmountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Drive_virtual_poll_for_media(void* fnptr, GDrive* arg0, GCancellable* arg1, GAsyncReadyCallback arg2, gpointer arg3) { +// ((void (*)(GDrive*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_Drive_virtual_start(void* fnptr, GDrive* arg0, GDriveStartFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GDrive*, GDriveStartFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Drive_virtual_stop(void* fnptr, GDrive* arg0, GMountUnmountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GDrive*, GMountUnmountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Drive_virtual_stop_button(void* fnptr, GDrive* arg0) { +// ((void (*)(GDrive*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_FileEnumerator_virtual_close_async(void* fnptr, GFileEnumerator* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GFileEnumerator*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_FileEnumerator_virtual_next_files_async(void* fnptr, GFileEnumerator* arg0, int arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFileEnumerator*, int, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_FileIOStream_virtual_query_info_async(void* fnptr, GFileIOStream* arg0, char* arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFileIOStream*, char*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_FileInputStream_virtual_query_info_async(void* fnptr, GFileInputStream* arg0, char* arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFileInputStream*, char*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_FileMonitor_virtual_changed(void* fnptr, GFileMonitor* arg0, GFile* arg1, GFile* arg2, GFileMonitorEvent arg3) { +// ((void (*)(GFileMonitor*, GFile*, GFile*, GFileMonitorEvent))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_FileOutputStream_virtual_query_info_async(void* fnptr, GFileOutputStream* arg0, char* arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFileOutputStream*, char*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_append_to_async(void* fnptr, GFile* arg0, GFileCreateFlags arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, GFileCreateFlags, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_create_async(void* fnptr, GFile* arg0, GFileCreateFlags arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, GFileCreateFlags, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_create_readwrite_async(void* fnptr, GFile* arg0, GFileCreateFlags arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, GFileCreateFlags, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_delete_file_async(void* fnptr, GFile* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GFile*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_File_virtual_eject_mountable(void* fnptr, GFile* arg0, GMountUnmountFlags arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GFile*, GMountUnmountFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_File_virtual_eject_mountable_with_operation(void* fnptr, GFile* arg0, GMountUnmountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, GMountUnmountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_enumerate_children_async(void* fnptr, GFile* arg0, char* arg1, GFileQueryInfoFlags arg2, int arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GFile*, char*, GFileQueryInfoFlags, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_File_virtual_find_enclosing_mount_async(void* fnptr, GFile* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GFile*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_File_virtual_make_directory_async(void* fnptr, GFile* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GFile*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_File_virtual_make_symbolic_link_async(void* fnptr, GFile* arg0, char* arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, char*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_mount_enclosing_volume(void* fnptr, GFile* arg0, GMountMountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, GMountMountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_mount_mountable(void* fnptr, GFile* arg0, GMountMountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, GMountMountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_open_readwrite_async(void* fnptr, GFile* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GFile*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_File_virtual_poll_mountable(void* fnptr, GFile* arg0, GCancellable* arg1, GAsyncReadyCallback arg2, gpointer arg3) { +// ((void (*)(GFile*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_File_virtual_query_filesystem_info_async(void* fnptr, GFile* arg0, char* arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, char*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_query_info_async(void* fnptr, GFile* arg0, char* arg1, GFileQueryInfoFlags arg2, int arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GFile*, char*, GFileQueryInfoFlags, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_File_virtual_read_async(void* fnptr, GFile* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GFile*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_File_virtual_replace_async(void* fnptr, GFile* arg0, char* arg1, gboolean arg2, GFileCreateFlags arg3, int arg4, GCancellable* arg5, GAsyncReadyCallback arg6, gpointer arg7) { +// ((void (*)(GFile*, char*, gboolean, GFileCreateFlags, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); +// }; +// void _gotk4_gio2_File_virtual_replace_readwrite_async(void* fnptr, GFile* arg0, char* arg1, gboolean arg2, GFileCreateFlags arg3, int arg4, GCancellable* arg5, GAsyncReadyCallback arg6, gpointer arg7) { +// ((void (*)(GFile*, char*, gboolean, GFileCreateFlags, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); +// }; +// void _gotk4_gio2_File_virtual_set_attributes_async(void* fnptr, GFile* arg0, GFileInfo* arg1, GFileQueryInfoFlags arg2, int arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GFile*, GFileInfo*, GFileQueryInfoFlags, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_File_virtual_set_display_name_async(void* fnptr, GFile* arg0, char* arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, char*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_start_mountable(void* fnptr, GFile* arg0, GDriveStartFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, GDriveStartFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_stop_mountable(void* fnptr, GFile* arg0, GMountUnmountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, GMountUnmountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_File_virtual_trash_async(void* fnptr, GFile* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GFile*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_File_virtual_unmount_mountable(void* fnptr, GFile* arg0, GMountUnmountFlags arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GFile*, GMountUnmountFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_File_virtual_unmount_mountable_with_operation(void* fnptr, GFile* arg0, GMountUnmountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GFile*, GMountUnmountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_FilenameCompleter_virtual_got_completion_data(void* fnptr, GFilenameCompleter* arg0) { +// ((void (*)(GFilenameCompleter*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_IOStream_virtual_close_async(void* fnptr, GIOStream* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GIOStream*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_InputStream_virtual_close_async(void* fnptr, GInputStream* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GInputStream*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_InputStream_virtual_read_async(void* fnptr, GInputStream* arg0, void* arg1, gsize arg2, int arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GInputStream*, void*, gsize, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_InputStream_virtual_skip_async(void* fnptr, GInputStream* arg0, gsize arg1, int arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GInputStream*, gsize, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_LoadableIcon_virtual_load_async(void* fnptr, GLoadableIcon* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GLoadableIcon*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_MemoryMonitor_virtual_low_memory_warning(void* fnptr, GMemoryMonitor* arg0, GMemoryMonitorWarningLevel arg1) { +// ((void (*)(GMemoryMonitor*, GMemoryMonitorWarningLevel))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_MenuModel_virtual_get_item_attributes(void* fnptr, GMenuModel* arg0, gint arg1, GHashTable** arg2) { +// ((void (*)(GMenuModel*, gint, GHashTable**))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_MenuModel_virtual_get_item_links(void* fnptr, GMenuModel* arg0, gint arg1, GHashTable** arg2) { +// ((void (*)(GMenuModel*, gint, GHashTable**))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_MountOperation_virtual_aborted(void* fnptr, GMountOperation* arg0) { +// ((void (*)(GMountOperation*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_MountOperation_virtual_ask_password(void* fnptr, GMountOperation* arg0, char* arg1, char* arg2, char* arg3, GAskPasswordFlags arg4) { +// ((void (*)(GMountOperation*, char*, char*, char*, GAskPasswordFlags))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_MountOperation_virtual_ask_question(void* fnptr, GMountOperation* arg0, char* arg1, char** arg2) { +// ((void (*)(GMountOperation*, char*, char**))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_MountOperation_virtual_reply(void* fnptr, GMountOperation* arg0, GMountOperationResult arg1) { +// ((void (*)(GMountOperation*, GMountOperationResult))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_MountOperation_virtual_show_unmount_progress(void* fnptr, GMountOperation* arg0, gchar* arg1, gint64 arg2, gint64 arg3) { +// ((void (*)(GMountOperation*, gchar*, gint64, gint64))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_Mount_virtual_changed(void* fnptr, GMount* arg0) { +// ((void (*)(GMount*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Mount_virtual_eject(void* fnptr, GMount* arg0, GMountUnmountFlags arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GMount*, GMountUnmountFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_Mount_virtual_eject_with_operation(void* fnptr, GMount* arg0, GMountUnmountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GMount*, GMountUnmountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Mount_virtual_guess_content_type(void* fnptr, GMount* arg0, gboolean arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GMount*, gboolean, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_Mount_virtual_pre_unmount(void* fnptr, GMount* arg0) { +// ((void (*)(GMount*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Mount_virtual_remount(void* fnptr, GMount* arg0, GMountMountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GMount*, GMountMountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Mount_virtual_unmount(void* fnptr, GMount* arg0, GMountUnmountFlags arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GMount*, GMountUnmountFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_Mount_virtual_unmount_with_operation(void* fnptr, GMount* arg0, GMountUnmountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GMount*, GMountUnmountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Mount_virtual_unmounted(void* fnptr, GMount* arg0) { +// ((void (*)(GMount*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_NetworkMonitor_virtual_can_reach_async(void* fnptr, GNetworkMonitor* arg0, GSocketConnectable* arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GNetworkMonitor*, GSocketConnectable*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_NetworkMonitor_virtual_network_changed(void* fnptr, GNetworkMonitor* arg0, gboolean arg1) { +// ((void (*)(GNetworkMonitor*, gboolean))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_OutputStream_virtual_close_async(void* fnptr, GOutputStream* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GOutputStream*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_OutputStream_virtual_flush_async(void* fnptr, GOutputStream* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GOutputStream*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_OutputStream_virtual_splice_async(void* fnptr, GOutputStream* arg0, GInputStream* arg1, GOutputStreamSpliceFlags arg2, int arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GOutputStream*, GInputStream*, GOutputStreamSpliceFlags, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_OutputStream_virtual_write_async(void* fnptr, GOutputStream* arg0, void* arg1, gsize arg2, int arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GOutputStream*, void*, gsize, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_OutputStream_virtual_writev_async(void* fnptr, GOutputStream* arg0, GOutputVector* arg1, gsize arg2, int arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GOutputStream*, GOutputVector*, gsize, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_Permission_virtual_acquire_async(void* fnptr, GPermission* arg0, GCancellable* arg1, GAsyncReadyCallback arg2, gpointer arg3) { +// ((void (*)(GPermission*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_Permission_virtual_release_async(void* fnptr, GPermission* arg0, GCancellable* arg1, GAsyncReadyCallback arg2, gpointer arg3) { +// ((void (*)(GPermission*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_ProxyResolver_virtual_lookup_async(void* fnptr, GProxyResolver* arg0, gchar* arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GProxyResolver*, gchar*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_Proxy_virtual_connect_async(void* fnptr, GProxy* arg0, GIOStream* arg1, GProxyAddress* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GProxy*, GIOStream*, GProxyAddress*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_RemoteActionGroup_virtual_activate_action_full(void* fnptr, GRemoteActionGroup* arg0, gchar* arg1, GVariant* arg2, GVariant* arg3) { +// ((void (*)(GRemoteActionGroup*, gchar*, GVariant*, GVariant*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_RemoteActionGroup_virtual_change_action_state_full(void* fnptr, GRemoteActionGroup* arg0, gchar* arg1, GVariant* arg2, GVariant* arg3) { +// ((void (*)(GRemoteActionGroup*, gchar*, GVariant*, GVariant*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_Resolver_virtual_lookup_by_address_async(void* fnptr, GResolver* arg0, GInetAddress* arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GResolver*, GInetAddress*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_Resolver_virtual_lookup_by_name_async(void* fnptr, GResolver* arg0, gchar* arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GResolver*, gchar*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_Resolver_virtual_lookup_by_name_with_flags_async(void* fnptr, GResolver* arg0, gchar* arg1, GResolverNameLookupFlags arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GResolver*, gchar*, GResolverNameLookupFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Resolver_virtual_lookup_records_async(void* fnptr, GResolver* arg0, gchar* arg1, GResolverRecordType arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GResolver*, gchar*, GResolverRecordType, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Resolver_virtual_lookup_service_async(void* fnptr, GResolver* arg0, gchar* arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GResolver*, gchar*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_Resolver_virtual_reload(void* fnptr, GResolver* arg0) { +// ((void (*)(GResolver*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Settings_virtual_changed(void* fnptr, GSettings* arg0, gchar* arg1) { +// ((void (*)(GSettings*, gchar*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_Settings_virtual_writable_changed(void* fnptr, GSettings* arg0, gchar* arg1) { +// ((void (*)(GSettings*, gchar*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_SocketAddressEnumerator_virtual_next_async(void* fnptr, GSocketAddressEnumerator* arg0, GCancellable* arg1, GAsyncReadyCallback arg2, gpointer arg3) { +// ((void (*)(GSocketAddressEnumerator*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_SocketClient_virtual_event(void* fnptr, GSocketClient* arg0, GSocketClientEvent arg1, GSocketConnectable* arg2, GIOStream* arg3) { +// ((void (*)(GSocketClient*, GSocketClientEvent, GSocketConnectable*, GIOStream*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gio2_SocketControlMessage_virtual_serialize(void* fnptr, GSocketControlMessage* arg0, gpointer arg1) { +// ((void (*)(GSocketControlMessage*, gpointer))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_SocketListener_virtual_changed(void* fnptr, GSocketListener* arg0) { +// ((void (*)(GSocketListener*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_SocketListener_virtual_event(void* fnptr, GSocketListener* arg0, GSocketListenerEvent arg1, GSocket* arg2) { +// ((void (*)(GSocketListener*, GSocketListenerEvent, GSocket*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_TLSClientConnection_virtual_copy_session_state(void* fnptr, GTlsClientConnection* arg0, GTlsClientConnection* arg1) { +// ((void (*)(GTlsClientConnection*, GTlsClientConnection*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_TLSConnection_virtual_handshake_async(void* fnptr, GTlsConnection* arg0, int arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GTlsConnection*, int, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_TLSDatabase_virtual_lookup_certificate_for_handle_async(void* fnptr, GTlsDatabase* arg0, gchar* arg1, GTlsInteraction* arg2, GTlsDatabaseLookupFlags arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GTlsDatabase*, gchar*, GTlsInteraction*, GTlsDatabaseLookupFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_TLSDatabase_virtual_lookup_certificate_issuer_async(void* fnptr, GTlsDatabase* arg0, GTlsCertificate* arg1, GTlsInteraction* arg2, GTlsDatabaseLookupFlags arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GTlsDatabase*, GTlsCertificate*, GTlsInteraction*, GTlsDatabaseLookupFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_TLSDatabase_virtual_lookup_certificates_issued_by_async(void* fnptr, GTlsDatabase* arg0, GByteArray* arg1, GTlsInteraction* arg2, GTlsDatabaseLookupFlags arg3, GCancellable* arg4, GAsyncReadyCallback arg5, gpointer arg6) { +// ((void (*)(GTlsDatabase*, GByteArray*, GTlsInteraction*, GTlsDatabaseLookupFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gio2_TLSDatabase_virtual_verify_chain_async(void* fnptr, GTlsDatabase* arg0, GTlsCertificate* arg1, gchar* arg2, GSocketConnectable* arg3, GTlsInteraction* arg4, GTlsDatabaseVerifyFlags arg5, GCancellable* arg6, GAsyncReadyCallback arg7, gpointer arg8) { +// ((void (*)(GTlsDatabase*, GTlsCertificate*, gchar*, GSocketConnectable*, GTlsInteraction*, GTlsDatabaseVerifyFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); +// }; +// void _gotk4_gio2_TLSInteraction_virtual_ask_password_async(void* fnptr, GTlsInteraction* arg0, GTlsPassword* arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GTlsInteraction*, GTlsPassword*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_TLSInteraction_virtual_request_certificate_async(void* fnptr, GTlsInteraction* arg0, GTlsConnection* arg1, GTlsCertificateRequestFlags arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GTlsInteraction*, GTlsConnection*, GTlsCertificateRequestFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_VFS_virtual_add_writable_namespaces(void* fnptr, GVfs* arg0, GFileAttributeInfoList* arg1) { +// ((void (*)(GVfs*, GFileAttributeInfoList*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VFS_virtual_local_file_moved(void* fnptr, GVfs* arg0, char* arg1, char* arg2) { +// ((void (*)(GVfs*, char*, char*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gio2_VFS_virtual_local_file_removed(void* fnptr, GVfs* arg0, char* arg1) { +// ((void (*)(GVfs*, char*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_drive_changed(void* fnptr, GVolumeMonitor* arg0, GDrive* arg1) { +// ((void (*)(GVolumeMonitor*, GDrive*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_drive_connected(void* fnptr, GVolumeMonitor* arg0, GDrive* arg1) { +// ((void (*)(GVolumeMonitor*, GDrive*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_drive_disconnected(void* fnptr, GVolumeMonitor* arg0, GDrive* arg1) { +// ((void (*)(GVolumeMonitor*, GDrive*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_drive_eject_button(void* fnptr, GVolumeMonitor* arg0, GDrive* arg1) { +// ((void (*)(GVolumeMonitor*, GDrive*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_drive_stop_button(void* fnptr, GVolumeMonitor* arg0, GDrive* arg1) { +// ((void (*)(GVolumeMonitor*, GDrive*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_mount_added(void* fnptr, GVolumeMonitor* arg0, GMount* arg1) { +// ((void (*)(GVolumeMonitor*, GMount*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_mount_changed(void* fnptr, GVolumeMonitor* arg0, GMount* arg1) { +// ((void (*)(GVolumeMonitor*, GMount*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_mount_pre_unmount(void* fnptr, GVolumeMonitor* arg0, GMount* arg1) { +// ((void (*)(GVolumeMonitor*, GMount*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_mount_removed(void* fnptr, GVolumeMonitor* arg0, GMount* arg1) { +// ((void (*)(GVolumeMonitor*, GMount*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_volume_added(void* fnptr, GVolumeMonitor* arg0, GVolume* arg1) { +// ((void (*)(GVolumeMonitor*, GVolume*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_volume_changed(void* fnptr, GVolumeMonitor* arg0, GVolume* arg1) { +// ((void (*)(GVolumeMonitor*, GVolume*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_VolumeMonitor_virtual_volume_removed(void* fnptr, GVolumeMonitor* arg0, GVolume* arg1) { +// ((void (*)(GVolumeMonitor*, GVolume*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gio2_Volume_virtual_changed(void* fnptr, GVolume* arg0) { +// ((void (*)(GVolume*))(fnptr))(arg0); +// }; +// void _gotk4_gio2_Volume_virtual_eject(void* fnptr, GVolume* arg0, GMountUnmountFlags arg1, GCancellable* arg2, GAsyncReadyCallback arg3, gpointer arg4) { +// ((void (*)(GVolume*, GMountUnmountFlags, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gio2_Volume_virtual_eject_with_operation(void* fnptr, GVolume* arg0, GMountUnmountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GVolume*, GMountUnmountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Volume_virtual_mount_fn(void* fnptr, GVolume* arg0, GMountMountFlags arg1, GMountOperation* arg2, GCancellable* arg3, GAsyncReadyCallback arg4, gpointer arg5) { +// ((void (*)(GVolume*, GMountMountFlags, GMountOperation*, GCancellable*, GAsyncReadyCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gio2_Volume_virtual_removed(void* fnptr, GVolume* arg0) { +// ((void (*)(GVolume*))(fnptr))(arg0); +// }; +import "C" + +// GType values. +var ( + GTypeBusType = coreglib.Type(C.g_bus_type_get_type()) + GTypeConverterResult = coreglib.Type(C.g_converter_result_get_type()) + GTypeCredentialsType = coreglib.Type(C.g_credentials_type_get_type()) + GTypeDBusError = coreglib.Type(C.g_dbus_error_get_type()) + GTypeDBusMessageByteOrder = coreglib.Type(C.g_dbus_message_byte_order_get_type()) + GTypeDBusMessageHeaderField = coreglib.Type(C.g_dbus_message_header_field_get_type()) + GTypeDBusMessageType = coreglib.Type(C.g_dbus_message_type_get_type()) + GTypeDataStreamByteOrder = coreglib.Type(C.g_data_stream_byte_order_get_type()) + GTypeDataStreamNewlineType = coreglib.Type(C.g_data_stream_newline_type_get_type()) + GTypeDriveStartStopType = coreglib.Type(C.g_drive_start_stop_type_get_type()) + GTypeEmblemOrigin = coreglib.Type(C.g_emblem_origin_get_type()) + GTypeFileAttributeStatus = coreglib.Type(C.g_file_attribute_status_get_type()) + GTypeFileAttributeType = coreglib.Type(C.g_file_attribute_type_get_type()) + GTypeFileMonitorEvent = coreglib.Type(C.g_file_monitor_event_get_type()) + GTypeFileType = coreglib.Type(C.g_file_type_get_type()) + GTypeFilesystemPreviewType = coreglib.Type(C.g_filesystem_preview_type_get_type()) + GTypeIOErrorEnum = coreglib.Type(C.g_io_error_enum_get_type()) + GTypeIOModuleScopeFlags = coreglib.Type(C.g_io_module_scope_flags_get_type()) + GTypeMemoryMonitorWarningLevel = coreglib.Type(C.g_memory_monitor_warning_level_get_type()) + GTypeMountOperationResult = coreglib.Type(C.g_mount_operation_result_get_type()) + GTypeNetworkConnectivity = coreglib.Type(C.g_network_connectivity_get_type()) + GTypeNotificationPriority = coreglib.Type(C.g_notification_priority_get_type()) + GTypePasswordSave = coreglib.Type(C.g_password_save_get_type()) + GTypePollableReturn = coreglib.Type(C.g_pollable_return_get_type()) + GTypeResolverError = coreglib.Type(C.g_resolver_error_get_type()) + GTypeResolverRecordType = coreglib.Type(C.g_resolver_record_type_get_type()) + GTypeResourceError = coreglib.Type(C.g_resource_error_get_type()) + GTypeSocketClientEvent = coreglib.Type(C.g_socket_client_event_get_type()) + GTypeSocketFamily = coreglib.Type(C.g_socket_family_get_type()) + GTypeSocketListenerEvent = coreglib.Type(C.g_socket_listener_event_get_type()) + GTypeSocketProtocol = coreglib.Type(C.g_socket_protocol_get_type()) + GTypeSocketType = coreglib.Type(C.g_socket_type_get_type()) + GTypeTLSAuthenticationMode = coreglib.Type(C.g_tls_authentication_mode_get_type()) + GTypeTLSCertificateRequestFlags = coreglib.Type(C.g_tls_certificate_request_flags_get_type()) + GTypeTLSChannelBindingError = coreglib.Type(C.g_tls_channel_binding_error_get_type()) + GTypeTLSChannelBindingType = coreglib.Type(C.g_tls_channel_binding_type_get_type()) + GTypeTLSDatabaseLookupFlags = coreglib.Type(C.g_tls_database_lookup_flags_get_type()) + GTypeTLSError = coreglib.Type(C.g_tls_error_get_type()) + GTypeTLSInteractionResult = coreglib.Type(C.g_tls_interaction_result_get_type()) + GTypeTLSProtocolVersion = coreglib.Type(C.g_tls_protocol_version_get_type()) + GTypeTLSRehandshakeMode = coreglib.Type(C.g_tls_rehandshake_mode_get_type()) + GTypeZlibCompressorFormat = coreglib.Type(C.g_zlib_compressor_format_get_type()) + GTypeAppInfoCreateFlags = coreglib.Type(C.g_app_info_create_flags_get_type()) + GTypeApplicationFlags = coreglib.Type(C.g_application_flags_get_type()) + GTypeAskPasswordFlags = coreglib.Type(C.g_ask_password_flags_get_type()) + GTypeBusNameOwnerFlags = coreglib.Type(C.g_bus_name_owner_flags_get_type()) + GTypeBusNameWatcherFlags = coreglib.Type(C.g_bus_name_watcher_flags_get_type()) + GTypeConverterFlags = coreglib.Type(C.g_converter_flags_get_type()) + GTypeDBusCallFlags = coreglib.Type(C.g_dbus_call_flags_get_type()) + GTypeDBusCapabilityFlags = coreglib.Type(C.g_dbus_capability_flags_get_type()) + GTypeDBusConnectionFlags = coreglib.Type(C.g_dbus_connection_flags_get_type()) + GTypeDBusInterfaceSkeletonFlags = coreglib.Type(C.g_dbus_interface_skeleton_flags_get_type()) + GTypeDBusMessageFlags = coreglib.Type(C.g_dbus_message_flags_get_type()) + GTypeDBusObjectManagerClientFlags = coreglib.Type(C.g_dbus_object_manager_client_flags_get_type()) + GTypeDBusPropertyInfoFlags = coreglib.Type(C.g_dbus_property_info_flags_get_type()) + GTypeDBusProxyFlags = coreglib.Type(C.g_dbus_proxy_flags_get_type()) + GTypeDBusSendMessageFlags = coreglib.Type(C.g_dbus_send_message_flags_get_type()) + GTypeDBusServerFlags = coreglib.Type(C.g_dbus_server_flags_get_type()) + GTypeDBusSignalFlags = coreglib.Type(C.g_dbus_signal_flags_get_type()) + GTypeDBusSubtreeFlags = coreglib.Type(C.g_dbus_subtree_flags_get_type()) + GTypeDriveStartFlags = coreglib.Type(C.g_drive_start_flags_get_type()) + GTypeFileAttributeInfoFlags = coreglib.Type(C.g_file_attribute_info_flags_get_type()) + GTypeFileCopyFlags = coreglib.Type(C.g_file_copy_flags_get_type()) + GTypeFileCreateFlags = coreglib.Type(C.g_file_create_flags_get_type()) + GTypeFileMeasureFlags = coreglib.Type(C.g_file_measure_flags_get_type()) + GTypeFileMonitorFlags = coreglib.Type(C.g_file_monitor_flags_get_type()) + GTypeFileQueryInfoFlags = coreglib.Type(C.g_file_query_info_flags_get_type()) + GTypeIOStreamSpliceFlags = coreglib.Type(C.g_io_stream_splice_flags_get_type()) + GTypeMountMountFlags = coreglib.Type(C.g_mount_mount_flags_get_type()) + GTypeMountUnmountFlags = coreglib.Type(C.g_mount_unmount_flags_get_type()) + GTypeOutputStreamSpliceFlags = coreglib.Type(C.g_output_stream_splice_flags_get_type()) + GTypeResolverNameLookupFlags = coreglib.Type(C.g_resolver_name_lookup_flags_get_type()) + GTypeResourceFlags = coreglib.Type(C.g_resource_flags_get_type()) + GTypeResourceLookupFlags = coreglib.Type(C.g_resource_lookup_flags_get_type()) + GTypeSettingsBindFlags = coreglib.Type(C.g_settings_bind_flags_get_type()) + GTypeSocketMsgFlags = coreglib.Type(C.g_socket_msg_flags_get_type()) + GTypeSubprocessFlags = coreglib.Type(C.g_subprocess_flags_get_type()) + GTypeTestDBusFlags = coreglib.Type(C.g_test_dbus_flags_get_type()) + GTypeTLSCertificateFlags = coreglib.Type(C.g_tls_certificate_flags_get_type()) + GTypeTLSDatabaseVerifyFlags = coreglib.Type(C.g_tls_database_verify_flags_get_type()) + GTypeTLSPasswordFlags = coreglib.Type(C.g_tls_password_flags_get_type()) + GTypeAction = coreglib.Type(C.g_action_get_type()) + GTypeActionGroup = coreglib.Type(C.g_action_group_get_type()) + GTypeActionMap = coreglib.Type(C.g_action_map_get_type()) + GTypeAppInfo = coreglib.Type(C.g_app_info_get_type()) + GTypeAsyncInitable = coreglib.Type(C.g_async_initable_get_type()) + GTypeAsyncResult = coreglib.Type(C.g_async_result_get_type()) + GTypeConverter = coreglib.Type(C.g_converter_get_type()) + GTypeDBusInterface = coreglib.Type(C.g_dbus_interface_get_type()) + GTypeDBusObject = coreglib.Type(C.g_dbus_object_get_type()) + GTypeDBusObjectManager = coreglib.Type(C.g_dbus_object_manager_get_type()) + GTypeDatagramBased = coreglib.Type(C.g_datagram_based_get_type()) + GTypeDebugController = coreglib.Type(C.g_debug_controller_get_type()) + GTypeDrive = coreglib.Type(C.g_drive_get_type()) + GTypeDTLSClientConnection = coreglib.Type(C.g_dtls_client_connection_get_type()) + GTypeDTLSConnection = coreglib.Type(C.g_dtls_connection_get_type()) + GTypeDTLSServerConnection = coreglib.Type(C.g_dtls_server_connection_get_type()) + GTypeFile = coreglib.Type(C.g_file_get_type()) + GTypeIcon = coreglib.Type(C.g_icon_get_type()) + GTypeInitable = coreglib.Type(C.g_initable_get_type()) + GTypeListModel = coreglib.Type(C.g_list_model_get_type()) + GTypeLoadableIcon = coreglib.Type(C.g_loadable_icon_get_type()) + GTypeMemoryMonitor = coreglib.Type(C.g_memory_monitor_get_type()) + GTypeMount = coreglib.Type(C.g_mount_get_type()) + GTypeNetworkMonitor = coreglib.Type(C.g_network_monitor_get_type()) + GTypePollableInputStream = coreglib.Type(C.g_pollable_input_stream_get_type()) + GTypePollableOutputStream = coreglib.Type(C.g_pollable_output_stream_get_type()) + GTypePowerProfileMonitor = coreglib.Type(C.g_power_profile_monitor_get_type()) + GTypeProxy = coreglib.Type(C.g_proxy_get_type()) + GTypeProxyResolver = coreglib.Type(C.g_proxy_resolver_get_type()) + GTypeRemoteActionGroup = coreglib.Type(C.g_remote_action_group_get_type()) + GTypeSeekable = coreglib.Type(C.g_seekable_get_type()) + GTypeSocketConnectable = coreglib.Type(C.g_socket_connectable_get_type()) + GTypeTLSBackend = coreglib.Type(C.g_tls_backend_get_type()) + GTypeTLSClientConnection = coreglib.Type(C.g_tls_client_connection_get_type()) + GTypeTLSFileDatabase = coreglib.Type(C.g_tls_file_database_get_type()) + GTypeTLSServerConnection = coreglib.Type(C.g_tls_server_connection_get_type()) + GTypeVolume = coreglib.Type(C.g_volume_get_type()) + GTypeAppInfoMonitor = coreglib.Type(C.g_app_info_monitor_get_type()) + GTypeAppLaunchContext = coreglib.Type(C.g_app_launch_context_get_type()) + GTypeApplication = coreglib.Type(C.g_application_get_type()) + GTypeApplicationCommandLine = coreglib.Type(C.g_application_command_line_get_type()) + GTypeBufferedInputStream = coreglib.Type(C.g_buffered_input_stream_get_type()) + GTypeBufferedOutputStream = coreglib.Type(C.g_buffered_output_stream_get_type()) + GTypeBytesIcon = coreglib.Type(C.g_bytes_icon_get_type()) + GTypeCancellable = coreglib.Type(C.g_cancellable_get_type()) + GTypeCharsetConverter = coreglib.Type(C.g_charset_converter_get_type()) + GTypeConverterInputStream = coreglib.Type(C.g_converter_input_stream_get_type()) + GTypeConverterOutputStream = coreglib.Type(C.g_converter_output_stream_get_type()) + GTypeCredentials = coreglib.Type(C.g_credentials_get_type()) + GTypeDBusActionGroup = coreglib.Type(C.g_dbus_action_group_get_type()) + GTypeDBusAuthObserver = coreglib.Type(C.g_dbus_auth_observer_get_type()) + GTypeDBusConnection = coreglib.Type(C.g_dbus_connection_get_type()) + GTypeDBusInterfaceSkeleton = coreglib.Type(C.g_dbus_interface_skeleton_get_type()) + GTypeDBusMenuModel = coreglib.Type(C.g_dbus_menu_model_get_type()) + GTypeDBusMessage = coreglib.Type(C.g_dbus_message_get_type()) + GTypeDBusMethodInvocation = coreglib.Type(C.g_dbus_method_invocation_get_type()) + GTypeDBusObjectManagerClient = coreglib.Type(C.g_dbus_object_manager_client_get_type()) + GTypeDBusObjectManagerServer = coreglib.Type(C.g_dbus_object_manager_server_get_type()) + GTypeDBusObjectProxy = coreglib.Type(C.g_dbus_object_proxy_get_type()) + GTypeDBusObjectSkeleton = coreglib.Type(C.g_dbus_object_skeleton_get_type()) + GTypeDBusProxy = coreglib.Type(C.g_dbus_proxy_get_type()) + GTypeDBusServer = coreglib.Type(C.g_dbus_server_get_type()) + GTypeDataInputStream = coreglib.Type(C.g_data_input_stream_get_type()) + GTypeDataOutputStream = coreglib.Type(C.g_data_output_stream_get_type()) + GTypeDebugControllerDBus = coreglib.Type(C.g_debug_controller_dbus_get_type()) + GTypeEmblem = coreglib.Type(C.g_emblem_get_type()) + GTypeEmblemedIcon = coreglib.Type(C.g_emblemed_icon_get_type()) + GTypeFileEnumerator = coreglib.Type(C.g_file_enumerator_get_type()) + GTypeFileIOStream = coreglib.Type(C.g_file_io_stream_get_type()) + GTypeFileIcon = coreglib.Type(C.g_file_icon_get_type()) + GTypeFileInfo = coreglib.Type(C.g_file_info_get_type()) + GTypeFileInputStream = coreglib.Type(C.g_file_input_stream_get_type()) + GTypeFileMonitor = coreglib.Type(C.g_file_monitor_get_type()) + GTypeFileOutputStream = coreglib.Type(C.g_file_output_stream_get_type()) + GTypeFilenameCompleter = coreglib.Type(C.g_filename_completer_get_type()) + GTypeFilterInputStream = coreglib.Type(C.g_filter_input_stream_get_type()) + GTypeFilterOutputStream = coreglib.Type(C.g_filter_output_stream_get_type()) + GTypeIOStream = coreglib.Type(C.g_io_stream_get_type()) + GTypeInetAddress = coreglib.Type(C.g_inet_address_get_type()) + GTypeInetAddressMask = coreglib.Type(C.g_inet_address_mask_get_type()) + GTypeInetSocketAddress = coreglib.Type(C.g_inet_socket_address_get_type()) + GTypeInputStream = coreglib.Type(C.g_input_stream_get_type()) + GTypeListStore = coreglib.Type(C.g_list_store_get_type()) + GTypeMemoryInputStream = coreglib.Type(C.g_memory_input_stream_get_type()) + GTypeMemoryOutputStream = coreglib.Type(C.g_memory_output_stream_get_type()) + GTypeMenu = coreglib.Type(C.g_menu_get_type()) + GTypeMenuAttributeIter = coreglib.Type(C.g_menu_attribute_iter_get_type()) + GTypeMenuItem = coreglib.Type(C.g_menu_item_get_type()) + GTypeMenuLinkIter = coreglib.Type(C.g_menu_link_iter_get_type()) + GTypeMenuModel = coreglib.Type(C.g_menu_model_get_type()) + GTypeMountOperation = coreglib.Type(C.g_mount_operation_get_type()) + GTypeNativeSocketAddress = coreglib.Type(C.g_native_socket_address_get_type()) + GTypeNativeVolumeMonitor = coreglib.Type(C.g_native_volume_monitor_get_type()) + GTypeNetworkAddress = coreglib.Type(C.g_network_address_get_type()) + GTypeNetworkService = coreglib.Type(C.g_network_service_get_type()) + GTypeNotification = coreglib.Type(C.g_notification_get_type()) + GTypeOutputStream = coreglib.Type(C.g_output_stream_get_type()) + GTypePermission = coreglib.Type(C.g_permission_get_type()) + GTypePropertyAction = coreglib.Type(C.g_property_action_get_type()) + GTypeProxyAddress = coreglib.Type(C.g_proxy_address_get_type()) + GTypeProxyAddressEnumerator = coreglib.Type(C.g_proxy_address_enumerator_get_type()) + GTypeResolver = coreglib.Type(C.g_resolver_get_type()) + GTypeSettings = coreglib.Type(C.g_settings_get_type()) + GTypeSimpleAction = coreglib.Type(C.g_simple_action_get_type()) + GTypeSimpleActionGroup = coreglib.Type(C.g_simple_action_group_get_type()) + GTypeSimpleAsyncResult = coreglib.Type(C.g_simple_async_result_get_type()) + GTypeSimpleIOStream = coreglib.Type(C.g_simple_io_stream_get_type()) + GTypeSimplePermission = coreglib.Type(C.g_simple_permission_get_type()) + GTypeSimpleProxyResolver = coreglib.Type(C.g_simple_proxy_resolver_get_type()) + GTypeSocket = coreglib.Type(C.g_socket_get_type()) + GTypeSocketAddress = coreglib.Type(C.g_socket_address_get_type()) + GTypeSocketAddressEnumerator = coreglib.Type(C.g_socket_address_enumerator_get_type()) + GTypeSocketClient = coreglib.Type(C.g_socket_client_get_type()) + GTypeSocketConnection = coreglib.Type(C.g_socket_connection_get_type()) + GTypeSocketControlMessage = coreglib.Type(C.g_socket_control_message_get_type()) + GTypeSocketListener = coreglib.Type(C.g_socket_listener_get_type()) + GTypeSocketService = coreglib.Type(C.g_socket_service_get_type()) + GTypeTask = coreglib.Type(C.g_task_get_type()) + GTypeTCPConnection = coreglib.Type(C.g_tcp_connection_get_type()) + GTypeTCPWrapperConnection = coreglib.Type(C.g_tcp_wrapper_connection_get_type()) + GTypeTestDBus = coreglib.Type(C.g_test_dbus_get_type()) + GTypeThemedIcon = coreglib.Type(C.g_themed_icon_get_type()) + GTypeThreadedSocketService = coreglib.Type(C.g_threaded_socket_service_get_type()) + GTypeTLSCertificate = coreglib.Type(C.g_tls_certificate_get_type()) + GTypeTLSConnection = coreglib.Type(C.g_tls_connection_get_type()) + GTypeTLSDatabase = coreglib.Type(C.g_tls_database_get_type()) + GTypeTLSInteraction = coreglib.Type(C.g_tls_interaction_get_type()) + GTypeTLSPassword = coreglib.Type(C.g_tls_password_get_type()) + GTypeVFS = coreglib.Type(C.g_vfs_get_type()) + GTypeVolumeMonitor = coreglib.Type(C.g_volume_monitor_get_type()) + GTypeZlibCompressor = coreglib.Type(C.g_zlib_compressor_get_type()) + GTypeZlibDecompressor = coreglib.Type(C.g_zlib_decompressor_get_type()) + GTypeDBusAnnotationInfo = coreglib.Type(C.g_dbus_annotation_info_get_type()) + GTypeDBusArgInfo = coreglib.Type(C.g_dbus_arg_info_get_type()) + GTypeDBusInterfaceInfo = coreglib.Type(C.g_dbus_interface_info_get_type()) + GTypeDBusMethodInfo = coreglib.Type(C.g_dbus_method_info_get_type()) + GTypeDBusNodeInfo = coreglib.Type(C.g_dbus_node_info_get_type()) + GTypeDBusPropertyInfo = coreglib.Type(C.g_dbus_property_info_get_type()) + GTypeDBusSignalInfo = coreglib.Type(C.g_dbus_signal_info_get_type()) + GTypeFileAttributeInfoList = coreglib.Type(C.g_file_attribute_info_list_get_type()) + GTypeFileAttributeMatcher = coreglib.Type(C.g_file_attribute_matcher_get_type()) + GTypeResource = coreglib.Type(C.g_resource_get_type()) + GTypeSettingsSchema = coreglib.Type(C.g_settings_schema_get_type()) + GTypeSettingsSchemaKey = coreglib.Type(C.g_settings_schema_key_get_type()) + GTypeSettingsSchemaSource = coreglib.Type(C.g_settings_schema_source_get_type()) + GTypeSrvTarget = coreglib.Type(C.g_srv_target_get_type()) +) + +func init() { + coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{ + coreglib.TypeMarshaler{T: GTypeBusType, F: marshalBusType}, + coreglib.TypeMarshaler{T: GTypeConverterResult, F: marshalConverterResult}, + coreglib.TypeMarshaler{T: GTypeCredentialsType, F: marshalCredentialsType}, + coreglib.TypeMarshaler{T: GTypeDBusError, F: marshalDBusError}, + coreglib.TypeMarshaler{T: GTypeDBusMessageByteOrder, F: marshalDBusMessageByteOrder}, + coreglib.TypeMarshaler{T: GTypeDBusMessageHeaderField, F: marshalDBusMessageHeaderField}, + coreglib.TypeMarshaler{T: GTypeDBusMessageType, F: marshalDBusMessageType}, + coreglib.TypeMarshaler{T: GTypeDataStreamByteOrder, F: marshalDataStreamByteOrder}, + coreglib.TypeMarshaler{T: GTypeDataStreamNewlineType, F: marshalDataStreamNewlineType}, + coreglib.TypeMarshaler{T: GTypeDriveStartStopType, F: marshalDriveStartStopType}, + coreglib.TypeMarshaler{T: GTypeEmblemOrigin, F: marshalEmblemOrigin}, + coreglib.TypeMarshaler{T: GTypeFileAttributeStatus, F: marshalFileAttributeStatus}, + coreglib.TypeMarshaler{T: GTypeFileAttributeType, F: marshalFileAttributeType}, + coreglib.TypeMarshaler{T: GTypeFileMonitorEvent, F: marshalFileMonitorEvent}, + coreglib.TypeMarshaler{T: GTypeFileType, F: marshalFileType}, + coreglib.TypeMarshaler{T: GTypeFilesystemPreviewType, F: marshalFilesystemPreviewType}, + coreglib.TypeMarshaler{T: GTypeIOErrorEnum, F: marshalIOErrorEnum}, + coreglib.TypeMarshaler{T: GTypeIOModuleScopeFlags, F: marshalIOModuleScopeFlags}, + coreglib.TypeMarshaler{T: GTypeMemoryMonitorWarningLevel, F: marshalMemoryMonitorWarningLevel}, + coreglib.TypeMarshaler{T: GTypeMountOperationResult, F: marshalMountOperationResult}, + coreglib.TypeMarshaler{T: GTypeNetworkConnectivity, F: marshalNetworkConnectivity}, + coreglib.TypeMarshaler{T: GTypeNotificationPriority, F: marshalNotificationPriority}, + coreglib.TypeMarshaler{T: GTypePasswordSave, F: marshalPasswordSave}, + coreglib.TypeMarshaler{T: GTypePollableReturn, F: marshalPollableReturn}, + coreglib.TypeMarshaler{T: GTypeResolverError, F: marshalResolverError}, + coreglib.TypeMarshaler{T: GTypeResolverRecordType, F: marshalResolverRecordType}, + coreglib.TypeMarshaler{T: GTypeResourceError, F: marshalResourceError}, + coreglib.TypeMarshaler{T: GTypeSocketClientEvent, F: marshalSocketClientEvent}, + coreglib.TypeMarshaler{T: GTypeSocketFamily, F: marshalSocketFamily}, + coreglib.TypeMarshaler{T: GTypeSocketListenerEvent, F: marshalSocketListenerEvent}, + coreglib.TypeMarshaler{T: GTypeSocketProtocol, F: marshalSocketProtocol}, + coreglib.TypeMarshaler{T: GTypeSocketType, F: marshalSocketType}, + coreglib.TypeMarshaler{T: GTypeTLSAuthenticationMode, F: marshalTLSAuthenticationMode}, + coreglib.TypeMarshaler{T: GTypeTLSCertificateRequestFlags, F: marshalTLSCertificateRequestFlags}, + coreglib.TypeMarshaler{T: GTypeTLSChannelBindingError, F: marshalTLSChannelBindingError}, + coreglib.TypeMarshaler{T: GTypeTLSChannelBindingType, F: marshalTLSChannelBindingType}, + coreglib.TypeMarshaler{T: GTypeTLSDatabaseLookupFlags, F: marshalTLSDatabaseLookupFlags}, + coreglib.TypeMarshaler{T: GTypeTLSError, F: marshalTLSError}, + coreglib.TypeMarshaler{T: GTypeTLSInteractionResult, F: marshalTLSInteractionResult}, + coreglib.TypeMarshaler{T: GTypeTLSProtocolVersion, F: marshalTLSProtocolVersion}, + coreglib.TypeMarshaler{T: GTypeTLSRehandshakeMode, F: marshalTLSRehandshakeMode}, + coreglib.TypeMarshaler{T: GTypeZlibCompressorFormat, F: marshalZlibCompressorFormat}, + coreglib.TypeMarshaler{T: GTypeAppInfoCreateFlags, F: marshalAppInfoCreateFlags}, + coreglib.TypeMarshaler{T: GTypeApplicationFlags, F: marshalApplicationFlags}, + coreglib.TypeMarshaler{T: GTypeAskPasswordFlags, F: marshalAskPasswordFlags}, + coreglib.TypeMarshaler{T: GTypeBusNameOwnerFlags, F: marshalBusNameOwnerFlags}, + coreglib.TypeMarshaler{T: GTypeBusNameWatcherFlags, F: marshalBusNameWatcherFlags}, + coreglib.TypeMarshaler{T: GTypeConverterFlags, F: marshalConverterFlags}, + coreglib.TypeMarshaler{T: GTypeDBusCallFlags, F: marshalDBusCallFlags}, + coreglib.TypeMarshaler{T: GTypeDBusCapabilityFlags, F: marshalDBusCapabilityFlags}, + coreglib.TypeMarshaler{T: GTypeDBusConnectionFlags, F: marshalDBusConnectionFlags}, + coreglib.TypeMarshaler{T: GTypeDBusInterfaceSkeletonFlags, F: marshalDBusInterfaceSkeletonFlags}, + coreglib.TypeMarshaler{T: GTypeDBusMessageFlags, F: marshalDBusMessageFlags}, + coreglib.TypeMarshaler{T: GTypeDBusObjectManagerClientFlags, F: marshalDBusObjectManagerClientFlags}, + coreglib.TypeMarshaler{T: GTypeDBusPropertyInfoFlags, F: marshalDBusPropertyInfoFlags}, + coreglib.TypeMarshaler{T: GTypeDBusProxyFlags, F: marshalDBusProxyFlags}, + coreglib.TypeMarshaler{T: GTypeDBusSendMessageFlags, F: marshalDBusSendMessageFlags}, + coreglib.TypeMarshaler{T: GTypeDBusServerFlags, F: marshalDBusServerFlags}, + coreglib.TypeMarshaler{T: GTypeDBusSignalFlags, F: marshalDBusSignalFlags}, + coreglib.TypeMarshaler{T: GTypeDBusSubtreeFlags, F: marshalDBusSubtreeFlags}, + coreglib.TypeMarshaler{T: GTypeDriveStartFlags, F: marshalDriveStartFlags}, + coreglib.TypeMarshaler{T: GTypeFileAttributeInfoFlags, F: marshalFileAttributeInfoFlags}, + coreglib.TypeMarshaler{T: GTypeFileCopyFlags, F: marshalFileCopyFlags}, + coreglib.TypeMarshaler{T: GTypeFileCreateFlags, F: marshalFileCreateFlags}, + coreglib.TypeMarshaler{T: GTypeFileMeasureFlags, F: marshalFileMeasureFlags}, + coreglib.TypeMarshaler{T: GTypeFileMonitorFlags, F: marshalFileMonitorFlags}, + coreglib.TypeMarshaler{T: GTypeFileQueryInfoFlags, F: marshalFileQueryInfoFlags}, + coreglib.TypeMarshaler{T: GTypeIOStreamSpliceFlags, F: marshalIOStreamSpliceFlags}, + coreglib.TypeMarshaler{T: GTypeMountMountFlags, F: marshalMountMountFlags}, + coreglib.TypeMarshaler{T: GTypeMountUnmountFlags, F: marshalMountUnmountFlags}, + coreglib.TypeMarshaler{T: GTypeOutputStreamSpliceFlags, F: marshalOutputStreamSpliceFlags}, + coreglib.TypeMarshaler{T: GTypeResolverNameLookupFlags, F: marshalResolverNameLookupFlags}, + coreglib.TypeMarshaler{T: GTypeResourceFlags, F: marshalResourceFlags}, + coreglib.TypeMarshaler{T: GTypeResourceLookupFlags, F: marshalResourceLookupFlags}, + coreglib.TypeMarshaler{T: GTypeSettingsBindFlags, F: marshalSettingsBindFlags}, + coreglib.TypeMarshaler{T: GTypeSocketMsgFlags, F: marshalSocketMsgFlags}, + coreglib.TypeMarshaler{T: GTypeSubprocessFlags, F: marshalSubprocessFlags}, + coreglib.TypeMarshaler{T: GTypeTestDBusFlags, F: marshalTestDBusFlags}, + coreglib.TypeMarshaler{T: GTypeTLSCertificateFlags, F: marshalTLSCertificateFlags}, + coreglib.TypeMarshaler{T: GTypeTLSDatabaseVerifyFlags, F: marshalTLSDatabaseVerifyFlags}, + coreglib.TypeMarshaler{T: GTypeTLSPasswordFlags, F: marshalTLSPasswordFlags}, + coreglib.TypeMarshaler{T: GTypeAction, F: marshalAction}, + coreglib.TypeMarshaler{T: GTypeActionGroup, F: marshalActionGroup}, + coreglib.TypeMarshaler{T: GTypeActionMap, F: marshalActionMap}, + coreglib.TypeMarshaler{T: GTypeAppInfo, F: marshalAppInfo}, + coreglib.TypeMarshaler{T: GTypeAsyncInitable, F: marshalAsyncInitable}, + coreglib.TypeMarshaler{T: GTypeAsyncResult, F: marshalAsyncResult}, + coreglib.TypeMarshaler{T: GTypeConverter, F: marshalConverter}, + coreglib.TypeMarshaler{T: GTypeDBusInterface, F: marshalDBusInterface}, + coreglib.TypeMarshaler{T: GTypeDBusObject, F: marshalDBusObject}, + coreglib.TypeMarshaler{T: GTypeDBusObjectManager, F: marshalDBusObjectManager}, + coreglib.TypeMarshaler{T: GTypeDatagramBased, F: marshalDatagramBased}, + coreglib.TypeMarshaler{T: GTypeDebugController, F: marshalDebugController}, + coreglib.TypeMarshaler{T: GTypeDrive, F: marshalDrive}, + coreglib.TypeMarshaler{T: GTypeDTLSClientConnection, F: marshalDTLSClientConnection}, + coreglib.TypeMarshaler{T: GTypeDTLSConnection, F: marshalDTLSConnection}, + coreglib.TypeMarshaler{T: GTypeDTLSServerConnection, F: marshalDTLSServerConnection}, + coreglib.TypeMarshaler{T: GTypeFile, F: marshalFile}, + coreglib.TypeMarshaler{T: GTypeIcon, F: marshalIcon}, + coreglib.TypeMarshaler{T: GTypeInitable, F: marshalInitable}, + coreglib.TypeMarshaler{T: GTypeListModel, F: marshalListModel}, + coreglib.TypeMarshaler{T: GTypeLoadableIcon, F: marshalLoadableIcon}, + coreglib.TypeMarshaler{T: GTypeMemoryMonitor, F: marshalMemoryMonitor}, + coreglib.TypeMarshaler{T: GTypeMount, F: marshalMount}, + coreglib.TypeMarshaler{T: GTypeNetworkMonitor, F: marshalNetworkMonitor}, + coreglib.TypeMarshaler{T: GTypePollableInputStream, F: marshalPollableInputStream}, + coreglib.TypeMarshaler{T: GTypePollableOutputStream, F: marshalPollableOutputStream}, + coreglib.TypeMarshaler{T: GTypePowerProfileMonitor, F: marshalPowerProfileMonitor}, + coreglib.TypeMarshaler{T: GTypeProxy, F: marshalProxy}, + coreglib.TypeMarshaler{T: GTypeProxyResolver, F: marshalProxyResolver}, + coreglib.TypeMarshaler{T: GTypeRemoteActionGroup, F: marshalRemoteActionGroup}, + coreglib.TypeMarshaler{T: GTypeSeekable, F: marshalSeekable}, + coreglib.TypeMarshaler{T: GTypeSocketConnectable, F: marshalSocketConnectable}, + coreglib.TypeMarshaler{T: GTypeTLSBackend, F: marshalTLSBackend}, + coreglib.TypeMarshaler{T: GTypeTLSClientConnection, F: marshalTLSClientConnection}, + coreglib.TypeMarshaler{T: GTypeTLSFileDatabase, F: marshalTLSFileDatabase}, + coreglib.TypeMarshaler{T: GTypeTLSServerConnection, F: marshalTLSServerConnection}, + coreglib.TypeMarshaler{T: GTypeVolume, F: marshalVolume}, + coreglib.TypeMarshaler{T: GTypeAppInfoMonitor, F: marshalAppInfoMonitor}, + coreglib.TypeMarshaler{T: GTypeAppLaunchContext, F: marshalAppLaunchContext}, + coreglib.TypeMarshaler{T: GTypeApplication, F: marshalApplication}, + coreglib.TypeMarshaler{T: GTypeApplicationCommandLine, F: marshalApplicationCommandLine}, + coreglib.TypeMarshaler{T: GTypeBufferedInputStream, F: marshalBufferedInputStream}, + coreglib.TypeMarshaler{T: GTypeBufferedOutputStream, F: marshalBufferedOutputStream}, + coreglib.TypeMarshaler{T: GTypeBytesIcon, F: marshalBytesIcon}, + coreglib.TypeMarshaler{T: GTypeCancellable, F: marshalCancellable}, + coreglib.TypeMarshaler{T: GTypeCharsetConverter, F: marshalCharsetConverter}, + coreglib.TypeMarshaler{T: GTypeConverterInputStream, F: marshalConverterInputStream}, + coreglib.TypeMarshaler{T: GTypeConverterOutputStream, F: marshalConverterOutputStream}, + coreglib.TypeMarshaler{T: GTypeCredentials, F: marshalCredentials}, + coreglib.TypeMarshaler{T: GTypeDBusActionGroup, F: marshalDBusActionGroup}, + coreglib.TypeMarshaler{T: GTypeDBusAuthObserver, F: marshalDBusAuthObserver}, + coreglib.TypeMarshaler{T: GTypeDBusConnection, F: marshalDBusConnection}, + coreglib.TypeMarshaler{T: GTypeDBusInterfaceSkeleton, F: marshalDBusInterfaceSkeleton}, + coreglib.TypeMarshaler{T: GTypeDBusMenuModel, F: marshalDBusMenuModel}, + coreglib.TypeMarshaler{T: GTypeDBusMessage, F: marshalDBusMessage}, + coreglib.TypeMarshaler{T: GTypeDBusMethodInvocation, F: marshalDBusMethodInvocation}, + coreglib.TypeMarshaler{T: GTypeDBusObjectManagerClient, F: marshalDBusObjectManagerClient}, + coreglib.TypeMarshaler{T: GTypeDBusObjectManagerServer, F: marshalDBusObjectManagerServer}, + coreglib.TypeMarshaler{T: GTypeDBusObjectProxy, F: marshalDBusObjectProxy}, + coreglib.TypeMarshaler{T: GTypeDBusObjectSkeleton, F: marshalDBusObjectSkeleton}, + coreglib.TypeMarshaler{T: GTypeDBusProxy, F: marshalDBusProxy}, + coreglib.TypeMarshaler{T: GTypeDBusServer, F: marshalDBusServer}, + coreglib.TypeMarshaler{T: GTypeDataInputStream, F: marshalDataInputStream}, + coreglib.TypeMarshaler{T: GTypeDataOutputStream, F: marshalDataOutputStream}, + coreglib.TypeMarshaler{T: GTypeDebugControllerDBus, F: marshalDebugControllerDBus}, + coreglib.TypeMarshaler{T: GTypeEmblem, F: marshalEmblem}, + coreglib.TypeMarshaler{T: GTypeEmblemedIcon, F: marshalEmblemedIcon}, + coreglib.TypeMarshaler{T: GTypeFileEnumerator, F: marshalFileEnumerator}, + coreglib.TypeMarshaler{T: GTypeFileIOStream, F: marshalFileIOStream}, + coreglib.TypeMarshaler{T: GTypeFileIcon, F: marshalFileIcon}, + coreglib.TypeMarshaler{T: GTypeFileInfo, F: marshalFileInfo}, + coreglib.TypeMarshaler{T: GTypeFileInputStream, F: marshalFileInputStream}, + coreglib.TypeMarshaler{T: GTypeFileMonitor, F: marshalFileMonitor}, + coreglib.TypeMarshaler{T: GTypeFileOutputStream, F: marshalFileOutputStream}, + coreglib.TypeMarshaler{T: GTypeFilenameCompleter, F: marshalFilenameCompleter}, + coreglib.TypeMarshaler{T: GTypeFilterInputStream, F: marshalFilterInputStream}, + coreglib.TypeMarshaler{T: GTypeFilterOutputStream, F: marshalFilterOutputStream}, + coreglib.TypeMarshaler{T: GTypeIOStream, F: marshalIOStream}, + coreglib.TypeMarshaler{T: GTypeInetAddress, F: marshalInetAddress}, + coreglib.TypeMarshaler{T: GTypeInetAddressMask, F: marshalInetAddressMask}, + coreglib.TypeMarshaler{T: GTypeInetSocketAddress, F: marshalInetSocketAddress}, + coreglib.TypeMarshaler{T: GTypeInputStream, F: marshalInputStream}, + coreglib.TypeMarshaler{T: GTypeListStore, F: marshalListStore}, + coreglib.TypeMarshaler{T: GTypeMemoryInputStream, F: marshalMemoryInputStream}, + coreglib.TypeMarshaler{T: GTypeMemoryOutputStream, F: marshalMemoryOutputStream}, + coreglib.TypeMarshaler{T: GTypeMenu, F: marshalMenu}, + coreglib.TypeMarshaler{T: GTypeMenuAttributeIter, F: marshalMenuAttributeIter}, + coreglib.TypeMarshaler{T: GTypeMenuItem, F: marshalMenuItem}, + coreglib.TypeMarshaler{T: GTypeMenuLinkIter, F: marshalMenuLinkIter}, + coreglib.TypeMarshaler{T: GTypeMenuModel, F: marshalMenuModel}, + coreglib.TypeMarshaler{T: GTypeMountOperation, F: marshalMountOperation}, + coreglib.TypeMarshaler{T: GTypeNativeSocketAddress, F: marshalNativeSocketAddress}, + coreglib.TypeMarshaler{T: GTypeNativeVolumeMonitor, F: marshalNativeVolumeMonitor}, + coreglib.TypeMarshaler{T: GTypeNetworkAddress, F: marshalNetworkAddress}, + coreglib.TypeMarshaler{T: GTypeNetworkService, F: marshalNetworkService}, + coreglib.TypeMarshaler{T: GTypeNotification, F: marshalNotification}, + coreglib.TypeMarshaler{T: GTypeOutputStream, F: marshalOutputStream}, + coreglib.TypeMarshaler{T: GTypePermission, F: marshalPermission}, + coreglib.TypeMarshaler{T: GTypePropertyAction, F: marshalPropertyAction}, + coreglib.TypeMarshaler{T: GTypeProxyAddress, F: marshalProxyAddress}, + coreglib.TypeMarshaler{T: GTypeProxyAddressEnumerator, F: marshalProxyAddressEnumerator}, + coreglib.TypeMarshaler{T: GTypeResolver, F: marshalResolver}, + coreglib.TypeMarshaler{T: GTypeSettings, F: marshalSettings}, + coreglib.TypeMarshaler{T: GTypeSimpleAction, F: marshalSimpleAction}, + coreglib.TypeMarshaler{T: GTypeSimpleActionGroup, F: marshalSimpleActionGroup}, + coreglib.TypeMarshaler{T: GTypeSimpleAsyncResult, F: marshalSimpleAsyncResult}, + coreglib.TypeMarshaler{T: GTypeSimpleIOStream, F: marshalSimpleIOStream}, + coreglib.TypeMarshaler{T: GTypeSimplePermission, F: marshalSimplePermission}, + coreglib.TypeMarshaler{T: GTypeSimpleProxyResolver, F: marshalSimpleProxyResolver}, + coreglib.TypeMarshaler{T: GTypeSocket, F: marshalSocket}, + coreglib.TypeMarshaler{T: GTypeSocketAddress, F: marshalSocketAddress}, + coreglib.TypeMarshaler{T: GTypeSocketAddressEnumerator, F: marshalSocketAddressEnumerator}, + coreglib.TypeMarshaler{T: GTypeSocketClient, F: marshalSocketClient}, + coreglib.TypeMarshaler{T: GTypeSocketConnection, F: marshalSocketConnection}, + coreglib.TypeMarshaler{T: GTypeSocketControlMessage, F: marshalSocketControlMessage}, + coreglib.TypeMarshaler{T: GTypeSocketListener, F: marshalSocketListener}, + coreglib.TypeMarshaler{T: GTypeSocketService, F: marshalSocketService}, + coreglib.TypeMarshaler{T: GTypeTask, F: marshalTask}, + coreglib.TypeMarshaler{T: GTypeTCPConnection, F: marshalTCPConnection}, + coreglib.TypeMarshaler{T: GTypeTCPWrapperConnection, F: marshalTCPWrapperConnection}, + coreglib.TypeMarshaler{T: GTypeTestDBus, F: marshalTestDBus}, + coreglib.TypeMarshaler{T: GTypeThemedIcon, F: marshalThemedIcon}, + coreglib.TypeMarshaler{T: GTypeThreadedSocketService, F: marshalThreadedSocketService}, + coreglib.TypeMarshaler{T: GTypeTLSCertificate, F: marshalTLSCertificate}, + coreglib.TypeMarshaler{T: GTypeTLSConnection, F: marshalTLSConnection}, + coreglib.TypeMarshaler{T: GTypeTLSDatabase, F: marshalTLSDatabase}, + coreglib.TypeMarshaler{T: GTypeTLSInteraction, F: marshalTLSInteraction}, + coreglib.TypeMarshaler{T: GTypeTLSPassword, F: marshalTLSPassword}, + coreglib.TypeMarshaler{T: GTypeVFS, F: marshalVFS}, + coreglib.TypeMarshaler{T: GTypeVolumeMonitor, F: marshalVolumeMonitor}, + coreglib.TypeMarshaler{T: GTypeZlibCompressor, F: marshalZlibCompressor}, + coreglib.TypeMarshaler{T: GTypeZlibDecompressor, F: marshalZlibDecompressor}, + coreglib.TypeMarshaler{T: GTypeDBusAnnotationInfo, F: marshalDBusAnnotationInfo}, + coreglib.TypeMarshaler{T: GTypeDBusArgInfo, F: marshalDBusArgInfo}, + coreglib.TypeMarshaler{T: GTypeDBusInterfaceInfo, F: marshalDBusInterfaceInfo}, + coreglib.TypeMarshaler{T: GTypeDBusMethodInfo, F: marshalDBusMethodInfo}, + coreglib.TypeMarshaler{T: GTypeDBusNodeInfo, F: marshalDBusNodeInfo}, + coreglib.TypeMarshaler{T: GTypeDBusPropertyInfo, F: marshalDBusPropertyInfo}, + coreglib.TypeMarshaler{T: GTypeDBusSignalInfo, F: marshalDBusSignalInfo}, + coreglib.TypeMarshaler{T: GTypeFileAttributeInfoList, F: marshalFileAttributeInfoList}, + coreglib.TypeMarshaler{T: GTypeFileAttributeMatcher, F: marshalFileAttributeMatcher}, + coreglib.TypeMarshaler{T: GTypeResource, F: marshalResource}, + coreglib.TypeMarshaler{T: GTypeSettingsSchema, F: marshalSettingsSchema}, + coreglib.TypeMarshaler{T: GTypeSettingsSchemaKey, F: marshalSettingsSchemaKey}, + coreglib.TypeMarshaler{T: GTypeSettingsSchemaSource, F: marshalSettingsSchemaSource}, + coreglib.TypeMarshaler{T: GTypeSrvTarget, F: marshalSrvTarget}, + }) +} + +// DBUS_METHOD_INVOCATION_HANDLED: value returned by handlers of the signals +// generated by the gdbus-codegen tool to indicate that a method call has been +// handled by an implementation. It is equal to TRUE, but using this macro is +// sometimes more readable. +// +// In code that needs to be backwards-compatible with older GLib, use TRUE +// instead, often written like this: +// +// g_dbus_method_invocation_return_error (invocation, ...); +// return TRUE; // handled. +const DBUS_METHOD_INVOCATION_HANDLED = true + +// DBUS_METHOD_INVOCATION_UNHANDLED: value returned by handlers of the signals +// generated by the gdbus-codegen tool to indicate that a method call has not +// been handled by an implementation. It is equal to FALSE, but using this macro +// is sometimes more readable. +// +// In code that needs to be backwards-compatible with older GLib, use FALSE +// instead. +const DBUS_METHOD_INVOCATION_UNHANDLED = false + +// DEBUG_CONTROLLER_EXTENSION_POINT_NAME: extension point for debug control +// functionality. See [Extending GIO][extending-gio]. +const DEBUG_CONTROLLER_EXTENSION_POINT_NAME = "gio-debug-controller" + +// DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME: extension point for default +// handler to URI association. See [Extending GIO][extending-gio]. +// +// Deprecated: The AppInfoLookup interface is deprecated and unused by GIO. +const DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME = "gio-desktop-app-info-lookup" + +// DRIVE_IDENTIFIER_KIND_UNIX_DEVICE: string used to obtain a Unix device path +// with g_drive_get_identifier(). +const DRIVE_IDENTIFIER_KIND_UNIX_DEVICE = "unix-device" + +// FILE_ATTRIBUTE_ACCESS_CAN_DELETE: key in the "access" namespace for checking +// deletion privileges. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +// +// This attribute will be TRUE if the user is able to delete the file. +const FILE_ATTRIBUTE_ACCESS_CAN_DELETE = "access::can-delete" + +// FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE: key in the "access" namespace for getting +// execution privileges. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +// +// This attribute will be TRUE if the user is able to execute the file. +const FILE_ATTRIBUTE_ACCESS_CAN_EXECUTE = "access::can-execute" + +// FILE_ATTRIBUTE_ACCESS_CAN_READ: key in the "access" namespace for getting +// read privileges. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +// +// This attribute will be TRUE if the user is able to read the file. +const FILE_ATTRIBUTE_ACCESS_CAN_READ = "access::can-read" + +// FILE_ATTRIBUTE_ACCESS_CAN_RENAME: key in the "access" namespace for checking +// renaming privileges. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +// +// This attribute will be TRUE if the user is able to rename the file. +const FILE_ATTRIBUTE_ACCESS_CAN_RENAME = "access::can-rename" + +// FILE_ATTRIBUTE_ACCESS_CAN_TRASH: key in the "access" namespace for checking +// trashing privileges. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +// +// This attribute will be TRUE if the user is able to move the file to the +// trash. +const FILE_ATTRIBUTE_ACCESS_CAN_TRASH = "access::can-trash" + +// FILE_ATTRIBUTE_ACCESS_CAN_WRITE: key in the "access" namespace for getting +// write privileges. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +// +// This attribute will be TRUE if the user is able to write to the file. +const FILE_ATTRIBUTE_ACCESS_CAN_WRITE = "access::can-write" + +// FILE_ATTRIBUTE_DOS_IS_ARCHIVE: key in the "dos" namespace for checking if the +// file's archive flag is set. +// +// This attribute is TRUE if the archive flag is set. +// +// This attribute is only available for DOS file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_DOS_IS_ARCHIVE = "dos::is-archive" + +// FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT: key in the "dos" namespace for checking if +// the file is a NTFS mount point (a volume mount or a junction point). +// +// This attribute is TRUE if file is a reparse +// point of type IO_REPARSE_TAG_MOUNT_POINT +// (https://msdn.microsoft.com/en-us/library/dd541667.aspx). +// +// This attribute is only available for DOS file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_DOS_IS_MOUNTPOINT = "dos::is-mountpoint" + +// FILE_ATTRIBUTE_DOS_IS_SYSTEM: key in the "dos" namespace for checking if the +// file's backup flag is set. +// +// This attribute is TRUE if the backup flag is set. +// +// This attribute is only available for DOS file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_DOS_IS_SYSTEM = "dos::is-system" + +// FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG: key in the "dos" namespace for getting +// the file NTFS reparse tag. +// +// This value is 0 for files that are not reparse points. +// +// See the Reparse Tags (https://msdn.microsoft.com/en-us/library/dd541667.aspx) +// page for possible reparse tag values. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_DOS_REPARSE_POINT_TAG = "dos::reparse-point-tag" + +// FILE_ATTRIBUTE_ETAG_VALUE: key in the "etag" namespace for getting the value +// of the file's entity tag. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_ETAG_VALUE = "etag::value" + +// FILE_ATTRIBUTE_FILESYSTEM_FREE: key in the "filesystem" namespace for getting +// the number of bytes of free space left on the file system. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64. +const FILE_ATTRIBUTE_FILESYSTEM_FREE = "filesystem::free" + +// FILE_ATTRIBUTE_FILESYSTEM_READONLY: key in the "filesystem" namespace for +// checking if the file system is read only. +// +// Is set to TRUE if the file system is read only. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_FILESYSTEM_READONLY = "filesystem::readonly" + +// FILE_ATTRIBUTE_FILESYSTEM_REMOTE: key in the "filesystem" namespace for +// checking if the file system is remote. +// +// Is set to TRUE if the file system is remote. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_FILESYSTEM_REMOTE = "filesystem::remote" + +// FILE_ATTRIBUTE_FILESYSTEM_SIZE: key in the "filesystem" namespace +// for getting the total size (in bytes) of the file system, used in +// g_file_query_filesystem_info(). +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64. +const FILE_ATTRIBUTE_FILESYSTEM_SIZE = "filesystem::size" + +// FILE_ATTRIBUTE_FILESYSTEM_TYPE: key in the "filesystem" namespace for getting +// the file system's type. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_FILESYSTEM_TYPE = "filesystem::type" + +// FILE_ATTRIBUTE_FILESYSTEM_USED: key in the "filesystem" namespace for getting +// the number of bytes used by data on the file system. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64. +const FILE_ATTRIBUTE_FILESYSTEM_USED = "filesystem::used" + +// FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW: key in the "filesystem" namespace for +// hinting a file manager application whether it should preview (e.g. thumbnail) +// files on the file system. +// +// The value for this key contain a PreviewType. +const FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW = "filesystem::use-preview" + +// FILE_ATTRIBUTE_GVFS_BACKEND: key in the "gvfs" namespace that gets the name +// of the current GVFS backend in use. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_GVFS_BACKEND = "gvfs::backend" + +// FILE_ATTRIBUTE_ID_FILE: key in the "id" namespace for getting a file +// identifier. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +// +// An example use would be during listing files, to avoid recursive directory +// scanning. +const FILE_ATTRIBUTE_ID_FILE = "id::file" + +// FILE_ATTRIBUTE_ID_FILESYSTEM: key in the "id" namespace for getting the file +// system identifier. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +// +// An example use would be during drag and drop to see if the source and target +// are on the same filesystem (default to move) or not (default to copy). +const FILE_ATTRIBUTE_ID_FILESYSTEM = "id::filesystem" + +// FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT: key in the "mountable" namespace for +// checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be ejected. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_MOUNTABLE_CAN_EJECT = "mountable::can-eject" + +// FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT: key in the "mountable" namespace for +// checking if a file (of type G_FILE_TYPE_MOUNTABLE) is mountable. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_MOUNTABLE_CAN_MOUNT = "mountable::can-mount" + +// FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL: key in the "mountable" namespace for +// checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be polled. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_MOUNTABLE_CAN_POLL = "mountable::can-poll" + +// FILE_ATTRIBUTE_MOUNTABLE_CAN_START: key in the "mountable" namespace for +// checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be started. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_MOUNTABLE_CAN_START = "mountable::can-start" + +// FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED: key in the "mountable" namespace +// for checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be started +// degraded. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_MOUNTABLE_CAN_START_DEGRADED = "mountable::can-start-degraded" + +// FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP: key in the "mountable" namespace for +// checking if a file (of type G_FILE_TYPE_MOUNTABLE) can be stopped. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_MOUNTABLE_CAN_STOP = "mountable::can-stop" + +// FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT: key in the "mountable" namespace for +// checking if a file (of type G_FILE_TYPE_MOUNTABLE) is unmountable. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_MOUNTABLE_CAN_UNMOUNT = "mountable::can-unmount" + +// FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI: key in the "mountable" namespace for +// getting the HAL UDI for the mountable file. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_MOUNTABLE_HAL_UDI = "mountable::hal-udi" + +// FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC: key in the "mountable" +// namespace for checking if a file (of type G_FILE_TYPE_MOUNTABLE) is +// automatically polled for media. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_MOUNTABLE_IS_MEDIA_CHECK_AUTOMATIC = "mountable::is-media-check-automatic" + +// FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE: key in the "mountable" namespace +// for getting the StartStopType. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_MOUNTABLE_START_STOP_TYPE = "mountable::start-stop-type" + +// FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE: key in the "mountable" namespace for +// getting the unix device. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE = "mountable::unix-device" + +// FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE: key in the "mountable" namespace +// for getting the unix device file. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_MOUNTABLE_UNIX_DEVICE_FILE = "mountable::unix-device-file" + +// FILE_ATTRIBUTE_OWNER_GROUP: key in the "owner" namespace for getting the file +// owner's group. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_OWNER_GROUP = "owner::group" + +// FILE_ATTRIBUTE_OWNER_USER: key in the "owner" namespace for getting the user +// name of the file's owner. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_OWNER_USER = "owner::user" + +// FILE_ATTRIBUTE_OWNER_USER_REAL: key in the "owner" namespace for getting the +// real name of the user that owns the file. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_OWNER_USER_REAL = "owner::user-real" + +// FILE_ATTRIBUTE_PREVIEW_ICON: key in the "preview" namespace for getting a +// #GIcon that can be used to get preview of the file. +// +// For example, it may be a low resolution thumbnail without metadata. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_OBJECT. +// +// The value for this key should contain a #GIcon. +const FILE_ATTRIBUTE_PREVIEW_ICON = "preview::icon" + +// FILE_ATTRIBUTE_RECENT_MODIFIED: key in the "recent" namespace for getting +// time, when the metadata for the file in recent:/// was last changed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_INT64. +const FILE_ATTRIBUTE_RECENT_MODIFIED = "recent::modified" + +// FILE_ATTRIBUTE_SELINUX_CONTEXT: key in the "selinux" namespace for getting +// the file's SELinux context. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +// +// Note that this attribute is only available if GLib has been built with +// SELinux support. +const FILE_ATTRIBUTE_SELINUX_CONTEXT = "selinux::context" + +// FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE: key in the "standard" namespace for +// getting the amount of disk space that is consumed by the file (in bytes). +// +// This will generally be larger than the file size (due to block size overhead) +// but can occasionally be smaller (for example, for sparse files). +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64. +const FILE_ATTRIBUTE_STANDARD_ALLOCATED_SIZE = "standard::allocated-size" + +// FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE: key in the "standard" namespace for +// getting the content type of the file. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +// +// The value for this key should contain a valid content type. +const FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE = "standard::content-type" + +// FILE_ATTRIBUTE_STANDARD_COPY_NAME: key in the "standard" namespace for +// getting the copy name of the file. +// +// The copy name is an optional version of the name. If available it's always in +// UTF8, and corresponds directly to the original filename (only transcoded to +// UTF8). This is useful if you want to copy the file to another filesystem that +// might have a different encoding. If the filename is not a valid string in the +// encoding selected for the filesystem it is in then the copy name will not be +// set. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_STANDARD_COPY_NAME = "standard::copy-name" + +// FILE_ATTRIBUTE_STANDARD_DESCRIPTION: key in the "standard" namespace for +// getting the description of the file. +// +// The description is a utf8 string that describes the file, generally +// containing the filename, but can also contain further information. Example +// descriptions could be "filename (on hostname)" for a remote file or "filename +// (in trash)" for a file in the trash. This is useful for instance as the +// window title when displaying a directory or for a bookmarks menu. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_STANDARD_DESCRIPTION = "standard::description" + +// FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME: key in the "standard" namespace for +// getting the display name of the file. +// +// A display name is guaranteed to be in UTF-8 and can thus be displayed in the +// UI. It is guaranteed to be set on every file. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME = "standard::display-name" + +// FILE_ATTRIBUTE_STANDARD_EDIT_NAME: key in the "standard" namespace for edit +// name of the file. +// +// An edit name is similar to the display name, but it is meant to be used +// when you want to rename the file in the UI. The display name might contain +// information you don't want in the new filename (such as "(invalid unicode)" +// if the filename was in an invalid encoding). +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_STANDARD_EDIT_NAME = "standard::edit-name" + +// FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE: key in the "standard" namespace +// for getting the fast content type. +// +// The fast content type isn't as reliable as the regular one, as it only uses +// the filename to guess it, but it is faster to calculate than the regular +// content type. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE = "standard::fast-content-type" + +// FILE_ATTRIBUTE_STANDARD_ICON: key in the "standard" namespace for getting the +// icon for the file. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_OBJECT. +// +// The value for this key should contain a #GIcon. +const FILE_ATTRIBUTE_STANDARD_ICON = "standard::icon" + +// FILE_ATTRIBUTE_STANDARD_IS_BACKUP: key in the "standard" namespace for +// checking if a file is a backup file. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_STANDARD_IS_BACKUP = "standard::is-backup" + +// FILE_ATTRIBUTE_STANDARD_IS_HIDDEN: key in the "standard" namespace for +// checking if a file is hidden. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_STANDARD_IS_HIDDEN = "standard::is-hidden" + +// FILE_ATTRIBUTE_STANDARD_IS_SYMLINK: key in the "standard" namespace for +// checking if the file is a symlink. Typically the actual type is something +// else, if we followed the symlink to get the type. +// +// On Windows NTFS mountpoints are considered to be symlinks as well. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_STANDARD_IS_SYMLINK = "standard::is-symlink" + +// FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL: key in the "standard" namespace for +// checking if a file is virtual. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL = "standard::is-virtual" + +// FILE_ATTRIBUTE_STANDARD_IS_VOLATILE: key in the "standard" namespace for +// checking if a file is volatile. This is meant for opaque, non-POSIX-like +// backends to indicate that the URI is not persistent. Applications should look +// at G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET for the persistent URI. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_STANDARD_IS_VOLATILE = "standard::is-volatile" + +// FILE_ATTRIBUTE_STANDARD_NAME: key in the "standard" namespace for getting the +// name of the file. +// +// The name is the on-disk filename which may not be in any known encoding, +// and can thus not be generally displayed as is. It is guaranteed to be set on +// every file. +// +// Use G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME if you need to display the name in +// a user interface. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +const FILE_ATTRIBUTE_STANDARD_NAME = "standard::name" + +// FILE_ATTRIBUTE_STANDARD_SIZE: key in the "standard" namespace for getting the +// file's size (in bytes). +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64. +const FILE_ATTRIBUTE_STANDARD_SIZE = "standard::size" + +// FILE_ATTRIBUTE_STANDARD_SORT_ORDER: key in the "standard" namespace for +// setting the sort order of a file. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_INT32. +// +// An example use would be in file managers, which would use this key to set +// the order files are displayed. Files with smaller sort order should be sorted +// first, and files without sort order as if sort order was zero. +const FILE_ATTRIBUTE_STANDARD_SORT_ORDER = "standard::sort-order" + +// FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON: key in the "standard" namespace for +// getting the symbolic icon for the file. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_OBJECT. +// +// The value for this key should contain a #GIcon. +const FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON = "standard::symbolic-icon" + +// FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET: key in the "standard" namespace for +// getting the symlink target, if the file is a symlink. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +const FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET = "standard::symlink-target" + +// FILE_ATTRIBUTE_STANDARD_TARGET_URI: key in the "standard" namespace for +// getting the target URI for the file, in the case of G_FILE_TYPE_SHORTCUT or +// G_FILE_TYPE_MOUNTABLE files. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_STANDARD_TARGET_URI = "standard::target-uri" + +// FILE_ATTRIBUTE_STANDARD_TYPE: key in the "standard" namespace for storing +// file types. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +// +// The value for this key should contain a Type. +const FILE_ATTRIBUTE_STANDARD_TYPE = "standard::type" + +// FILE_ATTRIBUTE_THUMBNAILING_FAILED: key in the "thumbnail" namespace for +// checking if thumbnailing failed. +// +// This attribute is TRUE if thumbnailing failed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAILING_FAILED = "thumbnail::failed" + +// FILE_ATTRIBUTE_THUMBNAILING_FAILED_LARGE: key in the "thumbnail" namespace +// for checking if thumbnailing failed for the large image. +// +// This attribute is TRUE if thumbnailing failed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAILING_FAILED_LARGE = "thumbnail::failed-large" + +// FILE_ATTRIBUTE_THUMBNAILING_FAILED_NORMAL: key in the "thumbnail" namespace +// for checking if thumbnailing failed for the normal image. +// +// This attribute is TRUE if thumbnailing failed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAILING_FAILED_NORMAL = "thumbnail::failed-normal" + +// FILE_ATTRIBUTE_THUMBNAILING_FAILED_XLARGE: key in the "thumbnail" namespace +// for checking if thumbnailing failed for the x-large image. +// +// This attribute is TRUE if thumbnailing failed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAILING_FAILED_XLARGE = "thumbnail::failed-xlarge" + +// FILE_ATTRIBUTE_THUMBNAILING_FAILED_XXLARGE: key in the "thumbnail" namespace +// for checking if thumbnailing failed for the xx-large image. +// +// This attribute is TRUE if thumbnailing failed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAILING_FAILED_XXLARGE = "thumbnail::failed-xxlarge" + +// FILE_ATTRIBUTE_THUMBNAIL_IS_VALID: key in the "thumbnail" namespace for +// checking whether the thumbnail is outdated. +// +// This attribute is TRUE if the thumbnail is up-to-date with the file it +// represents, and FALSE if the file has been modified since the thumbnail was +// generated. +// +// If G_FILE_ATTRIBUTE_THUMBNAILING_FAILED is TRUE and this attribute is FALSE, +// it indicates that thumbnailing may be attempted again and may succeed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID = "thumbnail::is-valid" + +// FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_LARGE: key in the "thumbnail" namespace for +// checking whether the large thumbnail is outdated. +// +// This attribute is TRUE if the large thumbnail is up-to-date with the file it +// represents, and FALSE if the file has been modified since the thumbnail was +// generated. +// +// If G_FILE_ATTRIBUTE_THUMBNAILING_FAILED_LARGE is TRUE and this attribute is +// FALSE, it indicates that thumbnailing may be attempted again and may succeed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_LARGE = "thumbnail::is-valid-large" + +// FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_NORMAL: key in the "thumbnail" namespace +// for checking whether the normal thumbnail is outdated. +// +// This attribute is TRUE if the normal thumbnail is up-to-date with the file it +// represents, and FALSE if the file has been modified since the thumbnail was +// generated. +// +// If G_FILE_ATTRIBUTE_THUMBNAILING_FAILED_NORMAL is TRUE and this attribute is +// FALSE, it indicates that thumbnailing may be attempted again and may succeed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_NORMAL = "thumbnail::is-valid-normal" + +// FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_XLARGE: key in the "thumbnail" namespace +// for checking whether the x-large thumbnail is outdated. +// +// This attribute is TRUE if the x-large thumbnail is up-to-date with the file +// it represents, and FALSE if the file has been modified since the thumbnail +// was generated. +// +// If G_FILE_ATTRIBUTE_THUMBNAILING_FAILED_XLARGE is TRUE and this attribute is +// FALSE, it indicates that thumbnailing may be attempted again and may succeed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_XLARGE = "thumbnail::is-valid-xlarge" + +// FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_XXLARGE: key in the "thumbnail" namespace +// for checking whether the xx-large thumbnail is outdated. +// +// This attribute is TRUE if the x-large thumbnail is up-to-date with the file +// it represents, and FALSE if the file has been modified since the thumbnail +// was generated. +// +// If G_FILE_ATTRIBUTE_THUMBNAILING_FAILED_XXLARGE is TRUE and this attribute is +// FALSE, it indicates that thumbnailing may be attempted again and may succeed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID_XXLARGE = "thumbnail::is-valid-xxlarge" + +// FILE_ATTRIBUTE_THUMBNAIL_PATH: key in the "thumbnail" namespace for getting +// the path to the thumbnail image with the biggest size available. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +const FILE_ATTRIBUTE_THUMBNAIL_PATH = "thumbnail::path" + +// FILE_ATTRIBUTE_THUMBNAIL_PATH_LARGE: key in the "thumbnail" namespace for +// getting the path to the large thumbnail image. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +const FILE_ATTRIBUTE_THUMBNAIL_PATH_LARGE = "thumbnail::path-large" + +// FILE_ATTRIBUTE_THUMBNAIL_PATH_NORMAL: key in the "thumbnail" namespace for +// getting the path to the normal thumbnail image. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +const FILE_ATTRIBUTE_THUMBNAIL_PATH_NORMAL = "thumbnail::path-normal" + +// FILE_ATTRIBUTE_THUMBNAIL_PATH_XLARGE: key in the "thumbnail" namespace for +// getting the path to the x-large thumbnail image. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +const FILE_ATTRIBUTE_THUMBNAIL_PATH_XLARGE = "thumbnail::path-xlarge" + +// FILE_ATTRIBUTE_THUMBNAIL_PATH_XXLARGE: key in the "thumbnail" namespace for +// getting the path to the xx-large thumbnail image. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +const FILE_ATTRIBUTE_THUMBNAIL_PATH_XXLARGE = "thumbnail::path-xxlarge" + +// FILE_ATTRIBUTE_TIME_ACCESS: key in the "time" namespace for getting the time +// the file was last accessed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64, and contains the +// time since the file was last accessed, in seconds since the UNIX epoch. +const FILE_ATTRIBUTE_TIME_ACCESS = "time::access" + +// FILE_ATTRIBUTE_TIME_ACCESS_NSEC: key in the "time" namespace for getting the +// nanoseconds of the time the file was last accessed. This should be used in +// conjunction with FILE_ATTRIBUTE_TIME_ACCESS. Corresponding AttributeType is +// G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_TIME_ACCESS_NSEC = "time::access-nsec" + +// FILE_ATTRIBUTE_TIME_ACCESS_USEC: key in the "time" namespace for getting the +// microseconds of the time the file was last accessed. +// +// This should be used in conjunction with G_FILE_ATTRIBUTE_TIME_ACCESS. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_TIME_ACCESS_USEC = "time::access-usec" + +// FILE_ATTRIBUTE_TIME_CHANGED: key in the "time" namespace for getting the time +// the file was last changed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64, and contains the +// time since the file was last changed, in seconds since the UNIX epoch. +// +// This corresponds to the traditional UNIX ctime. +const FILE_ATTRIBUTE_TIME_CHANGED = "time::changed" + +// FILE_ATTRIBUTE_TIME_CHANGED_NSEC: key in the "time" namespace for getting +// the nanoseconds of the time the file was last changed. This should be used in +// conjunction with FILE_ATTRIBUTE_TIME_CHANGED. Corresponding AttributeType is +// G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_TIME_CHANGED_NSEC = "time::changed-nsec" + +// FILE_ATTRIBUTE_TIME_CHANGED_USEC: key in the "time" namespace for getting the +// microseconds of the time the file was last changed. +// +// This should be used in conjunction with G_FILE_ATTRIBUTE_TIME_CHANGED. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_TIME_CHANGED_USEC = "time::changed-usec" + +// FILE_ATTRIBUTE_TIME_CREATED: key in the "time" namespace for getting the time +// the file was created. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64, and contains the +// time since the file was created, in seconds since the UNIX epoch. +// +// This may correspond to Linux stx_btime, FreeBSD st_birthtim, NetBSD +// st_birthtime or NTFS ctime. +const FILE_ATTRIBUTE_TIME_CREATED = "time::created" + +// FILE_ATTRIBUTE_TIME_CREATED_NSEC: key in the "time" namespace for getting +// the nanoseconds of the time the file was created. This should be used in +// conjunction with FILE_ATTRIBUTE_TIME_CREATED. Corresponding AttributeType is +// G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_TIME_CREATED_NSEC = "time::created-nsec" + +// FILE_ATTRIBUTE_TIME_CREATED_USEC: key in the "time" namespace for getting the +// microseconds of the time the file was created. +// +// This should be used in conjunction with G_FILE_ATTRIBUTE_TIME_CREATED. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_TIME_CREATED_USEC = "time::created-usec" + +// FILE_ATTRIBUTE_TIME_MODIFIED: key in the "time" namespace for getting the +// time the file was last modified. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64, and contains the +// time since the file was modified, in seconds since the UNIX epoch. +const FILE_ATTRIBUTE_TIME_MODIFIED = "time::modified" + +// FILE_ATTRIBUTE_TIME_MODIFIED_NSEC: key in the "time" namespace for getting +// the nanoseconds of the time the file was last modified. This should be used +// in conjunction with FILE_ATTRIBUTE_TIME_MODIFIED. Corresponding AttributeType +// is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_TIME_MODIFIED_NSEC = "time::modified-nsec" + +// FILE_ATTRIBUTE_TIME_MODIFIED_USEC: key in the "time" namespace for getting +// the microseconds of the time the file was last modified. +// +// This should be used in conjunction with G_FILE_ATTRIBUTE_TIME_MODIFIED. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_TIME_MODIFIED_USEC = "time::modified-usec" + +// FILE_ATTRIBUTE_TRASH_DELETION_DATE: key in the "trash" namespace for getting +// the deletion date and time of a file inside the trash:/// folder. +// +// The format of the returned string is YYYY-MM-DDThh:mm:ss. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_STRING. +const FILE_ATTRIBUTE_TRASH_DELETION_DATE = "trash::deletion-date" + +// FILE_ATTRIBUTE_TRASH_ITEM_COUNT: key in the "trash" namespace for getting the +// number of (toplevel) items that are present in the trash:/// folder. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_TRASH_ITEM_COUNT = "trash::item-count" + +// FILE_ATTRIBUTE_TRASH_ORIG_PATH: key in the "trash" namespace for getting the +// original path of a file inside the trash:/// folder before it was trashed. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +const FILE_ATTRIBUTE_TRASH_ORIG_PATH = "trash::orig-path" + +// FILE_ATTRIBUTE_UNIX_BLOCKS: key in the "unix" namespace for getting the +// number of blocks allocated for the file. +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64. +const FILE_ATTRIBUTE_UNIX_BLOCKS = "unix::blocks" + +// FILE_ATTRIBUTE_UNIX_BLOCK_SIZE: key in the "unix" namespace for getting the +// block size for the file system. +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_UNIX_BLOCK_SIZE = "unix::block-size" + +// FILE_ATTRIBUTE_UNIX_DEVICE: key in the "unix" namespace for getting the +// device id of the device the file is located on (see stat() documentation). +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_UNIX_DEVICE = "unix::device" + +// FILE_ATTRIBUTE_UNIX_GID: key in the "unix" namespace for getting the group ID +// for the file. +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_UNIX_GID = "unix::gid" + +// FILE_ATTRIBUTE_UNIX_INODE: key in the "unix" namespace for getting the inode +// of the file. +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT64. +const FILE_ATTRIBUTE_UNIX_INODE = "unix::inode" + +// FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT: key in the "unix" namespace for checking +// if the file represents a UNIX mount point. +// +// This attribute is TRUE if the file is a UNIX mount point. +// +// Since 2.58, / is considered to be a mount point. +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. +const FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT = "unix::is-mountpoint" + +// FILE_ATTRIBUTE_UNIX_MODE: key in the "unix" namespace for getting the mode of +// the file (e.g. whether the file is a regular file, symlink, etc). +// +// See the documentation for lstat(): this attribute is equivalent to +// the st_mode member of struct stat, and includes both the file type and +// permissions. +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_UNIX_MODE = "unix::mode" + +// FILE_ATTRIBUTE_UNIX_NLINK: key in the "unix" namespace for getting the number +// of hard links for a file. +// +// See the documentation for lstat(). +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_UNIX_NLINK = "unix::nlink" + +// FILE_ATTRIBUTE_UNIX_RDEV: key in the "unix" namespace for getting the device +// ID for the file (if it is a special file). +// +// See the documentation for lstat(). +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_UNIX_RDEV = "unix::rdev" + +// FILE_ATTRIBUTE_UNIX_UID: key in the "unix" namespace for getting the user ID +// for the file. +// +// This attribute is only available for UNIX file systems. +// +// Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +const FILE_ATTRIBUTE_UNIX_UID = "unix::uid" + +// MEMORY_MONITOR_EXTENSION_POINT_NAME: extension point for memory usage +// monitoring functionality. See [Extending GIO][extending-gio]. +const MEMORY_MONITOR_EXTENSION_POINT_NAME = "gio-memory-monitor" + +// MENU_ATTRIBUTE_ACTION: menu item attribute which holds the action name of the +// item. Action names are namespaced with an identifier for the action group in +// which the action resides. For example, "win." for window-specific actions and +// "app." for application-wide actions. +// +// See also g_menu_model_get_item_attribute() and g_menu_item_set_attribute(). +const MENU_ATTRIBUTE_ACTION = "action" + +// MENU_ATTRIBUTE_ACTION_NAMESPACE: menu item attribute that holds the namespace +// for all action names in menus that are linked from this item. +const MENU_ATTRIBUTE_ACTION_NAMESPACE = "action-namespace" + +// MENU_ATTRIBUTE_ICON: menu item attribute which holds the icon of the item. +// +// The icon is stored in the format returned by g_icon_serialize(). +// +// This attribute is intended only to represent 'noun' icons such as favicons +// for a webpage, or application icons. It should not be used for 'verbs' (ie: +// stock icons). +const MENU_ATTRIBUTE_ICON = "icon" + +// MENU_ATTRIBUTE_LABEL: menu item attribute which holds the label of the item. +const MENU_ATTRIBUTE_LABEL = "label" + +// MENU_ATTRIBUTE_TARGET: menu item attribute which holds the target with which +// the item's action will be activated. +// +// See also g_menu_item_set_action_and_target(). +const MENU_ATTRIBUTE_TARGET = "target" + +// MENU_EXPORTER_MAX_SECTION_SIZE: maximum number of entries in a menu section +// supported by g_dbus_connection_export_menu_model(). +// +// The exact value of the limit may change in future GLib versions. +const MENU_EXPORTER_MAX_SECTION_SIZE = 1000 + +// MENU_LINK_SECTION: name of the link that associates a menu item with a +// section. The linked menu will usually be shown in place of the menu item, +// using the item's label as a header. +// +// See also g_menu_item_set_link(). +const MENU_LINK_SECTION = "section" + +// MENU_LINK_SUBMENU: name of the link that associates a menu item with a +// submenu. +// +// See also g_menu_item_set_link(). +const MENU_LINK_SUBMENU = "submenu" +const NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME = "gio-native-volume-monitor" + +// NETWORK_MONITOR_EXTENSION_POINT_NAME: extension point for network status +// monitoring functionality. See [Extending GIO][extending-gio]. +const NETWORK_MONITOR_EXTENSION_POINT_NAME = "gio-network-monitor" + +// POWER_PROFILE_MONITOR_EXTENSION_POINT_NAME: extension point for power profile +// usage monitoring functionality. See [Extending GIO][extending-gio]. +const POWER_PROFILE_MONITOR_EXTENSION_POINT_NAME = "gio-power-profile-monitor" + +// PROXY_EXTENSION_POINT_NAME: extension point for proxy functionality. +// See [Extending GIO][extending-gio]. +const PROXY_EXTENSION_POINT_NAME = "gio-proxy" + +// PROXY_RESOLVER_EXTENSION_POINT_NAME: extension point for proxy resolving +// functionality. See [Extending GIO][extending-gio]. +const PROXY_RESOLVER_EXTENSION_POINT_NAME = "gio-proxy-resolver" + +// SETTINGS_BACKEND_EXTENSION_POINT_NAME: extension point for Backend +// functionality. +const SETTINGS_BACKEND_EXTENSION_POINT_NAME = "gsettings-backend" + +// TLS_BACKEND_EXTENSION_POINT_NAME: extension point for TLS functionality via +// Backend. See [Extending GIO][extending-gio]. +const TLS_BACKEND_EXTENSION_POINT_NAME = "gio-tls-backend" + +// TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT: purpose used to verify the client +// certificate in a TLS connection. Used by TLS servers. +const TLS_DATABASE_PURPOSE_AUTHENTICATE_CLIENT = "1.3.6.1.5.5.7.3.2" + +// TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER: purpose used to verify the server +// certificate in a TLS connection. This is the most common purpose in use. +// Used by TLS clients. +const TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER = "1.3.6.1.5.5.7.3.1" + +// VFS_EXTENSION_POINT_NAME: extension point for #GVfs functionality. See +// [Extending GIO][extending-gio]. +const VFS_EXTENSION_POINT_NAME = "gio-vfs" + +// VOLUME_IDENTIFIER_KIND_CLASS: string used to obtain the volume class with +// g_volume_get_identifier(). +// +// Known volume classes include device, network, and loop. Other classes may be +// added in the future. +// +// This is intended to be used by applications to classify #GVolume instances +// into different sections - for example a file manager or file chooser can use +// this information to show network volumes under a "Network" heading and device +// volumes under a "Devices" heading. +const VOLUME_IDENTIFIER_KIND_CLASS = "class" + +// VOLUME_IDENTIFIER_KIND_HAL_UDI: string used to obtain a Hal UDI with +// g_volume_get_identifier(). +// +// Deprecated: Do not use, HAL is deprecated. +const VOLUME_IDENTIFIER_KIND_HAL_UDI = "hal-udi" + +// VOLUME_IDENTIFIER_KIND_LABEL: string used to obtain a filesystem label with +// g_volume_get_identifier(). +const VOLUME_IDENTIFIER_KIND_LABEL = "label" + +// VOLUME_IDENTIFIER_KIND_NFS_MOUNT: string used to obtain a NFS mount with +// g_volume_get_identifier(). +const VOLUME_IDENTIFIER_KIND_NFS_MOUNT = "nfs-mount" + +// VOLUME_IDENTIFIER_KIND_UNIX_DEVICE: string used to obtain a Unix device path +// with g_volume_get_identifier(). +const VOLUME_IDENTIFIER_KIND_UNIX_DEVICE = "unix-device" + +// VOLUME_IDENTIFIER_KIND_UUID: string used to obtain a UUID with +// g_volume_get_identifier(). +const VOLUME_IDENTIFIER_KIND_UUID = "uuid" + +// VOLUME_MONITOR_EXTENSION_POINT_NAME: extension point for volume monitor +// functionality. See [Extending GIO][extending-gio]. +const VOLUME_MONITOR_EXTENSION_POINT_NAME = "gio-volume-monitor" + +// BusType: enumeration for well-known message buses. +type BusType C.gint + +const ( + // BusTypeStarter alias for the message bus that activated the process, + // if any. + BusTypeStarter BusType = -1 + // BusTypeNone: not a message bus. + BusTypeNone BusType = 0 + // BusTypeSystem: system-wide message bus. + BusTypeSystem BusType = 1 + // BusTypeSession: login session message bus. + BusTypeSession BusType = 2 +) + +func marshalBusType(p uintptr) (interface{}, error) { + return BusType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for BusType. +func (b BusType) String() string { + switch b { + case BusTypeStarter: + return "Starter" + case BusTypeNone: + return "None" + case BusTypeSystem: + return "System" + case BusTypeSession: + return "Session" + default: + return fmt.Sprintf("BusType(%d)", b) + } +} + +// ConverterResult results returned from g_converter_convert(). +type ConverterResult C.gint + +const ( + // ConverterError: there was an error during conversion. + ConverterError ConverterResult = iota + // ConverterConverted: some data was consumed or produced. + ConverterConverted + // ConverterFinished: conversion is finished. + ConverterFinished + // ConverterFlushed: flushing is finished. + ConverterFlushed +) + +func marshalConverterResult(p uintptr) (interface{}, error) { + return ConverterResult(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ConverterResult. +func (c ConverterResult) String() string { + switch c { + case ConverterError: + return "Error" + case ConverterConverted: + return "Converted" + case ConverterFinished: + return "Finished" + case ConverterFlushed: + return "Flushed" + default: + return fmt.Sprintf("ConverterResult(%d)", c) + } +} + +// CredentialsType: enumeration describing different kinds of native credential +// types. +type CredentialsType C.gint + +const ( + // CredentialsTypeInvalid indicates an invalid native credential type. + CredentialsTypeInvalid CredentialsType = iota + // CredentialsTypeLinuxUcred: native credentials type is a struct ucred. + CredentialsTypeLinuxUcred + // CredentialsTypeFreebsdCmsgcred: native credentials type is a struct + // cmsgcred. + CredentialsTypeFreebsdCmsgcred + // CredentialsTypeOpenbsdSockpeercred: native credentials type is a struct + // sockpeercred. Added in 2.30. + CredentialsTypeOpenbsdSockpeercred + // CredentialsTypeSolarisUcred: native credentials type is a ucred_t. + // Added in 2.40. + CredentialsTypeSolarisUcred + // CredentialsTypeNetbsdUnpcbid: native credentials type is a struct + // unpcbid. Added in 2.42. + CredentialsTypeNetbsdUnpcbid + // CredentialsTypeAppleXucred: native credentials type is a struct xucred. + // Added in 2.66. + CredentialsTypeAppleXucred + // CredentialsTypeWin32Pid: native credentials type is a PID DWORD. Added in + // 2.72. + CredentialsTypeWin32Pid +) + +func marshalCredentialsType(p uintptr) (interface{}, error) { + return CredentialsType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for CredentialsType. +func (c CredentialsType) String() string { + switch c { + case CredentialsTypeInvalid: + return "Invalid" + case CredentialsTypeLinuxUcred: + return "LinuxUcred" + case CredentialsTypeFreebsdCmsgcred: + return "FreebsdCmsgcred" + case CredentialsTypeOpenbsdSockpeercred: + return "OpenbsdSockpeercred" + case CredentialsTypeSolarisUcred: + return "SolarisUcred" + case CredentialsTypeNetbsdUnpcbid: + return "NetbsdUnpcbid" + case CredentialsTypeAppleXucred: + return "AppleXucred" + case CredentialsTypeWin32Pid: + return "Win32Pid" + default: + return fmt.Sprintf("CredentialsType(%d)", c) + } +} + +// DBusError: error codes for the G_DBUS_ERROR error domain. +type DBusError C.gint + +const ( + // DBusErrorFailed: generic error; "something went wrong" - see the error + // message for more. + DBusErrorFailed DBusError = iota + // DBusErrorNoMemory: there was not enough memory to complete an operation. + DBusErrorNoMemory + // DBusErrorServiceUnknown bus doesn't know how to launch a service to + // supply the bus name you wanted. + DBusErrorServiceUnknown + // DBusErrorNameHasNoOwner bus name you referenced doesn't exist (i.e. + // no application owns it). + DBusErrorNameHasNoOwner + // DBusErrorNoReply: no reply to a message expecting one, usually means a + // timeout occurred. + DBusErrorNoReply + // DBusErrorIOError: something went wrong reading or writing to a socket, + // for example. + DBusErrorIOError + // DBusErrorBadAddress d-Bus bus address was malformed. + DBusErrorBadAddress + // DBusErrorNotSupported: requested operation isn't supported (like ENOSYS + // on UNIX). + DBusErrorNotSupported + // DBusErrorLimitsExceeded: some limited resource is exhausted. + DBusErrorLimitsExceeded + // DBusErrorAccessDenied: security restrictions don't allow doing what + // you're trying to do. + DBusErrorAccessDenied + // DBusErrorAuthFailed: authentication didn't work. + DBusErrorAuthFailed + // DBusErrorNoServer: unable to connect to server (probably caused by + // ECONNREFUSED on a socket). + DBusErrorNoServer + // DBusErrorTimeout: certain timeout errors, possibly ETIMEDOUT on a socket. + // Note that G_DBUS_ERROR_NO_REPLY is used for message reply timeouts. + // Warning: this is confusingly-named given that G_DBUS_ERROR_TIMED_OUT also + // exists. We can't fix it for compatibility reasons so just be careful. + DBusErrorTimeout + // DBusErrorNoNetwork: no network access (probably ENETUNREACH on a socket). + DBusErrorNoNetwork + // DBusErrorAddressInUse: can't bind a socket since its address is in use + // (i.e. EADDRINUSE). + DBusErrorAddressInUse + // DBusErrorDisconnected: connection is disconnected and you're trying to + // use it. + DBusErrorDisconnected + // DBusErrorInvalidArgs: invalid arguments passed to a method call. + DBusErrorInvalidArgs + // DBusErrorFileNotFound: missing file. + DBusErrorFileNotFound + // DBusErrorFileExists: existing file and the operation you're using does + // not silently overwrite. + DBusErrorFileExists + // DBusErrorUnknownMethod: method name you invoked isn't known by the object + // you invoked it on. + DBusErrorUnknownMethod + // DBusErrorTimedOut: certain timeout errors, e.g. while starting a service. + // Warning: this is confusingly-named given that G_DBUS_ERROR_TIMEOUT also + // exists. We can't fix it for compatibility reasons so just be careful. + DBusErrorTimedOut + // DBusErrorMatchRuleNotFound: tried to remove or modify a match rule that + // didn't exist. + DBusErrorMatchRuleNotFound + // DBusErrorMatchRuleInvalid: match rule isn't syntactically valid. + DBusErrorMatchRuleInvalid + // DBusErrorSpawnExecFailed: while starting a new process, the exec() call + // failed. + DBusErrorSpawnExecFailed + // DBusErrorSpawnForkFailed: while starting a new process, the fork() call + // failed. + DBusErrorSpawnForkFailed + // DBusErrorSpawnChildExited: while starting a new process, the child exited + // with a status code. + DBusErrorSpawnChildExited + // DBusErrorSpawnChildSignaled: while starting a new process, the child + // exited on a signal. + DBusErrorSpawnChildSignaled + // DBusErrorSpawnFailed: while starting a new process, something went wrong. + DBusErrorSpawnFailed + // DBusErrorSpawnSetupFailed: we failed to setup the environment correctly. + DBusErrorSpawnSetupFailed + // DBusErrorSpawnConfigInvalid: we failed to setup the config parser + // correctly. + DBusErrorSpawnConfigInvalid + // DBusErrorSpawnServiceInvalid bus name was not valid. + DBusErrorSpawnServiceInvalid + // DBusErrorSpawnServiceNotFound: service file not found in system-services + // directory. + DBusErrorSpawnServiceNotFound + // DBusErrorSpawnPermissionsInvalid permissions are incorrect on the setuid + // helper. + DBusErrorSpawnPermissionsInvalid + // DBusErrorSpawnFileInvalid: service file invalid (Name, User or Exec + // missing). + DBusErrorSpawnFileInvalid + // DBusErrorSpawnNoMemory: tried to get a UNIX process ID and it wasn't + // available. + DBusErrorSpawnNoMemory + // DBusErrorUnixProcessIDUnknown: tried to get a UNIX process ID and it + // wasn't available. + DBusErrorUnixProcessIDUnknown + // DBusErrorInvalidSignature: type signature is not valid. + DBusErrorInvalidSignature + // DBusErrorInvalidFileContent: file contains invalid syntax or is otherwise + // broken. + DBusErrorInvalidFileContent + // DBusErrorSelinuxSecurityContextUnknown: asked for SELinux security + // context and it wasn't available. + DBusErrorSelinuxSecurityContextUnknown + // DBusErrorAdtAuditDataUnknown: asked for ADT audit data and it wasn't + // available. + DBusErrorAdtAuditDataUnknown + // DBusErrorObjectPathInUse there's already an object with the requested + // object path. + DBusErrorObjectPathInUse + // DBusErrorUnknownObject: object you invoked a method on isn't known. + // Since 2.42. + DBusErrorUnknownObject + // DBusErrorUnknownInterface: interface you invoked a method on isn't known + // by the object. Since 2.42. + DBusErrorUnknownInterface + // DBusErrorUnknownProperty: property you tried to access isn't known by the + // object. Since 2.42. + DBusErrorUnknownProperty + // DBusErrorPropertyReadOnly: property you tried to set is read-only. + // Since 2.42. + DBusErrorPropertyReadOnly +) + +func marshalDBusError(p uintptr) (interface{}, error) { + return DBusError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DBusError. +func (d DBusError) String() string { + switch d { + case DBusErrorFailed: + return "Failed" + case DBusErrorNoMemory: + return "NoMemory" + case DBusErrorServiceUnknown: + return "ServiceUnknown" + case DBusErrorNameHasNoOwner: + return "NameHasNoOwner" + case DBusErrorNoReply: + return "NoReply" + case DBusErrorIOError: + return "IOError" + case DBusErrorBadAddress: + return "BadAddress" + case DBusErrorNotSupported: + return "NotSupported" + case DBusErrorLimitsExceeded: + return "LimitsExceeded" + case DBusErrorAccessDenied: + return "AccessDenied" + case DBusErrorAuthFailed: + return "AuthFailed" + case DBusErrorNoServer: + return "NoServer" + case DBusErrorTimeout: + return "Timeout" + case DBusErrorNoNetwork: + return "NoNetwork" + case DBusErrorAddressInUse: + return "AddressInUse" + case DBusErrorDisconnected: + return "Disconnected" + case DBusErrorInvalidArgs: + return "InvalidArgs" + case DBusErrorFileNotFound: + return "FileNotFound" + case DBusErrorFileExists: + return "FileExists" + case DBusErrorUnknownMethod: + return "UnknownMethod" + case DBusErrorTimedOut: + return "TimedOut" + case DBusErrorMatchRuleNotFound: + return "MatchRuleNotFound" + case DBusErrorMatchRuleInvalid: + return "MatchRuleInvalid" + case DBusErrorSpawnExecFailed: + return "SpawnExecFailed" + case DBusErrorSpawnForkFailed: + return "SpawnForkFailed" + case DBusErrorSpawnChildExited: + return "SpawnChildExited" + case DBusErrorSpawnChildSignaled: + return "SpawnChildSignaled" + case DBusErrorSpawnFailed: + return "SpawnFailed" + case DBusErrorSpawnSetupFailed: + return "SpawnSetupFailed" + case DBusErrorSpawnConfigInvalid: + return "SpawnConfigInvalid" + case DBusErrorSpawnServiceInvalid: + return "SpawnServiceInvalid" + case DBusErrorSpawnServiceNotFound: + return "SpawnServiceNotFound" + case DBusErrorSpawnPermissionsInvalid: + return "SpawnPermissionsInvalid" + case DBusErrorSpawnFileInvalid: + return "SpawnFileInvalid" + case DBusErrorSpawnNoMemory: + return "SpawnNoMemory" + case DBusErrorUnixProcessIDUnknown: + return "UnixProcessIDUnknown" + case DBusErrorInvalidSignature: + return "InvalidSignature" + case DBusErrorInvalidFileContent: + return "InvalidFileContent" + case DBusErrorSelinuxSecurityContextUnknown: + return "SelinuxSecurityContextUnknown" + case DBusErrorAdtAuditDataUnknown: + return "AdtAuditDataUnknown" + case DBusErrorObjectPathInUse: + return "ObjectPathInUse" + case DBusErrorUnknownObject: + return "UnknownObject" + case DBusErrorUnknownInterface: + return "UnknownInterface" + case DBusErrorUnknownProperty: + return "UnknownProperty" + case DBusErrorPropertyReadOnly: + return "PropertyReadOnly" + default: + return fmt.Sprintf("DBusError(%d)", d) + } +} + +// DBusErrorEncodeGError creates a D-Bus error name to use for error. +// If error matches a registered error (cf. g_dbus_error_register_error()), +// the corresponding D-Bus error name will be returned. +// +// Otherwise the a name of the form +// org.gtk.GDBus.UnmappedGError.Quark._ESCAPED_QUARK_NAME.Code_ERROR_CODE will +// be used. This allows other GDBus applications to map the error on the wire +// back to a #GError using g_dbus_error_new_for_dbus_error(). +// +// This function is typically only used in object mappings to put a #GError on +// the wire. Regular applications should not use it. +// +// The function takes the following parameters: +// +// - err: #GError. +// +// The function returns the following values: +// +// - utf8 d-Bus error name (never NULL). Free with g_free(). +func DBusErrorEncodeGError(err error) string { + var _arg1 *C.GError // out + var _cret *C.gchar // in + + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + + _cret = C.g_dbus_error_encode_gerror(_arg1) + runtime.KeepAlive(err) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// DBusErrorGetRemoteError gets the D-Bus error name used for error, if any. +// +// This function is guaranteed to return a D-Bus error name for all +// #GErrors returned from functions handling remote method calls (e.g. +// g_dbus_connection_call_finish()) unless g_dbus_error_strip_remote_error() has +// been used on error. +// +// The function takes the following parameters: +// +// - err: #GError. +// +// The function returns the following values: +// +// - utf8 (optional): allocated string or NULL if the D-Bus error name could +// not be found. Free with g_free(). +func DBusErrorGetRemoteError(err error) string { + var _arg1 *C.GError // out + var _cret *C.gchar // in + + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + + _cret = C.g_dbus_error_get_remote_error(_arg1) + runtime.KeepAlive(err) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// DBusErrorIsRemoteError checks if error represents an error received via D-Bus +// from a remote peer. If so, use g_dbus_error_get_remote_error() to get the +// name of the error. +// +// The function takes the following parameters: +// +// - err: #GError. +// +// The function returns the following values: +// +// - ok: TRUE if error represents an error from a remote peer, FALSE +// otherwise. +func DBusErrorIsRemoteError(err error) bool { + var _arg1 *C.GError // out + var _cret C.gboolean // in + + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + + _cret = C.g_dbus_error_is_remote_error(_arg1) + runtime.KeepAlive(err) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// NewDBusErrorForDBusError creates a #GError based on the contents of +// dbus_error_name and dbus_error_message. +// +// Errors registered with g_dbus_error_register_error() will be looked up +// using dbus_error_name and if a match is found, the error domain and code +// is used. Applications can use g_dbus_error_get_remote_error() to recover +// dbus_error_name. +// +// If a match against a registered error is not found and the D-Bus error +// name is in a form as returned by g_dbus_error_encode_gerror() the error +// domain and code encoded in the name is used to create the #GError. Also, +// dbus_error_name is added to the error message such that it can be recovered +// with g_dbus_error_get_remote_error(). +// +// Otherwise, a #GError with the error code G_IO_ERROR_DBUS_ERROR in +// the G_IO_ERROR error domain is returned. Also, dbus_error_name +// is added to the error message such that it can be recovered with +// g_dbus_error_get_remote_error(). +// +// In all three cases, dbus_error_name can always be recovered from the +// returned #GError using the g_dbus_error_get_remote_error() function (unless +// g_dbus_error_strip_remote_error() hasn't been used on the returned error). +// +// This function is typically only used in object mappings to prepare #GError +// instances for applications. Regular applications should not use it. +// +// The function takes the following parameters: +// +// - dbusErrorName d-Bus error name. +// - dbusErrorMessage d-Bus error message. +// +// The function returns the following values: +// +// - err: allocated #GError. Free with g_error_free(). +func NewDBusErrorForDBusError(dbusErrorName, dbusErrorMessage string) error { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(dbusErrorName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(dbusErrorMessage))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_dbus_error_new_for_dbus_error(_arg1, _arg2) + runtime.KeepAlive(dbusErrorName) + runtime.KeepAlive(dbusErrorMessage) + + var _err error // out + + _err = gerror.Take(unsafe.Pointer(_cret)) + + return _err +} + +func DBusErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.g_dbus_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// DBusErrorRegisterError creates an association to map between dbus_error_name +// and #GErrors specified by error_domain and error_code. +// +// This is typically done in the routine that returns the #GQuark for an error +// domain. +// +// The function takes the following parameters: +// +// - errorDomain for an error domain. +// - errorCode: error code. +// - dbusErrorName d-Bus error name. +// +// The function returns the following values: +// +// - ok: TRUE if the association was created, FALSE if it already exists. +func DBusErrorRegisterError(errorDomain glib.Quark, errorCode int, dbusErrorName string) bool { + var _arg1 C.GQuark // out + var _arg2 C.gint // out + var _arg3 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = C.GQuark(errorDomain) + _arg2 = C.gint(errorCode) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(dbusErrorName))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.g_dbus_error_register_error(_arg1, _arg2, _arg3) + runtime.KeepAlive(errorDomain) + runtime.KeepAlive(errorCode) + runtime.KeepAlive(dbusErrorName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusErrorRegisterErrorDomain: helper function for associating a #GError error +// domain with D-Bus error names. +// +// While quark_volatile has a volatile qualifier, this is a historical artifact +// and the argument passed to it should not be volatile. +// +// The function takes the following parameters: +// +// - errorDomainQuarkName: error domain name. +// - quarkVolatile: pointer where to store the #GQuark. +// - entries: pointer to num_entries BusErrorEntry struct items. +func DBusErrorRegisterErrorDomain(errorDomainQuarkName string, quarkVolatile *uint, entries []DBusErrorEntry) { + var _arg1 *C.gchar // out + var _arg2 *C.gsize // out + var _arg3 *C.GDBusErrorEntry // out + var _arg4 C.guint + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(errorDomainQuarkName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gsize)(unsafe.Pointer(quarkVolatile)) + _arg4 = (C.guint)(len(entries)) + _arg3 = (*C.GDBusErrorEntry)(C.calloc(C.size_t(len(entries)), C.size_t(C.sizeof_GDBusErrorEntry))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice((*C.GDBusErrorEntry)(_arg3), len(entries)) + for i := range entries { + out[i] = *(*C.GDBusErrorEntry)(gextras.StructNative(unsafe.Pointer((&entries[i])))) + } + } + + C.g_dbus_error_register_error_domain(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(errorDomainQuarkName) + runtime.KeepAlive(quarkVolatile) + runtime.KeepAlive(entries) +} + +// DBusErrorStripRemoteError looks for extra information in the error message +// used to recover the D-Bus error name and strips it if found. If stripped, +// the message field in error will correspond exactly to what was received on +// the wire. +// +// This is typically used when presenting errors to the end user. +// +// The function takes the following parameters: +// +// - err: #GError. +// +// The function returns the following values: +// +// - ok: TRUE if information was stripped, FALSE otherwise. +func DBusErrorStripRemoteError(err error) bool { + var _arg1 *C.GError // out + var _cret C.gboolean // in + + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + + _cret = C.g_dbus_error_strip_remote_error(_arg1) + runtime.KeepAlive(err) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusErrorUnregisterError destroys an association previously set up with +// g_dbus_error_register_error(). +// +// The function takes the following parameters: +// +// - errorDomain for an error domain. +// - errorCode: error code. +// - dbusErrorName d-Bus error name. +// +// The function returns the following values: +// +// - ok: TRUE if the association was destroyed, FALSE if it wasn't found. +func DBusErrorUnregisterError(errorDomain glib.Quark, errorCode int, dbusErrorName string) bool { + var _arg1 C.GQuark // out + var _arg2 C.gint // out + var _arg3 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = C.GQuark(errorDomain) + _arg2 = C.gint(errorCode) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(dbusErrorName))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.g_dbus_error_unregister_error(_arg1, _arg2, _arg3) + runtime.KeepAlive(errorDomain) + runtime.KeepAlive(errorCode) + runtime.KeepAlive(dbusErrorName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusMessageByteOrder: enumeration used to describe the byte order of a D-Bus +// message. +type DBusMessageByteOrder C.gint + +const ( + // DBusMessageByteOrderBigEndian: byte order is big endian. + DBusMessageByteOrderBigEndian DBusMessageByteOrder = 66 + // DBusMessageByteOrderLittleEndian: byte order is little endian. + DBusMessageByteOrderLittleEndian DBusMessageByteOrder = 108 +) + +func marshalDBusMessageByteOrder(p uintptr) (interface{}, error) { + return DBusMessageByteOrder(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DBusMessageByteOrder. +func (d DBusMessageByteOrder) String() string { + switch d { + case DBusMessageByteOrderBigEndian: + return "BigEndian" + case DBusMessageByteOrderLittleEndian: + return "LittleEndian" + default: + return fmt.Sprintf("DBusMessageByteOrder(%d)", d) + } +} + +// DBusMessageHeaderField: header fields used in BusMessage. +type DBusMessageHeaderField C.gint + +const ( + // DBusMessageHeaderFieldInvalid: not a valid header field. + DBusMessageHeaderFieldInvalid DBusMessageHeaderField = iota + // DBusMessageHeaderFieldPath: object path. + DBusMessageHeaderFieldPath + // DBusMessageHeaderFieldInterface: interface name. + DBusMessageHeaderFieldInterface + // DBusMessageHeaderFieldMember: method or signal name. + DBusMessageHeaderFieldMember + // DBusMessageHeaderFieldErrorName: name of the error that occurred. + DBusMessageHeaderFieldErrorName + // DBusMessageHeaderFieldReplySerial: serial number the message is a reply + // to. + DBusMessageHeaderFieldReplySerial + // DBusMessageHeaderFieldDestination: name the message is intended for. + DBusMessageHeaderFieldDestination + // DBusMessageHeaderFieldSender: unique name of the sender of the message + // (filled in by the bus). + DBusMessageHeaderFieldSender + // DBusMessageHeaderFieldSignature: signature of the message body. + DBusMessageHeaderFieldSignature + // DBusMessageHeaderFieldNumUnixFds: number of UNIX file descriptors that + // accompany the message. + DBusMessageHeaderFieldNumUnixFds +) + +func marshalDBusMessageHeaderField(p uintptr) (interface{}, error) { + return DBusMessageHeaderField(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DBusMessageHeaderField. +func (d DBusMessageHeaderField) String() string { + switch d { + case DBusMessageHeaderFieldInvalid: + return "Invalid" + case DBusMessageHeaderFieldPath: + return "Path" + case DBusMessageHeaderFieldInterface: + return "Interface" + case DBusMessageHeaderFieldMember: + return "Member" + case DBusMessageHeaderFieldErrorName: + return "ErrorName" + case DBusMessageHeaderFieldReplySerial: + return "ReplySerial" + case DBusMessageHeaderFieldDestination: + return "Destination" + case DBusMessageHeaderFieldSender: + return "Sender" + case DBusMessageHeaderFieldSignature: + return "Signature" + case DBusMessageHeaderFieldNumUnixFds: + return "NumUnixFds" + default: + return fmt.Sprintf("DBusMessageHeaderField(%d)", d) + } +} + +// DBusMessageType: message types used in BusMessage. +type DBusMessageType C.gint + +const ( + // DBusMessageTypeInvalid: message is of invalid type. + DBusMessageTypeInvalid DBusMessageType = iota + // DBusMessageTypeMethodCall: method call. + DBusMessageTypeMethodCall + // DBusMessageTypeMethodReturn: method reply. + DBusMessageTypeMethodReturn + // DBusMessageTypeError: error reply. + DBusMessageTypeError + // DBusMessageTypeSignal: signal emission. + DBusMessageTypeSignal +) + +func marshalDBusMessageType(p uintptr) (interface{}, error) { + return DBusMessageType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DBusMessageType. +func (d DBusMessageType) String() string { + switch d { + case DBusMessageTypeInvalid: + return "Invalid" + case DBusMessageTypeMethodCall: + return "MethodCall" + case DBusMessageTypeMethodReturn: + return "MethodReturn" + case DBusMessageTypeError: + return "Error" + case DBusMessageTypeSignal: + return "Signal" + default: + return fmt.Sprintf("DBusMessageType(%d)", d) + } +} + +// DataStreamByteOrder is used to ensure proper endianness of streaming data +// sources across various machine architectures. +type DataStreamByteOrder C.gint + +const ( + // DataStreamByteOrderBigEndian selects Big Endian byte order. + DataStreamByteOrderBigEndian DataStreamByteOrder = iota + // DataStreamByteOrderLittleEndian selects Little Endian byte order. + DataStreamByteOrderLittleEndian + // DataStreamByteOrderHostEndian selects endianness based on host machine's + // architecture. + DataStreamByteOrderHostEndian +) + +func marshalDataStreamByteOrder(p uintptr) (interface{}, error) { + return DataStreamByteOrder(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DataStreamByteOrder. +func (d DataStreamByteOrder) String() string { + switch d { + case DataStreamByteOrderBigEndian: + return "BigEndian" + case DataStreamByteOrderLittleEndian: + return "LittleEndian" + case DataStreamByteOrderHostEndian: + return "HostEndian" + default: + return fmt.Sprintf("DataStreamByteOrder(%d)", d) + } +} + +// DataStreamNewlineType is used when checking for or setting the line endings +// for a given file. +type DataStreamNewlineType C.gint + +const ( + // DataStreamNewlineTypeLf selects "LF" line endings, common on most modern + // UNIX platforms. + DataStreamNewlineTypeLf DataStreamNewlineType = iota + // DataStreamNewlineTypeCr selects "CR" line endings. + DataStreamNewlineTypeCr + // DataStreamNewlineTypeCrLf selects "CR, LF" line ending, common on + // Microsoft Windows. + DataStreamNewlineTypeCrLf + // DataStreamNewlineTypeAny: automatically try to handle any line ending + // type. + DataStreamNewlineTypeAny +) + +func marshalDataStreamNewlineType(p uintptr) (interface{}, error) { + return DataStreamNewlineType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DataStreamNewlineType. +func (d DataStreamNewlineType) String() string { + switch d { + case DataStreamNewlineTypeLf: + return "Lf" + case DataStreamNewlineTypeCr: + return "Cr" + case DataStreamNewlineTypeCrLf: + return "CrLf" + case DataStreamNewlineTypeAny: + return "Any" + default: + return fmt.Sprintf("DataStreamNewlineType(%d)", d) + } +} + +// DriveStartStopType: enumeration describing how a drive can be +// started/stopped. +type DriveStartStopType C.gint + +const ( + // DriveStartStopTypeUnknown: unknown or drive doesn't support start/stop. + DriveStartStopTypeUnknown DriveStartStopType = iota + // DriveStartStopTypeShutdown: stop method will physically shut down the + // drive and e.g. power down the port the drive is attached to. + DriveStartStopTypeShutdown + // DriveStartStopTypeNetwork: start/stop methods are used for + // connecting/disconnect to the drive over the network. + DriveStartStopTypeNetwork + // DriveStartStopTypeMultidisk: start/stop methods will assemble/disassemble + // a virtual drive from several physical drives. + DriveStartStopTypeMultidisk + // DriveStartStopTypePassword: start/stop methods will unlock/lock the + // disk (for example using the ATA SECURITY UNLOCK DEVICE + // command). + DriveStartStopTypePassword +) + +func marshalDriveStartStopType(p uintptr) (interface{}, error) { + return DriveStartStopType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DriveStartStopType. +func (d DriveStartStopType) String() string { + switch d { + case DriveStartStopTypeUnknown: + return "Unknown" + case DriveStartStopTypeShutdown: + return "Shutdown" + case DriveStartStopTypeNetwork: + return "Network" + case DriveStartStopTypeMultidisk: + return "Multidisk" + case DriveStartStopTypePassword: + return "Password" + default: + return fmt.Sprintf("DriveStartStopType(%d)", d) + } +} + +// EmblemOrigin is used to add information about the origin of the emblem to +// #GEmblem. +type EmblemOrigin C.gint + +const ( + // EmblemOriginUnknown: emblem of unknown origin. + EmblemOriginUnknown EmblemOrigin = iota + // EmblemOriginDevice: emblem adds device-specific information. + EmblemOriginDevice + // EmblemOriginLivemetadata: emblem depicts live metadata, such as + // "readonly". + EmblemOriginLivemetadata + // EmblemOriginTag: emblem comes from a user-defined tag, e.g. set by + // nautilus (in the future). + EmblemOriginTag +) + +func marshalEmblemOrigin(p uintptr) (interface{}, error) { + return EmblemOrigin(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for EmblemOrigin. +func (e EmblemOrigin) String() string { + switch e { + case EmblemOriginUnknown: + return "Unknown" + case EmblemOriginDevice: + return "Device" + case EmblemOriginLivemetadata: + return "Livemetadata" + case EmblemOriginTag: + return "Tag" + default: + return fmt.Sprintf("EmblemOrigin(%d)", e) + } +} + +// FileAttributeStatus: used by g_file_set_attributes_from_info() when setting +// file attributes. +type FileAttributeStatus C.gint + +const ( + // FileAttributeStatusUnset: attribute value is unset (empty). + FileAttributeStatusUnset FileAttributeStatus = iota + // FileAttributeStatusSet: attribute value is set. + FileAttributeStatusSet + // FileAttributeStatusErrorSetting indicates an error in setting the value. + FileAttributeStatusErrorSetting +) + +func marshalFileAttributeStatus(p uintptr) (interface{}, error) { + return FileAttributeStatus(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FileAttributeStatus. +func (f FileAttributeStatus) String() string { + switch f { + case FileAttributeStatusUnset: + return "Unset" + case FileAttributeStatusSet: + return "Set" + case FileAttributeStatusErrorSetting: + return "ErrorSetting" + default: + return fmt.Sprintf("FileAttributeStatus(%d)", f) + } +} + +// FileAttributeType: data types for file attributes. +type FileAttributeType C.gint + +const ( + // FileAttributeTypeInvalid indicates an invalid or uninitialized type. + FileAttributeTypeInvalid FileAttributeType = iota + // FileAttributeTypeString: null terminated UTF8 string. + FileAttributeTypeString + // FileAttributeTypeByteString: zero terminated string of non-zero bytes. + FileAttributeTypeByteString + // FileAttributeTypeBoolean: boolean value. + FileAttributeTypeBoolean + // FileAttributeTypeUint32: unsigned 4-byte/32-bit integer. + FileAttributeTypeUint32 + // FileAttributeTypeInt32: signed 4-byte/32-bit integer. + FileAttributeTypeInt32 + // FileAttributeTypeUint64: unsigned 8-byte/64-bit integer. + FileAttributeTypeUint64 + // FileAttributeTypeInt64: signed 8-byte/64-bit integer. + FileAttributeTypeInt64 + // FileAttributeTypeObject: #GObject. + FileAttributeTypeObject + // FileAttributeTypeStringv: NULL terminated char **. Since 2.22. + FileAttributeTypeStringv +) + +func marshalFileAttributeType(p uintptr) (interface{}, error) { + return FileAttributeType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FileAttributeType. +func (f FileAttributeType) String() string { + switch f { + case FileAttributeTypeInvalid: + return "Invalid" + case FileAttributeTypeString: + return "String" + case FileAttributeTypeByteString: + return "ByteString" + case FileAttributeTypeBoolean: + return "Boolean" + case FileAttributeTypeUint32: + return "Uint32" + case FileAttributeTypeInt32: + return "Int32" + case FileAttributeTypeUint64: + return "Uint64" + case FileAttributeTypeInt64: + return "Int64" + case FileAttributeTypeObject: + return "Object" + case FileAttributeTypeStringv: + return "Stringv" + default: + return fmt.Sprintf("FileAttributeType(%d)", f) + } +} + +// FileMonitorEvent specifies what type of event a monitor event is. +type FileMonitorEvent C.gint + +const ( + // FileMonitorEventChanged: file changed. + FileMonitorEventChanged FileMonitorEvent = iota + // FileMonitorEventChangesDoneHint: hint that this was probably the last + // change in a set of changes. + FileMonitorEventChangesDoneHint + // FileMonitorEventDeleted: file was deleted. + FileMonitorEventDeleted + // FileMonitorEventCreated: file was created. + FileMonitorEventCreated + // FileMonitorEventAttributeChanged: file attribute was changed. + FileMonitorEventAttributeChanged + // FileMonitorEventPreUnmount: file location will soon be unmounted. + FileMonitorEventPreUnmount + // FileMonitorEventUnmounted: file location was unmounted. + FileMonitorEventUnmounted + // FileMonitorEventMoved: file was moved -- only sent if the (deprecated) + // G_FILE_MONITOR_SEND_MOVED flag is set. + FileMonitorEventMoved + // FileMonitorEventRenamed: file was renamed within the current directory -- + // only sent if the G_FILE_MONITOR_WATCH_MOVES flag is set. Since: 2.46. + FileMonitorEventRenamed + // FileMonitorEventMovedIn: file was moved into the monitored directory from + // another location -- only sent if the G_FILE_MONITOR_WATCH_MOVES flag is + // set. Since: 2.46. + FileMonitorEventMovedIn + // FileMonitorEventMovedOut: file was moved out of the monitored directory + // to another location -- only sent if the G_FILE_MONITOR_WATCH_MOVES flag + // is set. Since: 2.46. + FileMonitorEventMovedOut +) + +func marshalFileMonitorEvent(p uintptr) (interface{}, error) { + return FileMonitorEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FileMonitorEvent. +func (f FileMonitorEvent) String() string { + switch f { + case FileMonitorEventChanged: + return "Changed" + case FileMonitorEventChangesDoneHint: + return "ChangesDoneHint" + case FileMonitorEventDeleted: + return "Deleted" + case FileMonitorEventCreated: + return "Created" + case FileMonitorEventAttributeChanged: + return "AttributeChanged" + case FileMonitorEventPreUnmount: + return "PreUnmount" + case FileMonitorEventUnmounted: + return "Unmounted" + case FileMonitorEventMoved: + return "Moved" + case FileMonitorEventRenamed: + return "Renamed" + case FileMonitorEventMovedIn: + return "MovedIn" + case FileMonitorEventMovedOut: + return "MovedOut" + default: + return fmt.Sprintf("FileMonitorEvent(%d)", f) + } +} + +// FileType indicates the file's on-disk type. +// +// On Windows systems a file will never have G_FILE_TYPE_SYMBOLIC_LINK type; +// use Info and G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK to determine whether a +// file is a symlink or not. This is due to the fact that NTFS does not have a +// single filesystem object type for symbolic links - it has files that symlink +// to files, and directories that symlink to directories. Type enumeration +// cannot precisely represent this important distinction, which is why all +// Windows symlinks will continue to be reported as G_FILE_TYPE_REGULAR or +// G_FILE_TYPE_DIRECTORY. +type FileType C.gint + +const ( + // FileTypeUnknown file's type is unknown. + FileTypeUnknown FileType = iota + // FileTypeRegular: file handle represents a regular file. + FileTypeRegular + // FileTypeDirectory: file handle represents a directory. + FileTypeDirectory + // FileTypeSymbolicLink: file handle represents a symbolic link (Unix + // systems). + FileTypeSymbolicLink + // FileTypeSpecial: file is a "special" file, such as a socket, fifo, + // block device, or character device. + FileTypeSpecial + // FileTypeShortcut: file is a shortcut (Windows systems). + FileTypeShortcut + // FileTypeMountable: file is a mountable location. + FileTypeMountable +) + +func marshalFileType(p uintptr) (interface{}, error) { + return FileType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FileType. +func (f FileType) String() string { + switch f { + case FileTypeUnknown: + return "Unknown" + case FileTypeRegular: + return "Regular" + case FileTypeDirectory: + return "Directory" + case FileTypeSymbolicLink: + return "SymbolicLink" + case FileTypeSpecial: + return "Special" + case FileTypeShortcut: + return "Shortcut" + case FileTypeMountable: + return "Mountable" + default: + return fmt.Sprintf("FileType(%d)", f) + } +} + +// FilesystemPreviewType indicates a hint from the file system whether files +// should be previewed in a file manager. Returned as the value of the key +// G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW. +type FilesystemPreviewType C.gint + +const ( + // FilesystemPreviewTypeIfAlways: only preview files if user has explicitly + // requested it. + FilesystemPreviewTypeIfAlways FilesystemPreviewType = iota + // FilesystemPreviewTypeIfLocal: preview files if user has requested preview + // of "local" files. + FilesystemPreviewTypeIfLocal + // FilesystemPreviewTypeNever: never preview files. + FilesystemPreviewTypeNever +) + +func marshalFilesystemPreviewType(p uintptr) (interface{}, error) { + return FilesystemPreviewType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FilesystemPreviewType. +func (f FilesystemPreviewType) String() string { + switch f { + case FilesystemPreviewTypeIfAlways: + return "IfAlways" + case FilesystemPreviewTypeIfLocal: + return "IfLocal" + case FilesystemPreviewTypeNever: + return "Never" + default: + return fmt.Sprintf("FilesystemPreviewType(%d)", f) + } +} + +// IOErrorEnum: error codes returned by GIO functions. +// +// Note that this domain may be extended in future GLib releases. +// In general, new error codes either only apply to new APIs, or else replace +// G_IO_ERROR_FAILED in cases that were not explicitly distinguished before. +// You should therefore avoid writing code like +// +// if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_FAILED)) +// { +// // Assume that this is EPRINTERONFIRE +// ... +// } +// +// but should instead treat all unrecognized error codes the same as +// G_IO_ERROR_FAILED. +// +// See also Return for a cheaper way of returning G_IO_ERROR_WOULD_BLOCK to +// callers without allocating a #GError. +type IOErrorEnum C.gint + +const ( + // IOErrorFailed: generic error condition for when an operation fails and no + // more specific OErrorEnum value is defined. + IOErrorFailed IOErrorEnum = 0 + // IOErrorNotFound: file not found. + IOErrorNotFound IOErrorEnum = 1 + // IOErrorExists: file already exists. + IOErrorExists IOErrorEnum = 2 + // IOErrorIsDirectory: file is a directory. + IOErrorIsDirectory IOErrorEnum = 3 + // IOErrorNotDirectory: file is not a directory. + IOErrorNotDirectory IOErrorEnum = 4 + // IOErrorNotEmpty: file is a directory that isn't empty. + IOErrorNotEmpty IOErrorEnum = 5 + // IOErrorNotRegularFile: file is not a regular file. + IOErrorNotRegularFile IOErrorEnum = 6 + // IOErrorNotSymbolicLink: file is not a symbolic link. + IOErrorNotSymbolicLink IOErrorEnum = 7 + // IOErrorNotMountableFile: file cannot be mounted. + IOErrorNotMountableFile IOErrorEnum = 8 + // IOErrorFilenameTooLong: filename is too many characters. + IOErrorFilenameTooLong IOErrorEnum = 9 + // IOErrorInvalidFilename: filename is invalid or contains invalid + // characters. + IOErrorInvalidFilename IOErrorEnum = 10 + // IOErrorTooManyLinks: file contains too many symbolic links. + IOErrorTooManyLinks IOErrorEnum = 11 + // IOErrorNoSpace: no space left on drive. + IOErrorNoSpace IOErrorEnum = 12 + // IOErrorInvalidArgument: invalid argument. + IOErrorInvalidArgument IOErrorEnum = 13 + // IOErrorPermissionDenied: permission denied. + IOErrorPermissionDenied IOErrorEnum = 14 + // IOErrorNotSupported: operation (or one of its parameters) not supported. + IOErrorNotSupported IOErrorEnum = 15 + // IOErrorNotMounted: file isn't mounted. + IOErrorNotMounted IOErrorEnum = 16 + // IOErrorAlreadyMounted: file is already mounted. + IOErrorAlreadyMounted IOErrorEnum = 17 + // IOErrorClosed: file was closed. + IOErrorClosed IOErrorEnum = 18 + // IOErrorCancelled: operation was cancelled. See #GCancellable. + IOErrorCancelled IOErrorEnum = 19 + // IOErrorPending operations are still pending. + IOErrorPending IOErrorEnum = 20 + // IOErrorReadOnly: file is read only. + IOErrorReadOnly IOErrorEnum = 21 + // IOErrorCantCreateBackup: backup couldn't be created. + IOErrorCantCreateBackup IOErrorEnum = 22 + // IOErrorWrongETag file's Entity Tag was incorrect. + IOErrorWrongETag IOErrorEnum = 23 + // IOErrorTimedOut: operation timed out. + IOErrorTimedOut IOErrorEnum = 24 + // IOErrorWouldRecurse: operation would be recursive. + IOErrorWouldRecurse IOErrorEnum = 25 + // IOErrorBusy: file is busy. + IOErrorBusy IOErrorEnum = 26 + // IOErrorWouldBlock: operation would block. + IOErrorWouldBlock IOErrorEnum = 27 + // IOErrorHostNotFound: host couldn't be found (remote operations). + IOErrorHostNotFound IOErrorEnum = 28 + // IOErrorWouldMerge: operation would merge files. + IOErrorWouldMerge IOErrorEnum = 29 + // IOErrorFailedHandled: operation failed and a helper program has already + // interacted with the user. Do not display any error dialog. + IOErrorFailedHandled IOErrorEnum = 30 + // IOErrorTooManyOpenFiles: current process has too many files open and + // can't open any more. Duplicate descriptors do count toward this limit. + // Since 2.20. + IOErrorTooManyOpenFiles IOErrorEnum = 31 + // IOErrorNotInitialized: object has not been initialized. Since 2.22. + IOErrorNotInitialized IOErrorEnum = 32 + // IOErrorAddressInUse: requested address is already in use. Since 2.22. + IOErrorAddressInUse IOErrorEnum = 33 + // IOErrorPartialInput: need more input to finish operation. Since 2.24. + IOErrorPartialInput IOErrorEnum = 34 + // IOErrorInvalidData: input data was invalid. Since 2.24. + IOErrorInvalidData IOErrorEnum = 35 + // IOErrorDBusError: remote object generated an error that doesn't + // correspond to a locally registered #GError error domain. Use + // g_dbus_error_get_remote_error() to extract the D-Bus error name and + // g_dbus_error_strip_remote_error() to fix up the message so it matches + // what was received on the wire. Since 2.26. + IOErrorDBusError IOErrorEnum = 36 + // IOErrorHostUnreachable: host unreachable. Since 2.26. + IOErrorHostUnreachable IOErrorEnum = 37 + // IOErrorNetworkUnreachable: network unreachable. Since 2.26. + IOErrorNetworkUnreachable IOErrorEnum = 38 + // IOErrorConnectionRefused: connection refused. Since 2.26. + IOErrorConnectionRefused IOErrorEnum = 39 + // IOErrorProxyFailed: connection to proxy server failed. Since 2.26. + IOErrorProxyFailed IOErrorEnum = 40 + // IOErrorProxyAuthFailed: proxy authentication failed. Since 2.26. + IOErrorProxyAuthFailed IOErrorEnum = 41 + // IOErrorProxyNeedAuth: proxy server needs authentication. Since 2.26. + IOErrorProxyNeedAuth IOErrorEnum = 42 + // IOErrorProxyNotAllowed: proxy connection is not allowed by ruleset. + // Since 2.26. + IOErrorProxyNotAllowed IOErrorEnum = 43 + // IOErrorBrokenPipe: broken pipe. Since 2.36. + IOErrorBrokenPipe IOErrorEnum = 44 + // IOErrorConnectionClosed: connection closed by peer. Note that this is + // the same code as G_IO_ERROR_BROKEN_PIPE; before 2.44 some "connection + // closed" errors returned G_IO_ERROR_BROKEN_PIPE, but others returned + // G_IO_ERROR_FAILED. Now they should all return the same value, which has + // this more logical name. Since 2.44. + IOErrorConnectionClosed IOErrorEnum = 44 + // IOErrorNotConnected: transport endpoint is not connected. Since 2.44. + IOErrorNotConnected IOErrorEnum = 45 + // IOErrorMessageTooLarge: message too large. Since 2.48. + IOErrorMessageTooLarge IOErrorEnum = 46 + // IOErrorNoSuchDevice: no such device found. Since 2.74. + IOErrorNoSuchDevice IOErrorEnum = 47 + // IOErrorDestinationUnset: destination address unset. Since 2.80. + IOErrorDestinationUnset IOErrorEnum = 48 +) + +func marshalIOErrorEnum(p uintptr) (interface{}, error) { + return IOErrorEnum(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for IOErrorEnum. +func (i IOErrorEnum) String() string { + switch i { + case IOErrorFailed: + return "Failed" + case IOErrorNotFound: + return "NotFound" + case IOErrorExists: + return "Exists" + case IOErrorIsDirectory: + return "IsDirectory" + case IOErrorNotDirectory: + return "NotDirectory" + case IOErrorNotEmpty: + return "NotEmpty" + case IOErrorNotRegularFile: + return "NotRegularFile" + case IOErrorNotSymbolicLink: + return "NotSymbolicLink" + case IOErrorNotMountableFile: + return "NotMountableFile" + case IOErrorFilenameTooLong: + return "FilenameTooLong" + case IOErrorInvalidFilename: + return "InvalidFilename" + case IOErrorTooManyLinks: + return "TooManyLinks" + case IOErrorNoSpace: + return "NoSpace" + case IOErrorInvalidArgument: + return "InvalidArgument" + case IOErrorPermissionDenied: + return "PermissionDenied" + case IOErrorNotSupported: + return "NotSupported" + case IOErrorNotMounted: + return "NotMounted" + case IOErrorAlreadyMounted: + return "AlreadyMounted" + case IOErrorClosed: + return "Closed" + case IOErrorCancelled: + return "Cancelled" + case IOErrorPending: + return "Pending" + case IOErrorReadOnly: + return "ReadOnly" + case IOErrorCantCreateBackup: + return "CantCreateBackup" + case IOErrorWrongETag: + return "WrongETag" + case IOErrorTimedOut: + return "TimedOut" + case IOErrorWouldRecurse: + return "WouldRecurse" + case IOErrorBusy: + return "Busy" + case IOErrorWouldBlock: + return "WouldBlock" + case IOErrorHostNotFound: + return "HostNotFound" + case IOErrorWouldMerge: + return "WouldMerge" + case IOErrorFailedHandled: + return "FailedHandled" + case IOErrorTooManyOpenFiles: + return "TooManyOpenFiles" + case IOErrorNotInitialized: + return "NotInitialized" + case IOErrorAddressInUse: + return "AddressInUse" + case IOErrorPartialInput: + return "PartialInput" + case IOErrorInvalidData: + return "InvalidData" + case IOErrorDBusError: + return "DBusError" + case IOErrorHostUnreachable: + return "HostUnreachable" + case IOErrorNetworkUnreachable: + return "NetworkUnreachable" + case IOErrorConnectionRefused: + return "ConnectionRefused" + case IOErrorProxyFailed: + return "ProxyFailed" + case IOErrorProxyAuthFailed: + return "ProxyAuthFailed" + case IOErrorProxyNeedAuth: + return "ProxyNeedAuth" + case IOErrorProxyNotAllowed: + return "ProxyNotAllowed" + case IOErrorBrokenPipe: + return "BrokenPipe" + case IOErrorNotConnected: + return "NotConnected" + case IOErrorMessageTooLarge: + return "MessageTooLarge" + case IOErrorNoSuchDevice: + return "NoSuchDevice" + case IOErrorDestinationUnset: + return "DestinationUnset" + default: + return fmt.Sprintf("IOErrorEnum(%d)", i) + } +} + +// IOModuleScopeFlags flags for use with g_io_module_scope_new(). +type IOModuleScopeFlags C.gint + +const ( + // IOModuleScopeNone: no module scan flags. + IOModuleScopeNone IOModuleScopeFlags = iota + // IOModuleScopeBlockDuplicates: when using this scope to load or scan + // modules, automatically block a modules which has the same base basename + // as previously loaded module. + IOModuleScopeBlockDuplicates +) + +func marshalIOModuleScopeFlags(p uintptr) (interface{}, error) { + return IOModuleScopeFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for IOModuleScopeFlags. +func (i IOModuleScopeFlags) String() string { + switch i { + case IOModuleScopeNone: + return "None" + case IOModuleScopeBlockDuplicates: + return "BlockDuplicates" + default: + return fmt.Sprintf("IOModuleScopeFlags(%d)", i) + } +} + +// MemoryMonitorWarningLevel: memory availability warning levels. +// +// Note that because new values might be added, it is recommended that +// applications check MonitorWarningLevel as ranges, for example: +// +// if (warning_level > G_MEMORY_MONITOR_WARNING_LEVEL_LOW) +// drop_caches ();. +type MemoryMonitorWarningLevel C.gint + +const ( + // MemoryMonitorWarningLevelLow: memory on the device is low, processes + // should free up unneeded resources (for example, in-memory caches) so they + // can be used elsewhere. + MemoryMonitorWarningLevelLow MemoryMonitorWarningLevel = 50 + // MemoryMonitorWarningLevelMedium: same as + // G_MEMORY_MONITOR_WARNING_LEVEL_LOW but the device has even less free + // memory, so processes should try harder to free up unneeded resources. + // If your process does not need to stay running, it is a good time for it + // to quit. + MemoryMonitorWarningLevelMedium MemoryMonitorWarningLevel = 100 + // MemoryMonitorWarningLevelCritical: system will soon start terminating + // processes to reclaim memory, including background processes. + MemoryMonitorWarningLevelCritical MemoryMonitorWarningLevel = 255 +) + +func marshalMemoryMonitorWarningLevel(p uintptr) (interface{}, error) { + return MemoryMonitorWarningLevel(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for MemoryMonitorWarningLevel. +func (m MemoryMonitorWarningLevel) String() string { + switch m { + case MemoryMonitorWarningLevelLow: + return "Low" + case MemoryMonitorWarningLevelMedium: + return "Medium" + case MemoryMonitorWarningLevelCritical: + return "Critical" + default: + return fmt.Sprintf("MemoryMonitorWarningLevel(%d)", m) + } +} + +// MountOperationResult is returned as a result when a request for information +// is send by the mounting operation. +type MountOperationResult C.gint + +const ( + // MountOperationHandled: request was fulfilled and the user specified data + // is now available. + MountOperationHandled MountOperationResult = iota + // MountOperationAborted: user requested the mount operation to be aborted. + MountOperationAborted + // MountOperationUnhandled: request was unhandled (i.e. not implemented). + MountOperationUnhandled +) + +func marshalMountOperationResult(p uintptr) (interface{}, error) { + return MountOperationResult(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for MountOperationResult. +func (m MountOperationResult) String() string { + switch m { + case MountOperationHandled: + return "Handled" + case MountOperationAborted: + return "Aborted" + case MountOperationUnhandled: + return "Unhandled" + default: + return fmt.Sprintf("MountOperationResult(%d)", m) + } +} + +// NetworkConnectivity host's network connectivity state, as reported by +// Monitor. +type NetworkConnectivity C.gint + +const ( + // NetworkConnectivityLocal: host is not configured with a route to the + // Internet; it may or may not be connected to a local network. + NetworkConnectivityLocal NetworkConnectivity = 1 + // NetworkConnectivityLimited: host is connected to a network, but does not + // appear to be able to reach the full Internet, perhaps due to upstream + // network problems. + NetworkConnectivityLimited NetworkConnectivity = 2 + // NetworkConnectivityPortal: host is behind a captive portal and cannot + // reach the full Internet. + NetworkConnectivityPortal NetworkConnectivity = 3 + // NetworkConnectivityFull: host is connected to a network, and appears to + // be able to reach the full Internet. + NetworkConnectivityFull NetworkConnectivity = 4 +) + +func marshalNetworkConnectivity(p uintptr) (interface{}, error) { + return NetworkConnectivity(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for NetworkConnectivity. +func (n NetworkConnectivity) String() string { + switch n { + case NetworkConnectivityLocal: + return "Local" + case NetworkConnectivityLimited: + return "Limited" + case NetworkConnectivityPortal: + return "Portal" + case NetworkConnectivityFull: + return "Full" + default: + return fmt.Sprintf("NetworkConnectivity(%d)", n) + } +} + +// NotificationPriority: priority levels for #GNotifications. +type NotificationPriority C.gint + +const ( + // NotificationPriorityNormal: default priority, to be used for the majority + // of notifications (for example email messages, software updates, completed + // download/sync operations). + NotificationPriorityNormal NotificationPriority = iota + // NotificationPriorityLow: for notifications that do not require immediate + // attention - typically used for contextual background information, such as + // contact birthdays or local weather. + NotificationPriorityLow + // NotificationPriorityHigh: for events that require more attention, usually + // because responses are time-sensitive (for example chat and SMS messages + // or alarms). + NotificationPriorityHigh + // NotificationPriorityUrgent: for urgent notifications, or notifications + // that require a response in a short space of time (for example phone calls + // or emergency warnings). + NotificationPriorityUrgent +) + +func marshalNotificationPriority(p uintptr) (interface{}, error) { + return NotificationPriority(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for NotificationPriority. +func (n NotificationPriority) String() string { + switch n { + case NotificationPriorityNormal: + return "Normal" + case NotificationPriorityLow: + return "Low" + case NotificationPriorityHigh: + return "High" + case NotificationPriorityUrgent: + return "Urgent" + default: + return fmt.Sprintf("NotificationPriority(%d)", n) + } +} + +// PasswordSave is used to indicate the lifespan of a saved password. +// +// #Gvfs stores passwords in the Gnome keyring when this flag allows it to, +// and later retrieves it again from there. +type PasswordSave C.gint + +const ( + // PasswordSaveNever: never save a password. + PasswordSaveNever PasswordSave = iota + // PasswordSaveForSession: save a password for the session. + PasswordSaveForSession + // PasswordSavePermanently: save a password permanently. + PasswordSavePermanently +) + +func marshalPasswordSave(p uintptr) (interface{}, error) { + return PasswordSave(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PasswordSave. +func (p PasswordSave) String() string { + switch p { + case PasswordSaveNever: + return "Never" + case PasswordSaveForSession: + return "ForSession" + case PasswordSavePermanently: + return "Permanently" + default: + return fmt.Sprintf("PasswordSave(%d)", p) + } +} + +// PollableReturn: return value for various IO operations that signal errors via +// the return value and not necessarily via a #GError. +// +// This enum exists to be able to return errors to callers without having to +// allocate a #GError. Allocating #GErrors can be quite expensive for regularly +// happening errors like G_IO_ERROR_WOULD_BLOCK. +// +// In case of G_POLLABLE_RETURN_FAILED a #GError should be set for the operation +// to give details about the error that happened. +type PollableReturn C.gint + +const ( + // PollableReturnFailed: generic error condition for when an operation + // fails. + PollableReturnFailed PollableReturn = 0 + // PollableReturnOK: operation was successfully finished. + PollableReturnOK PollableReturn = 1 + // PollableReturnWouldBlock: operation would block. + PollableReturnWouldBlock PollableReturn = -27 +) + +func marshalPollableReturn(p uintptr) (interface{}, error) { + return PollableReturn(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PollableReturn. +func (p PollableReturn) String() string { + switch p { + case PollableReturnFailed: + return "Failed" + case PollableReturnOK: + return "OK" + case PollableReturnWouldBlock: + return "WouldBlock" + default: + return fmt.Sprintf("PollableReturn(%d)", p) + } +} + +// ResolverError: error code used with G_RESOLVER_ERROR in a #GError returned +// from a #GResolver routine. +type ResolverError C.gint + +const ( + // ResolverErrorNotFound: requested name/address/service was not found. + ResolverErrorNotFound ResolverError = iota + // ResolverErrorTemporaryFailure: requested information could not be looked + // up due to a network error or similar problem. + ResolverErrorTemporaryFailure + // ResolverErrorInternal: unknown error. + ResolverErrorInternal +) + +func marshalResolverError(p uintptr) (interface{}, error) { + return ResolverError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ResolverError. +func (r ResolverError) String() string { + switch r { + case ResolverErrorNotFound: + return "NotFound" + case ResolverErrorTemporaryFailure: + return "TemporaryFailure" + case ResolverErrorInternal: + return "Internal" + default: + return fmt.Sprintf("ResolverError(%d)", r) + } +} + +// ResolverErrorQuark gets the #GResolver Error Quark. +// +// The function returns the following values: +// +// - quark: #GQuark. +func ResolverErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.g_resolver_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// ResolverRecordType: type of record that g_resolver_lookup_records() or +// g_resolver_lookup_records_async() should retrieve. The records are returned +// as lists of #GVariant tuples. Each record type has different values in the +// variant tuples returned. +// +// G_RESOLVER_RECORD_SRV records are returned as variants with the signature +// (qqqs), containing a guint16 with the priority, a guint16 with the weight, +// a guint16 with the port, and a string of the hostname. +// +// G_RESOLVER_RECORD_MX records are returned as variants with the signature +// (qs), representing a guint16 with the preference, and a string containing the +// mail exchanger hostname. +// +// G_RESOLVER_RECORD_TXT records are returned as variants with the +// signature (as), representing an array of the strings in the text +// record. Note: Most TXT records only contain a single string, +// but RFC 1035 (https://tools.ietf.org/html/rfc1035#section-3.3.14) +// does allow a record to contain multiple strings. The RFC which defines +// the interpretation of a specific TXT record will likely require +// concatenation of multiple strings if they are present, as with RFC 7208 +// (https://tools.ietf.org/html/rfc7208#section-3.3). +// +// G_RESOLVER_RECORD_SOA records are returned as variants with the signature +// (ssuuuuu), representing a string containing the primary name server, +// a string containing the administrator, the serial as a guint32, the refresh +// interval as a guint32, the retry interval as a guint32, the expire timeout as +// a guint32, and the TTL as a guint32. +// +// G_RESOLVER_RECORD_NS records are returned as variants with the signature (s), +// representing a string of the hostname of the name server. +type ResolverRecordType C.gint + +const ( + // ResolverRecordSrv: look up DNS SRV records for a domain. + ResolverRecordSrv ResolverRecordType = 1 + // ResolverRecordMx: look up DNS MX records for a domain. + ResolverRecordMx ResolverRecordType = 2 + // ResolverRecordTxt: look up DNS TXT records for a name. + ResolverRecordTxt ResolverRecordType = 3 + // ResolverRecordSoa: look up DNS SOA records for a zone. + ResolverRecordSoa ResolverRecordType = 4 + // ResolverRecordNs: look up DNS NS records for a domain. + ResolverRecordNs ResolverRecordType = 5 +) + +func marshalResolverRecordType(p uintptr) (interface{}, error) { + return ResolverRecordType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ResolverRecordType. +func (r ResolverRecordType) String() string { + switch r { + case ResolverRecordSrv: + return "Srv" + case ResolverRecordMx: + return "Mx" + case ResolverRecordTxt: + return "Txt" + case ResolverRecordSoa: + return "Soa" + case ResolverRecordNs: + return "Ns" + default: + return fmt.Sprintf("ResolverRecordType(%d)", r) + } +} + +// ResourceError: error code used with G_RESOURCE_ERROR in a #GError returned +// from a #GResource routine. +type ResourceError C.gint + +const ( + // ResourceErrorNotFound: no file was found at the requested path. + ResourceErrorNotFound ResourceError = iota + // ResourceErrorInternal: unknown error. + ResourceErrorInternal +) + +func marshalResourceError(p uintptr) (interface{}, error) { + return ResourceError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ResourceError. +func (r ResourceError) String() string { + switch r { + case ResourceErrorNotFound: + return "NotFound" + case ResourceErrorInternal: + return "Internal" + default: + return fmt.Sprintf("ResourceError(%d)", r) + } +} + +// ResourceErrorQuark gets the #GResource Error Quark. +// +// The function returns the following values: +// +// - quark: #GQuark. +func ResourceErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.g_resource_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// SocketClientEvent describes an event occurring on a Client. See the +// Client::event signal for more details. +// +// Additional values may be added to this type in the future. +type SocketClientEvent C.gint + +const ( + // SocketClientResolving: client is doing a DNS lookup. + SocketClientResolving SocketClientEvent = iota + // SocketClientResolved: client has completed a DNS lookup. + SocketClientResolved + // SocketClientConnecting: client is connecting to a remote host (either a + // proxy or the destination server). + SocketClientConnecting + // SocketClientConnected: client has connected to a remote host. + SocketClientConnected + // SocketClientProxyNegotiating: client is negotiating with a proxy to + // connect to the destination server. + SocketClientProxyNegotiating + // SocketClientProxyNegotiated: client has negotiated with the proxy server. + SocketClientProxyNegotiated + // SocketClientTLSHandshaking: client is performing a TLS handshake. + SocketClientTLSHandshaking + // SocketClientTLSHandshaked: client has performed a TLS handshake. + SocketClientTLSHandshaked + // SocketClientComplete: client is done with a particular Connectable. + SocketClientComplete +) + +func marshalSocketClientEvent(p uintptr) (interface{}, error) { + return SocketClientEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SocketClientEvent. +func (s SocketClientEvent) String() string { + switch s { + case SocketClientResolving: + return "Resolving" + case SocketClientResolved: + return "Resolved" + case SocketClientConnecting: + return "Connecting" + case SocketClientConnected: + return "Connected" + case SocketClientProxyNegotiating: + return "ProxyNegotiating" + case SocketClientProxyNegotiated: + return "ProxyNegotiated" + case SocketClientTLSHandshaking: + return "TLSHandshaking" + case SocketClientTLSHandshaked: + return "TLSHandshaked" + case SocketClientComplete: + return "Complete" + default: + return fmt.Sprintf("SocketClientEvent(%d)", s) + } +} + +// SocketFamily: protocol family of a Address. (These values are identical to +// the system defines AF_INET, AF_INET6 and AF_UNIX, if available.). +type SocketFamily C.gint + +const ( + // SocketFamilyInvalid: no address family. + SocketFamilyInvalid SocketFamily = 0 + // SocketFamilyUnix: UNIX domain family. + SocketFamilyUnix SocketFamily = 1 + // SocketFamilyIPv4: IPv4 family. + SocketFamilyIPv4 SocketFamily = 2 + // SocketFamilyIPv6: IPv6 family. + SocketFamilyIPv6 SocketFamily = 10 +) + +func marshalSocketFamily(p uintptr) (interface{}, error) { + return SocketFamily(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SocketFamily. +func (s SocketFamily) String() string { + switch s { + case SocketFamilyInvalid: + return "Invalid" + case SocketFamilyUnix: + return "Unix" + case SocketFamilyIPv4: + return "IPv4" + case SocketFamilyIPv6: + return "IPv6" + default: + return fmt.Sprintf("SocketFamily(%d)", s) + } +} + +// SocketListenerEvent describes an event occurring on a Listener. See the +// Listener::event signal for more details. +// +// Additional values may be added to this type in the future. +type SocketListenerEvent C.gint + +const ( + // SocketListenerBinding: listener is about to bind a socket. + SocketListenerBinding SocketListenerEvent = iota + // SocketListenerBound: listener has bound a socket. + SocketListenerBound + // SocketListenerListening: listener is about to start listening on this + // socket. + SocketListenerListening + // SocketListenerListened: listener is now listening on this socket. + SocketListenerListened +) + +func marshalSocketListenerEvent(p uintptr) (interface{}, error) { + return SocketListenerEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SocketListenerEvent. +func (s SocketListenerEvent) String() string { + switch s { + case SocketListenerBinding: + return "Binding" + case SocketListenerBound: + return "Bound" + case SocketListenerListening: + return "Listening" + case SocketListenerListened: + return "Listened" + default: + return fmt.Sprintf("SocketListenerEvent(%d)", s) + } +} + +// SocketProtocol: protocol identifier is specified when creating a #GSocket, +// which is a family/type specific identifier, where 0 means the default +// protocol for the particular family/type. +// +// This enum contains a set of commonly available and used protocols. You can +// also pass any other identifiers handled by the platform in order to use +// protocols not listed here. +type SocketProtocol C.gint + +const ( + // SocketProtocolUnknown: protocol type is unknown. + SocketProtocolUnknown SocketProtocol = -1 + // SocketProtocolDefault: default protocol for the family/type. + SocketProtocolDefault SocketProtocol = 0 + // SocketProtocolTCP: TCP over IP. + SocketProtocolTCP SocketProtocol = 6 + // SocketProtocolUDP: UDP over IP. + SocketProtocolUDP SocketProtocol = 17 + // SocketProtocolSCTP: SCTP over IP. + SocketProtocolSCTP SocketProtocol = 132 +) + +func marshalSocketProtocol(p uintptr) (interface{}, error) { + return SocketProtocol(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SocketProtocol. +func (s SocketProtocol) String() string { + switch s { + case SocketProtocolUnknown: + return "Unknown" + case SocketProtocolDefault: + return "Default" + case SocketProtocolTCP: + return "TCP" + case SocketProtocolUDP: + return "UDP" + case SocketProtocolSCTP: + return "SCTP" + default: + return fmt.Sprintf("SocketProtocol(%d)", s) + } +} + +// SocketType flags used when creating a #GSocket. Some protocols may not +// implement all the socket types. +type SocketType C.gint + +const ( + // SocketTypeInvalid: type unknown or wrong. + SocketTypeInvalid SocketType = iota + // SocketTypeStream: reliable connection-based byte streams (e.g. TCP). + SocketTypeStream + // SocketTypeDatagram: connectionless, unreliable datagram passing. (e.g. + // UDP). + SocketTypeDatagram + // SocketTypeSeqpacket: reliable connection-based passing of datagrams of + // fixed maximum length (e.g. SCTP). + SocketTypeSeqpacket +) + +func marshalSocketType(p uintptr) (interface{}, error) { + return SocketType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SocketType. +func (s SocketType) String() string { + switch s { + case SocketTypeInvalid: + return "Invalid" + case SocketTypeStream: + return "Stream" + case SocketTypeDatagram: + return "Datagram" + case SocketTypeSeqpacket: + return "Seqpacket" + default: + return fmt.Sprintf("SocketType(%d)", s) + } +} + +// TLSAuthenticationMode: client authentication mode for a ServerConnection. +type TLSAuthenticationMode C.gint + +const ( + // TLSAuthenticationNone: client authentication not required. + TLSAuthenticationNone TLSAuthenticationMode = iota + // TLSAuthenticationRequested: client authentication is requested. + TLSAuthenticationRequested + // TLSAuthenticationRequired: client authentication is required. + TLSAuthenticationRequired +) + +func marshalTLSAuthenticationMode(p uintptr) (interface{}, error) { + return TLSAuthenticationMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TLSAuthenticationMode. +func (t TLSAuthenticationMode) String() string { + switch t { + case TLSAuthenticationNone: + return "None" + case TLSAuthenticationRequested: + return "Requested" + case TLSAuthenticationRequired: + return "Required" + default: + return fmt.Sprintf("TLSAuthenticationMode(%d)", t) + } +} + +// TLSCertificateRequestFlags flags for g_tls_interaction_request_certificate(), +// g_tls_interaction_request_certificate_async(), and +// g_tls_interaction_invoke_request_certificate(). +type TLSCertificateRequestFlags C.gint + +const ( + // TLSCertificateRequestNone: no flags. + TLSCertificateRequestNone TLSCertificateRequestFlags = iota +) + +func marshalTLSCertificateRequestFlags(p uintptr) (interface{}, error) { + return TLSCertificateRequestFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TLSCertificateRequestFlags. +func (t TLSCertificateRequestFlags) String() string { + switch t { + case TLSCertificateRequestNone: + return "None" + default: + return fmt.Sprintf("TLSCertificateRequestFlags(%d)", t) + } +} + +// TLSChannelBindingError: error code used with G_TLS_CHANNEL_BINDING_ERROR in a +// #GError to indicate a TLS channel binding retrieval error. +type TLSChannelBindingError C.gint + +const ( + // TLSChannelBindingErrorNotImplemented: either entire binding retrieval + // facility or specific binding type is not implemented in the TLS backend. + TLSChannelBindingErrorNotImplemented TLSChannelBindingError = iota + // TLSChannelBindingErrorInvalidState: handshake is not yet complete on the + // connection which is a strong requirement for any existing binding type. + TLSChannelBindingErrorInvalidState + // TLSChannelBindingErrorNotAvailable: handshake is complete but binding + // data is not available. That normally indicates the TLS implementation + // failed to provide the binding data. For example, some implementations do + // not provide a peer certificate for resumed connections. + TLSChannelBindingErrorNotAvailable + // TLSChannelBindingErrorNotSupported: binding type is not supported on + // the current connection. This error could be triggered when requesting + // tls-server-end-point binding data for a certificate which has no hash + // function or uses multiple hash functions. + TLSChannelBindingErrorNotSupported + // TLSChannelBindingErrorGeneralError: any other backend error preventing + // binding data retrieval. + TLSChannelBindingErrorGeneralError +) + +func marshalTLSChannelBindingError(p uintptr) (interface{}, error) { + return TLSChannelBindingError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TLSChannelBindingError. +func (t TLSChannelBindingError) String() string { + switch t { + case TLSChannelBindingErrorNotImplemented: + return "NotImplemented" + case TLSChannelBindingErrorInvalidState: + return "InvalidState" + case TLSChannelBindingErrorNotAvailable: + return "NotAvailable" + case TLSChannelBindingErrorNotSupported: + return "NotSupported" + case TLSChannelBindingErrorGeneralError: + return "GeneralError" + default: + return fmt.Sprintf("TLSChannelBindingError(%d)", t) + } +} + +// TLSChannelBindingErrorQuark gets the TLS channel binding error quark. +// +// The function returns the following values: +// +// - quark: #GQuark. +func TLSChannelBindingErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.g_tls_channel_binding_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// TLSChannelBindingType: type of TLS channel binding data to retrieve from +// Connection or Connection, as documented by RFC 5929 or RFC 9266. The +// tls-unique-for-telnet (https://tools.ietf.org/html/rfc5929#section-5) binding +// type is not currently implemented. +type TLSChannelBindingType C.gint + +const ( + // TLSChannelBindingTLSUnique: tls-unique + // (https://tools.ietf.org/html/rfc5929#section-3) binding type. + TLSChannelBindingTLSUnique TLSChannelBindingType = iota + // TLSChannelBindingTLSServerEndPoint: tls-server-end-point + // (https://tools.ietf.org/html/rfc5929#section-4) binding type. + TLSChannelBindingTLSServerEndPoint + // TLSChannelBindingTLSExporter: tls-exporter + // (https://www.rfc-editor.org/rfc/rfc9266.html) binding type. Since: 2.74. + TLSChannelBindingTLSExporter +) + +func marshalTLSChannelBindingType(p uintptr) (interface{}, error) { + return TLSChannelBindingType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TLSChannelBindingType. +func (t TLSChannelBindingType) String() string { + switch t { + case TLSChannelBindingTLSUnique: + return "Unique" + case TLSChannelBindingTLSServerEndPoint: + return "ServerEndPoint" + case TLSChannelBindingTLSExporter: + return "Exporter" + default: + return fmt.Sprintf("TLSChannelBindingType(%d)", t) + } +} + +// TLSDatabaseLookupFlags flags for +// g_tls_database_lookup_certificate_for_handle(), +// g_tls_database_lookup_certificate_issuer(), and +// g_tls_database_lookup_certificates_issued_by(). +type TLSDatabaseLookupFlags C.gint + +const ( + // TLSDatabaseLookupNone: no lookup flags. + TLSDatabaseLookupNone TLSDatabaseLookupFlags = iota + // TLSDatabaseLookupKeypair: restrict lookup to certificates that have a + // private key. + TLSDatabaseLookupKeypair +) + +func marshalTLSDatabaseLookupFlags(p uintptr) (interface{}, error) { + return TLSDatabaseLookupFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TLSDatabaseLookupFlags. +func (t TLSDatabaseLookupFlags) String() string { + switch t { + case TLSDatabaseLookupNone: + return "None" + case TLSDatabaseLookupKeypair: + return "Keypair" + default: + return fmt.Sprintf("TLSDatabaseLookupFlags(%d)", t) + } +} + +// TLSError: error code used with G_TLS_ERROR in a #GError returned from a +// TLS-related routine. +type TLSError C.gint + +const ( + // TLSErrorUnavailable: no TLS provider is available. + TLSErrorUnavailable TLSError = iota + // TLSErrorMisc miscellaneous TLS error. + TLSErrorMisc + // TLSErrorBadCertificate: certificate presented could not be parsed or + // failed validation. + TLSErrorBadCertificate + // TLSErrorNotTLS: TLS handshake failed because the peer does not seem to be + // a TLS server. + TLSErrorNotTLS + // TLSErrorHandshake: TLS handshake failed because the peer's certificate + // was not acceptable. + TLSErrorHandshake + // TLSErrorCertificateRequired: TLS handshake failed because the server + // requested a client-side certificate, but none was provided. See + // g_tls_connection_set_certificate(). + TLSErrorCertificateRequired + // TLSErrorEOF: TLS connection was closed without proper notice, which may + // indicate an attack. See g_tls_connection_set_require_close_notify(). + TLSErrorEOF + // TLSErrorInappropriateFallback: TLS handshake failed because the client + // sent the fallback SCSV, indicating a protocol downgrade attack. Since: + // 2.60. + TLSErrorInappropriateFallback + // TLSErrorBadCertificatePassword: certificate failed to load because a + // password was incorrect. Since: 2.72. + TLSErrorBadCertificatePassword +) + +func marshalTLSError(p uintptr) (interface{}, error) { + return TLSError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TLSError. +func (t TLSError) String() string { + switch t { + case TLSErrorUnavailable: + return "Unavailable" + case TLSErrorMisc: + return "Misc" + case TLSErrorBadCertificate: + return "BadCertificate" + case TLSErrorNotTLS: + return "NotTLS" + case TLSErrorHandshake: + return "Handshake" + case TLSErrorCertificateRequired: + return "CertificateRequired" + case TLSErrorEOF: + return "EOF" + case TLSErrorInappropriateFallback: + return "InappropriateFallback" + case TLSErrorBadCertificatePassword: + return "BadCertificatePassword" + default: + return fmt.Sprintf("TLSError(%d)", t) + } +} + +// TLSErrorQuark gets the TLS error quark. +// +// The function returns the following values: +// +// - quark: #GQuark. +func TLSErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.g_tls_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// TLSInteractionResult is returned by various functions in Interaction when +// finishing an interaction request. +type TLSInteractionResult C.gint + +const ( + // TLSInteractionUnhandled: interaction was unhandled (i.e. not + // implemented). + TLSInteractionUnhandled TLSInteractionResult = iota + // TLSInteractionHandled: interaction completed, and resulting data is + // available. + TLSInteractionHandled + // TLSInteractionFailed: interaction has failed, or was cancelled. and the + // operation should be aborted. + TLSInteractionFailed +) + +func marshalTLSInteractionResult(p uintptr) (interface{}, error) { + return TLSInteractionResult(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TLSInteractionResult. +func (t TLSInteractionResult) String() string { + switch t { + case TLSInteractionUnhandled: + return "Unhandled" + case TLSInteractionHandled: + return "Handled" + case TLSInteractionFailed: + return "Failed" + default: + return fmt.Sprintf("TLSInteractionResult(%d)", t) + } +} + +// TLSProtocolVersion: TLS or DTLS protocol version used by a Connection or +// Connection. The integer values of these versions are sequential to ensure +// newer known protocol versions compare greater than older known versions. Any +// known DTLS protocol version will compare greater than any SSL or TLS protocol +// version. The protocol version may be G_TLS_PROTOCOL_VERSION_UNKNOWN if the +// TLS backend supports a newer protocol version that GLib does not yet know +// about. This means that it's possible for an unknown DTLS protocol version to +// compare less than the TLS protocol versions. +type TLSProtocolVersion C.gint + +const ( + // TLSProtocolVersionUnknown: no protocol version or unknown protocol + // version. + TLSProtocolVersionUnknown TLSProtocolVersion = 0 + // TLSProtocolVersionSSL30: SSL 3.0, which is insecure and should not be + // used. + TLSProtocolVersionSSL30 TLSProtocolVersion = 1 + // TLSProtocolVersionTLS10: TLS 1.0, which is insecure and should not be + // used. + TLSProtocolVersionTLS10 TLSProtocolVersion = 2 + // TLSProtocolVersionTLS11: TLS 1.1, which is insecure and should not be + // used. + TLSProtocolVersionTLS11 TLSProtocolVersion = 3 + // TLSProtocolVersionTLS12: TLS 1.2, defined by RFC 5246 + // (https://datatracker.ietf.org/doc/html/rfc5246). + TLSProtocolVersionTLS12 TLSProtocolVersion = 4 + // TLSProtocolVersionTLS13: TLS 1.3, defined by RFC 8446 + // (https://datatracker.ietf.org/doc/html/rfc8446). + TLSProtocolVersionTLS13 TLSProtocolVersion = 5 + // TLSProtocolVersionDTLS10: DTLS 1.0, which is insecure and should not be + // used. + TLSProtocolVersionDTLS10 TLSProtocolVersion = 201 + // TLSProtocolVersionDTLS12: DTLS 1.2, defined by RFC 6347 + // (https://datatracker.ietf.org/doc/html/rfc6347). + TLSProtocolVersionDTLS12 TLSProtocolVersion = 202 +) + +func marshalTLSProtocolVersion(p uintptr) (interface{}, error) { + return TLSProtocolVersion(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TLSProtocolVersion. +func (t TLSProtocolVersion) String() string { + switch t { + case TLSProtocolVersionUnknown: + return "Unknown" + case TLSProtocolVersionSSL30: + return "SSL30" + case TLSProtocolVersionTLS10: + return "TLS10" + case TLSProtocolVersionTLS11: + return "TLS11" + case TLSProtocolVersionTLS12: + return "TLS12" + case TLSProtocolVersionTLS13: + return "TLS13" + case TLSProtocolVersionDTLS10: + return "DTLS10" + case TLSProtocolVersionDTLS12: + return "DTLS12" + default: + return fmt.Sprintf("TLSProtocolVersion(%d)", t) + } +} + +// TLSRehandshakeMode: when to allow rehandshaking. See +// g_tls_connection_set_rehandshake_mode(). +// +// Deprecated: Changing the rehandshake mode is no longer required for +// compatibility. Also, rehandshaking has been removed from the TLS protocol in +// TLS 1.3. +type TLSRehandshakeMode C.gint + +const ( + // TLSRehandshakeNever: never allow rehandshaking. + TLSRehandshakeNever TLSRehandshakeMode = iota + // TLSRehandshakeSafely: allow safe rehandshaking only. + TLSRehandshakeSafely + // TLSRehandshakeUnsafely: allow unsafe rehandshaking. + TLSRehandshakeUnsafely +) + +func marshalTLSRehandshakeMode(p uintptr) (interface{}, error) { + return TLSRehandshakeMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TLSRehandshakeMode. +func (t TLSRehandshakeMode) String() string { + switch t { + case TLSRehandshakeNever: + return "Never" + case TLSRehandshakeSafely: + return "Safely" + case TLSRehandshakeUnsafely: + return "Unsafely" + default: + return fmt.Sprintf("TLSRehandshakeMode(%d)", t) + } +} + +// ZlibCompressorFormat: used to select the type of data format to use for +// Decompressor and Compressor. +type ZlibCompressorFormat C.gint + +const ( + // ZlibCompressorFormatZlib: deflate compression with zlib header. + ZlibCompressorFormatZlib ZlibCompressorFormat = iota + // ZlibCompressorFormatGzip: gzip file format. + ZlibCompressorFormatGzip + // ZlibCompressorFormatRaw: deflate compression with no header. + ZlibCompressorFormatRaw +) + +func marshalZlibCompressorFormat(p uintptr) (interface{}, error) { + return ZlibCompressorFormat(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ZlibCompressorFormat. +func (z ZlibCompressorFormat) String() string { + switch z { + case ZlibCompressorFormatZlib: + return "Zlib" + case ZlibCompressorFormatGzip: + return "Gzip" + case ZlibCompressorFormatRaw: + return "Raw" + default: + return fmt.Sprintf("ZlibCompressorFormat(%d)", z) + } +} + +// AppInfoCreateFlags flags used when creating a Info. +type AppInfoCreateFlags C.guint + +const ( + // AppInfoCreateNone: no flags. + AppInfoCreateNone AppInfoCreateFlags = 0b0 + // AppInfoCreateNeedsTerminal: application opens in a terminal window. + AppInfoCreateNeedsTerminal AppInfoCreateFlags = 0b1 + // AppInfoCreateSupportsURIs: application supports URI arguments. + AppInfoCreateSupportsURIs AppInfoCreateFlags = 0b10 + // AppInfoCreateSupportsStartupNotification: application supports startup + // notification. Since 2.26. + AppInfoCreateSupportsStartupNotification AppInfoCreateFlags = 0b100 +) + +func marshalAppInfoCreateFlags(p uintptr) (interface{}, error) { + return AppInfoCreateFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for AppInfoCreateFlags. +func (a AppInfoCreateFlags) String() string { + if a == 0 { + return "AppInfoCreateFlags(0)" + } + + var builder strings.Builder + builder.Grow(111) + + for a != 0 { + next := a & (a - 1) + bit := a - next + + switch bit { + case AppInfoCreateNone: + builder.WriteString("None|") + case AppInfoCreateNeedsTerminal: + builder.WriteString("NeedsTerminal|") + case AppInfoCreateSupportsURIs: + builder.WriteString("SupportsURIs|") + case AppInfoCreateSupportsStartupNotification: + builder.WriteString("SupportsStartupNotification|") + default: + builder.WriteString(fmt.Sprintf("AppInfoCreateFlags(0b%b)|", bit)) + } + + a = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if a contains other. +func (a AppInfoCreateFlags) Has(other AppInfoCreateFlags) bool { + return (a & other) == other +} + +// ApplicationFlags flags used to define the behaviour of a #GApplication. +type ApplicationFlags C.guint + +const ( + // ApplicationFlagsNone: default. Deprecated in 2.74, use + // G_APPLICATION_DEFAULT_FLAGS instead. + ApplicationFlagsNone ApplicationFlags = 0b0 + // ApplicationDefaultFlags: default flags. Since: 2.74. + ApplicationDefaultFlags ApplicationFlags = 0b0 + // ApplicationIsService: run as a service. In this mode, registration fails + // if the service is already running, and the application will initially + // wait up to 10 seconds for an initial activation message to arrive. + ApplicationIsService ApplicationFlags = 0b1 + // ApplicationIsLauncher: don't try to become the primary instance. + ApplicationIsLauncher ApplicationFlags = 0b10 + // ApplicationHandlesOpen: this application handles opening files + // (in the primary instance). Note that this flag only affects the + // default implementation of local_command_line(), and has no effect if + // G_APPLICATION_HANDLES_COMMAND_LINE is given. See g_application_run() for + // details. + ApplicationHandlesOpen ApplicationFlags = 0b100 + // ApplicationHandlesCommandLine: this application handles command line + // arguments (in the primary instance). Note that this flag only affect the + // default implementation of local_command_line(). See g_application_run() + // for details. + ApplicationHandlesCommandLine ApplicationFlags = 0b1000 + // ApplicationSendEnvironment: send the environment of the launching process + // to the primary instance. Set this flag if your application is expected + // to behave differently depending on certain environment variables. + // For instance, an editor might be expected to use the GIT_COMMITTER_NAME + // environment variable when editing a git commit message. The environment + // is available to the #GApplication::command-line signal handler, + // via g_application_command_line_getenv(). + ApplicationSendEnvironment ApplicationFlags = 0b10000 + // ApplicationNonUnique: make no attempts to do any of the typical + // single-instance application negotiation, even if the application ID + // is given. The application neither attempts to become the owner of the + // application ID nor does it check if an existing owner already exists. + // Everything occurs in the local process. Since: 2.30. + ApplicationNonUnique ApplicationFlags = 0b100000 + // ApplicationCanOverrideAppID: allow users to override the application ID + // from the command line with --gapplication-app-id. Since: 2.48. + ApplicationCanOverrideAppID ApplicationFlags = 0b1000000 + // ApplicationAllowReplacement: allow another instance to take over the bus + // name. Since: 2.60. + ApplicationAllowReplacement ApplicationFlags = 0b10000000 + // ApplicationReplace: take over from another instance. This flag is usually + // set by passing --gapplication-replace on the commandline. Since: 2.60. + ApplicationReplace ApplicationFlags = 0b100000000 +) + +func marshalApplicationFlags(p uintptr) (interface{}, error) { + return ApplicationFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ApplicationFlags. +func (a ApplicationFlags) String() string { + if a == 0 { + return "ApplicationFlags(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for a != 0 { + next := a & (a - 1) + bit := a - next + + switch bit { + case ApplicationFlagsNone: + builder.WriteString("FlagsNone|") + case ApplicationIsService: + builder.WriteString("IsService|") + case ApplicationIsLauncher: + builder.WriteString("IsLauncher|") + case ApplicationHandlesOpen: + builder.WriteString("HandlesOpen|") + case ApplicationHandlesCommandLine: + builder.WriteString("HandlesCommandLine|") + case ApplicationSendEnvironment: + builder.WriteString("SendEnvironment|") + case ApplicationNonUnique: + builder.WriteString("NonUnique|") + case ApplicationCanOverrideAppID: + builder.WriteString("CanOverrideAppID|") + case ApplicationAllowReplacement: + builder.WriteString("AllowReplacement|") + case ApplicationReplace: + builder.WriteString("Replace|") + default: + builder.WriteString(fmt.Sprintf("ApplicationFlags(0b%b)|", bit)) + } + + a = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if a contains other. +func (a ApplicationFlags) Has(other ApplicationFlags) bool { + return (a & other) == other +} + +// AskPasswordFlags are used to request specific information from the user, +// or to notify the user of their choices in an authentication situation. +type AskPasswordFlags C.guint + +const ( + // AskPasswordNeedPassword: operation requires a password. + AskPasswordNeedPassword AskPasswordFlags = 0b1 + // AskPasswordNeedUsername: operation requires a username. + AskPasswordNeedUsername AskPasswordFlags = 0b10 + // AskPasswordNeedDomain: operation requires a domain. + AskPasswordNeedDomain AskPasswordFlags = 0b100 + // AskPasswordSavingSupported: operation supports saving settings. + AskPasswordSavingSupported AskPasswordFlags = 0b1000 + // AskPasswordAnonymousSupported: operation supports anonymous users. + AskPasswordAnonymousSupported AskPasswordFlags = 0b10000 + // AskPasswordTcrypt: operation takes TCRYPT parameters (Since: 2.58). + AskPasswordTcrypt AskPasswordFlags = 0b100000 +) + +func marshalAskPasswordFlags(p uintptr) (interface{}, error) { + return AskPasswordFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for AskPasswordFlags. +func (a AskPasswordFlags) String() string { + if a == 0 { + return "AskPasswordFlags(0)" + } + + var builder strings.Builder + builder.Grow(144) + + for a != 0 { + next := a & (a - 1) + bit := a - next + + switch bit { + case AskPasswordNeedPassword: + builder.WriteString("NeedPassword|") + case AskPasswordNeedUsername: + builder.WriteString("NeedUsername|") + case AskPasswordNeedDomain: + builder.WriteString("NeedDomain|") + case AskPasswordSavingSupported: + builder.WriteString("SavingSupported|") + case AskPasswordAnonymousSupported: + builder.WriteString("AnonymousSupported|") + case AskPasswordTcrypt: + builder.WriteString("Tcrypt|") + default: + builder.WriteString(fmt.Sprintf("AskPasswordFlags(0b%b)|", bit)) + } + + a = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if a contains other. +func (a AskPasswordFlags) Has(other AskPasswordFlags) bool { + return (a & other) == other +} + +// BusNameOwnerFlags flags used in g_bus_own_name(). +type BusNameOwnerFlags C.guint + +const ( + // BusNameOwnerFlagsNone: no flags set. + BusNameOwnerFlagsNone BusNameOwnerFlags = 0b0 + // BusNameOwnerFlagsAllowReplacement: allow another message bus connection + // to claim the name. + BusNameOwnerFlagsAllowReplacement BusNameOwnerFlags = 0b1 + // BusNameOwnerFlagsReplace: if another message bus connection owns the name + // and have specified G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take + // the name from the other connection. + BusNameOwnerFlagsReplace BusNameOwnerFlags = 0b10 + // BusNameOwnerFlagsDoNotQueue: if another message bus connection owns + // the name, immediately return an error from g_bus_own_name() rather than + // entering the waiting queue for that name. (Since 2.54). + BusNameOwnerFlagsDoNotQueue BusNameOwnerFlags = 0b100 +) + +func marshalBusNameOwnerFlags(p uintptr) (interface{}, error) { + return BusNameOwnerFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for BusNameOwnerFlags. +func (b BusNameOwnerFlags) String() string { + if b == 0 { + return "BusNameOwnerFlags(0)" + } + + var builder strings.Builder + builder.Grow(108) + + for b != 0 { + next := b & (b - 1) + bit := b - next + + switch bit { + case BusNameOwnerFlagsNone: + builder.WriteString("None|") + case BusNameOwnerFlagsAllowReplacement: + builder.WriteString("AllowReplacement|") + case BusNameOwnerFlagsReplace: + builder.WriteString("Replace|") + case BusNameOwnerFlagsDoNotQueue: + builder.WriteString("DoNotQueue|") + default: + builder.WriteString(fmt.Sprintf("BusNameOwnerFlags(0b%b)|", bit)) + } + + b = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if b contains other. +func (b BusNameOwnerFlags) Has(other BusNameOwnerFlags) bool { + return (b & other) == other +} + +// BusNameWatcherFlags flags used in g_bus_watch_name(). +type BusNameWatcherFlags C.guint + +const ( + // BusNameWatcherFlagsNone: no flags set. + BusNameWatcherFlagsNone BusNameWatcherFlags = 0b0 + // BusNameWatcherFlagsAutoStart: if no-one owns the name when beginning to + // watch the name, ask the bus to launch an owner for the name. + BusNameWatcherFlagsAutoStart BusNameWatcherFlags = 0b1 +) + +func marshalBusNameWatcherFlags(p uintptr) (interface{}, error) { + return BusNameWatcherFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for BusNameWatcherFlags. +func (b BusNameWatcherFlags) String() string { + if b == 0 { + return "BusNameWatcherFlags(0)" + } + + var builder strings.Builder + builder.Grow(52) + + for b != 0 { + next := b & (b - 1) + bit := b - next + + switch bit { + case BusNameWatcherFlagsNone: + builder.WriteString("None|") + case BusNameWatcherFlagsAutoStart: + builder.WriteString("AutoStart|") + default: + builder.WriteString(fmt.Sprintf("BusNameWatcherFlags(0b%b)|", bit)) + } + + b = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if b contains other. +func (b BusNameWatcherFlags) Has(other BusNameWatcherFlags) bool { + return (b & other) == other +} + +// ConverterFlags flags used when calling a g_converter_convert(). +type ConverterFlags C.guint + +const ( + // ConverterNoFlags: no flags. + ConverterNoFlags ConverterFlags = 0b0 + // ConverterInputAtEnd: at end of input data. + ConverterInputAtEnd ConverterFlags = 0b1 + // ConverterFlush: flush data. + ConverterFlush ConverterFlags = 0b10 +) + +func marshalConverterFlags(p uintptr) (interface{}, error) { + return ConverterFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ConverterFlags. +func (c ConverterFlags) String() string { + if c == 0 { + return "ConverterFlags(0)" + } + + var builder strings.Builder + builder.Grow(51) + + for c != 0 { + next := c & (c - 1) + bit := c - next + + switch bit { + case ConverterNoFlags: + builder.WriteString("None|") + case ConverterInputAtEnd: + builder.WriteString("InputAtEnd|") + case ConverterFlush: + builder.WriteString("Flush|") + default: + builder.WriteString(fmt.Sprintf("ConverterFlags(0b%b)|", bit)) + } + + c = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if c contains other. +func (c ConverterFlags) Has(other ConverterFlags) bool { + return (c & other) == other +} + +// DBusCallFlags flags used in g_dbus_connection_call() and similar APIs. +type DBusCallFlags C.guint + +const ( + // DBusCallFlagsNone: no flags set. + DBusCallFlagsNone DBusCallFlags = 0b0 + // DBusCallFlagsNoAutoStart bus must not launch an owner for the destination + // name in response to this method invocation. + DBusCallFlagsNoAutoStart DBusCallFlags = 0b1 + // DBusCallFlagsAllowInteractiveAuthorization: caller is prepared to wait + // for interactive authorization. Since 2.46. + DBusCallFlagsAllowInteractiveAuthorization DBusCallFlags = 0b10 +) + +func marshalDBusCallFlags(p uintptr) (interface{}, error) { + return DBusCallFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusCallFlags. +func (d DBusCallFlags) String() string { + if d == 0 { + return "DBusCallFlags(0)" + } + + var builder strings.Builder + builder.Grow(85) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusCallFlagsNone: + builder.WriteString("None|") + case DBusCallFlagsNoAutoStart: + builder.WriteString("NoAutoStart|") + case DBusCallFlagsAllowInteractiveAuthorization: + builder.WriteString("AllowInteractiveAuthorization|") + default: + builder.WriteString(fmt.Sprintf("DBusCallFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusCallFlags) Has(other DBusCallFlags) bool { + return (d & other) == other +} + +// DBusCapabilityFlags capabilities negotiated with the remote peer. +type DBusCapabilityFlags C.guint + +const ( + // DBusCapabilityFlagsNone: no flags set. + DBusCapabilityFlagsNone DBusCapabilityFlags = 0b0 + // DBusCapabilityFlagsUnixFdPassing connection supports exchanging UNIX file + // descriptors with the remote peer. + DBusCapabilityFlagsUnixFdPassing DBusCapabilityFlags = 0b1 +) + +func marshalDBusCapabilityFlags(p uintptr) (interface{}, error) { + return DBusCapabilityFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusCapabilityFlags. +func (d DBusCapabilityFlags) String() string { + if d == 0 { + return "DBusCapabilityFlags(0)" + } + + var builder strings.Builder + builder.Grow(56) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusCapabilityFlagsNone: + builder.WriteString("None|") + case DBusCapabilityFlagsUnixFdPassing: + builder.WriteString("UnixFdPassing|") + default: + builder.WriteString(fmt.Sprintf("DBusCapabilityFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusCapabilityFlags) Has(other DBusCapabilityFlags) bool { + return (d & other) == other +} + +// DBusConnectionFlags flags used when creating a new BusConnection. +type DBusConnectionFlags C.guint + +const ( + // DBusConnectionFlagsNone: no flags set. + DBusConnectionFlagsNone DBusConnectionFlags = 0b0 + // DBusConnectionFlagsAuthenticationClient: perform authentication against + // server. + DBusConnectionFlagsAuthenticationClient DBusConnectionFlags = 0b1 + // DBusConnectionFlagsAuthenticationServer: perform authentication against + // client. + DBusConnectionFlagsAuthenticationServer DBusConnectionFlags = 0b10 + // DBusConnectionFlagsAuthenticationAllowAnonymous: when authenticating as a + // server, allow the anonymous authentication method. + DBusConnectionFlagsAuthenticationAllowAnonymous DBusConnectionFlags = 0b100 + // DBusConnectionFlagsMessageBusConnection pass this flag if connecting to + // a peer that is a message bus. This means that the Hello() method will be + // invoked as part of the connection setup. + DBusConnectionFlagsMessageBusConnection DBusConnectionFlags = 0b1000 + // DBusConnectionFlagsDelayMessageProcessing: if set, processing of D-Bus + // messages is delayed until g_dbus_connection_start_message_processing() is + // called. + DBusConnectionFlagsDelayMessageProcessing DBusConnectionFlags = 0b10000 + // DBusConnectionFlagsAuthenticationRequireSameUser: when authenticating as + // a server, require the UID of the peer to be the same as the UID of the + // server. (Since: 2.68). + DBusConnectionFlagsAuthenticationRequireSameUser DBusConnectionFlags = 0b100000 + // DBusConnectionFlagsCrossNamespace: when authenticating, try to use + // protocols that work across a Linux user namespace boundary, even if this + // reduces interoperability with older D-Bus implementations. This currently + // affects client-side EXTERNAL authentication, for which this flag makes + // connections to a server in another user namespace succeed, but causes + // a deadlock when connecting to a GDBus server older than 2.73.3. Since: + // 2.74. + DBusConnectionFlagsCrossNamespace DBusConnectionFlags = 0b1000000 +) + +func marshalDBusConnectionFlags(p uintptr) (interface{}, error) { + return DBusConnectionFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusConnectionFlags. +func (d DBusConnectionFlags) String() string { + if d == 0 { + return "DBusConnectionFlags(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusConnectionFlagsNone: + builder.WriteString("None|") + case DBusConnectionFlagsAuthenticationClient: + builder.WriteString("AuthenticationClient|") + case DBusConnectionFlagsAuthenticationServer: + builder.WriteString("AuthenticationServer|") + case DBusConnectionFlagsAuthenticationAllowAnonymous: + builder.WriteString("AuthenticationAllowAnonymous|") + case DBusConnectionFlagsMessageBusConnection: + builder.WriteString("MessageBusConnection|") + case DBusConnectionFlagsDelayMessageProcessing: + builder.WriteString("DelayMessageProcessing|") + case DBusConnectionFlagsAuthenticationRequireSameUser: + builder.WriteString("AuthenticationRequireSameUser|") + case DBusConnectionFlagsCrossNamespace: + builder.WriteString("CrossNamespace|") + default: + builder.WriteString(fmt.Sprintf("DBusConnectionFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusConnectionFlags) Has(other DBusConnectionFlags) bool { + return (d & other) == other +} + +// DBusInterfaceSkeletonFlags flags describing the behavior of a +// BusInterfaceSkeleton instance. +type DBusInterfaceSkeletonFlags C.guint + +const ( + // DBusInterfaceSkeletonFlagsNone: no flags set. + DBusInterfaceSkeletonFlagsNone DBusInterfaceSkeletonFlags = 0b0 + // DBusInterfaceSkeletonFlagsHandleMethodInvocationsInThread: each method + // invocation is handled in a thread dedicated to the invocation. This means + // that the method implementation can use blocking IO without blocking any + // other part of the process. It also means that the method implementation + // must use locking to access data structures used by other threads. + DBusInterfaceSkeletonFlagsHandleMethodInvocationsInThread DBusInterfaceSkeletonFlags = 0b1 +) + +func marshalDBusInterfaceSkeletonFlags(p uintptr) (interface{}, error) { + return DBusInterfaceSkeletonFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusInterfaceSkeletonFlags. +func (d DBusInterfaceSkeletonFlags) String() string { + if d == 0 { + return "DBusInterfaceSkeletonFlags(0)" + } + + var builder strings.Builder + builder.Grow(88) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusInterfaceSkeletonFlagsNone: + builder.WriteString("None|") + case DBusInterfaceSkeletonFlagsHandleMethodInvocationsInThread: + builder.WriteString("HandleMethodInvocationsInThread|") + default: + builder.WriteString(fmt.Sprintf("DBusInterfaceSkeletonFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusInterfaceSkeletonFlags) Has(other DBusInterfaceSkeletonFlags) bool { + return (d & other) == other +} + +// DBusMessageFlags: message flags used in BusMessage. +type DBusMessageFlags C.guint + +const ( + // DBusMessageFlagsNone: no flags set. + DBusMessageFlagsNone DBusMessageFlags = 0b0 + // DBusMessageFlagsNoReplyExpected: reply is not expected. + DBusMessageFlagsNoReplyExpected DBusMessageFlags = 0b1 + // DBusMessageFlagsNoAutoStart bus must not launch an owner for the + // destination name in response to this message. + DBusMessageFlagsNoAutoStart DBusMessageFlags = 0b10 + // DBusMessageFlagsAllowInteractiveAuthorization: if set on a method call, + // this flag means that the caller is prepared to wait for interactive + // authorization. Since 2.46. + DBusMessageFlagsAllowInteractiveAuthorization DBusMessageFlags = 0b100 +) + +func marshalDBusMessageFlags(p uintptr) (interface{}, error) { + return DBusMessageFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusMessageFlags. +func (d DBusMessageFlags) String() string { + if d == 0 { + return "DBusMessageFlags(0)" + } + + var builder strings.Builder + builder.Grow(126) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusMessageFlagsNone: + builder.WriteString("None|") + case DBusMessageFlagsNoReplyExpected: + builder.WriteString("NoReplyExpected|") + case DBusMessageFlagsNoAutoStart: + builder.WriteString("NoAutoStart|") + case DBusMessageFlagsAllowInteractiveAuthorization: + builder.WriteString("AllowInteractiveAuthorization|") + default: + builder.WriteString(fmt.Sprintf("DBusMessageFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusMessageFlags) Has(other DBusMessageFlags) bool { + return (d & other) == other +} + +// DBusObjectManagerClientFlags flags used when constructing a +// BusObjectManagerClient. +type DBusObjectManagerClientFlags C.guint + +const ( + // DBusObjectManagerClientFlagsNone: no flags set. + DBusObjectManagerClientFlagsNone DBusObjectManagerClientFlags = 0b0 + // DBusObjectManagerClientFlagsDoNotAutoStart: if not set and the manager + // is for a well-known name, then request the bus to launch an owner for the + // name if no-one owns the name. This flag can only be used in managers for + // well-known names. + DBusObjectManagerClientFlagsDoNotAutoStart DBusObjectManagerClientFlags = 0b1 +) + +func marshalDBusObjectManagerClientFlags(p uintptr) (interface{}, error) { + return DBusObjectManagerClientFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusObjectManagerClientFlags. +func (d DBusObjectManagerClientFlags) String() string { + if d == 0 { + return "DBusObjectManagerClientFlags(0)" + } + + var builder strings.Builder + builder.Grow(75) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusObjectManagerClientFlagsNone: + builder.WriteString("None|") + case DBusObjectManagerClientFlagsDoNotAutoStart: + builder.WriteString("DoNotAutoStart|") + default: + builder.WriteString(fmt.Sprintf("DBusObjectManagerClientFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusObjectManagerClientFlags) Has(other DBusObjectManagerClientFlags) bool { + return (d & other) == other +} + +// DBusPropertyInfoFlags flags describing the access control of a D-Bus +// property. +type DBusPropertyInfoFlags C.guint + +const ( + // DBusPropertyInfoFlagsNone: no flags set. + DBusPropertyInfoFlagsNone DBusPropertyInfoFlags = 0b0 + // DBusPropertyInfoFlagsReadable: property is readable. + DBusPropertyInfoFlagsReadable DBusPropertyInfoFlags = 0b1 + // DBusPropertyInfoFlagsWritable: property is writable. + DBusPropertyInfoFlagsWritable DBusPropertyInfoFlags = 0b10 +) + +func marshalDBusPropertyInfoFlags(p uintptr) (interface{}, error) { + return DBusPropertyInfoFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusPropertyInfoFlags. +func (d DBusPropertyInfoFlags) String() string { + if d == 0 { + return "DBusPropertyInfoFlags(0)" + } + + var builder strings.Builder + builder.Grow(85) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusPropertyInfoFlagsNone: + builder.WriteString("None|") + case DBusPropertyInfoFlagsReadable: + builder.WriteString("Readable|") + case DBusPropertyInfoFlagsWritable: + builder.WriteString("Writable|") + default: + builder.WriteString(fmt.Sprintf("DBusPropertyInfoFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusPropertyInfoFlags) Has(other DBusPropertyInfoFlags) bool { + return (d & other) == other +} + +// DBusProxyFlags flags used when constructing an instance of a BusProxy derived +// class. +type DBusProxyFlags C.guint + +const ( + // DBusProxyFlagsNone: no flags set. + DBusProxyFlagsNone DBusProxyFlags = 0b0 + // DBusProxyFlagsDoNotLoadProperties: don't load properties. + DBusProxyFlagsDoNotLoadProperties DBusProxyFlags = 0b1 + // DBusProxyFlagsDoNotConnectSignals: don't connect to signals on the remote + // object. + DBusProxyFlagsDoNotConnectSignals DBusProxyFlags = 0b10 + // DBusProxyFlagsDoNotAutoStart: if the proxy is for a well-known name, + // do not ask the bus to launch an owner during proxy initialization or + // a method call. This flag is only meaningful in proxies for well-known + // names. + DBusProxyFlagsDoNotAutoStart DBusProxyFlags = 0b100 + // DBusProxyFlagsGetInvalidatedProperties: if set, + // the property value for any __invalidated property__ will be + // (asynchronously) retrieved upon receiving the PropertiesChanged + // (http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties) + // D-Bus signal and the property will not cause emission of the + // BusProxy::g-properties-changed signal. When the value is received the + // BusProxy::g-properties-changed signal is emitted for the property along + // with the retrieved value. Since 2.32. + DBusProxyFlagsGetInvalidatedProperties DBusProxyFlags = 0b1000 + // DBusProxyFlagsDoNotAutoStartAtConstruction: if the proxy is for a + // well-known name, do not ask the bus to launch an owner during proxy + // initialization, but allow it to be autostarted by a method call. + // This flag is only meaningful in proxies for well-known names, and only if + // G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is not also specified. + DBusProxyFlagsDoNotAutoStartAtConstruction DBusProxyFlags = 0b10000 + // DBusProxyFlagsNoMatchRule: don't actually send the AddMatch D-Bus call + // for this signal subscription. This gives you more control over which + // match rules you add (but you must add them manually). (Since: 2.72). + DBusProxyFlagsNoMatchRule DBusProxyFlags = 0b100000 +) + +func marshalDBusProxyFlags(p uintptr) (interface{}, error) { + return DBusProxyFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusProxyFlags. +func (d DBusProxyFlags) String() string { + if d == 0 { + return "DBusProxyFlags(0)" + } + + var builder strings.Builder + builder.Grow(223) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusProxyFlagsNone: + builder.WriteString("None|") + case DBusProxyFlagsDoNotLoadProperties: + builder.WriteString("DoNotLoadProperties|") + case DBusProxyFlagsDoNotConnectSignals: + builder.WriteString("DoNotConnectSignals|") + case DBusProxyFlagsDoNotAutoStart: + builder.WriteString("DoNotAutoStart|") + case DBusProxyFlagsGetInvalidatedProperties: + builder.WriteString("GetInvalidatedProperties|") + case DBusProxyFlagsDoNotAutoStartAtConstruction: + builder.WriteString("DoNotAutoStartAtConstruction|") + case DBusProxyFlagsNoMatchRule: + builder.WriteString("NoMatchRule|") + default: + builder.WriteString(fmt.Sprintf("DBusProxyFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusProxyFlags) Has(other DBusProxyFlags) bool { + return (d & other) == other +} + +// DBusSendMessageFlags flags used when sending BusMessages on a BusConnection. +type DBusSendMessageFlags C.guint + +const ( + // DBusSendMessageFlagsNone: no flags set. + DBusSendMessageFlagsNone DBusSendMessageFlags = 0b0 + // DBusSendMessageFlagsPreserveSerial: do not automatically assign a serial + // number from the BusConnection object when sending a message. + DBusSendMessageFlagsPreserveSerial DBusSendMessageFlags = 0b1 +) + +func marshalDBusSendMessageFlags(p uintptr) (interface{}, error) { + return DBusSendMessageFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusSendMessageFlags. +func (d DBusSendMessageFlags) String() string { + if d == 0 { + return "DBusSendMessageFlags(0)" + } + + var builder strings.Builder + builder.Grow(59) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusSendMessageFlagsNone: + builder.WriteString("None|") + case DBusSendMessageFlagsPreserveSerial: + builder.WriteString("PreserveSerial|") + default: + builder.WriteString(fmt.Sprintf("DBusSendMessageFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusSendMessageFlags) Has(other DBusSendMessageFlags) bool { + return (d & other) == other +} + +// DBusServerFlags flags used when creating a BusServer. +type DBusServerFlags C.guint + +const ( + // DBusServerFlagsNone: no flags set. + DBusServerFlagsNone DBusServerFlags = 0b0 + // DBusServerFlagsRunInThread: all BusServer::new-connection signals will + // run in separated dedicated threads (see signal for details). + DBusServerFlagsRunInThread DBusServerFlags = 0b1 + // DBusServerFlagsAuthenticationAllowAnonymous: allow the anonymous + // authentication method. + DBusServerFlagsAuthenticationAllowAnonymous DBusServerFlags = 0b10 + // DBusServerFlagsAuthenticationRequireSameUser: require the UID of the + // peer to be the same as the UID of the server when authenticating. (Since: + // 2.68). + DBusServerFlagsAuthenticationRequireSameUser DBusServerFlags = 0b100 +) + +func marshalDBusServerFlags(p uintptr) (interface{}, error) { + return DBusServerFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusServerFlags. +func (d DBusServerFlags) String() string { + if d == 0 { + return "DBusServerFlags(0)" + } + + var builder strings.Builder + builder.Grow(135) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusServerFlagsNone: + builder.WriteString("None|") + case DBusServerFlagsRunInThread: + builder.WriteString("RunInThread|") + case DBusServerFlagsAuthenticationAllowAnonymous: + builder.WriteString("AuthenticationAllowAnonymous|") + case DBusServerFlagsAuthenticationRequireSameUser: + builder.WriteString("AuthenticationRequireSameUser|") + default: + builder.WriteString(fmt.Sprintf("DBusServerFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusServerFlags) Has(other DBusServerFlags) bool { + return (d & other) == other +} + +// DBusSignalFlags flags used when subscribing to signals via +// g_dbus_connection_signal_subscribe(). +type DBusSignalFlags C.guint + +const ( + // DBusSignalFlagsNone: no flags set. + DBusSignalFlagsNone DBusSignalFlags = 0b0 + // DBusSignalFlagsNoMatchRule: don't actually send the AddMatch D-Bus call + // for this signal subscription. This gives you more control over which + // match rules you add (but you must add them manually). + DBusSignalFlagsNoMatchRule DBusSignalFlags = 0b1 + // DBusSignalFlagsMatchArg0Namespace: match first arguments that contain a + // bus or interface name with the given namespace. + DBusSignalFlagsMatchArg0Namespace DBusSignalFlags = 0b10 + // DBusSignalFlagsMatchArg0Path: match first arguments that contain an + // object path that is either equivalent to the given path, or one of the + // paths is a subpath of the other. + DBusSignalFlagsMatchArg0Path DBusSignalFlags = 0b100 +) + +func marshalDBusSignalFlags(p uintptr) (interface{}, error) { + return DBusSignalFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusSignalFlags. +func (d DBusSignalFlags) String() string { + if d == 0 { + return "DBusSignalFlags(0)" + } + + var builder strings.Builder + builder.Grow(109) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusSignalFlagsNone: + builder.WriteString("None|") + case DBusSignalFlagsNoMatchRule: + builder.WriteString("NoMatchRule|") + case DBusSignalFlagsMatchArg0Namespace: + builder.WriteString("MatchArg0Namespace|") + case DBusSignalFlagsMatchArg0Path: + builder.WriteString("MatchArg0Path|") + default: + builder.WriteString(fmt.Sprintf("DBusSignalFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusSignalFlags) Has(other DBusSignalFlags) bool { + return (d & other) == other +} + +// DBusSubtreeFlags flags passed to g_dbus_connection_register_subtree(). +type DBusSubtreeFlags C.guint + +const ( + // DBusSubtreeFlagsNone: no flags set. + DBusSubtreeFlagsNone DBusSubtreeFlags = 0b0 + // DBusSubtreeFlagsDispatchToUnenumeratedNodes: method calls to objects not + // in the enumerated range will still be dispatched. This is useful if you + // want to dynamically spawn objects in the subtree. + DBusSubtreeFlagsDispatchToUnenumeratedNodes DBusSubtreeFlags = 0b1 +) + +func marshalDBusSubtreeFlags(p uintptr) (interface{}, error) { + return DBusSubtreeFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DBusSubtreeFlags. +func (d DBusSubtreeFlags) String() string { + if d == 0 { + return "DBusSubtreeFlags(0)" + } + + var builder strings.Builder + builder.Grow(64) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DBusSubtreeFlagsNone: + builder.WriteString("None|") + case DBusSubtreeFlagsDispatchToUnenumeratedNodes: + builder.WriteString("DispatchToUnenumeratedNodes|") + default: + builder.WriteString(fmt.Sprintf("DBusSubtreeFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DBusSubtreeFlags) Has(other DBusSubtreeFlags) bool { + return (d & other) == other +} + +// DriveStartFlags flags used when starting a drive. +type DriveStartFlags C.guint + +const ( + // DriveStartNone: no flags set. + DriveStartNone DriveStartFlags = 0b0 +) + +func marshalDriveStartFlags(p uintptr) (interface{}, error) { + return DriveStartFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DriveStartFlags. +func (d DriveStartFlags) String() string { + if d == 0 { + return "DriveStartFlags(0)" + } + + var builder strings.Builder + builder.Grow(14) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DriveStartNone: + builder.WriteString("None|") + default: + builder.WriteString(fmt.Sprintf("DriveStartFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DriveStartFlags) Has(other DriveStartFlags) bool { + return (d & other) == other +} + +// FileAttributeInfoFlags flags specifying the behaviour of an attribute. +type FileAttributeInfoFlags C.guint + +const ( + // FileAttributeInfoNone: no flags set. + FileAttributeInfoNone FileAttributeInfoFlags = 0b0 + // FileAttributeInfoCopyWithFile: copy the attribute values when the file is + // copied. + FileAttributeInfoCopyWithFile FileAttributeInfoFlags = 0b1 + // FileAttributeInfoCopyWhenMoved: copy the attribute values when the file + // is moved. + FileAttributeInfoCopyWhenMoved FileAttributeInfoFlags = 0b10 +) + +func marshalFileAttributeInfoFlags(p uintptr) (interface{}, error) { + return FileAttributeInfoFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for FileAttributeInfoFlags. +func (f FileAttributeInfoFlags) String() string { + if f == 0 { + return "FileAttributeInfoFlags(0)" + } + + var builder strings.Builder + builder.Grow(82) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FileAttributeInfoNone: + builder.WriteString("None|") + case FileAttributeInfoCopyWithFile: + builder.WriteString("CopyWithFile|") + case FileAttributeInfoCopyWhenMoved: + builder.WriteString("CopyWhenMoved|") + default: + builder.WriteString(fmt.Sprintf("FileAttributeInfoFlags(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FileAttributeInfoFlags) Has(other FileAttributeInfoFlags) bool { + return (f & other) == other +} + +// FileCopyFlags flags used when copying or moving files. +type FileCopyFlags C.guint + +const ( + // FileCopyNone: no flags set. + FileCopyNone FileCopyFlags = 0b0 + // FileCopyOverwrite: overwrite any existing files. + FileCopyOverwrite FileCopyFlags = 0b1 + // FileCopyBackup: make a backup of any existing files. + FileCopyBackup FileCopyFlags = 0b10 + // FileCopyNofollowSymlinks: don't follow symlinks. + FileCopyNofollowSymlinks FileCopyFlags = 0b100 + // FileCopyAllMetadata: copy all file metadata instead of just default set + // used for copy (see Info). + FileCopyAllMetadata FileCopyFlags = 0b1000 + // FileCopyNoFallbackForMove: don't use copy and delete fallback if native + // move not supported. + FileCopyNoFallbackForMove FileCopyFlags = 0b10000 + // FileCopyTargetDefaultPerms leaves target file with default perms, instead + // of setting the source file perms. + FileCopyTargetDefaultPerms FileCopyFlags = 0b100000 + // FileCopyTargetDefaultModifiedTime: use default modification timestamps + // instead of copying them from the source file. Since 2.80. + FileCopyTargetDefaultModifiedTime FileCopyFlags = 0b1000000 +) + +func marshalFileCopyFlags(p uintptr) (interface{}, error) { + return FileCopyFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for FileCopyFlags. +func (f FileCopyFlags) String() string { + if f == 0 { + return "FileCopyFlags(0)" + } + + var builder strings.Builder + builder.Grow(177) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FileCopyNone: + builder.WriteString("None|") + case FileCopyOverwrite: + builder.WriteString("Overwrite|") + case FileCopyBackup: + builder.WriteString("Backup|") + case FileCopyNofollowSymlinks: + builder.WriteString("NofollowSymlinks|") + case FileCopyAllMetadata: + builder.WriteString("AllMetadata|") + case FileCopyNoFallbackForMove: + builder.WriteString("NoFallbackForMove|") + case FileCopyTargetDefaultPerms: + builder.WriteString("TargetDefaultPerms|") + case FileCopyTargetDefaultModifiedTime: + builder.WriteString("TargetDefaultModifiedTime|") + default: + builder.WriteString(fmt.Sprintf("FileCopyFlags(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FileCopyFlags) Has(other FileCopyFlags) bool { + return (f & other) == other +} + +// FileCreateFlags flags used when an operation may create a file. +type FileCreateFlags C.guint + +const ( + // FileCreateNone: no flags set. + FileCreateNone FileCreateFlags = 0b0 + // FileCreatePrivate: create a file that can only be accessed by the current + // user. + FileCreatePrivate FileCreateFlags = 0b1 + // FileCreateReplaceDestination: replace the destination as if it + // didn't exist before. Don't try to keep any old permissions, replace + // instead of following links. This is generally useful if you're doing + // a "copy over" rather than a "save new version of" replace operation. + // You can think of it as "unlink destination" before writing to it, + // although the implementation may not be exactly like that. This flag + // can only be used with g_file_replace() and its variants, including + // g_file_replace_contents(). Since 2.20. + FileCreateReplaceDestination FileCreateFlags = 0b10 +) + +func marshalFileCreateFlags(p uintptr) (interface{}, error) { + return FileCreateFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for FileCreateFlags. +func (f FileCreateFlags) String() string { + if f == 0 { + return "FileCreateFlags(0)" + } + + var builder strings.Builder + builder.Grow(61) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FileCreateNone: + builder.WriteString("None|") + case FileCreatePrivate: + builder.WriteString("Private|") + case FileCreateReplaceDestination: + builder.WriteString("ReplaceDestination|") + default: + builder.WriteString(fmt.Sprintf("FileCreateFlags(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FileCreateFlags) Has(other FileCreateFlags) bool { + return (f & other) == other +} + +// FileMeasureFlags flags that can be used with g_file_measure_disk_usage(). +type FileMeasureFlags C.guint + +const ( + // FileMeasureNone: no flags set. + FileMeasureNone FileMeasureFlags = 0b0 + // FileMeasureReportAnyError: report any error encountered while traversing + // the directory tree. Normally errors are only reported for the toplevel + // file. + FileMeasureReportAnyError FileMeasureFlags = 0b10 + // FileMeasureApparentSize: tally usage based on apparent file sizes. + // Normally, the block-size is used, if available, as this is a + // more accurate representation of disk space used. Compare with du + // --apparent-size. Since GLib 2.78. and similarly to du since GNU Coreutils + // 9.2, this will ignore the sizes of file types other than regular files + // and links, as the sizes of other file types are not specified in a + // standard way. + FileMeasureApparentSize FileMeasureFlags = 0b100 + // FileMeasureNoXdev: do not cross mount point boundaries. Compare with du + // -x. + FileMeasureNoXdev FileMeasureFlags = 0b1000 +) + +func marshalFileMeasureFlags(p uintptr) (interface{}, error) { + return FileMeasureFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for FileMeasureFlags. +func (f FileMeasureFlags) String() string { + if f == 0 { + return "FileMeasureFlags(0)" + } + + var builder strings.Builder + builder.Grow(83) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FileMeasureNone: + builder.WriteString("None|") + case FileMeasureReportAnyError: + builder.WriteString("ReportAnyError|") + case FileMeasureApparentSize: + builder.WriteString("ApparentSize|") + case FileMeasureNoXdev: + builder.WriteString("NoXdev|") + default: + builder.WriteString(fmt.Sprintf("FileMeasureFlags(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FileMeasureFlags) Has(other FileMeasureFlags) bool { + return (f & other) == other +} + +// FileMonitorFlags flags used to set what a Monitor will watch for. +type FileMonitorFlags C.guint + +const ( + // FileMonitorNone: no flags set. + FileMonitorNone FileMonitorFlags = 0b0 + // FileMonitorWatchMounts: watch for mount events. + FileMonitorWatchMounts FileMonitorFlags = 0b1 + // FileMonitorSendMoved: pair DELETED and CREATED events caused by file + // renames (moves) and send a single G_FILE_MONITOR_EVENT_MOVED event + // instead (NB: not supported on all backends; the default behaviour + // -without specifying this flag- is to send single DELETED and CREATED + // events). Deprecated since 2.46: use G_FILE_MONITOR_WATCH_MOVES instead. + FileMonitorSendMoved FileMonitorFlags = 0b10 + // FileMonitorWatchHardLinks: watch for changes to the file made via another + // hard link. Since 2.36. + FileMonitorWatchHardLinks FileMonitorFlags = 0b100 + // FileMonitorWatchMoves: watch for rename operations on a + // monitored directory. This causes G_FILE_MONITOR_EVENT_RENAMED, + // G_FILE_MONITOR_EVENT_MOVED_IN and G_FILE_MONITOR_EVENT_MOVED_OUT events + // to be emitted when possible. Since: 2.46. + FileMonitorWatchMoves FileMonitorFlags = 0b1000 +) + +func marshalFileMonitorFlags(p uintptr) (interface{}, error) { + return FileMonitorFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for FileMonitorFlags. +func (f FileMonitorFlags) String() string { + if f == 0 { + return "FileMonitorFlags(0)" + } + + var builder strings.Builder + builder.Grow(107) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FileMonitorNone: + builder.WriteString("None|") + case FileMonitorWatchMounts: + builder.WriteString("WatchMounts|") + case FileMonitorSendMoved: + builder.WriteString("SendMoved|") + case FileMonitorWatchHardLinks: + builder.WriteString("WatchHardLinks|") + case FileMonitorWatchMoves: + builder.WriteString("WatchMoves|") + default: + builder.WriteString(fmt.Sprintf("FileMonitorFlags(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FileMonitorFlags) Has(other FileMonitorFlags) bool { + return (f & other) == other +} + +// FileQueryInfoFlags flags used when querying a Info. +type FileQueryInfoFlags C.guint + +const ( + // FileQueryInfoNone: no flags set. + FileQueryInfoNone FileQueryInfoFlags = 0b0 + // FileQueryInfoNofollowSymlinks: don't follow symlinks. + FileQueryInfoNofollowSymlinks FileQueryInfoFlags = 0b1 +) + +func marshalFileQueryInfoFlags(p uintptr) (interface{}, error) { + return FileQueryInfoFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for FileQueryInfoFlags. +func (f FileQueryInfoFlags) String() string { + if f == 0 { + return "FileQueryInfoFlags(0)" + } + + var builder strings.Builder + builder.Grow(47) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FileQueryInfoNone: + builder.WriteString("None|") + case FileQueryInfoNofollowSymlinks: + builder.WriteString("NofollowSymlinks|") + default: + builder.WriteString(fmt.Sprintf("FileQueryInfoFlags(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FileQueryInfoFlags) Has(other FileQueryInfoFlags) bool { + return (f & other) == other +} + +// IOStreamSpliceFlags determine how streams should be spliced. +type IOStreamSpliceFlags C.guint + +const ( + // IOStreamSpliceNone: do not close either stream. + IOStreamSpliceNone IOStreamSpliceFlags = 0b0 + // IOStreamSpliceCloseStream1: close the first stream after the splice. + IOStreamSpliceCloseStream1 IOStreamSpliceFlags = 0b1 + // IOStreamSpliceCloseStream2: close the second stream after the splice. + IOStreamSpliceCloseStream2 IOStreamSpliceFlags = 0b10 + // IOStreamSpliceWaitForBoth: wait for both splice operations to finish + // before calling the callback. + IOStreamSpliceWaitForBoth IOStreamSpliceFlags = 0b100 +) + +func marshalIOStreamSpliceFlags(p uintptr) (interface{}, error) { + return IOStreamSpliceFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for IOStreamSpliceFlags. +func (i IOStreamSpliceFlags) String() string { + if i == 0 { + return "IOStreamSpliceFlags(0)" + } + + var builder strings.Builder + builder.Grow(98) + + for i != 0 { + next := i & (i - 1) + bit := i - next + + switch bit { + case IOStreamSpliceNone: + builder.WriteString("None|") + case IOStreamSpliceCloseStream1: + builder.WriteString("CloseStream1|") + case IOStreamSpliceCloseStream2: + builder.WriteString("CloseStream2|") + case IOStreamSpliceWaitForBoth: + builder.WriteString("WaitForBoth|") + default: + builder.WriteString(fmt.Sprintf("IOStreamSpliceFlags(0b%b)|", bit)) + } + + i = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if i contains other. +func (i IOStreamSpliceFlags) Has(other IOStreamSpliceFlags) bool { + return (i & other) == other +} + +// MountMountFlags flags used when mounting a mount. +type MountMountFlags C.guint + +const ( + // MountMountNone: no flags set. + MountMountNone MountMountFlags = 0b0 +) + +func marshalMountMountFlags(p uintptr) (interface{}, error) { + return MountMountFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for MountMountFlags. +func (m MountMountFlags) String() string { + if m == 0 { + return "MountMountFlags(0)" + } + + var builder strings.Builder + builder.Grow(14) + + for m != 0 { + next := m & (m - 1) + bit := m - next + + switch bit { + case MountMountNone: + builder.WriteString("None|") + default: + builder.WriteString(fmt.Sprintf("MountMountFlags(0b%b)|", bit)) + } + + m = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if m contains other. +func (m MountMountFlags) Has(other MountMountFlags) bool { + return (m & other) == other +} + +// MountUnmountFlags flags used when an unmounting a mount. +type MountUnmountFlags C.guint + +const ( + // MountUnmountNone: no flags set. + MountUnmountNone MountUnmountFlags = 0b0 + // MountUnmountForce: unmount even if there are outstanding file operations + // on the mount. + MountUnmountForce MountUnmountFlags = 0b1 +) + +func marshalMountUnmountFlags(p uintptr) (interface{}, error) { + return MountUnmountFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for MountUnmountFlags. +func (m MountUnmountFlags) String() string { + if m == 0 { + return "MountUnmountFlags(0)" + } + + var builder strings.Builder + builder.Grow(34) + + for m != 0 { + next := m & (m - 1) + bit := m - next + + switch bit { + case MountUnmountNone: + builder.WriteString("None|") + case MountUnmountForce: + builder.WriteString("Force|") + default: + builder.WriteString(fmt.Sprintf("MountUnmountFlags(0b%b)|", bit)) + } + + m = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if m contains other. +func (m MountUnmountFlags) Has(other MountUnmountFlags) bool { + return (m & other) == other +} + +// OutputStreamSpliceFlags determine how streams should be spliced. +type OutputStreamSpliceFlags C.guint + +const ( + // OutputStreamSpliceNone: do not close either stream. + OutputStreamSpliceNone OutputStreamSpliceFlags = 0b0 + // OutputStreamSpliceCloseSource: close the source stream after the splice. + OutputStreamSpliceCloseSource OutputStreamSpliceFlags = 0b1 + // OutputStreamSpliceCloseTarget: close the target stream after the splice. + OutputStreamSpliceCloseTarget OutputStreamSpliceFlags = 0b10 +) + +func marshalOutputStreamSpliceFlags(p uintptr) (interface{}, error) { + return OutputStreamSpliceFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for OutputStreamSpliceFlags. +func (o OutputStreamSpliceFlags) String() string { + if o == 0 { + return "OutputStreamSpliceFlags(0)" + } + + var builder strings.Builder + builder.Grow(82) + + for o != 0 { + next := o & (o - 1) + bit := o - next + + switch bit { + case OutputStreamSpliceNone: + builder.WriteString("None|") + case OutputStreamSpliceCloseSource: + builder.WriteString("CloseSource|") + case OutputStreamSpliceCloseTarget: + builder.WriteString("CloseTarget|") + default: + builder.WriteString(fmt.Sprintf("OutputStreamSpliceFlags(0b%b)|", bit)) + } + + o = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if o contains other. +func (o OutputStreamSpliceFlags) Has(other OutputStreamSpliceFlags) bool { + return (o & other) == other +} + +// ResolverNameLookupFlags flags to modify lookup behavior. +type ResolverNameLookupFlags C.guint + +const ( + // ResolverNameLookupFlagsDefault: default behavior (same as + // g_resolver_lookup_by_name()). + ResolverNameLookupFlagsDefault ResolverNameLookupFlags = 0b0 + // ResolverNameLookupFlagsIPv4Only: only resolve ipv4 addresses. + ResolverNameLookupFlagsIPv4Only ResolverNameLookupFlags = 0b1 + // ResolverNameLookupFlagsIPv6Only: only resolve ipv6 addresses. + ResolverNameLookupFlagsIPv6Only ResolverNameLookupFlags = 0b10 +) + +func marshalResolverNameLookupFlags(p uintptr) (interface{}, error) { + return ResolverNameLookupFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ResolverNameLookupFlags. +func (r ResolverNameLookupFlags) String() string { + if r == 0 { + return "ResolverNameLookupFlags(0)" + } + + var builder strings.Builder + builder.Grow(94) + + for r != 0 { + next := r & (r - 1) + bit := r - next + + switch bit { + case ResolverNameLookupFlagsDefault: + builder.WriteString("Default|") + case ResolverNameLookupFlagsIPv4Only: + builder.WriteString("IPv4Only|") + case ResolverNameLookupFlagsIPv6Only: + builder.WriteString("IPv6Only|") + default: + builder.WriteString(fmt.Sprintf("ResolverNameLookupFlags(0b%b)|", bit)) + } + + r = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if r contains other. +func (r ResolverNameLookupFlags) Has(other ResolverNameLookupFlags) bool { + return (r & other) == other +} + +// ResourceFlags give information about a particular file inside a resource +// bundle. +type ResourceFlags C.guint + +const ( + // ResourceFlagsNone: no flags set. + ResourceFlagsNone ResourceFlags = 0b0 + // ResourceFlagsCompressed: file is compressed. + ResourceFlagsCompressed ResourceFlags = 0b1 +) + +func marshalResourceFlags(p uintptr) (interface{}, error) { + return ResourceFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ResourceFlags. +func (r ResourceFlags) String() string { + if r == 0 { + return "ResourceFlags(0)" + } + + var builder strings.Builder + builder.Grow(41) + + for r != 0 { + next := r & (r - 1) + bit := r - next + + switch bit { + case ResourceFlagsNone: + builder.WriteString("None|") + case ResourceFlagsCompressed: + builder.WriteString("Compressed|") + default: + builder.WriteString(fmt.Sprintf("ResourceFlags(0b%b)|", bit)) + } + + r = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if r contains other. +func (r ResourceFlags) Has(other ResourceFlags) bool { + return (r & other) == other +} + +// ResourceLookupFlags determine how resource path lookups are handled. +type ResourceLookupFlags C.guint + +const ( + // ResourceLookupFlagsNone: no flags set. + ResourceLookupFlagsNone ResourceLookupFlags = 0b0 +) + +func marshalResourceLookupFlags(p uintptr) (interface{}, error) { + return ResourceLookupFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ResourceLookupFlags. +func (r ResourceLookupFlags) String() string { + if r == 0 { + return "ResourceLookupFlags(0)" + } + + var builder strings.Builder + builder.Grow(23) + + for r != 0 { + next := r & (r - 1) + bit := r - next + + switch bit { + case ResourceLookupFlagsNone: + builder.WriteString("None|") + default: + builder.WriteString(fmt.Sprintf("ResourceLookupFlags(0b%b)|", bit)) + } + + r = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if r contains other. +func (r ResourceLookupFlags) Has(other ResourceLookupFlags) bool { + return (r & other) == other +} + +// SettingsBindFlags flags used when creating a binding. These flags determine +// in which direction the binding works. The default is to synchronize in both +// directions. +type SettingsBindFlags C.guint + +const ( + // SettingsBindDefault: equivalent to + // G_SETTINGS_BIND_GET|G_SETTINGS_BIND_SET. + SettingsBindDefault SettingsBindFlags = 0b0 + // SettingsBindGet: update the #GObject property when the setting changes. + // It is an error to use this flag if the property is not writable. + SettingsBindGet SettingsBindFlags = 0b1 + // SettingsBindSet: update the setting when the #GObject property changes. + // It is an error to use this flag if the property is not readable. + SettingsBindSet SettingsBindFlags = 0b10 + // SettingsBindNoSensitivity: do not try to bind a "sensitivity" property to + // the writability of the setting. + SettingsBindNoSensitivity SettingsBindFlags = 0b100 + // SettingsBindGetNoChanges: when set in addition to G_SETTINGS_BIND_GET, + // set the #GObject property value initially from the setting, but do not + // listen for changes of the setting. + SettingsBindGetNoChanges SettingsBindFlags = 0b1000 + // SettingsBindInvertBoolean: when passed to g_settings_bind(), uses a pair + // of mapping functions that invert the boolean value when mapping between + // the setting and the property. The setting and property must both be + // booleans. You cannot pass this flag to g_settings_bind_with_mapping(). + SettingsBindInvertBoolean SettingsBindFlags = 0b10000 +) + +func marshalSettingsBindFlags(p uintptr) (interface{}, error) { + return SettingsBindFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for SettingsBindFlags. +func (s SettingsBindFlags) String() string { + if s == 0 { + return "SettingsBindFlags(0)" + } + + var builder strings.Builder + builder.Grow(128) + + for s != 0 { + next := s & (s - 1) + bit := s - next + + switch bit { + case SettingsBindDefault: + builder.WriteString("Default|") + case SettingsBindGet: + builder.WriteString("Get|") + case SettingsBindSet: + builder.WriteString("Set|") + case SettingsBindNoSensitivity: + builder.WriteString("NoSensitivity|") + case SettingsBindGetNoChanges: + builder.WriteString("GetNoChanges|") + case SettingsBindInvertBoolean: + builder.WriteString("InvertBoolean|") + default: + builder.WriteString(fmt.Sprintf("SettingsBindFlags(0b%b)|", bit)) + } + + s = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if s contains other. +func (s SettingsBindFlags) Has(other SettingsBindFlags) bool { + return (s & other) == other +} + +// SocketMsgFlags flags used in g_socket_receive_message() and +// g_socket_send_message(). The flags listed in the enum are some commonly +// available flags, but the values used for them are the same as on the +// platform, and any other flags are passed in/out as is. So to use a platform +// specific flag, just include the right system header and pass in the flag. +type SocketMsgFlags C.guint + +const ( + // SocketMsgNone: no flags. + SocketMsgNone SocketMsgFlags = 0b0 + // SocketMsgOob: request to send/receive out of band data. + SocketMsgOob SocketMsgFlags = 0b1 + // SocketMsgPeek: read data from the socket without removing it from the + // queue. + SocketMsgPeek SocketMsgFlags = 0b10 + // SocketMsgDontroute: don't use a gateway to send out the packet, only send + // to hosts on directly connected networks. + SocketMsgDontroute SocketMsgFlags = 0b100 +) + +func marshalSocketMsgFlags(p uintptr) (interface{}, error) { + return SocketMsgFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for SocketMsgFlags. +func (s SocketMsgFlags) String() string { + if s == 0 { + return "SocketMsgFlags(0)" + } + + var builder strings.Builder + builder.Grow(59) + + for s != 0 { + next := s & (s - 1) + bit := s - next + + switch bit { + case SocketMsgNone: + builder.WriteString("None|") + case SocketMsgOob: + builder.WriteString("Oob|") + case SocketMsgPeek: + builder.WriteString("Peek|") + case SocketMsgDontroute: + builder.WriteString("Dontroute|") + default: + builder.WriteString(fmt.Sprintf("SocketMsgFlags(0b%b)|", bit)) + } + + s = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if s contains other. +func (s SocketMsgFlags) Has(other SocketMsgFlags) bool { + return (s & other) == other +} + +// SubprocessFlags flags to define the behaviour of a #GSubprocess. +// +// Note that the default for stdin is to redirect from /dev/null. For stdout and +// stderr the default are for them to inherit the corresponding descriptor from +// the calling process. +// +// Note that it is a programmer error to mix 'incompatible' flags. +// For example, you may not request both G_SUBPROCESS_FLAGS_STDOUT_PIPE and +// G_SUBPROCESS_FLAGS_STDOUT_SILENCE. +type SubprocessFlags C.guint + +const ( + // SubprocessFlagsNone: no flags. + SubprocessFlagsNone SubprocessFlags = 0b0 + // SubprocessFlagsStdinPipe: create a pipe for the stdin of the spawned + // process that can be accessed with g_subprocess_get_stdin_pipe(). + SubprocessFlagsStdinPipe SubprocessFlags = 0b1 + // SubprocessFlagsStdinInherit: stdin is inherited from the calling process. + SubprocessFlagsStdinInherit SubprocessFlags = 0b10 + // SubprocessFlagsStdoutPipe: create a pipe for the stdout of the spawned + // process that can be accessed with g_subprocess_get_stdout_pipe(). + SubprocessFlagsStdoutPipe SubprocessFlags = 0b100 + // SubprocessFlagsStdoutSilence: silence the stdout of the spawned process + // (ie: redirect to /dev/null). + SubprocessFlagsStdoutSilence SubprocessFlags = 0b1000 + // SubprocessFlagsStderrPipe: create a pipe for the stderr of the spawned + // process that can be accessed with g_subprocess_get_stderr_pipe(). + SubprocessFlagsStderrPipe SubprocessFlags = 0b10000 + // SubprocessFlagsStderrSilence: silence the stderr of the spawned process + // (ie: redirect to /dev/null). + SubprocessFlagsStderrSilence SubprocessFlags = 0b100000 + // SubprocessFlagsStderrMerge: merge the stderr of the spawned process with + // whatever the stdout happens to be. This is a good way of directing both + // streams to a common log file, for example. + SubprocessFlagsStderrMerge SubprocessFlags = 0b1000000 + // SubprocessFlagsInheritFds: spawned processes will inherit the file + // descriptors of their parent, unless those descriptors have been + // explicitly marked as close-on-exec. This flag has no effect over the + // "standard" file descriptors (stdin, stdout, stderr). + SubprocessFlagsInheritFds SubprocessFlags = 0b10000000 + // SubprocessFlagsSearchPathFromEnvp: if path searching is needed when + // spawning the subprocess, use the PATH in the launcher environment. + // (Since: 2.72). + SubprocessFlagsSearchPathFromEnvp SubprocessFlags = 0b100000000 +) + +func marshalSubprocessFlags(p uintptr) (interface{}, error) { + return SubprocessFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for SubprocessFlags. +func (s SubprocessFlags) String() string { + if s == 0 { + return "SubprocessFlags(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for s != 0 { + next := s & (s - 1) + bit := s - next + + switch bit { + case SubprocessFlagsNone: + builder.WriteString("None|") + case SubprocessFlagsStdinPipe: + builder.WriteString("StdinPipe|") + case SubprocessFlagsStdinInherit: + builder.WriteString("StdinInherit|") + case SubprocessFlagsStdoutPipe: + builder.WriteString("StdoutPipe|") + case SubprocessFlagsStdoutSilence: + builder.WriteString("StdoutSilence|") + case SubprocessFlagsStderrPipe: + builder.WriteString("StderrPipe|") + case SubprocessFlagsStderrSilence: + builder.WriteString("StderrSilence|") + case SubprocessFlagsStderrMerge: + builder.WriteString("StderrMerge|") + case SubprocessFlagsInheritFds: + builder.WriteString("InheritFds|") + case SubprocessFlagsSearchPathFromEnvp: + builder.WriteString("SearchPathFromEnvp|") + default: + builder.WriteString(fmt.Sprintf("SubprocessFlags(0b%b)|", bit)) + } + + s = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if s contains other. +func (s SubprocessFlags) Has(other SubprocessFlags) bool { + return (s & other) == other +} + +// TestDBusFlags flags to define future DBus behaviour. +type TestDBusFlags C.guint + +const ( + // TestDBusNone: no flags. + TestDBusNone TestDBusFlags = 0b0 +) + +func marshalTestDBusFlags(p uintptr) (interface{}, error) { + return TestDBusFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for TestDBusFlags. +func (t TestDBusFlags) String() string { + if t == 0 { + return "TestDBusFlags(0)" + } + + var builder strings.Builder + builder.Grow(12) + + for t != 0 { + next := t & (t - 1) + bit := t - next + + switch bit { + case TestDBusNone: + builder.WriteString("None|") + default: + builder.WriteString(fmt.Sprintf("TestDBusFlags(0b%b)|", bit)) + } + + t = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if t contains other. +func (t TestDBusFlags) Has(other TestDBusFlags) bool { + return (t & other) == other +} + +// TLSCertificateFlags: set of flags describing TLS certification validation. +// This can be used to describe why a particular certificate was rejected (for +// example, in Connection::accept-certificate). +// +// GLib guarantees that if certificate verification fails, at least one flag +// will be set, but it does not guarantee that all possible flags will be set. +// Accordingly, you may not safely decide to ignore any particular type of +// error. For example, it would be incorrect to mask G_TLS_CERTIFICATE_EXPIRED +// if you want to allow expired certificates, because this could potentially be +// the only error flag set even if other problems exist with the certificate. +type TLSCertificateFlags C.guint + +const ( + // TLSCertificateNoFlags: no flags set. Since: 2.74. + TLSCertificateNoFlags TLSCertificateFlags = 0b0 + // TLSCertificateUnknownCa: signing certificate authority is not known. + TLSCertificateUnknownCa TLSCertificateFlags = 0b1 + // TLSCertificateBadIdentity: certificate does not match the expected + // identity of the site that it was retrieved from. + TLSCertificateBadIdentity TLSCertificateFlags = 0b10 + // TLSCertificateNotActivated certificate's activation time is still in the + // future. + TLSCertificateNotActivated TLSCertificateFlags = 0b100 + // TLSCertificateExpired: certificate has expired. + TLSCertificateExpired TLSCertificateFlags = 0b1000 + // TLSCertificateRevoked: certificate has been revoked according to the + // Connection's certificate revocation list. + TLSCertificateRevoked TLSCertificateFlags = 0b10000 + // TLSCertificateInsecure certificate's algorithm is considered insecure. + TLSCertificateInsecure TLSCertificateFlags = 0b100000 + // TLSCertificateGenericError: some other error occurred validating the + // certificate. + TLSCertificateGenericError TLSCertificateFlags = 0b1000000 + // TLSCertificateValidateAll: combination of all of the above flags. + TLSCertificateValidateAll TLSCertificateFlags = 0b1111111 +) + +func marshalTLSCertificateFlags(p uintptr) (interface{}, error) { + return TLSCertificateFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for TLSCertificateFlags. +func (t TLSCertificateFlags) String() string { + if t == 0 { + return "TLSCertificateFlags(0)" + } + + var builder strings.Builder + builder.Grow(218) + + for t != 0 { + next := t & (t - 1) + bit := t - next + + switch bit { + case TLSCertificateNoFlags: + builder.WriteString("NoFlags|") + case TLSCertificateUnknownCa: + builder.WriteString("UnknownCa|") + case TLSCertificateBadIdentity: + builder.WriteString("BadIdentity|") + case TLSCertificateNotActivated: + builder.WriteString("NotActivated|") + case TLSCertificateExpired: + builder.WriteString("Expired|") + case TLSCertificateRevoked: + builder.WriteString("Revoked|") + case TLSCertificateInsecure: + builder.WriteString("Insecure|") + case TLSCertificateGenericError: + builder.WriteString("GenericError|") + case TLSCertificateValidateAll: + builder.WriteString("ValidateAll|") + default: + builder.WriteString(fmt.Sprintf("TLSCertificateFlags(0b%b)|", bit)) + } + + t = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if t contains other. +func (t TLSCertificateFlags) Has(other TLSCertificateFlags) bool { + return (t & other) == other +} + +// TLSDatabaseVerifyFlags flags for g_tls_database_verify_chain(). +type TLSDatabaseVerifyFlags C.guint + +const ( + // TLSDatabaseVerifyNone: no verification flags. + TLSDatabaseVerifyNone TLSDatabaseVerifyFlags = 0b0 +) + +func marshalTLSDatabaseVerifyFlags(p uintptr) (interface{}, error) { + return TLSDatabaseVerifyFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for TLSDatabaseVerifyFlags. +func (t TLSDatabaseVerifyFlags) String() string { + if t == 0 { + return "TLSDatabaseVerifyFlags(0)" + } + + var builder strings.Builder + builder.Grow(21) + + for t != 0 { + next := t & (t - 1) + bit := t - next + + switch bit { + case TLSDatabaseVerifyNone: + builder.WriteString("None|") + default: + builder.WriteString(fmt.Sprintf("TLSDatabaseVerifyFlags(0b%b)|", bit)) + } + + t = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if t contains other. +func (t TLSDatabaseVerifyFlags) Has(other TLSDatabaseVerifyFlags) bool { + return (t & other) == other +} + +// TLSPasswordFlags various flags for the password. +type TLSPasswordFlags C.guint + +const ( + // TLSPasswordNone: no flags. + TLSPasswordNone TLSPasswordFlags = 0b0 + // TLSPasswordRetry: password was wrong, and the user should retry. + TLSPasswordRetry TLSPasswordFlags = 0b10 + // TLSPasswordManyTries: hint to the user that the password has been wrong + // many times, and the user may not have many chances left. + TLSPasswordManyTries TLSPasswordFlags = 0b100 + // TLSPasswordFinalTry: hint to the user that this is the last try to get + // this password right. + TLSPasswordFinalTry TLSPasswordFlags = 0b1000 + // TLSPasswordPKCS11User: for PKCS #11, the user PIN is required. Since: + // 2.70. + TLSPasswordPKCS11User TLSPasswordFlags = 0b10000 + // TLSPasswordPKCS11SecurityOfficer: for PKCS #11, the security officer PIN + // is required. Since: 2.70. + TLSPasswordPKCS11SecurityOfficer TLSPasswordFlags = 0b100000 + // TLSPasswordPKCS11ContextSpecific: for PKCS #11, the context-specific PIN + // is required. Since: 2.70. + TLSPasswordPKCS11ContextSpecific TLSPasswordFlags = 0b1000000 +) + +func marshalTLSPasswordFlags(p uintptr) (interface{}, error) { + return TLSPasswordFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for TLSPasswordFlags. +func (t TLSPasswordFlags) String() string { + if t == 0 { + return "TLSPasswordFlags(0)" + } + + var builder strings.Builder + builder.Grow(161) + + for t != 0 { + next := t & (t - 1) + bit := t - next + + switch bit { + case TLSPasswordNone: + builder.WriteString("None|") + case TLSPasswordRetry: + builder.WriteString("Retry|") + case TLSPasswordManyTries: + builder.WriteString("ManyTries|") + case TLSPasswordFinalTry: + builder.WriteString("FinalTry|") + case TLSPasswordPKCS11User: + builder.WriteString("PKCS11User|") + case TLSPasswordPKCS11SecurityOfficer: + builder.WriteString("PKCS11SecurityOfficer|") + case TLSPasswordPKCS11ContextSpecific: + builder.WriteString("PKCS11ContextSpecific|") + default: + builder.WriteString(fmt.Sprintf("TLSPasswordFlags(0b%b)|", bit)) + } + + t = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if t contains other. +func (t TLSPasswordFlags) Has(other TLSPasswordFlags) bool { + return (t & other) == other +} + +// AsyncReadyCallback: type definition for a function that will be called back +// when an asynchronous operation within GIO has been completed. ReadyCallback +// callbacks from #GTask are guaranteed to be invoked in a later iteration of +// the [thread-default main context][g-main-context-push-thread-default] where +// the #GTask was created. All other users of ReadyCallback must likewise call +// it asynchronously in a later iteration of the main context. +// +// The asynchronous operation is guaranteed to have held a reference to +// source_object from the time when the *_async() function was called, until +// after this callback returns. +type AsyncReadyCallback func(res AsyncResulter) + +// BusAcquiredCallback: invoked when a connection to a message bus has been +// obtained. +type BusAcquiredCallback func(connection *DBusConnection, name string) + +// BusNameAcquiredCallback: invoked when the name is acquired. +type BusNameAcquiredCallback func(connection *DBusConnection, name string) + +// BusNameAppearedCallback: invoked when the name being watched is known to have +// to have an owner. +type BusNameAppearedCallback func(connection *DBusConnection, name, nameOwner string) + +// BusNameLostCallback: invoked when the name is lost or connection has been +// closed. +type BusNameLostCallback func(connection *DBusConnection, name string) + +// BusNameVanishedCallback: invoked when the name being watched is known not to +// have to have an owner. +// +// This is also invoked when the BusConnection on which the watch was +// established has been closed. In that case, connection will be NULL. +type BusNameVanishedCallback func(connection *DBusConnection, name string) + +// DBusInterfaceGetPropertyFunc: type of the get_property function in +// BusInterfaceVTable. +type DBusInterfaceGetPropertyFunc func(connection *DBusConnection, sender, objectPath, interfaceName, propertyName string) (err error, variant *glib.Variant) + +// DBusInterfaceMethodCallFunc: type of the method_call function in +// BusInterfaceVTable. +type DBusInterfaceMethodCallFunc func(connection *DBusConnection, sender, objectPath, interfaceName, methodName string, parameters *glib.Variant, invocation *DBusMethodInvocation) + +// DBusInterfaceSetPropertyFunc: type of the set_property function in +// BusInterfaceVTable. +type DBusInterfaceSetPropertyFunc func(connection *DBusConnection, sender, objectPath, interfaceName, propertyName string, value *glib.Variant) (err error, ok bool) + +// DBusMessageFilterFunction: signature for function used in +// g_dbus_connection_add_filter(). +// +// A filter function is passed a BusMessage and expected to return a BusMessage +// too. Passive filter functions that don't modify the message can simply return +// the message object: +// +// static GDBusMessage * +// passive_filter (GDBusConnection *connection +// GDBusMessage *message, +// gboolean incoming, +// gpointer user_data) +// { +// // inspect message +// return message; +// } +// +// Filter functions that wants to drop a message can simply return NULL: +// +// static GDBusMessage * +// drop_filter (GDBusConnection *connection +// GDBusMessage *message, +// gboolean incoming, +// gpointer user_data) +// { +// if (should_drop_message) +// { +// g_object_unref (message); +// message = NULL; +// } +// return message; +// } +// +// Finally, a filter function may modify a message by copying it: +// +// static GDBusMessage * +// modifying_filter (GDBusConnection *connection +// GDBusMessage *message, +// gboolean incoming, +// gpointer user_data) +// { +// GDBusMessage *copy; +// GError *error; +// +// error = NULL; +// copy = g_dbus_message_copy (message, &error); +// // handle error being set +// g_object_unref (message); +// +// // modify copy +// +// return copy; +// } +// +// If the returned BusMessage is different from message and cannot be sent on +// connection (it could use features, such as file descriptors, not compatible +// with connection), then a warning is logged to standard error. Applications +// can check this ahead of time using g_dbus_message_to_blob() passing a +// BusCapabilityFlags value obtained from connection. +type DBusMessageFilterFunction func(connection *DBusConnection, message *DBusMessage, incoming bool) (dBusMessage *DBusMessage) + +// DBusSignalCallback: signature for callback function used in +// g_dbus_connection_signal_subscribe(). +type DBusSignalCallback func(connection *DBusConnection, senderName, objectPath, interfaceName, signalName string, parameters *glib.Variant) + +// DBusSubtreeDispatchFunc: type of the dispatch function in BusSubtreeVTable. +// +// Subtrees are flat. node, if non-NULL, is always exactly one segment of the +// object path (ie: it never contains a slash). +type DBusSubtreeDispatchFunc func(connection *DBusConnection, sender, objectPath, interfaceName, node string) (outUserData unsafe.Pointer, dBusInterfaceVTable *DBusInterfaceVTable) + +// DBusSubtreeEnumerateFunc: type of the enumerate function in BusSubtreeVTable. +// +// This function is called when generating introspection data and also +// when preparing to dispatch incoming messages in the event that the +// G_DBUS_SUBTREE_FLAGS_DISPATCH_TO_UNENUMERATED_NODES flag is not specified +// (ie: to verify that the object path is valid). +// +// Hierarchies are not supported; the items that you return should not contain +// the / character. +// +// The return value will be freed with g_strfreev(). +type DBusSubtreeEnumerateFunc func(connection *DBusConnection, sender, objectPath string) (utf8s []string) + +// DBusSubtreeIntrospectFunc: type of the introspect function in +// BusSubtreeVTable. +// +// Subtrees are flat. node, if non-NULL, is always exactly one segment of the +// object path (ie: it never contains a slash). +// +// This function should return NULL to indicate that there is no object at this +// node. +// +// If this function returns non-NULL, the return value is expected to be +// a NULL-terminated array of pointers to BusInterfaceInfo structures +// describing the interfaces implemented by node. This array will have +// g_dbus_interface_info_unref() called on each item before being freed with +// g_free(). +// +// The difference between returning NULL and an array containing zero items is +// that the standard DBus interfaces will returned to the remote introspector in +// the empty array case, but not in the NULL case. +type DBusSubtreeIntrospectFunc func(connection *DBusConnection, sender, objectPath, node string) (dBusInterfaceInfos []*DBusInterfaceInfo) + +// SettingsBindGetMapping: type for the function that is used to convert from +// #GSettings to an object property. The value is already initialized to hold +// values of the appropriate type. +type SettingsBindGetMapping func(value *coreglib.Value, variant *glib.Variant) (ok bool) + +// SettingsBindSetMapping: type for the function that is used to convert an +// object property value to a #GVariant for storing it in #GSettings. +type SettingsBindSetMapping func(value *coreglib.Value, expectedType *glib.VariantType) (variant *glib.Variant) + +// SettingsGetMapping: type of the function that is used to convert from a value +// stored in a #GSettings to a value that is useful to the application. +// +// If the value is successfully mapped, the result should be stored at result +// and TRUE returned. If mapping fails (for example, if value is not in the +// right format) then FALSE should be returned. +// +// If value is NULL then it means that the mapping function is being given a +// "last chance" to successfully return a valid value. TRUE must be returned in +// this case. +type SettingsGetMapping func(value *glib.Variant) (result unsafe.Pointer, ok bool) + +// VFSFileLookupFunc: this function type is used by g_vfs_register_uri_scheme() +// to make it possible for a client to associate an URI scheme to a different +// #GFile implementation. +// +// The client should return a reference to the new file that has been created +// for uri, or NULL to continue with the default implementation. +type VFSFileLookupFunc func(vfs *VFS, identifier string) (file *File) + +// BusGet: asynchronously connects to the message bus specified by bus_type. +// +// When the operation is finished, callback will be invoked. You can then call +// g_bus_get_finish() to get the result of the operation. +// +// This is an asynchronous failable function. See g_bus_get_sync() for the +// synchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - busType: Type. +// - callback (optional) to call when the request is satisfied. +func BusGet(ctx context.Context, busType BusType, callback AsyncReadyCallback) { + var _arg2 *C.GCancellable // out + var _arg1 C.GBusType // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GBusType(busType) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_bus_get(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(ctx) + runtime.KeepAlive(busType) + runtime.KeepAlive(callback) +} + +// BusGetFinish finishes an operation started with g_bus_get(). +// +// The returned object is a singleton, that is, shared with other +// callers of g_bus_get() and g_bus_get_sync() for bus_type. +// In the event that you need a private message bus connection, use +// g_dbus_address_get_for_bus_sync() and g_dbus_connection_new_for_address() +// with G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and +// G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags. +// +// Note that the returned BusConnection object will (usually) have the +// BusConnection:exit-on-close property set to TRUE. +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to g_bus_get(). +// +// The function returns the following values: +// +// - dBusConnection or NULL if error is set. Free with g_object_unref(). +func BusGetFinish(res AsyncResulter) (*DBusConnection, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GDBusConnection // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_bus_get_finish(_arg1, &_cerr) + runtime.KeepAlive(res) + + var _dBusConnection *DBusConnection // out + var _goerr error // out + + _dBusConnection = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusConnection, _goerr +} + +// BusGetSync: synchronously connects to the message bus specified by bus_type. +// Note that the returned object may shared with other callers, e.g. if two +// separate parts of a process calls this function with the same bus_type, +// they will share the same object. +// +// This is a synchronous failable function. See g_bus_get() and +// g_bus_get_finish() for the asynchronous version. +// +// The returned object is a singleton, that is, shared with other +// callers of g_bus_get() and g_bus_get_sync() for bus_type. +// In the event that you need a private message bus connection, use +// g_dbus_address_get_for_bus_sync() and g_dbus_connection_new_for_address() +// with G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT and +// G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION flags. +// +// Note that the returned BusConnection object will (usually) have the +// BusConnection:exit-on-close property set to TRUE. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - busType: Type. +// +// The function returns the following values: +// +// - dBusConnection or NULL if error is set. Free with g_object_unref(). +func BusGetSync(ctx context.Context, busType BusType) (*DBusConnection, error) { + var _arg2 *C.GCancellable // out + var _arg1 C.GBusType // out + var _cret *C.GDBusConnection // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GBusType(busType) + + _cret = C.g_bus_get_sync(_arg1, _arg2, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(busType) + + var _dBusConnection *DBusConnection // out + var _goerr error // out + + _dBusConnection = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusConnection, _goerr +} + +// BusUnownName stops owning a name. +// +// Note that there may still be D-Bus traffic to process (relating to owning and +// unowning the name) in the current thread-default Context after this function +// has returned. You should continue to iterate the Context until the Notify +// function passed to g_bus_own_name() is called, in order to avoid memory leaks +// through callbacks queued on the Context after it’s stopped being iterated. +// +// The function takes the following parameters: +// +// - ownerId: identifier obtained from g_bus_own_name(). +func BusUnownName(ownerId uint) { + var _arg1 C.guint // out + + _arg1 = C.guint(ownerId) + + C.g_bus_unown_name(_arg1) + runtime.KeepAlive(ownerId) +} + +// BusUnwatchName stops watching a name. +// +// Note that there may still be D-Bus traffic to process (relating to watching +// and unwatching the name) in the current thread-default Context after this +// function has returned. You should continue to iterate the Context until the +// Notify function passed to g_bus_watch_name() is called, in order to avoid +// memory leaks through callbacks queued on the Context after it’s stopped being +// iterated. +// +// The function takes the following parameters: +// +// - watcherId: identifier obtained from g_bus_watch_name(). +func BusUnwatchName(watcherId uint) { + var _arg1 C.guint // out + + _arg1 = C.guint(watcherId) + + C.g_bus_unwatch_name(_arg1) + runtime.KeepAlive(watcherId) +} + +// ContentTypeCanBeExecutable checks if a content type can be executable. +// Note that for instance things like text files can be executables (i.e. +// scripts and batch files). +// +// The function takes the following parameters: +// +// - typ: content type string. +// +// The function returns the following values: +// +// - ok: TRUE if the file type corresponds to a type that can be executable, +// FALSE otherwise. +func ContentTypeCanBeExecutable(typ string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_content_type_can_be_executable(_arg1) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ContentTypeEquals compares two content types for equality. +// +// The function takes the following parameters: +// +// - type1: content type string. +// - type2: content type string. +// +// The function returns the following values: +// +// - ok: TRUE if the two strings are identical or equivalent, FALSE otherwise. +func ContentTypeEquals(type1, type2 string) bool { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(type1))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(type2))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_content_type_equals(_arg1, _arg2) + runtime.KeepAlive(type1) + runtime.KeepAlive(type2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ContentTypeFromMIMEType tries to find a content type based on the mime type +// name. +// +// The function takes the following parameters: +// +// - mimeType: mime type string. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string with content type or NULL. +// Free with g_free(). +func ContentTypeFromMIMEType(mimeType string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_content_type_from_mime_type(_arg1) + runtime.KeepAlive(mimeType) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// ContentTypeGetDescription gets the human readable description of the content +// type. +// +// The function takes the following parameters: +// +// - typ: content type string. +// +// The function returns the following values: +// +// - utf8: short description of the content type type. Free the returned +// string with g_free(). +func ContentTypeGetDescription(typ string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_content_type_get_description(_arg1) + runtime.KeepAlive(typ) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// ContentTypeGetGenericIconName gets the generic icon name for a content type. +// +// See the shared-mime-info +// (http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec) +// specification for more on the generic icon name. +// +// The function takes the following parameters: +// +// - typ: content type string. +// +// The function returns the following values: +// +// - utf8 (optional): registered generic icon name for the given type, or NULL +// if unknown. Free with g_free(). +func ContentTypeGetGenericIconName(typ string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_content_type_get_generic_icon_name(_arg1) + runtime.KeepAlive(typ) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// ContentTypeGetIcon gets the icon for a content type. +// +// The function takes the following parameters: +// +// - typ: content type string. +// +// The function returns the following values: +// +// - icon corresponding to the content type. Free the returned object with +// g_object_unref(). +func ContentTypeGetIcon(typ string) *Icon { + var _arg1 *C.gchar // out + var _cret *C.GIcon // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_content_type_get_icon(_arg1) + runtime.KeepAlive(typ) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// ContentTypeGetMIMEDirs: get the list of directories which MIME data is loaded +// from. See g_content_type_set_mime_dirs() for details. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated list of directories to load MIME data from, +// including any mime/ subdirectory, and with the first directory to try +// listed first. +func ContentTypeGetMIMEDirs() []string { + var _cret **C.gchar // in + + _cret = C.g_content_type_get_mime_dirs() + + var _utf8s []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// ContentTypeGetMIMEType gets the mime type for the content type, if one is +// registered. +// +// The function takes the following parameters: +// +// - typ: content type string. +// +// The function returns the following values: +// +// - utf8 (optional): registered mime type for the given type, or NULL if +// unknown; free with g_free(). +func ContentTypeGetMIMEType(typ string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_content_type_get_mime_type(_arg1) + runtime.KeepAlive(typ) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// ContentTypeGetSymbolicIcon gets the symbolic icon for a content type. +// +// The function takes the following parameters: +// +// - typ: content type string. +// +// The function returns the following values: +// +// - icon: symbolic #GIcon corresponding to the content type. Free the +// returned object with g_object_unref(). +func ContentTypeGetSymbolicIcon(typ string) *Icon { + var _arg1 *C.gchar // out + var _cret *C.GIcon // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_content_type_get_symbolic_icon(_arg1) + runtime.KeepAlive(typ) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// ContentTypeGuess guesses the content type based on example data. If the +// function is uncertain, result_uncertain will be set to TRUE. Either filename +// or data may be NULL, in which case the guess will be based solely on the +// other argument. +// +// The function takes the following parameters: +// +// - filename (optional): path, or NULL. +// - data (optional): stream of data, or NULL. +// +// The function returns the following values: +// +// - resultUncertain (optional): return location for the certainty of the +// result, or NULL. +// - utf8: string indicating a guessed content type for the given data. +// Free with g_free(). +func ContentTypeGuess(filename string, data []byte) (bool, string) { + var _arg1 *C.gchar // out + var _arg2 *C.guchar // out + var _arg3 C.gsize + var _arg4 C.gboolean // in + var _cret *C.gchar // in + + if filename != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg3 = (C.gsize)(len(data)) + if len(data) > 0 { + _arg2 = (*C.guchar)(unsafe.Pointer(&data[0])) + } + + _cret = C.g_content_type_guess(_arg1, _arg2, _arg3, &_arg4) + runtime.KeepAlive(filename) + runtime.KeepAlive(data) + + var _resultUncertain bool // out + var _utf8 string // out + + if _arg4 != 0 { + _resultUncertain = true + } + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _resultUncertain, _utf8 +} + +// ContentTypeGuessForTree tries to guess the type of the tree with root root, +// by looking at the files it contains. The result is an array of content types, +// with the best guess coming first. +// +// The types returned all have the form x-content/foo, e.g. +// x-content/audio-cdda (for audio CDs) or x-content/image-dcf +// (for a camera memory card). See the shared-mime-info +// (http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec) +// specification for more on x-content types. +// +// This function is useful in the implementation of +// g_mount_guess_content_type(). +// +// The function takes the following parameters: +// +// - root of the tree to guess a type for. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of zero or more content types. Free with +// g_strfreev(). +func ContentTypeGuessForTree(root Filer) []string { + var _arg1 *C.GFile // out + var _cret **C.gchar // in + + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(root).Native())) + + _cret = C.g_content_type_guess_for_tree(_arg1) + runtime.KeepAlive(root) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// ContentTypeIsA determines if type is a subset of supertype. +// +// The function takes the following parameters: +// +// - typ: content type string. +// - supertype: content type string. +// +// The function returns the following values: +// +// - ok: TRUE if type is a kind of supertype, FALSE otherwise. +func ContentTypeIsA(typ, supertype string) bool { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(supertype))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_content_type_is_a(_arg1, _arg2) + runtime.KeepAlive(typ) + runtime.KeepAlive(supertype) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ContentTypeIsMIMEType determines if type is a subset of mime_type. +// Convenience wrapper around g_content_type_is_a(). +// +// The function takes the following parameters: +// +// - typ: content type string. +// - mimeType: mime type string. +// +// The function returns the following values: +// +// - ok: TRUE if type is a kind of mime_type, FALSE otherwise. +func ContentTypeIsMIMEType(typ, mimeType string) bool { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_content_type_is_mime_type(_arg1, _arg2) + runtime.KeepAlive(typ) + runtime.KeepAlive(mimeType) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ContentTypeIsUnknown checks if the content type is the generic "unknown" +// type. On UNIX this is the "application/octet-stream" mimetype, while on win32 +// it is "*" and on OSX it is a dynamic type or octet-stream. +// +// The function takes the following parameters: +// +// - typ: content type string. +// +// The function returns the following values: +// +// - ok: TRUE if the type is the unknown type. +func ContentTypeIsUnknown(typ string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_content_type_is_unknown(_arg1) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ContentTypeSetMIMEDirs: set the list of directories used by GIO to load the +// MIME database. If dirs is NULL, the directories used are the default: +// +// - the mime subdirectory of the directory in $XDG_DATA_HOME +// - the mime subdirectory of every directory in $XDG_DATA_DIRS +// +// This function is intended to be used when writing tests that depend on +// information stored in the MIME database, in order to control the data. +// +// Typically, in case your tests use G_TEST_OPTION_ISOLATE_DIRS, but they depend +// on the system’s MIME database, you should call this function with dirs set to +// NULL before calling g_test_init(), for instance: +// +// // Load MIME data from the system +// g_content_type_set_mime_dirs (NULL); +// // Isolate the environment +// g_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL); +// +// … +// +// return g_test_run ();. +// +// The function takes the following parameters: +// +// - dirs (optional): NULL-terminated list of directories to load MIME data +// from, including any mime/ subdirectory, and with the first directory to +// try listed first. +func ContentTypeSetMIMEDirs(dirs []string) { + var _arg1 **C.gchar // out + + { + _arg1 = (**C.gchar)(C.calloc(C.size_t((len(dirs) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(dirs)+1) + var zero *C.gchar + out[len(dirs)] = zero + for i := range dirs { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(dirs[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.g_content_type_set_mime_dirs(_arg1) + runtime.KeepAlive(dirs) +} + +// ContentTypesGetRegistered gets a list of strings containing all the +// registered content types known to the system. The list and its data should be +// freed using g_list_free_full (list, g_free). +// +// The function returns the following values: +// +// - list of the registered content types. +func ContentTypesGetRegistered() []string { + var _cret *C.GList // in + + _cret = C.g_content_types_get_registered() + + var _list []string // out + + _list = make([]string, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.gchar)(v) + var dst string // out + dst = C.GoString((*C.gchar)(unsafe.Pointer(src))) + defer C.free(unsafe.Pointer(src)) + _list = append(_list, dst) + }) + + return _list +} + +// DBusAddressEscapeValue: escape string so it can appear in a D-Bus address as +// the value part of a key-value pair. +// +// For instance, if string is /run/bus-for-:0, this function would +// return /run/bus-for-3A0, which could be used in a D-Bus address like +// unix:nonce-tcp:host=127.0.0.1,port=42,noncefile=/run/bus-for-3A0. +// +// The function takes the following parameters: +// +// - str: unescaped string to be included in a D-Bus address as the value in a +// key-value pair. +// +// The function returns the following values: +// +// - utf8: copy of string with all non-optionally-escaped bytes escaped. +func DBusAddressEscapeValue(str string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_address_escape_value(_arg1) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// DBusAddressGetForBusSync: synchronously looks up the D-Bus address for the +// well-known message bus instance specified by bus_type. This may involve using +// various platform specific mechanisms. +// +// The returned address will be in the D-Bus address format +// (https://dbus.freedesktop.org/doc/dbus-specification.html#addresses). +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - busType: Type. +// +// The function returns the following values: +// +// - utf8: valid D-Bus address string for bus_type or NULL if error is set. +func DBusAddressGetForBusSync(ctx context.Context, busType BusType) (string, error) { + var _arg2 *C.GCancellable // out + var _arg1 C.GBusType // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GBusType(busType) + + _cret = C.g_dbus_address_get_for_bus_sync(_arg1, _arg2, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(busType) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// DBusAddressGetStream: asynchronously connects to an endpoint +// specified by address and sets up the connection so it is in +// a state to run the client-side of the D-Bus authentication +// conversation. address must be in the D-Bus address format +// (https://dbus.freedesktop.org/doc/dbus-specification.html#addresses). +// +// When the operation is finished, callback will be invoked. You can then call +// g_dbus_address_get_stream_finish() to get the result of the operation. +// +// This is an asynchronous failable function. See +// g_dbus_address_get_stream_sync() for the synchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - address: valid D-Bus address. +// - callback (optional) to call when the request is satisfied. +func DBusAddressGetStream(ctx context.Context, address string, callback AsyncReadyCallback) { + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(address))) + defer C.free(unsafe.Pointer(_arg1)) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_address_get_stream(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(callback) +} + +// DBusAddressGetStreamFinish finishes an operation started with +// g_dbus_address_get_stream(). +// +// A server is not required to set a GUID, so out_guid may be set to NULL even +// on success. +// +// The function takes the following parameters: +// +// - res obtained from the GAsyncReadyCallback passed to +// g_dbus_address_get_stream(). +// +// The function returns the following values: +// +// - outGuid (optional): NULL or return location to store the GUID extracted +// from address, if any. +// - ioStream or NULL if error is set. +func DBusAddressGetStreamFinish(res AsyncResulter) (string, IOStreamer, error) { + var _arg1 *C.GAsyncResult // out + var _arg2 *C.gchar // in + var _cret *C.GIOStream // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_address_get_stream_finish(_arg1, &_arg2, &_cerr) + runtime.KeepAlive(res) + + var _outGuid string // out + var _ioStream IOStreamer // out + var _goerr error // out + + if _arg2 != nil { + _outGuid = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _ioStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _outGuid, _ioStream, _goerr +} + +// DBusAddressGetStreamSync: synchronously connects to an endpoint +// specified by address and sets up the connection so it is in +// a state to run the client-side of the D-Bus authentication +// conversation. address must be in the D-Bus address format +// (https://dbus.freedesktop.org/doc/dbus-specification.html#addresses). +// +// A server is not required to set a GUID, so out_guid may be set to NULL even +// on success. +// +// This is a synchronous failable function. See g_dbus_address_get_stream() for +// the asynchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - address: valid D-Bus address. +// +// The function returns the following values: +// +// - outGuid (optional): NULL or return location to store the GUID extracted +// from address, if any. +// - ioStream or NULL if error is set. +func DBusAddressGetStreamSync(ctx context.Context, address string) (string, IOStreamer, error) { + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // in + var _cret *C.GIOStream // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(address))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_address_get_stream_sync(_arg1, &_arg2, _arg3, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + + var _outGuid string // out + var _ioStream IOStreamer // out + var _goerr error // out + + if _arg2 != nil { + _outGuid = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _ioStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _outGuid, _ioStream, _goerr +} + +// DBusEscapeObjectPath: this is a language binding friendly version of +// g_dbus_escape_object_path_bytestring(). +// +// The function takes the following parameters: +// +// - s: string to escape. +// +// The function returns the following values: +// +// - utf8: escaped version of s. Free with g_free(). +func DBusEscapeObjectPath(s string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(s))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_escape_object_path(_arg1) + runtime.KeepAlive(s) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// DBusEscapeObjectPathBytestring escapes bytes for use in a D-Bus object path +// component. bytes is an array of zero or more nonzero bytes in an unspecified +// encoding, followed by a single zero byte. +// +// The escaping method consists of replacing all non-alphanumeric characters +// (see g_ascii_isalnum()) with their hexadecimal value preceded by an +// underscore (_). For example: foo.bar.baz will become foo_2ebar_2ebaz. +// +// This method is appropriate to use when the input is nearly a valid object +// path component but is not when your input is far from being a valid object +// path component. Other escaping algorithms are also valid to use with D-Bus +// object paths. +// +// This can be reversed with g_dbus_unescape_object_path(). +// +// The function takes the following parameters: +// +// - bytes: string of bytes to escape. +// +// The function returns the following values: +// +// - utf8: escaped version of bytes. Free with g_free(). +func DBusEscapeObjectPathBytestring(bytes []byte) string { + var _arg1 *C.guint8 // out + var _cret *C.gchar // in + + { + var zero byte + bytes = append(bytes, zero) + _arg1 = (*C.guint8)(unsafe.Pointer(&bytes[0])) + } + + _cret = C.g_dbus_escape_object_path_bytestring(_arg1) + runtime.KeepAlive(bytes) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// DBusGenerateGUID: generate a D-Bus GUID that can be used with e.g. +// g_dbus_connection_new(). +// +// See the D-Bus specification +// (https://dbus.freedesktop.org/doc/dbus-specification.html#uuids) regarding +// what strings are valid D-Bus GUIDs. The specification refers to these as +// ‘UUIDs’ whereas GLib (for historical reasons) refers to them as ‘GUIDs’. +// The terms are interchangeable. +// +// Note that D-Bus GUIDs do not follow RFC 4122 +// (https://datatracker.ietf.org/doc/html/rfc4122). +// +// The function returns the following values: +// +// - utf8: valid D-Bus GUID. Free with g_free(). +func DBusGenerateGUID() string { + var _cret *C.gchar // in + + _cret = C.g_dbus_generate_guid() + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// DBusGValueToGVariant converts a #GValue to a #GVariant of the type indicated +// by the type parameter. +// +// The conversion is using the following rules: +// +// - G_TYPE_STRING: 's', 'o', 'g' or 'ay' +// +// - G_TYPE_STRV: 'as', 'ao' or 'aay' +// +// - G_TYPE_BOOLEAN: 'b' +// +// - G_TYPE_UCHAR: 'y' +// +// - G_TYPE_INT: 'i', 'n' +// +// - G_TYPE_UINT: 'u', 'q' +// +// - G_TYPE_INT64: 'x' +// +// - G_TYPE_UINT64: 't' +// +// - G_TYPE_DOUBLE: 'd' +// +// - G_TYPE_VARIANT: Any Type +// +// This can fail if e.g. gvalue is of type G_TYPE_STRING and type is 'i', +// i.e. G_VARIANT_TYPE_INT32. It will also fail for any #GType (including e.g. +// G_TYPE_OBJECT and G_TYPE_BOXED derived-types) not in the table above. +// +// Note that if gvalue is of type G_TYPE_VARIANT and its value is NULL, +// the empty #GVariant instance (never NULL) for type is returned (e.g. 0 for +// scalar types, the empty string for string types, '/' for object path types, +// the empty array for any array type and so on). +// +// See the g_dbus_gvariant_to_gvalue() function for how to convert a #GVariant +// to a #GValue. +// +// The function takes the following parameters: +// +// - gvalue to convert to a #GVariant. +// - typ: Type. +// +// The function returns the following values: +// +// - variant (never floating) of Type type holding the data from gvalue or an +// empty #GVariant in case of failure. Free with g_variant_unref(). +func DBusGValueToGVariant(gvalue *coreglib.Value, typ *glib.VariantType) *glib.Variant { + var _arg1 *C.GValue // out + var _arg2 *C.GVariantType // out + var _cret *C.GVariant // in + + _arg1 = (*C.GValue)(unsafe.Pointer(gvalue.Native())) + _arg2 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_dbus_gvalue_to_gvariant(_arg1, _arg2) + runtime.KeepAlive(gvalue) + runtime.KeepAlive(typ) + + var _variant *glib.Variant // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// DBusGVariantToGValue converts a #GVariant to a #GValue. If value is floating, +// it is consumed. +// +// The rules specified in the g_dbus_gvalue_to_gvariant() function are used - +// this function is essentially its reverse form. So, a #GVariant containing +// any basic or string array type will be converted to a #GValue containing a +// basic value or string array. Any other #GVariant (handle, variant, tuple, +// dict entry) will be converted to a #GValue containing that #GVariant. +// +// The conversion never fails - a valid #GValue is always returned in +// out_gvalue. +// +// The function takes the following parameters: +// +// - value: #GVariant. +// +// The function returns the following values: +// +// - outGvalue: return location pointing to a zero-filled (uninitialized) +// #GValue. +func DBusGVariantToGValue(value *glib.Variant) coreglib.Value { + var _arg1 *C.GVariant // out + var _arg2 C.GValue // in + + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + C.g_dbus_gvariant_to_gvalue(_arg1, &_arg2) + runtime.KeepAlive(value) + + var _outGvalue coreglib.Value // out + + _outGvalue = *coreglib.ValueFromNative(unsafe.Pointer((&_arg2))) + + return _outGvalue +} + +// DBusIsAddress checks if string is a D-Bus address +// (https://dbus.freedesktop.org/doc/dbus-specification.html#addresses). +// +// This doesn't check if string is actually supported by BusServer or +// BusConnection - use g_dbus_is_supported_address() to do more checks. +// +// The function takes the following parameters: +// +// - str: string. +// +// The function returns the following values: +// +// - ok: TRUE if string is a valid D-Bus address, FALSE otherwise. +func DBusIsAddress(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_is_address(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusIsErrorName: check whether string is a valid D-Bus error name. +// +// This function returns the same result as g_dbus_is_interface_name(), because +// D-Bus error names are defined to have exactly the same syntax as interface +// names. +// +// The function takes the following parameters: +// +// - str: string to check. +// +// The function returns the following values: +// +// - ok: TRUE if valid, FALSE otherwise. +func DBusIsErrorName(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_is_error_name(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusIsGUID checks if string is a D-Bus GUID. +// +// See the documentation for g_dbus_generate_guid() for more information about +// the format of a GUID. +// +// The function takes the following parameters: +// +// - str: string to check. +// +// The function returns the following values: +// +// - ok: TRUE if string is a GUID, FALSE otherwise. +func DBusIsGUID(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_is_guid(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusIsInterfaceName checks if string is a valid D-Bus interface name. +// +// The function takes the following parameters: +// +// - str: string to check. +// +// The function returns the following values: +// +// - ok: TRUE if valid, FALSE otherwise. +func DBusIsInterfaceName(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_is_interface_name(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusIsMemberName checks if string is a valid D-Bus member (e.g. signal or +// method) name. +// +// The function takes the following parameters: +// +// - str: string to check. +// +// The function returns the following values: +// +// - ok: TRUE if valid, FALSE otherwise. +func DBusIsMemberName(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_is_member_name(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusIsName checks if string is a valid D-Bus bus name (either unique or +// well-known). +// +// The function takes the following parameters: +// +// - str: string to check. +// +// The function returns the following values: +// +// - ok: TRUE if valid, FALSE otherwise. +func DBusIsName(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_is_name(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusIsSupportedAddress: like g_dbus_is_address() but also checks if the +// library supports the transports in string and that key/value pairs for +// each transport are valid. See the specification of the D-Bus address format +// (https://dbus.freedesktop.org/doc/dbus-specification.html#addresses). +// +// The function takes the following parameters: +// +// - str: string. +func DBusIsSupportedAddress(str string) error { + var _arg1 *C.gchar // out + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_dbus_is_supported_address(_arg1, &_cerr) + runtime.KeepAlive(str) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// DBusIsUniqueName checks if string is a valid D-Bus unique bus name. +// +// The function takes the following parameters: +// +// - str: string to check. +// +// The function returns the following values: +// +// - ok: TRUE if valid, FALSE otherwise. +func DBusIsUniqueName(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_is_unique_name(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusUnescapeObjectPath unescapes an string that was previously escaped with +// g_dbus_escape_object_path(). If the string is in a format that could not have +// been returned by g_dbus_escape_object_path(), this function returns NULL. +// +// Encoding alphanumeric characters which do not need to be encoded is not +// allowed (e.g _63 is not valid, the string should contain c instead). +// +// The function takes the following parameters: +// +// - s: string to unescape. +// +// The function returns the following values: +// +// - guint8s (optional): an unescaped version of s, or NULL if s is not a +// string returned from g_dbus_escape_object_path(). Free with g_free(). +func DBusUnescapeObjectPath(s string) []byte { + var _arg1 *C.gchar // out + var _cret *C.guint8 // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(s))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_unescape_object_path(_arg1) + runtime.KeepAlive(s) + + var _guint8s []byte // out + + if _cret != nil { + { + var i int + var z C.guint8 + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _guint8s = make([]byte, i) + for i := range src { + _guint8s[i] = byte(src[i]) + } + } + } + + return _guint8s +} + +// IOErrorFromErrno converts errno.h error codes into GIO error codes. +// +// The fallback value G_IO_ERROR_FAILED is returned for error codes not +// currently handled (but note that future GLib releases may return a more +// specific value instead). +// +// As errno is global and may be modified by intermediate function calls, +// you should save its value immediately after the call returns, and use the +// saved value instead of errno: +// +// int saved_errno; +// +// ret = read (blah); +// saved_errno = errno; +// +// g_io_error_from_errno (saved_errno);. +// +// The function takes the following parameters: +// +// - errNo: error number as defined in errno.h. +// +// The function returns the following values: +// +// - ioErrorEnum value for the given errno.h error number. +func IOErrorFromErrno(errNo int) IOErrorEnum { + var _arg1 C.gint // out + var _cret C.GIOErrorEnum // in + + _arg1 = C.gint(errNo) + + _cret = C.g_io_error_from_errno(_arg1) + runtime.KeepAlive(errNo) + + var _ioErrorEnum IOErrorEnum // out + + _ioErrorEnum = IOErrorEnum(_cret) + + return _ioErrorEnum +} + +// IOErrorFromFileError converts Error error codes into GIO error codes. +// +// The function takes the following parameters: +// +// - fileError: Error. +// +// The function returns the following values: +// +// - ioErrorEnum value for the given Error error value. +func IOErrorFromFileError(fileError glib.FileError) IOErrorEnum { + var _arg1 C.GFileError // out + var _cret C.GIOErrorEnum // in + + _arg1 = C.GFileError(fileError) + + _cret = C.g_io_error_from_file_error(_arg1) + runtime.KeepAlive(fileError) + + var _ioErrorEnum IOErrorEnum // out + + _ioErrorEnum = IOErrorEnum(_cret) + + return _ioErrorEnum +} + +// IOErrorQuark gets the GIO Error Quark. +// +// The function returns the following values: +// +// - quark: #GQuark. +func IOErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.g_io_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// IOModulesScanAllInDirectory scans all the modules in the specified directory, +// ensuring that any extension point implemented by a module is registered. +// +// This may not actually load and initialize all the types in each module, +// some modules may be lazily loaded and initialized when an extension point +// it implements is used with e.g. g_io_extension_point_get_extensions() or +// g_io_extension_point_get_extension_by_name(). +// +// If you need to guarantee that all types are loaded in all the modules, +// use g_io_modules_load_all_in_directory(). +// +// The function takes the following parameters: +// +// - dirname: pathname for a directory containing modules to scan. +func IOModulesScanAllInDirectory(dirname string) { + var _arg1 *C.char // out + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(dirname))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_io_modules_scan_all_in_directory(_arg1) + runtime.KeepAlive(dirname) +} + +// IOSchedulerCancelAllJobs cancels all cancellable I/O jobs. +// +// A job is cancellable if a #GCancellable was passed into +// g_io_scheduler_push_job(). +// +// Deprecated: You should never call this function, since you don't know how +// other libraries in your program might be making use of gioscheduler. +func IOSchedulerCancelAllJobs() { + C.g_io_scheduler_cancel_all_jobs() +} + +// NewPollableSource: utility method for InputStream and OutputStream +// implementations. Creates a new #GSource that expects a callback of type +// SourceFunc. The new source does not actually do anything on its own; +// use g_source_add_child_source() to add other sources to it to cause it to +// trigger. +// +// The function takes the following parameters: +// +// - pollableStream: stream associated with the new source. +// +// The function returns the following values: +// +// - source: new #GSource. +func NewPollableSource(pollableStream *coreglib.Object) *glib.Source { + var _arg1 *C.GObject // out + var _cret *C.GSource // in + + _arg1 = (*C.GObject)(unsafe.Pointer(pollableStream.Native())) + + _cret = C.g_pollable_source_new(_arg1) + runtime.KeepAlive(pollableStream) + + var _source *glib.Source // out + + _source = (*glib.Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// PollableSourceNewFull: utility method for InputStream and OutputStream +// implementations. Creates a new #GSource, as with g_pollable_source_new(), +// but also attaching child_source (with a dummy callback), and cancellable, +// if they are non-NULL. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable to attach. +// - pollableStream: stream associated with the new source. +// - childSource (optional): optional child source to attach. +// +// The function returns the following values: +// +// - source: new #GSource. +func PollableSourceNewFull(ctx context.Context, pollableStream *coreglib.Object, childSource *glib.Source) *glib.Source { + var _arg3 *C.GCancellable // out + var _arg1 C.gpointer // out + var _arg2 *C.GSource // out + var _cret *C.GSource // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gpointer(unsafe.Pointer(pollableStream.Native())) + if childSource != nil { + _arg2 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(childSource))) + } + + _cret = C.g_pollable_source_new_full(_arg1, _arg2, _arg3) + runtime.KeepAlive(ctx) + runtime.KeepAlive(pollableStream) + runtime.KeepAlive(childSource) + + var _source *glib.Source // out + + _source = (*glib.Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// PollableStreamRead tries to read from stream, as with g_input_stream_read() +// (if blocking is TRUE) or g_pollable_input_stream_read_nonblocking() (if +// blocking is FALSE). This can be used to more easily share code between +// blocking and non-blocking implementations of a method. +// +// If blocking is FALSE, then stream must be a InputStream for which +// g_pollable_input_stream_can_poll() returns TRUE, or else the behavior +// is undefined. If blocking is TRUE, then stream does not need to be a +// InputStream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - stream: Stream. +// - buffer to read data into. +// - blocking: whether to do blocking I/O. +// +// The function returns the following values: +// +// - gssize: number of bytes read, or -1 on error. +func PollableStreamRead(ctx context.Context, stream InputStreamer, buffer []byte, blocking bool) (int, error) { + var _arg5 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg2 *C.void // out + var _arg3 C.gsize + var _arg4 C.gboolean // out + var _cret C.gssize // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg3 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg2 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + if blocking { + _arg4 = C.TRUE + } + + _cret = C.g_pollable_stream_read(_arg1, unsafe.Pointer(_arg2), _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(buffer) + runtime.KeepAlive(blocking) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// PollableStreamWrite tries to write to stream, as with g_output_stream_write() +// (if blocking is TRUE) or g_pollable_output_stream_write_nonblocking() (if +// blocking is FALSE). This can be used to more easily share code between +// blocking and non-blocking implementations of a method. +// +// If blocking is FALSE, then stream must be a OutputStream for which +// g_pollable_output_stream_can_poll() returns TRUE or else the behavior +// is undefined. If blocking is TRUE, then stream does not need to be a +// OutputStream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - stream: Stream. +// - buffer: buffer containing the data to write. +// - blocking: whether to do blocking I/O. +// +// The function returns the following values: +// +// - gssize: number of bytes written, or -1 on error. +func PollableStreamWrite(ctx context.Context, stream OutputStreamer, buffer []byte, blocking bool) (int, error) { + var _arg5 *C.GCancellable // out + var _arg1 *C.GOutputStream // out + var _arg2 *C.void // out + var _arg3 C.gsize + var _arg4 C.gboolean // out + var _cret C.gssize // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg3 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg2 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + if blocking { + _arg4 = C.TRUE + } + + _cret = C.g_pollable_stream_write(_arg1, unsafe.Pointer(_arg2), _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(buffer) + runtime.KeepAlive(blocking) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// PollableStreamWriteAll tries to write count bytes to stream, as with +// g_output_stream_write_all(), but using g_pollable_stream_write() rather than +// g_output_stream_write(). +// +// On a successful write of count bytes, TRUE is returned, and bytes_written is +// set to count. +// +// If there is an error during the operation (including G_IO_ERROR_WOULD_BLOCK +// in the non-blocking case), FALSE is returned and error is set to indicate the +// error status, bytes_written is updated to contain the number of bytes written +// into the stream before the error occurred. +// +// As with g_pollable_stream_write(), if blocking is FALSE, then stream must be +// a OutputStream for which g_pollable_output_stream_can_poll() returns TRUE +// or else the behavior is undefined. If blocking is TRUE, then stream does not +// need to be a OutputStream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - stream: Stream. +// - buffer: buffer containing the data to write. +// - blocking: whether to do blocking I/O. +// +// The function returns the following values: +// +// - bytesWritten: location to store the number of bytes that was written to +// the stream. +func PollableStreamWriteAll(ctx context.Context, stream OutputStreamer, buffer []byte, blocking bool) (uint, error) { + var _arg6 *C.GCancellable // out + var _arg1 *C.GOutputStream // out + var _arg2 *C.void // out + var _arg3 C.gsize + var _arg4 C.gboolean // out + var _arg5 C.gsize // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg6 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg3 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg2 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + if blocking { + _arg4 = C.TRUE + } + + C.g_pollable_stream_write_all(_arg1, unsafe.Pointer(_arg2), _arg3, _arg4, &_arg5, _arg6, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(buffer) + runtime.KeepAlive(blocking) + + var _bytesWritten uint // out + var _goerr error // out + + _bytesWritten = uint(_arg5) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _goerr +} + +// ResourcesEnumerateChildren returns all the names of children at the specified +// path in the set of globally registered resources. The return result is a NULL +// terminated list of strings which should be released with g_strfreev(). +// +// lookup_flags controls the behaviour of the lookup. +// +// The function takes the following parameters: +// +// - path: pathname inside the resource. +// - lookupFlags: LookupFlags. +// +// The function returns the following values: +// +// - utf8s: array of constant strings. +func ResourcesEnumerateChildren(path string, lookupFlags ResourceLookupFlags) ([]string, error) { + var _arg1 *C.char // out + var _arg2 C.GResourceLookupFlags // out + var _cret **C.char // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResourceLookupFlags(lookupFlags) + + _cret = C.g_resources_enumerate_children(_arg1, _arg2, &_cerr) + runtime.KeepAlive(path) + runtime.KeepAlive(lookupFlags) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// ResourcesGetInfo looks for a file at the specified path in the set of +// globally registered resources and if found returns information about it. +// +// lookup_flags controls the behaviour of the lookup. +// +// The function takes the following parameters: +// +// - path: pathname inside the resource. +// - lookupFlags: LookupFlags. +// +// The function returns the following values: +// +// - size (optional): location to place the length of the contents of the +// file, or NULL if the length is not needed. +// - flags (optional): location to place the Flags about the file, or NULL if +// the flags are not needed. +func ResourcesGetInfo(path string, lookupFlags ResourceLookupFlags) (uint, uint32, error) { + var _arg1 *C.char // out + var _arg2 C.GResourceLookupFlags // out + var _arg3 C.gsize // in + var _arg4 C.guint32 // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResourceLookupFlags(lookupFlags) + + C.g_resources_get_info(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(path) + runtime.KeepAlive(lookupFlags) + + var _size uint // out + var _flags uint32 // out + var _goerr error // out + + _size = uint(_arg3) + _flags = uint32(_arg4) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _size, _flags, _goerr +} + +// ResourcesLookupData looks for a file at the specified path in the set of +// globally registered resources and returns a #GBytes that lets you directly +// access the data in memory. +// +// The data is always followed by a zero byte, so you can safely use the data as +// a C string. However, that byte is not included in the size of the GBytes. +// +// For uncompressed resource files this is a pointer directly into the resource +// bundle, which is typically in some readonly data section in the program +// binary. For compressed files we allocate memory on the heap and automatically +// uncompress the data. +// +// lookup_flags controls the behaviour of the lookup. +// +// The function takes the following parameters: +// +// - path: pathname inside the resource. +// - lookupFlags: LookupFlags. +// +// The function returns the following values: +// +// - bytes or NULL on error. Free the returned object with g_bytes_unref(). +func ResourcesLookupData(path string, lookupFlags ResourceLookupFlags) (*glib.Bytes, error) { + var _arg1 *C.char // out + var _arg2 C.GResourceLookupFlags // out + var _cret *C.GBytes // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResourceLookupFlags(lookupFlags) + + _cret = C.g_resources_lookup_data(_arg1, _arg2, &_cerr) + runtime.KeepAlive(path) + runtime.KeepAlive(lookupFlags) + + var _bytes *glib.Bytes // out + var _goerr error // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytes, _goerr +} + +// ResourcesOpenStream looks for a file at the specified path in the set of +// globally registered resources and returns a Stream that lets you read the +// data. +// +// lookup_flags controls the behaviour of the lookup. +// +// The function takes the following parameters: +// +// - path: pathname inside the resource. +// - lookupFlags: LookupFlags. +// +// The function returns the following values: +// +// - inputStream or NULL on error. Free the returned object with +// g_object_unref(). +func ResourcesOpenStream(path string, lookupFlags ResourceLookupFlags) (InputStreamer, error) { + var _arg1 *C.char // out + var _arg2 C.GResourceLookupFlags // out + var _cret *C.GInputStream // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResourceLookupFlags(lookupFlags) + + _cret = C.g_resources_open_stream(_arg1, _arg2, &_cerr) + runtime.KeepAlive(path) + runtime.KeepAlive(lookupFlags) + + var _inputStream InputStreamer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _inputStream, _goerr +} + +// ResourcesRegister registers the resource with the process-global set of +// resources. Once a resource is registered the files in it can be accessed with +// the global resource lookup functions like g_resources_lookup_data(). +// +// The function takes the following parameters: +// +// - resource: #GResource. +func ResourcesRegister(resource *Resource) { + var _arg1 *C.GResource // out + + _arg1 = (*C.GResource)(gextras.StructNative(unsafe.Pointer(resource))) + + C.g_resources_register(_arg1) + runtime.KeepAlive(resource) +} + +// ResourcesUnregister unregisters the resource from the process-global set of +// resources. +// +// The function takes the following parameters: +// +// - resource: #GResource. +func ResourcesUnregister(resource *Resource) { + var _arg1 *C.GResource // out + + _arg1 = (*C.GResource)(gextras.StructNative(unsafe.Pointer(resource))) + + C.g_resources_unregister(_arg1) + runtime.KeepAlive(resource) +} + +// SimpleAsyncReportGErrorInIdle reports an error in an idle function. Similar +// to g_simple_async_report_error_in_idle(), but takes a #GError rather than +// building a new one. +// +// Deprecated: Use g_task_report_error(). +// +// The function takes the following parameters: +// +// - object (optional) or NULL. +// - callback (optional): ReadyCallback. +// - err to report. +func SimpleAsyncReportGErrorInIdle(object *coreglib.Object, callback AsyncReadyCallback, err error) { + var _arg1 *C.GObject // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + var _arg4 *C.GError // out + + if object != nil { + _arg1 = (*C.GObject)(unsafe.Pointer(object.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + if err != nil { + _arg4 = (*C.GError)(gerror.New(err)) + } + + C.g_simple_async_report_gerror_in_idle(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(object) + runtime.KeepAlive(callback) + runtime.KeepAlive(err) +} + +// Action: GAction represents a single named action. +// +// The main interface to an action is that it can be activated with +// gio.Action.Activate(). This results in the 'activate' signal being emitted. +// An activation has a GVariant parameter (which may be NULL). The correct type +// for the parameter is determined by a static parameter type (which is given at +// construction time). +// +// An action may optionally have a state, in which case the state may be set +// with gio.Action.ChangeState(). This call takes a #GVariant. The correct +// type for the state is determined by a static state type (which is given at +// construction time). +// +// The state may have a hint associated with it, specifying its valid range. +// +// GAction is merely the interface to the concept of an action, as described +// above. Various implementations of actions exist, including gio.SimpleAction. +// +// In all cases, the implementing class is responsible for storing the name +// of the action, the parameter type, the enabled state, the optional state +// type and the state and emitting the appropriate signals when these change. +// The implementor is responsible for filtering calls to gio.Action.Activate() +// and gio.Action.ChangeState() for type safety and for the state being enabled. +// +// Probably the only useful thing to do with a GAction is to put it inside of a +// gio.SimpleActionGroup. +// +// Action wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Action struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Action)(nil) +) + +// Actioner describes Action's interface methods. +type Actioner interface { + coreglib.Objector + + // Activate activates the action. + Activate(parameter *glib.Variant) + // ChangeState: request for the state of action to be changed to value. + ChangeState(value *glib.Variant) + // Enabled checks if action is currently enabled. + Enabled() bool + // Name queries the name of action. + Name() string + // ParameterType queries the type of the parameter that must be given when + // activating action. + ParameterType() *glib.VariantType + // State queries the current state of action. + State() *glib.Variant + // StateHint requests a hint about the valid range of values for the state + // of action. + StateHint() *glib.Variant + // StateType queries the type of the state of action. + StateType() *glib.VariantType +} + +var _ Actioner = (*Action)(nil) + +func wrapAction(obj *coreglib.Object) *Action { + return &Action{ + Object: obj, + } +} + +func marshalAction(p uintptr) (interface{}, error) { + return wrapAction(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Activate activates the action. +// +// parameter must be the correct type of parameter for the action (ie: the +// parameter type given at construction time). If the parameter type was NULL +// then parameter must also be NULL. +// +// If the parameter GVariant is floating, it is consumed. +// +// The function takes the following parameters: +// +// - parameter (optional) to the activation. +func (action *Action) Activate(parameter *glib.Variant) { + var _arg0 *C.GAction // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + if parameter != nil { + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameter))) + } + + C.g_action_activate(_arg0, _arg1) + runtime.KeepAlive(action) + runtime.KeepAlive(parameter) +} + +// ChangeState: request for the state of action to be changed to value. +// +// The action must be stateful and value must be of the correct type. See +// g_action_get_state_type(). +// +// This call merely requests a change. The action may refuse to change +// its state or may change its state to something other than value. See +// g_action_get_state_hint(). +// +// If the value GVariant is floating, it is consumed. +// +// The function takes the following parameters: +// +// - value: new state. +func (action *Action) ChangeState(value *glib.Variant) { + var _arg0 *C.GAction // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + C.g_action_change_state(_arg0, _arg1) + runtime.KeepAlive(action) + runtime.KeepAlive(value) +} + +// Enabled checks if action is currently enabled. +// +// An action must be enabled in order to be activated or in order to have its +// state changed from outside callers. +// +// The function returns the following values: +// +// - ok: whether the action is enabled. +func (action *Action) Enabled() bool { + var _arg0 *C.GAction // out + var _cret C.gboolean // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C.g_action_get_enabled(_arg0) + runtime.KeepAlive(action) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Name queries the name of action. +// +// The function returns the following values: +// +// - utf8: name of the action. +func (action *Action) Name() string { + var _arg0 *C.GAction // out + var _cret *C.gchar // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C.g_action_get_name(_arg0) + runtime.KeepAlive(action) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// ParameterType queries the type of the parameter that must be given when +// activating action. +// +// When activating the action using g_action_activate(), the #GVariant given to +// that function must be of the type returned by this function. +// +// In the case that this function returns NULL, you must not give any #GVariant, +// but NULL instead. +// +// The function returns the following values: +// +// - variantType (optional): parameter type. +func (action *Action) ParameterType() *glib.VariantType { + var _arg0 *C.GAction // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C.g_action_get_parameter_type(_arg0) + runtime.KeepAlive(action) + + var _variantType *glib.VariantType // out + + if _cret != nil { + _variantType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _variantType +} + +// State queries the current state of action. +// +// If the action is not stateful then NULL will be returned. If the action +// is stateful then the type of the return value is the type given by +// g_action_get_state_type(). +// +// The return value (if non-NULL) should be freed with g_variant_unref() when it +// is no longer required. +// +// The function returns the following values: +// +// - variant (optional): current state of the action. +func (action *Action) State() *glib.Variant { + var _arg0 *C.GAction // out + var _cret *C.GVariant // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C.g_action_get_state(_arg0) + runtime.KeepAlive(action) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// StateHint requests a hint about the valid range of values for the state of +// action. +// +// If NULL is returned it either means that the action is not stateful or that +// there is no hint about the valid range of values for the state of the action. +// +// If a #GVariant array is returned then each item in the array is a possible +// value for the state. If a #GVariant pair (ie: two-tuple) is returned then the +// tuple specifies the inclusive lower and upper bound of valid values for the +// state. +// +// In any case, the information is merely a hint. It may be possible to have a +// state value outside of the hinted range and setting a value within the range +// may fail. +// +// The return value (if non-NULL) should be freed with g_variant_unref() when it +// is no longer required. +// +// The function returns the following values: +// +// - variant (optional): state range hint. +func (action *Action) StateHint() *glib.Variant { + var _arg0 *C.GAction // out + var _cret *C.GVariant // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C.g_action_get_state_hint(_arg0) + runtime.KeepAlive(action) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// StateType queries the type of the state of action. +// +// If the action is stateful (e.g. created with g_simple_action_new_stateful()) +// then this function returns the Type of the state. This is the type of the +// initial value given as the state. All calls to g_action_change_state() +// must give a #GVariant of this type and g_action_get_state() will return a +// #GVariant of the same type. +// +// If the action is not stateful (e.g. created with g_simple_action_new()) +// then this function will return NULL. In that case, g_action_get_state() will +// return NULL and you must not call g_action_change_state(). +// +// The function returns the following values: +// +// - variantType (optional): state type, if the action is stateful. +func (action *Action) StateType() *glib.VariantType { + var _arg0 *C.GAction // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C.g_action_get_state_type(_arg0) + runtime.KeepAlive(action) + + var _variantType *glib.VariantType // out + + if _cret != nil { + _variantType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _variantType +} + +// Activate activates the action. +// +// parameter must be the correct type of parameter for the action (ie: the +// parameter type given at construction time). If the parameter type was NULL +// then parameter must also be NULL. +// +// If the parameter GVariant is floating, it is consumed. +// +// The function takes the following parameters: +// +// - parameter (optional) to the activation. +func (action *Action) activate(parameter *glib.Variant) { + gclass := (*C.GActionInterface)(coreglib.PeekParentClass(action)) + fnarg := gclass.activate + + var _arg0 *C.GAction // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + if parameter != nil { + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameter))) + } + + C._gotk4_gio2_Action_virtual_activate(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(action) + runtime.KeepAlive(parameter) +} + +// changeState: request for the state of action to be changed to value. +// +// The action must be stateful and value must be of the correct type. See +// g_action_get_state_type(). +// +// This call merely requests a change. The action may refuse to change +// its state or may change its state to something other than value. See +// g_action_get_state_hint(). +// +// If the value GVariant is floating, it is consumed. +// +// The function takes the following parameters: +// +// - value: new state. +func (action *Action) changeState(value *glib.Variant) { + gclass := (*C.GActionInterface)(coreglib.PeekParentClass(action)) + fnarg := gclass.change_state + + var _arg0 *C.GAction // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + C._gotk4_gio2_Action_virtual_change_state(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(action) + runtime.KeepAlive(value) +} + +// Enabled checks if action is currently enabled. +// +// An action must be enabled in order to be activated or in order to have its +// state changed from outside callers. +// +// The function returns the following values: +// +// - ok: whether the action is enabled. +func (action *Action) enabled() bool { + gclass := (*C.GActionInterface)(coreglib.PeekParentClass(action)) + fnarg := gclass.get_enabled + + var _arg0 *C.GAction // out + var _cret C.gboolean // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C._gotk4_gio2_Action_virtual_get_enabled(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(action) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Name queries the name of action. +// +// The function returns the following values: +// +// - utf8: name of the action. +func (action *Action) name() string { + gclass := (*C.GActionInterface)(coreglib.PeekParentClass(action)) + fnarg := gclass.get_name + + var _arg0 *C.GAction // out + var _cret *C.gchar // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C._gotk4_gio2_Action_virtual_get_name(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(action) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// parameterType queries the type of the parameter that must be given when +// activating action. +// +// When activating the action using g_action_activate(), the #GVariant given to +// that function must be of the type returned by this function. +// +// In the case that this function returns NULL, you must not give any #GVariant, +// but NULL instead. +// +// The function returns the following values: +// +// - variantType (optional): parameter type. +func (action *Action) parameterType() *glib.VariantType { + gclass := (*C.GActionInterface)(coreglib.PeekParentClass(action)) + fnarg := gclass.get_parameter_type + + var _arg0 *C.GAction // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C._gotk4_gio2_Action_virtual_get_parameter_type(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(action) + + var _variantType *glib.VariantType // out + + if _cret != nil { + _variantType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _variantType +} + +// State queries the current state of action. +// +// If the action is not stateful then NULL will be returned. If the action +// is stateful then the type of the return value is the type given by +// g_action_get_state_type(). +// +// The return value (if non-NULL) should be freed with g_variant_unref() when it +// is no longer required. +// +// The function returns the following values: +// +// - variant (optional): current state of the action. +func (action *Action) state() *glib.Variant { + gclass := (*C.GActionInterface)(coreglib.PeekParentClass(action)) + fnarg := gclass.get_state + + var _arg0 *C.GAction // out + var _cret *C.GVariant // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C._gotk4_gio2_Action_virtual_get_state(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(action) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// stateHint requests a hint about the valid range of values for the state of +// action. +// +// If NULL is returned it either means that the action is not stateful or that +// there is no hint about the valid range of values for the state of the action. +// +// If a #GVariant array is returned then each item in the array is a possible +// value for the state. If a #GVariant pair (ie: two-tuple) is returned then the +// tuple specifies the inclusive lower and upper bound of valid values for the +// state. +// +// In any case, the information is merely a hint. It may be possible to have a +// state value outside of the hinted range and setting a value within the range +// may fail. +// +// The return value (if non-NULL) should be freed with g_variant_unref() when it +// is no longer required. +// +// The function returns the following values: +// +// - variant (optional): state range hint. +func (action *Action) stateHint() *glib.Variant { + gclass := (*C.GActionInterface)(coreglib.PeekParentClass(action)) + fnarg := gclass.get_state_hint + + var _arg0 *C.GAction // out + var _cret *C.GVariant // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C._gotk4_gio2_Action_virtual_get_state_hint(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(action) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// stateType queries the type of the state of action. +// +// If the action is stateful (e.g. created with g_simple_action_new_stateful()) +// then this function returns the Type of the state. This is the type of the +// initial value given as the state. All calls to g_action_change_state() +// must give a #GVariant of this type and g_action_get_state() will return a +// #GVariant of the same type. +// +// If the action is not stateful (e.g. created with g_simple_action_new()) +// then this function will return NULL. In that case, g_action_get_state() will +// return NULL and you must not call g_action_change_state(). +// +// The function returns the following values: +// +// - variantType (optional): state type, if the action is stateful. +func (action *Action) stateType() *glib.VariantType { + gclass := (*C.GActionInterface)(coreglib.PeekParentClass(action)) + fnarg := gclass.get_state_type + + var _arg0 *C.GAction // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + _cret = C._gotk4_gio2_Action_virtual_get_state_type(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(action) + + var _variantType *glib.VariantType // out + + if _cret != nil { + _variantType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _variantType +} + +// ActionNameIsValid checks if action_name is valid. +// +// action_name is valid if it consists only of alphanumeric characters, plus '-' +// and '.'. The empty string is not a valid action name. +// +// It is an error to call this function with a non-utf8 action_name. action_name +// must not be NULL. +// +// The function takes the following parameters: +// +// - actionName: potential action name. +// +// The function returns the following values: +// +// - ok: TRUE if action_name is valid. +func ActionNameIsValid(actionName string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_action_name_is_valid(_arg1) + runtime.KeepAlive(actionName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ActionParseDetailedName parses a detailed action name into its separate name +// and target components. +// +// Detailed action names can have three formats. +// +// The first format is used to represent an action name with no target value and +// consists of just an action name containing no whitespace nor the characters +// :, ( or ). For example: app.action. +// +// The second format is used to represent an action with a target value that is +// a non-empty string consisting only of alphanumerics, plus - and .. In that +// case, the action name and target value are separated by a double colon (::). +// For example: app.action::target. +// +// The third format is used to represent an action with any type of target +// value, including strings. The target value follows the action name, +// surrounded in parens. For example: app.action(42). The target value is +// parsed using g_variant_parse(). If a tuple-typed value is desired, it must +// be specified in the same way, resulting in two sets of parens, for example: +// app.action((1,2,3)). A string target can be specified this way as well: +// app.action('target'). For strings, this third format must be used if target +// value is empty or contains characters other than alphanumerics, - and .. +// +// If this function returns TRUE, a non-NULL value is guaranteed to be returned +// in action_name (if a pointer is passed in). A NULL value may still be +// returned in target_value, as the detailed_name may not contain a target. +// +// If returned, the #GVariant in target_value is guaranteed to not be floating. +// +// The function takes the following parameters: +// +// - detailedName: detailed action name. +// +// The function returns the following values: +// +// - actionName (optional): action name. +// - targetValue (optional): target value, or NULL for no target. +func ActionParseDetailedName(detailedName string) (string, *glib.Variant, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // in + var _arg3 *C.GVariant // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(detailedName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_action_parse_detailed_name(_arg1, &_arg2, &_arg3, &_cerr) + runtime.KeepAlive(detailedName) + + var _actionName string // out + var _targetValue *glib.Variant // out + var _goerr error // out + + if _arg2 != nil { + _actionName = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + if _arg3 != nil { + _targetValue = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_arg3))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_targetValue)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _actionName, _targetValue, _goerr +} + +// ActionPrintDetailedName formats a detailed action name from action_name and +// target_value. +// +// It is an error to call this function with an invalid action name. +// +// This function is the opposite of g_action_parse_detailed_name(). It will +// produce a string that can be parsed back to the action_name and target_value +// by that function. +// +// See that function for the types of strings that will be printed by this +// function. +// +// The function takes the following parameters: +// +// - actionName: valid action name. +// - targetValue (optional) target value, or NULL. +// +// The function returns the following values: +// +// - utf8: detailed format string. +func ActionPrintDetailedName(actionName string, targetValue *glib.Variant) string { + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + if targetValue != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(targetValue))) + } + + _cret = C.g_action_print_detailed_name(_arg1, _arg2) + runtime.KeepAlive(actionName) + runtime.KeepAlive(targetValue) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// ActionGroup: GActionGroup represents a group of actions. +// +// Actions can be used to expose functionality in a structured way, either from +// one part of a program to another, or to the outside world. Action groups are +// often used together with a GMenuModel that provides additional representation +// data for displaying the actions to the user, e.g. in a menu. +// +// The main way to interact with the actions in a GActionGroup is to activate +// them with gio.ActionGroup.ActivateAction(). Activating an action may require +// a GVariant parameter. The required type of the parameter can be inquired +// with gio.ActionGroup.GetActionParameterType(). Actions may be disabled, +// see gio.ActionGroup.GetActionEnabled(). Activating a disabled action has no +// effect. +// +// Actions may optionally have a state in the form of a #GVariant. The current +// state of an action can be inquired with gio.ActionGroup.GetActionState(). +// Activating a stateful action may change its state, but it is also possible to +// set the state by calling gio.ActionGroup.ChangeActionState(). +// +// As typical example, consider a text editing application which has an option +// to change the current font to 'bold'. A good way to represent this would be a +// stateful action, with a boolean state. Activating the action would toggle the +// state. +// +// Each action in the group has a unique name (which is a string). All method +// calls, except gio.ActionGroup.ListActions() take the name of an action as an +// argument. +// +// The GActionGroup API is meant to be the 'public' API to the action group. +// The calls here are exactly the interaction that 'external forces' (eg: UI, +// incoming D-Bus messages, etc.) are supposed to have with actions. 'Internal' +// APIs (ie: ones meant only to be accessed by the action group implementation) +// are found on subclasses. This is why you will find - for example - +// gio.ActionGroup.GetActionEnabled() but not an equivalent set() call. +// +// Signals are emitted on the action group in response to state changes on +// individual actions. +// +// Implementations of GActionGroup should provide implementations +// for the virtual functions gio.ActionGroup.ListActions() and +// gio.ActionGroup.QueryAction(). The other virtual functions should not +// be implemented - their "wrappers" are actually implemented with calls to +// gio.ActionGroup.QueryAction(). +// +// ActionGroup wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type ActionGroup struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ActionGroup)(nil) +) + +// ActionGrouper describes ActionGroup's interface methods. +type ActionGrouper interface { + coreglib.Objector + + // ActionAdded emits the Group::action-added signal on action_group. + ActionAdded(actionName string) + // ActionEnabledChanged emits the Group::action-enabled-changed signal on + // action_group. + ActionEnabledChanged(actionName string, enabled bool) + // ActionRemoved emits the Group::action-removed signal on action_group. + ActionRemoved(actionName string) + // ActionStateChanged emits the Group::action-state-changed signal on + // action_group. + ActionStateChanged(actionName string, state *glib.Variant) + // ActivateAction: activate the named action within action_group. + ActivateAction(actionName string, parameter *glib.Variant) + // ChangeActionState: request for the state of the named action within + // action_group to be changed to value. + ChangeActionState(actionName string, value *glib.Variant) + // ActionEnabled checks if the named action within action_group is currently + // enabled. + ActionEnabled(actionName string) bool + // ActionParameterType queries the type of the parameter that must be given + // when activating the named action within action_group. + ActionParameterType(actionName string) *glib.VariantType + // ActionState queries the current state of the named action within + // action_group. + ActionState(actionName string) *glib.Variant + // ActionStateHint requests a hint about the valid range of values for the + // state of the named action within action_group. + ActionStateHint(actionName string) *glib.Variant + // ActionStateType queries the type of the state of the named action within + // action_group. + ActionStateType(actionName string) *glib.VariantType + // HasAction checks if the named action exists within action_group. + HasAction(actionName string) bool + // ListActions lists the actions contained within action_group. + ListActions() []string + // QueryAction queries all aspects of the named action within an + // action_group. + QueryAction(actionName string) (enabled bool, parameterType, stateType *glib.VariantType, stateHint, state *glib.Variant, ok bool) + + // Action-added signals that a new action was just added to the group. + ConnectActionAdded(func(actionName string)) coreglib.SignalHandle + // Action-enabled-changed signals that the enabled status of the named + // action has changed. + ConnectActionEnabledChanged(func(actionName string, enabled bool)) coreglib.SignalHandle + // Action-removed signals that an action is just about to be removed from + // the group. + ConnectActionRemoved(func(actionName string)) coreglib.SignalHandle + // Action-state-changed signals that the state of the named action has + // changed. + ConnectActionStateChanged(func(actionName string, value *glib.Variant)) coreglib.SignalHandle +} + +var _ ActionGrouper = (*ActionGroup)(nil) + +func wrapActionGroup(obj *coreglib.Object) *ActionGroup { + return &ActionGroup{ + Object: obj, + } +} + +func marshalActionGroup(p uintptr) (interface{}, error) { + return wrapActionGroup(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectActionAdded signals that a new action was just added to the group. +// This signal is emitted after the action has been added and is now visible. +func (actionGroup *ActionGroup) ConnectActionAdded(f func(actionName string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(actionGroup, "action-added", false, unsafe.Pointer(C._gotk4_gio2_ActionGroup_ConnectActionAdded), f) +} + +// ConnectActionEnabledChanged signals that the enabled status of the named +// action has changed. +func (actionGroup *ActionGroup) ConnectActionEnabledChanged(f func(actionName string, enabled bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(actionGroup, "action-enabled-changed", false, unsafe.Pointer(C._gotk4_gio2_ActionGroup_ConnectActionEnabledChanged), f) +} + +// ConnectActionRemoved signals that an action is just about to be removed from +// the group. This signal is emitted before the action is removed, so the action +// is still visible and can be queried from the signal handler. +func (actionGroup *ActionGroup) ConnectActionRemoved(f func(actionName string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(actionGroup, "action-removed", false, unsafe.Pointer(C._gotk4_gio2_ActionGroup_ConnectActionRemoved), f) +} + +// ConnectActionStateChanged signals that the state of the named action has +// changed. +func (actionGroup *ActionGroup) ConnectActionStateChanged(f func(actionName string, value *glib.Variant)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(actionGroup, "action-state-changed", false, unsafe.Pointer(C._gotk4_gio2_ActionGroup_ConnectActionStateChanged), f) +} + +// ActionAdded emits the Group::action-added signal on action_group. +// +// This function should only be called by Group implementations. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +func (actionGroup *ActionGroup) ActionAdded(actionName string) { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_action_group_action_added(_arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) +} + +// ActionEnabledChanged emits the Group::action-enabled-changed signal on +// action_group. +// +// This function should only be called by Group implementations. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +// - enabled: whether or not the action is now enabled. +func (actionGroup *ActionGroup) ActionEnabledChanged(actionName string, enabled bool) { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + if enabled { + _arg2 = C.TRUE + } + + C.g_action_group_action_enabled_changed(_arg0, _arg1, _arg2) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + runtime.KeepAlive(enabled) +} + +// ActionRemoved emits the Group::action-removed signal on action_group. +// +// This function should only be called by Group implementations. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +func (actionGroup *ActionGroup) ActionRemoved(actionName string) { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_action_group_action_removed(_arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) +} + +// ActionStateChanged emits the Group::action-state-changed signal on +// action_group. +// +// This function should only be called by Group implementations. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +// - state: new state of the named action. +func (actionGroup *ActionGroup) ActionStateChanged(actionName string, state *glib.Variant) { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(state))) + + C.g_action_group_action_state_changed(_arg0, _arg1, _arg2) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + runtime.KeepAlive(state) +} + +// ActivateAction: activate the named action within action_group. +// +// If the action is expecting a parameter, then the correct type of parameter +// must be given as parameter. If the action is expecting no parameters then +// parameter must be NULL. See g_action_group_get_action_parameter_type(). +// +// If the Group implementation supports asynchronous remote activation over +// D-Bus, this call may return before the relevant D-Bus traffic has been sent, +// or any replies have been received. In order to block on such asynchronous +// activation calls, g_dbus_connection_flush() should be called prior to the +// code, which depends on the result of the action activation. Without flushing +// the D-Bus connection, there is no guarantee that the action would have been +// activated. +// +// The following code which runs in a remote app instance, shows an example +// of a "quit" action being activated on the primary app instance over D-Bus. +// Here g_dbus_connection_flush() is called before exit(). Without +// g_dbus_connection_flush(), the "quit" action may fail to be activated on the +// primary instance. +// +// // call "quit" action on primary instance +// g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL); +// +// // make sure the action is activated now +// g_dbus_connection_flush (...); +// +// g_debug ("application has been terminated. exiting."); +// +// exit (0);. +// +// The function takes the following parameters: +// +// - actionName: name of the action to activate. +// - parameter (optional) parameters to the activation. +func (actionGroup *ActionGroup) ActivateAction(actionName string, parameter *glib.Variant) { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + if parameter != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameter))) + } + + C.g_action_group_activate_action(_arg0, _arg1, _arg2) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + runtime.KeepAlive(parameter) +} + +// ChangeActionState: request for the state of the named action within +// action_group to be changed to value. +// +// The action must be stateful and value must be of the correct type. See +// g_action_group_get_action_state_type(). +// +// This call merely requests a change. The action may refuse to change +// its state or may change its state to something other than value. See +// g_action_group_get_action_state_hint(). +// +// If the value GVariant is floating, it is consumed. +// +// The function takes the following parameters: +// +// - actionName: name of the action to request the change on. +// - value: new state. +func (actionGroup *ActionGroup) ChangeActionState(actionName string, value *glib.Variant) { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + C.g_action_group_change_action_state(_arg0, _arg1, _arg2) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + runtime.KeepAlive(value) +} + +// ActionEnabled checks if the named action within action_group is currently +// enabled. +// +// An action must be enabled in order to be activated or in order to have its +// state changed from outside callers. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - ok: whether or not the action is currently enabled. +func (actionGroup *ActionGroup) ActionEnabled(actionName string) bool { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_action_group_get_action_enabled(_arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ActionParameterType queries the type of the parameter that must be given when +// activating the named action within action_group. +// +// When activating the action using g_action_group_activate_action(), +// the #GVariant given to that function must be of the type returned by this +// function. +// +// In the case that this function returns NULL, you must not give any #GVariant, +// but NULL instead. +// +// The parameter type of a particular action will never change but it is +// possible for an action to be removed and for a new action to be added with +// the same name but a different parameter type. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - variantType (optional): parameter type. +func (actionGroup *ActionGroup) ActionParameterType(actionName string) *glib.VariantType { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_action_group_get_action_parameter_type(_arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _variantType *glib.VariantType // out + + if _cret != nil { + _variantType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _variantType +} + +// ActionState queries the current state of the named action within +// action_group. +// +// If the action is not stateful then NULL will be returned. If the action +// is stateful then the type of the return value is the type given by +// g_action_group_get_action_state_type(). +// +// The return value (if non-NULL) should be freed with g_variant_unref() when it +// is no longer required. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - variant (optional): current state of the action. +func (actionGroup *ActionGroup) ActionState(actionName string) *glib.Variant { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_action_group_get_action_state(_arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// ActionStateHint requests a hint about the valid range of values for the state +// of the named action within action_group. +// +// If NULL is returned it either means that the action is not stateful or that +// there is no hint about the valid range of values for the state of the action. +// +// If a #GVariant array is returned then each item in the array is a possible +// value for the state. If a #GVariant pair (ie: two-tuple) is returned then the +// tuple specifies the inclusive lower and upper bound of valid values for the +// state. +// +// In any case, the information is merely a hint. It may be possible to have a +// state value outside of the hinted range and setting a value within the range +// may fail. +// +// The return value (if non-NULL) should be freed with g_variant_unref() when it +// is no longer required. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - variant (optional): state range hint. +func (actionGroup *ActionGroup) ActionStateHint(actionName string) *glib.Variant { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_action_group_get_action_state_hint(_arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// ActionStateType queries the type of the state of the named action within +// action_group. +// +// If the action is stateful then this function returns the Type of the state. +// All calls to g_action_group_change_action_state() must give a #GVariant of +// this type and g_action_group_get_action_state() will return a #GVariant of +// the same type. +// +// If the action is not stateful then this function will return NULL. In that +// case, g_action_group_get_action_state() will return NULL and you must not +// call g_action_group_change_action_state(). +// +// The state type of a particular action will never change but it is possible +// for an action to be removed and for a new action to be added with the same +// name but a different state type. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - variantType (optional): state type, if the action is stateful. +func (actionGroup *ActionGroup) ActionStateType(actionName string) *glib.VariantType { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_action_group_get_action_state_type(_arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _variantType *glib.VariantType // out + + if _cret != nil { + _variantType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _variantType +} + +// HasAction checks if the named action exists within action_group. +// +// The function takes the following parameters: +// +// - actionName: name of the action to check for. +// +// The function returns the following values: +// +// - ok: whether the named action exists. +func (actionGroup *ActionGroup) HasAction(actionName string) bool { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_action_group_has_action(_arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ListActions lists the actions contained within action_group. +// +// The caller is responsible for freeing the list with g_strfreev() when it is +// no longer required. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of the names of the actions in the group. +func (actionGroup *ActionGroup) ListActions() []string { + var _arg0 *C.GActionGroup // out + var _cret **C.gchar // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + + _cret = C.g_action_group_list_actions(_arg0) + runtime.KeepAlive(actionGroup) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// QueryAction queries all aspects of the named action within an action_group. +// +// This function acquires the information available from +// g_action_group_has_action(), g_action_group_get_action_enabled(), +// g_action_group_get_action_parameter_type(), +// g_action_group_get_action_state_type(), +// g_action_group_get_action_state_hint() and g_action_group_get_action_state() +// with a single function call. +// +// This provides two main benefits. +// +// The first is the improvement in efficiency that comes with not having to +// perform repeated lookups of the action in order to discover different things +// about it. The second is that implementing Group can now be done by only +// overriding this one virtual function. +// +// The interface provides a default implementation of this function that +// calls the individual functions, as required, to fetch the information. +// The interface also provides default implementations of those functions that +// call this function. All implementations, therefore, must override either this +// function or all of the others. +// +// If the action exists, TRUE is returned and any of the requested fields (as +// indicated by having a non-NULL reference passed in) are filled. If the action +// doesn't exist, FALSE is returned and the fields may or may not have been +// modified. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +// +// The function returns the following values: +// +// - enabled: if the action is presently enabled. +// - parameterType (optional): parameter type, or NULL if none needed. +// - stateType (optional): state type, or NULL if stateless. +// - stateHint (optional): state hint, or NULL if none. +// - state (optional): current state, or NULL if stateless. +// - ok: TRUE if the action exists, else FALSE. +func (actionGroup *ActionGroup) QueryAction(actionName string) (enabled bool, parameterType, stateType *glib.VariantType, stateHint, state *glib.Variant, ok bool) { + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 C.gboolean // in + var _arg3 *C.GVariantType // in + var _arg4 *C.GVariantType // in + var _arg5 *C.GVariant // in + var _arg6 *C.GVariant // in + var _cret C.gboolean // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_action_group_query_action(_arg0, _arg1, &_arg2, &_arg3, &_arg4, &_arg5, &_arg6) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _enabled bool // out + var _parameterType *glib.VariantType // out + var _stateType *glib.VariantType // out + var _stateHint *glib.Variant // out + var _state *glib.Variant // out + var _ok bool // out + + if _arg2 != 0 { + _enabled = true + } + if _arg3 != nil { + _parameterType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_arg3))) + } + if _arg4 != nil { + _stateType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_arg4))) + } + if _arg5 != nil { + _stateHint = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_arg5))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_stateHint)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + if _arg6 != nil { + _state = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_arg6))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_state)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + if _cret != 0 { + _ok = true + } + + return _enabled, _parameterType, _stateType, _stateHint, _state, _ok +} + +// actionAdded emits the Group::action-added signal on action_group. +// +// This function should only be called by Group implementations. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +func (actionGroup *ActionGroup) actionAdded(actionName string) { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.action_added + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_ActionGroup_virtual_action_added(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) +} + +// actionEnabledChanged emits the Group::action-enabled-changed signal on +// action_group. +// +// This function should only be called by Group implementations. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +// - enabled: whether or not the action is now enabled. +func (actionGroup *ActionGroup) actionEnabledChanged(actionName string, enabled bool) { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.action_enabled_changed + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + if enabled { + _arg2 = C.TRUE + } + + C._gotk4_gio2_ActionGroup_virtual_action_enabled_changed(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + runtime.KeepAlive(enabled) +} + +// actionRemoved emits the Group::action-removed signal on action_group. +// +// This function should only be called by Group implementations. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +func (actionGroup *ActionGroup) actionRemoved(actionName string) { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.action_removed + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_ActionGroup_virtual_action_removed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) +} + +// actionStateChanged emits the Group::action-state-changed signal on +// action_group. +// +// This function should only be called by Group implementations. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +// - state: new state of the named action. +func (actionGroup *ActionGroup) actionStateChanged(actionName string, state *glib.Variant) { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.action_state_changed + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(state))) + + C._gotk4_gio2_ActionGroup_virtual_action_state_changed(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + runtime.KeepAlive(state) +} + +// activateAction: activate the named action within action_group. +// +// If the action is expecting a parameter, then the correct type of parameter +// must be given as parameter. If the action is expecting no parameters then +// parameter must be NULL. See g_action_group_get_action_parameter_type(). +// +// If the Group implementation supports asynchronous remote activation over +// D-Bus, this call may return before the relevant D-Bus traffic has been sent, +// or any replies have been received. In order to block on such asynchronous +// activation calls, g_dbus_connection_flush() should be called prior to the +// code, which depends on the result of the action activation. Without flushing +// the D-Bus connection, there is no guarantee that the action would have been +// activated. +// +// The following code which runs in a remote app instance, shows an example +// of a "quit" action being activated on the primary app instance over D-Bus. +// Here g_dbus_connection_flush() is called before exit(). Without +// g_dbus_connection_flush(), the "quit" action may fail to be activated on the +// primary instance. +// +// // call "quit" action on primary instance +// g_action_group_activate_action (G_ACTION_GROUP (app), "quit", NULL); +// +// // make sure the action is activated now +// g_dbus_connection_flush (...); +// +// g_debug ("application has been terminated. exiting."); +// +// exit (0);. +// +// The function takes the following parameters: +// +// - actionName: name of the action to activate. +// - parameter (optional) parameters to the activation. +func (actionGroup *ActionGroup) activateAction(actionName string, parameter *glib.Variant) { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.activate_action + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + if parameter != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameter))) + } + + C._gotk4_gio2_ActionGroup_virtual_activate_action(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + runtime.KeepAlive(parameter) +} + +// changeActionState: request for the state of the named action within +// action_group to be changed to value. +// +// The action must be stateful and value must be of the correct type. See +// g_action_group_get_action_state_type(). +// +// This call merely requests a change. The action may refuse to change +// its state or may change its state to something other than value. See +// g_action_group_get_action_state_hint(). +// +// If the value GVariant is floating, it is consumed. +// +// The function takes the following parameters: +// +// - actionName: name of the action to request the change on. +// - value: new state. +func (actionGroup *ActionGroup) changeActionState(actionName string, value *glib.Variant) { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.change_action_state + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + C._gotk4_gio2_ActionGroup_virtual_change_action_state(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + runtime.KeepAlive(value) +} + +// actionEnabled checks if the named action within action_group is currently +// enabled. +// +// An action must be enabled in order to be activated or in order to have its +// state changed from outside callers. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - ok: whether or not the action is currently enabled. +func (actionGroup *ActionGroup) actionEnabled(actionName string) bool { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.get_action_enabled + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_ActionGroup_virtual_get_action_enabled(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// actionParameterType queries the type of the parameter that must be given when +// activating the named action within action_group. +// +// When activating the action using g_action_group_activate_action(), +// the #GVariant given to that function must be of the type returned by this +// function. +// +// In the case that this function returns NULL, you must not give any #GVariant, +// but NULL instead. +// +// The parameter type of a particular action will never change but it is +// possible for an action to be removed and for a new action to be added with +// the same name but a different parameter type. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - variantType (optional): parameter type. +func (actionGroup *ActionGroup) actionParameterType(actionName string) *glib.VariantType { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.get_action_parameter_type + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_ActionGroup_virtual_get_action_parameter_type(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _variantType *glib.VariantType // out + + if _cret != nil { + _variantType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _variantType +} + +// actionState queries the current state of the named action within +// action_group. +// +// If the action is not stateful then NULL will be returned. If the action +// is stateful then the type of the return value is the type given by +// g_action_group_get_action_state_type(). +// +// The return value (if non-NULL) should be freed with g_variant_unref() when it +// is no longer required. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - variant (optional): current state of the action. +func (actionGroup *ActionGroup) actionState(actionName string) *glib.Variant { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.get_action_state + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_ActionGroup_virtual_get_action_state(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// actionStateHint requests a hint about the valid range of values for the state +// of the named action within action_group. +// +// If NULL is returned it either means that the action is not stateful or that +// there is no hint about the valid range of values for the state of the action. +// +// If a #GVariant array is returned then each item in the array is a possible +// value for the state. If a #GVariant pair (ie: two-tuple) is returned then the +// tuple specifies the inclusive lower and upper bound of valid values for the +// state. +// +// In any case, the information is merely a hint. It may be possible to have a +// state value outside of the hinted range and setting a value within the range +// may fail. +// +// The return value (if non-NULL) should be freed with g_variant_unref() when it +// is no longer required. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - variant (optional): state range hint. +func (actionGroup *ActionGroup) actionStateHint(actionName string) *glib.Variant { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.get_action_state_hint + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_ActionGroup_virtual_get_action_state_hint(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// actionStateType queries the type of the state of the named action within +// action_group. +// +// If the action is stateful then this function returns the Type of the state. +// All calls to g_action_group_change_action_state() must give a #GVariant of +// this type and g_action_group_get_action_state() will return a #GVariant of +// the same type. +// +// If the action is not stateful then this function will return NULL. In that +// case, g_action_group_get_action_state() will return NULL and you must not +// call g_action_group_change_action_state(). +// +// The state type of a particular action will never change but it is possible +// for an action to be removed and for a new action to be added with the same +// name but a different state type. +// +// The function takes the following parameters: +// +// - actionName: name of the action to query. +// +// The function returns the following values: +// +// - variantType (optional): state type, if the action is stateful. +func (actionGroup *ActionGroup) actionStateType(actionName string) *glib.VariantType { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.get_action_state_type + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_ActionGroup_virtual_get_action_state_type(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _variantType *glib.VariantType // out + + if _cret != nil { + _variantType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + } + + return _variantType +} + +// hasAction checks if the named action exists within action_group. +// +// The function takes the following parameters: +// +// - actionName: name of the action to check for. +// +// The function returns the following values: +// +// - ok: whether the named action exists. +func (actionGroup *ActionGroup) hasAction(actionName string) bool { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.has_action + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_ActionGroup_virtual_has_action(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// listActions lists the actions contained within action_group. +// +// The caller is responsible for freeing the list with g_strfreev() when it is +// no longer required. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of the names of the actions in the group. +func (actionGroup *ActionGroup) listActions() []string { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.list_actions + + var _arg0 *C.GActionGroup // out + var _cret **C.gchar // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + + _cret = C._gotk4_gio2_ActionGroup_virtual_list_actions(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(actionGroup) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// queryAction queries all aspects of the named action within an action_group. +// +// This function acquires the information available from +// g_action_group_has_action(), g_action_group_get_action_enabled(), +// g_action_group_get_action_parameter_type(), +// g_action_group_get_action_state_type(), +// g_action_group_get_action_state_hint() and g_action_group_get_action_state() +// with a single function call. +// +// This provides two main benefits. +// +// The first is the improvement in efficiency that comes with not having to +// perform repeated lookups of the action in order to discover different things +// about it. The second is that implementing Group can now be done by only +// overriding this one virtual function. +// +// The interface provides a default implementation of this function that +// calls the individual functions, as required, to fetch the information. +// The interface also provides default implementations of those functions that +// call this function. All implementations, therefore, must override either this +// function or all of the others. +// +// If the action exists, TRUE is returned and any of the requested fields (as +// indicated by having a non-NULL reference passed in) are filled. If the action +// doesn't exist, FALSE is returned and the fields may or may not have been +// modified. +// +// The function takes the following parameters: +// +// - actionName: name of an action in the group. +// +// The function returns the following values: +// +// - enabled: if the action is presently enabled. +// - parameterType (optional): parameter type, or NULL if none needed. +// - stateType (optional): state type, or NULL if stateless. +// - stateHint (optional): state hint, or NULL if none. +// - state (optional): current state, or NULL if stateless. +// - ok: TRUE if the action exists, else FALSE. +func (actionGroup *ActionGroup) queryAction(actionName string) (enabled bool, parameterType, stateType *glib.VariantType, stateHint, state *glib.Variant, ok bool) { + gclass := (*C.GActionGroupInterface)(coreglib.PeekParentClass(actionGroup)) + fnarg := gclass.query_action + + var _arg0 *C.GActionGroup // out + var _arg1 *C.gchar // out + var _arg2 C.gboolean // in + var _arg3 *C.GVariantType // in + var _arg4 *C.GVariantType // in + var _arg5 *C.GVariant // in + var _arg6 *C.GVariant // in + var _cret C.gboolean // in + + _arg0 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_ActionGroup_virtual_query_action(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2, &_arg3, &_arg4, &_arg5, &_arg6) + runtime.KeepAlive(actionGroup) + runtime.KeepAlive(actionName) + + var _enabled bool // out + var _parameterType *glib.VariantType // out + var _stateType *glib.VariantType // out + var _stateHint *glib.Variant // out + var _state *glib.Variant // out + var _ok bool // out + + if _arg2 != 0 { + _enabled = true + } + if _arg3 != nil { + _parameterType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_arg3))) + } + if _arg4 != nil { + _stateType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_arg4))) + } + if _arg5 != nil { + _stateHint = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_arg5))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_stateHint)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + if _arg6 != nil { + _state = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_arg6))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_state)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + if _cret != 0 { + _ok = true + } + + return _enabled, _parameterType, _stateType, _stateHint, _state, _ok +} + +// ActionMap: GActionMap is an interface for action containers. +// +// The GActionMap interface is implemented by gio.ActionGroup implementations +// that operate by containing a number of named gio.Action instances, such as +// gio.SimpleActionGroup. +// +// One useful application of this interface is to map the names of actions from +// various action groups to unique, prefixed names (e.g. by prepending "app." or +// "win."). This is the motivation for the 'Map' part of the interface name. +// +// ActionMap wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type ActionMap struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ActionMap)(nil) +) + +// ActionMapper describes ActionMap's interface methods. +type ActionMapper interface { + coreglib.Objector + + // AddAction adds an action to the action_map. + AddAction(action Actioner) + // AddActionEntries: convenience function for creating multiple Action + // instances and adding them to a Map. + AddActionEntries(entries []ActionEntry, userData unsafe.Pointer) + // LookupAction looks up the action with the name action_name in action_map. + LookupAction(actionName string) *Action + // RemoveAction removes the named action from the action map. + RemoveAction(actionName string) + // RemoveActionEntries: remove actions from a Map. + RemoveActionEntries(entries []ActionEntry) +} + +var _ ActionMapper = (*ActionMap)(nil) + +func wrapActionMap(obj *coreglib.Object) *ActionMap { + return &ActionMap{ + Object: obj, + } +} + +func marshalActionMap(p uintptr) (interface{}, error) { + return wrapActionMap(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// AddAction adds an action to the action_map. +// +// If the action map already contains an action with the same name as action +// then the old action is dropped from the action map. +// +// The action map takes its own reference on action. +// +// The function takes the following parameters: +// +// - action: #GAction. +func (actionMap *ActionMap) AddAction(action Actioner) { + var _arg0 *C.GActionMap // out + var _arg1 *C.GAction // out + + _arg0 = (*C.GActionMap)(unsafe.Pointer(coreglib.InternObject(actionMap).Native())) + _arg1 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + C.g_action_map_add_action(_arg0, _arg1) + runtime.KeepAlive(actionMap) + runtime.KeepAlive(action) +} + +// AddActionEntries: convenience function for creating multiple Action instances +// and adding them to a Map. +// +// Each action is constructed as per one Entry. +// +// static void +// activate_quit (GSimpleAction *simple, +// GVariant *parameter, +// gpointer user_data) +// { +// exit (0); +// } +// +// static void +// activate_print_string (GSimpleAction *simple, +// GVariant *parameter, +// gpointer user_data) +// { +// g_print ("s\n", g_variant_get_string (parameter, NULL)); +// } +// +// static GActionGroup * +// create_action_group (void) +// { +// const GActionEntry entries[] = { +// { "quit", activate_quit }, +// { "print-string", activate_print_string, "s" } +// }; +// GSimpleActionGroup *group; +// +// group = g_simple_action_group_new (); +// g_action_map_add_action_entries (G_ACTION_MAP (group), entries, G_N_ELEMENTS (entries), NULL); +// +// return G_ACTION_GROUP (group); +// }. +// +// The function takes the following parameters: +// +// - entries: pointer to the first item in an array of Entry structs. +// - userData (optional): user data for signal connections. +func (actionMap *ActionMap) AddActionEntries(entries []ActionEntry, userData unsafe.Pointer) { + var _arg0 *C.GActionMap // out + var _arg1 *C.GActionEntry // out + var _arg2 C.gint + var _arg3 C.gpointer // out + + _arg0 = (*C.GActionMap)(unsafe.Pointer(coreglib.InternObject(actionMap).Native())) + _arg2 = (C.gint)(len(entries)) + _arg1 = (*C.GActionEntry)(C.calloc(C.size_t(len(entries)), C.size_t(C.sizeof_GActionEntry))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GActionEntry)(_arg1), len(entries)) + for i := range entries { + out[i] = *(*C.GActionEntry)(gextras.StructNative(unsafe.Pointer((&entries[i])))) + } + } + _arg3 = (C.gpointer)(unsafe.Pointer(userData)) + + C.g_action_map_add_action_entries(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(actionMap) + runtime.KeepAlive(entries) + runtime.KeepAlive(userData) +} + +// LookupAction looks up the action with the name action_name in action_map. +// +// If no such action exists, returns NULL. +// +// The function takes the following parameters: +// +// - actionName: name of an action. +// +// The function returns the following values: +// +// - action (optional) or NULL. +func (actionMap *ActionMap) LookupAction(actionName string) *Action { + var _arg0 *C.GActionMap // out + var _arg1 *C.gchar // out + var _cret *C.GAction // in + + _arg0 = (*C.GActionMap)(unsafe.Pointer(coreglib.InternObject(actionMap).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_action_map_lookup_action(_arg0, _arg1) + runtime.KeepAlive(actionMap) + runtime.KeepAlive(actionName) + + var _action *Action // out + + if _cret != nil { + _action = wrapAction(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _action +} + +// RemoveAction removes the named action from the action map. +// +// If no action of this name is in the map then nothing happens. +// +// The function takes the following parameters: +// +// - actionName: name of the action. +func (actionMap *ActionMap) RemoveAction(actionName string) { + var _arg0 *C.GActionMap // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GActionMap)(unsafe.Pointer(coreglib.InternObject(actionMap).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_action_map_remove_action(_arg0, _arg1) + runtime.KeepAlive(actionMap) + runtime.KeepAlive(actionName) +} + +// RemoveActionEntries: remove actions from a Map. This is meant as the reverse +// of g_action_map_add_action_entries(). +// +// static const GActionEntry entries[] = { +// { "quit", activate_quit }, +// { "print-string", activate_print_string, "s" } +// }; +// +// void +// add_actions (GActionMap *map) +// { +// g_action_map_add_action_entries (map, entries, G_N_ELEMENTS (entries), NULL); +// } +// +// void +// remove_actions (GActionMap *map) +// { +// g_action_map_remove_action_entries (map, entries, G_N_ELEMENTS (entries)); +// }. +// +// The function takes the following parameters: +// +// - entries: pointer to the first item in an array of Entry structs. +func (actionMap *ActionMap) RemoveActionEntries(entries []ActionEntry) { + var _arg0 *C.GActionMap // out + var _arg1 *C.GActionEntry // out + var _arg2 C.gint + + _arg0 = (*C.GActionMap)(unsafe.Pointer(coreglib.InternObject(actionMap).Native())) + _arg2 = (C.gint)(len(entries)) + _arg1 = (*C.GActionEntry)(C.calloc(C.size_t(len(entries)), C.size_t(C.sizeof_GActionEntry))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GActionEntry)(_arg1), len(entries)) + for i := range entries { + out[i] = *(*C.GActionEntry)(gextras.StructNative(unsafe.Pointer((&entries[i])))) + } + } + + C.g_action_map_remove_action_entries(_arg0, _arg1, _arg2) + runtime.KeepAlive(actionMap) + runtime.KeepAlive(entries) +} + +// addAction adds an action to the action_map. +// +// If the action map already contains an action with the same name as action +// then the old action is dropped from the action map. +// +// The action map takes its own reference on action. +// +// The function takes the following parameters: +// +// - action: #GAction. +func (actionMap *ActionMap) addAction(action Actioner) { + gclass := (*C.GActionMapInterface)(coreglib.PeekParentClass(actionMap)) + fnarg := gclass.add_action + + var _arg0 *C.GActionMap // out + var _arg1 *C.GAction // out + + _arg0 = (*C.GActionMap)(unsafe.Pointer(coreglib.InternObject(actionMap).Native())) + _arg1 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + C._gotk4_gio2_ActionMap_virtual_add_action(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionMap) + runtime.KeepAlive(action) +} + +// lookupAction looks up the action with the name action_name in action_map. +// +// If no such action exists, returns NULL. +// +// The function takes the following parameters: +// +// - actionName: name of an action. +// +// The function returns the following values: +// +// - action (optional) or NULL. +func (actionMap *ActionMap) lookupAction(actionName string) *Action { + gclass := (*C.GActionMapInterface)(coreglib.PeekParentClass(actionMap)) + fnarg := gclass.lookup_action + + var _arg0 *C.GActionMap // out + var _arg1 *C.gchar // out + var _cret *C.GAction // in + + _arg0 = (*C.GActionMap)(unsafe.Pointer(coreglib.InternObject(actionMap).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_ActionMap_virtual_lookup_action(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionMap) + runtime.KeepAlive(actionName) + + var _action *Action // out + + if _cret != nil { + _action = wrapAction(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _action +} + +// removeAction removes the named action from the action map. +// +// If no action of this name is in the map then nothing happens. +// +// The function takes the following parameters: +// +// - actionName: name of the action. +func (actionMap *ActionMap) removeAction(actionName string) { + gclass := (*C.GActionMapInterface)(coreglib.PeekParentClass(actionMap)) + fnarg := gclass.remove_action + + var _arg0 *C.GActionMap // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GActionMap)(unsafe.Pointer(coreglib.InternObject(actionMap).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_ActionMap_virtual_remove_action(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionMap) + runtime.KeepAlive(actionName) +} + +// AppInfo: information about an installed application and methods to launch it +// (with file arguments). +// +// GAppInfo and GAppLaunchContext are used for describing and launching +// applications installed on the system. +// +// As of GLib 2.20, URIs will always be converted to POSIX paths (using +// gio.File.GetPath()) when using gio.AppInfo.Launch() even if the application +// requested an URI and not a POSIX path. For example for a desktop-file based +// application with Exec key totem U and a single URI, sftp://foo/file.avi, +// then /home/user/.gvfs/sftp on foo/file.avi will be passed. This will only +// work if a set of suitable GIO extensions (such as GVfs 2.26 compiled with +// FUSE support), is available and operational; if this is not the case, the URI +// will be passed unmodified to the application. Some URIs, such as mailto:, +// of course cannot be mapped to a POSIX path (in GVfs there's no FUSE mount for +// it); such URIs will be passed unmodified to the application. +// +// Specifically for GVfs 2.26 and later, the POSIX URI will be mapped back +// to the GIO URI in the gio.File constructors (since GVfs implements the +// GVfs extension point). As such, if the application needs to examine +// the URI, it needs to use gio.File.GetURI() or similar on gio.File. +// In other words, an application cannot assume that the URI passed to e.g. +// gio.File().NewForCommandlineArg is equal to the result of gio.File.GetURI(). +// The following snippet illustrates this: +// +// GFile *f; +// char *uri; +// +// file = g_file_new_for_commandline_arg (uri_from_commandline); +// +// uri = g_file_get_uri (file); +// strcmp (uri, uri_from_commandline) == 0; +// g_free (uri); +// +// if (g_file_has_uri_scheme (file, "cdda")) +// { +// // do something special with uri +// } +// g_object_unref (file); +// +// This code will work when both cdda://sr0/Track 1.wav and +// /home/user/.gvfs/cdda on sr0/Track 1.wav is passed to the application. +// It should be noted that it's generally not safe for applications to rely +// on the format of a particular URIs. Different launcher applications (e.g. +// file managers) may have different ideas of what a given URI means. +// +// AppInfo wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type AppInfo struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*AppInfo)(nil) +) + +// AppInfor describes AppInfo's interface methods. +type AppInfor interface { + coreglib.Objector + + // AddSupportsType adds a content type to the application information to + // indicate the application is capable of opening files with the given + // content type. + AddSupportsType(contentType string) error + // CanDelete obtains the information whether the Info can be deleted. + CanDelete() bool + // CanRemoveSupportsType checks if a supported content type can be removed + // from an application. + CanRemoveSupportsType() bool + // Delete tries to delete a Info. + Delete() bool + // Dup creates a duplicate of a Info. + Dup() *AppInfo + // Equal checks if two Infos are equal. + Equal(appinfo2 AppInfor) bool + // Commandline gets the commandline with which the application will be + // started. + Commandline() string + // Description gets a human-readable description of an installed + // application. + Description() string + // DisplayName gets the display name of the application. + DisplayName() string + // Executable gets the executable's name for the installed application. + Executable() string + // Icon gets the icon for the application. + Icon() *Icon + // ID gets the ID of an application. + ID() string + // Name gets the installed name of the application. + Name() string + // SupportedTypes retrieves the list of content types that app_info claims + // to support. + SupportedTypes() []string + // Launch launches the application. + Launch(files []Filer, context *AppLaunchContext) error + // LaunchURIs launches the application. + LaunchURIs(uris []string, context *AppLaunchContext) error + // LaunchURIsAsync: async version of g_app_info_launch_uris(). + LaunchURIsAsync(ctx context.Context, uris []string, context *AppLaunchContext, callback AsyncReadyCallback) + // LaunchURIsFinish finishes a g_app_info_launch_uris_async() operation. + LaunchURIsFinish(result AsyncResulter) error + // RemoveSupportsType removes a supported type from an application, + // if possible. + RemoveSupportsType(contentType string) error + // SetAsDefaultForExtension sets the application as the default handler for + // the given file extension. + SetAsDefaultForExtension(extension string) error + // SetAsDefaultForType sets the application as the default handler for a + // given type. + SetAsDefaultForType(contentType string) error + // SetAsLastUsedForType sets the application as the last used application + // for a given type. + SetAsLastUsedForType(contentType string) error + // ShouldShow checks if the application info should be shown in menus that + // list available applications. + ShouldShow() bool + // SupportsFiles checks if the application accepts files as arguments. + SupportsFiles() bool + // SupportsURIs checks if the application supports reading files and + // directories from URIs. + SupportsURIs() bool +} + +var _ AppInfor = (*AppInfo)(nil) + +func wrapAppInfo(obj *coreglib.Object) *AppInfo { + return &AppInfo{ + Object: obj, + } +} + +func marshalAppInfo(p uintptr) (interface{}, error) { + return wrapAppInfo(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// AddSupportsType adds a content type to the application information to +// indicate the application is capable of opening files with the given content +// type. +// +// The function takes the following parameters: +// +// - contentType: string. +func (appinfo *AppInfo) AddSupportsType(contentType string) error { + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_app_info_add_supports_type(_arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(contentType) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CanDelete obtains the information whether the Info can be deleted. See +// g_app_info_delete(). +// +// The function returns the following values: +// +// - ok: TRUE if appinfo can be deleted. +func (appinfo *AppInfo) CanDelete() bool { + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_can_delete(_arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanRemoveSupportsType checks if a supported content type can be removed from +// an application. +// +// The function returns the following values: +// +// - ok: TRUE if it is possible to remove supported content types from a given +// appinfo, FALSE if not. +func (appinfo *AppInfo) CanRemoveSupportsType() bool { + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_can_remove_supports_type(_arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Delete tries to delete a Info. +// +// On some platforms, there may be a difference between user-defined +// Infos which can be deleted, and system-wide ones which cannot. See +// g_app_info_can_delete(). +// +// The function returns the following values: +// +// - ok: TRUE if appinfo has been deleted. +func (appinfo *AppInfo) Delete() bool { + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_delete(_arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Dup creates a duplicate of a Info. +// +// The function returns the following values: +// +// - appInfo: duplicate of appinfo. +func (appinfo *AppInfo) Dup() *AppInfo { + var _arg0 *C.GAppInfo // out + var _cret *C.GAppInfo // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_dup(_arg0) + runtime.KeepAlive(appinfo) + + var _appInfo *AppInfo // out + + _appInfo = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _appInfo +} + +// Equal checks if two Infos are equal. +// +// Note that the check *may not* compare each individual field, and only does +// an identity check. In case detecting changes in the contents is needed, +// program code must additionally compare relevant fields. +// +// The function takes the following parameters: +// +// - appinfo2: second Info. +// +// The function returns the following values: +// +// - ok: TRUE if appinfo1 is equal to appinfo2. FALSE otherwise. +func (appinfo1 *AppInfo) Equal(appinfo2 AppInfor) bool { + var _arg0 *C.GAppInfo // out + var _arg1 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo1).Native())) + _arg1 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo2).Native())) + + _cret = C.g_app_info_equal(_arg0, _arg1) + runtime.KeepAlive(appinfo1) + runtime.KeepAlive(appinfo2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Commandline gets the commandline with which the application will be started. +// +// The function returns the following values: +// +// - filename (optional): string containing the appinfo's commandline, or NULL +// if this information is not available. +func (appinfo *AppInfo) Commandline() string { + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_get_commandline(_arg0) + runtime.KeepAlive(appinfo) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// Description gets a human-readable description of an installed application. +// +// The function returns the following values: +// +// - utf8 (optional): string containing a description of the application +// appinfo, or NULL if none. +func (appinfo *AppInfo) Description() string { + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_get_description(_arg0) + runtime.KeepAlive(appinfo) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// DisplayName gets the display name of the application. The display name is +// often more descriptive to the user than the name itself. +// +// The function returns the following values: +// +// - utf8: display name of the application for appinfo, or the name if no +// display name is available. +func (appinfo *AppInfo) DisplayName() string { + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_get_display_name(_arg0) + runtime.KeepAlive(appinfo) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Executable gets the executable's name for the installed application. +// +// This is intended to be used for debugging or labelling what program is going +// to be run. To launch the executable, use g_app_info_launch() and related +// functions, rather than spawning the return value from this function. +// +// The function returns the following values: +// +// - filename: string containing the appinfo's application binaries name. +func (appinfo *AppInfo) Executable() string { + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_get_executable(_arg0) + runtime.KeepAlive(appinfo) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// Icon gets the icon for the application. +// +// The function returns the following values: +// +// - icon (optional): default #GIcon for appinfo or NULL if there is no +// default icon. +func (appinfo *AppInfo) Icon() *Icon { + var _arg0 *C.GAppInfo // out + var _cret *C.GIcon // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_get_icon(_arg0) + runtime.KeepAlive(appinfo) + + var _icon *Icon // out + + if _cret != nil { + _icon = wrapIcon(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _icon +} + +// ID gets the ID of an application. An id is a string that identifies the +// application. The exact format of the id is platform dependent. For instance, +// on Unix this is the desktop file id from the xdg menu specification. +// +// Note that the returned ID may be NULL, depending on how the appinfo has been +// constructed. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the application's ID. +func (appinfo *AppInfo) ID() string { + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_get_id(_arg0) + runtime.KeepAlive(appinfo) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Name gets the installed name of the application. +// +// The function returns the following values: +// +// - utf8: name of the application for appinfo. +func (appinfo *AppInfo) Name() string { + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_get_name(_arg0) + runtime.KeepAlive(appinfo) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// SupportedTypes retrieves the list of content types that app_info claims +// to support. If this information is not provided by the environment, +// this function will return NULL. This function does not take in consideration +// associations added with g_app_info_add_supports_type(), but only those +// exported directly by the application. +// +// The function returns the following values: +// +// - utf8s: a list of content types. +func (appinfo *AppInfo) SupportedTypes() []string { + var _arg0 *C.GAppInfo // out + var _cret **C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_get_supported_types(_arg0) + runtime.KeepAlive(appinfo) + + var _utf8s []string // out + + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// Launch launches the application. Passes files to the launched application as +// arguments, using the optional context to get information about the details +// of the launcher (like what screen it is on). On error, error will be set +// accordingly. +// +// To launch the application without arguments pass a NULL files list. +// +// Note that even if the launch is successful the application launched can fail +// to start if it runs into problems during startup. There is no way to detect +// this. +// +// Some URIs can be changed when passed through a GFile (for instance +// unsupported URIs with strange formats like mailto:), so if you have a textual +// URI you want to pass in as argument, consider using g_app_info_launch_uris() +// instead. +// +// The launched application inherits the environment of the launching +// process, but it can be modified with g_app_launch_context_setenv() and +// g_app_launch_context_unsetenv(). +// +// On UNIX, this function sets the GIO_LAUNCHED_DESKTOP_FILE +// environment variable with the path of the launched desktop file and +// GIO_LAUNCHED_DESKTOP_FILE_PID to the process id of the launched process. This +// can be used to ignore GIO_LAUNCHED_DESKTOP_FILE, should it be inherited by +// further processes. The DISPLAY, XDG_ACTIVATION_TOKEN and DESKTOP_STARTUP_ID +// environment variables are also set, based on information provided in context. +// +// The function takes the following parameters: +// +// - files (optional) of #GFile objects. +// - context (optional) or NULL. +func (appinfo *AppInfo) Launch(files []Filer, context *AppLaunchContext) error { + var _arg0 *C.GAppInfo // out + var _arg1 *C.GList // out + var _arg2 *C.GAppLaunchContext // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + if files != nil { + for i := len(files) - 1; i >= 0; i-- { + src := files[i] + var dst *C.GFile // out + dst = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = C.g_list_prepend(_arg1, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg1) + } + if context != nil { + _arg2 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } + + C.g_app_info_launch(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(files) + runtime.KeepAlive(context) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// LaunchURIs launches the application. This passes the uris to the launched +// application as arguments, using the optional context to get information about +// the details of the launcher (like what screen it is on). On error, error will +// be set accordingly. If the application only supports one URI per invocation +// as part of their command-line, multiple instances of the application will be +// spawned. +// +// To launch the application without arguments pass a NULL uris list. +// +// Note that even if the launch is successful the application launched can fail +// to start if it runs into problems during startup. There is no way to detect +// this. +// +// The function takes the following parameters: +// +// - uris (optional) containing URIs to launch. +// - context (optional) or NULL. +func (appinfo *AppInfo) LaunchURIs(uris []string, context *AppLaunchContext) error { + var _arg0 *C.GAppInfo // out + var _arg1 *C.GList // out + var _arg2 *C.GAppLaunchContext // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + if uris != nil { + for i := len(uris) - 1; i >= 0; i-- { + src := uris[i] + var dst *C.gchar // out + dst = (*C.gchar)(unsafe.Pointer(C.CString(src))) + defer C.free(unsafe.Pointer(dst)) + _arg1 = C.g_list_prepend(_arg1, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg1) + } + if context != nil { + _arg2 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } + + C.g_app_info_launch_uris(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(uris) + runtime.KeepAlive(context) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// LaunchURIsAsync: async version of g_app_info_launch_uris(). +// +// The callback is invoked immediately after the application launch, +// but it waits for activation in case of D-Bus–activated applications and also +// provides extended error information for sandboxed applications, see notes for +// g_app_info_launch_default_for_uri_async(). +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - uris (optional) containing URIs to launch. +// - context (optional) or NULL. +// - callback (optional) to call when the request is done. +func (appinfo *AppInfo) LaunchURIsAsync(ctx context.Context, uris []string, context *AppLaunchContext, callback AsyncReadyCallback) { + var _arg0 *C.GAppInfo // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GList // out + var _arg2 *C.GAppLaunchContext // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if uris != nil { + for i := len(uris) - 1; i >= 0; i-- { + src := uris[i] + var dst *C.gchar // out + dst = (*C.gchar)(unsafe.Pointer(C.CString(src))) + defer C.free(unsafe.Pointer(dst)) + _arg1 = C.g_list_prepend(_arg1, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg1) + } + if context != nil { + _arg2 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_app_info_launch_uris_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uris) + runtime.KeepAlive(context) + runtime.KeepAlive(callback) +} + +// LaunchURIsFinish finishes a g_app_info_launch_uris_async() operation. +// +// The function takes the following parameters: +// +// - result: Result. +func (appinfo *AppInfo) LaunchURIsFinish(result AsyncResulter) error { + var _arg0 *C.GAppInfo // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_app_info_launch_uris_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// RemoveSupportsType removes a supported type from an application, if possible. +// +// The function takes the following parameters: +// +// - contentType: string. +func (appinfo *AppInfo) RemoveSupportsType(contentType string) error { + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_app_info_remove_supports_type(_arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(contentType) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAsDefaultForExtension sets the application as the default handler for the +// given file extension. +// +// The function takes the following parameters: +// +// - extension: string containing the file extension (without the dot). +func (appinfo *AppInfo) SetAsDefaultForExtension(extension string) error { + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(extension))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_app_info_set_as_default_for_extension(_arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(extension) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAsDefaultForType sets the application as the default handler for a given +// type. +// +// The function takes the following parameters: +// +// - contentType: content type. +func (appinfo *AppInfo) SetAsDefaultForType(contentType string) error { + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_app_info_set_as_default_for_type(_arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(contentType) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAsLastUsedForType sets the application as the last used application for +// a given type. This will make the application appear as first in the list +// returned by g_app_info_get_recommended_for_type(), regardless of the default +// application for that content type. +// +// The function takes the following parameters: +// +// - contentType: content type. +func (appinfo *AppInfo) SetAsLastUsedForType(contentType string) error { + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_app_info_set_as_last_used_for_type(_arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(contentType) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ShouldShow checks if the application info should be shown in menus that list +// available applications. +// +// The function returns the following values: +// +// - ok: TRUE if the appinfo should be shown, FALSE otherwise. +func (appinfo *AppInfo) ShouldShow() bool { + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_should_show(_arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SupportsFiles checks if the application accepts files as arguments. +// +// The function returns the following values: +// +// - ok: TRUE if the appinfo supports files. +func (appinfo *AppInfo) SupportsFiles() bool { + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_supports_files(_arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SupportsURIs checks if the application supports reading files and directories +// from URIs. +// +// The function returns the following values: +// +// - ok: TRUE if the appinfo supports URIs. +func (appinfo *AppInfo) SupportsURIs() bool { + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C.g_app_info_supports_uris(_arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// addSupportsType adds a content type to the application information to +// indicate the application is capable of opening files with the given content +// type. +// +// The function takes the following parameters: +// +// - contentType: string. +func (appinfo *AppInfo) addSupportsType(contentType string) error { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.add_supports_type + + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_AppInfo_virtual_add_supports_type(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(contentType) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// canDelete obtains the information whether the Info can be deleted. See +// g_app_info_delete(). +// +// The function returns the following values: +// +// - ok: TRUE if appinfo can be deleted. +func (appinfo *AppInfo) canDelete() bool { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.can_delete + + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_can_delete(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canRemoveSupportsType checks if a supported content type can be removed from +// an application. +// +// The function returns the following values: +// +// - ok: TRUE if it is possible to remove supported content types from a given +// appinfo, FALSE if not. +func (appinfo *AppInfo) canRemoveSupportsType() bool { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.can_remove_supports_type + + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_can_remove_supports_type(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// doDelete tries to delete a Info. +// +// On some platforms, there may be a difference between user-defined +// Infos which can be deleted, and system-wide ones which cannot. See +// g_app_info_can_delete(). +// +// The function returns the following values: +// +// - ok: TRUE if appinfo has been deleted. +func (appinfo *AppInfo) doDelete() bool { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.do_delete + + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_do_delete(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Dup creates a duplicate of a Info. +// +// The function returns the following values: +// +// - appInfo: duplicate of appinfo. +func (appinfo *AppInfo) dup() *AppInfo { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.dup + + var _arg0 *C.GAppInfo // out + var _cret *C.GAppInfo // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_dup(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _appInfo *AppInfo // out + + _appInfo = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _appInfo +} + +// Equal checks if two Infos are equal. +// +// Note that the check *may not* compare each individual field, and only does +// an identity check. In case detecting changes in the contents is needed, +// program code must additionally compare relevant fields. +// +// The function takes the following parameters: +// +// - appinfo2: second Info. +// +// The function returns the following values: +// +// - ok: TRUE if appinfo1 is equal to appinfo2. FALSE otherwise. +func (appinfo1 *AppInfo) equal(appinfo2 AppInfor) bool { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo1)) + fnarg := gclass.equal + + var _arg0 *C.GAppInfo // out + var _arg1 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo1).Native())) + _arg1 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo2).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_equal(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(appinfo1) + runtime.KeepAlive(appinfo2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Commandline gets the commandline with which the application will be started. +// +// The function returns the following values: +// +// - filename (optional): string containing the appinfo's commandline, or NULL +// if this information is not available. +func (appinfo *AppInfo) commandline() string { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.get_commandline + + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_get_commandline(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// Description gets a human-readable description of an installed application. +// +// The function returns the following values: +// +// - utf8 (optional): string containing a description of the application +// appinfo, or NULL if none. +func (appinfo *AppInfo) description() string { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.get_description + + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_get_description(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// displayName gets the display name of the application. The display name is +// often more descriptive to the user than the name itself. +// +// The function returns the following values: +// +// - utf8: display name of the application for appinfo, or the name if no +// display name is available. +func (appinfo *AppInfo) displayName() string { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.get_display_name + + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_get_display_name(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Executable gets the executable's name for the installed application. +// +// This is intended to be used for debugging or labelling what program is going +// to be run. To launch the executable, use g_app_info_launch() and related +// functions, rather than spawning the return value from this function. +// +// The function returns the following values: +// +// - filename: string containing the appinfo's application binaries name. +func (appinfo *AppInfo) executable() string { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.get_executable + + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_get_executable(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// Icon gets the icon for the application. +// +// The function returns the following values: +// +// - icon (optional): default #GIcon for appinfo or NULL if there is no +// default icon. +func (appinfo *AppInfo) icon() *Icon { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.get_icon + + var _arg0 *C.GAppInfo // out + var _cret *C.GIcon // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_get_icon(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _icon *Icon // out + + if _cret != nil { + _icon = wrapIcon(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _icon +} + +// iD gets the ID of an application. An id is a string that identifies the +// application. The exact format of the id is platform dependent. For instance, +// on Unix this is the desktop file id from the xdg menu specification. +// +// Note that the returned ID may be NULL, depending on how the appinfo has been +// constructed. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the application's ID. +func (appinfo *AppInfo) iD() string { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.get_id + + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_get_id(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Name gets the installed name of the application. +// +// The function returns the following values: +// +// - utf8: name of the application for appinfo. +func (appinfo *AppInfo) name() string { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.get_name + + var _arg0 *C.GAppInfo // out + var _cret *C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_get_name(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// supportedTypes retrieves the list of content types that app_info claims +// to support. If this information is not provided by the environment, +// this function will return NULL. This function does not take in consideration +// associations added with g_app_info_add_supports_type(), but only those +// exported directly by the application. +// +// The function returns the following values: +// +// - utf8s: a list of content types. +func (appinfo *AppInfo) supportedTypes() []string { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.get_supported_types + + var _arg0 *C.GAppInfo // out + var _cret **C.char // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_get_supported_types(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _utf8s []string // out + + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// Launch launches the application. Passes files to the launched application as +// arguments, using the optional context to get information about the details +// of the launcher (like what screen it is on). On error, error will be set +// accordingly. +// +// To launch the application without arguments pass a NULL files list. +// +// Note that even if the launch is successful the application launched can fail +// to start if it runs into problems during startup. There is no way to detect +// this. +// +// Some URIs can be changed when passed through a GFile (for instance +// unsupported URIs with strange formats like mailto:), so if you have a textual +// URI you want to pass in as argument, consider using g_app_info_launch_uris() +// instead. +// +// The launched application inherits the environment of the launching +// process, but it can be modified with g_app_launch_context_setenv() and +// g_app_launch_context_unsetenv(). +// +// On UNIX, this function sets the GIO_LAUNCHED_DESKTOP_FILE +// environment variable with the path of the launched desktop file and +// GIO_LAUNCHED_DESKTOP_FILE_PID to the process id of the launched process. This +// can be used to ignore GIO_LAUNCHED_DESKTOP_FILE, should it be inherited by +// further processes. The DISPLAY, XDG_ACTIVATION_TOKEN and DESKTOP_STARTUP_ID +// environment variables are also set, based on information provided in context. +// +// The function takes the following parameters: +// +// - files (optional) of #GFile objects. +// - context (optional) or NULL. +func (appinfo *AppInfo) launch(files []Filer, context *AppLaunchContext) error { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.launch + + var _arg0 *C.GAppInfo // out + var _arg1 *C.GList // out + var _arg2 *C.GAppLaunchContext // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + if files != nil { + for i := len(files) - 1; i >= 0; i-- { + src := files[i] + var dst *C.GFile // out + dst = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg1 = C.g_list_prepend(_arg1, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg1) + } + if context != nil { + _arg2 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } + + C._gotk4_gio2_AppInfo_virtual_launch(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(files) + runtime.KeepAlive(context) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// launchURIs launches the application. This passes the uris to the launched +// application as arguments, using the optional context to get information about +// the details of the launcher (like what screen it is on). On error, error will +// be set accordingly. If the application only supports one URI per invocation +// as part of their command-line, multiple instances of the application will be +// spawned. +// +// To launch the application without arguments pass a NULL uris list. +// +// Note that even if the launch is successful the application launched can fail +// to start if it runs into problems during startup. There is no way to detect +// this. +// +// The function takes the following parameters: +// +// - uris (optional) containing URIs to launch. +// - context (optional) or NULL. +func (appinfo *AppInfo) launchURIs(uris []string, context *AppLaunchContext) error { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.launch_uris + + var _arg0 *C.GAppInfo // out + var _arg1 *C.GList // out + var _arg2 *C.GAppLaunchContext // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + if uris != nil { + for i := len(uris) - 1; i >= 0; i-- { + src := uris[i] + var dst *C.gchar // out + dst = (*C.gchar)(unsafe.Pointer(C.CString(src))) + defer C.free(unsafe.Pointer(dst)) + _arg1 = C.g_list_prepend(_arg1, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg1) + } + if context != nil { + _arg2 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } + + C._gotk4_gio2_AppInfo_virtual_launch_uris(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(uris) + runtime.KeepAlive(context) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// launchURIsAsync: async version of g_app_info_launch_uris(). +// +// The callback is invoked immediately after the application launch, +// but it waits for activation in case of D-Bus–activated applications and also +// provides extended error information for sandboxed applications, see notes for +// g_app_info_launch_default_for_uri_async(). +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - uris (optional) containing URIs to launch. +// - context (optional) or NULL. +// - callback (optional) to call when the request is done. +func (appinfo *AppInfo) launchURIsAsync(ctx context.Context, uris []string, context *AppLaunchContext, callback AsyncReadyCallback) { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.launch_uris_async + + var _arg0 *C.GAppInfo // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GList // out + var _arg2 *C.GAppLaunchContext // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if uris != nil { + for i := len(uris) - 1; i >= 0; i-- { + src := uris[i] + var dst *C.gchar // out + dst = (*C.gchar)(unsafe.Pointer(C.CString(src))) + defer C.free(unsafe.Pointer(dst)) + _arg1 = C.g_list_prepend(_arg1, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg1) + } + if context != nil { + _arg2 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_AppInfo_virtual_launch_uris_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uris) + runtime.KeepAlive(context) + runtime.KeepAlive(callback) +} + +// launchURIsFinish finishes a g_app_info_launch_uris_async() operation. +// +// The function takes the following parameters: +// +// - result: Result. +func (appinfo *AppInfo) launchURIsFinish(result AsyncResulter) error { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.launch_uris_finish + + var _arg0 *C.GAppInfo // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_AppInfo_virtual_launch_uris_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// removeSupportsType removes a supported type from an application, if possible. +// +// The function takes the following parameters: +// +// - contentType: string. +func (appinfo *AppInfo) removeSupportsType(contentType string) error { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.remove_supports_type + + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_AppInfo_virtual_remove_supports_type(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(contentType) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// setAsDefaultForExtension sets the application as the default handler for the +// given file extension. +// +// The function takes the following parameters: +// +// - extension: string containing the file extension (without the dot). +func (appinfo *AppInfo) setAsDefaultForExtension(extension string) error { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.set_as_default_for_extension + + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(extension))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_AppInfo_virtual_set_as_default_for_extension(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(extension) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// setAsDefaultForType sets the application as the default handler for a given +// type. +// +// The function takes the following parameters: +// +// - contentType: content type. +func (appinfo *AppInfo) setAsDefaultForType(contentType string) error { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.set_as_default_for_type + + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_AppInfo_virtual_set_as_default_for_type(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(contentType) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// setAsLastUsedForType sets the application as the last used application for +// a given type. This will make the application appear as first in the list +// returned by g_app_info_get_recommended_for_type(), regardless of the default +// application for that content type. +// +// The function takes the following parameters: +// +// - contentType: content type. +func (appinfo *AppInfo) setAsLastUsedForType(contentType string) error { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.set_as_last_used_for_type + + var _arg0 *C.GAppInfo // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_AppInfo_virtual_set_as_last_used_for_type(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(appinfo) + runtime.KeepAlive(contentType) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// shouldShow checks if the application info should be shown in menus that list +// available applications. +// +// The function returns the following values: +// +// - ok: TRUE if the appinfo should be shown, FALSE otherwise. +func (appinfo *AppInfo) shouldShow() bool { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.should_show + + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_should_show(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// supportsFiles checks if the application accepts files as arguments. +// +// The function returns the following values: +// +// - ok: TRUE if the appinfo supports files. +func (appinfo *AppInfo) supportsFiles() bool { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.supports_files + + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_supports_files(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// supportsURIs checks if the application supports reading files and directories +// from URIs. +// +// The function returns the following values: +// +// - ok: TRUE if the appinfo supports URIs. +func (appinfo *AppInfo) supportsURIs() bool { + gclass := (*C.GAppInfoIface)(coreglib.PeekParentClass(appinfo)) + fnarg := gclass.supports_uris + + var _arg0 *C.GAppInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(appinfo).Native())) + + _cret = C._gotk4_gio2_AppInfo_virtual_supports_uris(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(appinfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// AppInfoCreateFromCommandline creates a new Info from the given information. +// +// Note that for commandline, the quoting rules of the Exec +// key of the freedesktop.org Desktop Entry Specification +// (http://freedesktop.org/Standards/desktop-entry-spec) are applied. +// For example, if the commandline contains percent-encoded URIs, the +// percent-character must be doubled in order to prevent it from being swallowed +// by Exec key unquoting. See the specification for exact quoting rules. +// +// The function takes the following parameters: +// +// - commandline to use. +// - applicationName (optional): application name, or NULL to use commandline. +// - flags that can specify details of the created Info. +// +// The function returns the following values: +// +// - appInfo: new Info for given command. +func AppInfoCreateFromCommandline(commandline, applicationName string, flags AppInfoCreateFlags) (*AppInfo, error) { + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 C.GAppInfoCreateFlags // out + var _cret *C.GAppInfo // in + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(commandline))) + defer C.free(unsafe.Pointer(_arg1)) + if applicationName != "" { + _arg2 = (*C.char)(unsafe.Pointer(C.CString(applicationName))) + defer C.free(unsafe.Pointer(_arg2)) + } + _arg3 = C.GAppInfoCreateFlags(flags) + + _cret = C.g_app_info_create_from_commandline(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(commandline) + runtime.KeepAlive(applicationName) + runtime.KeepAlive(flags) + + var _appInfo *AppInfo // out + var _goerr error // out + + _appInfo = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _appInfo, _goerr +} + +// AppInfoGetAll gets a list of all of the applications currently registered on +// this system. +// +// For desktop files, this includes applications that have NoDisplay=true +// set or are excluded from display by means of OnlyShowIn or NotShowIn. +// See g_app_info_should_show(). The returned list does not include applications +// which have the Hidden key set. +// +// The function returns the following values: +// +// - list: newly allocated #GList of references to Infos. +func AppInfoGetAll() []*AppInfo { + var _cret *C.GList // in + + _cret = C.g_app_info_get_all() + + var _list []*AppInfo // out + + _list = make([]*AppInfo, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GAppInfo)(v) + var dst *AppInfo // out + dst = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// AppInfoGetAllForType gets a list of all Infos for a given +// content type, including the recommended and fallback Infos. See +// g_app_info_get_recommended_for_type() and g_app_info_get_fallback_for_type(). +// +// The function takes the following parameters: +// +// - contentType: content type to find a Info for. +// +// The function returns the following values: +// +// - list of Infos for given content_type or NULL on error. +func AppInfoGetAllForType(contentType string) []*AppInfo { + var _arg1 *C.char // out + var _cret *C.GList // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_app_info_get_all_for_type(_arg1) + runtime.KeepAlive(contentType) + + var _list []*AppInfo // out + + _list = make([]*AppInfo, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GAppInfo)(v) + var dst *AppInfo // out + dst = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// AppInfoGetDefaultForType gets the default Info for a given content type. +// +// The function takes the following parameters: +// +// - contentType: content type to find a Info for. +// - mustSupportUris: if TRUE, the Info is expected to support URIs. +// +// The function returns the following values: +// +// - appInfo (optional) for given content_type or NULL on error. +func AppInfoGetDefaultForType(contentType string, mustSupportUris bool) *AppInfo { + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _cret *C.GAppInfo // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + if mustSupportUris { + _arg2 = C.TRUE + } + + _cret = C.g_app_info_get_default_for_type(_arg1, _arg2) + runtime.KeepAlive(contentType) + runtime.KeepAlive(mustSupportUris) + + var _appInfo *AppInfo // out + + if _cret != nil { + _appInfo = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _appInfo +} + +// AppInfoGetDefaultForTypeAsync: asynchronously gets the default Info for a +// given content type. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - contentType: content type to find a Info for. +// - mustSupportUris: if TRUE, the Info is expected to support URIs. +// - callback (optional) to call when the request is done. +func AppInfoGetDefaultForTypeAsync(ctx context.Context, contentType string, mustSupportUris bool, callback AsyncReadyCallback) { + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + if mustSupportUris { + _arg2 = C.TRUE + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_app_info_get_default_for_type_async(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(ctx) + runtime.KeepAlive(contentType) + runtime.KeepAlive(mustSupportUris) + runtime.KeepAlive(callback) +} + +// AppInfoGetDefaultForTypeFinish finishes a default Info lookup started by +// g_app_info_get_default_for_type_async(). +// +// If no Info is found, then error will be set to G_IO_ERROR_NOT_FOUND. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - appInfo for given content_type or NULL on error. +func AppInfoGetDefaultForTypeFinish(result AsyncResulter) (*AppInfo, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GAppInfo // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_app_info_get_default_for_type_finish(_arg1, &_cerr) + runtime.KeepAlive(result) + + var _appInfo *AppInfo // out + var _goerr error // out + + _appInfo = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _appInfo, _goerr +} + +// AppInfoGetDefaultForURIScheme gets the default application for handling URIs +// with the given URI scheme. A URI scheme is the initial part of the URI, +// up to but not including the ':', e.g. "http", "ftp" or "sip". +// +// The function takes the following parameters: +// +// - uriScheme: string containing a URI scheme. +// +// The function returns the following values: +// +// - appInfo (optional) for given uri_scheme or NULL on error. +func AppInfoGetDefaultForURIScheme(uriScheme string) *AppInfo { + var _arg1 *C.char // out + var _cret *C.GAppInfo // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uriScheme))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_app_info_get_default_for_uri_scheme(_arg1) + runtime.KeepAlive(uriScheme) + + var _appInfo *AppInfo // out + + if _cret != nil { + _appInfo = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _appInfo +} + +// AppInfoGetDefaultForURISchemeAsync: asynchronously gets the default +// application for handling URIs with the given URI scheme. A URI scheme is +// the initial part of the URI, up to but not including the ':', e.g. "http", +// "ftp" or "sip". +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - uriScheme: string containing a URI scheme. +// - callback (optional) to call when the request is done. +func AppInfoGetDefaultForURISchemeAsync(ctx context.Context, uriScheme string, callback AsyncReadyCallback) { + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uriScheme))) + defer C.free(unsafe.Pointer(_arg1)) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_app_info_get_default_for_uri_scheme_async(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uriScheme) + runtime.KeepAlive(callback) +} + +// AppInfoGetDefaultForURISchemeFinish finishes a default Info lookup started by +// g_app_info_get_default_for_uri_scheme_async(). +// +// If no Info is found, then error will be set to G_IO_ERROR_NOT_FOUND. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - appInfo for given uri_scheme or NULL on error. +func AppInfoGetDefaultForURISchemeFinish(result AsyncResulter) (*AppInfo, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GAppInfo // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_app_info_get_default_for_uri_scheme_finish(_arg1, &_cerr) + runtime.KeepAlive(result) + + var _appInfo *AppInfo // out + var _goerr error // out + + _appInfo = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _appInfo, _goerr +} + +// AppInfoGetFallbackForType gets a list of fallback Infos for a given content +// type, i.e. those applications which claim to support the given content type +// by MIME type subclassing and not directly. +// +// The function takes the following parameters: +// +// - contentType: content type to find a Info for. +// +// The function returns the following values: +// +// - list of Infos for given content_type or NULL on error. +func AppInfoGetFallbackForType(contentType string) []*AppInfo { + var _arg1 *C.gchar // out + var _cret *C.GList // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_app_info_get_fallback_for_type(_arg1) + runtime.KeepAlive(contentType) + + var _list []*AppInfo // out + + _list = make([]*AppInfo, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GAppInfo)(v) + var dst *AppInfo // out + dst = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// AppInfoGetRecommendedForType gets a list of recommended Infos for a given +// content type, i.e. those applications which claim to support the given +// content type exactly, and not by MIME type subclassing. Note that the first +// application of the list is the last used one, i.e. the last one for which +// g_app_info_set_as_last_used_for_type() has been called. +// +// The function takes the following parameters: +// +// - contentType: content type to find a Info for. +// +// The function returns the following values: +// +// - list of Infos for given content_type or NULL on error. +func AppInfoGetRecommendedForType(contentType string) []*AppInfo { + var _arg1 *C.gchar // out + var _cret *C.GList // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_app_info_get_recommended_for_type(_arg1) + runtime.KeepAlive(contentType) + + var _list []*AppInfo // out + + _list = make([]*AppInfo, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GAppInfo)(v) + var dst *AppInfo // out + dst = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// AppInfoLaunchDefaultForURI: utility function that launches the default +// application registered to handle the specified uri. Synchronous I/O is done +// on the uri to detect the type of the file if required. +// +// The D-Bus–activated applications don't have to be started if your +// application terminates too soon after this function. To prevent this, +// use g_app_info_launch_default_for_uri_async() instead. +// +// The function takes the following parameters: +// +// - uri to show. +// - context (optional): optional LaunchContext. +func AppInfoLaunchDefaultForURI(uri string, context *AppLaunchContext) error { + var _arg1 *C.char // out + var _arg2 *C.GAppLaunchContext // out + var _cerr *C.GError // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + if context != nil { + _arg2 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } + + C.g_app_info_launch_default_for_uri(_arg1, _arg2, &_cerr) + runtime.KeepAlive(uri) + runtime.KeepAlive(context) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// AppInfoLaunchDefaultForURIAsync: async version of +// g_app_info_launch_default_for_uri(). +// +// This version is useful if you are interested in receiving error information +// in the case where the application is sandboxed and the portal may present an +// application chooser dialog to the user. +// +// This is also useful if you want to be sure that the D-Bus–activated +// applications are really started before termination and if you are interested +// in receiving error information from their activation. +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - uri to show. +// - context (optional): optional LaunchContext. +// - callback (optional) to call when the request is done. +func AppInfoLaunchDefaultForURIAsync(ctx context.Context, uri string, context *AppLaunchContext, callback AsyncReadyCallback) { + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 *C.GAppLaunchContext // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + if context != nil { + _arg2 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_app_info_launch_default_for_uri_async(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uri) + runtime.KeepAlive(context) + runtime.KeepAlive(callback) +} + +// AppInfoLaunchDefaultForURIFinish finishes an asynchronous +// launch-default-for-uri operation. +// +// The function takes the following parameters: +// +// - result: Result. +func AppInfoLaunchDefaultForURIFinish(result AsyncResulter) error { + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_app_info_launch_default_for_uri_finish(_arg1, &_cerr) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// AppInfoResetTypeAssociations removes all changes to the type +// associations done by g_app_info_set_as_default_for_type(), +// g_app_info_set_as_default_for_extension(), g_app_info_add_supports_type() or +// g_app_info_remove_supports_type(). +// +// The function takes the following parameters: +// +// - contentType: content type. +func AppInfoResetTypeAssociations(contentType string) { + var _arg1 *C.char // out + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_app_info_reset_type_associations(_arg1) + runtime.KeepAlive(contentType) +} + +// AsyncInitable: GAsyncInitable is an interface for asynchronously +// initializable objects. +// +// This is the asynchronous version of gio.Initable; it behaves the same in all +// ways except that initialization is asynchronous. For more details see the +// descriptions on GInitable. +// +// A class may implement both the GInitable and GAsyncInitable interfaces. +// +// Users of objects implementing this are not intended to use the interface +// method directly; instead it will be used automatically in various ways. +// For C applications you generally just call gio.AsyncInitable().NewAsync +// directly, or indirectly via a foo_thing_new_async() wrapper. This will call +// gio.AsyncInitable.InitAsync() under the covers, calling back with NULL and a +// set GError on failure. +// +// A typical implementation might look something like this: +// +// enum { +// NOT_INITIALIZED, +// INITIALIZING, +// INITIALIZED +// }; +// +// static void +// _foo_ready_cb (Foo *self) +// { +// GList *l; +// +// self->priv->state = INITIALIZED; +// +// for (l = self->priv->init_results; l != NULL; l = l->next) +// { +// GTask *task = l->data; +// +// if (self->priv->success) +// g_task_return_boolean (task, TRUE); +// else +// g_task_return_new_error (task, ...); +// g_object_unref (task); +// } +// +// g_list_free (self->priv->init_results); +// self->priv->init_results = NULL; +// } +// +// static void +// foo_init_async (GAsyncInitable *initable, +// int io_priority, +// GCancellable *cancellable, +// GAsyncReadyCallback callback, +// gpointer user_data) +// { +// Foo *self = FOO (initable); +// GTask *task; +// +// task = g_task_new (initable, cancellable, callback, user_data); +// g_task_set_name (task, G_STRFUNC); +// +// switch (self->priv->state) +// { +// case NOT_INITIALIZED: +// _foo_get_ready (self); +// self->priv->init_results = g_list_append (self->priv->init_results, +// task); +// self->priv->state = INITIALIZING; +// break; +// case INITIALIZING: +// self->priv->init_results = g_list_append (self->priv->init_results, +// task); +// break; +// case INITIALIZED: +// if (!self->priv->success) +// g_task_return_new_error (task, ...); +// else +// g_task_return_boolean (task, TRUE); +// g_object_unref (task); +// break; +// } +// } +// +// static gboolean +// foo_init_finish (GAsyncInitable *initable, +// GAsyncResult *result, +// GError **error) +// { +// g_return_val_if_fail (g_task_is_valid (result, initable), FALSE); +// +// return g_task_propagate_boolean (G_TASK (result), error); +// } +// +// static void +// foo_async_initable_iface_init (gpointer g_iface, +// gpointer data) +// { +// GAsyncInitableIface *iface = g_iface; +// +// iface->init_async = foo_init_async; +// iface->init_finish = foo_init_finish; +// }. +// +// AsyncInitable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type AsyncInitable struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*AsyncInitable)(nil) +) + +// AsyncInitabler describes AsyncInitable's interface methods. +type AsyncInitabler interface { + coreglib.Objector + + // InitAsync starts asynchronous initialization of the object implementing + // the interface. + InitAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // InitFinish finishes asynchronous initialization and returns the result. + InitFinish(res AsyncResulter) error + // NewFinish finishes the async construction for the various + // g_async_initable_new calls, returning the created object or NULL on + // error. + NewFinish(res AsyncResulter) (*coreglib.Object, error) +} + +var _ AsyncInitabler = (*AsyncInitable)(nil) + +func wrapAsyncInitable(obj *coreglib.Object) *AsyncInitable { + return &AsyncInitable{ + Object: obj, + } +} + +func marshalAsyncInitable(p uintptr) (interface{}, error) { + return wrapAsyncInitable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// InitAsync starts asynchronous initialization of the object implementing the +// interface. This must be done before any real use of the object after initial +// construction. If the object also implements #GInitable you can optionally +// call g_initable_init() instead. +// +// This method is intended for language bindings. If writing in C, +// g_async_initable_new_async() should typically be used instead. +// +// When the initialization is finished, callback will be called. You can then +// call g_async_initable_init_finish() to get the result of the initialization. +// +// Implementations may also support cancellation. If cancellable is not NULL, +// then initialization can be cancelled by triggering the cancellable +// object from another thread. If the operation was cancelled, the error +// G_IO_ERROR_CANCELLED will be returned. If cancellable is not NULL, +// and the object doesn't support cancellable initialization, the error +// G_IO_ERROR_NOT_SUPPORTED will be returned. +// +// As with #GInitable, if the object is not initialized, or initialization +// returns with an error, then all operations on the object except +// g_object_ref() and g_object_unref() are considered to be invalid, and have +// undefined behaviour. They will often fail with g_critical() or g_warning(), +// but this must not be relied on. +// +// Callers should not assume that a class which implements Initable can be +// initialized multiple times; for more information, see g_initable_init(). If +// a class explicitly supports being initialized multiple times, implementation +// requires yielding all subsequent calls to init_async() on the results of the +// first call. +// +// For classes that also support the #GInitable interface, the default +// implementation of this method will run the g_initable_init() function in a +// thread, so if you want to support asynchronous initialization via threads, +// just implement the Initable interface without overriding any interface +// methods. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the operation. +// - callback (optional) to call when the request is satisfied. +func (initable *AsyncInitable) InitAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GAsyncInitable // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GAsyncInitable)(unsafe.Pointer(coreglib.InternObject(initable).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_async_initable_init_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(initable) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// InitFinish finishes asynchronous initialization and returns the result. +// See g_async_initable_init_async(). +// +// The function takes the following parameters: +// +// - res: Result. +func (initable *AsyncInitable) InitFinish(res AsyncResulter) error { + var _arg0 *C.GAsyncInitable // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GAsyncInitable)(unsafe.Pointer(coreglib.InternObject(initable).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C.g_async_initable_init_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(initable) + runtime.KeepAlive(res) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// NewFinish finishes the async construction for the various +// g_async_initable_new calls, returning the created object or NULL on error. +// +// The function takes the following parameters: +// +// - res from the callback. +// +// The function returns the following values: +// +// - object: newly created #GObject, or NULL on error. Free with +// g_object_unref(). +func (initable *AsyncInitable) NewFinish(res AsyncResulter) (*coreglib.Object, error) { + var _arg0 *C.GAsyncInitable // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GObject // in + var _cerr *C.GError // in + + _arg0 = (*C.GAsyncInitable)(unsafe.Pointer(coreglib.InternObject(initable).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_async_initable_new_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(initable) + runtime.KeepAlive(res) + + var _object *coreglib.Object // out + var _goerr error // out + + _object = coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _object, _goerr +} + +// initAsync starts asynchronous initialization of the object implementing the +// interface. This must be done before any real use of the object after initial +// construction. If the object also implements #GInitable you can optionally +// call g_initable_init() instead. +// +// This method is intended for language bindings. If writing in C, +// g_async_initable_new_async() should typically be used instead. +// +// When the initialization is finished, callback will be called. You can then +// call g_async_initable_init_finish() to get the result of the initialization. +// +// Implementations may also support cancellation. If cancellable is not NULL, +// then initialization can be cancelled by triggering the cancellable +// object from another thread. If the operation was cancelled, the error +// G_IO_ERROR_CANCELLED will be returned. If cancellable is not NULL, +// and the object doesn't support cancellable initialization, the error +// G_IO_ERROR_NOT_SUPPORTED will be returned. +// +// As with #GInitable, if the object is not initialized, or initialization +// returns with an error, then all operations on the object except +// g_object_ref() and g_object_unref() are considered to be invalid, and have +// undefined behaviour. They will often fail with g_critical() or g_warning(), +// but this must not be relied on. +// +// Callers should not assume that a class which implements Initable can be +// initialized multiple times; for more information, see g_initable_init(). If +// a class explicitly supports being initialized multiple times, implementation +// requires yielding all subsequent calls to init_async() on the results of the +// first call. +// +// For classes that also support the #GInitable interface, the default +// implementation of this method will run the g_initable_init() function in a +// thread, so if you want to support asynchronous initialization via threads, +// just implement the Initable interface without overriding any interface +// methods. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the operation. +// - callback (optional) to call when the request is satisfied. +func (initable *AsyncInitable) initAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GAsyncInitableIface)(coreglib.PeekParentClass(initable)) + fnarg := gclass.init_async + + var _arg0 *C.GAsyncInitable // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GAsyncInitable)(unsafe.Pointer(coreglib.InternObject(initable).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_AsyncInitable_virtual_init_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(initable) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// initFinish finishes asynchronous initialization and returns the result. +// See g_async_initable_init_async(). +// +// The function takes the following parameters: +// +// - res: Result. +func (initable *AsyncInitable) initFinish(res AsyncResulter) error { + gclass := (*C.GAsyncInitableIface)(coreglib.PeekParentClass(initable)) + fnarg := gclass.init_finish + + var _arg0 *C.GAsyncInitable // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GAsyncInitable)(unsafe.Pointer(coreglib.InternObject(initable).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C._gotk4_gio2_AsyncInitable_virtual_init_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(initable) + runtime.KeepAlive(res) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// AsyncResult: GAsyncResult provides a base class for implementing asynchronous +// function results. +// +// Asynchronous operations are broken up into two separate operations which +// are chained together by a GAsyncReadyCallback. To begin an asynchronous +// operation, provide a GAsyncReadyCallback to the asynchronous function. +// This callback will be triggered when the operation has completed, +// and must be run in a later iteration of the thread-default main context (see +// glib.MainContext.PushThreadDefault()) from where the operation was initiated. +// It will be passed a GAsyncResult instance filled with the details of the +// operation's success or failure, the object the asynchronous function was +// started for and any error codes returned. The asynchronous callback function +// is then expected to call the corresponding _finish() function, passing +// the object the function was called for, the GAsyncResult instance, and +// (optionally) an error to grab any error conditions that may have occurred. +// +// The _finish() function for an operation takes the generic result (of type +// GAsyncResult) and returns the specific result that the operation in question +// yields (e.g. a gio.FileEnumerator for a "enumerate children" operation). +// If the result or error status of the operation is not needed, there is no +// need to call the _finish() function; GIO will take care of cleaning up the +// result and error information after the GAsyncReadyCallback returns. You can +// pass NULL for the GAsyncReadyCallback if you don't need to take any action +// at all after the operation completes. Applications may also take a reference +// to the GAsyncResult and call _finish() later; however, the _finish() function +// may be called at most once. +// +// Example of a typical asynchronous operation flow: +// +// void _theoretical_frobnitz_async (Theoretical *t, +// GCancellable *c, +// GAsyncReadyCallback cb, +// gpointer u); +// +// gboolean _theoretical_frobnitz_finish (Theoretical *t, +// GAsyncResult *res, +// GError **e); +// +// static void +// frobnitz_result_func (GObject *source_object, +// GAsyncResult *res, +// gpointer user_data) +// { +// gboolean success = FALSE; +// +// success = _theoretical_frobnitz_finish (source_object, res, NULL); +// +// if (success) +// g_printf ("Hurray!\n"); +// else +// g_printf ("Uh oh!\n"); +// +// ... +// +// } +// +// int main (int argc, void *argv[]) +// { +// ... +// +// _theoretical_frobnitz_async (theoretical_data, +// NULL, +// frobnitz_result_func, +// NULL); +// +// ... +// } +// +// The callback for an asynchronous operation is called only once, and is always +// called, even in the case of a cancelled operation. On cancellation the result +// is a G_IO_ERROR_CANCELLED error. +// +// I/O Priority +// +// Many I/O-related asynchronous operations have a priority parameter, +// which is used in certain cases to determine the order in which operations +// are executed. They are not used to determine system-wide I/O scheduling. +// Priorities are integers, with lower numbers indicating higher priority. It is +// recommended to choose priorities between G_PRIORITY_LOW and G_PRIORITY_HIGH, +// with G_PRIORITY_DEFAULT as a default. +// +// AsyncResult wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type AsyncResult struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*AsyncResult)(nil) +) + +// AsyncResulter describes AsyncResult's interface methods. +type AsyncResulter interface { + coreglib.Objector + + // SourceObject gets the source object from a Result. + SourceObject() *coreglib.Object + // UserData gets the user data from a Result. + UserData() unsafe.Pointer + // IsTagged checks if res has the given source_tag (generally a function + // pointer indicating the function res was created by). + IsTagged(sourceTag unsafe.Pointer) bool + // LegacyPropagateError: if res is a AsyncResult, this is equivalent to + // g_simple_async_result_propagate_error(). + LegacyPropagateError() error +} + +var _ AsyncResulter = (*AsyncResult)(nil) + +func wrapAsyncResult(obj *coreglib.Object) *AsyncResult { + return &AsyncResult{ + Object: obj, + } +} + +func marshalAsyncResult(p uintptr) (interface{}, error) { + return wrapAsyncResult(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// SourceObject gets the source object from a Result. +// +// The function returns the following values: +// +// - object (optional): new reference to the source object for the res, +// or NULL if there is none. +func (res *AsyncResult) SourceObject() *coreglib.Object { + var _arg0 *C.GAsyncResult // out + var _cret *C.GObject // in + + _arg0 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_async_result_get_source_object(_arg0) + runtime.KeepAlive(res) + + var _object *coreglib.Object // out + + if _cret != nil { + _object = coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + } + + return _object +} + +// UserData gets the user data from a Result. +// +// The function returns the following values: +// +// - gpointer (optional): user data for res. +func (res *AsyncResult) UserData() unsafe.Pointer { + var _arg0 *C.GAsyncResult // out + var _cret C.gpointer // in + + _arg0 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_async_result_get_user_data(_arg0) + runtime.KeepAlive(res) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// IsTagged checks if res has the given source_tag (generally a function pointer +// indicating the function res was created by). +// +// The function takes the following parameters: +// +// - sourceTag (optional): application-defined tag. +// +// The function returns the following values: +// +// - ok: TRUE if res has the indicated source_tag, FALSE if not. +func (res *AsyncResult) IsTagged(sourceTag unsafe.Pointer) bool { + var _arg0 *C.GAsyncResult // out + var _arg1 C.gpointer // out + var _cret C.gboolean // in + + _arg0 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + _arg1 = (C.gpointer)(unsafe.Pointer(sourceTag)) + + _cret = C.g_async_result_is_tagged(_arg0, _arg1) + runtime.KeepAlive(res) + runtime.KeepAlive(sourceTag) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// LegacyPropagateError: if res is a AsyncResult, this is equivalent to +// g_simple_async_result_propagate_error(). Otherwise it returns FALSE. +// +// This can be used for legacy error handling in async *_finish() wrapper +// functions that traditionally handled AsyncResult error returns themselves +// rather than calling into the virtual method. This should not be used in new +// code; Result errors that are set by virtual methods should also be extracted +// by virtual methods, to enable subclasses to chain up correctly. +func (res *AsyncResult) LegacyPropagateError() error { + var _arg0 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C.g_async_result_legacy_propagate_error(_arg0, &_cerr) + runtime.KeepAlive(res) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// sourceObject gets the source object from a Result. +// +// The function returns the following values: +// +// - object (optional): new reference to the source object for the res, +// or NULL if there is none. +func (res *AsyncResult) sourceObject() *coreglib.Object { + gclass := (*C.GAsyncResultIface)(coreglib.PeekParentClass(res)) + fnarg := gclass.get_source_object + + var _arg0 *C.GAsyncResult // out + var _cret *C.GObject // in + + _arg0 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_AsyncResult_virtual_get_source_object(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(res) + + var _object *coreglib.Object // out + + if _cret != nil { + _object = coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + } + + return _object +} + +// userData gets the user data from a Result. +// +// The function returns the following values: +// +// - gpointer (optional): user data for res. +func (res *AsyncResult) userData() unsafe.Pointer { + gclass := (*C.GAsyncResultIface)(coreglib.PeekParentClass(res)) + fnarg := gclass.get_user_data + + var _arg0 *C.GAsyncResult // out + var _cret C.gpointer // in + + _arg0 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_AsyncResult_virtual_get_user_data(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(res) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// isTagged checks if res has the given source_tag (generally a function pointer +// indicating the function res was created by). +// +// The function takes the following parameters: +// +// - sourceTag (optional): application-defined tag. +// +// The function returns the following values: +// +// - ok: TRUE if res has the indicated source_tag, FALSE if not. +func (res *AsyncResult) isTagged(sourceTag unsafe.Pointer) bool { + gclass := (*C.GAsyncResultIface)(coreglib.PeekParentClass(res)) + fnarg := gclass.is_tagged + + var _arg0 *C.GAsyncResult // out + var _arg1 C.gpointer // out + var _cret C.gboolean // in + + _arg0 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + _arg1 = (C.gpointer)(unsafe.Pointer(sourceTag)) + + _cret = C._gotk4_gio2_AsyncResult_virtual_is_tagged(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(res) + runtime.KeepAlive(sourceTag) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Converter: GConverter is an interface for streaming conversions. +// +// GConverter is implemented by objects that convert binary data in various +// ways. The conversion can be stateful and may fail at any place. +// +// Some example conversions are: character set conversion, compression, +// decompression and regular expression replace. +// +// Converter wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Converter struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Converter)(nil) +) + +// Converterer describes Converter's interface methods. +type Converterer interface { + coreglib.Objector + + // Convert: this is the main operation used when converting data. + Convert(inbuf, outbuf []byte, flags ConverterFlags) (bytesRead, bytesWritten uint, converterResult ConverterResult, goerr error) + // Reset resets all internal state in the converter, making it behave as if + // it was just created. + Reset() +} + +var _ Converterer = (*Converter)(nil) + +func wrapConverter(obj *coreglib.Object) *Converter { + return &Converter{ + Object: obj, + } +} + +func marshalConverter(p uintptr) (interface{}, error) { + return wrapConverter(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Convert: this is the main operation used when converting data. It is to be +// called multiple times in a loop, and each time it will do some work, i.e. +// producing some output (in outbuf) or consuming some input (from inbuf) or +// both. If its not possible to do any work an error is returned. +// +// Note that a single call may not consume all input (or any input at all). +// Also a call may produce output even if given no input, due to state stored in +// the converter producing output. +// +// If any data was either produced or consumed, and then an error happens, +// then only the successful conversion is reported and the error is returned on +// the next call. +// +// A full conversion loop involves calling this method repeatedly, each time +// giving it new input and space output space. When there is no more input data +// after the data in inbuf, the flag G_CONVERTER_INPUT_AT_END must be set. +// The loop will be (unless some error happens) returning G_CONVERTER_CONVERTED +// each time until all data is consumed and all output is produced, then +// G_CONVERTER_FINISHED is returned instead. Note, that G_CONVERTER_FINISHED +// may be returned even if G_CONVERTER_INPUT_AT_END is not set, for instance in +// a decompression converter where the end of data is detectable from the data +// (and there might even be other data after the end of the compressed data). +// +// When some data has successfully been converted bytes_read and is set to +// the number of bytes read from inbuf, and bytes_written is set to indicate +// how many bytes was written to outbuf. If there are more data to output +// or consume (i.e. unless the G_CONVERTER_INPUT_AT_END is specified) then +// G_CONVERTER_CONVERTED is returned, and if no more data is to be output then +// G_CONVERTER_FINISHED is returned. +// +// On error G_CONVERTER_ERROR is returned and error is set accordingly. Some +// errors need special handling: +// +// G_IO_ERROR_NO_SPACE is returned if there is not enough space to write the +// resulting converted data, the application should call the function again with +// a larger outbuf to continue. +// +// G_IO_ERROR_PARTIAL_INPUT is returned if there is not enough input +// to fully determine what the conversion should produce, and the +// G_CONVERTER_INPUT_AT_END flag is not set. This happens for example with an +// incomplete multibyte sequence when converting text, or when a regexp matches +// up to the end of the input (and may match further input). It may also happen +// when inbuf_size is zero and there is no more data to produce. +// +// When this happens the application should read more input and then call the +// function again. If further input shows that there is no more data call the +// function again with the same data but with the G_CONVERTER_INPUT_AT_END flag +// set. This may cause the conversion to finish as e.g. in the regexp match case +// (or, to fail again with G_IO_ERROR_PARTIAL_INPUT in e.g. a charset conversion +// where the input is actually partial). +// +// After g_converter_convert() has returned G_CONVERTER_FINISHED the +// converter object is in an invalid state where its not allowed to call +// g_converter_convert() anymore. At this time you can only free the object or +// call g_converter_reset() to reset it to the initial state. +// +// If the flag G_CONVERTER_FLUSH is set then conversion is modified to try to +// write out all internal state to the output. The application has to call +// the function multiple times with the flag set, and when the available +// input has been consumed and all internal state has been produced then +// G_CONVERTER_FLUSHED (or G_CONVERTER_FINISHED if really at the end) is +// returned instead of G_CONVERTER_CONVERTED. This is somewhat similar to what +// happens at the end of the input stream, but done in the middle of the data. +// +// This has different meanings for different conversions. For instance in a +// compression converter it would mean that we flush all the compression state +// into output such that if you uncompress the compressed data you get back all +// the input data. Doing this may make the final file larger due to padding +// though. Another example is a regexp conversion, where if you at the end of +// the flushed data have a match, but there is also a potential longer match. +// In the non-flushed case we would ask for more input, but when flushing we +// treat this as the end of input and do the match. +// +// Flushing is not always possible (like if a charset converter flushes +// at a partial multibyte sequence). Converters are supposed to try to +// produce as much output as possible and then return an error (typically +// G_IO_ERROR_PARTIAL_INPUT). +// +// The function takes the following parameters: +// +// - inbuf: buffer containing the data to convert. +// - outbuf: a buffer to write converted data in. +// - flags controlling the conversion details. +// +// The function returns the following values: +// +// - bytesRead will be set to the number of bytes read from inbuf on success. +// - bytesWritten will be set to the number of bytes written to outbuf on +// success. +// - converterResult G_CONVERTER_ERROR on error. +func (converter *Converter) Convert(inbuf, outbuf []byte, flags ConverterFlags) (bytesRead, bytesWritten uint, converterResult ConverterResult, goerr error) { + var _arg0 *C.GConverter // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 *C.void // out + var _arg4 C.gsize + var _arg5 C.GConverterFlags // out + var _arg6 C.gsize // in + var _arg7 C.gsize // in + var _cret C.GConverterResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GConverter)(unsafe.Pointer(coreglib.InternObject(converter).Native())) + _arg2 = (C.gsize)(len(inbuf)) + if len(inbuf) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&inbuf[0])) + } + _arg4 = (C.gsize)(len(outbuf)) + if len(outbuf) > 0 { + _arg3 = (*C.void)(unsafe.Pointer(&outbuf[0])) + } + _arg5 = C.GConverterFlags(flags) + + _cret = C.g_converter_convert(_arg0, unsafe.Pointer(_arg1), _arg2, unsafe.Pointer(_arg3), _arg4, _arg5, &_arg6, &_arg7, &_cerr) + runtime.KeepAlive(converter) + runtime.KeepAlive(inbuf) + runtime.KeepAlive(outbuf) + runtime.KeepAlive(flags) + + var _bytesRead uint // out + var _bytesWritten uint // out + var _converterResult ConverterResult // out + var _goerr error // out + + _bytesRead = uint(_arg6) + _bytesWritten = uint(_arg7) + _converterResult = ConverterResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _bytesWritten, _converterResult, _goerr +} + +// Reset resets all internal state in the converter, making it behave as if it +// was just created. If the converter has any internal state that would produce +// output then that output is lost. +func (converter *Converter) Reset() { + var _arg0 *C.GConverter // out + + _arg0 = (*C.GConverter)(unsafe.Pointer(coreglib.InternObject(converter).Native())) + + C.g_converter_reset(_arg0) + runtime.KeepAlive(converter) +} + +// Convert: this is the main operation used when converting data. It is to be +// called multiple times in a loop, and each time it will do some work, i.e. +// producing some output (in outbuf) or consuming some input (from inbuf) or +// both. If its not possible to do any work an error is returned. +// +// Note that a single call may not consume all input (or any input at all). +// Also a call may produce output even if given no input, due to state stored in +// the converter producing output. +// +// If any data was either produced or consumed, and then an error happens, +// then only the successful conversion is reported and the error is returned on +// the next call. +// +// A full conversion loop involves calling this method repeatedly, each time +// giving it new input and space output space. When there is no more input data +// after the data in inbuf, the flag G_CONVERTER_INPUT_AT_END must be set. +// The loop will be (unless some error happens) returning G_CONVERTER_CONVERTED +// each time until all data is consumed and all output is produced, then +// G_CONVERTER_FINISHED is returned instead. Note, that G_CONVERTER_FINISHED +// may be returned even if G_CONVERTER_INPUT_AT_END is not set, for instance in +// a decompression converter where the end of data is detectable from the data +// (and there might even be other data after the end of the compressed data). +// +// When some data has successfully been converted bytes_read and is set to +// the number of bytes read from inbuf, and bytes_written is set to indicate +// how many bytes was written to outbuf. If there are more data to output +// or consume (i.e. unless the G_CONVERTER_INPUT_AT_END is specified) then +// G_CONVERTER_CONVERTED is returned, and if no more data is to be output then +// G_CONVERTER_FINISHED is returned. +// +// On error G_CONVERTER_ERROR is returned and error is set accordingly. Some +// errors need special handling: +// +// G_IO_ERROR_NO_SPACE is returned if there is not enough space to write the +// resulting converted data, the application should call the function again with +// a larger outbuf to continue. +// +// G_IO_ERROR_PARTIAL_INPUT is returned if there is not enough input +// to fully determine what the conversion should produce, and the +// G_CONVERTER_INPUT_AT_END flag is not set. This happens for example with an +// incomplete multibyte sequence when converting text, or when a regexp matches +// up to the end of the input (and may match further input). It may also happen +// when inbuf_size is zero and there is no more data to produce. +// +// When this happens the application should read more input and then call the +// function again. If further input shows that there is no more data call the +// function again with the same data but with the G_CONVERTER_INPUT_AT_END flag +// set. This may cause the conversion to finish as e.g. in the regexp match case +// (or, to fail again with G_IO_ERROR_PARTIAL_INPUT in e.g. a charset conversion +// where the input is actually partial). +// +// After g_converter_convert() has returned G_CONVERTER_FINISHED the +// converter object is in an invalid state where its not allowed to call +// g_converter_convert() anymore. At this time you can only free the object or +// call g_converter_reset() to reset it to the initial state. +// +// If the flag G_CONVERTER_FLUSH is set then conversion is modified to try to +// write out all internal state to the output. The application has to call +// the function multiple times with the flag set, and when the available +// input has been consumed and all internal state has been produced then +// G_CONVERTER_FLUSHED (or G_CONVERTER_FINISHED if really at the end) is +// returned instead of G_CONVERTER_CONVERTED. This is somewhat similar to what +// happens at the end of the input stream, but done in the middle of the data. +// +// This has different meanings for different conversions. For instance in a +// compression converter it would mean that we flush all the compression state +// into output such that if you uncompress the compressed data you get back all +// the input data. Doing this may make the final file larger due to padding +// though. Another example is a regexp conversion, where if you at the end of +// the flushed data have a match, but there is also a potential longer match. +// In the non-flushed case we would ask for more input, but when flushing we +// treat this as the end of input and do the match. +// +// Flushing is not always possible (like if a charset converter flushes +// at a partial multibyte sequence). Converters are supposed to try to +// produce as much output as possible and then return an error (typically +// G_IO_ERROR_PARTIAL_INPUT). +// +// The function takes the following parameters: +// +// - inbuf (optional): buffer containing the data to convert. +// - outbuf: a buffer to write converted data in. +// - flags controlling the conversion details. +// +// The function returns the following values: +// +// - bytesRead will be set to the number of bytes read from inbuf on success. +// - bytesWritten will be set to the number of bytes written to outbuf on +// success. +// - converterResult G_CONVERTER_ERROR on error. +func (converter *Converter) convert(inbuf, outbuf []byte, flags ConverterFlags) (bytesRead, bytesWritten uint, converterResult ConverterResult, goerr error) { + gclass := (*C.GConverterIface)(coreglib.PeekParentClass(converter)) + fnarg := gclass.convert + + var _arg0 *C.GConverter // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 *C.void // out + var _arg4 C.gsize + var _arg5 C.GConverterFlags // out + var _arg6 C.gsize // in + var _arg7 C.gsize // in + var _cret C.GConverterResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GConverter)(unsafe.Pointer(coreglib.InternObject(converter).Native())) + _arg2 = (C.gsize)(len(inbuf)) + if len(inbuf) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&inbuf[0])) + } + _arg4 = (C.gsize)(len(outbuf)) + if len(outbuf) > 0 { + _arg3 = (*C.void)(unsafe.Pointer(&outbuf[0])) + } + _arg5 = C.GConverterFlags(flags) + + _cret = C._gotk4_gio2_Converter_virtual_convert(unsafe.Pointer(fnarg), _arg0, unsafe.Pointer(_arg1), _arg2, unsafe.Pointer(_arg3), _arg4, _arg5, &_arg6, &_arg7, &_cerr) + runtime.KeepAlive(converter) + runtime.KeepAlive(inbuf) + runtime.KeepAlive(outbuf) + runtime.KeepAlive(flags) + + var _bytesRead uint // out + var _bytesWritten uint // out + var _converterResult ConverterResult // out + var _goerr error // out + + _bytesRead = uint(_arg6) + _bytesWritten = uint(_arg7) + _converterResult = ConverterResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _bytesWritten, _converterResult, _goerr +} + +// Reset resets all internal state in the converter, making it behave as if it +// was just created. If the converter has any internal state that would produce +// output then that output is lost. +func (converter *Converter) reset() { + gclass := (*C.GConverterIface)(coreglib.PeekParentClass(converter)) + fnarg := gclass.reset + + var _arg0 *C.GConverter // out + + _arg0 = (*C.GConverter)(unsafe.Pointer(coreglib.InternObject(converter).Native())) + + C._gotk4_gio2_Converter_virtual_reset(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(converter) +} + +// DBusInterface: base type for D-Bus interfaces. +// +// The GDBusInterface type is the base type for D-Bus interfaces both on +// the service side (see gio.DBusInterfaceSkeleton) and client side (see +// gio.DBusProxy). +// +// DBusInterface wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DBusInterface struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DBusInterface)(nil) +) + +// DBusInterfacer describes DBusInterface's interface methods. +type DBusInterfacer interface { + coreglib.Objector + + // GetObject gets the BusObject that interface_ belongs to, if any. + GetObject() *DBusObject + // Info gets D-Bus introspection information for the D-Bus interface + // implemented by interface_. + Info() *DBusInterfaceInfo + // SetObject sets the BusObject for interface_ to object. + SetObject(object DBusObjector) +} + +var _ DBusInterfacer = (*DBusInterface)(nil) + +func wrapDBusInterface(obj *coreglib.Object) *DBusInterface { + return &DBusInterface{ + Object: obj, + } +} + +func marshalDBusInterface(p uintptr) (interface{}, error) { + return wrapDBusInterface(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// GetObject gets the BusObject that interface_ belongs to, if any. +// +// The function returns the following values: +// +// - dBusObject (optional) or NULL. The returned reference should be freed +// with g_object_unref(). +func (interface_ *DBusInterface) GetObject() *DBusObject { + var _arg0 *C.GDBusInterface // out + var _cret *C.GDBusObject // in + + _arg0 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C.g_dbus_interface_dup_object(_arg0) + runtime.KeepAlive(interface_) + + var _dBusObject *DBusObject // out + + if _cret != nil { + _dBusObject = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _dBusObject +} + +// Info gets D-Bus introspection information for the D-Bus interface implemented +// by interface_. +// +// The function returns the following values: +// +// - dBusInterfaceInfo Do not free. +func (interface_ *DBusInterface) Info() *DBusInterfaceInfo { + var _arg0 *C.GDBusInterface // out + var _cret *C.GDBusInterfaceInfo // in + + _arg0 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C.g_dbus_interface_get_info(_arg0) + runtime.KeepAlive(interface_) + + var _dBusInterfaceInfo *DBusInterfaceInfo // out + + _dBusInterfaceInfo = (*DBusInterfaceInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_interface_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusInterfaceInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_interface_info_unref((*C.GDBusInterfaceInfo)(intern.C)) + }, + ) + + return _dBusInterfaceInfo +} + +// SetObject sets the BusObject for interface_ to object. +// +// Note that interface_ will hold a weak reference to object. +// +// The function takes the following parameters: +// +// - object (optional) or NULL. +func (interface_ *DBusInterface) SetObject(object DBusObjector) { + var _arg0 *C.GDBusInterface // out + var _arg1 *C.GDBusObject // out + + _arg0 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + if object != nil { + _arg1 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + } + + C.g_dbus_interface_set_object(_arg0, _arg1) + runtime.KeepAlive(interface_) + runtime.KeepAlive(object) +} + +// dupObject gets the BusObject that interface_ belongs to, if any. +// +// The function returns the following values: +// +// - dBusObject (optional) or NULL. The returned reference should be freed +// with g_object_unref(). +func (interface_ *DBusInterface) dupObject() *DBusObject { + gclass := (*C.GDBusInterfaceIface)(coreglib.PeekParentClass(interface_)) + fnarg := gclass.dup_object + + var _arg0 *C.GDBusInterface // out + var _cret *C.GDBusObject // in + + _arg0 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C._gotk4_gio2_DBusInterface_virtual_dup_object(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(interface_) + + var _dBusObject *DBusObject // out + + if _cret != nil { + _dBusObject = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _dBusObject +} + +// Info gets D-Bus introspection information for the D-Bus interface implemented +// by interface_. +// +// The function returns the following values: +// +// - dBusInterfaceInfo Do not free. +func (interface_ *DBusInterface) info() *DBusInterfaceInfo { + gclass := (*C.GDBusInterfaceIface)(coreglib.PeekParentClass(interface_)) + fnarg := gclass.get_info + + var _arg0 *C.GDBusInterface // out + var _cret *C.GDBusInterfaceInfo // in + + _arg0 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C._gotk4_gio2_DBusInterface_virtual_get_info(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(interface_) + + var _dBusInterfaceInfo *DBusInterfaceInfo // out + + _dBusInterfaceInfo = (*DBusInterfaceInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_interface_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusInterfaceInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_interface_info_unref((*C.GDBusInterfaceInfo)(intern.C)) + }, + ) + + return _dBusInterfaceInfo +} + +// setObject sets the BusObject for interface_ to object. +// +// Note that interface_ will hold a weak reference to object. +// +// The function takes the following parameters: +// +// - object (optional) or NULL. +func (interface_ *DBusInterface) setObject(object DBusObjector) { + gclass := (*C.GDBusInterfaceIface)(coreglib.PeekParentClass(interface_)) + fnarg := gclass.set_object + + var _arg0 *C.GDBusInterface // out + var _arg1 *C.GDBusObject // out + + _arg0 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + if object != nil { + _arg1 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + } + + C._gotk4_gio2_DBusInterface_virtual_set_object(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(interface_) + runtime.KeepAlive(object) +} + +// DBusObject: GDBusObject type is the base type for D-Bus objects on both +// the service side (see gio.DBusObjectSkeleton) and the client side (see +// gio.DBusObjectProxy). It is essentially just a container of interfaces. +// +// DBusObject wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DBusObject struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DBusObject)(nil) +) + +// DBusObjector describes DBusObject's interface methods. +type DBusObjector interface { + coreglib.Objector + + // Interface gets the D-Bus interface with name interface_name associated + // with object, if any. + Interface(interfaceName string) *DBusInterface + // Interfaces gets the D-Bus interfaces associated with object. + Interfaces() []*DBusInterface + // ObjectPath gets the object path for object. + ObjectPath() string + + // Interface-added is emitted when interface is added to object. + ConnectInterfaceAdded(func(iface DBusInterfacer)) coreglib.SignalHandle + // Interface-removed is emitted when interface is removed from object. + ConnectInterfaceRemoved(func(iface DBusInterfacer)) coreglib.SignalHandle +} + +var _ DBusObjector = (*DBusObject)(nil) + +func wrapDBusObject(obj *coreglib.Object) *DBusObject { + return &DBusObject{ + Object: obj, + } +} + +func marshalDBusObject(p uintptr) (interface{}, error) { + return wrapDBusObject(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectInterfaceAdded is emitted when interface is added to object. +func (object *DBusObject) ConnectInterfaceAdded(f func(iface DBusInterfacer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(object, "interface-added", false, unsafe.Pointer(C._gotk4_gio2_DBusObject_ConnectInterfaceAdded), f) +} + +// ConnectInterfaceRemoved is emitted when interface is removed from object. +func (object *DBusObject) ConnectInterfaceRemoved(f func(iface DBusInterfacer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(object, "interface-removed", false, unsafe.Pointer(C._gotk4_gio2_DBusObject_ConnectInterfaceRemoved), f) +} + +// Interface gets the D-Bus interface with name interface_name associated with +// object, if any. +// +// The function takes the following parameters: +// +// - interfaceName d-Bus interface name. +// +// The function returns the following values: +// +// - dBusInterface (optional): NULL if not found, otherwise a BusInterface +// that must be freed with g_object_unref(). +func (object *DBusObject) Interface(interfaceName string) *DBusInterface { + var _arg0 *C.GDBusObject // out + var _arg1 *C.gchar // out + var _cret *C.GDBusInterface // in + + _arg0 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_object_get_interface(_arg0, _arg1) + runtime.KeepAlive(object) + runtime.KeepAlive(interfaceName) + + var _dBusInterface *DBusInterface // out + + if _cret != nil { + _dBusInterface = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _dBusInterface +} + +// Interfaces gets the D-Bus interfaces associated with object. +// +// The function returns the following values: +// +// - list of BusInterface instances. The returned list must be freed by +// g_list_free() after each element has been freed with g_object_unref(). +func (object *DBusObject) Interfaces() []*DBusInterface { + var _arg0 *C.GDBusObject // out + var _cret *C.GList // in + + _arg0 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + _cret = C.g_dbus_object_get_interfaces(_arg0) + runtime.KeepAlive(object) + + var _list []*DBusInterface // out + + _list = make([]*DBusInterface, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GDBusInterface)(v) + var dst *DBusInterface // out + dst = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// ObjectPath gets the object path for object. +// +// The function returns the following values: +// +// - utf8: string owned by object. Do not free. +func (object *DBusObject) ObjectPath() string { + var _arg0 *C.GDBusObject // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + _cret = C.g_dbus_object_get_object_path(_arg0) + runtime.KeepAlive(object) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Iface gets the D-Bus interface with name interface_name associated with +// object, if any. +// +// The function takes the following parameters: +// +// - interfaceName d-Bus interface name. +// +// The function returns the following values: +// +// - dBusInterface (optional): NULL if not found, otherwise a BusInterface +// that must be freed with g_object_unref(). +func (object *DBusObject) iface(interfaceName string) *DBusInterface { + gclass := (*C.GDBusObjectIface)(coreglib.PeekParentClass(object)) + fnarg := gclass.get_interface + + var _arg0 *C.GDBusObject // out + var _arg1 *C.gchar // out + var _cret *C.GDBusInterface // in + + _arg0 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_DBusObject_virtual_get_interface(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(object) + runtime.KeepAlive(interfaceName) + + var _dBusInterface *DBusInterface // out + + if _cret != nil { + _dBusInterface = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _dBusInterface +} + +// Interfaces gets the D-Bus interfaces associated with object. +// +// The function returns the following values: +// +// - list of BusInterface instances. The returned list must be freed by +// g_list_free() after each element has been freed with g_object_unref(). +func (object *DBusObject) interfaces() []*DBusInterface { + gclass := (*C.GDBusObjectIface)(coreglib.PeekParentClass(object)) + fnarg := gclass.get_interfaces + + var _arg0 *C.GDBusObject // out + var _cret *C.GList // in + + _arg0 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + _cret = C._gotk4_gio2_DBusObject_virtual_get_interfaces(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(object) + + var _list []*DBusInterface // out + + _list = make([]*DBusInterface, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GDBusInterface)(v) + var dst *DBusInterface // out + dst = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// objectPath gets the object path for object. +// +// The function returns the following values: +// +// - utf8: string owned by object. Do not free. +func (object *DBusObject) objectPath() string { + gclass := (*C.GDBusObjectIface)(coreglib.PeekParentClass(object)) + fnarg := gclass.get_object_path + + var _arg0 *C.GDBusObject // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + _cret = C._gotk4_gio2_DBusObject_virtual_get_object_path(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(object) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// interfaceAdded: signal handler for the BusObject::interface-added signal. +func (object *DBusObject) interfaceAdded(interface_ DBusInterfacer) { + gclass := (*C.GDBusObjectIface)(coreglib.PeekParentClass(object)) + fnarg := gclass.interface_added + + var _arg0 *C.GDBusObject // out + var _arg1 *C.GDBusInterface // out + + _arg0 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg1 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + C._gotk4_gio2_DBusObject_virtual_interface_added(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(object) + runtime.KeepAlive(interface_) +} + +// interfaceRemoved: signal handler for the BusObject::interface-removed signal. +func (object *DBusObject) interfaceRemoved(interface_ DBusInterfacer) { + gclass := (*C.GDBusObjectIface)(coreglib.PeekParentClass(object)) + fnarg := gclass.interface_removed + + var _arg0 *C.GDBusObject // out + var _arg1 *C.GDBusInterface // out + + _arg0 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg1 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + C._gotk4_gio2_DBusObject_virtual_interface_removed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(object) + runtime.KeepAlive(interface_) +} + +// DBusObjectManager: GDBusObjectManager type is the base +// type for service- and client-side implementations of +// the standardized org.freedesktop.DBus.ObjectManager +// (http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager) +// interface. +// +// See gio.DBusObjectManagerClient for the client-side implementation and +// gio.DBusObjectManagerServer for the service-side implementation. +// +// DBusObjectManager wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DBusObjectManager struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DBusObjectManager)(nil) +) + +// DBusObjectManagerer describes DBusObjectManager's interface methods. +type DBusObjectManagerer interface { + coreglib.Objector + + // Interface gets the interface proxy for interface_name at object_path, + // if any. + Interface(objectPath, interfaceName string) *DBusInterface + // GetObject gets the BusObject at object_path, if any. + GetObject(objectPath string) *DBusObject + // ObjectPath gets the object path that manager is for. + ObjectPath() string + // Objects gets all BusObject objects known to manager. + Objects() []*DBusObject + + // Interface-added is emitted when interface is added to object. + ConnectInterfaceAdded(func(object DBusObjector, iface DBusInterfacer)) coreglib.SignalHandle + // Interface-removed is emitted when interface has been removed from object. + ConnectInterfaceRemoved(func(object DBusObjector, iface DBusInterfacer)) coreglib.SignalHandle + // Object-added is emitted when object is added to manager. + ConnectObjectAdded(func(object DBusObjector)) coreglib.SignalHandle + // Object-removed is emitted when object is removed from manager. + ConnectObjectRemoved(func(object DBusObjector)) coreglib.SignalHandle +} + +var _ DBusObjectManagerer = (*DBusObjectManager)(nil) + +func wrapDBusObjectManager(obj *coreglib.Object) *DBusObjectManager { + return &DBusObjectManager{ + Object: obj, + } +} + +func marshalDBusObjectManager(p uintptr) (interface{}, error) { + return wrapDBusObjectManager(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectInterfaceAdded is emitted when interface is added to object. +// +// This signal exists purely as a convenience to avoid having to connect signals +// to all objects managed by manager. +func (manager *DBusObjectManager) ConnectInterfaceAdded(f func(object DBusObjector, iface DBusInterfacer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(manager, "interface-added", false, unsafe.Pointer(C._gotk4_gio2_DBusObjectManager_ConnectInterfaceAdded), f) +} + +// ConnectInterfaceRemoved is emitted when interface has been removed from +// object. +// +// This signal exists purely as a convenience to avoid having to connect signals +// to all objects managed by manager. +func (manager *DBusObjectManager) ConnectInterfaceRemoved(f func(object DBusObjector, iface DBusInterfacer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(manager, "interface-removed", false, unsafe.Pointer(C._gotk4_gio2_DBusObjectManager_ConnectInterfaceRemoved), f) +} + +// ConnectObjectAdded is emitted when object is added to manager. +func (manager *DBusObjectManager) ConnectObjectAdded(f func(object DBusObjector)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(manager, "object-added", false, unsafe.Pointer(C._gotk4_gio2_DBusObjectManager_ConnectObjectAdded), f) +} + +// ConnectObjectRemoved is emitted when object is removed from manager. +func (manager *DBusObjectManager) ConnectObjectRemoved(f func(object DBusObjector)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(manager, "object-removed", false, unsafe.Pointer(C._gotk4_gio2_DBusObjectManager_ConnectObjectRemoved), f) +} + +// Interface gets the interface proxy for interface_name at object_path, if any. +// +// The function takes the following parameters: +// +// - objectPath: object path to look up. +// - interfaceName d-Bus interface name to look up. +// +// The function returns the following values: +// +// - dBusInterface (optional) instance or NULL. Free with g_object_unref(). +func (manager *DBusObjectManager) Interface(objectPath, interfaceName string) *DBusInterface { + var _arg0 *C.GDBusObjectManager // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GDBusInterface // in + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_dbus_object_manager_get_interface(_arg0, _arg1, _arg2) + runtime.KeepAlive(manager) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceName) + + var _dBusInterface *DBusInterface // out + + if _cret != nil { + _dBusInterface = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _dBusInterface +} + +// GetObject gets the BusObject at object_path, if any. +// +// The function takes the following parameters: +// +// - objectPath: object path to look up. +// +// The function returns the following values: +// +// - dBusObject (optional) or NULL. Free with g_object_unref(). +func (manager *DBusObjectManager) GetObject(objectPath string) *DBusObject { + var _arg0 *C.GDBusObjectManager // out + var _arg1 *C.gchar // out + var _cret *C.GDBusObject // in + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_object_manager_get_object(_arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(objectPath) + + var _dBusObject *DBusObject // out + + if _cret != nil { + _dBusObject = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _dBusObject +} + +// ObjectPath gets the object path that manager is for. +// +// The function returns the following values: +// +// - utf8: string owned by manager. Do not free. +func (manager *DBusObjectManager) ObjectPath() string { + var _arg0 *C.GDBusObjectManager // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C.g_dbus_object_manager_get_object_path(_arg0) + runtime.KeepAlive(manager) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Objects gets all BusObject objects known to manager. +// +// The function returns the following values: +// +// - list of BusObject objects. The returned list should be freed with +// g_list_free() after each element has been freed with g_object_unref(). +func (manager *DBusObjectManager) Objects() []*DBusObject { + var _arg0 *C.GDBusObjectManager // out + var _cret *C.GList // in + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C.g_dbus_object_manager_get_objects(_arg0) + runtime.KeepAlive(manager) + + var _list []*DBusObject // out + + _list = make([]*DBusObject, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GDBusObject)(v) + var dst *DBusObject // out + dst = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// Iface gets the interface proxy for interface_name at object_path, if any. +// +// The function takes the following parameters: +// +// - objectPath: object path to look up. +// - interfaceName d-Bus interface name to look up. +// +// The function returns the following values: +// +// - dBusInterface (optional) instance or NULL. Free with g_object_unref(). +func (manager *DBusObjectManager) iface(objectPath, interfaceName string) *DBusInterface { + gclass := (*C.GDBusObjectManagerIface)(coreglib.PeekParentClass(manager)) + fnarg := gclass.get_interface + + var _arg0 *C.GDBusObjectManager // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GDBusInterface // in + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C._gotk4_gio2_DBusObjectManager_virtual_get_interface(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(manager) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceName) + + var _dBusInterface *DBusInterface // out + + if _cret != nil { + _dBusInterface = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _dBusInterface +} + +// getObject gets the BusObject at object_path, if any. +// +// The function takes the following parameters: +// +// - objectPath: object path to look up. +// +// The function returns the following values: +// +// - dBusObject (optional) or NULL. Free with g_object_unref(). +func (manager *DBusObjectManager) getObject(objectPath string) *DBusObject { + gclass := (*C.GDBusObjectManagerIface)(coreglib.PeekParentClass(manager)) + fnarg := gclass.get_object + + var _arg0 *C.GDBusObjectManager // out + var _arg1 *C.gchar // out + var _cret *C.GDBusObject // in + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_DBusObjectManager_virtual_get_object(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(objectPath) + + var _dBusObject *DBusObject // out + + if _cret != nil { + _dBusObject = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _dBusObject +} + +// objectPath gets the object path that manager is for. +// +// The function returns the following values: +// +// - utf8: string owned by manager. Do not free. +func (manager *DBusObjectManager) objectPath() string { + gclass := (*C.GDBusObjectManagerIface)(coreglib.PeekParentClass(manager)) + fnarg := gclass.get_object_path + + var _arg0 *C.GDBusObjectManager // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C._gotk4_gio2_DBusObjectManager_virtual_get_object_path(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(manager) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Objects gets all BusObject objects known to manager. +// +// The function returns the following values: +// +// - list of BusObject objects. The returned list should be freed with +// g_list_free() after each element has been freed with g_object_unref(). +func (manager *DBusObjectManager) objects() []*DBusObject { + gclass := (*C.GDBusObjectManagerIface)(coreglib.PeekParentClass(manager)) + fnarg := gclass.get_objects + + var _arg0 *C.GDBusObjectManager // out + var _cret *C.GList // in + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C._gotk4_gio2_DBusObjectManager_virtual_get_objects(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(manager) + + var _list []*DBusObject // out + + _list = make([]*DBusObject, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GDBusObject)(v) + var dst *DBusObject // out + dst = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// interfaceAdded: signal handler for the BusObjectManager::interface-added +// signal. +// +// The function takes the following parameters: +// +// - object +// - interface_ +func (manager *DBusObjectManager) interfaceAdded(object DBusObjector, interface_ DBusInterfacer) { + gclass := (*C.GDBusObjectManagerIface)(coreglib.PeekParentClass(manager)) + fnarg := gclass.interface_added + + var _arg0 *C.GDBusObjectManager // out + var _arg1 *C.GDBusObject // out + var _arg2 *C.GDBusInterface // out + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg2 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + C._gotk4_gio2_DBusObjectManager_virtual_interface_added(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(manager) + runtime.KeepAlive(object) + runtime.KeepAlive(interface_) +} + +// interfaceRemoved: signal handler for the BusObjectManager::interface-removed +// signal. +// +// The function takes the following parameters: +// +// - object +// - interface_ +func (manager *DBusObjectManager) interfaceRemoved(object DBusObjector, interface_ DBusInterfacer) { + gclass := (*C.GDBusObjectManagerIface)(coreglib.PeekParentClass(manager)) + fnarg := gclass.interface_removed + + var _arg0 *C.GDBusObjectManager // out + var _arg1 *C.GDBusObject // out + var _arg2 *C.GDBusInterface // out + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg2 = (*C.GDBusInterface)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + C._gotk4_gio2_DBusObjectManager_virtual_interface_removed(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(manager) + runtime.KeepAlive(object) + runtime.KeepAlive(interface_) +} + +// objectAdded: signal handler for the BusObjectManager::object-added signal. +func (manager *DBusObjectManager) objectAdded(object DBusObjector) { + gclass := (*C.GDBusObjectManagerIface)(coreglib.PeekParentClass(manager)) + fnarg := gclass.object_added + + var _arg0 *C.GDBusObjectManager // out + var _arg1 *C.GDBusObject // out + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + C._gotk4_gio2_DBusObjectManager_virtual_object_added(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(object) +} + +// objectRemoved: signal handler for the BusObjectManager::object-removed +// signal. +func (manager *DBusObjectManager) objectRemoved(object DBusObjector) { + gclass := (*C.GDBusObjectManagerIface)(coreglib.PeekParentClass(manager)) + fnarg := gclass.object_removed + + var _arg0 *C.GDBusObjectManager // out + var _arg1 *C.GDBusObject // out + + _arg0 = (*C.GDBusObjectManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.GDBusObject)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + C._gotk4_gio2_DBusObjectManager_virtual_object_removed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(object) +} + +// DatagramBased: interface for socket-like objects with datagram semantics. +// +// A GDatagramBased is a networking interface for representing datagram-based +// communications. It is a more or less direct mapping of the core parts of +// the BSD socket API in a portable GObject interface. It is implemented by +// gio.Socket, which wraps the UNIX socket API on UNIX and winsock2 on Windows. +// +// GDatagramBased is entirely platform independent, and is intended to be used +// alongside higher-level networking APIs such as gio.IOStream. +// +// It uses vectored scatter/gather I/O by default, allowing for many messages +// to be sent or received in a single call. Where possible, implementations of +// the interface should take advantage of vectored I/O to minimise processing +// or system calls. For example, GSocket uses recvmmsg() and sendmmsg() where +// possible. Callers should take advantage of scatter/gather I/O (the use +// of multiple buffers per message) to avoid unnecessary copying of data to +// assemble or disassemble a message. +// +// Each GDatagramBased operation has a timeout parameter which may be negative +// for blocking behaviour, zero for non-blocking behaviour, or positive for +// timeout behaviour. A blocking operation blocks until finished or there +// is an error. A non-blocking operation will return immediately with a +// G_IO_ERROR_WOULD_BLOCK error if it cannot make progress. A timeout operation +// will block until the operation is complete or the timeout expires; if the +// timeout expires it will return what progress it made, or G_IO_ERROR_TIMED_OUT +// if no progress was made. To know when a call would successfully run you can +// call gio.DatagramBased.ConditionCheck() or gio.DatagramBased.ConditionWait(). +// You can also use gio.DatagramBased.CreateSource() and attach it to a +// glib.MainContext to get callbacks when I/O is possible. +// +// When running a non-blocking operation applications should always be able +// to handle getting a G_IO_ERROR_WOULD_BLOCK error even when some other +// function said that I/O was possible. This can easily happen in case of a +// race condition in the application, but it can also happen for other reasons. +// For instance, on Windows a socket is always seen as writable until a write +// returns G_IO_ERROR_WOULD_BLOCK. +// +// As with GSocket, GDatagramBaseds can be either connection oriented (for +// example, SCTP) or connectionless (for example, UDP). GDatagramBaseds +// must be datagram-based, not stream-based. The interface does not cover +// connection establishment — use methods on the underlying type to establish a +// connection before sending and receiving data through the GDatagramBased API. +// For connectionless socket types the target/source address is specified or +// received in each I/O operation. +// +// Like most other APIs in GLib, GDatagramBased is not inherently thread safe. +// To use a GDatagramBased concurrently from multiple threads, you must +// implement your own locking. +// +// DatagramBased wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DatagramBased struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DatagramBased)(nil) +) + +// DatagramBasedder describes DatagramBased's interface methods. +type DatagramBasedder interface { + coreglib.Objector + + // ConditionCheck checks on the readiness of datagram_based to perform + // operations. + ConditionCheck(condition glib.IOCondition) glib.IOCondition + // ConditionWait waits for up to timeout microseconds for condition to + // become true on datagram_based. + ConditionWait(ctx context.Context, condition glib.IOCondition, timeout int64) error + // CreateSource creates a #GSource that can be attached to a Context to + // monitor for the availability of the specified condition on the Based. + CreateSource(ctx context.Context, condition glib.IOCondition) *glib.Source + // ReceiveMessages: receive one or more data messages from datagram_based in + // one go. + ReceiveMessages(ctx context.Context, messages []InputMessage, flags int, timeout int64) (int, error) + // SendMessages: send one or more data messages from datagram_based in one + // go. + SendMessages(ctx context.Context, messages []OutputMessage, flags int, timeout int64) (int, error) +} + +var _ DatagramBasedder = (*DatagramBased)(nil) + +func wrapDatagramBased(obj *coreglib.Object) *DatagramBased { + return &DatagramBased{ + Object: obj, + } +} + +func marshalDatagramBased(p uintptr) (interface{}, error) { + return wrapDatagramBased(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConditionCheck checks on the readiness of datagram_based to perform +// operations. The operations specified in condition are checked for and masked +// against the currently-satisfied conditions on datagram_based. The result is +// returned. +// +// G_IO_IN will be set in the return value if data is available to read +// with g_datagram_based_receive_messages(), or if the connection is closed +// remotely (EOS); and if the datagram_based has not been closed locally +// using some implementation-specific method (such as g_socket_close() or +// g_socket_shutdown() with shutdown_read set, if it’s a #GSocket). +// +// If the connection is shut down or closed (by calling g_socket_close() or +// g_socket_shutdown() with shutdown_read set, if it’s a #GSocket, for example), +// all calls to this function will return G_IO_ERROR_CLOSED. +// +// G_IO_OUT will be set if it is expected that at least one byte can be sent +// using g_datagram_based_send_messages() without blocking. It will not be set +// if the datagram_based has been closed locally. +// +// G_IO_HUP will be set if the connection has been closed locally. +// +// G_IO_ERR will be set if there was an asynchronous error in transmitting data +// previously enqueued using g_datagram_based_send_messages(). +// +// Note that on Windows, it is possible for an operation +// to return G_IO_ERROR_WOULD_BLOCK even immediately after +// g_datagram_based_condition_check() has claimed that the Based is ready for +// writing. Rather than calling g_datagram_based_condition_check() and then +// writing to the Based if it succeeds, it is generally better to simply try +// writing right away, and try again later if the initial attempt returns +// G_IO_ERROR_WOULD_BLOCK. +// +// It is meaningless to specify G_IO_ERR or G_IO_HUP in condition; these +// conditions will always be set in the output if they are true. Apart from +// these flags, the output is guaranteed to be masked by condition. +// +// This call never blocks. +// +// The function takes the following parameters: +// +// - condition mask to check. +// +// The function returns the following values: +// +// - ioCondition mask of the current state. +func (datagramBased *DatagramBased) ConditionCheck(condition glib.IOCondition) glib.IOCondition { + var _arg0 *C.GDatagramBased // out + var _arg1 C.GIOCondition // out + var _cret C.GIOCondition // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + _arg1 = C.GIOCondition(condition) + + _cret = C.g_datagram_based_condition_check(_arg0, _arg1) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(condition) + + var _ioCondition glib.IOCondition // out + + _ioCondition = glib.IOCondition(_cret) + + return _ioCondition +} + +// ConditionWait waits for up to timeout microseconds for condition to become +// true on datagram_based. If the condition is met, TRUE is returned. +// +// If cancellable is cancelled before the condition is met, or if timeout is +// reached before the condition is met, then FALSE is returned and error is set +// appropriately (G_IO_ERROR_CANCELLED or G_IO_ERROR_TIMED_OUT). +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - condition mask to wait for. +// - timeout: maximum time (in microseconds) to wait, 0 to not block, or -1 to +// block indefinitely. +func (datagramBased *DatagramBased) ConditionWait(ctx context.Context, condition glib.IOCondition, timeout int64) error { + var _arg0 *C.GDatagramBased // out + var _arg3 *C.GCancellable // out + var _arg1 C.GIOCondition // out + var _arg2 C.gint64 // out + var _cerr *C.GError // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GIOCondition(condition) + _arg2 = C.gint64(timeout) + + C.g_datagram_based_condition_wait(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(ctx) + runtime.KeepAlive(condition) + runtime.KeepAlive(timeout) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CreateSource creates a #GSource that can be attached to a Context to monitor +// for the availability of the specified condition on the Based. The #GSource +// keeps a reference to the datagram_based. +// +// The callback on the source is of the BasedSourceFunc type. +// +// It is meaningless to specify G_IO_ERR or G_IO_HUP in condition; these +// conditions will always be reported in the callback if they are true. +// +// If non-NULL, cancellable can be used to cancel the source, which will cause +// the source to trigger, reporting the current condition (which is likely +// 0 unless cancellation happened at the same time as a condition change). +// You can check for this in the callback using g_cancellable_is_cancelled(). +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - condition mask to monitor. +// +// The function returns the following values: +// +// - source: newly allocated #GSource. +func (datagramBased *DatagramBased) CreateSource(ctx context.Context, condition glib.IOCondition) *glib.Source { + var _arg0 *C.GDatagramBased // out + var _arg2 *C.GCancellable // out + var _arg1 C.GIOCondition // out + var _cret *C.GSource // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GIOCondition(condition) + + _cret = C.g_datagram_based_create_source(_arg0, _arg1, _arg2) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(ctx) + runtime.KeepAlive(condition) + + var _source *glib.Source // out + + _source = (*glib.Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// ReceiveMessages: receive one or more data messages from datagram_based in one +// go. +// +// messages must point to an array of Message structs and num_messages must +// be the length of this array. Each Message contains a pointer to an array of +// Vector structs describing the buffers that the data received in each message +// will be written to. +// +// flags modify how all messages are received. The commonly available arguments +// for this are available in the MsgFlags enum, but the values there are the +// same as the system values, and the flags are passed in as-is, so you can +// pass in system-specific flags too. These flags affect the overall receive +// operation. Flags affecting individual messages are returned in Message.flags. +// +// The other members of Message are treated as described in its documentation. +// +// If timeout is negative the call will block until num_messages have been +// received, the connection is closed remotely (EOS), cancellable is cancelled, +// or an error occurs. +// +// If timeout is 0 the call will return up to num_messages without blocking, +// or G_IO_ERROR_WOULD_BLOCK if no messages are queued in the operating system +// to be received. +// +// If timeout is positive the call will block on the same conditions as if +// timeout were negative. If the timeout is reached before any messages are +// received, G_IO_ERROR_TIMED_OUT is returned, otherwise it will return the +// number of messages received before timing out. (Note: This is effectively the +// behaviour of MSG_WAITFORONE with recvmmsg().) +// +// To be notified when messages are available, wait for the G_IO_IN condition. +// Note though that you may still receive G_IO_ERROR_WOULD_BLOCK from +// g_datagram_based_receive_messages() even if you were previously notified of a +// G_IO_IN condition. +// +// If the remote peer closes the connection, any messages queued in the +// underlying receive buffer will be returned, and subsequent calls to +// g_datagram_based_receive_messages() will return 0 (with no error set). +// +// If the connection is shut down or closed (by calling g_socket_close() or +// g_socket_shutdown() with shutdown_read set, if it’s a #GSocket, for example), +// all calls to this function will return G_IO_ERROR_CLOSED. +// +// On error -1 is returned and error is set accordingly. An error will only be +// returned if zero messages could be received; otherwise the number of messages +// successfully received before the error will be returned. If cancellable is +// cancelled, G_IO_ERROR_CANCELLED is returned as with any other error. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable. +// - messages: array of Message structs. +// - flags: int containing MsgFlags flags for the overall operation. +// - timeout: maximum time (in microseconds) to wait, 0 to not block, or -1 to +// block indefinitely. +// +// The function returns the following values: +// +// - gint: number of messages received, or -1 on error. Note that the number +// of messages received may be smaller than num_messages if timeout is zero +// or positive, if the peer closed the connection, or if num_messages was +// larger than UIO_MAXIOV (1024), in which case the caller may re-try to +// receive the remaining messages. +func (datagramBased *DatagramBased) ReceiveMessages(ctx context.Context, messages []InputMessage, flags int, timeout int64) (int, error) { + var _arg0 *C.GDatagramBased // out + var _arg5 *C.GCancellable // out + var _arg1 *C.GInputMessage // out + var _arg2 C.guint + var _arg3 C.gint // out + var _arg4 C.gint64 // out + var _cret C.gint // in + var _cerr *C.GError // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.guint)(len(messages)) + _arg1 = (*C.GInputMessage)(C.calloc(C.size_t(len(messages)), C.size_t(C.sizeof_GInputMessage))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GInputMessage)(_arg1), len(messages)) + for i := range messages { + out[i] = *(*C.GInputMessage)(gextras.StructNative(unsafe.Pointer((&messages[i])))) + } + } + _arg3 = C.gint(flags) + _arg4 = C.gint64(timeout) + + _cret = C.g_datagram_based_receive_messages(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(ctx) + runtime.KeepAlive(messages) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeout) + + var _gint int // out + var _goerr error // out + + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint, _goerr +} + +// SendMessages: send one or more data messages from datagram_based in one go. +// +// messages must point to an array of Message structs and num_messages must be +// the length of this array. Each Message contains an address to send the data +// to, and a pointer to an array of Vector structs to describe the buffers that +// the data to be sent for each message will be gathered from. +// +// flags modify how the message is sent. The commonly available arguments for +// this are available in the MsgFlags enum, but the values there are the same +// as the system values, and the flags are passed in as-is, so you can pass in +// system-specific flags too. +// +// The other members of Message are treated as described in its documentation. +// +// If timeout is negative the call will block until num_messages have been sent, +// cancellable is cancelled, or an error occurs. +// +// If timeout is 0 the call will send up to num_messages without blocking, +// or will return G_IO_ERROR_WOULD_BLOCK if there is no space to send messages. +// +// If timeout is positive the call will block on the same conditions as if +// timeout were negative. If the timeout is reached before any messages are +// sent, G_IO_ERROR_TIMED_OUT is returned, otherwise it will return the number +// of messages sent before timing out. +// +// To be notified when messages can be sent, wait for the G_IO_OUT condition. +// Note though that you may still receive G_IO_ERROR_WOULD_BLOCK from +// g_datagram_based_send_messages() even if you were previously notified of a +// G_IO_OUT condition. (On Windows in particular, this is very common due to the +// way the underlying APIs work.) +// +// If the connection is shut down or closed (by calling g_socket_close() +// or g_socket_shutdown() with shutdown_write set, if it’s a #GSocket, for +// example), all calls to this function will return G_IO_ERROR_CLOSED. +// +// On error -1 is returned and error is set accordingly. An error will only be +// returned if zero messages could be sent; otherwise the number of messages +// successfully sent before the error will be returned. If cancellable is +// cancelled, G_IO_ERROR_CANCELLED is returned as with any other error. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable. +// - messages: array of Message structs. +// - flags: int containing MsgFlags flags. +// - timeout: maximum time (in microseconds) to wait, 0 to not block, or -1 to +// block indefinitely. +// +// The function returns the following values: +// +// - gint: number of messages sent, or -1 on error. Note that the number of +// messages sent may be smaller than num_messages if timeout is zero or +// positive, or if num_messages was larger than UIO_MAXIOV (1024), in which +// case the caller may re-try to send the remaining messages. +func (datagramBased *DatagramBased) SendMessages(ctx context.Context, messages []OutputMessage, flags int, timeout int64) (int, error) { + var _arg0 *C.GDatagramBased // out + var _arg5 *C.GCancellable // out + var _arg1 *C.GOutputMessage // out + var _arg2 C.guint + var _arg3 C.gint // out + var _arg4 C.gint64 // out + var _cret C.gint // in + var _cerr *C.GError // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.guint)(len(messages)) + _arg1 = (*C.GOutputMessage)(C.calloc(C.size_t(len(messages)), C.size_t(C.sizeof_GOutputMessage))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputMessage)(_arg1), len(messages)) + for i := range messages { + out[i] = *(*C.GOutputMessage)(gextras.StructNative(unsafe.Pointer((&messages[i])))) + } + } + _arg3 = C.gint(flags) + _arg4 = C.gint64(timeout) + + _cret = C.g_datagram_based_send_messages(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(ctx) + runtime.KeepAlive(messages) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeout) + + var _gint int // out + var _goerr error // out + + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint, _goerr +} + +// conditionCheck checks on the readiness of datagram_based to perform +// operations. The operations specified in condition are checked for and masked +// against the currently-satisfied conditions on datagram_based. The result is +// returned. +// +// G_IO_IN will be set in the return value if data is available to read +// with g_datagram_based_receive_messages(), or if the connection is closed +// remotely (EOS); and if the datagram_based has not been closed locally +// using some implementation-specific method (such as g_socket_close() or +// g_socket_shutdown() with shutdown_read set, if it’s a #GSocket). +// +// If the connection is shut down or closed (by calling g_socket_close() or +// g_socket_shutdown() with shutdown_read set, if it’s a #GSocket, for example), +// all calls to this function will return G_IO_ERROR_CLOSED. +// +// G_IO_OUT will be set if it is expected that at least one byte can be sent +// using g_datagram_based_send_messages() without blocking. It will not be set +// if the datagram_based has been closed locally. +// +// G_IO_HUP will be set if the connection has been closed locally. +// +// G_IO_ERR will be set if there was an asynchronous error in transmitting data +// previously enqueued using g_datagram_based_send_messages(). +// +// Note that on Windows, it is possible for an operation +// to return G_IO_ERROR_WOULD_BLOCK even immediately after +// g_datagram_based_condition_check() has claimed that the Based is ready for +// writing. Rather than calling g_datagram_based_condition_check() and then +// writing to the Based if it succeeds, it is generally better to simply try +// writing right away, and try again later if the initial attempt returns +// G_IO_ERROR_WOULD_BLOCK. +// +// It is meaningless to specify G_IO_ERR or G_IO_HUP in condition; these +// conditions will always be set in the output if they are true. Apart from +// these flags, the output is guaranteed to be masked by condition. +// +// This call never blocks. +// +// The function takes the following parameters: +// +// - condition mask to check. +// +// The function returns the following values: +// +// - ioCondition mask of the current state. +func (datagramBased *DatagramBased) conditionCheck(condition glib.IOCondition) glib.IOCondition { + gclass := (*C.GDatagramBasedInterface)(coreglib.PeekParentClass(datagramBased)) + fnarg := gclass.condition_check + + var _arg0 *C.GDatagramBased // out + var _arg1 C.GIOCondition // out + var _cret C.GIOCondition // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + _arg1 = C.GIOCondition(condition) + + _cret = C._gotk4_gio2_DatagramBased_virtual_condition_check(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(condition) + + var _ioCondition glib.IOCondition // out + + _ioCondition = glib.IOCondition(_cret) + + return _ioCondition +} + +// conditionWait waits for up to timeout microseconds for condition to become +// true on datagram_based. If the condition is met, TRUE is returned. +// +// If cancellable is cancelled before the condition is met, or if timeout is +// reached before the condition is met, then FALSE is returned and error is set +// appropriately (G_IO_ERROR_CANCELLED or G_IO_ERROR_TIMED_OUT). +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - condition mask to wait for. +// - timeout: maximum time (in microseconds) to wait, 0 to not block, or -1 to +// block indefinitely. +func (datagramBased *DatagramBased) conditionWait(ctx context.Context, condition glib.IOCondition, timeout int64) error { + gclass := (*C.GDatagramBasedInterface)(coreglib.PeekParentClass(datagramBased)) + fnarg := gclass.condition_wait + + var _arg0 *C.GDatagramBased // out + var _arg3 *C.GCancellable // out + var _arg1 C.GIOCondition // out + var _arg2 C.gint64 // out + var _cerr *C.GError // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GIOCondition(condition) + _arg2 = C.gint64(timeout) + + C._gotk4_gio2_DatagramBased_virtual_condition_wait(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(ctx) + runtime.KeepAlive(condition) + runtime.KeepAlive(timeout) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// createSource creates a #GSource that can be attached to a Context to monitor +// for the availability of the specified condition on the Based. The #GSource +// keeps a reference to the datagram_based. +// +// The callback on the source is of the BasedSourceFunc type. +// +// It is meaningless to specify G_IO_ERR or G_IO_HUP in condition; these +// conditions will always be reported in the callback if they are true. +// +// If non-NULL, cancellable can be used to cancel the source, which will cause +// the source to trigger, reporting the current condition (which is likely +// 0 unless cancellation happened at the same time as a condition change). +// You can check for this in the callback using g_cancellable_is_cancelled(). +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - condition mask to monitor. +// +// The function returns the following values: +// +// - source: newly allocated #GSource. +func (datagramBased *DatagramBased) createSource(ctx context.Context, condition glib.IOCondition) *glib.Source { + gclass := (*C.GDatagramBasedInterface)(coreglib.PeekParentClass(datagramBased)) + fnarg := gclass.create_source + + var _arg0 *C.GDatagramBased // out + var _arg2 *C.GCancellable // out + var _arg1 C.GIOCondition // out + var _cret *C.GSource // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GIOCondition(condition) + + _cret = C._gotk4_gio2_DatagramBased_virtual_create_source(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(ctx) + runtime.KeepAlive(condition) + + var _source *glib.Source // out + + _source = (*glib.Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// receiveMessages: receive one or more data messages from datagram_based in one +// go. +// +// messages must point to an array of Message structs and num_messages must +// be the length of this array. Each Message contains a pointer to an array of +// Vector structs describing the buffers that the data received in each message +// will be written to. +// +// flags modify how all messages are received. The commonly available arguments +// for this are available in the MsgFlags enum, but the values there are the +// same as the system values, and the flags are passed in as-is, so you can +// pass in system-specific flags too. These flags affect the overall receive +// operation. Flags affecting individual messages are returned in Message.flags. +// +// The other members of Message are treated as described in its documentation. +// +// If timeout is negative the call will block until num_messages have been +// received, the connection is closed remotely (EOS), cancellable is cancelled, +// or an error occurs. +// +// If timeout is 0 the call will return up to num_messages without blocking, +// or G_IO_ERROR_WOULD_BLOCK if no messages are queued in the operating system +// to be received. +// +// If timeout is positive the call will block on the same conditions as if +// timeout were negative. If the timeout is reached before any messages are +// received, G_IO_ERROR_TIMED_OUT is returned, otherwise it will return the +// number of messages received before timing out. (Note: This is effectively the +// behaviour of MSG_WAITFORONE with recvmmsg().) +// +// To be notified when messages are available, wait for the G_IO_IN condition. +// Note though that you may still receive G_IO_ERROR_WOULD_BLOCK from +// g_datagram_based_receive_messages() even if you were previously notified of a +// G_IO_IN condition. +// +// If the remote peer closes the connection, any messages queued in the +// underlying receive buffer will be returned, and subsequent calls to +// g_datagram_based_receive_messages() will return 0 (with no error set). +// +// If the connection is shut down or closed (by calling g_socket_close() or +// g_socket_shutdown() with shutdown_read set, if it’s a #GSocket, for example), +// all calls to this function will return G_IO_ERROR_CLOSED. +// +// On error -1 is returned and error is set accordingly. An error will only be +// returned if zero messages could be received; otherwise the number of messages +// successfully received before the error will be returned. If cancellable is +// cancelled, G_IO_ERROR_CANCELLED is returned as with any other error. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable. +// - messages: array of Message structs. +// - flags: int containing MsgFlags flags for the overall operation. +// - timeout: maximum time (in microseconds) to wait, 0 to not block, or -1 to +// block indefinitely. +// +// The function returns the following values: +// +// - gint: number of messages received, or -1 on error. Note that the number +// of messages received may be smaller than num_messages if timeout is zero +// or positive, if the peer closed the connection, or if num_messages was +// larger than UIO_MAXIOV (1024), in which case the caller may re-try to +// receive the remaining messages. +func (datagramBased *DatagramBased) receiveMessages(ctx context.Context, messages []InputMessage, flags int, timeout int64) (int, error) { + gclass := (*C.GDatagramBasedInterface)(coreglib.PeekParentClass(datagramBased)) + fnarg := gclass.receive_messages + + var _arg0 *C.GDatagramBased // out + var _arg5 *C.GCancellable // out + var _arg1 *C.GInputMessage // out + var _arg2 C.guint + var _arg3 C.gint // out + var _arg4 C.gint64 // out + var _cret C.gint // in + var _cerr *C.GError // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.guint)(len(messages)) + _arg1 = (*C.GInputMessage)(C.calloc(C.size_t(len(messages)), C.size_t(C.sizeof_GInputMessage))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GInputMessage)(_arg1), len(messages)) + for i := range messages { + out[i] = *(*C.GInputMessage)(gextras.StructNative(unsafe.Pointer((&messages[i])))) + } + } + _arg3 = C.gint(flags) + _arg4 = C.gint64(timeout) + + _cret = C._gotk4_gio2_DatagramBased_virtual_receive_messages(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(ctx) + runtime.KeepAlive(messages) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeout) + + var _gint int // out + var _goerr error // out + + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint, _goerr +} + +// sendMessages: send one or more data messages from datagram_based in one go. +// +// messages must point to an array of Message structs and num_messages must be +// the length of this array. Each Message contains an address to send the data +// to, and a pointer to an array of Vector structs to describe the buffers that +// the data to be sent for each message will be gathered from. +// +// flags modify how the message is sent. The commonly available arguments for +// this are available in the MsgFlags enum, but the values there are the same +// as the system values, and the flags are passed in as-is, so you can pass in +// system-specific flags too. +// +// The other members of Message are treated as described in its documentation. +// +// If timeout is negative the call will block until num_messages have been sent, +// cancellable is cancelled, or an error occurs. +// +// If timeout is 0 the call will send up to num_messages without blocking, +// or will return G_IO_ERROR_WOULD_BLOCK if there is no space to send messages. +// +// If timeout is positive the call will block on the same conditions as if +// timeout were negative. If the timeout is reached before any messages are +// sent, G_IO_ERROR_TIMED_OUT is returned, otherwise it will return the number +// of messages sent before timing out. +// +// To be notified when messages can be sent, wait for the G_IO_OUT condition. +// Note though that you may still receive G_IO_ERROR_WOULD_BLOCK from +// g_datagram_based_send_messages() even if you were previously notified of a +// G_IO_OUT condition. (On Windows in particular, this is very common due to the +// way the underlying APIs work.) +// +// If the connection is shut down or closed (by calling g_socket_close() +// or g_socket_shutdown() with shutdown_write set, if it’s a #GSocket, for +// example), all calls to this function will return G_IO_ERROR_CLOSED. +// +// On error -1 is returned and error is set accordingly. An error will only be +// returned if zero messages could be sent; otherwise the number of messages +// successfully sent before the error will be returned. If cancellable is +// cancelled, G_IO_ERROR_CANCELLED is returned as with any other error. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable. +// - messages: array of Message structs. +// - flags: int containing MsgFlags flags. +// - timeout: maximum time (in microseconds) to wait, 0 to not block, or -1 to +// block indefinitely. +// +// The function returns the following values: +// +// - gint: number of messages sent, or -1 on error. Note that the number of +// messages sent may be smaller than num_messages if timeout is zero or +// positive, or if num_messages was larger than UIO_MAXIOV (1024), in which +// case the caller may re-try to send the remaining messages. +func (datagramBased *DatagramBased) sendMessages(ctx context.Context, messages []OutputMessage, flags int, timeout int64) (int, error) { + gclass := (*C.GDatagramBasedInterface)(coreglib.PeekParentClass(datagramBased)) + fnarg := gclass.send_messages + + var _arg0 *C.GDatagramBased // out + var _arg5 *C.GCancellable // out + var _arg1 *C.GOutputMessage // out + var _arg2 C.guint + var _arg3 C.gint // out + var _arg4 C.gint64 // out + var _cret C.gint // in + var _cerr *C.GError // in + + _arg0 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(datagramBased).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.guint)(len(messages)) + _arg1 = (*C.GOutputMessage)(C.calloc(C.size_t(len(messages)), C.size_t(C.sizeof_GOutputMessage))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputMessage)(_arg1), len(messages)) + for i := range messages { + out[i] = *(*C.GOutputMessage)(gextras.StructNative(unsafe.Pointer((&messages[i])))) + } + } + _arg3 = C.gint(flags) + _arg4 = C.gint64(timeout) + + _cret = C._gotk4_gio2_DatagramBased_virtual_send_messages(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(datagramBased) + runtime.KeepAlive(ctx) + runtime.KeepAlive(messages) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeout) + + var _gint int // out + var _goerr error // out + + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint, _goerr +} + +// DebugControllerOverrider contains methods that are overridable. +type DebugControllerOverrider interface { +} + +// DebugController: GDebugController is an interface to expose control of +// debugging features and debug output. +// +// It is implemented on Linux using gio.DebugControllerDBus, which exposes a +// D-Bus interface to allow authenticated peers to control debug features in +// this process. +// +// Whether debug output is enabled is exposed as +// gio.DebugController:debug-enabled. This controls glib.LogSetDebugEnabled() +// by default. Application code may connect to the gobject.Object::notify signal +// for it to control other parts of its debug infrastructure as necessary. +// +// If your application or service is using the default GLib log writer function, +// creating one of the built-in implementations of GDebugController should be +// all that’s needed to dynamically enable or disable debug output. +// +// DebugController wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DebugController struct { + _ [0]func() // equal guard + Initable +} + +var () + +// DebugControllerer describes DebugController's interface methods. +type DebugControllerer interface { + coreglib.Objector + + // DebugEnabled: get the value of Controller:debug-enabled. + DebugEnabled() bool + // SetDebugEnabled: set the value of Controller:debug-enabled. + SetDebugEnabled(debugEnabled bool) +} + +var _ DebugControllerer = (*DebugController)(nil) + +func ifaceInitDebugControllerer(gifacePtr, data C.gpointer) { +} + +func wrapDebugController(obj *coreglib.Object) *DebugController { + return &DebugController{ + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalDebugController(p uintptr) (interface{}, error) { + return wrapDebugController(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// DebugEnabled: get the value of Controller:debug-enabled. +// +// The function returns the following values: +// +// - ok: TRUE if debug output should be exposed, FALSE otherwise. +func (self *DebugController) DebugEnabled() bool { + var _arg0 *C.GDebugController // out + var _cret C.gboolean // in + + _arg0 = (*C.GDebugController)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.g_debug_controller_get_debug_enabled(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetDebugEnabled: set the value of Controller:debug-enabled. +// +// The function takes the following parameters: +// +// - debugEnabled: TRUE if debug output should be exposed, FALSE otherwise. +func (self *DebugController) SetDebugEnabled(debugEnabled bool) { + var _arg0 *C.GDebugController // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GDebugController)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if debugEnabled { + _arg1 = C.TRUE + } + + C.g_debug_controller_set_debug_enabled(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(debugEnabled) +} + +// Drive: GDrive represents a piece of hardware connected to the machine. +// It’s generally only created for removable hardware or hardware with removable +// media. +// +// GDrive is a container class for gio.Volume objects that stem from the same +// piece of media. As such, GDrive abstracts a drive with (or without) removable +// media and provides operations for querying whether media is available, +// determining whether media change is automatically detected and ejecting the +// media. +// +// If the GDrive reports that media isn’t automatically detected, one can poll +// for media; typically one should not do this periodically as a poll for media +// operation is potentially expensive and may spin up the drive creating noise. +// +// GDrive supports starting and stopping drives with authentication support +// for the former. This can be used to support a diverse set of use cases +// including connecting/disconnecting iSCSI devices, powering down external disk +// enclosures and starting/stopping multi-disk devices such as RAID devices. +// Note that the actual semantics and side-effects of starting/stopping a GDrive +// may vary according to implementation. To choose the correct verbs in e.g. +// a file manager, use gio.Drive.GetStartStopType(). +// +// For porting from GnomeVFS (migrating-gnome-vfs.html) note that there is no +// equivalent of GDrive in that API. +// +// Drive wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Drive struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Drive)(nil) +) + +// Driver describes Drive's interface methods. +type Driver interface { + coreglib.Objector + + // CanEject checks if a drive can be ejected. + CanEject() bool + // CanPollForMedia checks if a drive can be polled for media changes. + CanPollForMedia() bool + // CanStart checks if a drive can be started. + CanStart() bool + // CanStartDegraded checks if a drive can be started degraded. + CanStartDegraded() bool + // CanStop checks if a drive can be stopped. + CanStop() bool + // Eject: asynchronously ejects a drive. + Eject(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) + // EjectFinish finishes ejecting a drive. + EjectFinish(result AsyncResulter) error + // EjectWithOperation ejects a drive. + EjectWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // EjectWithOperationFinish finishes ejecting a drive. + EjectWithOperationFinish(result AsyncResulter) error + // EnumerateIdentifiers gets the kinds of identifiers that drive has. + EnumerateIdentifiers() []string + // Icon gets the icon for drive. + Icon() *Icon + // Identifier gets the identifier of the given kind for drive. + Identifier(kind string) string + // Name gets the name of drive. + Name() string + // SortKey gets the sort key for drive, if any. + SortKey() string + // StartStopType gets a hint about how a drive can be started/stopped. + StartStopType() DriveStartStopType + // SymbolicIcon gets the icon for drive. + SymbolicIcon() *Icon + // Volumes: get a list of mountable volumes for drive. + Volumes() []*Volume + // HasMedia checks if the drive has media. + HasMedia() bool + // HasVolumes: check if drive has any mountable volumes. + HasVolumes() bool + // IsMediaCheckAutomatic checks if drive is capable of automatically + // detecting media changes. + IsMediaCheckAutomatic() bool + // IsMediaRemovable checks if the drive supports removable media. + IsMediaRemovable() bool + // IsRemovable checks if the #GDrive and/or its media is considered + // removable by the user. + IsRemovable() bool + // PollForMedia: asynchronously polls drive to see if media has been + // inserted or removed. + PollForMedia(ctx context.Context, callback AsyncReadyCallback) + // PollForMediaFinish finishes an operation started with + // g_drive_poll_for_media() on a drive. + PollForMediaFinish(result AsyncResulter) error + // Start: asynchronously starts a drive. + Start(ctx context.Context, flags DriveStartFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // StartFinish finishes starting a drive. + StartFinish(result AsyncResulter) error + // Stop: asynchronously stops a drive. + Stop(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // StopFinish finishes stopping a drive. + StopFinish(result AsyncResulter) error + + // Changed is emitted when the drive's state has changed. + ConnectChanged(func()) coreglib.SignalHandle + // Disconnected: this signal is emitted when the #GDrive have been + // disconnected. + ConnectDisconnected(func()) coreglib.SignalHandle + // Eject-button is emitted when the physical eject button (if any) of a + // drive has been pressed. + ConnectEjectButton(func()) coreglib.SignalHandle + // Stop-button is emitted when the physical stop button (if any) of a drive + // has been pressed. + ConnectStopButton(func()) coreglib.SignalHandle +} + +var _ Driver = (*Drive)(nil) + +func wrapDrive(obj *coreglib.Object) *Drive { + return &Drive{ + Object: obj, + } +} + +func marshalDrive(p uintptr) (interface{}, error) { + return wrapDrive(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectChanged is emitted when the drive's state has changed. +func (drive *Drive) ConnectChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(drive, "changed", false, unsafe.Pointer(C._gotk4_gio2_Drive_ConnectChanged), f) +} + +// ConnectDisconnected: this signal is emitted when the #GDrive have been +// disconnected. If the recipient is holding references to the object they +// should release them so the object can be finalized. +func (drive *Drive) ConnectDisconnected(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(drive, "disconnected", false, unsafe.Pointer(C._gotk4_gio2_Drive_ConnectDisconnected), f) +} + +// ConnectEjectButton is emitted when the physical eject button (if any) of a +// drive has been pressed. +func (drive *Drive) ConnectEjectButton(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(drive, "eject-button", false, unsafe.Pointer(C._gotk4_gio2_Drive_ConnectEjectButton), f) +} + +// ConnectStopButton is emitted when the physical stop button (if any) of a +// drive has been pressed. +func (drive *Drive) ConnectStopButton(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(drive, "stop-button", false, unsafe.Pointer(C._gotk4_gio2_Drive_ConnectStopButton), f) +} + +// CanEject checks if a drive can be ejected. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be ejected, FALSE otherwise. +func (drive *Drive) CanEject() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_can_eject(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanPollForMedia checks if a drive can be polled for media changes. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be polled for media changes, FALSE otherwise. +func (drive *Drive) CanPollForMedia() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_can_poll_for_media(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanStart checks if a drive can be started. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be started, FALSE otherwise. +func (drive *Drive) CanStart() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_can_start(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanStartDegraded checks if a drive can be started degraded. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be started degraded, FALSE otherwise. +func (drive *Drive) CanStartDegraded() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_can_start_degraded(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanStop checks if a drive can be stopped. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be stopped, FALSE otherwise. +func (drive *Drive) CanStop() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_can_stop(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Eject: asynchronously ejects a drive. +// +// When the operation is finished, callback will be called. You can then call +// g_drive_eject_finish() to obtain the result of the operation. +// +// Deprecated: Use g_drive_eject_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - callback (optional) or NULL. +func (drive *Drive) Eject(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + var _arg0 *C.GDrive // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_drive_eject(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// EjectFinish finishes ejecting a drive. +// +// Deprecated: Use g_drive_eject_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) EjectFinish(result AsyncResulter) error { + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_drive_eject_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// EjectWithOperation ejects a drive. This is an asynchronous operation, and is +// finished by calling g_drive_eject_with_operation_finish() with the drive and +// Result data returned in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (drive *Drive) EjectWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GDrive // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_drive_eject_with_operation(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// EjectWithOperationFinish finishes ejecting a drive. If any errors occurred +// during the operation, error will be set to contain the errors and FALSE will +// be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) EjectWithOperationFinish(result AsyncResulter) error { + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_drive_eject_with_operation_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// EnumerateIdentifiers gets the kinds of identifiers that drive has. Use +// g_drive_get_identifier() to obtain the identifiers themselves. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of strings containing kinds of identifiers. +// Use g_strfreev() to free. +func (drive *Drive) EnumerateIdentifiers() []string { + var _arg0 *C.GDrive // out + var _cret **C.char // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_enumerate_identifiers(_arg0) + runtime.KeepAlive(drive) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// Icon gets the icon for drive. +// +// The function returns the following values: +// +// - icon for the drive. Free the returned object with g_object_unref(). +func (drive *Drive) Icon() *Icon { + var _arg0 *C.GDrive // out + var _cret *C.GIcon // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_get_icon(_arg0) + runtime.KeepAlive(drive) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// Identifier gets the identifier of the given kind for drive. The only +// identifier currently available is G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE. +// +// The function takes the following parameters: +// +// - kind of identifier to return. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string containing the requested +// identifier, or NULL if the #GDrive doesn't have this kind of identifier. +func (drive *Drive) Identifier(kind string) string { + var _arg0 *C.GDrive // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(kind))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_drive_get_identifier(_arg0, _arg1) + runtime.KeepAlive(drive) + runtime.KeepAlive(kind) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Name gets the name of drive. +// +// The function returns the following values: +// +// - utf8: string containing drive's name. The returned string should be freed +// when no longer needed. +func (drive *Drive) Name() string { + var _arg0 *C.GDrive // out + var _cret *C.char // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_get_name(_arg0) + runtime.KeepAlive(drive) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// SortKey gets the sort key for drive, if any. +// +// The function returns the following values: +// +// - utf8 (optional): sorting key for drive or NULL if no such key is +// available. +func (drive *Drive) SortKey() string { + var _arg0 *C.GDrive // out + var _cret *C.gchar // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_get_sort_key(_arg0) + runtime.KeepAlive(drive) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// StartStopType gets a hint about how a drive can be started/stopped. +// +// The function returns the following values: +// +// - driveStartStopType: value from the StartStopType enumeration. +func (drive *Drive) StartStopType() DriveStartStopType { + var _arg0 *C.GDrive // out + var _cret C.GDriveStartStopType // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_get_start_stop_type(_arg0) + runtime.KeepAlive(drive) + + var _driveStartStopType DriveStartStopType // out + + _driveStartStopType = DriveStartStopType(_cret) + + return _driveStartStopType +} + +// SymbolicIcon gets the icon for drive. +// +// The function returns the following values: +// +// - icon: symbolic #GIcon for the drive. Free the returned object with +// g_object_unref(). +func (drive *Drive) SymbolicIcon() *Icon { + var _arg0 *C.GDrive // out + var _cret *C.GIcon // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_get_symbolic_icon(_arg0) + runtime.KeepAlive(drive) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// Volumes: get a list of mountable volumes for drive. +// +// The returned list should be freed with g_list_free(), after its elements have +// been unreffed with g_object_unref(). +// +// The function returns the following values: +// +// - list containing any #GVolume objects on the given drive. +func (drive *Drive) Volumes() []*Volume { + var _arg0 *C.GDrive // out + var _cret *C.GList // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_get_volumes(_arg0) + runtime.KeepAlive(drive) + + var _list []*Volume // out + + _list = make([]*Volume, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GVolume)(v) + var dst *Volume // out + dst = wrapVolume(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// HasMedia checks if the drive has media. Note that the OS may not be polling +// the drive for media changes; see g_drive_is_media_check_automatic() for more +// details. +// +// The function returns the following values: +// +// - ok: TRUE if drive has media, FALSE otherwise. +func (drive *Drive) HasMedia() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_has_media(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HasVolumes: check if drive has any mountable volumes. +// +// The function returns the following values: +// +// - ok: TRUE if the drive contains volumes, FALSE otherwise. +func (drive *Drive) HasVolumes() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_has_volumes(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsMediaCheckAutomatic checks if drive is capable of automatically detecting +// media changes. +// +// The function returns the following values: +// +// - ok: TRUE if the drive is capable of automatically detecting media +// changes, FALSE otherwise. +func (drive *Drive) IsMediaCheckAutomatic() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_is_media_check_automatic(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsMediaRemovable checks if the drive supports removable media. +// +// The function returns the following values: +// +// - ok: TRUE if drive supports removable media, FALSE otherwise. +func (drive *Drive) IsMediaRemovable() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_is_media_removable(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsRemovable checks if the #GDrive and/or its media is considered removable by +// the user. See g_drive_is_media_removable(). +// +// The function returns the following values: +// +// - ok: TRUE if drive and/or its media is considered removable, FALSE +// otherwise. +func (drive *Drive) IsRemovable() bool { + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C.g_drive_is_removable(_arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PollForMedia: asynchronously polls drive to see if media has been inserted or +// removed. +// +// When the operation is finished, callback will be called. You can then call +// g_drive_poll_for_media_finish() to obtain the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - callback (optional) or NULL. +func (drive *Drive) PollForMedia(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GDrive // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_drive_poll_for_media(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// PollForMediaFinish finishes an operation started with +// g_drive_poll_for_media() on a drive. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) PollForMediaFinish(result AsyncResulter) error { + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_drive_poll_for_media_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Start: asynchronously starts a drive. +// +// When the operation is finished, callback will be called. You can then call +// g_drive_start_finish() to obtain the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the start operation. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (drive *Drive) Start(ctx context.Context, flags DriveStartFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GDrive // out + var _arg3 *C.GCancellable // out + var _arg1 C.GDriveStartFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GDriveStartFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_drive_start(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// StartFinish finishes starting a drive. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) StartFinish(result AsyncResulter) error { + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_drive_start_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Stop: asynchronously stops a drive. +// +// When the operation is finished, callback will be called. You can then call +// g_drive_stop_finish() to obtain the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for stopping. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (drive *Drive) Stop(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GDrive // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_drive_stop(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// StopFinish finishes stopping a drive. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) StopFinish(result AsyncResulter) error { + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_drive_stop_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// canEject checks if a drive can be ejected. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be ejected, FALSE otherwise. +func (drive *Drive) canEject() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.can_eject + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_can_eject(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canPollForMedia checks if a drive can be polled for media changes. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be polled for media changes, FALSE otherwise. +func (drive *Drive) canPollForMedia() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.can_poll_for_media + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_can_poll_for_media(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canStart checks if a drive can be started. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be started, FALSE otherwise. +func (drive *Drive) canStart() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.can_start + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_can_start(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canStartDegraded checks if a drive can be started degraded. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be started degraded, FALSE otherwise. +func (drive *Drive) canStartDegraded() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.can_start_degraded + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_can_start_degraded(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canStop checks if a drive can be stopped. +// +// The function returns the following values: +// +// - ok: TRUE if the drive can be stopped, FALSE otherwise. +func (drive *Drive) canStop() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.can_stop + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_can_stop(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Changed: signal emitted when the drive is changed. +func (drive *Drive) changed() { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.changed + + var _arg0 *C.GDrive // out + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + C._gotk4_gio2_Drive_virtual_changed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) +} + +// Disconnected: removed signal that is emitted when the #GDrive have been +// disconnected. If the recipient is holding references to the object they +// should release them so the object can be finalized. +func (drive *Drive) disconnected() { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.disconnected + + var _arg0 *C.GDrive // out + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + C._gotk4_gio2_Drive_virtual_disconnected(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) +} + +// Eject: asynchronously ejects a drive. +// +// When the operation is finished, callback will be called. You can then call +// g_drive_eject_finish() to obtain the result of the operation. +// +// Deprecated: Use g_drive_eject_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - callback (optional) or NULL. +func (drive *Drive) eject(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.eject + + var _arg0 *C.GDrive // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Drive_virtual_eject(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// ejectButton: signal emitted when the physical eject button (if any) of a +// drive have been pressed. +func (drive *Drive) ejectButton() { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.eject_button + + var _arg0 *C.GDrive // out + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + C._gotk4_gio2_Drive_virtual_eject_button(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) +} + +// ejectFinish finishes ejecting a drive. +// +// Deprecated: Use g_drive_eject_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) ejectFinish(result AsyncResulter) error { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.eject_finish + + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Drive_virtual_eject_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ejectWithOperation ejects a drive. This is an asynchronous operation, and is +// finished by calling g_drive_eject_with_operation_finish() with the drive and +// Result data returned in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (drive *Drive) ejectWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.eject_with_operation + + var _arg0 *C.GDrive // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Drive_virtual_eject_with_operation(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// ejectWithOperationFinish finishes ejecting a drive. If any errors occurred +// during the operation, error will be set to contain the errors and FALSE will +// be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) ejectWithOperationFinish(result AsyncResulter) error { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.eject_with_operation_finish + + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Drive_virtual_eject_with_operation_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// enumerateIdentifiers gets the kinds of identifiers that drive has. Use +// g_drive_get_identifier() to obtain the identifiers themselves. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of strings containing kinds of identifiers. +// Use g_strfreev() to free. +func (drive *Drive) enumerateIdentifiers() []string { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.enumerate_identifiers + + var _arg0 *C.GDrive // out + var _cret **C.char // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_enumerate_identifiers(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// Icon gets the icon for drive. +// +// The function returns the following values: +// +// - icon for the drive. Free the returned object with g_object_unref(). +func (drive *Drive) icon() *Icon { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.get_icon + + var _arg0 *C.GDrive // out + var _cret *C.GIcon // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_get_icon(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// Identifier gets the identifier of the given kind for drive. The only +// identifier currently available is G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE. +// +// The function takes the following parameters: +// +// - kind of identifier to return. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string containing the requested +// identifier, or NULL if the #GDrive doesn't have this kind of identifier. +func (drive *Drive) identifier(kind string) string { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.get_identifier + + var _arg0 *C.GDrive // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(kind))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_Drive_virtual_get_identifier(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(drive) + runtime.KeepAlive(kind) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Name gets the name of drive. +// +// The function returns the following values: +// +// - utf8: string containing drive's name. The returned string should be freed +// when no longer needed. +func (drive *Drive) name() string { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.get_name + + var _arg0 *C.GDrive // out + var _cret *C.char // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_get_name(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// sortKey gets the sort key for drive, if any. +// +// The function returns the following values: +// +// - utf8 (optional): sorting key for drive or NULL if no such key is +// available. +func (drive *Drive) sortKey() string { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.get_sort_key + + var _arg0 *C.GDrive // out + var _cret *C.gchar // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_get_sort_key(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// startStopType gets a hint about how a drive can be started/stopped. +// +// The function returns the following values: +// +// - driveStartStopType: value from the StartStopType enumeration. +func (drive *Drive) startStopType() DriveStartStopType { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.get_start_stop_type + + var _arg0 *C.GDrive // out + var _cret C.GDriveStartStopType // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_get_start_stop_type(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _driveStartStopType DriveStartStopType // out + + _driveStartStopType = DriveStartStopType(_cret) + + return _driveStartStopType +} + +// symbolicIcon gets the icon for drive. +// +// The function returns the following values: +// +// - icon: symbolic #GIcon for the drive. Free the returned object with +// g_object_unref(). +func (drive *Drive) symbolicIcon() *Icon { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.get_symbolic_icon + + var _arg0 *C.GDrive // out + var _cret *C.GIcon // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_get_symbolic_icon(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// Volumes: get a list of mountable volumes for drive. +// +// The returned list should be freed with g_list_free(), after its elements have +// been unreffed with g_object_unref(). +// +// The function returns the following values: +// +// - list containing any #GVolume objects on the given drive. +func (drive *Drive) volumes() []*Volume { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.get_volumes + + var _arg0 *C.GDrive // out + var _cret *C.GList // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_get_volumes(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _list []*Volume // out + + _list = make([]*Volume, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GVolume)(v) + var dst *Volume // out + dst = wrapVolume(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// hasMedia checks if the drive has media. Note that the OS may not be polling +// the drive for media changes; see g_drive_is_media_check_automatic() for more +// details. +// +// The function returns the following values: +// +// - ok: TRUE if drive has media, FALSE otherwise. +func (drive *Drive) hasMedia() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.has_media + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_has_media(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// hasVolumes: check if drive has any mountable volumes. +// +// The function returns the following values: +// +// - ok: TRUE if the drive contains volumes, FALSE otherwise. +func (drive *Drive) hasVolumes() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.has_volumes + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_has_volumes(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// isMediaCheckAutomatic checks if drive is capable of automatically detecting +// media changes. +// +// The function returns the following values: +// +// - ok: TRUE if the drive is capable of automatically detecting media +// changes, FALSE otherwise. +func (drive *Drive) isMediaCheckAutomatic() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.is_media_check_automatic + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_is_media_check_automatic(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// isMediaRemovable checks if the drive supports removable media. +// +// The function returns the following values: +// +// - ok: TRUE if drive supports removable media, FALSE otherwise. +func (drive *Drive) isMediaRemovable() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.is_media_removable + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_is_media_removable(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// isRemovable checks if the #GDrive and/or its media is considered removable by +// the user. See g_drive_is_media_removable(). +// +// The function returns the following values: +// +// - ok: TRUE if drive and/or its media is considered removable, FALSE +// otherwise. +func (drive *Drive) isRemovable() bool { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.is_removable + + var _arg0 *C.GDrive // out + var _cret C.gboolean // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + _cret = C._gotk4_gio2_Drive_virtual_is_removable(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// pollForMedia: asynchronously polls drive to see if media has been inserted or +// removed. +// +// When the operation is finished, callback will be called. You can then call +// g_drive_poll_for_media_finish() to obtain the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - callback (optional) or NULL. +func (drive *Drive) pollForMedia(ctx context.Context, callback AsyncReadyCallback) { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.poll_for_media + + var _arg0 *C.GDrive // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Drive_virtual_poll_for_media(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// pollForMediaFinish finishes an operation started with +// g_drive_poll_for_media() on a drive. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) pollForMediaFinish(result AsyncResulter) error { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.poll_for_media_finish + + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Drive_virtual_poll_for_media_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Start: asynchronously starts a drive. +// +// When the operation is finished, callback will be called. You can then call +// g_drive_start_finish() to obtain the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the start operation. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (drive *Drive) start(ctx context.Context, flags DriveStartFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.start + + var _arg0 *C.GDrive // out + var _arg3 *C.GCancellable // out + var _arg1 C.GDriveStartFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GDriveStartFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Drive_virtual_start(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// startFinish finishes starting a drive. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) startFinish(result AsyncResulter) error { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.start_finish + + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Drive_virtual_start_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Stop: asynchronously stops a drive. +// +// When the operation is finished, callback will be called. You can then call +// g_drive_stop_finish() to obtain the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for stopping. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (drive *Drive) stop(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.stop + + var _arg0 *C.GDrive // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Drive_virtual_stop(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(drive) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// stopButton: signal emitted when the physical stop button (if any) of a drive +// have been pressed. Since 2.22. +func (drive *Drive) stopButton() { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.stop_button + + var _arg0 *C.GDrive // out + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + C._gotk4_gio2_Drive_virtual_stop_button(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(drive) +} + +// stopFinish finishes stopping a drive. +// +// The function takes the following parameters: +// +// - result: Result. +func (drive *Drive) stopFinish(result AsyncResulter) error { + gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) + fnarg := gclass.stop_finish + + var _arg0 *C.GDrive // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Drive_virtual_stop_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(drive) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// DTLSClientConnectionOverrider contains methods that are overridable. +type DTLSClientConnectionOverrider interface { +} + +// DTLSClientConnection: GDtlsClientConnection is the client-side subclass of +// gio.DTLSConnection, representing a client-side DTLS connection. +// +// DTLSClientConnection wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DTLSClientConnection struct { + _ [0]func() // equal guard + DTLSConnection +} + +var () + +// DTLSClientConnectioner describes DTLSClientConnection's interface methods. +type DTLSClientConnectioner interface { + coreglib.Objector + + // ServerIdentity gets conn's expected server identity. + ServerIdentity() *SocketConnectable + // ValidationFlags gets conn's validation flags. + ValidationFlags() TLSCertificateFlags + // SetServerIdentity sets conn's expected server identity, which is used + // both to tell servers on virtual hosts which certificate to present, + // and also to let conn know what name to look for in the certificate when + // performing G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled. + SetServerIdentity(identity SocketConnectabler) + // SetValidationFlags sets conn's validation flags, to override the default + // set of checks performed when validating a server certificate. + SetValidationFlags(flags TLSCertificateFlags) +} + +var _ DTLSClientConnectioner = (*DTLSClientConnection)(nil) + +func ifaceInitDTLSClientConnectioner(gifacePtr, data C.gpointer) { +} + +func wrapDTLSClientConnection(obj *coreglib.Object) *DTLSClientConnection { + return &DTLSClientConnection{ + DTLSConnection: DTLSConnection{ + DatagramBased: DatagramBased{ + Object: obj, + }, + }, + } +} + +func marshalDTLSClientConnection(p uintptr) (interface{}, error) { + return wrapDTLSClientConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ServerIdentity gets conn's expected server identity. +// +// The function returns the following values: +// +// - socketConnectable describing the expected server identity, or NULL if the +// expected identity is not known. +func (conn *DTLSClientConnection) ServerIdentity() *SocketConnectable { + var _arg0 *C.GDtlsClientConnection // out + var _cret *C.GSocketConnectable // in + + _arg0 = (*C.GDtlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_client_connection_get_server_identity(_arg0) + runtime.KeepAlive(conn) + + var _socketConnectable *SocketConnectable // out + + _socketConnectable = wrapSocketConnectable(coreglib.Take(unsafe.Pointer(_cret))) + + return _socketConnectable +} + +// ValidationFlags gets conn's validation flags +// +// This function does not work as originally designed and is impossible to use +// correctly. See ClientConnection:validation-flags for more information. +// +// Deprecated: Do not attempt to ignore validation errors. +// +// The function returns the following values: +// +// - tlsCertificateFlags: validation flags. +func (conn *DTLSClientConnection) ValidationFlags() TLSCertificateFlags { + var _arg0 *C.GDtlsClientConnection // out + var _cret C.GTlsCertificateFlags // in + + _arg0 = (*C.GDtlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_client_connection_get_validation_flags(_arg0) + runtime.KeepAlive(conn) + + var _tlsCertificateFlags TLSCertificateFlags // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + + return _tlsCertificateFlags +} + +// SetServerIdentity sets conn's expected server identity, which is used both +// to tell servers on virtual hosts which certificate to present, and also +// to let conn know what name to look for in the certificate when performing +// G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled. +// +// The function takes the following parameters: +// +// - identity describing the expected server identity. +func (conn *DTLSClientConnection) SetServerIdentity(identity SocketConnectabler) { + var _arg0 *C.GDtlsClientConnection // out + var _arg1 *C.GSocketConnectable // out + + _arg0 = (*C.GDtlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(identity).Native())) + + C.g_dtls_client_connection_set_server_identity(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(identity) +} + +// SetValidationFlags sets conn's validation flags, to override the default +// set of checks performed when validating a server certificate. By default, +// G_TLS_CERTIFICATE_VALIDATE_ALL is used. +// +// This function does not work as originally designed and is impossible to use +// correctly. See ClientConnection:validation-flags for more information. +// +// Deprecated: Do not attempt to ignore validation errors. +// +// The function takes the following parameters: +// +// - flags to use. +func (conn *DTLSClientConnection) SetValidationFlags(flags TLSCertificateFlags) { + var _arg0 *C.GDtlsClientConnection // out + var _arg1 C.GTlsCertificateFlags // out + + _arg0 = (*C.GDtlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = C.GTlsCertificateFlags(flags) + + C.g_dtls_client_connection_set_validation_flags(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(flags) +} + +// NewDTLSClientConnection creates a new ClientConnection wrapping +// base_socket which is assumed to communicate with the server identified by +// server_identity. +// +// The function takes the following parameters: +// +// - baseSocket to wrap. +// - serverIdentity (optional): expected identity of the server. +// +// The function returns the following values: +// +// - dtlsClientConnection: new ClientConnection, or NULL on error. +func NewDTLSClientConnection(baseSocket DatagramBasedder, serverIdentity SocketConnectabler) (*DTLSClientConnection, error) { + var _arg1 *C.GDatagramBased // out + var _arg2 *C.GSocketConnectable // out + var _cret *C.GDatagramBased // in + var _cerr *C.GError // in + + _arg1 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(baseSocket).Native())) + if serverIdentity != nil { + _arg2 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(serverIdentity).Native())) + } + + _cret = C.g_dtls_client_connection_new(_arg1, _arg2, &_cerr) + runtime.KeepAlive(baseSocket) + runtime.KeepAlive(serverIdentity) + + var _dtlsClientConnection *DTLSClientConnection // out + var _goerr error // out + + _dtlsClientConnection = wrapDTLSClientConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dtlsClientConnection, _goerr +} + +// DTLSConnection: GDtlsConnection is the base DTLS connection class type, +// which wraps a gio.DatagramBased and provides DTLS encryption on top of it. +// Its subclasses, gio.DTLSClientConnection and gio.DTLSServerConnection, +// implement client-side and server-side DTLS, respectively. +// +// For TLS support, see gio.TLSConnection. +// +// As DTLS is datagram based, GDtlsConnection implements gio.DatagramBased, +// presenting a datagram-socket-like API for the encrypted connection. +// This operates over a base datagram connection, which is also a GDatagramBased +// (gio.DTLSConnection:base-socket). +// +// To close a DTLS connection, use gio.DTLSConnection.Close(). +// +// Neither gio.DTLSServerConnection or gio.DTLSClientConnection set the peer +// address on their base gio.DatagramBased if it is a gio.Socket — it is up to +// the caller to do that if they wish. If they do not, and gio.Socket.Close() +// is called on the base socket, the GDtlsConnection will not raise a +// G_IO_ERROR_NOT_CONNECTED error on further I/O. +// +// DTLSConnection wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DTLSConnection struct { + _ [0]func() // equal guard + DatagramBased +} + +var () + +// DTLSConnectioner describes DTLSConnection's interface methods. +type DTLSConnectioner interface { + coreglib.Objector + + // Close the DTLS connection. + Close(ctx context.Context) error + // CloseAsync: asynchronously close the DTLS connection. + CloseAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // CloseFinish: finish an asynchronous TLS close operation. + CloseFinish(result AsyncResulter) error + // EmitAcceptCertificate: used by Connection implementations to emit the + // Connection::accept-certificate signal. + EmitAcceptCertificate(peerCert TLSCertificater, errors TLSCertificateFlags) bool + // Certificate gets conn's certificate, as set by + // g_dtls_connection_set_certificate(). + Certificate() TLSCertificater + // ChannelBindingData: query the TLS backend for TLS channel binding data of + // type for conn. + ChannelBindingData(typ TLSChannelBindingType) ([]byte, error) + // CiphersuiteName returns the name of the current DTLS ciphersuite, + // or NULL if the connection has not handshaked or has been closed. + CiphersuiteName() string + // Database gets the certificate database that conn uses to verify peer + // certificates. + Database() TLSDatabaser + // Interaction: get the object that will be used to interact with the user. + Interaction() *TLSInteraction + // NegotiatedProtocol gets the name of the application-layer protocol + // negotiated during the handshake. + NegotiatedProtocol() string + // PeerCertificate gets conn's peer's certificate after the handshake has + // completed or failed. + PeerCertificate() TLSCertificater + // PeerCertificateErrors gets the errors associated with validating conn's + // peer's certificate, after the handshake has completed or failed. + PeerCertificateErrors() TLSCertificateFlags + // ProtocolVersion returns the current DTLS protocol version, which may be + // G_TLS_PROTOCOL_VERSION_UNKNOWN if the connection has not handshaked, + // or has been closed, or if the TLS backend has implemented a protocol + // version that is not a recognized ProtocolVersion. + ProtocolVersion() TLSProtocolVersion + // RehandshakeMode gets conn rehandshaking mode. + RehandshakeMode() TLSRehandshakeMode + // RequireCloseNotify tests whether or not conn expects a proper TLS close + // notification when the connection is closed. + RequireCloseNotify() bool + // Handshake attempts a TLS handshake on conn. + Handshake(ctx context.Context) error + // HandshakeAsync: asynchronously performs a TLS handshake on conn. + HandshakeAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // HandshakeFinish: finish an asynchronous TLS handshake operation. + HandshakeFinish(result AsyncResulter) error + // SetAdvertisedProtocols sets the list of application-layer protocols to + // advertise that the caller is willing to speak on this connection. + SetAdvertisedProtocols(protocols []string) + // SetCertificate: this sets the certificate that conn will present to its + // peer during the TLS handshake. + SetCertificate(certificate TLSCertificater) + // SetDatabase sets the certificate database that is used to verify peer + // certificates. + SetDatabase(database TLSDatabaser) + // SetInteraction: set the object that will be used to interact with the + // user. + SetInteraction(interaction *TLSInteraction) + // SetRehandshakeMode: since GLib 2.64, changing the rehandshake mode is no + // longer supported and will have no effect. + SetRehandshakeMode(mode TLSRehandshakeMode) + // SetRequireCloseNotify sets whether or not conn expects a proper TLS close + // notification before the connection is closed. + SetRequireCloseNotify(requireCloseNotify bool) + // Shutdown: shut down part or all of a DTLS connection. + Shutdown(ctx context.Context, shutdownRead, shutdownWrite bool) error + // ShutdownAsync: asynchronously shut down part or all of the DTLS + // connection. + ShutdownAsync(ctx context.Context, shutdownRead, shutdownWrite bool, ioPriority int, callback AsyncReadyCallback) + // ShutdownFinish: finish an asynchronous TLS shutdown operation. + ShutdownFinish(result AsyncResulter) error + + // Accept-certificate is emitted during the TLS handshake after the peer + // certificate has been received. + ConnectAcceptCertificate(func(peerCert TLSCertificater, errors TLSCertificateFlags) (ok bool)) coreglib.SignalHandle +} + +var _ DTLSConnectioner = (*DTLSConnection)(nil) + +func wrapDTLSConnection(obj *coreglib.Object) *DTLSConnection { + return &DTLSConnection{ + DatagramBased: DatagramBased{ + Object: obj, + }, + } +} + +func marshalDTLSConnection(p uintptr) (interface{}, error) { + return wrapDTLSConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectAcceptCertificate is emitted during the TLS handshake after the peer +// certificate has been received. You can examine peer_cert's certification path +// by calling g_tls_certificate_get_issuer() on it. +// +// For a client-side connection, peer_cert is the server's certificate, +// and the signal will only be emitted if the certificate was not acceptable +// according to conn's ClientConnection:validation_flags. If you would like +// the certificate to be accepted despite errors, return TRUE from the signal +// handler. Otherwise, if no handler accepts the certificate, the handshake will +// fail with G_TLS_ERROR_BAD_CERTIFICATE. +// +// GLib guarantees that if certificate verification fails, this signal will +// be emitted with at least one error will be set in errors, but it does not +// guarantee that all possible errors will be set. Accordingly, you may not +// safely decide to ignore any particular type of error. For example, it would +// be incorrect to ignore G_TLS_CERTIFICATE_EXPIRED if you want to allow expired +// certificates, because this could potentially be the only error flag set even +// if other problems exist with the certificate. +// +// For a server-side connection, peer_cert is the certificate +// presented by the client, if this was requested via the server's +// ServerConnection:authentication_mode. On the server side, the signal is +// always emitted when the client presents a certificate, and the certificate +// will only be accepted if a handler returns TRUE. +// +// Note that if this signal is emitted as part of asynchronous I/O in the +// main thread, then you should not attempt to interact with the user before +// returning from the signal handler. If you want to let the user decide whether +// or not to accept the certificate, you would have to return FALSE from the +// signal handler on the first attempt, and then after the connection attempt +// returns a G_TLS_ERROR_BAD_CERTIFICATE, you can interact with the user, +// and if the user decides to accept the certificate, remember that fact, create +// a new connection, and return TRUE from the signal handler the next time. +// +// If you are doing I/O in another thread, you do not need to worry about this, +// and can simply block in the signal handler until the UI thread returns an +// answer. +func (conn *DTLSConnection) ConnectAcceptCertificate(f func(peerCert TLSCertificater, errors TLSCertificateFlags) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(conn, "accept-certificate", false, unsafe.Pointer(C._gotk4_gio2_DtlsConnection_ConnectAcceptCertificate), f) +} + +// Close the DTLS connection. This is equivalent to calling +// g_dtls_connection_shutdown() to shut down both sides of the connection. +// +// Closing a Connection waits for all buffered but untransmitted data to be sent +// before it completes. It then sends a close_notify DTLS alert to the peer and +// may wait for a close_notify to be received from the peer. It does not close +// the underlying Connection:base-socket; that must be closed separately. +// +// Once conn is closed, all other operations will return G_IO_ERROR_CLOSED. +// Closing a Connection multiple times will not return an error. +// +// Connections will be automatically closed when the last reference is dropped, +// but you might want to call this function to make sure resources are released +// as early as possible. +// +// If cancellable is cancelled, the Connection may be left partially-closed and +// any pending untransmitted data may be lost. Call g_dtls_connection_close() +// again to complete closing the Connection. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (conn *DTLSConnection) Close(ctx context.Context) error { + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_dtls_connection_close(_arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CloseAsync: asynchronously close the DTLS connection. See +// g_dtls_connection_close() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the close operation is complete. +func (conn *DTLSConnection) CloseAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GDtlsConnection // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dtls_connection_close_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// CloseFinish: finish an asynchronous TLS close operation. See +// g_dtls_connection_close() for more information. +// +// The function takes the following parameters: +// +// - result: Result. +func (conn *DTLSConnection) CloseFinish(result AsyncResulter) error { + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_dtls_connection_close_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// EmitAcceptCertificate: used by Connection implementations to emit the +// Connection::accept-certificate signal. +// +// The function takes the following parameters: +// +// - peerCert peer's Certificate. +// - errors problems with peer_cert. +// +// The function returns the following values: +// +// - ok: TRUE if one of the signal handlers has returned TRUE to accept +// peer_cert. +func (conn *DTLSConnection) EmitAcceptCertificate(peerCert TLSCertificater, errors TLSCertificateFlags) bool { + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GTlsCertificate // out + var _arg2 C.GTlsCertificateFlags // out + var _cret C.gboolean // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(peerCert).Native())) + _arg2 = C.GTlsCertificateFlags(errors) + + _cret = C.g_dtls_connection_emit_accept_certificate(_arg0, _arg1, _arg2) + runtime.KeepAlive(conn) + runtime.KeepAlive(peerCert) + runtime.KeepAlive(errors) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Certificate gets conn's certificate, as set by +// g_dtls_connection_set_certificate(). +// +// The function returns the following values: +// +// - tlsCertificate (optional) conn's certificate, or NULL. +func (conn *DTLSConnection) Certificate() TLSCertificater { + var _arg0 *C.GDtlsConnection // out + var _cret *C.GTlsCertificate // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_certificate(_arg0) + runtime.KeepAlive(conn) + + var _tlsCertificate TLSCertificater // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + } + + return _tlsCertificate +} + +// ChannelBindingData: query the TLS backend for TLS channel binding data of +// type for conn. +// +// This call retrieves TLS channel binding data as specified +// in RFC 5056 (https://tools.ietf.org/html/rfc5056), RFC 5929 +// (https://tools.ietf.org/html/rfc5929), and related RFCs. The binding +// data is returned in data. The data is resized by the callee using +// Array buffer management and will be freed when the data is destroyed by +// g_byte_array_unref(). If data is NULL, it will only check whether TLS +// backend is able to fetch the data (e.g. whether type is supported by the +// TLS backend). It does not guarantee that the data will be available though. +// That could happen if TLS connection does not support type or the binding data +// is not available yet due to additional negotiation or input required. +// +// The function takes the following parameters: +// +// - typ type of data to fetch. +// +// The function returns the following values: +// +// - data (optional) is filled with the binding data, or NULL. +func (conn *DTLSConnection) ChannelBindingData(typ TLSChannelBindingType) ([]byte, error) { + var _arg0 *C.GDtlsConnection // out + var _arg1 C.GTlsChannelBindingType // out + var _arg2 C.GByteArray // in + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = C.GTlsChannelBindingType(typ) + + C.g_dtls_connection_get_channel_binding_data(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(typ) + + var _data []byte // out + var _goerr error // out + + _data = make([]byte, _arg2.len) + copy(_data, unsafe.Slice((*byte)(_arg2.data), _arg2.len)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _data, _goerr +} + +// CiphersuiteName returns the name of the current DTLS ciphersuite, or NULL +// if the connection has not handshaked or has been closed. Beware that the TLS +// backend may use any of multiple different naming conventions, because OpenSSL +// and GnuTLS have their own ciphersuite naming conventions that are different +// from each other and different from the standard, IANA- registered ciphersuite +// names. The ciphersuite name is intended to be displayed to the user for +// informative purposes only, and parsing it is not recommended. +// +// The function returns the following values: +// +// - utf8 (optional): name of the current DTLS ciphersuite, or NULL. +func (conn *DTLSConnection) CiphersuiteName() string { + var _arg0 *C.GDtlsConnection // out + var _cret *C.gchar // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_ciphersuite_name(_arg0) + runtime.KeepAlive(conn) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Database gets the certificate database that conn uses to verify peer +// certificates. See g_dtls_connection_set_database(). +// +// The function returns the following values: +// +// - tlsDatabase (optional): certificate database that conn uses or NULL. +func (conn *DTLSConnection) Database() TLSDatabaser { + var _arg0 *C.GDtlsConnection // out + var _cret *C.GTlsDatabase // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_database(_arg0) + runtime.KeepAlive(conn) + + var _tlsDatabase TLSDatabaser // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSDatabaser) + return ok + }) + rv, ok := casted.(TLSDatabaser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSDatabaser") + } + _tlsDatabase = rv + } + } + + return _tlsDatabase +} + +// Interaction: get the object that will be used to interact with the user. +// It will be used for things like prompting the user for passwords. If NULL is +// returned, then no user interaction will occur for this connection. +// +// The function returns the following values: +// +// - tlsInteraction (optional): interaction object. +func (conn *DTLSConnection) Interaction() *TLSInteraction { + var _arg0 *C.GDtlsConnection // out + var _cret *C.GTlsInteraction // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_interaction(_arg0) + runtime.KeepAlive(conn) + + var _tlsInteraction *TLSInteraction // out + + if _cret != nil { + _tlsInteraction = wrapTLSInteraction(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _tlsInteraction +} + +// NegotiatedProtocol gets the name of the application-layer protocol negotiated +// during the handshake. +// +// If the peer did not use the ALPN extension, or did not advertise +// a protocol that matched one of conn's protocols, or the TLS +// backend does not support ALPN, then this will be NULL. See +// g_dtls_connection_set_advertised_protocols(). +// +// The function returns the following values: +// +// - utf8 (optional): negotiated protocol, or NULL. +func (conn *DTLSConnection) NegotiatedProtocol() string { + var _arg0 *C.GDtlsConnection // out + var _cret *C.gchar // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_negotiated_protocol(_arg0) + runtime.KeepAlive(conn) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// PeerCertificate gets conn's peer's certificate after the handshake +// has completed or failed. (It is not set during the emission of +// Connection::accept-certificate.). +// +// The function returns the following values: +// +// - tlsCertificate (optional) conn's peer's certificate, or NULL. +func (conn *DTLSConnection) PeerCertificate() TLSCertificater { + var _arg0 *C.GDtlsConnection // out + var _cret *C.GTlsCertificate // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_peer_certificate(_arg0) + runtime.KeepAlive(conn) + + var _tlsCertificate TLSCertificater // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + } + + return _tlsCertificate +} + +// PeerCertificateErrors gets the errors associated with validating conn's +// peer's certificate, after the handshake has completed or failed. (It is not +// set during the emission of Connection::accept-certificate.). +// +// The function returns the following values: +// +// - tlsCertificateFlags conn's peer's certificate errors. +func (conn *DTLSConnection) PeerCertificateErrors() TLSCertificateFlags { + var _arg0 *C.GDtlsConnection // out + var _cret C.GTlsCertificateFlags // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_peer_certificate_errors(_arg0) + runtime.KeepAlive(conn) + + var _tlsCertificateFlags TLSCertificateFlags // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + + return _tlsCertificateFlags +} + +// ProtocolVersion returns the current DTLS protocol version, which may be +// G_TLS_PROTOCOL_VERSION_UNKNOWN if the connection has not handshaked, or has +// been closed, or if the TLS backend has implemented a protocol version that is +// not a recognized ProtocolVersion. +// +// The function returns the following values: +// +// - tlsProtocolVersion: current DTLS protocol version. +func (conn *DTLSConnection) ProtocolVersion() TLSProtocolVersion { + var _arg0 *C.GDtlsConnection // out + var _cret C.GTlsProtocolVersion // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_protocol_version(_arg0) + runtime.KeepAlive(conn) + + var _tlsProtocolVersion TLSProtocolVersion // out + + _tlsProtocolVersion = TLSProtocolVersion(_cret) + + return _tlsProtocolVersion +} + +// RehandshakeMode gets conn rehandshaking mode. See +// g_dtls_connection_set_rehandshake_mode() for details. +// +// Deprecated: Changing the rehandshake mode is no longer required for +// compatibility. Also, rehandshaking has been removed from the TLS protocol in +// TLS 1.3. +// +// The function returns the following values: +// +// - tlsRehandshakeMode: G_TLS_REHANDSHAKE_SAFELY. +func (conn *DTLSConnection) RehandshakeMode() TLSRehandshakeMode { + var _arg0 *C.GDtlsConnection // out + var _cret C.GTlsRehandshakeMode // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_rehandshake_mode(_arg0) + runtime.KeepAlive(conn) + + var _tlsRehandshakeMode TLSRehandshakeMode // out + + _tlsRehandshakeMode = TLSRehandshakeMode(_cret) + + return _tlsRehandshakeMode +} + +// RequireCloseNotify tests whether or not conn expects a proper +// TLS close notification when the connection is closed. See +// g_dtls_connection_set_require_close_notify() for details. +// +// The function returns the following values: +// +// - ok: TRUE if conn requires a proper TLS close notification. +func (conn *DTLSConnection) RequireCloseNotify() bool { + var _arg0 *C.GDtlsConnection // out + var _cret C.gboolean // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_dtls_connection_get_require_close_notify(_arg0) + runtime.KeepAlive(conn) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Handshake attempts a TLS handshake on conn. +// +// On the client side, it is never necessary to call this method; although the +// connection needs to perform a handshake after connecting, Connection will +// handle this for you automatically when you try to send or receive data on the +// connection. You can call g_dtls_connection_handshake() manually if you want +// to know whether the initial handshake succeeded or failed (as opposed to just +// immediately trying to use conn to read or write, in which case, if it fails, +// it may not be possible to tell if it failed before or after completing the +// handshake), but beware that servers may reject client authentication after +// the handshake has completed, so a successful handshake does not indicate the +// connection will be usable. +// +// Likewise, on the server side, although a handshake is necessary at the +// beginning of the communication, you do not need to call this function +// explicitly unless you want clearer error reporting. +// +// Previously, calling g_dtls_connection_handshake() after the initial handshake +// would trigger a rehandshake; however, this usage was deprecated in GLib +// 2.60 because rehandshaking was removed from the TLS protocol in TLS 1.3. +// Since GLib 2.64, calling this function after the initial handshake will no +// longer do anything. +// +// Connection::accept_certificate may be emitted during the handshake. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (conn *DTLSConnection) Handshake(ctx context.Context) error { + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_dtls_connection_handshake(_arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// HandshakeAsync: asynchronously performs a TLS handshake on conn. See +// g_dtls_connection_handshake() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the handshake is complete. +func (conn *DTLSConnection) HandshakeAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GDtlsConnection // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dtls_connection_handshake_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// HandshakeFinish: finish an asynchronous TLS handshake operation. See +// g_dtls_connection_handshake() for more information. +// +// The function takes the following parameters: +// +// - result: Result. +func (conn *DTLSConnection) HandshakeFinish(result AsyncResulter) error { + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_dtls_connection_handshake_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAdvertisedProtocols sets the list of application-layer protocols +// to advertise that the caller is willing to speak on this connection. +// The Application-Layer Protocol Negotiation (ALPN) extension will +// be used to negotiate a compatible protocol with the peer; use +// g_dtls_connection_get_negotiated_protocol() to find the negotiated protocol +// after the handshake. Specifying NULL for the the value of protocols will +// disable ALPN negotiation. +// +// See IANA TLS ALPN Protocol IDs +// (https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids) +// for a list of registered protocol IDs. +// +// The function takes the following parameters: +// +// - protocols (optional): NULL-terminated array of ALPN protocol names (eg, +// "http/1.1", "h2"), or NULL. +func (conn *DTLSConnection) SetAdvertisedProtocols(protocols []string) { + var _arg0 *C.GDtlsConnection // out + var _arg1 **C.gchar // out + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + _arg1 = (**C.gchar)(C.calloc(C.size_t((len(protocols) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(protocols)+1) + var zero *C.gchar + out[len(protocols)] = zero + for i := range protocols { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(protocols[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.g_dtls_connection_set_advertised_protocols(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(protocols) +} + +// SetCertificate: this sets the certificate that conn will present to its peer +// during the TLS handshake. For a ServerConnection, it is mandatory to set +// this, and that will normally be done at construct time. +// +// For a ClientConnection, this is optional. If a handshake fails with +// G_TLS_ERROR_CERTIFICATE_REQUIRED, that means that the server requires a +// certificate, and if you try connecting again, you should call this method +// first. You can call g_dtls_client_connection_get_accepted_cas() on the failed +// connection to get a list of Certificate Authorities that the server will +// accept certificates from. +// +// (It is also possible that a server will allow the connection with or +// without a certificate; in that case, if you don't provide a certificate, +// you can tell that the server requested one by the fact that +// g_dtls_client_connection_get_accepted_cas() will return non-NULL.). +// +// The function takes the following parameters: +// +// - certificate to use for conn. +func (conn *DTLSConnection) SetCertificate(certificate TLSCertificater) { + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GTlsCertificate // out + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + + C.g_dtls_connection_set_certificate(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(certificate) +} + +// SetDatabase sets the certificate database that is used to verify +// peer certificates. This is set to the default database by default. +// See g_tls_backend_get_default_database(). If set to NULL, then peer +// certificate validation will always set the G_TLS_CERTIFICATE_UNKNOWN_CA +// error (meaning Connection::accept-certificate will always be +// emitted on client-side connections, unless that bit is not set in +// ClientConnection:validation-flags). +// +// There are nonintuitive security implications when using a non-default +// database. See Connection:database for details. +// +// The function takes the following parameters: +// +// - database (optional): Database. +func (conn *DTLSConnection) SetDatabase(database TLSDatabaser) { + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GTlsDatabase // out + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + if database != nil { + _arg1 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(database).Native())) + } + + C.g_dtls_connection_set_database(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(database) +} + +// SetInteraction: set the object that will be used to interact with the user. +// It will be used for things like prompting the user for passwords. +// +// The interaction argument will normally be a derived subclass of Interaction. +// NULL can also be provided if no user interaction should occur for this +// connection. +// +// The function takes the following parameters: +// +// - interaction (optional) object, or NULL. +func (conn *DTLSConnection) SetInteraction(interaction *TLSInteraction) { + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GTlsInteraction // out + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + if interaction != nil { + _arg1 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + + C.g_dtls_connection_set_interaction(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(interaction) +} + +// SetRehandshakeMode: since GLib 2.64, changing the rehandshake mode is no +// longer supported and will have no effect. With TLS 1.3, rehandshaking has +// been removed from the TLS protocol, replaced by separate post-handshake +// authentication and rekey operations. +// +// Deprecated: Changing the rehandshake mode is no longer required for +// compatibility. Also, rehandshaking has been removed from the TLS protocol in +// TLS 1.3. +// +// The function takes the following parameters: +// +// - mode: rehandshaking mode. +func (conn *DTLSConnection) SetRehandshakeMode(mode TLSRehandshakeMode) { + var _arg0 *C.GDtlsConnection // out + var _arg1 C.GTlsRehandshakeMode // out + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = C.GTlsRehandshakeMode(mode) + + C.g_dtls_connection_set_rehandshake_mode(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(mode) +} + +// SetRequireCloseNotify sets whether or not conn expects a proper TLS close +// notification before the connection is closed. If this is TRUE (the default), +// then conn will expect to receive a TLS close notification from its peer +// before the connection is closed, and will return a G_TLS_ERROR_EOF error if +// the connection is closed without proper notification (since this may indicate +// a network error, or man-in-the-middle attack). +// +// In some protocols, the application will know whether or not the +// connection was closed cleanly based on application-level data (because +// the application-level data includes a length field, or is somehow +// self-delimiting); in this case, the close notify is redundant and may be +// omitted. You can use g_dtls_connection_set_require_close_notify() to tell +// conn to allow an "unannounced" connection close, in which case the close +// will show up as a 0-length read, as in a non-TLS Based, and it is up to the +// application to check that the data has been fully received. +// +// Note that this only affects the behavior when the peer closes the connection; +// when the application calls g_dtls_connection_close_async() on conn itself, +// this will send a close notification regardless of the setting of this +// property. If you explicitly want to do an unclean close, you can close conn's +// Connection:base-socket rather than closing conn itself. +// +// The function takes the following parameters: +// +// - requireCloseNotify: whether or not to require close notification. +func (conn *DTLSConnection) SetRequireCloseNotify(requireCloseNotify bool) { + var _arg0 *C.GDtlsConnection // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + if requireCloseNotify { + _arg1 = C.TRUE + } + + C.g_dtls_connection_set_require_close_notify(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(requireCloseNotify) +} + +// Shutdown: shut down part or all of a DTLS connection. +// +// If shutdown_read is TRUE then the receiving side of the connection +// is shut down, and further reading is disallowed. Subsequent calls to +// g_datagram_based_receive_messages() will return G_IO_ERROR_CLOSED. +// +// If shutdown_write is TRUE then the sending side of the connection +// is shut down, and further writing is disallowed. Subsequent calls to +// g_datagram_based_send_messages() will return G_IO_ERROR_CLOSED. +// +// It is allowed for both shutdown_read and shutdown_write to be TRUE — this is +// equivalent to calling g_dtls_connection_close(). +// +// If cancellable is cancelled, the Connection may be left partially-closed and +// any pending untransmitted data may be lost. Call g_dtls_connection_shutdown() +// again to complete closing the Connection. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - shutdownRead: TRUE to stop reception of incoming datagrams. +// - shutdownWrite: TRUE to stop sending outgoing datagrams. +func (conn *DTLSConnection) Shutdown(ctx context.Context, shutdownRead, shutdownWrite bool) error { + var _arg0 *C.GDtlsConnection // out + var _arg3 *C.GCancellable // out + var _arg1 C.gboolean // out + var _arg2 C.gboolean // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if shutdownRead { + _arg1 = C.TRUE + } + if shutdownWrite { + _arg2 = C.TRUE + } + + C.g_dtls_connection_shutdown(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + runtime.KeepAlive(shutdownRead) + runtime.KeepAlive(shutdownWrite) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ShutdownAsync: asynchronously shut down part or all of the DTLS connection. +// See g_dtls_connection_shutdown() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - shutdownRead: TRUE to stop reception of incoming datagrams. +// - shutdownWrite: TRUE to stop sending outgoing datagrams. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the shutdown operation is complete. +func (conn *DTLSConnection) ShutdownAsync(ctx context.Context, shutdownRead, shutdownWrite bool, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GDtlsConnection // out + var _arg4 *C.GCancellable // out + var _arg1 C.gboolean // out + var _arg2 C.gboolean // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if shutdownRead { + _arg1 = C.TRUE + } + if shutdownWrite { + _arg2 = C.TRUE + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dtls_connection_shutdown_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + runtime.KeepAlive(shutdownRead) + runtime.KeepAlive(shutdownWrite) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ShutdownFinish: finish an asynchronous TLS shutdown operation. See +// g_dtls_connection_shutdown() for more information. +// +// The function takes the following parameters: +// +// - result: Result. +func (conn *DTLSConnection) ShutdownFinish(result AsyncResulter) error { + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_dtls_connection_shutdown_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// acceptCertificate: check whether to accept a certificate. +// +// The function takes the following parameters: +// +// - peerCert +// - errors +func (connection *DTLSConnection) acceptCertificate(peerCert TLSCertificater, errors TLSCertificateFlags) bool { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(connection)) + fnarg := gclass.accept_certificate + + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GTlsCertificate // out + var _arg2 C.GTlsCertificateFlags // out + var _cret C.gboolean // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(peerCert).Native())) + _arg2 = C.GTlsCertificateFlags(errors) + + _cret = C._gotk4_gio2_DTLSConnection_virtual_accept_certificate(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(connection) + runtime.KeepAlive(peerCert) + runtime.KeepAlive(errors) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// bindingData: retrieve TLS channel binding data (Since: 2.66). +// +// The function takes the following parameters: +// +// - typ +// - data +func (conn *DTLSConnection) bindingData(typ TLSChannelBindingType, data []byte) error { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.get_binding_data + + var _arg0 *C.GDtlsConnection // out + var _arg1 C.GTlsChannelBindingType // out + var _arg2 *C.GByteArray // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = C.GTlsChannelBindingType(typ) + _arg2 = C.g_byte_array_sized_new(C.guint(len(data))) + if len(data) > 0 { + _arg2 = C.g_byte_array_append(_arg2, (*C.guint8)(&data[0]), C.guint(len(data))) + } + defer C.g_byte_array_unref(_arg2) + + C._gotk4_gio2_DTLSConnection_virtual_get_binding_data(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(typ) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// negotiatedProtocol gets the name of the application-layer protocol negotiated +// during the handshake. +// +// If the peer did not use the ALPN extension, or did not advertise +// a protocol that matched one of conn's protocols, or the TLS +// backend does not support ALPN, then this will be NULL. See +// g_dtls_connection_set_advertised_protocols(). +// +// The function returns the following values: +// +// - utf8 (optional): negotiated protocol, or NULL. +func (conn *DTLSConnection) negotiatedProtocol() string { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.get_negotiated_protocol + + var _arg0 *C.GDtlsConnection // out + var _cret *C.gchar // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C._gotk4_gio2_DTLSConnection_virtual_get_negotiated_protocol(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(conn) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Handshake attempts a TLS handshake on conn. +// +// On the client side, it is never necessary to call this method; although the +// connection needs to perform a handshake after connecting, Connection will +// handle this for you automatically when you try to send or receive data on the +// connection. You can call g_dtls_connection_handshake() manually if you want +// to know whether the initial handshake succeeded or failed (as opposed to just +// immediately trying to use conn to read or write, in which case, if it fails, +// it may not be possible to tell if it failed before or after completing the +// handshake), but beware that servers may reject client authentication after +// the handshake has completed, so a successful handshake does not indicate the +// connection will be usable. +// +// Likewise, on the server side, although a handshake is necessary at the +// beginning of the communication, you do not need to call this function +// explicitly unless you want clearer error reporting. +// +// Previously, calling g_dtls_connection_handshake() after the initial handshake +// would trigger a rehandshake; however, this usage was deprecated in GLib +// 2.60 because rehandshaking was removed from the TLS protocol in TLS 1.3. +// Since GLib 2.64, calling this function after the initial handshake will no +// longer do anything. +// +// Connection::accept_certificate may be emitted during the handshake. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (conn *DTLSConnection) handshake(ctx context.Context) error { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.handshake + + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_DTLSConnection_virtual_handshake(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// handshakeAsync: asynchronously performs a TLS handshake on conn. See +// g_dtls_connection_handshake() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the handshake is complete. +func (conn *DTLSConnection) handshakeAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.handshake_async + + var _arg0 *C.GDtlsConnection // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_DTLSConnection_virtual_handshake_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// handshakeFinish: finish an asynchronous TLS handshake operation. See +// g_dtls_connection_handshake() for more information. +// +// The function takes the following parameters: +// +// - result: Result. +func (conn *DTLSConnection) handshakeFinish(result AsyncResulter) error { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.handshake_finish + + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_DTLSConnection_virtual_handshake_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// setAdvertisedProtocols sets the list of application-layer protocols +// to advertise that the caller is willing to speak on this connection. +// The Application-Layer Protocol Negotiation (ALPN) extension will +// be used to negotiate a compatible protocol with the peer; use +// g_dtls_connection_get_negotiated_protocol() to find the negotiated protocol +// after the handshake. Specifying NULL for the the value of protocols will +// disable ALPN negotiation. +// +// See IANA TLS ALPN Protocol IDs +// (https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids) +// for a list of registered protocol IDs. +// +// The function takes the following parameters: +// +// - protocols (optional): NULL-terminated array of ALPN protocol names (eg, +// "http/1.1", "h2"), or NULL. +func (conn *DTLSConnection) setAdvertisedProtocols(protocols []string) { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.set_advertised_protocols + + var _arg0 *C.GDtlsConnection // out + var _arg1 **C.gchar // out + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + _arg1 = (**C.gchar)(C.calloc(C.size_t((len(protocols) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(protocols)+1) + var zero *C.gchar + out[len(protocols)] = zero + for i := range protocols { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(protocols[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C._gotk4_gio2_DTLSConnection_virtual_set_advertised_protocols(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(protocols) +} + +// Shutdown: shut down part or all of a DTLS connection. +// +// If shutdown_read is TRUE then the receiving side of the connection +// is shut down, and further reading is disallowed. Subsequent calls to +// g_datagram_based_receive_messages() will return G_IO_ERROR_CLOSED. +// +// If shutdown_write is TRUE then the sending side of the connection +// is shut down, and further writing is disallowed. Subsequent calls to +// g_datagram_based_send_messages() will return G_IO_ERROR_CLOSED. +// +// It is allowed for both shutdown_read and shutdown_write to be TRUE — this is +// equivalent to calling g_dtls_connection_close(). +// +// If cancellable is cancelled, the Connection may be left partially-closed and +// any pending untransmitted data may be lost. Call g_dtls_connection_shutdown() +// again to complete closing the Connection. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - shutdownRead: TRUE to stop reception of incoming datagrams. +// - shutdownWrite: TRUE to stop sending outgoing datagrams. +func (conn *DTLSConnection) shutdown(ctx context.Context, shutdownRead, shutdownWrite bool) error { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.shutdown + + var _arg0 *C.GDtlsConnection // out + var _arg3 *C.GCancellable // out + var _arg1 C.gboolean // out + var _arg2 C.gboolean // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if shutdownRead { + _arg1 = C.TRUE + } + if shutdownWrite { + _arg2 = C.TRUE + } + + C._gotk4_gio2_DTLSConnection_virtual_shutdown(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + runtime.KeepAlive(shutdownRead) + runtime.KeepAlive(shutdownWrite) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// shutdownAsync: asynchronously shut down part or all of the DTLS connection. +// See g_dtls_connection_shutdown() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - shutdownRead: TRUE to stop reception of incoming datagrams. +// - shutdownWrite: TRUE to stop sending outgoing datagrams. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the shutdown operation is complete. +func (conn *DTLSConnection) shutdownAsync(ctx context.Context, shutdownRead, shutdownWrite bool, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.shutdown_async + + var _arg0 *C.GDtlsConnection // out + var _arg4 *C.GCancellable // out + var _arg1 C.gboolean // out + var _arg2 C.gboolean // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if shutdownRead { + _arg1 = C.TRUE + } + if shutdownWrite { + _arg2 = C.TRUE + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_DTLSConnection_virtual_shutdown_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + runtime.KeepAlive(shutdownRead) + runtime.KeepAlive(shutdownWrite) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// shutdownFinish: finish an asynchronous TLS shutdown operation. See +// g_dtls_connection_shutdown() for more information. +// +// The function takes the following parameters: +// +// - result: Result. +func (conn *DTLSConnection) shutdownFinish(result AsyncResulter) error { + gclass := (*C.GDtlsConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.shutdown_finish + + var _arg0 *C.GDtlsConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDtlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_DTLSConnection_virtual_shutdown_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// DTLSServerConnectionOverrider contains methods that are overridable. +type DTLSServerConnectionOverrider interface { +} + +// DTLSServerConnection: GDtlsServerConnection is the server-side subclass of +// gio.DTLSConnection, representing a server-side DTLS connection. +// +// DTLSServerConnection wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type DTLSServerConnection struct { + _ [0]func() // equal guard + DTLSConnection +} + +var () + +// DTLSServerConnectioner describes DTLSServerConnection's interface methods. +type DTLSServerConnectioner interface { + coreglib.Objector + + baseDTLSServerConnection() *DTLSServerConnection +} + +var _ DTLSServerConnectioner = (*DTLSServerConnection)(nil) + +func ifaceInitDTLSServerConnectioner(gifacePtr, data C.gpointer) { +} + +func wrapDTLSServerConnection(obj *coreglib.Object) *DTLSServerConnection { + return &DTLSServerConnection{ + DTLSConnection: DTLSConnection{ + DatagramBased: DatagramBased{ + Object: obj, + }, + }, + } +} + +func marshalDTLSServerConnection(p uintptr) (interface{}, error) { + return wrapDTLSServerConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *DTLSServerConnection) baseDTLSServerConnection() *DTLSServerConnection { + return v +} + +// BaseDTLSServerConnection returns the underlying base object. +func BaseDTLSServerConnection(obj DTLSServerConnectioner) *DTLSServerConnection { + return obj.baseDTLSServerConnection() +} + +// NewDTLSServerConnection creates a new ServerConnection wrapping base_socket. +// +// The function takes the following parameters: +// +// - baseSocket to wrap. +// - certificate (optional): default server certificate, or NULL. +// +// The function returns the following values: +// +// - dtlsServerConnection: new ServerConnection, or NULL on error. +func NewDTLSServerConnection(baseSocket DatagramBasedder, certificate TLSCertificater) (*DTLSServerConnection, error) { + var _arg1 *C.GDatagramBased // out + var _arg2 *C.GTlsCertificate // out + var _cret *C.GDatagramBased // in + var _cerr *C.GError // in + + _arg1 = (*C.GDatagramBased)(unsafe.Pointer(coreglib.InternObject(baseSocket).Native())) + if certificate != nil { + _arg2 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + } + + _cret = C.g_dtls_server_connection_new(_arg1, _arg2, &_cerr) + runtime.KeepAlive(baseSocket) + runtime.KeepAlive(certificate) + + var _dtlsServerConnection *DTLSServerConnection // out + var _goerr error // out + + _dtlsServerConnection = wrapDTLSServerConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dtlsServerConnection, _goerr +} + +// File: GFile is a high level abstraction for manipulating files on a virtual +// file system. GFiles are lightweight, immutable objects that do no I/O upon +// creation. It is necessary to understand that GFile objects do not represent +// files, merely an identifier for a file. All file content I/O is implemented +// as streaming operations (see gio.InputStream and gio.OutputStream). +// +// To construct a GFile, you can use: +// +// - gio.File().NewForPath if you have a path. +// +// - gio.File().NewForURI if you have a URI. +// +// - gio.File().NewForCommandlineArg or gio.File().NewForCommandlineArgAndCwd +// for a command line argument. +// +// - gio.File().NewTmp to create a temporary file from a template. +// +// - gio.File().NewTmpAsync to asynchronously create a temporary file. +// +// - gio.File().NewTmpDirAsync to asynchronously create a temporary directory. +// +// - gio.File().ParseName from a UTF-8 string gotten from +// gio.File.GetParseName(). +// +// - gio.File().NewBuildFilename or gio.File().NewBuildFilenamev to create a +// file from path elements. +// +// One way to think of a GFile is as an abstraction of a pathname. For normal +// files the system pathname is what is stored internally, but as GFiles are +// extensible it could also be something else that corresponds to a pathname in +// a userspace implementation of a filesystem. +// +// GFiles make up hierarchies of directories and files that correspond to +// the files on a filesystem. You can move through the file system with +// GFile using gio.File.GetParent() to get an identifier for the parent +// directory, gio.File.GetChild() to get a child within a directory, and +// gio.File.ResolveRelativePath() to resolve a relative path between two GFiles. +// There can be multiple hierarchies, so you may not end up at the same root if +// you repeatedly call gio.File.GetParent() on two different files. +// +// All GFiles have a basename (get with gio.File.GetBasename()). These names are +// byte strings that are used to identify the file on the filesystem (relative +// to its parent directory) and there is no guarantees that they have any +// particular charset encoding or even make any sense at all. If you want to use +// filenames in a user interface you should use the display name that you can +// get by requesting the G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with +// gio.File.QueryInfo(). This is guaranteed to be in UTF-8 and can be used in +// a user interface. But always store the real basename or the GFile to use to +// actually access the file, because there is no way to go from a display name +// to the actual name. +// +// Using GFile as an identifier has the same weaknesses as using a path in +// that there may be multiple aliases for the same file. For instance, hard or +// soft links may cause two different GFiles to refer to the same file. Other +// possible causes for aliases are: case insensitive filesystems, short and +// long names on FAT/NTFS, or bind mounts in Linux. If you want to check if two +// GFiles point to the same file you can query for the G_FILE_ATTRIBUTE_ID_FILE +// attribute. Note that GFile does some trivial canonicalization of pathnames +// passed in, so that trivial differences in the path string used at creation +// (duplicated slashes, slash at end of path, . or .. path segments, etc) does +// not create different GFiles. +// +// Many GFile operations have both synchronous and asynchronous versions to suit +// your application. Asynchronous versions of synchronous functions simply have +// _async() appended to their function names. The asynchronous I/O functions +// call a gio.AsyncReadyCallback which is then used to finalize the operation, +// producing a gio.AsyncResult which is then passed to the function’s matching +// _finish() operation. +// +// It is highly recommended to use asynchronous calls when running within +// a shared main loop, such as in the main thread of an application. +// This avoids I/O operations blocking other sources on the main loop from +// being dispatched. Synchronous I/O operations should be performed from +// worker threads. See the introduction to asynchronous programming section +// (overview.html#asynchronous-programming) for more. +// +// Some GFile operations almost always take a noticeable amount of time, +// and so do not have synchronous analogs. Notable cases include: +// +// - gio.File.MountMountable() to mount a mountable file. +// +// - gio.File.UnmountMountableWithOperation() to unmount a mountable file. +// +// - gio.File.EjectMountableWithOperation() to eject a mountable file. +// +// # Entity Tags +// +// One notable feature of GFiles are entity tags, or ‘etags’ for short. +// Entity tags are somewhat like a more abstract version of the traditional +// mtime, and can be used to quickly determine if the file has been modified +// from the version on the file system. See the HTTP 1.1 specification +// (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html) for HTTP ETag +// headers, which are a very similar concept. +// +// File wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type File struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*File)(nil) +) + +// Filer describes File's interface methods. +type Filer interface { + coreglib.Objector + + // AppendTo gets an output stream for appending data to the file. + AppendTo(ctx context.Context, flags FileCreateFlags) (*FileOutputStream, error) + // AppendToAsync: asynchronously opens file for appending. + AppendToAsync(ctx context.Context, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) + // AppendToFinish finishes an asynchronous file append operation started + // with g_file_append_to_async(). + AppendToFinish(res AsyncResulter) (*FileOutputStream, error) + // BuildAttributeListForCopy prepares the file attribute query string for + // copying to file. + BuildAttributeListForCopy(ctx context.Context, flags FileCopyFlags) (string, error) + // CopyAttributes copies the file attributes from source to destination. + CopyAttributes(ctx context.Context, destination Filer, flags FileCopyFlags) error + // CopyFinish finishes copying the file started with g_file_copy_async(). + CopyFinish(res AsyncResulter) error + // Create creates a new file and returns an output stream for writing to it. + Create(ctx context.Context, flags FileCreateFlags) (*FileOutputStream, error) + // CreateAsync: asynchronously creates a new file and returns an output + // stream for writing to it. + CreateAsync(ctx context.Context, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) + // CreateFinish finishes an asynchronous file create operation started with + // g_file_create_async(). + CreateFinish(res AsyncResulter) (*FileOutputStream, error) + // CreateReadwrite creates a new file and returns a stream for reading and + // writing to it. + CreateReadwrite(ctx context.Context, flags FileCreateFlags) (*FileIOStream, error) + // CreateReadwriteAsync: asynchronously creates a new file and returns a + // stream for reading and writing to it. + CreateReadwriteAsync(ctx context.Context, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) + // CreateReadwriteFinish finishes an asynchronous file create operation + // started with g_file_create_readwrite_async(). + CreateReadwriteFinish(res AsyncResulter) (*FileIOStream, error) + // Delete deletes a file. + Delete(ctx context.Context) error + // DeleteAsync: asynchronously delete a file. + DeleteAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // DeleteFinish finishes deleting a file started with g_file_delete_async(). + DeleteFinish(result AsyncResulter) error + // Dup duplicates a #GFile handle. + Dup() *File + // EjectMountable starts an asynchronous eject on a mountable. + EjectMountable(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) + // EjectMountableFinish finishes an asynchronous eject operation started by + // g_file_eject_mountable(). + EjectMountableFinish(result AsyncResulter) error + // EjectMountableWithOperation starts an asynchronous eject on a mountable. + EjectMountableWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // EjectMountableWithOperationFinish finishes an asynchronous eject + // operation started by g_file_eject_mountable_with_operation(). + EjectMountableWithOperationFinish(result AsyncResulter) error + // EnumerateChildren gets the requested information about the files in a + // directory. + EnumerateChildren(ctx context.Context, attributes string, flags FileQueryInfoFlags) (*FileEnumerator, error) + // EnumerateChildrenAsync: asynchronously gets the requested information + // about the files in a directory. + EnumerateChildrenAsync(ctx context.Context, attributes string, flags FileQueryInfoFlags, ioPriority int, callback AsyncReadyCallback) + // EnumerateChildrenFinish finishes an async enumerate children operation. + EnumerateChildrenFinish(res AsyncResulter) (*FileEnumerator, error) + // Equal checks if the two given #GFiles refer to the same file. + Equal(file2 Filer) bool + // FindEnclosingMount gets a #GMount for the #GFile. + FindEnclosingMount(ctx context.Context) (*Mount, error) + // FindEnclosingMountAsync: asynchronously gets the mount for the file. + FindEnclosingMountAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // FindEnclosingMountFinish finishes an asynchronous find mount request. + FindEnclosingMountFinish(res AsyncResulter) (*Mount, error) + // Basename gets the base name (the last component of the path) for a given + // #GFile. + Basename() string + // Child gets a child of file with basename equal to name. + Child(name string) *File + // ChildForDisplayName gets the child of file for a given display_name (i.e. + ChildForDisplayName(displayName string) (*File, error) + // Parent gets the parent directory for the file. + Parent() *File + // ParseName gets the parse name of the file. + ParseName() string + // Path gets the local pathname for #GFile, if one exists. + Path() string + // RelativePath gets the path for descendant relative to parent. + RelativePath(descendant Filer) string + // URI gets the URI for the file. + URI() string + // URIScheme gets the URI scheme for a #GFile. + URIScheme() string + // HasParent checks if file has a parent, and optionally, if it is parent. + HasParent(parent Filer) bool + // HasPrefix checks whether file has the prefix specified by prefix. + HasPrefix(prefix Filer) bool + // HasURIScheme checks to see if a #GFile has a given URI scheme. + HasURIScheme(uriScheme string) bool + // Hash creates a hash value for a #GFile. + Hash() uint + // IsNative checks to see if a file is native to the platform. + IsNative() bool + // LoadBytes loads the contents of file and returns it as #GBytes. + LoadBytes(ctx context.Context) (string, *glib.Bytes, error) + // LoadBytesAsync: asynchronously loads the contents of file as #GBytes. + LoadBytesAsync(ctx context.Context, callback AsyncReadyCallback) + // LoadBytesFinish completes an asynchronous request to + // g_file_load_bytes_async(). + LoadBytesFinish(result AsyncResulter) (string, *glib.Bytes, error) + // LoadContents loads the content of the file into memory. + LoadContents(ctx context.Context) ([]byte, string, error) + // LoadContentsAsync starts an asynchronous load of the file's contents. + LoadContentsAsync(ctx context.Context, callback AsyncReadyCallback) + // LoadContentsFinish finishes an asynchronous load of the file's contents. + LoadContentsFinish(res AsyncResulter) ([]byte, string, error) + // LoadPartialContentsFinish finishes an asynchronous partial load operation + // that was started with g_file_load_partial_contents_async(). + LoadPartialContentsFinish(res AsyncResulter) ([]byte, string, error) + // MakeDirectory creates a directory. + MakeDirectory(ctx context.Context) error + // MakeDirectoryAsync: asynchronously creates a directory. + MakeDirectoryAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // MakeDirectoryFinish finishes an asynchronous directory creation, started + // with g_file_make_directory_async(). + MakeDirectoryFinish(result AsyncResulter) error + // MakeDirectoryWithParents creates a directory and any parent directories + // that may not exist similar to 'mkdir -p'. + MakeDirectoryWithParents(ctx context.Context) error + // MakeSymbolicLink creates a symbolic link named file which contains the + // string symlink_value. + MakeSymbolicLink(ctx context.Context, symlinkValue string) error + // MakeSymbolicLinkAsync: asynchronously creates a symbolic link named file + // which contains the string symlink_value. + MakeSymbolicLinkAsync(ctx context.Context, symlinkValue string, ioPriority int, callback AsyncReadyCallback) + // MakeSymbolicLinkFinish finishes an asynchronous symbolic link creation, + // started with g_file_make_symbolic_link_async(). + MakeSymbolicLinkFinish(result AsyncResulter) error + // MeasureDiskUsageFinish collects the results from an earlier call to + // g_file_measure_disk_usage_async(). + MeasureDiskUsageFinish(result AsyncResulter) (diskUsage, numDirs, numFiles uint64, goerr error) + // Monitor obtains a file or directory monitor for the given file, depending + // on the type of the file. + Monitor(ctx context.Context, flags FileMonitorFlags) (FileMonitorrer, error) + // MonitorDirectory obtains a directory monitor for the given file. + MonitorDirectory(ctx context.Context, flags FileMonitorFlags) (FileMonitorrer, error) + // MonitorFile obtains a file monitor for the given file. + MonitorFile(ctx context.Context, flags FileMonitorFlags) (FileMonitorrer, error) + // MountEnclosingVolume starts a mount_operation, mounting the volume that + // contains the file location. + MountEnclosingVolume(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // MountEnclosingVolumeFinish finishes a mount operation started by + // g_file_mount_enclosing_volume(). + MountEnclosingVolumeFinish(result AsyncResulter) error + // MountMountable mounts a file of type G_FILE_TYPE_MOUNTABLE. + MountMountable(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // MountMountableFinish finishes a mount operation. + MountMountableFinish(result AsyncResulter) (*File, error) + // MoveFinish finishes an asynchronous file movement, started with + // g_file_move_async(). + MoveFinish(result AsyncResulter) error + // OpenReadwrite opens an existing file for reading and writing. + OpenReadwrite(ctx context.Context) (*FileIOStream, error) + // OpenReadwriteAsync: asynchronously opens file for reading and writing. + OpenReadwriteAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // OpenReadwriteFinish finishes an asynchronous file read operation started + // with g_file_open_readwrite_async(). + OpenReadwriteFinish(res AsyncResulter) (*FileIOStream, error) + // PeekPath: exactly like g_file_get_path(), but caches the result via + // g_object_set_qdata_full(). + PeekPath() string + // PollMountable polls a file of type G_FILE_TYPE_MOUNTABLE. + PollMountable(ctx context.Context, callback AsyncReadyCallback) + // PollMountableFinish finishes a poll operation. + PollMountableFinish(result AsyncResulter) error + // QueryDefaultHandler returns the Info that is registered as the default + // application to handle the file specified by file. + QueryDefaultHandler(ctx context.Context) (*AppInfo, error) + // QueryDefaultHandlerAsync: async version of + // g_file_query_default_handler(). + QueryDefaultHandlerAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // QueryDefaultHandlerFinish finishes a g_file_query_default_handler_async() + // operation. + QueryDefaultHandlerFinish(result AsyncResulter) (*AppInfo, error) + // QueryExists: utility function to check if a particular file exists. + QueryExists(ctx context.Context) bool + // QueryFileType: utility function to inspect the Type of a file. + QueryFileType(ctx context.Context, flags FileQueryInfoFlags) FileType + // QueryFilesystemInfo: similar to g_file_query_info(), but obtains + // information about the filesystem the file is on, rather than the file + // itself. + QueryFilesystemInfo(ctx context.Context, attributes string) (*FileInfo, error) + // QueryFilesystemInfoAsync: asynchronously gets the requested information + // about the filesystem that the specified file is on. + QueryFilesystemInfoAsync(ctx context.Context, attributes string, ioPriority int, callback AsyncReadyCallback) + // QueryFilesystemInfoFinish finishes an asynchronous filesystem info query. + QueryFilesystemInfoFinish(res AsyncResulter) (*FileInfo, error) + // QueryInfo gets the requested information about specified file. + QueryInfo(ctx context.Context, attributes string, flags FileQueryInfoFlags) (*FileInfo, error) + // QueryInfoAsync: asynchronously gets the requested information about + // specified file. + QueryInfoAsync(ctx context.Context, attributes string, flags FileQueryInfoFlags, ioPriority int, callback AsyncReadyCallback) + // QueryInfoFinish finishes an asynchronous file info query. + QueryInfoFinish(res AsyncResulter) (*FileInfo, error) + // QuerySettableAttributes: obtain the list of settable attributes for the + // file. + QuerySettableAttributes(ctx context.Context) (*FileAttributeInfoList, error) + // QueryWritableNamespaces: obtain the list of attribute namespaces where + // new attributes can be created by a user. + QueryWritableNamespaces(ctx context.Context) (*FileAttributeInfoList, error) + // Read opens a file for reading. + Read(ctx context.Context) (*FileInputStream, error) + // ReadAsync: asynchronously opens file for reading. + ReadAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // ReadFinish finishes an asynchronous file read operation started with + // g_file_read_async(). + ReadFinish(res AsyncResulter) (*FileInputStream, error) + // Replace returns an output stream for overwriting the file, possibly + // creating a backup copy of the file first. + Replace(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags) (*FileOutputStream, error) + // ReplaceAsync: asynchronously overwrites the file, replacing the contents, + // possibly creating a backup copy of the file first. + ReplaceAsync(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) + // ReplaceContents replaces the contents of file with contents of length + // bytes. + ReplaceContents(ctx context.Context, contents, etag string, makeBackup bool, flags FileCreateFlags) (string, error) + // ReplaceContentsAsync starts an asynchronous replacement of file with the + // given contents of length bytes. + ReplaceContentsAsync(ctx context.Context, contents, etag string, makeBackup bool, flags FileCreateFlags, callback AsyncReadyCallback) + // ReplaceContentsBytesAsync: same as g_file_replace_contents_async() but + // takes a #GBytes input instead. + ReplaceContentsBytesAsync(ctx context.Context, contents *glib.Bytes, etag string, makeBackup bool, flags FileCreateFlags, callback AsyncReadyCallback) + // ReplaceContentsFinish finishes an asynchronous replace of the given file. + ReplaceContentsFinish(res AsyncResulter) (string, error) + // ReplaceFinish finishes an asynchronous file replace operation started + // with g_file_replace_async(). + ReplaceFinish(res AsyncResulter) (*FileOutputStream, error) + // ReplaceReadwrite returns an output stream for overwriting the file in + // readwrite mode, possibly creating a backup copy of the file first. + ReplaceReadwrite(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags) (*FileIOStream, error) + // ReplaceReadwriteAsync: asynchronously overwrites the file in read-write + // mode, replacing the contents, possibly creating a backup copy of the file + // first. + ReplaceReadwriteAsync(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) + // ReplaceReadwriteFinish finishes an asynchronous file replace operation + // started with g_file_replace_readwrite_async(). + ReplaceReadwriteFinish(res AsyncResulter) (*FileIOStream, error) + // ResolveRelativePath resolves a relative path for file to an absolute + // path. + ResolveRelativePath(relativePath string) *File + // SetAttribute sets an attribute in the file with attribute name attribute + // to value_p. + SetAttribute(ctx context.Context, attribute string, typ FileAttributeType, valueP unsafe.Pointer, flags FileQueryInfoFlags) error + // SetAttributeByteString sets attribute of type + // G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to value. + SetAttributeByteString(ctx context.Context, attribute, value string, flags FileQueryInfoFlags) error + // SetAttributeInt32 sets attribute of type G_FILE_ATTRIBUTE_TYPE_INT32 to + // value. + SetAttributeInt32(ctx context.Context, attribute string, value int32, flags FileQueryInfoFlags) error + // SetAttributeInt64 sets attribute of type G_FILE_ATTRIBUTE_TYPE_INT64 to + // value. + SetAttributeInt64(ctx context.Context, attribute string, value int64, flags FileQueryInfoFlags) error + // SetAttributeString sets attribute of type G_FILE_ATTRIBUTE_TYPE_STRING to + // value. + SetAttributeString(ctx context.Context, attribute, value string, flags FileQueryInfoFlags) error + // SetAttributeUint32 sets attribute of type G_FILE_ATTRIBUTE_TYPE_UINT32 to + // value. + SetAttributeUint32(ctx context.Context, attribute string, value uint32, flags FileQueryInfoFlags) error + // SetAttributeUint64 sets attribute of type G_FILE_ATTRIBUTE_TYPE_UINT64 to + // value. + SetAttributeUint64(ctx context.Context, attribute string, value uint64, flags FileQueryInfoFlags) error + // SetAttributesAsync: asynchronously sets the attributes of file with info. + SetAttributesAsync(ctx context.Context, info *FileInfo, flags FileQueryInfoFlags, ioPriority int, callback AsyncReadyCallback) + // SetAttributesFinish finishes setting an attribute started in + // g_file_set_attributes_async(). + SetAttributesFinish(result AsyncResulter) (*FileInfo, error) + // SetAttributesFromInfo tries to set all attributes in the Info on the + // target values, not stopping on the first error. + SetAttributesFromInfo(ctx context.Context, info *FileInfo, flags FileQueryInfoFlags) error + // SetDisplayName renames file to the specified display name. + SetDisplayName(ctx context.Context, displayName string) (*File, error) + // SetDisplayNameAsync: asynchronously sets the display name for a given + // #GFile. + SetDisplayNameAsync(ctx context.Context, displayName string, ioPriority int, callback AsyncReadyCallback) + // SetDisplayNameFinish finishes setting a display name started with + // g_file_set_display_name_async(). + SetDisplayNameFinish(res AsyncResulter) (*File, error) + // StartMountable starts a file of type G_FILE_TYPE_MOUNTABLE. + StartMountable(ctx context.Context, flags DriveStartFlags, startOperation *MountOperation, callback AsyncReadyCallback) + // StartMountableFinish finishes a start operation. + StartMountableFinish(result AsyncResulter) error + // StopMountable stops a file of type G_FILE_TYPE_MOUNTABLE. + StopMountable(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // StopMountableFinish finishes a stop operation, see + // g_file_stop_mountable() for details. + StopMountableFinish(result AsyncResulter) error + // SupportsThreadContexts checks if file supports [thread-default + // contexts][g-main-context-push-thread-default-context]. + SupportsThreadContexts() bool + // Trash sends file to the "Trashcan", if possible. + Trash(ctx context.Context) error + // TrashAsync: asynchronously sends file to the Trash location, if possible. + TrashAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) + // TrashFinish finishes an asynchronous file trashing operation, started + // with g_file_trash_async(). + TrashFinish(result AsyncResulter) error + // UnmountMountable unmounts a file of type G_FILE_TYPE_MOUNTABLE. + UnmountMountable(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) + // UnmountMountableFinish finishes an unmount operation, see + // g_file_unmount_mountable() for details. + UnmountMountableFinish(result AsyncResulter) error + // UnmountMountableWithOperation unmounts a file of type + // G_FILE_TYPE_MOUNTABLE. + UnmountMountableWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // UnmountMountableWithOperationFinish finishes an unmount operation, + // see g_file_unmount_mountable_with_operation() for details. + UnmountMountableWithOperationFinish(result AsyncResulter) error +} + +var _ Filer = (*File)(nil) + +func wrapFile(obj *coreglib.Object) *File { + return &File{ + Object: obj, + } +} + +func marshalFile(p uintptr) (interface{}, error) { + return wrapFile(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// AppendTo gets an output stream for appending data to the file. If the file +// doesn't already exist it is created. +// +// By default files created are generally readable by everyone, but if you pass +// G_FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// current user, to the level that is supported on the target filesystem. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// Some file systems don't allow all file names, and may return an +// G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the +// G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are possible +// too, and depend on what kind of filesystem the file is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileOutputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) AppendTo(ctx context.Context, flags FileCreateFlags) (*FileOutputStream, error) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + + _cret = C.g_file_append_to(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// AppendToAsync: asynchronously opens file for appending. +// +// For more details, see g_file_append_to() which is the synchronous version of +// this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_append_to_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) AppendToAsync(ctx context.Context, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_append_to_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// AppendToFinish finishes an asynchronous file append operation started with +// g_file_append_to_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileOutputStream: valid OutputStream or NULL on error. Free the returned +// object with g_object_unref(). +func (file *File) AppendToFinish(res AsyncResulter) (*FileOutputStream, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_append_to_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// BuildAttributeListForCopy prepares the file attribute query string for +// copying to file. +// +// This function prepares an attribute query string to be passed to +// g_file_query_info() to get a list of attributes normally copied with the file +// (see g_file_copy_attributes() for the detailed description). This function is +// used by the implementation of g_file_copy_attributes() and is useful when one +// needs to query and set the attributes in two stages (e.g., for recursive move +// of a directory). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CopyFlags. +// +// The function returns the following values: +// +// - utf8: attribute query string for g_file_query_info(), or NULL if an error +// occurs. +func (file *File) BuildAttributeListForCopy(ctx context.Context, flags FileCopyFlags) (string, error) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileCopyFlags // out + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCopyFlags(flags) + + _cret = C.g_file_build_attribute_list_for_copy(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// CopyAttributes copies the file attributes from source to destination. +// +// Normally only a subset of the file attributes are copied, those that are +// copies in a normal file copy operation (which for instance does not include +// e.g. owner). However if G_FILE_COPY_ALL_METADATA is specified in flags, +// then all the metadata that is possible to copy is copied. This is useful when +// implementing move by copy + delete source. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - destination to copy attributes to. +// - flags: set of CopyFlags. +func (source *File) CopyAttributes(ctx context.Context, destination Filer, flags FileCopyFlags) error { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GFile // out + var _arg2 C.GFileCopyFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(source).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(destination).Native())) + _arg2 = C.GFileCopyFlags(flags) + + C.g_file_copy_attributes(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(source) + runtime.KeepAlive(ctx) + runtime.KeepAlive(destination) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CopyFinish finishes copying the file started with g_file_copy_async(). +// +// The function takes the following parameters: +// +// - res: Result. +func (file *File) CopyFinish(res AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C.g_file_copy_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Create creates a new file and returns an output stream for writing to it. +// The file must not already exist. +// +// By default files created are generally readable by everyone, but if you pass +// G_FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// current user, to the level that is supported on the target filesystem. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If a file or directory with this name already exists the G_IO_ERROR_EXISTS +// error will be returned. Some file systems don't allow all file names, and +// may return an G_IO_ERROR_INVALID_FILENAME error, and if the name is to long +// G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, +// and depend on what kind of filesystem the file is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileOutputStream for the newly created file, or NULL on error. Free the +// returned object with g_object_unref(). +func (file *File) Create(ctx context.Context, flags FileCreateFlags) (*FileOutputStream, error) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + + _cret = C.g_file_create(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// CreateAsync: asynchronously creates a new file and returns an output stream +// for writing to it. The file must not already exist. +// +// For more details, see g_file_create() which is the synchronous version of +// this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_create_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) CreateAsync(ctx context.Context, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_create_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// CreateFinish finishes an asynchronous file create operation started with +// g_file_create_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileOutputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) CreateFinish(res AsyncResulter) (*FileOutputStream, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_create_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// CreateReadwrite creates a new file and returns a stream for reading and +// writing to it. The file must not already exist. +// +// By default files created are generally readable by everyone, but if you pass +// G_FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// current user, to the level that is supported on the target filesystem. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If a file or directory with this name already exists, the G_IO_ERROR_EXISTS +// error will be returned. Some file systems don't allow all file names, and may +// return an G_IO_ERROR_INVALID_FILENAME error, and if the name is too long, +// G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, +// and depend on what kind of filesystem the file is on. +// +// Note that in many non-local file cases read and write streams are not +// supported, so make sure you really need to do read and write streaming, +// rather than just opening for reading or writing. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileIOStream for the newly created file, or NULL on error. Free the +// returned object with g_object_unref(). +func (file *File) CreateReadwrite(ctx context.Context, flags FileCreateFlags) (*FileIOStream, error) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + + _cret = C.g_file_create_readwrite(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// CreateReadwriteAsync: asynchronously creates a new file and returns a stream +// for reading and writing to it. The file must not already exist. +// +// For more details, see g_file_create_readwrite() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_create_readwrite_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) CreateReadwriteAsync(ctx context.Context, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_create_readwrite_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// CreateReadwriteFinish finishes an asynchronous file create operation started +// with g_file_create_readwrite_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) CreateReadwriteFinish(res AsyncResulter) (*FileIOStream, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_create_readwrite_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// Delete deletes a file. If the file is a directory, it will only be deleted if +// it is empty. This has the same semantics as g_unlink(). +// +// If file doesn’t exist, G_IO_ERROR_NOT_FOUND will be returned. This allows +// for deletion to be implemented avoiding time-of-check to time-of-use races +// (https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use): +// +// g_autoptr(GError) local_error = NULL; +// if (!g_file_delete (my_file, my_cancellable, &local_error) && +// !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) +// { +// // deletion failed for some reason other than the file not existing: +// // so report the error +// g_warning ("Failed to delete s: s", +// g_file_peek_path (my_file), local_error->message); +// } +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (file *File) Delete(ctx context.Context) error { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_file_delete(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// DeleteAsync: asynchronously delete a file. If the file is a directory, +// it will only be deleted if it is empty. This has the same semantics as +// g_unlink(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (file *File) DeleteAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_delete_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// DeleteFinish finishes deleting a file started with g_file_delete_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) DeleteFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_delete_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Dup duplicates a #GFile handle. This operation does not duplicate the actual +// file or directory represented by the #GFile; see g_file_copy() if attempting +// to copy a file. +// +// g_file_dup() is useful when a second handle is needed to the same underlying +// file, for use in a separate thread (#GFile is not thread-safe). For use +// within the same thread, use g_object_ref() to increment the existing object’s +// reference count. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - ret: new #GFile that is a duplicate of the given #GFile. +func (file *File) Dup() *File { + var _arg0 *C.GFile // out + var _cret *C.GFile // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_dup(_arg0) + runtime.KeepAlive(file) + + var _ret *File // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _ret +} + +// EjectMountable starts an asynchronous eject on a mountable. When this +// operation has completed, callback will be called with user_user data, and the +// operation can be finalized with g_file_eject_mountable_finish(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// Deprecated: Use g_file_eject_mountable_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) EjectMountable(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_eject_mountable(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// EjectMountableFinish finishes an asynchronous eject operation started by +// g_file_eject_mountable(). +// +// Deprecated: Use g_file_eject_mountable_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) EjectMountableFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_eject_mountable_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// EjectMountableWithOperation starts an asynchronous eject on a +// mountable. When this operation has completed, callback will be +// called with user_user data, and the operation can be finalized with +// g_file_eject_mountable_with_operation_finish(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation, or NULL to avoid user interaction. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) EjectMountableWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_eject_mountable_with_operation(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// EjectMountableWithOperationFinish finishes an asynchronous eject operation +// started by g_file_eject_mountable_with_operation(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) EjectMountableWithOperationFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_eject_mountable_with_operation_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// EnumerateChildren gets the requested information about the files in a +// directory. The result is a Enumerator object that will give out Info objects +// for all the files in the directory. +// +// The attributes value is a string that specifies the file attributes that +// should be gathered. It is not an error if it's not possible to read a +// particular requested attribute from a file - it just won't be set. attributes +// should be a comma-separated list of attributes or attribute wildcards. +// The wildcard "*" means all attributes, and a wildcard like "standard::*" +// means all attributes in the standard namespace. An example attribute query be +// "standard::*,owner::user". The standard attributes are available as defines, +// like G_FILE_ATTRIBUTE_STANDARD_NAME. G_FILE_ATTRIBUTE_STANDARD_NAME should +// always be specified if you plan to call g_file_enumerator_get_child() or +// g_file_enumerator_iterate() on the returned enumerator. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// If the file is not a directory, the G_IO_ERROR_NOT_DIRECTORY error will be +// returned. Other errors are possible too. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - flags: set of QueryInfoFlags. +// +// The function returns the following values: +// +// - fileEnumerator if successful, NULL on error. Free the returned object +// with g_object_unref(). +func (file *File) EnumerateChildren(ctx context.Context, attributes string, flags FileQueryInfoFlags) (*FileEnumerator, error) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileQueryInfoFlags // out + var _cret *C.GFileEnumerator // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileQueryInfoFlags(flags) + + _cret = C.g_file_enumerate_children(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(flags) + + var _fileEnumerator *FileEnumerator // out + var _goerr error // out + + _fileEnumerator = wrapFileEnumerator(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileEnumerator, _goerr +} + +// EnumerateChildrenAsync: asynchronously gets the requested information about +// the files in a directory. The result is a Enumerator object that will give +// out Info objects for all the files in the directory. +// +// For more details, see g_file_enumerate_children() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_enumerate_children_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - flags: set of QueryInfoFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) EnumerateChildrenAsync(ctx context.Context, attributes string, flags FileQueryInfoFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileQueryInfoFlags // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileQueryInfoFlags(flags) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_enumerate_children_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// EnumerateChildrenFinish finishes an async enumerate children operation. +// See g_file_enumerate_children_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileEnumerator or NULL if an error occurred. Free the returned object +// with g_object_unref(). +func (file *File) EnumerateChildrenFinish(res AsyncResulter) (*FileEnumerator, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileEnumerator // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_enumerate_children_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileEnumerator *FileEnumerator // out + var _goerr error // out + + _fileEnumerator = wrapFileEnumerator(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileEnumerator, _goerr +} + +// Equal checks if the two given #GFiles refer to the same file. +// +// Note that two #GFiles that differ can still refer to the same file on the +// filesystem due to various forms of filename aliasing. +// +// This call does no blocking I/O. +// +// The function takes the following parameters: +// +// - file2: second #GFile. +// +// The function returns the following values: +// +// - ok: TRUE if file1 and file2 are equal. +func (file1 *File) Equal(file2 Filer) bool { + var _arg0 *C.GFile // out + var _arg1 *C.GFile // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file1).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file2).Native())) + + _cret = C.g_file_equal(_arg0, _arg1) + runtime.KeepAlive(file1) + runtime.KeepAlive(file2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// FindEnclosingMount gets a #GMount for the #GFile. +// +// #GMount is returned only for user interesting locations, see Monitor. +// If the Iface for file does not have a #mount, error will be set to +// G_IO_ERROR_NOT_FOUND and NULL #will be returned. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - mount where the file is located or NULL on error. Free the returned +// object with g_object_unref(). +func (file *File) FindEnclosingMount(ctx context.Context) (*Mount, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GMount // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_file_find_enclosing_mount(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _mount *Mount // out + var _goerr error // out + + _mount = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _mount, _goerr +} + +// FindEnclosingMountAsync: asynchronously gets the mount for the file. +// +// For more details, see g_file_find_enclosing_mount() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_find_enclosing_mount_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) FindEnclosingMountAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_find_enclosing_mount_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// FindEnclosingMountFinish finishes an asynchronous find mount request. +// See g_file_find_enclosing_mount_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - mount for given file or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) FindEnclosingMountFinish(res AsyncResulter) (*Mount, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GMount // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_find_enclosing_mount_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _mount *Mount // out + var _goerr error // out + + _mount = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _mount, _goerr +} + +// Basename gets the base name (the last component of the path) for a given +// #GFile. +// +// If called for the top level of a system (such as the filesystem root or a +// uri like sftp://host/) it will return a single directory separator (and on +// Windows, possibly a drive letter). +// +// The base name is a byte string (not UTF-8). It has no defined encoding +// or rules other than it may not contain zero bytes. If you want to use +// filenames in a user interface you should use the display name that you can +// get by requesting the G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with +// g_file_query_info(). +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - filename (optional): string containing the #GFile's base name, or NULL +// if given #GFile is invalid. The returned string should be freed with +// g_free() when no longer needed. +func (file *File) Basename() string { + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_get_basename(_arg0) + runtime.KeepAlive(file) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// Child gets a child of file with basename equal to name. +// +// Note that the file with that specific name might not exist, but you can still +// have a #GFile that points to it. You can use this for instance to create that +// file. +// +// This call does no blocking I/O. +// +// The function takes the following parameters: +// +// - name: string containing the child's basename. +// +// The function returns the following values: +// +// - ret to a child specified by name. Free the returned object with +// g_object_unref(). +func (file *File) Child(name string) *File { + var _arg0 *C.GFile // out + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_get_child(_arg0, _arg1) + runtime.KeepAlive(file) + runtime.KeepAlive(name) + + var _ret *File // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _ret +} + +// ChildForDisplayName gets the child of file for a given display_name (i.e. +// a UTF-8 version of the name). If this function fails, it returns NULL and +// error will be set. This is very useful when constructing a #GFile for a new +// file and the user entered the filename in the user interface, for instance +// when you select a directory and type a filename in the file selector. +// +// This call does no blocking I/O. +// +// The function takes the following parameters: +// +// - displayName: string to a possible child. +// +// The function returns the following values: +// +// - ret to the specified child, or NULL if the display name couldn't be +// converted. Free the returned object with g_object_unref(). +func (file *File) ChildForDisplayName(displayName string) (*File, error) { + var _arg0 *C.GFile // out + var _arg1 *C.char // out + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(displayName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_get_child_for_display_name(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(displayName) + + var _ret *File // out + var _goerr error // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// Parent gets the parent directory for the file. If the file represents the +// root directory of the file system, then NULL will be returned. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - ret (optional) structure to the parent of the given #GFile or NULL if +// there is no parent. Free the returned object with g_object_unref(). +func (file *File) Parent() *File { + var _arg0 *C.GFile // out + var _cret *C.GFile // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_get_parent(_arg0) + runtime.KeepAlive(file) + + var _ret *File // out + + if _cret != nil { + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _ret +} + +// ParseName gets the parse name of the file. A parse name is a UTF-8 string +// that describes the file such that one can get the #GFile back using +// g_file_parse_name(). +// +// This is generally used to show the #GFile as a nice full-pathname kind of +// string in a user interface, like in a location entry. +// +// For local files with names that can safely be converted to UTF-8 the +// pathname is used, otherwise the IRI is used (a form of URI that allows UTF-8 +// characters unescaped). +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - utf8: string containing the #GFile's parse name. The returned string +// should be freed with g_free() when no longer needed. +func (file *File) ParseName() string { + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_get_parse_name(_arg0) + runtime.KeepAlive(file) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Path gets the local pathname for #GFile, if one exists. If non-NULL, this is +// guaranteed to be an absolute, canonical path. It might contain symlinks. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - filename (optional): string containing the #GFile's path, or NULL if no +// such path exists. The returned string should be freed with g_free() when +// no longer needed. +func (file *File) Path() string { + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_get_path(_arg0) + runtime.KeepAlive(file) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// RelativePath gets the path for descendant relative to parent. +// +// This call does no blocking I/O. +// +// The function takes the following parameters: +// +// - descendant: input #GFile. +// +// The function returns the following values: +// +// - filename (optional): string with the relative path from descendant to +// parent, or NULL if descendant doesn't have parent as prefix. The returned +// string should be freed with g_free() when no longer needed. +func (parent *File) RelativePath(descendant Filer) string { + var _arg0 *C.GFile // out + var _arg1 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(descendant).Native())) + + _cret = C.g_file_get_relative_path(_arg0, _arg1) + runtime.KeepAlive(parent) + runtime.KeepAlive(descendant) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// URI gets the URI for the file. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - utf8: string containing the #GFile's URI. If the #GFile was constructed +// with an invalid URI, an invalid URI is returned. The returned string +// should be freed with g_free() when no longer needed. +func (file *File) URI() string { + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_get_uri(_arg0) + runtime.KeepAlive(file) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// URIScheme gets the URI scheme for a #GFile. RFC 3986 decodes the scheme as: +// +// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] +// +// Common schemes include "file", "http", "ftp", etc. +// +// The scheme can be different from the one used to construct the #GFile, +// in that it might be replaced with one that is logically equivalent to the +// #GFile. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the URI scheme for the given #GFile +// or NULL if the #GFile was constructed with an invalid URI. The returned +// string should be freed with g_free() when no longer needed. +func (file *File) URIScheme() string { + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_get_uri_scheme(_arg0) + runtime.KeepAlive(file) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// HasParent checks if file has a parent, and optionally, if it is parent. +// +// If parent is NULL then this function returns TRUE if file has any parent at +// all. If parent is non-NULL then TRUE is only returned if file is an immediate +// child of parent. +// +// The function takes the following parameters: +// +// - parent (optional) to check for, or NULL. +// +// The function returns the following values: +// +// - ok: TRUE if file is an immediate child of parent (or any parent in the +// case that parent is NULL). +func (file *File) HasParent(parent Filer) bool { + var _arg0 *C.GFile // out + var _arg1 *C.GFile // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + if parent != nil { + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + + _cret = C.g_file_has_parent(_arg0, _arg1) + runtime.KeepAlive(file) + runtime.KeepAlive(parent) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HasPrefix checks whether file has the prefix specified by prefix. +// +// In other words, if the names of initial elements of file's pathname match +// prefix. Only full pathname elements are matched, so a path like /foo is not +// considered a prefix of /foobar, only of /foo/bar. +// +// A #GFile is not a prefix of itself. If you want to check for equality, +// use g_file_equal(). +// +// This call does no I/O, as it works purely on names. As such it can sometimes +// return FALSE even if file is inside a prefix (from a filesystem point of +// view), because the prefix of file is an alias of prefix. +// +// The function takes the following parameters: +// +// - prefix: input #GFile. +// +// The function returns the following values: +// +// - ok: TRUE if the file's parent, grandparent, etc is prefix, FALSE +// otherwise. +func (file *File) HasPrefix(prefix Filer) bool { + var _arg0 *C.GFile // out + var _arg1 *C.GFile // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(prefix).Native())) + + _cret = C.g_file_has_prefix(_arg0, _arg1) + runtime.KeepAlive(file) + runtime.KeepAlive(prefix) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HasURIScheme checks to see if a #GFile has a given URI scheme. +// +// This call does no blocking I/O. +// +// The function takes the following parameters: +// +// - uriScheme: string containing a URI scheme. +// +// The function returns the following values: +// +// - ok: TRUE if #GFile's backend supports the given URI scheme, FALSE if URI +// scheme is NULL, not supported, or #GFile is invalid. +func (file *File) HasURIScheme(uriScheme string) bool { + var _arg0 *C.GFile // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uriScheme))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_has_uri_scheme(_arg0, _arg1) + runtime.KeepAlive(file) + runtime.KeepAlive(uriScheme) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Hash creates a hash value for a #GFile. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - guint: 0 if file is not a valid #GFile, otherwise an integer that can be +// used as hash value for the #GFile. This function is intended for easily +// hashing a #GFile to add to a Table or similar data structure. +func (file *File) Hash() uint { + var _arg0 C.gconstpointer // out + var _cret C.guint // in + + _arg0 = *(*C.gconstpointer)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_hash(_arg0) + runtime.KeepAlive(file) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// IsNative checks to see if a file is native to the platform. +// +// A native file is one expressed in the platform-native filename format, +// e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local, +// as it might be on a locally mounted remote filesystem. +// +// On some systems non-native files may be available using the native filesystem +// via a userspace filesystem (FUSE), in these cases this call will return +// FALSE, but g_file_get_path() will still return a native path. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - ok: TRUE if file is native. +func (file *File) IsNative() bool { + var _arg0 *C.GFile // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_is_native(_arg0) + runtime.KeepAlive(file) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// LoadBytes loads the contents of file and returns it as #GBytes. +// +// If file is a resource:// based URI, the resulting bytes will reference the +// embedded resource instead of a copy. Otherwise, this is equivalent to calling +// g_file_load_contents() and g_bytes_new_take(). +// +// For resources, etag_out will be set to NULL. +// +// The data contained in the resulting #GBytes is always zero-terminated, +// but this is not included in the #GBytes length. The resulting #GBytes should +// be freed with g_bytes_unref() when no longer in use. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// +// The function returns the following values: +// +// - etagOut (optional): location to place the current entity tag for the +// file, or NULL if the entity tag is not needed. +// - bytes or NULL and error is set. +func (file *File) LoadBytes(ctx context.Context) (string, *glib.Bytes, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _arg2 *C.gchar // in + var _cret *C.GBytes // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_file_load_bytes(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _etagOut string // out + var _bytes *glib.Bytes // out + var _goerr error // out + + if _arg2 != nil { + _etagOut = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _etagOut, _bytes, _goerr +} + +// LoadBytesAsync: asynchronously loads the contents of file as #GBytes. +// +// If file is a resource:// based URI, the resulting bytes will reference the +// embedded resource instead of a copy. Otherwise, this is equivalent to calling +// g_file_load_contents_async() and g_bytes_new_take(). +// +// callback should call g_file_load_bytes_finish() to get the result of this +// asynchronous operation. +// +// See g_file_load_bytes() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) LoadBytesAsync(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_load_bytes_async(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// LoadBytesFinish completes an asynchronous request to +// g_file_load_bytes_async(). +// +// For resources, etag_out will be set to NULL. +// +// The data contained in the resulting #GBytes is always zero-terminated, +// but this is not included in the #GBytes length. The resulting #GBytes should +// be freed with g_bytes_unref() when no longer in use. +// +// See g_file_load_bytes() for more information. +// +// The function takes the following parameters: +// +// - result provided to the callback. +// +// The function returns the following values: +// +// - etagOut (optional): location to place the current entity tag for the +// file, or NULL if the entity tag is not needed. +// - bytes or NULL and error is set. +func (file *File) LoadBytesFinish(result AsyncResulter) (string, *glib.Bytes, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.gchar // in + var _cret *C.GBytes // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_file_load_bytes_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _etagOut string // out + var _bytes *glib.Bytes // out + var _goerr error // out + + if _arg2 != nil { + _etagOut = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _etagOut, _bytes, _goerr +} + +// LoadContents loads the content of the file into memory. The data is +// always zero-terminated, but this is not included in the resultant length. +// The returned contents should be freed with g_free() when no longer needed. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - contents: location to place the contents of the file. +// - etagOut (optional): location to place the current entity tag for the +// file, or NULL if the entity tag is not needed. +func (file *File) LoadContents(ctx context.Context) ([]byte, string, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _arg2 *C.char // in + var _arg3 C.gsize // in + var _arg4 *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_file_load_contents(_arg0, _arg1, &_arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _contents []byte // out + var _etagOut string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_arg2)) + _contents = make([]byte, _arg3) + copy(_contents, unsafe.Slice((*byte)(unsafe.Pointer(_arg2)), _arg3)) + if _arg4 != nil { + _etagOut = C.GoString((*C.gchar)(unsafe.Pointer(_arg4))) + defer C.free(unsafe.Pointer(_arg4)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _contents, _etagOut, _goerr +} + +// LoadContentsAsync starts an asynchronous load of the file's contents. +// +// For more details, see g_file_load_contents() which is the synchronous version +// of this call. +// +// When the load operation has completed, callback will be called with user +// data. To finish the operation, call g_file_load_contents_finish() with the +// Result returned by the callback. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - callback (optional) to call when the request is satisfied. +func (file *File) LoadContentsAsync(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_load_contents_async(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// LoadContentsFinish finishes an asynchronous load of the file's contents. +// The contents are placed in contents, and length is set to the size of the +// contents string. The contents should be freed with g_free() when no longer +// needed. If etag_out is present, it will be set to the new entity tag for the +// file. +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - contents: location to place the contents of the file. +// - etagOut (optional): location to place the current entity tag for the +// file, or NULL if the entity tag is not needed. +func (file *File) LoadContentsFinish(res AsyncResulter) ([]byte, string, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.char // in + var _arg3 C.gsize // in + var _arg4 *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C.g_file_load_contents_finish(_arg0, _arg1, &_arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _contents []byte // out + var _etagOut string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_arg2)) + _contents = make([]byte, _arg3) + copy(_contents, unsafe.Slice((*byte)(unsafe.Pointer(_arg2)), _arg3)) + if _arg4 != nil { + _etagOut = C.GoString((*C.gchar)(unsafe.Pointer(_arg4))) + defer C.free(unsafe.Pointer(_arg4)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _contents, _etagOut, _goerr +} + +// LoadPartialContentsFinish finishes an asynchronous partial load operation +// that was started with g_file_load_partial_contents_async(). The data is +// always zero-terminated, but this is not included in the resultant length. +// The returned contents should be freed with g_free() when no longer needed. +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - contents: location to place the contents of the file. +// - etagOut (optional): location to place the current entity tag for the +// file, or NULL if the entity tag is not needed. +func (file *File) LoadPartialContentsFinish(res AsyncResulter) ([]byte, string, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.char // in + var _arg3 C.gsize // in + var _arg4 *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C.g_file_load_partial_contents_finish(_arg0, _arg1, &_arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _contents []byte // out + var _etagOut string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_arg2)) + _contents = make([]byte, _arg3) + copy(_contents, unsafe.Slice((*byte)(unsafe.Pointer(_arg2)), _arg3)) + if _arg4 != nil { + _etagOut = C.GoString((*C.gchar)(unsafe.Pointer(_arg4))) + defer C.free(unsafe.Pointer(_arg4)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _contents, _etagOut, _goerr +} + +// MakeDirectory creates a directory. Note that this will only create +// a child directory of the immediate parent directory of the path +// or URI given by the #GFile. To recursively create directories, see +// g_file_make_directory_with_parents(). This function will fail if the parent +// directory does not exist, setting error to G_IO_ERROR_NOT_FOUND. If the +// file system doesn't support creating directories, this function will fail, +// setting error to G_IO_ERROR_NOT_SUPPORTED. +// +// For a local #GFile the newly created directory will have the default +// (current) ownership and permissions of the current process. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (file *File) MakeDirectory(ctx context.Context) error { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_file_make_directory(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// MakeDirectoryAsync: asynchronously creates a directory. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (file *File) MakeDirectoryAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_make_directory_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// MakeDirectoryFinish finishes an asynchronous directory creation, started with +// g_file_make_directory_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) MakeDirectoryFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_make_directory_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// MakeDirectoryWithParents creates a directory and any parent directories +// that may not exist similar to 'mkdir -p'. If the file system does not +// support creating directories, this function will fail, setting error to +// G_IO_ERROR_NOT_SUPPORTED. If the directory itself already exists, this +// function will fail setting error to G_IO_ERROR_EXISTS, unlike the similar +// g_mkdir_with_parents(). +// +// For a local #GFile the newly created directories will have the default +// (current) ownership and permissions of the current process. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (file *File) MakeDirectoryWithParents(ctx context.Context) error { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_file_make_directory_with_parents(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// MakeSymbolicLink creates a symbolic link named file which contains the string +// symlink_value. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - symlinkValue: string with the path for the target of the new symlink. +func (file *File) MakeSymbolicLink(ctx context.Context, symlinkValue string) error { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(symlinkValue))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_file_make_symbolic_link(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(symlinkValue) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// MakeSymbolicLinkAsync: asynchronously creates a symbolic link named file +// which contains the string symlink_value. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - symlinkValue: string with the path for the target of the new symlink. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (file *File) MakeSymbolicLinkAsync(ctx context.Context, symlinkValue string, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(symlinkValue))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_make_symbolic_link_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(symlinkValue) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// MakeSymbolicLinkFinish finishes an asynchronous symbolic link creation, +// started with g_file_make_symbolic_link_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) MakeSymbolicLinkFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_make_symbolic_link_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// MeasureDiskUsageFinish collects the results from an earlier call to +// g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for more +// information. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - diskUsage (optional): number of bytes of disk space used. +// - numDirs (optional): number of directories encountered. +// - numFiles (optional): number of non-directories encountered. +func (file *File) MeasureDiskUsageFinish(result AsyncResulter) (diskUsage, numDirs, numFiles uint64, goerr error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.guint64 // in + var _arg3 C.guint64 // in + var _arg4 C.guint64 // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_measure_disk_usage_finish(_arg0, _arg1, &_arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _diskUsage uint64 // out + var _numDirs uint64 // out + var _numFiles uint64 // out + var _goerr error // out + + _diskUsage = uint64(_arg2) + _numDirs = uint64(_arg3) + _numFiles = uint64(_arg4) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _diskUsage, _numDirs, _numFiles, _goerr +} + +// Monitor obtains a file or directory monitor for the given file, depending on +// the type of the file. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of MonitorFlags. +// +// The function returns the following values: +// +// - fileMonitor for the given file, or NULL on error. Free the returned +// object with g_object_unref(). +func (file *File) Monitor(ctx context.Context, flags FileMonitorFlags) (FileMonitorrer, error) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileMonitorFlags // out + var _cret *C.GFileMonitor // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileMonitorFlags(flags) + + _cret = C.g_file_monitor(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileMonitor FileMonitorrer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.FileMonitorrer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(FileMonitorrer) + return ok + }) + rv, ok := casted.(FileMonitorrer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.FileMonitorrer") + } + _fileMonitor = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileMonitor, _goerr +} + +// MonitorDirectory obtains a directory monitor for the given file. This may +// fail if directory monitoring is not supported. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// It does not make sense for flags to contain G_FILE_MONITOR_WATCH_HARD_LINKS, +// since hard links can not be made to directories. It is not possible to +// monitor all the files in a directory for changes made via hard links; +// if you want to do this then you must register individual watches with +// g_file_monitor(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of MonitorFlags. +// +// The function returns the following values: +// +// - fileMonitor for the given file, or NULL on error. Free the returned +// object with g_object_unref(). +func (file *File) MonitorDirectory(ctx context.Context, flags FileMonitorFlags) (FileMonitorrer, error) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileMonitorFlags // out + var _cret *C.GFileMonitor // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileMonitorFlags(flags) + + _cret = C.g_file_monitor_directory(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileMonitor FileMonitorrer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.FileMonitorrer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(FileMonitorrer) + return ok + }) + rv, ok := casted.(FileMonitorrer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.FileMonitorrer") + } + _fileMonitor = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileMonitor, _goerr +} + +// MonitorFile obtains a file monitor for the given file. If no file +// notification mechanism exists, then regular polling of the file is used. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If flags contains G_FILE_MONITOR_WATCH_HARD_LINKS then the monitor will +// also attempt to report changes made to the file via another filename (ie, +// a hard link). Without this flag, you can only rely on changes made through +// the filename contained in file to be reported. Using this flag may result in +// an increase in resource usage, and may not have any effect depending on the +// Monitor backend and/or filesystem type. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of MonitorFlags. +// +// The function returns the following values: +// +// - fileMonitor for the given file, or NULL on error. Free the returned +// object with g_object_unref(). +func (file *File) MonitorFile(ctx context.Context, flags FileMonitorFlags) (FileMonitorrer, error) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileMonitorFlags // out + var _cret *C.GFileMonitor // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileMonitorFlags(flags) + + _cret = C.g_file_monitor_file(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileMonitor FileMonitorrer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.FileMonitorrer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(FileMonitorrer) + return ok + }) + rv, ok := casted.(FileMonitorrer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.FileMonitorrer") + } + _fileMonitor = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileMonitor, _goerr +} + +// MountEnclosingVolume starts a mount_operation, mounting the volume that +// contains the file location. +// +// When this operation has completed, callback will be called +// with user_user data, and the operation can be finalized with +// g_file_mount_enclosing_volume_finish(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation or NULL to avoid user interaction. +// - callback (optional) to call when the request is satisfied, or NULL. +func (location *File) MountEnclosingVolume(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountMountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(location).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountMountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_mount_enclosing_volume(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(location) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// MountEnclosingVolumeFinish finishes a mount operation started by +// g_file_mount_enclosing_volume(). +// +// The function takes the following parameters: +// +// - result: Result. +func (location *File) MountEnclosingVolumeFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(location).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_mount_enclosing_volume_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(location) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// MountMountable mounts a file of type G_FILE_TYPE_MOUNTABLE. Using +// mount_operation, you can request callbacks when, for instance, passwords are +// needed during authentication. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_mount_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation, or NULL to avoid user interaction. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) MountMountable(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountMountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountMountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_mount_mountable(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// MountMountableFinish finishes a mount operation. See g_file_mount_mountable() +// for details. +// +// Finish an asynchronous mount operation that was started with +// g_file_mount_mountable(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - ret or NULL on error. Free the returned object with g_object_unref(). +func (file *File) MountMountableFinish(result AsyncResulter) (*File, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_file_mount_mountable_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _ret *File // out + var _goerr error // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// MoveFinish finishes an asynchronous file movement, started with +// g_file_move_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) MoveFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_move_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// OpenReadwrite opens an existing file for reading and writing. The result is a +// IOStream that can be used to read and write the contents of the file. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be +// returned. Other errors are possible too, and depend on what kind of +// filesystem the file is on. Note that in many non-local file cases read and +// write streams are not supported, so make sure you really need to do read and +// write streaming, rather than just opening for reading or writing. +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) OpenReadwrite(ctx context.Context) (*FileIOStream, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_file_open_readwrite(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// OpenReadwriteAsync: asynchronously opens file for reading and writing. +// +// For more details, see g_file_open_readwrite() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_open_readwrite_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) OpenReadwriteAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_open_readwrite_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// OpenReadwriteFinish finishes an asynchronous file read operation started with +// g_file_open_readwrite_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) OpenReadwriteFinish(res AsyncResulter) (*FileIOStream, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_open_readwrite_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// PeekPath: exactly like g_file_get_path(), but caches the result via +// g_object_set_qdata_full(). This is useful for example in C applications which +// mix g_file_* APIs with native ones. It also avoids an extra duplicated string +// when possible, so will be generally more efficient. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - filename (optional): string containing the #GFile's path, or NULL if no +// such path exists. The returned string is owned by file. +func (file *File) PeekPath() string { + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_peek_path(_arg0) + runtime.KeepAlive(file) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// PollMountable polls a file of type G_FILE_TYPE_MOUNTABLE. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_mount_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - callback (optional) to call when the request is satisfied, or NULL. +func (file *File) PollMountable(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_poll_mountable(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// PollMountableFinish finishes a poll operation. See g_file_poll_mountable() +// for details. +// +// Finish an asynchronous poll operation that was polled with +// g_file_poll_mountable(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) PollMountableFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_poll_mountable_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// QueryDefaultHandler returns the Info that is registered as the default +// application to handle the file specified by file. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - appInfo if the handle was found, NULL if there were errors. When you are +// done with it, release it with g_object_unref(). +func (file *File) QueryDefaultHandler(ctx context.Context) (*AppInfo, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GAppInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_file_query_default_handler(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _appInfo *AppInfo // out + var _goerr error // out + + _appInfo = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _appInfo, _goerr +} + +// QueryDefaultHandlerAsync: async version of g_file_query_default_handler(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is done. +func (file *File) QueryDefaultHandlerAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_query_default_handler_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// QueryDefaultHandlerFinish finishes a g_file_query_default_handler_async() +// operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - appInfo if the handle was found, NULL if there were errors. When you are +// done with it, release it with g_object_unref(). +func (file *File) QueryDefaultHandlerFinish(result AsyncResulter) (*AppInfo, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GAppInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_file_query_default_handler_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _appInfo *AppInfo // out + var _goerr error // out + + _appInfo = wrapAppInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _appInfo, _goerr +} + +// QueryExists: utility function to check if a particular file exists. This is +// implemented using g_file_query_info() and as such does blocking I/O. +// +// Note that in many cases it is racy to first check for file existence +// (https://en.wikipedia.org/wiki/Time_of_check_to_time_of_use) and then +// execute something based on the outcome of that, because the file might have +// been created or removed in between the operations. The general approach +// to handling that is to not check, but just do the operation and handle the +// errors as they come. +// +// As an example of race-free checking, take the case of reading a file, +// and if it doesn't exist, creating it. There are two racy versions: read it, +// and on error create it; and: check if it exists, if not create it. These can +// both result in two processes creating the file (with perhaps a partially +// written file as the result). The correct approach is to always try to create +// the file with g_file_create() which will either atomically create the file or +// fail with a G_IO_ERROR_EXISTS error. +// +// However, in many cases an existence check is useful in a user interface, for +// instance to make a menu item sensitive/insensitive, so that you don't have +// to fool users that something is possible and then just show an error dialog. +// If you do this, you should make sure to also handle the errors that can +// happen due to races when you execute the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - ok: TRUE if the file exists (and can be detected without error), FALSE +// otherwise (or if cancelled). +func (file *File) QueryExists(ctx context.Context) bool { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_file_query_exists(_arg0, _arg1) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// QueryFileType: utility function to inspect the Type of a file. This is +// implemented using g_file_query_info() and as such does blocking I/O. +// +// The primary use case of this method is to check if a file is a regular file, +// directory, or symlink. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of QueryInfoFlags passed to g_file_query_info(). +// +// The function returns the following values: +// +// - fileType of the file and G_FILE_TYPE_UNKNOWN if the file does not exist. +func (file *File) QueryFileType(ctx context.Context, flags FileQueryInfoFlags) FileType { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileQueryInfoFlags // out + var _cret C.GFileType // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileQueryInfoFlags(flags) + + _cret = C.g_file_query_file_type(_arg0, _arg1, _arg2) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileType FileType // out + + _fileType = FileType(_cret) + + return _fileType +} + +// QueryFilesystemInfo: similar to g_file_query_info(), but obtains information +// about the filesystem the file is on, rather than the file itself. For +// instance the amount of space available and the type of the filesystem. +// +// The attributes value is a string that specifies the attributes that should +// be gathered. It is not an error if it's not possible to read a particular +// requested attribute from a file - it just won't be set. attributes +// should be a comma-separated list of attributes or attribute wildcards. +// The wildcard "*" means all attributes, and a wildcard like "filesystem::*" +// means all attributes in the filesystem namespace. The standard namespace +// for filesystem attributes is "filesystem". Common attributes of interest +// are G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem +// in bytes), G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available), +// and G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// Other errors are possible too, and depend on what kind of filesystem the file +// is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// +// The function returns the following values: +// +// - fileInfo or NULL if there was an error. Free the returned object with +// g_object_unref(). +func (file *File) QueryFilesystemInfo(ctx context.Context, attributes string) (*FileInfo, error) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_query_filesystem_info(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// QueryFilesystemInfoAsync: asynchronously gets the requested information about +// the filesystem that the specified file is on. The result is a Info object +// that contains key-value attributes (such as type or size for the file). +// +// For more details, see g_file_query_filesystem_info() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_query_info_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) QueryFilesystemInfoAsync(ctx context.Context, attributes string, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_query_filesystem_info_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// QueryFilesystemInfoFinish finishes an asynchronous filesystem info query. +// See g_file_query_filesystem_info_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileInfo for given file or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) QueryFilesystemInfoFinish(res AsyncResulter) (*FileInfo, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_query_filesystem_info_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// QueryInfo gets the requested information about specified file. The result is +// a Info object that contains key-value attributes (such as the type or size of +// the file). +// +// The attributes value is a string that specifies the file attributes that +// should be gathered. It is not an error if it's not possible to read a +// particular requested attribute from a file - it just won't be set. attributes +// should be a comma-separated list of attributes or attribute wildcards. +// The wildcard "*" means all attributes, and a wildcard like "standard::*" +// means all attributes in the standard namespace. An example attribute query be +// "standard::*,owner::user". The standard attributes are available as defines, +// like G_FILE_ATTRIBUTE_STANDARD_NAME. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// For symlinks, normally the information about the target of the symlink is +// returned, rather than information about the symlink itself. However if you +// pass G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in flags the information about +// the symlink itself will be returned. Also, for symlinks that point to +// non-existing files the information about the symlink itself will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// Other errors are possible too, and depend on what kind of filesystem the file +// is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - flags: set of QueryInfoFlags. +// +// The function returns the following values: +// +// - fileInfo for the given file, or NULL on error. Free the returned object +// with g_object_unref(). +func (file *File) QueryInfo(ctx context.Context, attributes string, flags FileQueryInfoFlags) (*FileInfo, error) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileQueryInfoFlags // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileQueryInfoFlags(flags) + + _cret = C.g_file_query_info(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(flags) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// QueryInfoAsync: asynchronously gets the requested information about specified +// file. The result is a Info object that contains key-value attributes (such as +// type or size for the file). +// +// For more details, see g_file_query_info() which is the synchronous version of +// this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_query_info_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - flags: set of QueryInfoFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) QueryInfoAsync(ctx context.Context, attributes string, flags FileQueryInfoFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileQueryInfoFlags // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileQueryInfoFlags(flags) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_query_info_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// QueryInfoFinish finishes an asynchronous file info query. See +// g_file_query_info_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileInfo for given file or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) QueryInfoFinish(res AsyncResulter) (*FileInfo, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_query_info_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// QuerySettableAttributes: obtain the list of settable attributes for the file. +// +// Returns the type and full attribute name of all the attributes that can be +// set on this file. This doesn't mean setting it will always succeed though, +// you might get an access failure, or some specific file may not support a +// specific attribute. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - fileAttributeInfoList describing the settable attributes. When you are +// done with it, release it with g_file_attribute_info_list_unref(). +func (file *File) QuerySettableAttributes(ctx context.Context) (*FileAttributeInfoList, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileAttributeInfoList // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_file_query_settable_attributes(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _fileAttributeInfoList *FileAttributeInfoList // out + var _goerr error // out + + _fileAttributeInfoList = (*FileAttributeInfoList)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileAttributeInfoList)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_file_attribute_info_list_unref((*C.GFileAttributeInfoList)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileAttributeInfoList, _goerr +} + +// QueryWritableNamespaces: obtain the list of attribute namespaces where +// new attributes can be created by a user. An example of this is extended +// attributes (in the "xattr" namespace). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - fileAttributeInfoList describing the writable namespaces. When you are +// done with it, release it with g_file_attribute_info_list_unref(). +func (file *File) QueryWritableNamespaces(ctx context.Context) (*FileAttributeInfoList, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileAttributeInfoList // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_file_query_writable_namespaces(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _fileAttributeInfoList *FileAttributeInfoList // out + var _goerr error // out + + _fileAttributeInfoList = (*FileAttributeInfoList)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileAttributeInfoList)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_file_attribute_info_list_unref((*C.GFileAttributeInfoList)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileAttributeInfoList, _goerr +} + +// Read opens a file for reading. The result is a InputStream that can be used +// to read the contents of the file. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be +// returned. Other errors are possible too, and depend on what kind of +// filesystem the file is on. +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// +// The function returns the following values: +// +// - fileInputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) Read(ctx context.Context) (*FileInputStream, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_file_read(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _fileInputStream *FileInputStream // out + var _goerr error // out + + _fileInputStream = wrapFileInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInputStream, _goerr +} + +// ReadAsync: asynchronously opens file for reading. +// +// For more details, see g_file_read() which is the synchronous version of this +// call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_read_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) ReadAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_read_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadFinish finishes an asynchronous file read operation started with +// g_file_read_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileInputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) ReadFinish(res AsyncResulter) (*FileInputStream, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_read_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileInputStream *FileInputStream // out + var _goerr error // out + + _fileInputStream = wrapFileInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInputStream, _goerr +} + +// Replace returns an output stream for overwriting the file, possibly creating +// a backup copy of the file first. If the file doesn't exist, it will be +// created. +// +// This will try to replace the file in the safest way possible so that any +// errors during the writing will not affect an already existing copy of the +// file. For instance, for local files it may write to a temporary file and then +// atomically rename over the destination when the stream is closed. +// +// By default files created are generally readable by everyone, but if you pass +// G_FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// current user, to the level that is supported on the target filesystem. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If you pass in a non-NULL etag value and file already exists, then this +// value is compared to the current entity tag of the file, and if they +// differ an G_IO_ERROR_WRONG_ETAG error is returned. This generally means +// that the file has been changed since you last read it. You can get the +// new etag from g_file_output_stream_get_etag() after you've finished +// writing and closed the OutputStream. When you load a new file you can use +// g_file_input_stream_query_info() to get the etag of the file. +// +// If make_backup is TRUE, this function will attempt to make a +// backup of the current file before overwriting it. If this fails a +// G_IO_ERROR_CANT_CREATE_BACKUP error will be returned. If you want to replace +// anyway, try again with make_backup set to FALSE. +// +// If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be +// returned, and if the file is some other form of non-regular file then a +// G_IO_ERROR_NOT_REGULAR_FILE error will be returned. Some file systems don't +// allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME error, +// and if the name is to long G_IO_ERROR_FILENAME_TOO_LONG will be returned. +// Other errors are possible too, and depend on what kind of filesystem the file +// is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - etag (optional): optional entity tag (#entity-tags) for the current +// #GFile, or LL to ignore. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileOutputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) Replace(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags) (*FileOutputStream, error) { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _arg3 C.GFileCreateFlags // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if etag != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg1)) + } + if makeBackup { + _arg2 = C.TRUE + } + _arg3 = C.GFileCreateFlags(flags) + + _cret = C.g_file_replace(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// ReplaceAsync: asynchronously overwrites the file, replacing the contents, +// possibly creating a backup copy of the file first. +// +// For more details, see g_file_replace() which is the synchronous version of +// this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_replace_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - etag (optional): entity tag (#entity-tags) for the current #GFile, +// or NULL to ignore. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) ReplaceAsync(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg5 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _arg3 C.GFileCreateFlags // out + var _arg4 C.int // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if etag != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg1)) + } + if makeBackup { + _arg2 = C.TRUE + } + _arg3 = C.GFileCreateFlags(flags) + _arg4 = C.int(ioPriority) + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_replace_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReplaceContents replaces the contents of file with contents of length bytes. +// +// If etag is specified (not NULL), any existing file must have that etag, +// or the error G_IO_ERROR_WRONG_ETAG will be returned. +// +// If make_backup is TRUE, this function will attempt to make a backup of file. +// Internally, it uses g_file_replace(), so will try to replace the file +// contents in the safest way possible. For example, atomic renames are used +// when replacing local files’ contents. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The returned new_etag can be used to verify that the file hasn't changed the +// next time it is saved over. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - contents: string containing the new contents for file. +// - etag (optional): old entity-tag (#entity-tags) for the document, or NULL. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - newEtag (optional): location to a new entity tag (#entity-tags) for the +// document. This should be freed with g_free() when no longer needed, +// or NULL. +func (file *File) ReplaceContents(ctx context.Context, contents, etag string, makeBackup bool, flags FileCreateFlags) (string, error) { + var _arg0 *C.GFile // out + var _arg7 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gsize + var _arg3 *C.char // out + var _arg4 C.gboolean // out + var _arg5 C.GFileCreateFlags // out + var _arg6 *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg7 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(contents)) + _arg1 = (*C.char)(C.calloc(C.size_t((len(contents) + 1)), C.size_t(C.sizeof_char))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(contents)), contents) + defer C.free(unsafe.Pointer(_arg1)) + if etag != "" { + _arg3 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg3)) + } + if makeBackup { + _arg4 = C.TRUE + } + _arg5 = C.GFileCreateFlags(flags) + + C.g_file_replace_contents(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_arg6, _arg7, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(contents) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + + var _newEtag string // out + var _goerr error // out + + if _arg6 != nil { + _newEtag = C.GoString((*C.gchar)(unsafe.Pointer(_arg6))) + defer C.free(unsafe.Pointer(_arg6)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _newEtag, _goerr +} + +// ReplaceContentsAsync starts an asynchronous replacement of file with the +// given contents of length bytes. etag will replace the document's current +// entity tag. +// +// When this operation has completed, callback will be called +// with user_user data, and the operation can be finalized with +// g_file_replace_contents_finish(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If make_backup is TRUE, this function will attempt to make a backup of file. +// +// Note that no copy of contents will be made, so it must stay valid until +// callback is called. See g_file_replace_contents_bytes_async() for a #GBytes +// version that will automatically hold a reference to the contents (without +// copying) for the duration of the call. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - contents: string of contents to replace the file with. +// - etag (optional): new entity tag (#entity-tags) for the file, or NULL. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// - callback (optional) to call when the request is satisfied. +func (file *File) ReplaceContentsAsync(ctx context.Context, contents, etag string, makeBackup bool, flags FileCreateFlags, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg6 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gsize + var _arg3 *C.char // out + var _arg4 C.gboolean // out + var _arg5 C.GFileCreateFlags // out + var _arg7 C.GAsyncReadyCallback // out + var _arg8 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg6 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(contents)) + _arg1 = (*C.char)(C.calloc(C.size_t((len(contents) + 1)), C.size_t(C.sizeof_char))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(contents)), contents) + defer C.free(unsafe.Pointer(_arg1)) + if etag != "" { + _arg3 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg3)) + } + if makeBackup { + _arg4 = C.TRUE + } + _arg5 = C.GFileCreateFlags(flags) + if callback != nil { + _arg7 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg8 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_replace_contents_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(contents) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// ReplaceContentsBytesAsync: same as g_file_replace_contents_async() but takes +// a #GBytes input instead. This function will keep a ref on contents until +// the operation is done. Unlike g_file_replace_contents_async() this allows +// forgetting about the content without waiting for the callback. +// +// When this operation has completed, callback will be called +// with user_user data, and the operation can be finalized with +// g_file_replace_contents_finish(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - contents: #GBytes. +// - etag (optional): new entity tag (#entity-tags) for the file, or NULL. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// - callback (optional) to call when the request is satisfied. +func (file *File) ReplaceContentsBytesAsync(ctx context.Context, contents *glib.Bytes, etag string, makeBackup bool, flags FileCreateFlags, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg5 *C.GCancellable // out + var _arg1 *C.GBytes // out + var _arg2 *C.char // out + var _arg3 C.gboolean // out + var _arg4 C.GFileCreateFlags // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(contents))) + if etag != "" { + _arg2 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg2)) + } + if makeBackup { + _arg3 = C.TRUE + } + _arg4 = C.GFileCreateFlags(flags) + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_replace_contents_bytes_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(contents) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// ReplaceContentsFinish finishes an asynchronous replace of the given file. +// See g_file_replace_contents_async(). Sets new_etag to the new entity tag for +// the document, if present. +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - newEtag (optional): location of a new entity tag (#entity-tags) for the +// document. This should be freed with g_free() when it is no longer needed, +// or NULL. +func (file *File) ReplaceContentsFinish(res AsyncResulter) (string, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C.g_file_replace_contents_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _newEtag string // out + var _goerr error // out + + if _arg2 != nil { + _newEtag = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _newEtag, _goerr +} + +// ReplaceFinish finishes an asynchronous file replace operation started with +// g_file_replace_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileOutputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) ReplaceFinish(res AsyncResulter) (*FileOutputStream, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_replace_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// ReplaceReadwrite returns an output stream for overwriting the file in +// readwrite mode, possibly creating a backup copy of the file first. If the +// file doesn't exist, it will be created. +// +// For details about the behaviour, see g_file_replace() which does the same +// thing but returns an output stream only. +// +// Note that in many non-local file cases read and write streams are not +// supported, so make sure you really need to do read and write streaming, +// rather than just opening for reading or writing. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - etag (optional): optional entity tag (#entity-tags) for the current +// #GFile, or LL to ignore. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) ReplaceReadwrite(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags) (*FileIOStream, error) { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _arg3 C.GFileCreateFlags // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if etag != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg1)) + } + if makeBackup { + _arg2 = C.TRUE + } + _arg3 = C.GFileCreateFlags(flags) + + _cret = C.g_file_replace_readwrite(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// ReplaceReadwriteAsync: asynchronously overwrites the file in read-write mode, +// replacing the contents, possibly creating a backup copy of the file first. +// +// For more details, see g_file_replace_readwrite() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_replace_readwrite_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - etag (optional): entity tag (#entity-tags) for the current #GFile, +// or NULL to ignore. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) ReplaceReadwriteAsync(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg5 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _arg3 C.GFileCreateFlags // out + var _arg4 C.int // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if etag != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg1)) + } + if makeBackup { + _arg2 = C.TRUE + } + _arg3 = C.GFileCreateFlags(flags) + _arg4 = C.int(ioPriority) + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_replace_readwrite_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReplaceReadwriteFinish finishes an asynchronous file replace operation +// started with g_file_replace_readwrite_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) ReplaceReadwriteFinish(res AsyncResulter) (*FileIOStream, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_replace_readwrite_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// ResolveRelativePath resolves a relative path for file to an absolute path. +// +// This call does no blocking I/O. +// +// If the relative_path is an absolute path name, the resolution is done +// absolutely (without taking file path as base). +// +// The function takes the following parameters: +// +// - relativePath: given relative path string. +// +// The function returns the following values: +// +// - ret for the resolved path. +func (file *File) ResolveRelativePath(relativePath string) *File { + var _arg0 *C.GFile // out + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(relativePath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_resolve_relative_path(_arg0, _arg1) + runtime.KeepAlive(file) + runtime.KeepAlive(relativePath) + + var _ret *File // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _ret +} + +// SetAttribute sets an attribute in the file with attribute name attribute to +// value_p. +// +// Some attributes can be unset by setting type to G_FILE_ATTRIBUTE_TYPE_INVALID +// and value_p to NULL. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attribute: string containing the attribute's name. +// - typ: type of the attribute. +// - valueP (optional): pointer to the value (or the pointer itself if the +// type is a pointer type). +// - flags: set of QueryInfoFlags. +func (file *File) SetAttribute(ctx context.Context, attribute string, typ FileAttributeType, valueP unsafe.Pointer, flags FileQueryInfoFlags) error { + var _arg0 *C.GFile // out + var _arg5 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileAttributeType // out + var _arg3 C.gpointer // out + var _arg4 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileAttributeType(typ) + _arg3 = (C.gpointer)(unsafe.Pointer(valueP)) + _arg4 = C.GFileQueryInfoFlags(flags) + + C.g_file_set_attribute(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attribute) + runtime.KeepAlive(typ) + runtime.KeepAlive(valueP) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAttributeByteString sets attribute of type +// G_FILE_ATTRIBUTE_TYPE_BYTE_STRING to value. If attribute is of a different +// type, this operation will fail, returning FALSE. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attribute: string containing the attribute's name. +// - value: string containing the attribute's new value. +// - flags: QueryInfoFlags. +func (file *File) SetAttributeByteString(ctx context.Context, attribute, value string, flags FileQueryInfoFlags) error { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.GFileQueryInfoFlags(flags) + + C.g_file_set_attribute_byte_string(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attribute) + runtime.KeepAlive(value) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAttributeInt32 sets attribute of type G_FILE_ATTRIBUTE_TYPE_INT32 to +// value. If attribute is of a different type, this operation will fail. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attribute: string containing the attribute's name. +// - value containing the attribute's new value. +// - flags: QueryInfoFlags. +func (file *File) SetAttributeInt32(ctx context.Context, attribute string, value int32, flags FileQueryInfoFlags) error { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gint32 // out + var _arg3 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint32(value) + _arg3 = C.GFileQueryInfoFlags(flags) + + C.g_file_set_attribute_int32(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attribute) + runtime.KeepAlive(value) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAttributeInt64 sets attribute of type G_FILE_ATTRIBUTE_TYPE_INT64 to +// value. If attribute is of a different type, this operation will fail. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attribute: string containing the attribute's name. +// - value containing the attribute's new value. +// - flags: QueryInfoFlags. +func (file *File) SetAttributeInt64(ctx context.Context, attribute string, value int64, flags FileQueryInfoFlags) error { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gint64 // out + var _arg3 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint64(value) + _arg3 = C.GFileQueryInfoFlags(flags) + + C.g_file_set_attribute_int64(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attribute) + runtime.KeepAlive(value) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAttributeString sets attribute of type G_FILE_ATTRIBUTE_TYPE_STRING to +// value. If attribute is of a different type, this operation will fail. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attribute: string containing the attribute's name. +// - value: string containing the attribute's value. +// - flags: QueryInfoFlags. +func (file *File) SetAttributeString(ctx context.Context, attribute, value string, flags FileQueryInfoFlags) error { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.GFileQueryInfoFlags(flags) + + C.g_file_set_attribute_string(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attribute) + runtime.KeepAlive(value) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAttributeUint32 sets attribute of type G_FILE_ATTRIBUTE_TYPE_UINT32 to +// value. If attribute is of a different type, this operation will fail. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attribute: string containing the attribute's name. +// - value containing the attribute's new value. +// - flags: QueryInfoFlags. +func (file *File) SetAttributeUint32(ctx context.Context, attribute string, value uint32, flags FileQueryInfoFlags) error { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.guint32 // out + var _arg3 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint32(value) + _arg3 = C.GFileQueryInfoFlags(flags) + + C.g_file_set_attribute_uint32(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attribute) + runtime.KeepAlive(value) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAttributeUint64 sets attribute of type G_FILE_ATTRIBUTE_TYPE_UINT64 to +// value. If attribute is of a different type, this operation will fail. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attribute: string containing the attribute's name. +// - value containing the attribute's new value. +// - flags: QueryInfoFlags. +func (file *File) SetAttributeUint64(ctx context.Context, attribute string, value uint64, flags FileQueryInfoFlags) error { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.guint64 // out + var _arg3 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint64(value) + _arg3 = C.GFileQueryInfoFlags(flags) + + C.g_file_set_attribute_uint64(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attribute) + runtime.KeepAlive(value) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAttributesAsync: asynchronously sets the attributes of file with info. +// +// For more details, see g_file_set_attributes_from_info(), which is the +// synchronous version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_set_attributes_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - info: Info. +// - flags: QueryInfoFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) SetAttributesAsync(ctx context.Context, info *FileInfo, flags FileQueryInfoFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GFileInfo // out + var _arg2 C.GFileQueryInfoFlags // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg2 = C.GFileQueryInfoFlags(flags) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_set_attributes_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(info) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// SetAttributesFinish finishes setting an attribute started in +// g_file_set_attributes_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - info: Info. +func (file *File) SetAttributesFinish(result AsyncResulter) (*FileInfo, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_set_attributes_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _info *FileInfo // out + var _goerr error // out + + _info = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_arg2))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _info, _goerr +} + +// SetAttributesFromInfo tries to set all attributes in the Info on the target +// values, not stopping on the first error. +// +// If there is any error during this operation then error will be set to the +// first error. Error on particular fields are flagged by setting the "status" +// field in the attribute value to G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING, +// which means you can also detect further errors. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - info: Info. +// - flags: QueryInfoFlags. +func (file *File) SetAttributesFromInfo(ctx context.Context, info *FileInfo, flags FileQueryInfoFlags) error { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GFileInfo // out + var _arg2 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg2 = C.GFileQueryInfoFlags(flags) + + C.g_file_set_attributes_from_info(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(info) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetDisplayName renames file to the specified display name. +// +// The display name is converted from UTF-8 to the correct encoding for the +// target filesystem if possible and the file is renamed to this. +// +// If you want to implement a rename operation in the user interface the edit +// name (G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial +// value in the rename widget, and then the result after editing should be +// passed to g_file_set_display_name(). +// +// On success the resulting converted filename is returned. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - displayName: string. +// +// The function returns the following values: +// +// - ret specifying what file was renamed to, or NULL if there was an error. +// Free the returned object with g_object_unref(). +func (file *File) SetDisplayName(ctx context.Context, displayName string) (*File, error) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(displayName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_set_display_name(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(displayName) + + var _ret *File // out + var _goerr error // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// SetDisplayNameAsync: asynchronously sets the display name for a given #GFile. +// +// For more details, see g_file_set_display_name() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_set_display_name_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - displayName: string. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) SetDisplayNameAsync(ctx context.Context, displayName string, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(displayName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_set_display_name_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(displayName) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// SetDisplayNameFinish finishes setting a display name started with +// g_file_set_display_name_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - ret or NULL on error. Free the returned object with g_object_unref(). +func (file *File) SetDisplayNameFinish(res AsyncResulter) (*File, error) { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_file_set_display_name_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _ret *File // out + var _goerr error // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// StartMountable starts a file of type G_FILE_TYPE_MOUNTABLE. Using +// start_operation, you can request callbacks when, for instance, passwords are +// needed during authentication. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_mount_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - startOperation (optional) or NULL to avoid user interaction. +// - callback (optional) to call when the request is satisfied, or NULL. +func (file *File) StartMountable(ctx context.Context, flags DriveStartFlags, startOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GDriveStartFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GDriveStartFlags(flags) + if startOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(startOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_start_mountable(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(startOperation) + runtime.KeepAlive(callback) +} + +// StartMountableFinish finishes a start operation. See g_file_start_mountable() +// for details. +// +// Finish an asynchronous start operation that was started with +// g_file_start_mountable(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) StartMountableFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_start_mountable_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// StopMountable stops a file of type G_FILE_TYPE_MOUNTABLE. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_stop_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation, or NULL to avoid user interaction. +// - callback (optional) to call when the request is satisfied, or NULL. +func (file *File) StopMountable(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_stop_mountable(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// StopMountableFinish finishes a stop operation, see g_file_stop_mountable() +// for details. +// +// Finish an asynchronous stop operation that was started with +// g_file_stop_mountable(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) StopMountableFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_stop_mountable_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SupportsThreadContexts checks if file supports [thread-default +// contexts][g-main-context-push-thread-default-context]. If this returns FALSE, +// you cannot perform asynchronous operations on file in a thread that has a +// thread-default context. +// +// The function returns the following values: +// +// - ok: whether or not file supports thread-default contexts. +func (file *File) SupportsThreadContexts() bool { + var _arg0 *C.GFile // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_supports_thread_contexts(_arg0) + runtime.KeepAlive(file) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Trash sends file to the "Trashcan", if possible. This is similar to +// deleting it, but the user can recover it before emptying the trashcan. +// Not all file systems support trashing, so this call can return the +// G_IO_ERROR_NOT_SUPPORTED error. Since GLib 2.66, the x-gvfs-notrash unix +// mount option can be used to disable g_file_trash() support for certain +// mounts, the G_IO_ERROR_NOT_SUPPORTED error will be returned in that case. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (file *File) Trash(ctx context.Context) error { + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_file_trash(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// TrashAsync: asynchronously sends file to the Trash location, if possible. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (file *File) TrashAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_trash_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// TrashFinish finishes an asynchronous file trashing operation, started with +// g_file_trash_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) TrashFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_trash_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// UnmountMountable unmounts a file of type G_FILE_TYPE_MOUNTABLE. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_unmount_mountable_finish() to get the result of the operation. +// +// Deprecated: Use g_file_unmount_mountable_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) UnmountMountable(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_unmount_mountable(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// UnmountMountableFinish finishes an unmount operation, see +// g_file_unmount_mountable() for details. +// +// Finish an asynchronous unmount operation that was started with +// g_file_unmount_mountable(). +// +// Deprecated: Use g_file_unmount_mountable_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) UnmountMountableFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_unmount_mountable_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// UnmountMountableWithOperation unmounts a file of type G_FILE_TYPE_MOUNTABLE. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_unmount_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation, or NULL to avoid user interaction. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) UnmountMountableWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_unmount_mountable_with_operation(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// UnmountMountableWithOperationFinish finishes an unmount operation, see +// g_file_unmount_mountable_with_operation() for details. +// +// Finish an asynchronous unmount operation that was started with +// g_file_unmount_mountable_with_operation(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) UnmountMountableWithOperationFinish(result AsyncResulter) error { + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_unmount_mountable_with_operation_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// appendTo gets an output stream for appending data to the file. If the file +// doesn't already exist it is created. +// +// By default files created are generally readable by everyone, but if you pass +// G_FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// current user, to the level that is supported on the target filesystem. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// Some file systems don't allow all file names, and may return an +// G_IO_ERROR_INVALID_FILENAME error. If the file is a directory the +// G_IO_ERROR_IS_DIRECTORY error will be returned. Other errors are possible +// too, and depend on what kind of filesystem the file is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileOutputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) appendTo(ctx context.Context, flags FileCreateFlags) (*FileOutputStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.append_to + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + + _cret = C._gotk4_gio2_File_virtual_append_to(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// appendToAsync: asynchronously opens file for appending. +// +// For more details, see g_file_append_to() which is the synchronous version of +// this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_append_to_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) appendToAsync(ctx context.Context, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.append_to_async + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_append_to_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// appendToFinish finishes an asynchronous file append operation started with +// g_file_append_to_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileOutputStream: valid OutputStream or NULL on error. Free the returned +// object with g_object_unref(). +func (file *File) appendToFinish(res AsyncResulter) (*FileOutputStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.append_to_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_append_to_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// copyFinish finishes copying the file started with g_file_copy_async(). +// +// The function takes the following parameters: +// +// - res: Result. +func (file *File) copyFinish(res AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.copy_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C._gotk4_gio2_File_virtual_copy_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Create creates a new file and returns an output stream for writing to it. +// The file must not already exist. +// +// By default files created are generally readable by everyone, but if you pass +// G_FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// current user, to the level that is supported on the target filesystem. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If a file or directory with this name already exists the G_IO_ERROR_EXISTS +// error will be returned. Some file systems don't allow all file names, and +// may return an G_IO_ERROR_INVALID_FILENAME error, and if the name is to long +// G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, +// and depend on what kind of filesystem the file is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileOutputStream for the newly created file, or NULL on error. Free the +// returned object with g_object_unref(). +func (file *File) create(ctx context.Context, flags FileCreateFlags) (*FileOutputStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.create + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + + _cret = C._gotk4_gio2_File_virtual_create(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// createAsync: asynchronously creates a new file and returns an output stream +// for writing to it. The file must not already exist. +// +// For more details, see g_file_create() which is the synchronous version of +// this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_create_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) createAsync(ctx context.Context, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.create_async + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_create_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// createFinish finishes an asynchronous file create operation started with +// g_file_create_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileOutputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) createFinish(res AsyncResulter) (*FileOutputStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.create_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_create_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// createReadwrite creates a new file and returns a stream for reading and +// writing to it. The file must not already exist. +// +// By default files created are generally readable by everyone, but if you pass +// G_FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// current user, to the level that is supported on the target filesystem. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If a file or directory with this name already exists, the G_IO_ERROR_EXISTS +// error will be returned. Some file systems don't allow all file names, and may +// return an G_IO_ERROR_INVALID_FILENAME error, and if the name is too long, +// G_IO_ERROR_FILENAME_TOO_LONG will be returned. Other errors are possible too, +// and depend on what kind of filesystem the file is on. +// +// Note that in many non-local file cases read and write streams are not +// supported, so make sure you really need to do read and write streaming, +// rather than just opening for reading or writing. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileIOStream for the newly created file, or NULL on error. Free the +// returned object with g_object_unref(). +func (file *File) createReadwrite(ctx context.Context, flags FileCreateFlags) (*FileIOStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.create_readwrite + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + + _cret = C._gotk4_gio2_File_virtual_create_readwrite(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// createReadwriteAsync: asynchronously creates a new file and returns a stream +// for reading and writing to it. The file must not already exist. +// +// For more details, see g_file_create_readwrite() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_create_readwrite_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) createReadwriteAsync(ctx context.Context, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.create_readwrite_async + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GFileCreateFlags // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileCreateFlags(flags) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_create_readwrite_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// createReadwriteFinish finishes an asynchronous file create operation started +// with g_file_create_readwrite_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) createReadwriteFinish(res AsyncResulter) (*FileIOStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.create_readwrite_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_create_readwrite_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// deleteFile deletes a file. If the file is a directory, it will only be +// deleted if it is empty. This has the same semantics as g_unlink(). +// +// If file doesn’t exist, G_IO_ERROR_NOT_FOUND will be returned. This allows +// for deletion to be implemented avoiding time-of-check to time-of-use races +// (https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use): +// +// g_autoptr(GError) local_error = NULL; +// if (!g_file_delete (my_file, my_cancellable, &local_error) && +// !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND)) +// { +// // deletion failed for some reason other than the file not existing: +// // so report the error +// g_warning ("Failed to delete s: s", +// g_file_peek_path (my_file), local_error->message); +// } +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (file *File) deleteFile(ctx context.Context) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.delete_file + + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_File_virtual_delete_file(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// deleteFileAsync: asynchronously delete a file. If the file is a directory, +// it will only be deleted if it is empty. This has the same semantics as +// g_unlink(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (file *File) deleteFileAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.delete_file_async + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_delete_file_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// deleteFileFinish finishes deleting a file started with g_file_delete_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) deleteFileFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.delete_file_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_delete_file_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Dup duplicates a #GFile handle. This operation does not duplicate the actual +// file or directory represented by the #GFile; see g_file_copy() if attempting +// to copy a file. +// +// g_file_dup() is useful when a second handle is needed to the same underlying +// file, for use in a separate thread (#GFile is not thread-safe). For use +// within the same thread, use g_object_ref() to increment the existing object’s +// reference count. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - ret: new #GFile that is a duplicate of the given #GFile. +func (file *File) dup() *File { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.dup + + var _arg0 *C.GFile // out + var _cret *C.GFile // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_dup(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(file) + + var _ret *File // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _ret +} + +// ejectMountable starts an asynchronous eject on a mountable. When this +// operation has completed, callback will be called with user_user data, and the +// operation can be finalized with g_file_eject_mountable_finish(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// Deprecated: Use g_file_eject_mountable_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) ejectMountable(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.eject_mountable + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_eject_mountable(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// ejectMountableFinish finishes an asynchronous eject operation started by +// g_file_eject_mountable(). +// +// Deprecated: Use g_file_eject_mountable_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) ejectMountableFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.eject_mountable_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_eject_mountable_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ejectMountableWithOperation starts an asynchronous eject on a +// mountable. When this operation has completed, callback will be +// called with user_user data, and the operation can be finalized with +// g_file_eject_mountable_with_operation_finish(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation, or NULL to avoid user interaction. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) ejectMountableWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.eject_mountable_with_operation + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_eject_mountable_with_operation(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// ejectMountableWithOperationFinish finishes an asynchronous eject operation +// started by g_file_eject_mountable_with_operation(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) ejectMountableWithOperationFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.eject_mountable_with_operation_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_eject_mountable_with_operation_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// enumerateChildren gets the requested information about the files in a +// directory. The result is a Enumerator object that will give out Info objects +// for all the files in the directory. +// +// The attributes value is a string that specifies the file attributes that +// should be gathered. It is not an error if it's not possible to read a +// particular requested attribute from a file - it just won't be set. attributes +// should be a comma-separated list of attributes or attribute wildcards. +// The wildcard "*" means all attributes, and a wildcard like "standard::*" +// means all attributes in the standard namespace. An example attribute query be +// "standard::*,owner::user". The standard attributes are available as defines, +// like G_FILE_ATTRIBUTE_STANDARD_NAME. G_FILE_ATTRIBUTE_STANDARD_NAME should +// always be specified if you plan to call g_file_enumerator_get_child() or +// g_file_enumerator_iterate() on the returned enumerator. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// If the file is not a directory, the G_IO_ERROR_NOT_DIRECTORY error will be +// returned. Other errors are possible too. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - flags: set of QueryInfoFlags. +// +// The function returns the following values: +// +// - fileEnumerator if successful, NULL on error. Free the returned object +// with g_object_unref(). +func (file *File) enumerateChildren(ctx context.Context, attributes string, flags FileQueryInfoFlags) (*FileEnumerator, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.enumerate_children + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileQueryInfoFlags // out + var _cret *C.GFileEnumerator // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileQueryInfoFlags(flags) + + _cret = C._gotk4_gio2_File_virtual_enumerate_children(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(flags) + + var _fileEnumerator *FileEnumerator // out + var _goerr error // out + + _fileEnumerator = wrapFileEnumerator(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileEnumerator, _goerr +} + +// enumerateChildrenAsync: asynchronously gets the requested information about +// the files in a directory. The result is a Enumerator object that will give +// out Info objects for all the files in the directory. +// +// For more details, see g_file_enumerate_children() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_enumerate_children_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - flags: set of QueryInfoFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) enumerateChildrenAsync(ctx context.Context, attributes string, flags FileQueryInfoFlags, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.enumerate_children_async + + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileQueryInfoFlags // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileQueryInfoFlags(flags) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_enumerate_children_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// enumerateChildrenFinish finishes an async enumerate children operation. +// See g_file_enumerate_children_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileEnumerator or NULL if an error occurred. Free the returned object +// with g_object_unref(). +func (file *File) enumerateChildrenFinish(res AsyncResulter) (*FileEnumerator, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.enumerate_children_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileEnumerator // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_enumerate_children_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileEnumerator *FileEnumerator // out + var _goerr error // out + + _fileEnumerator = wrapFileEnumerator(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileEnumerator, _goerr +} + +// Equal checks if the two given #GFiles refer to the same file. +// +// Note that two #GFiles that differ can still refer to the same file on the +// filesystem due to various forms of filename aliasing. +// +// This call does no blocking I/O. +// +// The function takes the following parameters: +// +// - file2: second #GFile. +// +// The function returns the following values: +// +// - ok: TRUE if file1 and file2 are equal. +func (file1 *File) equal(file2 Filer) bool { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file1)) + fnarg := gclass.equal + + var _arg0 *C.GFile // out + var _arg1 *C.GFile // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file1).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file2).Native())) + + _cret = C._gotk4_gio2_File_virtual_equal(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(file1) + runtime.KeepAlive(file2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// findEnclosingMount gets a #GMount for the #GFile. +// +// #GMount is returned only for user interesting locations, see Monitor. +// If the Iface for file does not have a #mount, error will be set to +// G_IO_ERROR_NOT_FOUND and NULL #will be returned. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - mount where the file is located or NULL on error. Free the returned +// object with g_object_unref(). +func (file *File) findEnclosingMount(ctx context.Context) (*Mount, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.find_enclosing_mount + + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GMount // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C._gotk4_gio2_File_virtual_find_enclosing_mount(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _mount *Mount // out + var _goerr error // out + + _mount = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _mount, _goerr +} + +// findEnclosingMountAsync: asynchronously gets the mount for the file. +// +// For more details, see g_file_find_enclosing_mount() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_find_enclosing_mount_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) findEnclosingMountAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.find_enclosing_mount_async + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_find_enclosing_mount_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// findEnclosingMountFinish finishes an asynchronous find mount request. +// See g_file_find_enclosing_mount_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - mount for given file or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) findEnclosingMountFinish(res AsyncResulter) (*Mount, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.find_enclosing_mount_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GMount // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_find_enclosing_mount_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _mount *Mount // out + var _goerr error // out + + _mount = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _mount, _goerr +} + +// Basename gets the base name (the last component of the path) for a given +// #GFile. +// +// If called for the top level of a system (such as the filesystem root or a +// uri like sftp://host/) it will return a single directory separator (and on +// Windows, possibly a drive letter). +// +// The base name is a byte string (not UTF-8). It has no defined encoding +// or rules other than it may not contain zero bytes. If you want to use +// filenames in a user interface you should use the display name that you can +// get by requesting the G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with +// g_file_query_info(). +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - filename (optional): string containing the #GFile's base name, or NULL +// if given #GFile is invalid. The returned string should be freed with +// g_free() when no longer needed. +func (file *File) basename() string { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.get_basename + + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_get_basename(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(file) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// childForDisplayName gets the child of file for a given display_name (i.e. +// a UTF-8 version of the name). If this function fails, it returns NULL and +// error will be set. This is very useful when constructing a #GFile for a new +// file and the user entered the filename in the user interface, for instance +// when you select a directory and type a filename in the file selector. +// +// This call does no blocking I/O. +// +// The function takes the following parameters: +// +// - displayName: string to a possible child. +// +// The function returns the following values: +// +// - ret to the specified child, or NULL if the display name couldn't be +// converted. Free the returned object with g_object_unref(). +func (file *File) childForDisplayName(displayName string) (*File, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.get_child_for_display_name + + var _arg0 *C.GFile // out + var _arg1 *C.char // out + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(displayName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_File_virtual_get_child_for_display_name(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(displayName) + + var _ret *File // out + var _goerr error // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// Parent gets the parent directory for the file. If the file represents the +// root directory of the file system, then NULL will be returned. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - ret (optional) structure to the parent of the given #GFile or NULL if +// there is no parent. Free the returned object with g_object_unref(). +func (file *File) parent() *File { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.get_parent + + var _arg0 *C.GFile // out + var _cret *C.GFile // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_get_parent(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(file) + + var _ret *File // out + + if _cret != nil { + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _ret +} + +// parseName gets the parse name of the file. A parse name is a UTF-8 string +// that describes the file such that one can get the #GFile back using +// g_file_parse_name(). +// +// This is generally used to show the #GFile as a nice full-pathname kind of +// string in a user interface, like in a location entry. +// +// For local files with names that can safely be converted to UTF-8 the +// pathname is used, otherwise the IRI is used (a form of URI that allows UTF-8 +// characters unescaped). +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - utf8: string containing the #GFile's parse name. The returned string +// should be freed with g_free() when no longer needed. +func (file *File) parseName() string { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.get_parse_name + + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_get_parse_name(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(file) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Path gets the local pathname for #GFile, if one exists. If non-NULL, this is +// guaranteed to be an absolute, canonical path. It might contain symlinks. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - filename (optional): string containing the #GFile's path, or NULL if no +// such path exists. The returned string should be freed with g_free() when +// no longer needed. +func (file *File) path() string { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.get_path + + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_get_path(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(file) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// relativePath gets the path for descendant relative to parent. +// +// This call does no blocking I/O. +// +// The function takes the following parameters: +// +// - descendant: input #GFile. +// +// The function returns the following values: +// +// - filename (optional): string with the relative path from descendant to +// parent, or NULL if descendant doesn't have parent as prefix. The returned +// string should be freed with g_free() when no longer needed. +func (parent *File) relativePath(descendant Filer) string { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(parent)) + fnarg := gclass.get_relative_path + + var _arg0 *C.GFile // out + var _arg1 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(descendant).Native())) + + _cret = C._gotk4_gio2_File_virtual_get_relative_path(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(parent) + runtime.KeepAlive(descendant) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// urI gets the URI for the file. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - utf8: string containing the #GFile's URI. If the #GFile was constructed +// with an invalid URI, an invalid URI is returned. The returned string +// should be freed with g_free() when no longer needed. +func (file *File) urI() string { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.get_uri + + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_get_uri(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(file) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// uriScheme gets the URI scheme for a #GFile. RFC 3986 decodes the scheme as: +// +// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] +// +// Common schemes include "file", "http", "ftp", etc. +// +// The scheme can be different from the one used to construct the #GFile, +// in that it might be replaced with one that is logically equivalent to the +// #GFile. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the URI scheme for the given #GFile +// or NULL if the #GFile was constructed with an invalid URI. The returned +// string should be freed with g_free() when no longer needed. +func (file *File) uriScheme() string { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.get_uri_scheme + + var _arg0 *C.GFile // out + var _cret *C.char // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_get_uri_scheme(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(file) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// hasURIScheme checks to see if a #GFile has a given URI scheme. +// +// This call does no blocking I/O. +// +// The function takes the following parameters: +// +// - uriScheme: string containing a URI scheme. +// +// The function returns the following values: +// +// - ok: TRUE if #GFile's backend supports the given URI scheme, FALSE if URI +// scheme is NULL, not supported, or #GFile is invalid. +func (file *File) hasURIScheme(uriScheme string) bool { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.has_uri_scheme + + var _arg0 *C.GFile // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uriScheme))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_File_virtual_has_uri_scheme(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(file) + runtime.KeepAlive(uriScheme) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Hash creates a hash value for a #GFile. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - guint: 0 if file is not a valid #GFile, otherwise an integer that can be +// used as hash value for the #GFile. This function is intended for easily +// hashing a #GFile to add to a Table or similar data structure. +func (file *File) hash() uint { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.hash + + var _arg0 *C.GFile // out + var _cret C.guint // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_hash(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(file) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// isNative checks to see if a file is native to the platform. +// +// A native file is one expressed in the platform-native filename format, +// e.g. "C:\Windows" or "/usr/bin/". This does not mean the file is local, +// as it might be on a locally mounted remote filesystem. +// +// On some systems non-native files may be available using the native filesystem +// via a userspace filesystem (FUSE), in these cases this call will return +// FALSE, but g_file_get_path() will still return a native path. +// +// This call does no blocking I/O. +// +// The function returns the following values: +// +// - ok: TRUE if file is native. +func (file *File) isNative() bool { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.is_native + + var _arg0 *C.GFile // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_is_native(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(file) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// makeDirectory creates a directory. Note that this will only create +// a child directory of the immediate parent directory of the path +// or URI given by the #GFile. To recursively create directories, see +// g_file_make_directory_with_parents(). This function will fail if the parent +// directory does not exist, setting error to G_IO_ERROR_NOT_FOUND. If the +// file system doesn't support creating directories, this function will fail, +// setting error to G_IO_ERROR_NOT_SUPPORTED. +// +// For a local #GFile the newly created directory will have the default +// (current) ownership and permissions of the current process. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (file *File) makeDirectory(ctx context.Context) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.make_directory + + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_File_virtual_make_directory(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// makeDirectoryAsync: asynchronously creates a directory. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (file *File) makeDirectoryAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.make_directory_async + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_make_directory_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// makeDirectoryFinish finishes an asynchronous directory creation, started with +// g_file_make_directory_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) makeDirectoryFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.make_directory_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_make_directory_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// makeSymbolicLink creates a symbolic link named file which contains the string +// symlink_value. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - symlinkValue: string with the path for the target of the new symlink. +func (file *File) makeSymbolicLink(ctx context.Context, symlinkValue string) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.make_symbolic_link + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(symlinkValue))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_File_virtual_make_symbolic_link(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(symlinkValue) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// makeSymbolicLinkAsync: asynchronously creates a symbolic link named file +// which contains the string symlink_value. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - symlinkValue: string with the path for the target of the new symlink. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (file *File) makeSymbolicLinkAsync(ctx context.Context, symlinkValue string, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.make_symbolic_link_async + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(symlinkValue))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_make_symbolic_link_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(symlinkValue) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// makeSymbolicLinkFinish finishes an asynchronous symbolic link creation, +// started with g_file_make_symbolic_link_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) makeSymbolicLinkFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.make_symbolic_link_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_make_symbolic_link_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// measureDiskUsageFinish collects the results from an earlier call to +// g_file_measure_disk_usage_async(). See g_file_measure_disk_usage() for more +// information. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - diskUsage (optional): number of bytes of disk space used. +// - numDirs (optional): number of directories encountered. +// - numFiles (optional): number of non-directories encountered. +func (file *File) measureDiskUsageFinish(result AsyncResulter) (diskUsage, numDirs, numFiles uint64, goerr error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.measure_disk_usage_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.guint64 // in + var _arg3 C.guint64 // in + var _arg4 C.guint64 // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_measure_disk_usage_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _diskUsage uint64 // out + var _numDirs uint64 // out + var _numFiles uint64 // out + var _goerr error // out + + _diskUsage = uint64(_arg2) + _numDirs = uint64(_arg3) + _numFiles = uint64(_arg4) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _diskUsage, _numDirs, _numFiles, _goerr +} + +// monitorDir obtains a directory monitor for the given file. This may fail if +// directory monitoring is not supported. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// It does not make sense for flags to contain G_FILE_MONITOR_WATCH_HARD_LINKS, +// since hard links can not be made to directories. It is not possible to +// monitor all the files in a directory for changes made via hard links; +// if you want to do this then you must register individual watches with +// g_file_monitor(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of MonitorFlags. +// +// The function returns the following values: +// +// - fileMonitor for the given file, or NULL on error. Free the returned +// object with g_object_unref(). +func (file *File) monitorDir(ctx context.Context, flags FileMonitorFlags) (FileMonitorrer, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.monitor_dir + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileMonitorFlags // out + var _cret *C.GFileMonitor // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileMonitorFlags(flags) + + _cret = C._gotk4_gio2_File_virtual_monitor_dir(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileMonitor FileMonitorrer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.FileMonitorrer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(FileMonitorrer) + return ok + }) + rv, ok := casted.(FileMonitorrer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.FileMonitorrer") + } + _fileMonitor = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileMonitor, _goerr +} + +// monitorFile obtains a file monitor for the given file. If no file +// notification mechanism exists, then regular polling of the file is used. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If flags contains G_FILE_MONITOR_WATCH_HARD_LINKS then the monitor will +// also attempt to report changes made to the file via another filename (ie, +// a hard link). Without this flag, you can only rely on changes made through +// the filename contained in file to be reported. Using this flag may result in +// an increase in resource usage, and may not have any effect depending on the +// Monitor backend and/or filesystem type. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags: set of MonitorFlags. +// +// The function returns the following values: +// +// - fileMonitor for the given file, or NULL on error. Free the returned +// object with g_object_unref(). +func (file *File) monitorFile(ctx context.Context, flags FileMonitorFlags) (FileMonitorrer, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.monitor_file + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GFileMonitorFlags // out + var _cret *C.GFileMonitor // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GFileMonitorFlags(flags) + + _cret = C._gotk4_gio2_File_virtual_monitor_file(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + + var _fileMonitor FileMonitorrer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.FileMonitorrer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(FileMonitorrer) + return ok + }) + rv, ok := casted.(FileMonitorrer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.FileMonitorrer") + } + _fileMonitor = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileMonitor, _goerr +} + +// mountEnclosingVolume starts a mount_operation, mounting the volume that +// contains the file location. +// +// When this operation has completed, callback will be called +// with user_user data, and the operation can be finalized with +// g_file_mount_enclosing_volume_finish(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation or NULL to avoid user interaction. +// - callback (optional) to call when the request is satisfied, or NULL. +func (location *File) mountEnclosingVolume(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(location)) + fnarg := gclass.mount_enclosing_volume + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountMountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(location).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountMountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_mount_enclosing_volume(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(location) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// mountEnclosingVolumeFinish finishes a mount operation started by +// g_file_mount_enclosing_volume(). +// +// The function takes the following parameters: +// +// - result: Result. +func (location *File) mountEnclosingVolumeFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(location)) + fnarg := gclass.mount_enclosing_volume_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(location).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_mount_enclosing_volume_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(location) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// mountMountable mounts a file of type G_FILE_TYPE_MOUNTABLE. Using +// mount_operation, you can request callbacks when, for instance, passwords are +// needed during authentication. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_mount_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation, or NULL to avoid user interaction. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) mountMountable(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.mount_mountable + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountMountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountMountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_mount_mountable(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// mountMountableFinish finishes a mount operation. See g_file_mount_mountable() +// for details. +// +// Finish an asynchronous mount operation that was started with +// g_file_mount_mountable(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - ret or NULL on error. Free the returned object with g_object_unref(). +func (file *File) mountMountableFinish(result AsyncResulter) (*File, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.mount_mountable_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_File_virtual_mount_mountable_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _ret *File // out + var _goerr error // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// moveFinish finishes an asynchronous file movement, started with +// g_file_move_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) moveFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.move_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_move_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// openReadwrite opens an existing file for reading and writing. The result is a +// IOStream that can be used to read and write the contents of the file. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be +// returned. Other errors are possible too, and depend on what kind of +// filesystem the file is on. Note that in many non-local file cases read and +// write streams are not supported, so make sure you really need to do read and +// write streaming, rather than just opening for reading or writing. +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) openReadwrite(ctx context.Context) (*FileIOStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.open_readwrite + + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C._gotk4_gio2_File_virtual_open_readwrite(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// openReadwriteAsync: asynchronously opens file for reading and writing. +// +// For more details, see g_file_open_readwrite() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_open_readwrite_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) openReadwriteAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.open_readwrite_async + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_open_readwrite_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// openReadwriteFinish finishes an asynchronous file read operation started with +// g_file_open_readwrite_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) openReadwriteFinish(res AsyncResulter) (*FileIOStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.open_readwrite_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_open_readwrite_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// pollMountable polls a file of type G_FILE_TYPE_MOUNTABLE. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_mount_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - callback (optional) to call when the request is satisfied, or NULL. +func (file *File) pollMountable(ctx context.Context, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.poll_mountable + + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_poll_mountable(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// pollMountableFinish finishes a poll operation. See g_file_poll_mountable() +// for details. +// +// Finish an asynchronous poll operation that was polled with +// g_file_poll_mountable(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) pollMountableFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.poll_mountable_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_poll_mountable_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// prefixMatches checks whether file has the prefix specified by prefix. +// +// In other words, if the names of initial elements of file's pathname match +// prefix. Only full pathname elements are matched, so a path like /foo is not +// considered a prefix of /foobar, only of /foo/bar. +// +// A #GFile is not a prefix of itself. If you want to check for equality, +// use g_file_equal(). +// +// This call does no I/O, as it works purely on names. As such it can sometimes +// return FALSE even if file is inside a prefix (from a filesystem point of +// view), because the prefix of file is an alias of prefix. +// +// The function takes the following parameters: +// +// - file: input #GFile. +// +// The function returns the following values: +// +// - ok: TRUE if the file's parent, grandparent, etc is prefix, FALSE +// otherwise. +func (prefix *File) prefixMatches(file Filer) bool { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(prefix)) + fnarg := gclass.prefix_matches + + var _arg0 *C.GFile // out + var _arg1 *C.GFile // out + var _cret C.gboolean // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(prefix).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C._gotk4_gio2_File_virtual_prefix_matches(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(prefix) + runtime.KeepAlive(file) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// queryFilesystemInfo: similar to g_file_query_info(), but obtains information +// about the filesystem the file is on, rather than the file itself. For +// instance the amount of space available and the type of the filesystem. +// +// The attributes value is a string that specifies the attributes that should +// be gathered. It is not an error if it's not possible to read a particular +// requested attribute from a file - it just won't be set. attributes +// should be a comma-separated list of attributes or attribute wildcards. +// The wildcard "*" means all attributes, and a wildcard like "filesystem::*" +// means all attributes in the filesystem namespace. The standard namespace +// for filesystem attributes is "filesystem". Common attributes of interest +// are G_FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem +// in bytes), G_FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available), +// and G_FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// Other errors are possible too, and depend on what kind of filesystem the file +// is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// +// The function returns the following values: +// +// - fileInfo or NULL if there was an error. Free the returned object with +// g_object_unref(). +func (file *File) queryFilesystemInfo(ctx context.Context, attributes string) (*FileInfo, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.query_filesystem_info + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_File_virtual_query_filesystem_info(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// queryFilesystemInfoAsync: asynchronously gets the requested information about +// the filesystem that the specified file is on. The result is a Info object +// that contains key-value attributes (such as type or size for the file). +// +// For more details, see g_file_query_filesystem_info() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_query_info_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) queryFilesystemInfoAsync(ctx context.Context, attributes string, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.query_filesystem_info_async + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_query_filesystem_info_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// queryFilesystemInfoFinish finishes an asynchronous filesystem info query. +// See g_file_query_filesystem_info_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileInfo for given file or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) queryFilesystemInfoFinish(res AsyncResulter) (*FileInfo, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.query_filesystem_info_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_query_filesystem_info_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// queryInfo gets the requested information about specified file. The result is +// a Info object that contains key-value attributes (such as the type or size of +// the file). +// +// The attributes value is a string that specifies the file attributes that +// should be gathered. It is not an error if it's not possible to read a +// particular requested attribute from a file - it just won't be set. attributes +// should be a comma-separated list of attributes or attribute wildcards. +// The wildcard "*" means all attributes, and a wildcard like "standard::*" +// means all attributes in the standard namespace. An example attribute query be +// "standard::*,owner::user". The standard attributes are available as defines, +// like G_FILE_ATTRIBUTE_STANDARD_NAME. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// For symlinks, normally the information about the target of the symlink is +// returned, rather than information about the symlink itself. However if you +// pass G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in flags the information about +// the symlink itself will be returned. Also, for symlinks that point to +// non-existing files the information about the symlink itself will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// Other errors are possible too, and depend on what kind of filesystem the file +// is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - flags: set of QueryInfoFlags. +// +// The function returns the following values: +// +// - fileInfo for the given file, or NULL on error. Free the returned object +// with g_object_unref(). +func (file *File) queryInfo(ctx context.Context, attributes string, flags FileQueryInfoFlags) (*FileInfo, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.query_info + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileQueryInfoFlags // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileQueryInfoFlags(flags) + + _cret = C._gotk4_gio2_File_virtual_query_info(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(flags) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// queryInfoAsync: asynchronously gets the requested information about specified +// file. The result is a Info object that contains key-value attributes (such as +// type or size for the file). +// +// For more details, see g_file_query_info() which is the synchronous version of +// this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_query_info_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: attribute query string. +// - flags: set of QueryInfoFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) queryInfoAsync(ctx context.Context, attributes string, flags FileQueryInfoFlags, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.query_info_async + + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileQueryInfoFlags // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileQueryInfoFlags(flags) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_query_info_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// queryInfoFinish finishes an asynchronous file info query. See +// g_file_query_info_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileInfo for given file or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) queryInfoFinish(res AsyncResulter) (*FileInfo, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.query_info_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_query_info_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// querySettableAttributes: obtain the list of settable attributes for the file. +// +// Returns the type and full attribute name of all the attributes that can be +// set on this file. This doesn't mean setting it will always succeed though, +// you might get an access failure, or some specific file may not support a +// specific attribute. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - fileAttributeInfoList describing the settable attributes. When you are +// done with it, release it with g_file_attribute_info_list_unref(). +func (file *File) querySettableAttributes(ctx context.Context) (*FileAttributeInfoList, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.query_settable_attributes + + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileAttributeInfoList // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C._gotk4_gio2_File_virtual_query_settable_attributes(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _fileAttributeInfoList *FileAttributeInfoList // out + var _goerr error // out + + _fileAttributeInfoList = (*FileAttributeInfoList)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileAttributeInfoList)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_file_attribute_info_list_unref((*C.GFileAttributeInfoList)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileAttributeInfoList, _goerr +} + +// queryWritableNamespaces: obtain the list of attribute namespaces where +// new attributes can be created by a user. An example of this is extended +// attributes (in the "xattr" namespace). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - fileAttributeInfoList describing the writable namespaces. When you are +// done with it, release it with g_file_attribute_info_list_unref(). +func (file *File) queryWritableNamespaces(ctx context.Context) (*FileAttributeInfoList, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.query_writable_namespaces + + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileAttributeInfoList // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C._gotk4_gio2_File_virtual_query_writable_namespaces(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _fileAttributeInfoList *FileAttributeInfoList // out + var _goerr error // out + + _fileAttributeInfoList = (*FileAttributeInfoList)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileAttributeInfoList)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_file_attribute_info_list_unref((*C.GFileAttributeInfoList)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileAttributeInfoList, _goerr +} + +// readAsync: asynchronously opens file for reading. +// +// For more details, see g_file_read() which is the synchronous version of this +// call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_read_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) readAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.read_async + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_read_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// readFinish finishes an asynchronous file read operation started with +// g_file_read_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileInputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) readFinish(res AsyncResulter) (*FileInputStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.read_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_read_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileInputStream *FileInputStream // out + var _goerr error // out + + _fileInputStream = wrapFileInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInputStream, _goerr +} + +// readFn opens a file for reading. The result is a InputStream that can be used +// to read the contents of the file. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. +// If the file is a directory, the G_IO_ERROR_IS_DIRECTORY error will be +// returned. Other errors are possible too, and depend on what kind of +// filesystem the file is on. +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// +// The function returns the following values: +// +// - fileInputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) readFn(ctx context.Context) (*FileInputStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.read_fn + + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C._gotk4_gio2_File_virtual_read_fn(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _fileInputStream *FileInputStream // out + var _goerr error // out + + _fileInputStream = wrapFileInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInputStream, _goerr +} + +// Replace returns an output stream for overwriting the file, possibly creating +// a backup copy of the file first. If the file doesn't exist, it will be +// created. +// +// This will try to replace the file in the safest way possible so that any +// errors during the writing will not affect an already existing copy of the +// file. For instance, for local files it may write to a temporary file and then +// atomically rename over the destination when the stream is closed. +// +// By default files created are generally readable by everyone, but if you pass +// G_FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// current user, to the level that is supported on the target filesystem. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// If you pass in a non-NULL etag value and file already exists, then this +// value is compared to the current entity tag of the file, and if they +// differ an G_IO_ERROR_WRONG_ETAG error is returned. This generally means +// that the file has been changed since you last read it. You can get the +// new etag from g_file_output_stream_get_etag() after you've finished +// writing and closed the OutputStream. When you load a new file you can use +// g_file_input_stream_query_info() to get the etag of the file. +// +// If make_backup is TRUE, this function will attempt to make a +// backup of the current file before overwriting it. If this fails a +// G_IO_ERROR_CANT_CREATE_BACKUP error will be returned. If you want to replace +// anyway, try again with make_backup set to FALSE. +// +// If the file is a directory the G_IO_ERROR_IS_DIRECTORY error will be +// returned, and if the file is some other form of non-regular file then a +// G_IO_ERROR_NOT_REGULAR_FILE error will be returned. Some file systems don't +// allow all file names, and may return an G_IO_ERROR_INVALID_FILENAME error, +// and if the name is to long G_IO_ERROR_FILENAME_TOO_LONG will be returned. +// Other errors are possible too, and depend on what kind of filesystem the file +// is on. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - etag (optional): optional entity tag (#entity-tags) for the current +// #GFile, or LL to ignore. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileOutputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) replace(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags) (*FileOutputStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.replace + + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _arg3 C.GFileCreateFlags // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if etag != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg1)) + } + if makeBackup { + _arg2 = C.TRUE + } + _arg3 = C.GFileCreateFlags(flags) + + _cret = C._gotk4_gio2_File_virtual_replace(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// replaceAsync: asynchronously overwrites the file, replacing the contents, +// possibly creating a backup copy of the file first. +// +// For more details, see g_file_replace() which is the synchronous version of +// this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_replace_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - etag (optional): entity tag (#entity-tags) for the current #GFile, +// or NULL to ignore. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) replaceAsync(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.replace_async + + var _arg0 *C.GFile // out + var _arg5 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _arg3 C.GFileCreateFlags // out + var _arg4 C.int // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if etag != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg1)) + } + if makeBackup { + _arg2 = C.TRUE + } + _arg3 = C.GFileCreateFlags(flags) + _arg4 = C.int(ioPriority) + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_replace_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// replaceFinish finishes an asynchronous file replace operation started with +// g_file_replace_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileOutputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) replaceFinish(res AsyncResulter) (*FileOutputStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.replace_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileOutputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_replace_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileOutputStream *FileOutputStream // out + var _goerr error // out + + _fileOutputStream = wrapFileOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileOutputStream, _goerr +} + +// replaceReadwrite returns an output stream for overwriting the file in +// readwrite mode, possibly creating a backup copy of the file first. If the +// file doesn't exist, it will be created. +// +// For details about the behaviour, see g_file_replace() which does the same +// thing but returns an output stream only. +// +// Note that in many non-local file cases read and write streams are not +// supported, so make sure you really need to do read and write streaming, +// rather than just opening for reading or writing. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - etag (optional): optional entity tag (#entity-tags) for the current +// #GFile, or LL to ignore. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) replaceReadwrite(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags) (*FileIOStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.replace_readwrite + + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _arg3 C.GFileCreateFlags // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if etag != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg1)) + } + if makeBackup { + _arg2 = C.TRUE + } + _arg3 = C.GFileCreateFlags(flags) + + _cret = C._gotk4_gio2_File_virtual_replace_readwrite(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// replaceReadwriteAsync: asynchronously overwrites the file in read-write mode, +// replacing the contents, possibly creating a backup copy of the file first. +// +// For more details, see g_file_replace_readwrite() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_replace_readwrite_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - etag (optional): entity tag (#entity-tags) for the current #GFile, +// or NULL to ignore. +// - makeBackup: TRUE if a backup should be created. +// - flags: set of CreateFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) replaceReadwriteAsync(ctx context.Context, etag string, makeBackup bool, flags FileCreateFlags, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.replace_readwrite_async + + var _arg0 *C.GFile // out + var _arg5 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + var _arg3 C.GFileCreateFlags // out + var _arg4 C.int // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if etag != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(etag))) + defer C.free(unsafe.Pointer(_arg1)) + } + if makeBackup { + _arg2 = C.TRUE + } + _arg3 = C.GFileCreateFlags(flags) + _arg4 = C.int(ioPriority) + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_replace_readwrite_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(etag) + runtime.KeepAlive(makeBackup) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// replaceReadwriteFinish finishes an asynchronous file replace operation +// started with g_file_replace_readwrite_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - fileIOStream or NULL on error. Free the returned object with +// g_object_unref(). +func (file *File) replaceReadwriteFinish(res AsyncResulter) (*FileIOStream, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.replace_readwrite_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_replace_readwrite_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _fileIOStream *FileIOStream // out + var _goerr error // out + + _fileIOStream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileIOStream, _goerr +} + +// resolveRelativePath resolves a relative path for file to an absolute path. +// +// This call does no blocking I/O. +// +// If the relative_path is an absolute path name, the resolution is done +// absolutely (without taking file path as base). +// +// The function takes the following parameters: +// +// - relativePath: given relative path string. +// +// The function returns the following values: +// +// - ret for the resolved path. +func (file *File) resolveRelativePath(relativePath string) *File { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.resolve_relative_path + + var _arg0 *C.GFile // out + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(relativePath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_File_virtual_resolve_relative_path(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(file) + runtime.KeepAlive(relativePath) + + var _ret *File // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _ret +} + +// setAttribute sets an attribute in the file with attribute name attribute to +// value_p. +// +// Some attributes can be unset by setting type to G_FILE_ATTRIBUTE_TYPE_INVALID +// and value_p to NULL. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attribute: string containing the attribute's name. +// - typ: type of the attribute. +// - valueP (optional): pointer to the value (or the pointer itself if the +// type is a pointer type). +// - flags: set of QueryInfoFlags. +func (file *File) setAttribute(ctx context.Context, attribute string, typ FileAttributeType, valueP unsafe.Pointer, flags FileQueryInfoFlags) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.set_attribute + + var _arg0 *C.GFile // out + var _arg5 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.GFileAttributeType // out + var _arg3 C.gpointer // out + var _arg4 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileAttributeType(typ) + _arg3 = (C.gpointer)(unsafe.Pointer(valueP)) + _arg4 = C.GFileQueryInfoFlags(flags) + + C._gotk4_gio2_File_virtual_set_attribute(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attribute) + runtime.KeepAlive(typ) + runtime.KeepAlive(valueP) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// setAttributesAsync: asynchronously sets the attributes of file with info. +// +// For more details, see g_file_set_attributes_from_info(), which is the +// synchronous version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_set_attributes_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - info: Info. +// - flags: QueryInfoFlags. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) setAttributesAsync(ctx context.Context, info *FileInfo, flags FileQueryInfoFlags, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.set_attributes_async + + var _arg0 *C.GFile // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GFileInfo // out + var _arg2 C.GFileQueryInfoFlags // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg2 = C.GFileQueryInfoFlags(flags) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_set_attributes_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(info) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// setAttributesFinish finishes setting an attribute started in +// g_file_set_attributes_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - info: Info. +func (file *File) setAttributesFinish(result AsyncResulter) (*FileInfo, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.set_attributes_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_set_attributes_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _info *FileInfo // out + var _goerr error // out + + _info = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_arg2))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _info, _goerr +} + +// setAttributesFromInfo tries to set all attributes in the Info on the target +// values, not stopping on the first error. +// +// If there is any error during this operation then error will be set to the +// first error. Error on particular fields are flagged by setting the "status" +// field in the attribute value to G_FILE_ATTRIBUTE_STATUS_ERROR_SETTING, +// which means you can also detect further errors. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - info: Info. +// - flags: QueryInfoFlags. +func (file *File) setAttributesFromInfo(ctx context.Context, info *FileInfo, flags FileQueryInfoFlags) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.set_attributes_from_info + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GFileInfo // out + var _arg2 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg2 = C.GFileQueryInfoFlags(flags) + + C._gotk4_gio2_File_virtual_set_attributes_from_info(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(info) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// setDisplayName renames file to the specified display name. +// +// The display name is converted from UTF-8 to the correct encoding for the +// target filesystem if possible and the file is renamed to this. +// +// If you want to implement a rename operation in the user interface the edit +// name (G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME) should be used as the initial +// value in the rename widget, and then the result after editing should be +// passed to g_file_set_display_name(). +// +// On success the resulting converted filename is returned. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - displayName: string. +// +// The function returns the following values: +// +// - ret specifying what file was renamed to, or NULL if there was an error. +// Free the returned object with g_object_unref(). +func (file *File) setDisplayName(ctx context.Context, displayName string) (*File, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.set_display_name + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(displayName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_File_virtual_set_display_name(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(displayName) + + var _ret *File // out + var _goerr error // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// setDisplayNameAsync: asynchronously sets the display name for a given #GFile. +// +// For more details, see g_file_set_display_name() which is the synchronous +// version of this call. +// +// When the operation is finished, callback will be called. You can then call +// g_file_set_display_name_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - displayName: string. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) setDisplayNameAsync(ctx context.Context, displayName string, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.set_display_name_async + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(displayName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_set_display_name_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(displayName) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// setDisplayNameFinish finishes setting a display name started with +// g_file_set_display_name_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - ret or NULL on error. Free the returned object with g_object_unref(). +func (file *File) setDisplayNameFinish(res AsyncResulter) (*File, error) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.set_display_name_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_File_virtual_set_display_name_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(res) + + var _ret *File // out + var _goerr error // out + + _ret = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// startMountable starts a file of type G_FILE_TYPE_MOUNTABLE. Using +// start_operation, you can request callbacks when, for instance, passwords are +// needed during authentication. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_mount_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - startOperation (optional) or NULL to avoid user interaction. +// - callback (optional) to call when the request is satisfied, or NULL. +func (file *File) startMountable(ctx context.Context, flags DriveStartFlags, startOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.start_mountable + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GDriveStartFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GDriveStartFlags(flags) + if startOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(startOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_start_mountable(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(startOperation) + runtime.KeepAlive(callback) +} + +// startMountableFinish finishes a start operation. See g_file_start_mountable() +// for details. +// +// Finish an asynchronous start operation that was started with +// g_file_start_mountable(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) startMountableFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.start_mountable_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_start_mountable_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// stopMountable stops a file of type G_FILE_TYPE_MOUNTABLE. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_stop_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation, or NULL to avoid user interaction. +// - callback (optional) to call when the request is satisfied, or NULL. +func (file *File) stopMountable(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.stop_mountable + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_stop_mountable(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// stopMountableFinish finishes a stop operation, see g_file_stop_mountable() +// for details. +// +// Finish an asynchronous stop operation that was started with +// g_file_stop_mountable(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) stopMountableFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.stop_mountable_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_stop_mountable_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Trash sends file to the "Trashcan", if possible. This is similar to +// deleting it, but the user can recover it before emptying the trashcan. +// Not all file systems support trashing, so this call can return the +// G_IO_ERROR_NOT_SUPPORTED error. Since GLib 2.66, the x-gvfs-notrash unix +// mount option can be used to disable g_file_trash() support for certain +// mounts, the G_IO_ERROR_NOT_SUPPORTED error will be returned in that case. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (file *File) trash(ctx context.Context) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.trash + + var _arg0 *C.GFile // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_File_virtual_trash(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// trashAsync: asynchronously sends file to the Trash location, if possible. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (file *File) trashAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.trash_async + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_trash_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// trashFinish finishes an asynchronous file trashing operation, started with +// g_file_trash_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) trashFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.trash_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_trash_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// unmountMountable unmounts a file of type G_FILE_TYPE_MOUNTABLE. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_unmount_mountable_finish() to get the result of the operation. +// +// Deprecated: Use g_file_unmount_mountable_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) unmountMountable(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.unmount_mountable + + var _arg0 *C.GFile // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_unmount_mountable(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// unmountMountableFinish finishes an unmount operation, see +// g_file_unmount_mountable() for details. +// +// Finish an asynchronous unmount operation that was started with +// g_file_unmount_mountable(). +// +// Deprecated: Use g_file_unmount_mountable_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) unmountMountableFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.unmount_mountable_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_unmount_mountable_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// unmountMountableWithOperation unmounts a file of type G_FILE_TYPE_MOUNTABLE. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// When the operation is finished, callback will be called. You can then call +// g_file_unmount_mountable_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional): Operation, or NULL to avoid user interaction. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (file *File) unmountMountableWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.unmount_mountable_with_operation + + var _arg0 *C.GFile // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_File_virtual_unmount_mountable_with_operation(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(file) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// unmountMountableWithOperationFinish finishes an unmount operation, see +// g_file_unmount_mountable_with_operation() for details. +// +// Finish an asynchronous unmount operation that was started with +// g_file_unmount_mountable_with_operation(). +// +// The function takes the following parameters: +// +// - result: Result. +func (file *File) unmountMountableWithOperationFinish(result AsyncResulter) error { + gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) + fnarg := gclass.unmount_mountable_with_operation_finish + + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_File_virtual_unmount_mountable_with_operation_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// NewFileBuildFilenamev constructs a #GFile from a vector of elements using the +// correct separator for filenames. +// +// Using this function is equivalent to calling g_build_filenamev(), followed by +// g_file_new_for_path() on the result. +// +// The function takes the following parameters: +// +// - args: NULL-terminated array of strings containing the path elements. +// +// The function returns the following values: +// +// - file: new #GFile. +func NewFileBuildFilenamev(args []string) *File { + var _arg1 **C.gchar // out + var _cret *C.GFile // in + + { + _arg1 = (**C.gchar)(C.calloc(C.size_t((len(args) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(args)+1) + var zero *C.gchar + out[len(args)] = zero + for i := range args { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(args[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + _cret = C.g_file_new_build_filenamev(_arg1) + runtime.KeepAlive(args) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// NewFileForCommandlineArg creates a #GFile with the given argument from +// the command line. The value of arg can be either a URI, an absolute path +// or a relative path resolved relative to the current working directory. +// This operation never fails, but the returned object might not support any I/O +// operation if arg points to a malformed path. +// +// Note that on Windows, this function expects its argument to be in UTF-8 -- +// not the system code page. This means that you should not use this function +// with string from argv as it is passed to main(). g_win32_get_command_line() +// will return a UTF-8 version of the commandline. #GApplication also uses UTF-8 +// but g_application_command_line_create_file_for_arg() may be more useful for +// you there. It is also always possible to use this function with Context +// arguments of type G_OPTION_ARG_FILENAME. +// +// The function takes the following parameters: +// +// - arg: command line string. +// +// The function returns the following values: +// +// - file: new #GFile. Free the returned object with g_object_unref(). +func NewFileForCommandlineArg(arg string) *File { + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(arg))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_new_for_commandline_arg(_arg1) + runtime.KeepAlive(arg) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// NewFileForCommandlineArgAndCwd creates a #GFile with the given argument from +// the command line. +// +// This function is similar to g_file_new_for_commandline_arg() except that it +// allows for passing the current working directory as an argument instead of +// using the current working directory of the process. +// +// This is useful if the commandline argument was given in a context other than +// the invocation of the current process. +// +// See also g_application_command_line_create_file_for_arg(). +// +// The function takes the following parameters: +// +// - arg: command line string. +// - cwd: current working directory of the commandline. +// +// The function returns the following values: +// +// - file: new #GFile. +func NewFileForCommandlineArgAndCwd(arg, cwd string) *File { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GFile // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(arg))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(cwd))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_file_new_for_commandline_arg_and_cwd(_arg1, _arg2) + runtime.KeepAlive(arg) + runtime.KeepAlive(cwd) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// NewFileForPath constructs a #GFile for a given path. This operation never +// fails, but the returned object might not support any I/O operation if path is +// malformed. +// +// The function takes the following parameters: +// +// - path: string containing a relative or absolute path. The string must be +// encoded in the glib filename encoding. +// +// The function returns the following values: +// +// - file: new #GFile for the given path. Free the returned object with +// g_object_unref(). +func NewFileForPath(path string) *File { + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_new_for_path(_arg1) + runtime.KeepAlive(path) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// NewFileForURI constructs a #GFile for a given URI. This operation never +// fails, but the returned object might not support any I/O operation if uri is +// malformed or if the uri type is not supported. +// +// The function takes the following parameters: +// +// - uri: UTF-8 string containing a URI. +// +// The function returns the following values: +// +// - file: new #GFile for the given uri. Free the returned object with +// g_object_unref(). +func NewFileForURI(uri string) *File { + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_new_for_uri(_arg1) + runtime.KeepAlive(uri) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// NewFileTmp opens a file in the preferred directory for temporary files (as +// returned by g_get_tmp_dir()) and returns a #GFile and IOStream pointing to +// it. +// +// tmpl should be a string in the GLib file name encoding containing a sequence +// of six 'X' characters, and containing no directory components. If it is NULL, +// a default template is used. +// +// Unlike the other #GFile constructors, this will return NULL if a temporary +// file could not be created. +// +// The function takes the following parameters: +// +// - tmpl (optional): template for the file name, as in g_file_open_tmp(), +// or NULL for a default template. +// +// The function returns the following values: +// +// - iostream: on return, a IOStream for the created file. +// - file: new #GFile. Free the returned object with g_object_unref(). +func NewFileTmp(tmpl string) (*FileIOStream, *File, error) { + var _arg1 *C.char // out + var _arg2 *C.GFileIOStream // in + var _cret *C.GFile // in + var _cerr *C.GError // in + + if tmpl != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(tmpl))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_file_new_tmp(_arg1, &_arg2, &_cerr) + runtime.KeepAlive(tmpl) + + var _iostream *FileIOStream // out + var _file *File // out + var _goerr error // out + + _iostream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_arg2))) + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _iostream, _file, _goerr +} + +// NewFileTmpAsync: asynchronously opens a file in the preferred directory for +// temporary files (as returned by g_get_tmp_dir()) as g_file_new_tmp(). +// +// tmpl should be a string in the GLib file name encoding containing a sequence +// of six 'X' characters, and containing no directory components. If it is NULL, +// a default template is used. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - tmpl (optional): template for the file name, as in g_file_open_tmp(), +// or NULL for a default template. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is done. +func NewFileTmpAsync(ctx context.Context, tmpl string, ioPriority int, callback AsyncReadyCallback) { + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if tmpl != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(tmpl))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_new_tmp_async(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(ctx) + runtime.KeepAlive(tmpl) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// NewFileTmpDirAsync: asynchronously creates a directory in the preferred +// directory for temporary files (as returned by g_get_tmp_dir()) as +// g_dir_make_tmp(). +// +// tmpl should be a string in the GLib file name encoding containing a sequence +// of six 'X' characters, and containing no directory components. If it is NULL, +// a default template is used. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - tmpl (optional): template for the file name, as in g_dir_make_tmp(), +// or NULL for a default template. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is done. +func NewFileTmpDirAsync(ctx context.Context, tmpl string, ioPriority int, callback AsyncReadyCallback) { + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if tmpl != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(tmpl))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_new_tmp_dir_async(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(ctx) + runtime.KeepAlive(tmpl) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// NewFileTmpDirFinish finishes a temporary directory creation started by +// g_file_new_tmp_dir_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - file: new #GFile. Free the returned object with g_object_unref(). +func NewFileTmpDirFinish(result AsyncResulter) (*File, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_file_new_tmp_dir_finish(_arg1, &_cerr) + runtime.KeepAlive(result) + + var _file *File // out + var _goerr error // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _file, _goerr +} + +// NewFileTmpFinish finishes a temporary file creation started by +// g_file_new_tmp_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - iostream: on return, a IOStream for the created file. +// - file: new #GFile. Free the returned object with g_object_unref(). +func NewFileTmpFinish(result AsyncResulter) (*FileIOStream, *File, error) { + var _arg1 *C.GAsyncResult // out + var _arg2 *C.GFileIOStream // in + var _cret *C.GFile // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_file_new_tmp_finish(_arg1, &_arg2, &_cerr) + runtime.KeepAlive(result) + + var _iostream *FileIOStream // out + var _file *File // out + var _goerr error // out + + _iostream = wrapFileIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_arg2))) + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _iostream, _file, _goerr +} + +// FileParseName constructs a #GFile with the given parse_name (i.e. +// something given by g_file_get_parse_name()). This operation never fails, +// but the returned object might not support any I/O operation if the parse_name +// cannot be parsed. +// +// The function takes the following parameters: +// +// - parseName: file name or path to be parsed. +// +// The function returns the following values: +// +// - file: new #GFile. +func FileParseName(parseName string) *File { + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(parseName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_parse_name(_arg1) + runtime.KeepAlive(parseName) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// Icon: GIcon is a very minimal interface for icons. It provides functions for +// checking the equality of two icons, hashing of icons and serializing an icon +// to and from strings. +// +// GIcon does not provide the actual pixmap for the icon as this is out of GIO's +// scope, however implementations of GIcon may contain the name of an icon (see +// gio.ThemedIcon), or the path to an icon (see gio.LoadableIcon). +// +// To obtain a hash of a GIcon, see gio.Icon.Hash(). +// +// To check if two GIcons are equal, see gio.Icon.Equal(). +// +// For serializing a GIcon, use gio.Icon.Serialize() and gio.Icon().Deserialize. +// +// If you want to consume GIcon (for example, in a toolkit) you +// must be prepared to handle at least the three following cases: +// gio.LoadableIcon, gio.ThemedIcon and gio.EmblemedIcon. It may also +// make sense to have fast-paths for other cases (like handling GdkPixbuf +// (https://docs.gtk.org/gdk-pixbuf/class.Pixbuf.html) directly, for example) +// but all compliant GIcon implementations outside of GIO must implement +// gio.LoadableIcon. +// +// If your application or library provides one or more GIcon implementations you +// need to ensure that your new implementation also implements gio.LoadableIcon. +// Additionally, you must provide an implementation of gio.Icon.Serialize() that +// gives a result that is understood by gio.Icon().Deserialize, yielding one of +// the built-in icon types. +// +// Icon wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Icon struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Icon)(nil) +) + +// Iconner describes Icon's interface methods. +type Iconner interface { + coreglib.Objector + + // Equal checks if two icons are equal. + Equal(icon2 Iconner) bool + // Hash gets a hash for an icon. + Hash() uint + // Serialize serializes a #GIcon into a #GVariant. + Serialize() *glib.Variant + // String generates a textual representation of icon that can be used for + // serialization such as when passing icon to a different process or saving + // it to persistent storage. + String() string +} + +var _ Iconner = (*Icon)(nil) + +func wrapIcon(obj *coreglib.Object) *Icon { + return &Icon{ + Object: obj, + } +} + +func marshalIcon(p uintptr) (interface{}, error) { + return wrapIcon(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Equal checks if two icons are equal. +// +// The function takes the following parameters: +// +// - icon2 (optional): pointer to the second #GIcon. +// +// The function returns the following values: +// +// - ok: TRUE if icon1 is equal to icon2. FALSE otherwise. +func (icon1 *Icon) Equal(icon2 Iconner) bool { + var _arg0 *C.GIcon // out + var _arg1 *C.GIcon // out + var _cret C.gboolean // in + + if icon1 != nil { + _arg0 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon1).Native())) + } + if icon2 != nil { + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon2).Native())) + } + + _cret = C.g_icon_equal(_arg0, _arg1) + runtime.KeepAlive(icon1) + runtime.KeepAlive(icon2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Hash gets a hash for an icon. +// +// The function returns the following values: +// +// - guint containing a hash for the icon, suitable for use in a Table or +// similar data structure. +func (icon *Icon) Hash() uint { + var _arg0 C.gconstpointer // out + var _cret C.guint // in + + _arg0 = *(*C.gconstpointer)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + _cret = C.g_icon_hash(_arg0) + runtime.KeepAlive(icon) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Serialize serializes a #GIcon into a #GVariant. An equivalent #GIcon can +// be retrieved back by calling g_icon_deserialize() on the returned value. +// As serialization will avoid using raw icon data when possible, it only makes +// sense to transfer the #GVariant between processes on the same machine, +// (as opposed to over the network), and within the same file system namespace. +// +// The function returns the following values: +// +// - variant (optional) or NULL when serialization fails. The #GVariant will +// not be floating. +func (icon *Icon) Serialize() *glib.Variant { + var _arg0 *C.GIcon // out + var _cret *C.GVariant // in + + _arg0 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + _cret = C.g_icon_serialize(_arg0) + runtime.KeepAlive(icon) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// String generates a textual representation of icon that can be used for +// serialization such as when passing icon to a different process or saving it +// to persistent storage. Use g_icon_new_for_string() to get icon back from the +// returned string. +// +// The encoding of the returned string is proprietary to #GIcon except in the +// following two cases +// +// - If icon is a Icon, the returned string is a native path (such as +// /path/to/my icon.png) without escaping if the #GFile for icon is a native +// file. If the file is not native, the returned string is the result of +// g_file_get_uri() (such as sftp://path/to/my20icon.png). +// +// - If icon is a Icon with exactly one name and no fallbacks, the encoding is +// simply the name (such as network-server). +// +// The function returns the following values: +// +// - utf8 (optional): allocated NUL-terminated UTF8 string or NULL if icon +// can't be serialized. Use g_free() to free. +func (icon *Icon) String() string { + var _arg0 *C.GIcon // out + var _cret *C.gchar // in + + _arg0 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + _cret = C.g_icon_to_string(_arg0) + runtime.KeepAlive(icon) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Equal checks if two icons are equal. +// +// The function takes the following parameters: +// +// - icon2 (optional): pointer to the second #GIcon. +// +// The function returns the following values: +// +// - ok: TRUE if icon1 is equal to icon2. FALSE otherwise. +func (icon1 *Icon) equal(icon2 Iconner) bool { + gclass := (*C.GIconIface)(coreglib.PeekParentClass(icon1)) + fnarg := gclass.equal + + var _arg0 *C.GIcon // out + var _arg1 *C.GIcon // out + var _cret C.gboolean // in + + if icon1 != nil { + _arg0 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon1).Native())) + } + if icon2 != nil { + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon2).Native())) + } + + _cret = C._gotk4_gio2_Icon_virtual_equal(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(icon1) + runtime.KeepAlive(icon2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Hash gets a hash for an icon. +// +// The function returns the following values: +// +// - guint containing a hash for the icon, suitable for use in a Table or +// similar data structure. +func (icon *Icon) hash() uint { + gclass := (*C.GIconIface)(coreglib.PeekParentClass(icon)) + fnarg := gclass.hash + + var _arg0 *C.GIcon // out + var _cret C.guint // in + + _arg0 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + _cret = C._gotk4_gio2_Icon_virtual_hash(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(icon) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Serialize serializes a #GIcon into a #GVariant. An equivalent #GIcon can +// be retrieved back by calling g_icon_deserialize() on the returned value. +// As serialization will avoid using raw icon data when possible, it only makes +// sense to transfer the #GVariant between processes on the same machine, +// (as opposed to over the network), and within the same file system namespace. +// +// The function returns the following values: +// +// - variant (optional) or NULL when serialization fails. The #GVariant will +// not be floating. +func (icon *Icon) serialize() *glib.Variant { + gclass := (*C.GIconIface)(coreglib.PeekParentClass(icon)) + fnarg := gclass.serialize + + var _arg0 *C.GIcon // out + var _cret *C.GVariant // in + + _arg0 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + _cret = C._gotk4_gio2_Icon_virtual_serialize(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(icon) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// IconDeserialize deserializes a #GIcon previously serialized using +// g_icon_serialize(). +// +// The function takes the following parameters: +// +// - value created with g_icon_serialize(). +// +// The function returns the following values: +// +// - icon (optional) or NULL when deserialization fails. +func IconDeserialize(value *glib.Variant) *Icon { + var _arg1 *C.GVariant // out + var _cret *C.GIcon // in + + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_icon_deserialize(_arg1) + runtime.KeepAlive(value) + + var _icon *Icon // out + + if _cret != nil { + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _icon +} + +// NewIconForString: generate a #GIcon instance from str. This function can fail +// if str is not valid - see g_icon_to_string() for discussion. +// +// If your application or library provides one or more #GIcon implementations +// you need to ensure that each #GType is registered with the type system prior +// to calling g_icon_new_for_string(). +// +// The function takes the following parameters: +// +// - str: string obtained via g_icon_to_string(). +// +// The function returns the following values: +// +// - icon: object implementing the #GIcon interface or NULL if error is set. +func NewIconForString(str string) (*Icon, error) { + var _arg1 *C.gchar // out + var _cret *C.GIcon // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_icon_new_for_string(_arg1, &_cerr) + runtime.KeepAlive(str) + + var _icon *Icon // out + var _goerr error // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _icon, _goerr +} + +// Initable: GInitable is implemented by objects that can fail during +// initialization. If an object implements this interface then it must +// be initialized as the first thing after construction, either via +// gio.Initable.Init() or gio.AsyncInitable.InitAsync() (the latter is only +// available if it also implements gio.AsyncInitable). +// +// If the object is not initialized, or initialization returns with an error, +// then all operations on the object except g_object_ref() and g_object_unref() +// are considered to be invalid, and have undefined behaviour. They will often +// fail with glib.Critical() or glib.Warning(), but this must not be relied on. +// +// Users of objects implementing this are not intended to use the interface +// method directly, instead it will be used automatically in various ways. +// For C applications you generally just call gio.Initable().New directly, or +// indirectly via a foo_thing_new() wrapper. This will call gio.Initable.Init() +// under the cover, returning NULL and setting a GError on failure (at which +// point the instance is unreferenced). +// +// For bindings in languages where the native constructor supports exceptions +// the binding could check for objects implementing GInitable during normal +// construction and automatically initialize them, throwing an exception on +// failure. +// +// Initable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Initable struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Initable)(nil) +) + +// Initabler describes Initable's interface methods. +type Initabler interface { + coreglib.Objector + + // Init initializes the object implementing the interface. + Init(ctx context.Context) error +} + +var _ Initabler = (*Initable)(nil) + +func wrapInitable(obj *coreglib.Object) *Initable { + return &Initable{ + Object: obj, + } +} + +func marshalInitable(p uintptr) (interface{}, error) { + return wrapInitable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Init initializes the object implementing the interface. +// +// This method is intended for language bindings. If writing in C, +// g_initable_new() should typically be used instead. +// +// The object must be initialized before any real use after initial +// construction, either with this function or g_async_initable_init_async(). +// +// Implementations may also support cancellation. If cancellable is not NULL, +// then initialization can be cancelled by triggering the cancellable +// object from another thread. If the operation was cancelled, the error +// G_IO_ERROR_CANCELLED will be returned. If cancellable is not NULL +// and the object doesn't support cancellable initialization the error +// G_IO_ERROR_NOT_SUPPORTED will be returned. +// +// If the object is not initialized, or initialization returns with an error, +// then all operations on the object except g_object_ref() and g_object_unref() +// are considered to be invalid, and have undefined behaviour. See the +// [introduction][ginitable] for more details. +// +// Callers should not assume that a class which implements #GInitable can be +// initialized multiple times, unless the class explicitly documents itself as +// supporting this. Generally, a class’ implementation of init() can assume (and +// assert) that it will only be called once. Previously, this documentation +// recommended all #GInitable implementations should be idempotent; that +// recommendation was relaxed in GLib 2.54. +// +// If a class explicitly supports being initialized multiple times, it is +// recommended that the method is idempotent: multiple calls with the same +// arguments should return the same results. Only the first call initializes the +// object; further calls return the result of the first call. +// +// One reason why a class might need to support idempotent initialization is if +// it is designed to be used via the singleton pattern, with a Class.constructor +// that sometimes returns an existing instance. In this pattern, a caller would +// expect to be able to call g_initable_init() on the result of g_object_new(), +// regardless of whether it is in fact a new instance. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (initable *Initable) Init(ctx context.Context) error { + var _arg0 *C.GInitable // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GInitable)(unsafe.Pointer(coreglib.InternObject(initable).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_initable_init(_arg0, _arg1, &_cerr) + runtime.KeepAlive(initable) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Init initializes the object implementing the interface. +// +// This method is intended for language bindings. If writing in C, +// g_initable_new() should typically be used instead. +// +// The object must be initialized before any real use after initial +// construction, either with this function or g_async_initable_init_async(). +// +// Implementations may also support cancellation. If cancellable is not NULL, +// then initialization can be cancelled by triggering the cancellable +// object from another thread. If the operation was cancelled, the error +// G_IO_ERROR_CANCELLED will be returned. If cancellable is not NULL +// and the object doesn't support cancellable initialization the error +// G_IO_ERROR_NOT_SUPPORTED will be returned. +// +// If the object is not initialized, or initialization returns with an error, +// then all operations on the object except g_object_ref() and g_object_unref() +// are considered to be invalid, and have undefined behaviour. See the +// [introduction][ginitable] for more details. +// +// Callers should not assume that a class which implements #GInitable can be +// initialized multiple times, unless the class explicitly documents itself as +// supporting this. Generally, a class’ implementation of init() can assume (and +// assert) that it will only be called once. Previously, this documentation +// recommended all #GInitable implementations should be idempotent; that +// recommendation was relaxed in GLib 2.54. +// +// If a class explicitly supports being initialized multiple times, it is +// recommended that the method is idempotent: multiple calls with the same +// arguments should return the same results. Only the first call initializes the +// object; further calls return the result of the first call. +// +// One reason why a class might need to support idempotent initialization is if +// it is designed to be used via the singleton pattern, with a Class.constructor +// that sometimes returns an existing instance. In this pattern, a caller would +// expect to be able to call g_initable_init() on the result of g_object_new(), +// regardless of whether it is in fact a new instance. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (initable *Initable) init(ctx context.Context) error { + gclass := (*C.GInitableIface)(coreglib.PeekParentClass(initable)) + fnarg := gclass.init + + var _arg0 *C.GInitable // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GInitable)(unsafe.Pointer(coreglib.InternObject(initable).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_Initable_virtual_init(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(initable) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ListModel: GListModel is an interface that represents a mutable list of +// gobject.Object. Its main intention is as a model for various widgets in user +// interfaces, such as list views, but it can also be used as a convenient +// method of returning lists of data, with support for updates. +// +// Each object in the list may also report changes in itself via some mechanism +// (normally the gobject.Object::notify signal). Taken together with the +// gio.ListModel::items-changed signal, this provides for a list that can +// change its membership, and in which the members can change their individual +// properties. +// +// A good example would be the list of visible wireless network access points, +// where each access point can report dynamic properties such as signal +// strength. +// +// It is important to note that the GListModel itself does not report changes +// to the individual items. It only reports changes to the list membership. +// If you want to observe changes to the objects themselves then you need to +// connect signals to the objects that you are interested in. +// +// All items in a GListModel are of (or derived from) the same type. +// gio.ListModel.GetItemType() returns that type. The type may be an interface, +// in which case all objects in the list must implement it. +// +// The semantics are close to that of an array: gio.ListModel.GetNItems() +// returns the number of items in the list and gio.ListModel.GetItem() returns +// an item at a (0-based) position. In order to allow implementations to +// calculate the list length lazily, you can also iterate over items: starting +// from 0, repeatedly call gio.ListModel.GetItem() until it returns NULL. +// +// An implementation may create objects lazily, but must take care to return the +// same object for a given position until all references to it are gone. +// +// On the other side, a consumer is expected only to hold references on objects +// that are currently ‘user visible’, in order to facilitate the maximum level +// of laziness in the implementation of the list and to reduce the required +// number of signal connections at a given time. +// +// This interface is intended only to be used from a single thread. +// The thread in which it is appropriate to use it depends on the particular +// implementation, but typically it will be from the thread that owns the +// thread-default main context (see glib.MainContext.PushThreadDefault()) in +// effect at the time that the model was created. +// +// Over time, it has established itself as good practice for list model +// implementations to provide properties item-type and n-items to ease +// working with them. While it is not required, it is recommended that +// implementations provide these two properties. They should return the values +// of gio.ListModel.GetItemType() and gio.ListModel.GetNItems() respectively and +// be defined as such: +// +// properties[PROP_ITEM_TYPE] = +// g_param_spec_gtype ("item-type", NULL, NULL, G_TYPE_OBJECT, +// G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); +// properties[PROP_N_ITEMS] = +// g_param_spec_uint ("n-items", NULL, NULL, 0, G_MAXUINT, 0, +// G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);. +// +// ListModel wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type ListModel struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ListModel)(nil) +) + +// ListModeller describes ListModel's interface methods. +type ListModeller interface { + coreglib.Objector + + // ItemType gets the type of the items in list. + ItemType() coreglib.Type + // NItems gets the number of items in list. + NItems() uint + // Item: get the item at position. + Item(position uint) *coreglib.Object + // ItemsChanged emits the Model::items-changed signal on list. + ItemsChanged(position, removed, added uint) + + // Items-changed: this signal is emitted whenever items were added to or + // removed from list. + ConnectItemsChanged(func(position, removed, added uint)) coreglib.SignalHandle +} + +var _ ListModeller = (*ListModel)(nil) + +func wrapListModel(obj *coreglib.Object) *ListModel { + return &ListModel{ + Object: obj, + } +} + +func marshalListModel(p uintptr) (interface{}, error) { + return wrapListModel(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectItemsChanged: this signal is emitted whenever items were added to or +// removed from list. At position, removed items were removed and added items +// were added in their place. +// +// Note: If removed != added, the positions of all later items in the model +// change. +func (list *ListModel) ConnectItemsChanged(f func(position, removed, added uint)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(list, "items-changed", false, unsafe.Pointer(C._gotk4_gio2_ListModel_ConnectItemsChanged), f) +} + +// ItemType gets the type of the items in list. +// +// All items returned from g_list_model_get_item() are of the type returned +// by this function, or a subtype, or if the type is an interface, they are an +// implementation of that interface. +// +// The item type of a Model can not change during the life of the model. +// +// The function returns the following values: +// +// - gType of the items contained in list. +func (list *ListModel) ItemType() coreglib.Type { + var _arg0 *C.GListModel // out + var _cret C.GType // in + + _arg0 = (*C.GListModel)(unsafe.Pointer(coreglib.InternObject(list).Native())) + + _cret = C.g_list_model_get_item_type(_arg0) + runtime.KeepAlive(list) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// NItems gets the number of items in list. +// +// Depending on the model implementation, calling this function may be less +// efficient than iterating the list with increasing values for position until +// g_list_model_get_item() returns NULL. +// +// The function returns the following values: +// +// - guint: number of items in list. +func (list *ListModel) NItems() uint { + var _arg0 *C.GListModel // out + var _cret C.guint // in + + _arg0 = (*C.GListModel)(unsafe.Pointer(coreglib.InternObject(list).Native())) + + _cret = C.g_list_model_get_n_items(_arg0) + runtime.KeepAlive(list) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Item: get the item at position. +// +// If position is greater than the number of items in list, NULL is returned. +// +// NULL is never returned for an index that is smaller than the length of the +// list. +// +// This function is meant to be used by language bindings in place of +// g_list_model_get_item(). +// +// See also: g_list_model_get_n_items(). +// +// The function takes the following parameters: +// +// - position of the item to fetch. +// +// The function returns the following values: +// +// - object (optional) at position. +func (list *ListModel) Item(position uint) *coreglib.Object { + var _arg0 *C.GListModel // out + var _arg1 C.guint // out + var _cret *C.GObject // in + + _arg0 = (*C.GListModel)(unsafe.Pointer(coreglib.InternObject(list).Native())) + _arg1 = C.guint(position) + + _cret = C.g_list_model_get_object(_arg0, _arg1) + runtime.KeepAlive(list) + runtime.KeepAlive(position) + + var _object *coreglib.Object // out + + if _cret != nil { + _object = coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + } + + return _object +} + +// ItemsChanged emits the Model::items-changed signal on list. +// +// This function should only be called by classes implementing Model. It has to +// be called after the internal representation of list has been updated, because +// handlers connected to this signal might query the new state of the list. +// +// Implementations must only make changes to the model (as visible to its +// consumer) in places that will not cause problems for that consumer. +// For models that are driven directly by a write API (such as Store), changes +// can be reported in response to uses of that API. For models that represent +// remote data, changes should only be made from a fresh mainloop dispatch. +// It is particularly not permitted to make changes in response to a call to the +// Model consumer API. +// +// Stated another way: in general, it is assumed that code making a series +// of accesses to the model via the API, without returning to the mainloop, +// and without calling other code, will continue to view the same contents of +// the model. +// +// The function takes the following parameters: +// +// - position at which list changed. +// - removed: number of items removed. +// - added: number of items added. +func (list *ListModel) ItemsChanged(position, removed, added uint) { + var _arg0 *C.GListModel // out + var _arg1 C.guint // out + var _arg2 C.guint // out + var _arg3 C.guint // out + + _arg0 = (*C.GListModel)(unsafe.Pointer(coreglib.InternObject(list).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(removed) + _arg3 = C.guint(added) + + C.g_list_model_items_changed(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(list) + runtime.KeepAlive(position) + runtime.KeepAlive(removed) + runtime.KeepAlive(added) +} + +// Item: get the item at position. If position is greater than the number of +// items in list, NULL is returned. +// +// NULL is never returned for an index that is smaller than the length of the +// list. See g_list_model_get_n_items(). +// +// The same #GObject instance may not appear more than once in a Model. +// +// The function takes the following parameters: +// +// - position of the item to fetch. +// +// The function returns the following values: +// +// - object (optional) at position. +func (list *ListModel) item(position uint) *coreglib.Object { + gclass := (*C.GListModelInterface)(coreglib.PeekParentClass(list)) + fnarg := gclass.get_item + + var _arg0 *C.GListModel // out + var _arg1 C.guint // out + var _cret C.gpointer // in + + _arg0 = (*C.GListModel)(unsafe.Pointer(coreglib.InternObject(list).Native())) + _arg1 = C.guint(position) + + _cret = C._gotk4_gio2_ListModel_virtual_get_item(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(list) + runtime.KeepAlive(position) + + var _object *coreglib.Object // out + + _object = coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + + return _object +} + +// itemType gets the type of the items in list. +// +// All items returned from g_list_model_get_item() are of the type returned +// by this function, or a subtype, or if the type is an interface, they are an +// implementation of that interface. +// +// The item type of a Model can not change during the life of the model. +// +// The function returns the following values: +// +// - gType of the items contained in list. +func (list *ListModel) itemType() coreglib.Type { + gclass := (*C.GListModelInterface)(coreglib.PeekParentClass(list)) + fnarg := gclass.get_item_type + + var _arg0 *C.GListModel // out + var _cret C.GType // in + + _arg0 = (*C.GListModel)(unsafe.Pointer(coreglib.InternObject(list).Native())) + + _cret = C._gotk4_gio2_ListModel_virtual_get_item_type(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(list) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// nItems gets the number of items in list. +// +// Depending on the model implementation, calling this function may be less +// efficient than iterating the list with increasing values for position until +// g_list_model_get_item() returns NULL. +// +// The function returns the following values: +// +// - guint: number of items in list. +func (list *ListModel) nItems() uint { + gclass := (*C.GListModelInterface)(coreglib.PeekParentClass(list)) + fnarg := gclass.get_n_items + + var _arg0 *C.GListModel // out + var _cret C.guint // in + + _arg0 = (*C.GListModel)(unsafe.Pointer(coreglib.InternObject(list).Native())) + + _cret = C._gotk4_gio2_ListModel_virtual_get_n_items(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(list) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// LoadableIcon: GLoadableIcon extends the gio.Icon interface and adds the +// ability to load icons from streams. +// +// LoadableIcon wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type LoadableIcon struct { + _ [0]func() // equal guard + Icon +} + +var () + +// LoadableIconner describes LoadableIcon's interface methods. +type LoadableIconner interface { + coreglib.Objector + + // Load loads a loadable icon. + Load(ctx context.Context, size int) (string, InputStreamer, error) + // LoadAsync loads an icon asynchronously. + LoadAsync(ctx context.Context, size int, callback AsyncReadyCallback) + // LoadFinish finishes an asynchronous icon load started in + // g_loadable_icon_load_async(). + LoadFinish(res AsyncResulter) (string, InputStreamer, error) +} + +var _ LoadableIconner = (*LoadableIcon)(nil) + +func wrapLoadableIcon(obj *coreglib.Object) *LoadableIcon { + return &LoadableIcon{ + Icon: Icon{ + Object: obj, + }, + } +} + +func marshalLoadableIcon(p uintptr) (interface{}, error) { + return wrapLoadableIcon(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Load loads a loadable icon. For the asynchronous version of this function, +// see g_loadable_icon_load_async(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - size: integer. +// +// The function returns the following values: +// +// - typ (optional): location to store the type of the loaded icon, NULL to +// ignore. +// - inputStream to read the icon from. +func (icon *LoadableIcon) Load(ctx context.Context, size int) (string, InputStreamer, error) { + var _arg0 *C.GLoadableIcon // out + var _arg3 *C.GCancellable // out + var _arg1 C.int // out + var _arg2 *C.char // in + var _cret *C.GInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GLoadableIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(size) + + _cret = C.g_loadable_icon_load(_arg0, _arg1, &_arg2, _arg3, &_cerr) + runtime.KeepAlive(icon) + runtime.KeepAlive(ctx) + runtime.KeepAlive(size) + + var _typ string // out + var _inputStream InputStreamer // out + var _goerr error // out + + if _arg2 != nil { + _typ = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _typ, _inputStream, _goerr +} + +// LoadAsync loads an icon asynchronously. To finish this function, see +// g_loadable_icon_load_finish(). For the synchronous, blocking version of this +// function, see g_loadable_icon_load(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - size: integer. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (icon *LoadableIcon) LoadAsync(ctx context.Context, size int, callback AsyncReadyCallback) { + var _arg0 *C.GLoadableIcon // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GLoadableIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(size) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_loadable_icon_load_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(icon) + runtime.KeepAlive(ctx) + runtime.KeepAlive(size) + runtime.KeepAlive(callback) +} + +// LoadFinish finishes an asynchronous icon load started in +// g_loadable_icon_load_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - typ (optional): location to store the type of the loaded icon, NULL to +// ignore. +// - inputStream to read the icon from. +func (icon *LoadableIcon) LoadFinish(res AsyncResulter) (string, InputStreamer, error) { + var _arg0 *C.GLoadableIcon // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.char // in + var _cret *C.GInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GLoadableIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_loadable_icon_load_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(icon) + runtime.KeepAlive(res) + + var _typ string // out + var _inputStream InputStreamer // out + var _goerr error // out + + if _arg2 != nil { + _typ = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _typ, _inputStream, _goerr +} + +// Load loads a loadable icon. For the asynchronous version of this function, +// see g_loadable_icon_load_async(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - size: integer. +// +// The function returns the following values: +// +// - typ (optional): location to store the type of the loaded icon, NULL to +// ignore. +// - inputStream to read the icon from. +func (icon *LoadableIcon) load(ctx context.Context, size int) (string, InputStreamer, error) { + gclass := (*C.GLoadableIconIface)(coreglib.PeekParentClass(icon)) + fnarg := gclass.load + + var _arg0 *C.GLoadableIcon // out + var _arg3 *C.GCancellable // out + var _arg1 C.int // out + var _arg2 *C.char // in + var _cret *C.GInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GLoadableIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(size) + + _cret = C._gotk4_gio2_LoadableIcon_virtual_load(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2, _arg3, &_cerr) + runtime.KeepAlive(icon) + runtime.KeepAlive(ctx) + runtime.KeepAlive(size) + + var _typ string // out + var _inputStream InputStreamer // out + var _goerr error // out + + if _arg2 != nil { + _typ = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _typ, _inputStream, _goerr +} + +// loadAsync loads an icon asynchronously. To finish this function, see +// g_loadable_icon_load_finish(). For the synchronous, blocking version of this +// function, see g_loadable_icon_load(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - size: integer. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (icon *LoadableIcon) loadAsync(ctx context.Context, size int, callback AsyncReadyCallback) { + gclass := (*C.GLoadableIconIface)(coreglib.PeekParentClass(icon)) + fnarg := gclass.load_async + + var _arg0 *C.GLoadableIcon // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GLoadableIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(size) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_LoadableIcon_virtual_load_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(icon) + runtime.KeepAlive(ctx) + runtime.KeepAlive(size) + runtime.KeepAlive(callback) +} + +// loadFinish finishes an asynchronous icon load started in +// g_loadable_icon_load_async(). +// +// The function takes the following parameters: +// +// - res: Result. +// +// The function returns the following values: +// +// - typ (optional): location to store the type of the loaded icon, NULL to +// ignore. +// - inputStream to read the icon from. +func (icon *LoadableIcon) loadFinish(res AsyncResulter) (string, InputStreamer, error) { + gclass := (*C.GLoadableIconIface)(coreglib.PeekParentClass(icon)) + fnarg := gclass.load_finish + + var _arg0 *C.GLoadableIcon // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.char // in + var _cret *C.GInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GLoadableIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C._gotk4_gio2_LoadableIcon_virtual_load_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(icon) + runtime.KeepAlive(res) + + var _typ string // out + var _inputStream InputStreamer // out + var _goerr error // out + + if _arg2 != nil { + _typ = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _typ, _inputStream, _goerr +} + +// MemoryMonitor: GMemoryMonitor will monitor system memory and suggest +// to the application when to free memory so as to leave more room for +// other applications. It is implemented on Linux using the Low Memory +// Monitor (https://gitlab.freedesktop.org/hadess/low-memory-monitor/) (API +// documentation (https://hadess.pages.freedesktop.org/low-memory-monitor/)). +// +// There is also an implementation for use inside Flatpak sandboxes. +// +// Possible actions to take when the signal is received are: +// +// - Free caches +// - Save files that haven’t been looked at in a while to disk, ready to be +// reopened when needed +// - Run a garbage collection cycle +// - Try and compress fragmented allocations +// - Exit on idle if the process has no reason to stay around +// - Call malloc_trim(3) (man:malloc_trim(3)) to return cached heap pages to +// the kernel (if supported by your libc) +// +// Note that some actions may not always improve system performance, +// and so should be profiled for your application. malloc_trim(), for example, +// may make future heap allocations slower (due to releasing cached heap pages +// back to the kernel). +// +// See gio.MemoryMonitorWarningLevel for details on the various warning levels. +// +// static void +// warning_cb (GMemoryMonitor *m, GMemoryMonitorWarningLevel level) +// { +// g_debug ("Warning level: d", level); +// if (warning_level > G_MEMORY_MONITOR_WARNING_LEVEL_LOW) +// drop_caches (); +// } +// +// static GMemoryMonitor * +// monitor_low_memory (void) +// { +// GMemoryMonitor *m; +// m = g_memory_monitor_dup_default (); +// g_signal_connect (G_OBJECT (m), "low-memory-warning", +// G_CALLBACK (warning_cb), NULL); +// return m; +// } +// +// Don’t forget to disconnect the gio.MemoryMonitor::low-memory-warning signal, +// and unref the GMemoryMonitor itself when exiting. +// +// MemoryMonitor wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type MemoryMonitor struct { + _ [0]func() // equal guard + Initable +} + +var () + +// MemoryMonitorrer describes MemoryMonitor's interface methods. +type MemoryMonitorrer interface { + coreglib.Objector + + baseMemoryMonitor() *MemoryMonitor +} + +var _ MemoryMonitorrer = (*MemoryMonitor)(nil) + +func wrapMemoryMonitor(obj *coreglib.Object) *MemoryMonitor { + return &MemoryMonitor{ + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalMemoryMonitor(p uintptr) (interface{}, error) { + return wrapMemoryMonitor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *MemoryMonitor) baseMemoryMonitor() *MemoryMonitor { + return v +} + +// BaseMemoryMonitor returns the underlying base object. +func BaseMemoryMonitor(obj MemoryMonitorrer) *MemoryMonitor { + return obj.baseMemoryMonitor() +} + +// ConnectLowMemoryWarning is emitted when the system is running low on free +// memory. The signal handler should then take the appropriate action depending +// on the warning level. See the MonitorWarningLevel documentation for details. +func (v *MemoryMonitor) ConnectLowMemoryWarning(f func(level MemoryMonitorWarningLevel)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(v, "low-memory-warning", false, unsafe.Pointer(C._gotk4_gio2_MemoryMonitor_ConnectLowMemoryWarning), f) +} + +// lowMemoryWarning: virtual function pointer for the +// Monitor::low-memory-warning signal. +func (monitor *MemoryMonitor) lowMemoryWarning(level MemoryMonitorWarningLevel) { + gclass := (*C.GMemoryMonitorInterface)(coreglib.PeekParentClass(monitor)) + fnarg := gclass.low_memory_warning + + var _arg0 *C.GMemoryMonitor // out + var _arg1 C.GMemoryMonitorWarningLevel // out + + _arg0 = (*C.GMemoryMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + _arg1 = C.GMemoryMonitorWarningLevel(level) + + C._gotk4_gio2_MemoryMonitor_virtual_low_memory_warning(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(monitor) + runtime.KeepAlive(level) +} + +// MemoryMonitorDupDefault gets a reference to the default Monitor for the +// system. +// +// The function returns the following values: +// +// - memoryMonitor: new reference to the default Monitor. +func MemoryMonitorDupDefault() *MemoryMonitor { + var _cret *C.GMemoryMonitor // in + + _cret = C.g_memory_monitor_dup_default() + + var _memoryMonitor *MemoryMonitor // out + + _memoryMonitor = wrapMemoryMonitor(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _memoryMonitor +} + +// Mount: GMount interface represents user-visible mounts. Note, when porting +// from GnomeVFS (migrating-gnome-vfs.html), GMount is the moral equivalent of +// GnomeVFSVolume. +// +// GMount is a ‘mounted’ filesystem that you can access. Mounted is in quotes +// because it’s not the same as a UNIX mount, it might be a GVFS mount, +// but you can still access the files on it if you use GIO. Might or might not +// be related to a volume object. +// +// Unmounting a GMount instance is an asynchronous operation. For more +// information about asynchronous operations, see gio.AsyncResult and gio.Task. +// To unmount a GMount instance, first call gio.Mount.UnmountWithOperation() +// with (at least) the GMount instance and a gio.AsyncReadyCallback. The +// callback will be fired when the operation has resolved (either with success +// or failure), and a gio.AsyncResult structure will be passed to the callback. +// That callback should then call gio.Mount.UnmountWithOperationFinish() +// with the GMount and the gio.AsyncResult data to see if the +// operation was completed successfully. If an error is present when +// gio.Mount.UnmountWithOperationFinish() is called, then it will be filled with +// any error information. +// +// Mount wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Mount struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Mount)(nil) +) + +// Mounter describes Mount's interface methods. +type Mounter interface { + coreglib.Objector + + // CanEject checks if mount can be ejected. + CanEject() bool + // CanUnmount checks if mount can be unmounted. + CanUnmount() bool + // Eject ejects a mount. + Eject(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) + // EjectFinish finishes ejecting a mount. + EjectFinish(result AsyncResulter) error + // EjectWithOperation ejects a mount. + EjectWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // EjectWithOperationFinish finishes ejecting a mount. + EjectWithOperationFinish(result AsyncResulter) error + // DefaultLocation gets the default location of mount. + DefaultLocation() *File + // Drive gets the drive for the mount. + Drive() *Drive + // Icon gets the icon for mount. + Icon() *Icon + // Name gets the name of mount. + Name() string + // Root gets the root directory on mount. + Root() *File + // SortKey gets the sort key for mount, if any. + SortKey() string + // SymbolicIcon gets the symbolic icon for mount. + SymbolicIcon() *Icon + // UUID gets the UUID for the mount. + UUID() string + // Volume gets the volume for the mount. + Volume() *Volume + // GuessContentType tries to guess the type of content stored on mount. + GuessContentType(ctx context.Context, forceRescan bool, callback AsyncReadyCallback) + // GuessContentTypeFinish finishes guessing content types of mount. + GuessContentTypeFinish(result AsyncResulter) ([]string, error) + // GuessContentTypeSync tries to guess the type of content stored on mount. + GuessContentTypeSync(ctx context.Context, forceRescan bool) ([]string, error) + // IsShadowed determines if mount is shadowed. + IsShadowed() bool + // Remount remounts a mount. + Remount(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // RemountFinish finishes remounting a mount. + RemountFinish(result AsyncResulter) error + // Shadow increments the shadow count on mount. + Shadow() + // Unmount unmounts a mount. + Unmount(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) + // UnmountFinish finishes unmounting a mount. + UnmountFinish(result AsyncResulter) error + // UnmountWithOperation unmounts a mount. + UnmountWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // UnmountWithOperationFinish finishes unmounting a mount. + UnmountWithOperationFinish(result AsyncResulter) error + // Unshadow decrements the shadow count on mount. + Unshadow() + + // Changed is emitted when the mount has been changed. + ConnectChanged(func()) coreglib.SignalHandle + // Pre-unmount: this signal may be emitted when the #GMount is about to be + // unmounted. + ConnectPreUnmount(func()) coreglib.SignalHandle + // Unmounted: this signal is emitted when the #GMount have been unmounted. + ConnectUnmounted(func()) coreglib.SignalHandle +} + +var _ Mounter = (*Mount)(nil) + +func wrapMount(obj *coreglib.Object) *Mount { + return &Mount{ + Object: obj, + } +} + +func marshalMount(p uintptr) (interface{}, error) { + return wrapMount(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectChanged is emitted when the mount has been changed. +func (mount *Mount) ConnectChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(mount, "changed", false, unsafe.Pointer(C._gotk4_gio2_Mount_ConnectChanged), f) +} + +// ConnectPreUnmount: this signal may be emitted when the #GMount is about to be +// unmounted. +// +// This signal depends on the backend and is only emitted if GIO was used to +// unmount. +func (mount *Mount) ConnectPreUnmount(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(mount, "pre-unmount", false, unsafe.Pointer(C._gotk4_gio2_Mount_ConnectPreUnmount), f) +} + +// ConnectUnmounted: this signal is emitted when the #GMount have been +// unmounted. If the recipient is holding references to the object they should +// release them so the object can be finalized. +func (mount *Mount) ConnectUnmounted(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(mount, "unmounted", false, unsafe.Pointer(C._gotk4_gio2_Mount_ConnectUnmounted), f) +} + +// CanEject checks if mount can be ejected. +// +// The function returns the following values: +// +// - ok: TRUE if the mount can be ejected. +func (mount *Mount) CanEject() bool { + var _arg0 *C.GMount // out + var _cret C.gboolean // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_can_eject(_arg0) + runtime.KeepAlive(mount) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanUnmount checks if mount can be unmounted. +// +// The function returns the following values: +// +// - ok: TRUE if the mount can be unmounted. +func (mount *Mount) CanUnmount() bool { + var _arg0 *C.GMount // out + var _cret C.gboolean // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_can_unmount(_arg0) + runtime.KeepAlive(mount) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Eject ejects a mount. This is an asynchronous operation, and is finished by +// calling g_mount_eject_finish() with the mount and Result data returned in the +// callback. +// +// Deprecated: Use g_mount_eject_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - callback (optional) or NULL. +func (mount *Mount) Eject(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + var _arg0 *C.GMount // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_mount_eject(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// EjectFinish finishes ejecting a mount. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// Deprecated: Use g_mount_eject_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) EjectFinish(result AsyncResulter) error { + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_mount_eject_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// EjectWithOperation ejects a mount. This is an asynchronous operation, and is +// finished by calling g_mount_eject_with_operation_finish() with the mount and +// Result data returned in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (mount *Mount) EjectWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GMount // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_mount_eject_with_operation(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// EjectWithOperationFinish finishes ejecting a mount. If any errors occurred +// during the operation, error will be set to contain the errors and FALSE will +// be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) EjectWithOperationFinish(result AsyncResulter) error { + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_mount_eject_with_operation_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// DefaultLocation gets the default location of mount. The default location of +// the given mount is a path that reflects the main entry point for the user +// (e.g. the home directory, or the root of the volume). +// +// The function returns the following values: +// +// - file: #GFile. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (mount *Mount) DefaultLocation() *File { + var _arg0 *C.GMount // out + var _cret *C.GFile // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_get_default_location(_arg0) + runtime.KeepAlive(mount) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// Drive gets the drive for the mount. +// +// This is a convenience method for getting the #GVolume and then using that +// object to get the #GDrive. +// +// The function returns the following values: +// +// - drive (optional) or NULL if mount is not associated with a volume or a +// drive. The returned object should be unreffed with g_object_unref() when +// no longer needed. +func (mount *Mount) Drive() *Drive { + var _arg0 *C.GMount // out + var _cret *C.GDrive // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_get_drive(_arg0) + runtime.KeepAlive(mount) + + var _drive *Drive // out + + if _cret != nil { + _drive = wrapDrive(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _drive +} + +// Icon gets the icon for mount. +// +// The function returns the following values: +// +// - icon: #GIcon. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (mount *Mount) Icon() *Icon { + var _arg0 *C.GMount // out + var _cret *C.GIcon // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_get_icon(_arg0) + runtime.KeepAlive(mount) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// Name gets the name of mount. +// +// The function returns the following values: +// +// - utf8: name for the given mount. The returned string should be freed with +// g_free() when no longer needed. +func (mount *Mount) Name() string { + var _arg0 *C.GMount // out + var _cret *C.char // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_get_name(_arg0) + runtime.KeepAlive(mount) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Root gets the root directory on mount. +// +// The function returns the following values: +// +// - file: #GFile. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (mount *Mount) Root() *File { + var _arg0 *C.GMount // out + var _cret *C.GFile // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_get_root(_arg0) + runtime.KeepAlive(mount) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// SortKey gets the sort key for mount, if any. +// +// The function returns the following values: +// +// - utf8 (optional): sorting key for mount or NULL if no such key is +// available. +func (mount *Mount) SortKey() string { + var _arg0 *C.GMount // out + var _cret *C.gchar // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_get_sort_key(_arg0) + runtime.KeepAlive(mount) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// SymbolicIcon gets the symbolic icon for mount. +// +// The function returns the following values: +// +// - icon: #GIcon. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (mount *Mount) SymbolicIcon() *Icon { + var _arg0 *C.GMount // out + var _cret *C.GIcon // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_get_symbolic_icon(_arg0) + runtime.KeepAlive(mount) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// UUID gets the UUID for the mount. The reference is typically based on the +// file system UUID for the mount in question and should be considered an opaque +// string. Returns NULL if there is no UUID available. +// +// The function returns the following values: +// +// - utf8 (optional): UUID for mount or NULL if no UUID can be computed. +// The returned string should be freed with g_free() when no longer needed. +func (mount *Mount) UUID() string { + var _arg0 *C.GMount // out + var _cret *C.char // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_get_uuid(_arg0) + runtime.KeepAlive(mount) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Volume gets the volume for the mount. +// +// The function returns the following values: +// +// - volume (optional) or NULL if mount is not associated with a volume. +// The returned object should be unreffed with g_object_unref() when no +// longer needed. +func (mount *Mount) Volume() *Volume { + var _arg0 *C.GMount // out + var _cret *C.GVolume // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_get_volume(_arg0) + runtime.KeepAlive(mount) + + var _volume *Volume // out + + if _cret != nil { + _volume = wrapVolume(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _volume +} + +// GuessContentType tries to guess the type of content stored on +// mount. Returns one or more textual identifiers of well-known +// content types (typically prefixed with "x-content/"), e.g. +// x-content/image-dcf for camera memory cards. See the shared-mime-info +// (http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec) +// specification for more on x-content types. +// +// This is an asynchronous operation (see g_mount_guess_content_type_sync() +// for the synchronous version), and is finished by calling +// g_mount_guess_content_type_finish() with the mount and Result data returned +// in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - forceRescan: whether to force a rescan of the content. Otherwise a cached +// result will be used if available. +// - callback (optional): ReadyCallback. +func (mount *Mount) GuessContentType(ctx context.Context, forceRescan bool, callback AsyncReadyCallback) { + var _arg0 *C.GMount // out + var _arg2 *C.GCancellable // out + var _arg1 C.gboolean // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if forceRescan { + _arg1 = C.TRUE + } + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_mount_guess_content_type(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(forceRescan) + runtime.KeepAlive(callback) +} + +// GuessContentTypeFinish finishes guessing content types of mount. +// If any errors occurred during the operation, error will be set to contain +// the errors and FALSE will be returned. In particular, you may get an +// G_IO_ERROR_NOT_SUPPORTED if the mount does not support content guessing. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of content types or NULL on error. Caller +// should free this array with g_strfreev() when done with it. +func (mount *Mount) GuessContentTypeFinish(result AsyncResulter) ([]string, error) { + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cret **C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_mount_guess_content_type_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// GuessContentTypeSync tries to guess the type of content stored +// on mount. Returns one or more textual identifiers of well-known +// content types (typically prefixed with "x-content/"), e.g. +// x-content/image-dcf for camera memory cards. See the shared-mime-info +// (http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec) +// specification for more on x-content types. +// +// This is a synchronous operation and as such may block doing IO; see +// g_mount_guess_content_type() for the asynchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - forceRescan: whether to force a rescan of the content. Otherwise a cached +// result will be used if available. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of content types or NULL on error. Caller +// should free this array with g_strfreev() when done with it. +func (mount *Mount) GuessContentTypeSync(ctx context.Context, forceRescan bool) ([]string, error) { + var _arg0 *C.GMount // out + var _arg2 *C.GCancellable // out + var _arg1 C.gboolean // out + var _cret **C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if forceRescan { + _arg1 = C.TRUE + } + + _cret = C.g_mount_guess_content_type_sync(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(forceRescan) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// IsShadowed determines if mount is shadowed. Applications or libraries should +// avoid displaying mount in the user interface if it is shadowed. +// +// A mount is said to be shadowed if there exists one or more user visible +// objects (currently #GMount objects) with a root that is inside the root of +// mount. +// +// One application of shadow mounts is when exposing a single file system +// that is used to address several logical volumes. In this situation, +// a Monitor implementation would create two #GVolume objects (for example, +// one for the camera functionality of the device and one for a SD card reader +// on the device) with activation URIs gphoto2://[usb:001,002]/store1/ and +// gphoto2://[usb:001,002]/store2/. When the underlying mount (with root +// gphoto2://[usb:001,002]/) is mounted, said Monitor implementation would +// create two #GMount objects (each with their root matching the corresponding +// volume activation root) that would shadow the original mount. +// +// The proxy monitor in GVfs 2.26 and later, automatically creates and manage +// shadow mounts (and shadows the underlying mount) if the activation root on a +// #GVolume is set. +// +// The function returns the following values: +// +// - ok: TRUE if mount is shadowed. +func (mount *Mount) IsShadowed() bool { + var _arg0 *C.GMount // out + var _cret C.gboolean // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_mount_is_shadowed(_arg0) + runtime.KeepAlive(mount) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Remount remounts a mount. This is an asynchronous operation, and is finished +// by calling g_mount_remount_finish() with the mount and Results data returned +// in the callback. +// +// Remounting is useful when some setting affecting the operation of the volume +// has been changed, as these may need a remount to take affect. While this is +// semantically equivalent with unmounting and then remounting not all backends +// might need to actually be unmounted. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (mount *Mount) Remount(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GMount // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountMountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountMountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_mount_remount(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// RemountFinish finishes remounting a mount. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) RemountFinish(result AsyncResulter) error { + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_mount_remount_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Shadow increments the shadow count on mount. Usually used by +// Monitor implementations when creating a shadow mount for mount, see +// g_mount_is_shadowed() for more information. The caller will need to emit the +// #GMount::changed signal on mount manually. +func (mount *Mount) Shadow() { + var _arg0 *C.GMount // out + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + C.g_mount_shadow(_arg0) + runtime.KeepAlive(mount) +} + +// Unmount unmounts a mount. This is an asynchronous operation, and is finished +// by calling g_mount_unmount_finish() with the mount and Result data returned +// in the callback. +// +// Deprecated: Use g_mount_unmount_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - callback (optional) or NULL. +func (mount *Mount) Unmount(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + var _arg0 *C.GMount // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_mount_unmount(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// UnmountFinish finishes unmounting a mount. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// Deprecated: Use g_mount_unmount_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) UnmountFinish(result AsyncResulter) error { + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_mount_unmount_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// UnmountWithOperation unmounts a mount. This is an asynchronous operation, +// and is finished by calling g_mount_unmount_with_operation_finish() with the +// mount and Result data returned in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (mount *Mount) UnmountWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GMount // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_mount_unmount_with_operation(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// UnmountWithOperationFinish finishes unmounting a mount. If any errors +// occurred during the operation, error will be set to contain the errors and +// FALSE will be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) UnmountWithOperationFinish(result AsyncResulter) error { + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_mount_unmount_with_operation_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Unshadow decrements the shadow count on mount. Usually used by +// Monitor implementations when destroying a shadow mount for mount, see +// g_mount_is_shadowed() for more information. The caller will need to emit the +// #GMount::changed signal on mount manually. +func (mount *Mount) Unshadow() { + var _arg0 *C.GMount // out + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + C.g_mount_unshadow(_arg0) + runtime.KeepAlive(mount) +} + +// canEject checks if mount can be ejected. +// +// The function returns the following values: +// +// - ok: TRUE if the mount can be ejected. +func (mount *Mount) canEject() bool { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.can_eject + + var _arg0 *C.GMount // out + var _cret C.gboolean // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_can_eject(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canUnmount checks if mount can be unmounted. +// +// The function returns the following values: +// +// - ok: TRUE if the mount can be unmounted. +func (mount *Mount) canUnmount() bool { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.can_unmount + + var _arg0 *C.GMount // out + var _cret C.gboolean // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_can_unmount(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Changed: changed signal that is emitted when the mount's state has changed. +func (mount *Mount) changed() { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.changed + + var _arg0 *C.GMount // out + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + C._gotk4_gio2_Mount_virtual_changed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) +} + +// Eject ejects a mount. This is an asynchronous operation, and is finished by +// calling g_mount_eject_finish() with the mount and Result data returned in the +// callback. +// +// Deprecated: Use g_mount_eject_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - callback (optional) or NULL. +func (mount *Mount) eject(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.eject + + var _arg0 *C.GMount // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Mount_virtual_eject(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// ejectFinish finishes ejecting a mount. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// Deprecated: Use g_mount_eject_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) ejectFinish(result AsyncResulter) error { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.eject_finish + + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Mount_virtual_eject_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ejectWithOperation ejects a mount. This is an asynchronous operation, and is +// finished by calling g_mount_eject_with_operation_finish() with the mount and +// Result data returned in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (mount *Mount) ejectWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.eject_with_operation + + var _arg0 *C.GMount // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Mount_virtual_eject_with_operation(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// ejectWithOperationFinish finishes ejecting a mount. If any errors occurred +// during the operation, error will be set to contain the errors and FALSE will +// be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) ejectWithOperationFinish(result AsyncResulter) error { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.eject_with_operation_finish + + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Mount_virtual_eject_with_operation_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// defaultLocation gets the default location of mount. The default location of +// the given mount is a path that reflects the main entry point for the user +// (e.g. the home directory, or the root of the volume). +// +// The function returns the following values: +// +// - file: #GFile. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (mount *Mount) defaultLocation() *File { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.get_default_location + + var _arg0 *C.GMount // out + var _cret *C.GFile // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_get_default_location(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// Drive gets the drive for the mount. +// +// This is a convenience method for getting the #GVolume and then using that +// object to get the #GDrive. +// +// The function returns the following values: +// +// - drive (optional) or NULL if mount is not associated with a volume or a +// drive. The returned object should be unreffed with g_object_unref() when +// no longer needed. +func (mount *Mount) drive() *Drive { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.get_drive + + var _arg0 *C.GMount // out + var _cret *C.GDrive // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_get_drive(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _drive *Drive // out + + if _cret != nil { + _drive = wrapDrive(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _drive +} + +// Icon gets the icon for mount. +// +// The function returns the following values: +// +// - icon: #GIcon. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (mount *Mount) icon() *Icon { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.get_icon + + var _arg0 *C.GMount // out + var _cret *C.GIcon // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_get_icon(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// Name gets the name of mount. +// +// The function returns the following values: +// +// - utf8: name for the given mount. The returned string should be freed with +// g_free() when no longer needed. +func (mount *Mount) name() string { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.get_name + + var _arg0 *C.GMount // out + var _cret *C.char // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_get_name(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Root gets the root directory on mount. +// +// The function returns the following values: +// +// - file: #GFile. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (mount *Mount) root() *File { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.get_root + + var _arg0 *C.GMount // out + var _cret *C.GFile // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_get_root(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// sortKey gets the sort key for mount, if any. +// +// The function returns the following values: +// +// - utf8 (optional): sorting key for mount or NULL if no such key is +// available. +func (mount *Mount) sortKey() string { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.get_sort_key + + var _arg0 *C.GMount // out + var _cret *C.gchar // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_get_sort_key(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// symbolicIcon gets the symbolic icon for mount. +// +// The function returns the following values: +// +// - icon: #GIcon. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (mount *Mount) symbolicIcon() *Icon { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.get_symbolic_icon + + var _arg0 *C.GMount // out + var _cret *C.GIcon // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_get_symbolic_icon(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// uuiD gets the UUID for the mount. The reference is typically based on the +// file system UUID for the mount in question and should be considered an opaque +// string. Returns NULL if there is no UUID available. +// +// The function returns the following values: +// +// - utf8 (optional): UUID for mount or NULL if no UUID can be computed. +// The returned string should be freed with g_free() when no longer needed. +func (mount *Mount) uuiD() string { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.get_uuid + + var _arg0 *C.GMount // out + var _cret *C.char // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_get_uuid(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Volume gets the volume for the mount. +// +// The function returns the following values: +// +// - volume (optional) or NULL if mount is not associated with a volume. +// The returned object should be unreffed with g_object_unref() when no +// longer needed. +func (mount *Mount) volume() *Volume { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.get_volume + + var _arg0 *C.GMount // out + var _cret *C.GVolume // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_get_volume(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) + + var _volume *Volume // out + + if _cret != nil { + _volume = wrapVolume(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _volume +} + +// guessContentType tries to guess the type of content stored on +// mount. Returns one or more textual identifiers of well-known +// content types (typically prefixed with "x-content/"), e.g. +// x-content/image-dcf for camera memory cards. See the shared-mime-info +// (http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec) +// specification for more on x-content types. +// +// This is an asynchronous operation (see g_mount_guess_content_type_sync() +// for the synchronous version), and is finished by calling +// g_mount_guess_content_type_finish() with the mount and Result data returned +// in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - forceRescan: whether to force a rescan of the content. Otherwise a cached +// result will be used if available. +// - callback (optional): ReadyCallback. +func (mount *Mount) guessContentType(ctx context.Context, forceRescan bool, callback AsyncReadyCallback) { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.guess_content_type + + var _arg0 *C.GMount // out + var _arg2 *C.GCancellable // out + var _arg1 C.gboolean // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if forceRescan { + _arg1 = C.TRUE + } + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Mount_virtual_guess_content_type(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(forceRescan) + runtime.KeepAlive(callback) +} + +// guessContentTypeFinish finishes guessing content types of mount. +// If any errors occurred during the operation, error will be set to contain +// the errors and FALSE will be returned. In particular, you may get an +// G_IO_ERROR_NOT_SUPPORTED if the mount does not support content guessing. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of content types or NULL on error. Caller +// should free this array with g_strfreev() when done with it. +func (mount *Mount) guessContentTypeFinish(result AsyncResulter) ([]string, error) { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.guess_content_type_finish + + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cret **C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_Mount_virtual_guess_content_type_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// guessContentTypeSync tries to guess the type of content stored +// on mount. Returns one or more textual identifiers of well-known +// content types (typically prefixed with "x-content/"), e.g. +// x-content/image-dcf for camera memory cards. See the shared-mime-info +// (http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec) +// specification for more on x-content types. +// +// This is a synchronous operation and as such may block doing IO; see +// g_mount_guess_content_type() for the asynchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - forceRescan: whether to force a rescan of the content. Otherwise a cached +// result will be used if available. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of content types or NULL on error. Caller +// should free this array with g_strfreev() when done with it. +func (mount *Mount) guessContentTypeSync(ctx context.Context, forceRescan bool) ([]string, error) { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.guess_content_type_sync + + var _arg0 *C.GMount // out + var _arg2 *C.GCancellable // out + var _arg1 C.gboolean // out + var _cret **C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if forceRescan { + _arg1 = C.TRUE + } + + _cret = C._gotk4_gio2_Mount_virtual_guess_content_type_sync(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(forceRescan) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// preUnmount: ::pre-unmount signal that is emitted when the #GMount will soon +// be emitted. If the recipient is somehow holding the mount open by keeping an +// open file on it it should close the file. +func (mount *Mount) preUnmount() { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.pre_unmount + + var _arg0 *C.GMount // out + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + C._gotk4_gio2_Mount_virtual_pre_unmount(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) +} + +// Remount remounts a mount. This is an asynchronous operation, and is finished +// by calling g_mount_remount_finish() with the mount and Results data returned +// in the callback. +// +// Remounting is useful when some setting affecting the operation of the volume +// has been changed, as these may need a remount to take affect. While this is +// semantically equivalent with unmounting and then remounting not all backends +// might need to actually be unmounted. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (mount *Mount) remount(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.remount + + var _arg0 *C.GMount // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountMountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountMountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Mount_virtual_remount(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// remountFinish finishes remounting a mount. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) remountFinish(result AsyncResulter) error { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.remount_finish + + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Mount_virtual_remount_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Unmount unmounts a mount. This is an asynchronous operation, and is finished +// by calling g_mount_unmount_finish() with the mount and Result data returned +// in the callback. +// +// Deprecated: Use g_mount_unmount_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - callback (optional) or NULL. +func (mount *Mount) unmount(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.unmount + + var _arg0 *C.GMount // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Mount_virtual_unmount(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// unmountFinish finishes unmounting a mount. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// Deprecated: Use g_mount_unmount_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) unmountFinish(result AsyncResulter) error { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.unmount_finish + + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Mount_virtual_unmount_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// unmountWithOperation unmounts a mount. This is an asynchronous operation, +// and is finished by calling g_mount_unmount_with_operation_finish() with the +// mount and Result data returned in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (mount *Mount) unmountWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.unmount_with_operation + + var _arg0 *C.GMount // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Mount_virtual_unmount_with_operation(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(mount) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// unmountWithOperationFinish finishes unmounting a mount. If any errors +// occurred during the operation, error will be set to contain the errors and +// FALSE will be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (mount *Mount) unmountWithOperationFinish(result AsyncResulter) error { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.unmount_with_operation_finish + + var _arg0 *C.GMount // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Mount_virtual_unmount_with_operation_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(mount) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Unmounted signal that is emitted when the #GMount have been unmounted. +// If the recipient is holding references to the object they should release them +// so the object can be finalized. +func (mount *Mount) unmounted() { + gclass := (*C.GMountIface)(coreglib.PeekParentClass(mount)) + fnarg := gclass.unmounted + + var _arg0 *C.GMount // out + + _arg0 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + C._gotk4_gio2_Mount_virtual_unmounted(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(mount) +} + +// NetworkMonitor: GNetworkMonitor provides an easy-to-use cross-platform API +// for monitoring network connectivity. On Linux, the available implementations +// are based on the kernel's netlink interface and on NetworkManager. +// +// There is also an implementation for use inside Flatpak sandboxes. +// +// NetworkMonitor wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type NetworkMonitor struct { + _ [0]func() // equal guard + Initable +} + +var () + +// NetworkMonitorrer describes NetworkMonitor's interface methods. +type NetworkMonitorrer interface { + coreglib.Objector + + // CanReach attempts to determine whether or not the host pointed to by + // connectable can be reached, without actually trying to connect to it. + CanReach(ctx context.Context, connectable SocketConnectabler) error + // CanReachAsync: asynchronously attempts to determine whether or not the + // host pointed to by connectable can be reached, without actually trying to + // connect to it. + CanReachAsync(ctx context.Context, connectable SocketConnectabler, callback AsyncReadyCallback) + // CanReachFinish finishes an async network connectivity test. + CanReachFinish(result AsyncResulter) error + // Connectivity gets a more detailed networking state than + // g_network_monitor_get_network_available(). + Connectivity() NetworkConnectivity + // NetworkAvailable checks if the network is available. + NetworkAvailable() bool + // NetworkMetered checks if the network is metered. + NetworkMetered() bool + + // Network-changed is emitted when the network configuration changes. + ConnectNetworkChanged(func(networkAvailable bool)) coreglib.SignalHandle +} + +var _ NetworkMonitorrer = (*NetworkMonitor)(nil) + +func wrapNetworkMonitor(obj *coreglib.Object) *NetworkMonitor { + return &NetworkMonitor{ + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalNetworkMonitor(p uintptr) (interface{}, error) { + return wrapNetworkMonitor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectNetworkChanged is emitted when the network configuration changes. +func (monitor *NetworkMonitor) ConnectNetworkChanged(f func(networkAvailable bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(monitor, "network-changed", false, unsafe.Pointer(C._gotk4_gio2_NetworkMonitor_ConnectNetworkChanged), f) +} + +// CanReach attempts to determine whether or not the host pointed to by +// connectable can be reached, without actually trying to connect to it. +// +// This may return TRUE even when Monitor:network-available is FALSE, if, +// for example, monitor can determine that connectable refers to a host on a +// local network. +// +// If monitor believes that an attempt to connect to connectable will succeed, +// it will return TRUE. Otherwise, it will return FALSE and set error to an +// appropriate error (such as G_IO_ERROR_HOST_UNREACHABLE). +// +// Note that although this does not attempt to connect to connectable, +// it may still block for a brief period of time (eg, trying to do multicast +// DNS on the local network), so if you do not want to block, you should use +// g_network_monitor_can_reach_async(). +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - connectable: Connectable. +func (monitor *NetworkMonitor) CanReach(ctx context.Context, connectable SocketConnectabler) error { + var _arg0 *C.GNetworkMonitor // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GSocketConnectable // out + var _cerr *C.GError // in + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + + C.g_network_monitor_can_reach(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(monitor) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connectable) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CanReachAsync: asynchronously attempts to determine whether or not the host +// pointed to by connectable can be reached, without actually trying to connect +// to it. +// +// For more details, see g_network_monitor_can_reach(). +// +// When the operation is finished, callback will be called. You can then call +// g_network_monitor_can_reach_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - connectable: Connectable. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (monitor *NetworkMonitor) CanReachAsync(ctx context.Context, connectable SocketConnectabler, callback AsyncReadyCallback) { + var _arg0 *C.GNetworkMonitor // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GSocketConnectable // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_network_monitor_can_reach_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(monitor) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connectable) + runtime.KeepAlive(callback) +} + +// CanReachFinish finishes an async network connectivity test. See +// g_network_monitor_can_reach_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (monitor *NetworkMonitor) CanReachFinish(result AsyncResulter) error { + var _arg0 *C.GNetworkMonitor // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_network_monitor_can_reach_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(monitor) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Connectivity gets a more detailed networking state than +// g_network_monitor_get_network_available(). +// +// If Monitor:network-available is FALSE, then the connectivity state will be +// G_NETWORK_CONNECTIVITY_LOCAL. +// +// If Monitor:network-available is TRUE, then the connectivity state will +// be G_NETWORK_CONNECTIVITY_FULL (if there is full Internet connectivity), +// G_NETWORK_CONNECTIVITY_LIMITED (if the host has a default route, +// but appears to be unable to actually reach the full Internet), +// or G_NETWORK_CONNECTIVITY_PORTAL (if the host is trapped behind a "captive +// portal" that requires some sort of login or acknowledgement before allowing +// full Internet access). +// +// Note that in the case of G_NETWORK_CONNECTIVITY_LIMITED and +// G_NETWORK_CONNECTIVITY_PORTAL, it is possible that some sites are reachable +// but others are not. In this case, applications can attempt to connect to +// remote servers, but should gracefully fall back to their "offline" behavior +// if the connection attempt fails. +// +// The function returns the following values: +// +// - networkConnectivity: network connectivity state. +func (monitor *NetworkMonitor) Connectivity() NetworkConnectivity { + var _arg0 *C.GNetworkMonitor // out + var _cret C.GNetworkConnectivity // in + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.g_network_monitor_get_connectivity(_arg0) + runtime.KeepAlive(monitor) + + var _networkConnectivity NetworkConnectivity // out + + _networkConnectivity = NetworkConnectivity(_cret) + + return _networkConnectivity +} + +// NetworkAvailable checks if the network is available. "Available" here means +// that the system has a default route available for at least one of IPv4 or +// IPv6. It does not necessarily imply that the public Internet is reachable. +// See Monitor:network-available for more details. +// +// The function returns the following values: +// +// - ok: whether the network is available. +func (monitor *NetworkMonitor) NetworkAvailable() bool { + var _arg0 *C.GNetworkMonitor // out + var _cret C.gboolean // in + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.g_network_monitor_get_network_available(_arg0) + runtime.KeepAlive(monitor) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// NetworkMetered checks if the network is metered. See Monitor:network-metered +// for more details. +// +// The function returns the following values: +// +// - ok: whether the connection is metered. +func (monitor *NetworkMonitor) NetworkMetered() bool { + var _arg0 *C.GNetworkMonitor // out + var _cret C.gboolean // in + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.g_network_monitor_get_network_metered(_arg0) + runtime.KeepAlive(monitor) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canReach attempts to determine whether or not the host pointed to by +// connectable can be reached, without actually trying to connect to it. +// +// This may return TRUE even when Monitor:network-available is FALSE, if, +// for example, monitor can determine that connectable refers to a host on a +// local network. +// +// If monitor believes that an attempt to connect to connectable will succeed, +// it will return TRUE. Otherwise, it will return FALSE and set error to an +// appropriate error (such as G_IO_ERROR_HOST_UNREACHABLE). +// +// Note that although this does not attempt to connect to connectable, +// it may still block for a brief period of time (eg, trying to do multicast +// DNS on the local network), so if you do not want to block, you should use +// g_network_monitor_can_reach_async(). +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - connectable: Connectable. +func (monitor *NetworkMonitor) canReach(ctx context.Context, connectable SocketConnectabler) error { + gclass := (*C.GNetworkMonitorInterface)(coreglib.PeekParentClass(monitor)) + fnarg := gclass.can_reach + + var _arg0 *C.GNetworkMonitor // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GSocketConnectable // out + var _cerr *C.GError // in + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + + C._gotk4_gio2_NetworkMonitor_virtual_can_reach(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(monitor) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connectable) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// canReachAsync: asynchronously attempts to determine whether or not the host +// pointed to by connectable can be reached, without actually trying to connect +// to it. +// +// For more details, see g_network_monitor_can_reach(). +// +// When the operation is finished, callback will be called. You can then call +// g_network_monitor_can_reach_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - connectable: Connectable. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (monitor *NetworkMonitor) canReachAsync(ctx context.Context, connectable SocketConnectabler, callback AsyncReadyCallback) { + gclass := (*C.GNetworkMonitorInterface)(coreglib.PeekParentClass(monitor)) + fnarg := gclass.can_reach_async + + var _arg0 *C.GNetworkMonitor // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GSocketConnectable // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_NetworkMonitor_virtual_can_reach_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(monitor) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connectable) + runtime.KeepAlive(callback) +} + +// canReachFinish finishes an async network connectivity test. See +// g_network_monitor_can_reach_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (monitor *NetworkMonitor) canReachFinish(result AsyncResulter) error { + gclass := (*C.GNetworkMonitorInterface)(coreglib.PeekParentClass(monitor)) + fnarg := gclass.can_reach_finish + + var _arg0 *C.GNetworkMonitor // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_NetworkMonitor_virtual_can_reach_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(monitor) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// networkChanged: virtual function pointer for the +// GNetworkMonitor::network-changed signal. +func (monitor *NetworkMonitor) networkChanged(networkAvailable bool) { + gclass := (*C.GNetworkMonitorInterface)(coreglib.PeekParentClass(monitor)) + fnarg := gclass.network_changed + + var _arg0 *C.GNetworkMonitor // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GNetworkMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + if networkAvailable { + _arg1 = C.TRUE + } + + C._gotk4_gio2_NetworkMonitor_virtual_network_changed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(monitor) + runtime.KeepAlive(networkAvailable) +} + +// NetworkMonitorGetDefault gets the default Monitor for the system. +// +// The function returns the following values: +// +// - networkMonitor which will be a dummy object if no network monitor is +// available. +func NetworkMonitorGetDefault() *NetworkMonitor { + var _cret *C.GNetworkMonitor // in + + _cret = C.g_network_monitor_get_default() + + var _networkMonitor *NetworkMonitor // out + + _networkMonitor = wrapNetworkMonitor(coreglib.Take(unsafe.Pointer(_cret))) + + return _networkMonitor +} + +// PollableInputStream: GPollableInputStream is implemented by gio.InputStreams +// that can be polled for readiness to read. This can be used when interfacing +// with a non-GIO API that expects UNIX-file-descriptor-style asynchronous I/O +// rather than GIO-style. +// +// Some classes may implement GPollableInputStream but have only certain +// instances of that class be pollable. If gio.PollableInputStream.CanPoll() +// returns false, then the behavior of other GPollableInputStream methods is +// undefined. +// +// PollableInputStream wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type PollableInputStream struct { + _ [0]func() // equal guard + InputStream +} + +var ( + _ InputStreamer = (*PollableInputStream)(nil) +) + +// PollableInputStreamer describes PollableInputStream's interface methods. +type PollableInputStreamer interface { + coreglib.Objector + + // CanPoll checks if stream is actually pollable. + CanPoll() bool + // CreateSource creates a #GSource that triggers when stream can be read, + // or cancellable is triggered or an error occurs. + CreateSource(ctx context.Context) *glib.Source + // IsReadable checks if stream can be read. + IsReadable() bool + // ReadNonblocking attempts to read up to count bytes from stream into + // buffer, as with g_input_stream_read(). + ReadNonblocking(ctx context.Context, buffer []byte) (int, error) +} + +var _ PollableInputStreamer = (*PollableInputStream)(nil) + +func wrapPollableInputStream(obj *coreglib.Object) *PollableInputStream { + return &PollableInputStream{ + InputStream: InputStream{ + Object: obj, + }, + } +} + +func marshalPollableInputStream(p uintptr) (interface{}, error) { + return wrapPollableInputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// CanPoll checks if stream is actually pollable. Some classes may implement +// InputStream but have only certain instances of that class be pollable. +// If this method returns FALSE, then the behavior of other InputStream methods +// is undefined. +// +// For any given stream, the value returned by this method is constant; a stream +// cannot switch from pollable to non-pollable or vice versa. +// +// The function returns the following values: +// +// - ok: TRUE if stream is pollable, FALSE if not. +func (stream *PollableInputStream) CanPoll() bool { + var _arg0 *C.GPollableInputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GPollableInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_pollable_input_stream_can_poll(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CreateSource creates a #GSource that triggers when stream can be read, +// or cancellable is triggered or an error occurs. The callback on the source is +// of the SourceFunc type. +// +// As with g_pollable_input_stream_is_readable(), it is possible that the +// stream may not actually be readable even after the source triggers, +// so you should use g_pollable_input_stream_read_nonblocking() rather than +// g_input_stream_read() from the callback. +// +// The behaviour of this method is undefined if +// g_pollable_input_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// +// The function returns the following values: +// +// - source: new #GSource. +func (stream *PollableInputStream) CreateSource(ctx context.Context) *glib.Source { + var _arg0 *C.GPollableInputStream // out + var _arg1 *C.GCancellable // out + var _cret *C.GSource // in + + _arg0 = (*C.GPollableInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_pollable_input_stream_create_source(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _source *glib.Source // out + + _source = (*glib.Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// IsReadable checks if stream can be read. +// +// Note that some stream types may not be able to implement this 100% reliably, +// and it is possible that a call to g_input_stream_read() after this returns +// TRUE would still block. To guarantee non-blocking behavior, you should +// always use g_pollable_input_stream_read_nonblocking(), which will return a +// G_IO_ERROR_WOULD_BLOCK error rather than blocking. +// +// The behaviour of this method is undefined if +// g_pollable_input_stream_can_poll() returns FALSE for stream. +// +// The function returns the following values: +// +// - ok: TRUE if stream is readable, FALSE if not. If an error has occurred +// on stream, this will result in g_pollable_input_stream_is_readable() +// returning TRUE, and the next attempt to read will return the error. +func (stream *PollableInputStream) IsReadable() bool { + var _arg0 *C.GPollableInputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GPollableInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_pollable_input_stream_is_readable(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ReadNonblocking attempts to read up to count bytes from stream into buffer, +// as with g_input_stream_read(). If stream is not currently readable, +// this will immediately return G_IO_ERROR_WOULD_BLOCK, and you can use +// g_pollable_input_stream_create_source() to create a #GSource that will be +// triggered when stream is readable. +// +// Note that since this method never blocks, you cannot actually use cancellable +// to cancel it. However, it will return an error if cancellable has already +// been cancelled when you call, which may happen if you call this method after +// a source triggers due to having been cancelled. +// +// The behaviour of this method is undefined if +// g_pollable_input_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - buffer: a buffer to read data into (which should be at least count bytes +// long). +// +// The function returns the following values: +// +// - gssize: number of bytes read, or -1 on error (including +// G_IO_ERROR_WOULD_BLOCK). +func (stream *PollableInputStream) ReadNonblocking(ctx context.Context, buffer []byte) (int, error) { + var _arg0 *C.GPollableInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GPollableInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + + _cret = C.g_pollable_input_stream_read_nonblocking(_arg0, unsafe.Pointer(_arg1), _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// canPoll checks if stream is actually pollable. Some classes may implement +// InputStream but have only certain instances of that class be pollable. +// If this method returns FALSE, then the behavior of other InputStream methods +// is undefined. +// +// For any given stream, the value returned by this method is constant; a stream +// cannot switch from pollable to non-pollable or vice versa. +// +// The function returns the following values: +// +// - ok: TRUE if stream is pollable, FALSE if not. +func (stream *PollableInputStream) canPoll() bool { + gclass := (*C.GPollableInputStreamInterface)(coreglib.PeekParentClass(stream)) + fnarg := gclass.can_poll + + var _arg0 *C.GPollableInputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GPollableInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_PollableInputStream_virtual_can_poll(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// createSource creates a #GSource that triggers when stream can be read, +// or cancellable is triggered or an error occurs. The callback on the source is +// of the SourceFunc type. +// +// As with g_pollable_input_stream_is_readable(), it is possible that the +// stream may not actually be readable even after the source triggers, +// so you should use g_pollable_input_stream_read_nonblocking() rather than +// g_input_stream_read() from the callback. +// +// The behaviour of this method is undefined if +// g_pollable_input_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// +// The function returns the following values: +// +// - source: new #GSource. +func (stream *PollableInputStream) createSource(ctx context.Context) *glib.Source { + gclass := (*C.GPollableInputStreamInterface)(coreglib.PeekParentClass(stream)) + fnarg := gclass.create_source + + var _arg0 *C.GPollableInputStream // out + var _arg1 *C.GCancellable // out + var _cret *C.GSource // in + + _arg0 = (*C.GPollableInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C._gotk4_gio2_PollableInputStream_virtual_create_source(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _source *glib.Source // out + + _source = (*glib.Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// isReadable checks if stream can be read. +// +// Note that some stream types may not be able to implement this 100% reliably, +// and it is possible that a call to g_input_stream_read() after this returns +// TRUE would still block. To guarantee non-blocking behavior, you should +// always use g_pollable_input_stream_read_nonblocking(), which will return a +// G_IO_ERROR_WOULD_BLOCK error rather than blocking. +// +// The behaviour of this method is undefined if +// g_pollable_input_stream_can_poll() returns FALSE for stream. +// +// The function returns the following values: +// +// - ok: TRUE if stream is readable, FALSE if not. If an error has occurred +// on stream, this will result in g_pollable_input_stream_is_readable() +// returning TRUE, and the next attempt to read will return the error. +func (stream *PollableInputStream) isReadable() bool { + gclass := (*C.GPollableInputStreamInterface)(coreglib.PeekParentClass(stream)) + fnarg := gclass.is_readable + + var _arg0 *C.GPollableInputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GPollableInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_PollableInputStream_virtual_is_readable(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// readNonblocking attempts to read up to count bytes from stream into buffer, +// as with g_input_stream_read(). If stream is not currently readable, +// this will immediately return G_IO_ERROR_WOULD_BLOCK, and you can use +// g_pollable_input_stream_create_source() to create a #GSource that will be +// triggered when stream is readable. +// +// Note that since this method never blocks, you cannot actually use cancellable +// to cancel it. However, it will return an error if cancellable has already +// been cancelled when you call, which may happen if you call this method after +// a source triggers due to having been cancelled. +// +// The behaviour of this method is undefined if +// g_pollable_input_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - buffer (optional): a buffer to read data into (which should be at least +// count bytes long). +// +// The function returns the following values: +// +// - gssize: number of bytes read, or -1 on error (including +// G_IO_ERROR_WOULD_BLOCK). +func (stream *PollableInputStream) readNonblocking(buffer []byte) (int, error) { + gclass := (*C.GPollableInputStreamInterface)(coreglib.PeekParentClass(stream)) + fnarg := gclass.read_nonblocking + + var _arg0 *C.GPollableInputStream // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GPollableInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + + _cret = C._gotk4_gio2_PollableInputStream_virtual_read_nonblocking(unsafe.Pointer(fnarg), _arg0, unsafe.Pointer(_arg1), _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// PollableOutputStream: GPollableOutputStream is implemented by +// gio.OutputStreams that can be polled for readiness to write. This can be used +// when interfacing with a non-GIO API that expects UNIX-file-descriptor-style +// asynchronous I/O rather than GIO-style. +// +// Some classes may implement GPollableOutputStream but have only certain +// instances of that class be pollable. If gio.PollableOutputStream.CanPoll() +// returns false, then the behavior of other GPollableOutputStream methods is +// undefined. +// +// PollableOutputStream wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type PollableOutputStream struct { + _ [0]func() // equal guard + OutputStream +} + +var ( + _ OutputStreamer = (*PollableOutputStream)(nil) +) + +// PollableOutputStreamer describes PollableOutputStream's interface methods. +type PollableOutputStreamer interface { + coreglib.Objector + + // CanPoll checks if stream is actually pollable. + CanPoll() bool + // CreateSource creates a #GSource that triggers when stream can be written, + // or cancellable is triggered or an error occurs. + CreateSource(ctx context.Context) *glib.Source + // IsWritable checks if stream can be written. + IsWritable() bool + // WriteNonblocking attempts to write up to count bytes from buffer to + // stream, as with g_output_stream_write(). + WriteNonblocking(ctx context.Context, buffer []byte) (int, error) + // WritevNonblocking attempts to write the bytes contained in the n_vectors + // vectors to stream, as with g_output_stream_writev(). + WritevNonblocking(ctx context.Context, vectors []OutputVector) (uint, PollableReturn, error) +} + +var _ PollableOutputStreamer = (*PollableOutputStream)(nil) + +func wrapPollableOutputStream(obj *coreglib.Object) *PollableOutputStream { + return &PollableOutputStream{ + OutputStream: OutputStream{ + Object: obj, + }, + } +} + +func marshalPollableOutputStream(p uintptr) (interface{}, error) { + return wrapPollableOutputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// CanPoll checks if stream is actually pollable. Some classes may implement +// OutputStream but have only certain instances of that class be pollable. +// If this method returns FALSE, then the behavior of other OutputStream methods +// is undefined. +// +// For any given stream, the value returned by this method is constant; a stream +// cannot switch from pollable to non-pollable or vice versa. +// +// The function returns the following values: +// +// - ok: TRUE if stream is pollable, FALSE if not. +func (stream *PollableOutputStream) CanPoll() bool { + var _arg0 *C.GPollableOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_pollable_output_stream_can_poll(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CreateSource creates a #GSource that triggers when stream can be written, +// or cancellable is triggered or an error occurs. The callback on the source is +// of the SourceFunc type. +// +// As with g_pollable_output_stream_is_writable(), it is possible that the +// stream may not actually be writable even after the source triggers, +// so you should use g_pollable_output_stream_write_nonblocking() rather than +// g_output_stream_write() from the callback. +// +// The behaviour of this method is undefined if +// g_pollable_output_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// +// The function returns the following values: +// +// - source: new #GSource. +func (stream *PollableOutputStream) CreateSource(ctx context.Context) *glib.Source { + var _arg0 *C.GPollableOutputStream // out + var _arg1 *C.GCancellable // out + var _cret *C.GSource // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_pollable_output_stream_create_source(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _source *glib.Source // out + + _source = (*glib.Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// IsWritable checks if stream can be written. +// +// Note that some stream types may not be able to implement this 100% reliably, +// and it is possible that a call to g_output_stream_write() after this returns +// TRUE would still block. To guarantee non-blocking behavior, you should +// always use g_pollable_output_stream_write_nonblocking(), which will return a +// G_IO_ERROR_WOULD_BLOCK error rather than blocking. +// +// The behaviour of this method is undefined if +// g_pollable_output_stream_can_poll() returns FALSE for stream. +// +// The function returns the following values: +// +// - ok: TRUE if stream is writable, FALSE if not. If an error has occurred +// on stream, this will result in g_pollable_output_stream_is_writable() +// returning TRUE, and the next attempt to write will return the error. +func (stream *PollableOutputStream) IsWritable() bool { + var _arg0 *C.GPollableOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_pollable_output_stream_is_writable(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// WriteNonblocking attempts to write up to count bytes from buffer to stream, +// as with g_output_stream_write(). If stream is not currently writable, +// this will immediately return G_IO_ERROR_WOULD_BLOCK, and you can use +// g_pollable_output_stream_create_source() to create a #GSource that will be +// triggered when stream is writable. +// +// Note that since this method never blocks, you cannot actually use cancellable +// to cancel it. However, it will return an error if cancellable has already +// been cancelled when you call, which may happen if you call this method after +// a source triggers due to having been cancelled. +// +// Also note that if G_IO_ERROR_WOULD_BLOCK is returned some underlying +// transports like D/TLS require that you re-send the same buffer and count in +// the next write call. +// +// The behaviour of this method is undefined if +// g_pollable_output_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - buffer to write data from. +// +// The function returns the following values: +// +// - gssize: number of bytes written, or -1 on error (including +// G_IO_ERROR_WOULD_BLOCK). +func (stream *PollableOutputStream) WriteNonblocking(ctx context.Context, buffer []byte) (int, error) { + var _arg0 *C.GPollableOutputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + + _cret = C.g_pollable_output_stream_write_nonblocking(_arg0, unsafe.Pointer(_arg1), _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// WritevNonblocking attempts to write the bytes contained in the +// n_vectors vectors to stream, as with g_output_stream_writev(). +// If stream is not currently writable, this will immediately +// return G_POLLABLE_RETURN_WOULD_BLOCK, and you can use +// g_pollable_output_stream_create_source() to create a #GSource that will be +// triggered when stream is writable. error will *not* be set in that case. +// +// Note that since this method never blocks, you cannot actually use cancellable +// to cancel it. However, it will return an error if cancellable has already +// been cancelled when you call, which may happen if you call this method after +// a source triggers due to having been cancelled. +// +// Also note that if G_POLLABLE_RETURN_WOULD_BLOCK is returned some underlying +// transports like D/TLS require that you re-send the same vectors and n_vectors +// in the next write call. +// +// The behaviour of this method is undefined if +// g_pollable_output_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - vectors: buffer containing the Vectors to write. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that were +// written to the stream. +// - pollableReturn: G_POLLABLE_RETURN_OK on success, +// G_POLLABLE_RETURN_WOULD_BLOCK if the stream is not currently writable +// (and error is *not* set), or G_POLLABLE_RETURN_FAILED if there was an +// error in which case error will be set. +func (stream *PollableOutputStream) WritevNonblocking(ctx context.Context, vectors []OutputVector) (uint, PollableReturn, error) { + var _arg0 *C.GPollableOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GOutputVector // out + var _arg2 C.gsize + var _arg3 C.gsize // in + var _cret C.GPollableReturn // in + var _cerr *C.GError // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(vectors)) + _arg1 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg1), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + + _cret = C.g_pollable_output_stream_writev_nonblocking(_arg0, _arg1, _arg2, &_arg3, _arg4, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(vectors) + + var _bytesWritten uint // out + var _pollableReturn PollableReturn // out + var _goerr error // out + + _bytesWritten = uint(_arg3) + _pollableReturn = PollableReturn(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _pollableReturn, _goerr +} + +// canPoll checks if stream is actually pollable. Some classes may implement +// OutputStream but have only certain instances of that class be pollable. +// If this method returns FALSE, then the behavior of other OutputStream methods +// is undefined. +// +// For any given stream, the value returned by this method is constant; a stream +// cannot switch from pollable to non-pollable or vice versa. +// +// The function returns the following values: +// +// - ok: TRUE if stream is pollable, FALSE if not. +func (stream *PollableOutputStream) canPoll() bool { + gclass := (*C.GPollableOutputStreamInterface)(coreglib.PeekParentClass(stream)) + fnarg := gclass.can_poll + + var _arg0 *C.GPollableOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_PollableOutputStream_virtual_can_poll(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// createSource creates a #GSource that triggers when stream can be written, +// or cancellable is triggered or an error occurs. The callback on the source is +// of the SourceFunc type. +// +// As with g_pollable_output_stream_is_writable(), it is possible that the +// stream may not actually be writable even after the source triggers, +// so you should use g_pollable_output_stream_write_nonblocking() rather than +// g_output_stream_write() from the callback. +// +// The behaviour of this method is undefined if +// g_pollable_output_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// +// The function returns the following values: +// +// - source: new #GSource. +func (stream *PollableOutputStream) createSource(ctx context.Context) *glib.Source { + gclass := (*C.GPollableOutputStreamInterface)(coreglib.PeekParentClass(stream)) + fnarg := gclass.create_source + + var _arg0 *C.GPollableOutputStream // out + var _arg1 *C.GCancellable // out + var _cret *C.GSource // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C._gotk4_gio2_PollableOutputStream_virtual_create_source(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _source *glib.Source // out + + _source = (*glib.Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// isWritable checks if stream can be written. +// +// Note that some stream types may not be able to implement this 100% reliably, +// and it is possible that a call to g_output_stream_write() after this returns +// TRUE would still block. To guarantee non-blocking behavior, you should +// always use g_pollable_output_stream_write_nonblocking(), which will return a +// G_IO_ERROR_WOULD_BLOCK error rather than blocking. +// +// The behaviour of this method is undefined if +// g_pollable_output_stream_can_poll() returns FALSE for stream. +// +// The function returns the following values: +// +// - ok: TRUE if stream is writable, FALSE if not. If an error has occurred +// on stream, this will result in g_pollable_output_stream_is_writable() +// returning TRUE, and the next attempt to write will return the error. +func (stream *PollableOutputStream) isWritable() bool { + gclass := (*C.GPollableOutputStreamInterface)(coreglib.PeekParentClass(stream)) + fnarg := gclass.is_writable + + var _arg0 *C.GPollableOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_PollableOutputStream_virtual_is_writable(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// writeNonblocking attempts to write up to count bytes from buffer to stream, +// as with g_output_stream_write(). If stream is not currently writable, +// this will immediately return G_IO_ERROR_WOULD_BLOCK, and you can use +// g_pollable_output_stream_create_source() to create a #GSource that will be +// triggered when stream is writable. +// +// Note that since this method never blocks, you cannot actually use cancellable +// to cancel it. However, it will return an error if cancellable has already +// been cancelled when you call, which may happen if you call this method after +// a source triggers due to having been cancelled. +// +// Also note that if G_IO_ERROR_WOULD_BLOCK is returned some underlying +// transports like D/TLS require that you re-send the same buffer and count in +// the next write call. +// +// The behaviour of this method is undefined if +// g_pollable_output_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - buffer (optional) to write data from. +// +// The function returns the following values: +// +// - gssize: number of bytes written, or -1 on error (including +// G_IO_ERROR_WOULD_BLOCK). +func (stream *PollableOutputStream) writeNonblocking(buffer []byte) (int, error) { + gclass := (*C.GPollableOutputStreamInterface)(coreglib.PeekParentClass(stream)) + fnarg := gclass.write_nonblocking + + var _arg0 *C.GPollableOutputStream // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + + _cret = C._gotk4_gio2_PollableOutputStream_virtual_write_nonblocking(unsafe.Pointer(fnarg), _arg0, unsafe.Pointer(_arg1), _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// writevNonblocking attempts to write the bytes contained in the +// n_vectors vectors to stream, as with g_output_stream_writev(). +// If stream is not currently writable, this will immediately +// return G_POLLABLE_RETURN_WOULD_BLOCK, and you can use +// g_pollable_output_stream_create_source() to create a #GSource that will be +// triggered when stream is writable. error will *not* be set in that case. +// +// Note that since this method never blocks, you cannot actually use cancellable +// to cancel it. However, it will return an error if cancellable has already +// been cancelled when you call, which may happen if you call this method after +// a source triggers due to having been cancelled. +// +// Also note that if G_POLLABLE_RETURN_WOULD_BLOCK is returned some underlying +// transports like D/TLS require that you re-send the same vectors and n_vectors +// in the next write call. +// +// The behaviour of this method is undefined if +// g_pollable_output_stream_can_poll() returns FALSE for stream. +// +// The function takes the following parameters: +// +// - vectors: buffer containing the Vectors to write. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that were +// written to the stream. +// - pollableReturn: G_POLLABLE_RETURN_OK on success, +// G_POLLABLE_RETURN_WOULD_BLOCK if the stream is not currently writable +// (and error is *not* set), or G_POLLABLE_RETURN_FAILED if there was an +// error in which case error will be set. +func (stream *PollableOutputStream) writevNonblocking(vectors []OutputVector) (uint, PollableReturn, error) { + gclass := (*C.GPollableOutputStreamInterface)(coreglib.PeekParentClass(stream)) + fnarg := gclass.writev_nonblocking + + var _arg0 *C.GPollableOutputStream // out + var _arg1 *C.GOutputVector // out + var _arg2 C.gsize + var _arg3 C.gsize // in + var _cret C.GPollableReturn // in + var _cerr *C.GError // in + + _arg0 = (*C.GPollableOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg2 = (C.gsize)(len(vectors)) + _arg1 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg1), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + + _cret = C._gotk4_gio2_PollableOutputStream_virtual_writev_nonblocking(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(vectors) + + var _bytesWritten uint // out + var _pollableReturn PollableReturn // out + var _goerr error // out + + _bytesWritten = uint(_arg3) + _pollableReturn = PollableReturn(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _pollableReturn, _goerr +} + +// PowerProfileMonitorOverrider contains methods that are overridable. +type PowerProfileMonitorOverrider interface { +} + +// PowerProfileMonitor: GPowerProfileMonitor makes it possible for applications +// as well as OS components to monitor system power profiles and act upon them. +// It currently only exports whether the system is in “Power Saver” mode (known +// as “Low Power” mode on some systems). +// +// When in “Low Power” mode, it is recommended that applications: +// +// - disable automatic downloads; +// +// - reduce the rate of refresh from online sources such as calendar or email +// synchronisation; +// +// - reduce the use of expensive visual effects. +// +// It is also likely that OS components providing services to applications will +// lower their own background activity, for the sake of the system. +// +// There are a variety of tools that exist for power consumption analysis, +// but those usually depend on the OS and hardware used. On Linux, one could +// use upower to monitor the battery discharge rate, powertop to check on the +// background activity or activity at all), sysprof to inspect CPU usage, +// and intel_gpu_time to profile GPU usage. +// +// Don’t forget to disconnect the gobject.Object::notify signal +// for gio.PowerProfileMonitor:power-saver-enabled, and unref the +// GPowerProfileMonitor itself when exiting. +// +// PowerProfileMonitor wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type PowerProfileMonitor struct { + _ [0]func() // equal guard + Initable +} + +var () + +// PowerProfileMonitorrer describes PowerProfileMonitor's interface methods. +type PowerProfileMonitorrer interface { + coreglib.Objector + + // PowerSaverEnabled gets whether the system is in “Power Saver” mode. + PowerSaverEnabled() bool +} + +var _ PowerProfileMonitorrer = (*PowerProfileMonitor)(nil) + +func ifaceInitPowerProfileMonitorrer(gifacePtr, data C.gpointer) { +} + +func wrapPowerProfileMonitor(obj *coreglib.Object) *PowerProfileMonitor { + return &PowerProfileMonitor{ + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalPowerProfileMonitor(p uintptr) (interface{}, error) { + return wrapPowerProfileMonitor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// PowerSaverEnabled gets whether the system is in “Power Saver” mode. +// +// You are expected to listen to the ProfileMonitor::notify::power-saver-enabled +// signal to know when the profile has changed. +// +// The function returns the following values: +// +// - ok: whether the system is in “Power Saver” mode. +func (monitor *PowerProfileMonitor) PowerSaverEnabled() bool { + var _arg0 *C.GPowerProfileMonitor // out + var _cret C.gboolean // in + + _arg0 = (*C.GPowerProfileMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.g_power_profile_monitor_get_power_saver_enabled(_arg0) + runtime.KeepAlive(monitor) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PowerProfileMonitorDupDefault gets a reference to the default ProfileMonitor +// for the system. +// +// The function returns the following values: +// +// - powerProfileMonitor: new reference to the default ProfileMonitor. +func PowerProfileMonitorDupDefault() *PowerProfileMonitor { + var _cret *C.GPowerProfileMonitor // in + + _cret = C.g_power_profile_monitor_dup_default() + + var _powerProfileMonitor *PowerProfileMonitor // out + + _powerProfileMonitor = wrapPowerProfileMonitor(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _powerProfileMonitor +} + +// Proxy: GProxy handles connecting to a remote host via a given type of proxy +// server. It is implemented by the gio-proxy extension point. The extensions +// are named after their proxy protocol name. As an example, a SOCKS5 proxy +// implementation can be retrieved with the name socks5 using the function +// gio.IOExtensionPoint.GetExtensionByName(). +// +// Proxy wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Proxy struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Proxy)(nil) +) + +// Proxier describes Proxy's interface methods. +type Proxier interface { + coreglib.Objector + + // ConnectProxy: given connection to communicate with a proxy (eg, + // a Connection that is connected to the proxy server), this does the + // necessary handshake to connect to proxy_address, and if required, + // wraps the OStream to handle proxy payload. + ConnectProxy(ctx context.Context, connection IOStreamer, proxyAddress *ProxyAddress) (IOStreamer, error) + // ConnectAsync asynchronous version of g_proxy_connect(). + ConnectAsync(ctx context.Context, connection IOStreamer, proxyAddress *ProxyAddress, callback AsyncReadyCallback) + // ConnectFinish: see g_proxy_connect(). + ConnectFinish(result AsyncResulter) (IOStreamer, error) + // SupportsHostname: some proxy protocols expect to be passed a hostname, + // which they will resolve to an IP address themselves. + SupportsHostname() bool +} + +var _ Proxier = (*Proxy)(nil) + +func wrapProxy(obj *coreglib.Object) *Proxy { + return &Proxy{ + Object: obj, + } +} + +func marshalProxy(p uintptr) (interface{}, error) { + return wrapProxy(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectProxy: given connection to communicate with a proxy (eg, a Connection +// that is connected to the proxy server), this does the necessary handshake to +// connect to proxy_address, and if required, wraps the OStream to handle proxy +// payload. +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - connection: OStream. +// - proxyAddress: Address. +// +// The function returns the following values: +// +// - ioStream that will replace connection. This might be the same as +// connection, in which case a reference will be added. +func (proxy *Proxy) ConnectProxy(ctx context.Context, connection IOStreamer, proxyAddress *ProxyAddress) (IOStreamer, error) { + var _arg0 *C.GProxy // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GIOStream // out + var _arg2 *C.GProxyAddress // out + var _cret *C.GIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxyAddress).Native())) + + _cret = C.g_proxy_connect(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(proxy) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(proxyAddress) + + var _ioStream IOStreamer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _ioStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStream, _goerr +} + +// ConnectAsync asynchronous version of g_proxy_connect(). +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - connection: OStream. +// - proxyAddress: Address. +// - callback (optional): ReadyCallback. +func (proxy *Proxy) ConnectAsync(ctx context.Context, connection IOStreamer, proxyAddress *ProxyAddress, callback AsyncReadyCallback) { + var _arg0 *C.GProxy // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GIOStream // out + var _arg2 *C.GProxyAddress // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxyAddress).Native())) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_proxy_connect_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(proxy) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(proxyAddress) + runtime.KeepAlive(callback) +} + +// ConnectFinish: see g_proxy_connect(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - ioStream: OStream. +func (proxy *Proxy) ConnectFinish(result AsyncResulter) (IOStreamer, error) { + var _arg0 *C.GProxy // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_proxy_connect_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(proxy) + runtime.KeepAlive(result) + + var _ioStream IOStreamer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _ioStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStream, _goerr +} + +// SupportsHostname: some proxy protocols expect to be passed a hostname, +// which they will resolve to an IP address themselves. Others, like SOCKS4, do +// not allow this. This function will return FALSE if proxy is implementing such +// a protocol. When FALSE is returned, the caller should resolve the destination +// hostname first, and then pass a Address containing the stringified IP address +// to g_proxy_connect() or g_proxy_connect_async(). +// +// The function returns the following values: +// +// - ok: TRUE if hostname resolution is supported. +func (proxy *Proxy) SupportsHostname() bool { + var _arg0 *C.GProxy // out + var _cret C.gboolean // in + + _arg0 = (*C.GProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_proxy_supports_hostname(_arg0) + runtime.KeepAlive(proxy) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// connectProxy: given connection to communicate with a proxy (eg, a Connection +// that is connected to the proxy server), this does the necessary handshake to +// connect to proxy_address, and if required, wraps the OStream to handle proxy +// payload. +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - connection: OStream. +// - proxyAddress: Address. +// +// The function returns the following values: +// +// - ioStream that will replace connection. This might be the same as +// connection, in which case a reference will be added. +func (proxy *Proxy) connectProxy(ctx context.Context, connection IOStreamer, proxyAddress *ProxyAddress) (IOStreamer, error) { + gclass := (*C.GProxyInterface)(coreglib.PeekParentClass(proxy)) + fnarg := gclass.connect + + var _arg0 *C.GProxy // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GIOStream // out + var _arg2 *C.GProxyAddress // out + var _cret *C.GIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxyAddress).Native())) + + _cret = C._gotk4_gio2_Proxy_virtual_connect(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(proxy) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(proxyAddress) + + var _ioStream IOStreamer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _ioStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStream, _goerr +} + +// connectAsync asynchronous version of g_proxy_connect(). +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// - connection: OStream. +// - proxyAddress: Address. +// - callback (optional): ReadyCallback. +func (proxy *Proxy) connectAsync(ctx context.Context, connection IOStreamer, proxyAddress *ProxyAddress, callback AsyncReadyCallback) { + gclass := (*C.GProxyInterface)(coreglib.PeekParentClass(proxy)) + fnarg := gclass.connect_async + + var _arg0 *C.GProxy // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GIOStream // out + var _arg2 *C.GProxyAddress // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxyAddress).Native())) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Proxy_virtual_connect_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(proxy) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(proxyAddress) + runtime.KeepAlive(callback) +} + +// connectFinish: see g_proxy_connect(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - ioStream: OStream. +func (proxy *Proxy) connectFinish(result AsyncResulter) (IOStreamer, error) { + gclass := (*C.GProxyInterface)(coreglib.PeekParentClass(proxy)) + fnarg := gclass.connect_finish + + var _arg0 *C.GProxy // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GIOStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_Proxy_virtual_connect_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(proxy) + runtime.KeepAlive(result) + + var _ioStream IOStreamer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _ioStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStream, _goerr +} + +// supportsHostname: some proxy protocols expect to be passed a hostname, +// which they will resolve to an IP address themselves. Others, like SOCKS4, do +// not allow this. This function will return FALSE if proxy is implementing such +// a protocol. When FALSE is returned, the caller should resolve the destination +// hostname first, and then pass a Address containing the stringified IP address +// to g_proxy_connect() or g_proxy_connect_async(). +// +// The function returns the following values: +// +// - ok: TRUE if hostname resolution is supported. +func (proxy *Proxy) supportsHostname() bool { + gclass := (*C.GProxyInterface)(coreglib.PeekParentClass(proxy)) + fnarg := gclass.supports_hostname + + var _arg0 *C.GProxy // out + var _cret C.gboolean // in + + _arg0 = (*C.GProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C._gotk4_gio2_Proxy_virtual_supports_hostname(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(proxy) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ProxyGetDefaultForProtocol: find the gio-proxy extension point for a proxy +// implementation that supports the specified protocol. +// +// The function takes the following parameters: +// +// - protocol: proxy protocol name (e.g. http, socks, etc). +// +// The function returns the following values: +// +// - proxy (optional): return a #GProxy or NULL if protocol is not supported. +func ProxyGetDefaultForProtocol(protocol string) *Proxy { + var _arg1 *C.gchar // out + var _cret *C.GProxy // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(protocol))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_proxy_get_default_for_protocol(_arg1) + runtime.KeepAlive(protocol) + + var _proxy *Proxy // out + + if _cret != nil { + _proxy = wrapProxy(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _proxy +} + +// ProxyResolver: GProxyResolver provides synchronous and asynchronous network +// proxy resolution. GProxyResolver is used within gio.SocketClient through the +// method gio.SocketConnectable.ProxyEnumerate(). +// +// Implementations of GProxyResolver based on libproxy +// (https://github.com/libproxy/libproxy) and GNOME settings can be found in +// glib-networking (https://gitlab.gnome.org/GNOME/glib-networking). GIO comes +// with an implementation for use inside Flatpak portals. +// +// ProxyResolver wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type ProxyResolver struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ProxyResolver)(nil) +) + +// ProxyResolverer describes ProxyResolver's interface methods. +type ProxyResolverer interface { + coreglib.Objector + + // IsSupported checks if resolver can be used on this system. + IsSupported() bool + // Lookup looks into the system proxy configuration to determine what proxy, + // if any, to use to connect to uri. + Lookup(ctx context.Context, uri string) ([]string, error) + // LookupAsync asynchronous lookup of proxy. + LookupAsync(ctx context.Context, uri string, callback AsyncReadyCallback) + // LookupFinish: call this function to obtain the array of proxy URIs when + // g_proxy_resolver_lookup_async() is complete. + LookupFinish(result AsyncResulter) ([]string, error) +} + +var _ ProxyResolverer = (*ProxyResolver)(nil) + +func wrapProxyResolver(obj *coreglib.Object) *ProxyResolver { + return &ProxyResolver{ + Object: obj, + } +} + +func marshalProxyResolver(p uintptr) (interface{}, error) { + return wrapProxyResolver(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// IsSupported checks if resolver can be used on this system. (This is used +// internally; g_proxy_resolver_get_default() will only return a proxy resolver +// that returns TRUE for this method.). +// +// The function returns the following values: +// +// - ok: TRUE if resolver is supported. +func (resolver *ProxyResolver) IsSupported() bool { + var _arg0 *C.GProxyResolver // out + var _cret C.gboolean // in + + _arg0 = (*C.GProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + + _cret = C.g_proxy_resolver_is_supported(_arg0) + runtime.KeepAlive(resolver) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Lookup looks into the system proxy configuration to determine what proxy, +// if any, to use to connect to uri. The returned proxy URIs are of the form +// ://[user[:password]@]host[:port] or direct://, where +// could be http, rtsp, socks or other proxying protocol. +// +// If you don't know what network protocol is being used on the socket, +// you should use none as the URI protocol. In this case, the resolver might +// still return a generic proxy type (such as SOCKS), but would not return +// protocol-specific proxy types (such as http). +// +// direct:// is used when no proxy is needed. Direct connection should not be +// attempted unless it is part of the returned array of proxies. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - uri: URI representing the destination to connect to. +// +// The function returns the following values: +// +// - utf8s: a NULL-terminated array of proxy URIs. Must be freed with +// g_strfreev(). +func (resolver *ProxyResolver) Lookup(ctx context.Context, uri string) ([]string, error) { + var _arg0 *C.GProxyResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _cret **C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_proxy_resolver_lookup(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uri) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// LookupAsync asynchronous lookup of proxy. See g_proxy_resolver_lookup() for +// more details. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - uri: URI representing the destination to connect to. +// - callback (optional) to call after resolution completes. +func (resolver *ProxyResolver) LookupAsync(ctx context.Context, uri string, callback AsyncReadyCallback) { + var _arg0 *C.GProxyResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_proxy_resolver_lookup_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uri) + runtime.KeepAlive(callback) +} + +// LookupFinish: call this function to obtain the array of proxy URIs when +// g_proxy_resolver_lookup_async() is complete. See g_proxy_resolver_lookup() +// for more details. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - utf8s: a NULL-terminated array of proxy URIs. Must be freed with +// g_strfreev(). +func (resolver *ProxyResolver) LookupFinish(result AsyncResulter) ([]string, error) { + var _arg0 *C.GProxyResolver // out + var _arg1 *C.GAsyncResult // out + var _cret **C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_proxy_resolver_lookup_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// isSupported checks if resolver can be used on this system. (This is used +// internally; g_proxy_resolver_get_default() will only return a proxy resolver +// that returns TRUE for this method.). +// +// The function returns the following values: +// +// - ok: TRUE if resolver is supported. +func (resolver *ProxyResolver) isSupported() bool { + gclass := (*C.GProxyResolverInterface)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.is_supported + + var _arg0 *C.GProxyResolver // out + var _cret C.gboolean // in + + _arg0 = (*C.GProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + + _cret = C._gotk4_gio2_ProxyResolver_virtual_is_supported(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(resolver) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Lookup looks into the system proxy configuration to determine what proxy, +// if any, to use to connect to uri. The returned proxy URIs are of the form +// ://[user[:password]@]host[:port] or direct://, where +// could be http, rtsp, socks or other proxying protocol. +// +// If you don't know what network protocol is being used on the socket, +// you should use none as the URI protocol. In this case, the resolver might +// still return a generic proxy type (such as SOCKS), but would not return +// protocol-specific proxy types (such as http). +// +// direct:// is used when no proxy is needed. Direct connection should not be +// attempted unless it is part of the returned array of proxies. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - uri: URI representing the destination to connect to. +// +// The function returns the following values: +// +// - utf8s: a NULL-terminated array of proxy URIs. Must be freed with +// g_strfreev(). +func (resolver *ProxyResolver) lookup(ctx context.Context, uri string) ([]string, error) { + gclass := (*C.GProxyResolverInterface)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup + + var _arg0 *C.GProxyResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _cret **C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_ProxyResolver_virtual_lookup(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uri) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// lookupAsync asynchronous lookup of proxy. See g_proxy_resolver_lookup() for +// more details. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - uri: URI representing the destination to connect to. +// - callback (optional) to call after resolution completes. +func (resolver *ProxyResolver) lookupAsync(ctx context.Context, uri string, callback AsyncReadyCallback) { + gclass := (*C.GProxyResolverInterface)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_async + + var _arg0 *C.GProxyResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_ProxyResolver_virtual_lookup_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uri) + runtime.KeepAlive(callback) +} + +// lookupFinish: call this function to obtain the array of proxy URIs when +// g_proxy_resolver_lookup_async() is complete. See g_proxy_resolver_lookup() +// for more details. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - utf8s: a NULL-terminated array of proxy URIs. Must be freed with +// g_strfreev(). +func (resolver *ProxyResolver) lookupFinish(result AsyncResulter) ([]string, error) { + gclass := (*C.GProxyResolverInterface)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_finish + + var _arg0 *C.GProxyResolver // out + var _arg1 *C.GAsyncResult // out + var _cret **C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_ProxyResolver_virtual_lookup_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// ProxyResolverGetDefault gets the default Resolver for the system. +// +// The function returns the following values: +// +// - proxyResolver: default Resolver, which will be a dummy object if no proxy +// resolver is available. +func ProxyResolverGetDefault() *ProxyResolver { + var _cret *C.GProxyResolver // in + + _cret = C.g_proxy_resolver_get_default() + + var _proxyResolver *ProxyResolver // out + + _proxyResolver = wrapProxyResolver(coreglib.Take(unsafe.Pointer(_cret))) + + return _proxyResolver +} + +// RemoteActionGroup: GRemoteActionGroup interface is implemented by +// gio.ActionGroup instances that either transmit action invocations to other +// processes or receive action invocations in the local process from other +// processes. +// +// The interface has _full variants of the two methods on gio.ActionGroup +// used to activate actions: gio.ActionGroup.ActivateAction() and +// gio.ActionGroup.ChangeActionState(). These variants allow a ‘platform data’ +// glib.Variant to be specified: a dictionary providing context for the action +// invocation (for example: timestamps, startup notification IDs, etc). +// +// gio.DBusActionGroup implements GRemoteActionGroup. This provides a mechanism +// to send platform data for action invocations over D-Bus. +// +// Additionally, gio.DBusConnection.ExportActionGroup() will check if the +// exported gio.ActionGroup implements GRemoteActionGroup and use the _full +// variants of the calls if available. This provides a mechanism by which to +// receive platform data for action invocations that arrive by way of D-Bus. +// +// RemoteActionGroup wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type RemoteActionGroup struct { + _ [0]func() // equal guard + ActionGroup +} + +var () + +// RemoteActionGrouper describes RemoteActionGroup's interface methods. +type RemoteActionGrouper interface { + coreglib.Objector + + // ActivateActionFull activates the remote action. + ActivateActionFull(actionName string, parameter, platformData *glib.Variant) + // ChangeActionStateFull changes the state of a remote action. + ChangeActionStateFull(actionName string, value, platformData *glib.Variant) +} + +var _ RemoteActionGrouper = (*RemoteActionGroup)(nil) + +func wrapRemoteActionGroup(obj *coreglib.Object) *RemoteActionGroup { + return &RemoteActionGroup{ + ActionGroup: ActionGroup{ + Object: obj, + }, + } +} + +func marshalRemoteActionGroup(p uintptr) (interface{}, error) { + return wrapRemoteActionGroup(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ActivateActionFull activates the remote action. +// +// This is the same as g_action_group_activate_action() except that it allows +// for provision of "platform data" to be sent along with the activation +// request. This typically contains details such as the user interaction +// timestamp or startup notification information. +// +// platform_data must be non-NULL and must have the type G_VARIANT_TYPE_VARDICT. +// If it is floating, it will be consumed. +// +// The function takes the following parameters: +// +// - actionName: name of the action to activate. +// - parameter (optional): optional parameter to the activation. +// - platformData: platform data to send. +func (remote *RemoteActionGroup) ActivateActionFull(actionName string, parameter, platformData *glib.Variant) { + var _arg0 *C.GRemoteActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + var _arg3 *C.GVariant // out + + _arg0 = (*C.GRemoteActionGroup)(unsafe.Pointer(coreglib.InternObject(remote).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + if parameter != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameter))) + } + _arg3 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(platformData))) + + C.g_remote_action_group_activate_action_full(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(remote) + runtime.KeepAlive(actionName) + runtime.KeepAlive(parameter) + runtime.KeepAlive(platformData) +} + +// ChangeActionStateFull changes the state of a remote action. +// +// This is the same as g_action_group_change_action_state() except that it +// allows for provision of "platform data" to be sent along with the state +// change request. This typically contains details such as the user interaction +// timestamp or startup notification information. +// +// platform_data must be non-NULL and must have the type G_VARIANT_TYPE_VARDICT. +// If it is floating, it will be consumed. +// +// The function takes the following parameters: +// +// - actionName: name of the action to change the state of. +// - value: new requested value for the state. +// - platformData: platform data to send. +func (remote *RemoteActionGroup) ChangeActionStateFull(actionName string, value, platformData *glib.Variant) { + var _arg0 *C.GRemoteActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + var _arg3 *C.GVariant // out + + _arg0 = (*C.GRemoteActionGroup)(unsafe.Pointer(coreglib.InternObject(remote).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + _arg3 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(platformData))) + + C.g_remote_action_group_change_action_state_full(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(remote) + runtime.KeepAlive(actionName) + runtime.KeepAlive(value) + runtime.KeepAlive(platformData) +} + +// activateActionFull activates the remote action. +// +// This is the same as g_action_group_activate_action() except that it allows +// for provision of "platform data" to be sent along with the activation +// request. This typically contains details such as the user interaction +// timestamp or startup notification information. +// +// platform_data must be non-NULL and must have the type G_VARIANT_TYPE_VARDICT. +// If it is floating, it will be consumed. +// +// The function takes the following parameters: +// +// - actionName: name of the action to activate. +// - parameter (optional): optional parameter to the activation. +// - platformData: platform data to send. +func (remote *RemoteActionGroup) activateActionFull(actionName string, parameter, platformData *glib.Variant) { + gclass := (*C.GRemoteActionGroupInterface)(coreglib.PeekParentClass(remote)) + fnarg := gclass.activate_action_full + + var _arg0 *C.GRemoteActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + var _arg3 *C.GVariant // out + + _arg0 = (*C.GRemoteActionGroup)(unsafe.Pointer(coreglib.InternObject(remote).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + if parameter != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameter))) + } + _arg3 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(platformData))) + + C._gotk4_gio2_RemoteActionGroup_virtual_activate_action_full(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(remote) + runtime.KeepAlive(actionName) + runtime.KeepAlive(parameter) + runtime.KeepAlive(platformData) +} + +// changeActionStateFull changes the state of a remote action. +// +// This is the same as g_action_group_change_action_state() except that it +// allows for provision of "platform data" to be sent along with the state +// change request. This typically contains details such as the user interaction +// timestamp or startup notification information. +// +// platform_data must be non-NULL and must have the type G_VARIANT_TYPE_VARDICT. +// If it is floating, it will be consumed. +// +// The function takes the following parameters: +// +// - actionName: name of the action to change the state of. +// - value: new requested value for the state. +// - platformData: platform data to send. +func (remote *RemoteActionGroup) changeActionStateFull(actionName string, value, platformData *glib.Variant) { + gclass := (*C.GRemoteActionGroupInterface)(coreglib.PeekParentClass(remote)) + fnarg := gclass.change_action_state_full + + var _arg0 *C.GRemoteActionGroup // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + var _arg3 *C.GVariant // out + + _arg0 = (*C.GRemoteActionGroup)(unsafe.Pointer(coreglib.InternObject(remote).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + _arg3 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(platformData))) + + C._gotk4_gio2_RemoteActionGroup_virtual_change_action_state_full(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(remote) + runtime.KeepAlive(actionName) + runtime.KeepAlive(value) + runtime.KeepAlive(platformData) +} + +// Seekable: GSeekable is implemented by streams (implementations of +// gio.InputStream or gio.OutputStream) that support seeking. +// +// Seekable streams largely fall into two categories: resizable and fixed-size. +// +// GSeekable on fixed-sized streams is approximately the same as POSIX lseek() +// (man:lseek(2)) on a block device (for example: attempting to seek past the +// end of the device is an error). Fixed streams typically cannot be truncated. +// +// GSeekable on resizable streams is approximately the same as POSIX lseek() +// (man:lseek(2)) on a normal file. Seeking past the end and writing data will +// usually cause the stream to resize by introducing zero bytes. +// +// Seekable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Seekable struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Seekable)(nil) +) + +// Seekabler describes Seekable's interface methods. +type Seekabler interface { + coreglib.Objector + + // CanSeek tests if the stream supports the Iface. + CanSeek() bool + // CanTruncate tests if the length of the stream can be adjusted with + // g_seekable_truncate(). + CanTruncate() bool + // Seek seeks in the stream by the given offset, modified by type. + Seek(ctx context.Context, offset int64, typ glib.SeekType) error + // Tell tells the current position within the stream. + Tell() int64 + // Truncate sets the length of the stream to offset. + Truncate(ctx context.Context, offset int64) error +} + +var _ Seekabler = (*Seekable)(nil) + +func wrapSeekable(obj *coreglib.Object) *Seekable { + return &Seekable{ + Object: obj, + } +} + +func marshalSeekable(p uintptr) (interface{}, error) { + return wrapSeekable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// CanSeek tests if the stream supports the Iface. +// +// The function returns the following values: +// +// - ok: TRUE if seekable can be seeked. FALSE otherwise. +func (seekable *Seekable) CanSeek() bool { + var _arg0 *C.GSeekable // out + var _cret C.gboolean // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + + _cret = C.g_seekable_can_seek(_arg0) + runtime.KeepAlive(seekable) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanTruncate tests if the length of the stream can be adjusted with +// g_seekable_truncate(). +// +// The function returns the following values: +// +// - ok: TRUE if the stream can be truncated, FALSE otherwise. +func (seekable *Seekable) CanTruncate() bool { + var _arg0 *C.GSeekable // out + var _cret C.gboolean // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + + _cret = C.g_seekable_can_truncate(_arg0) + runtime.KeepAlive(seekable) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Seek seeks in the stream by the given offset, modified by type. +// +// Attempting to seek past the end of the stream will have different results +// depending on if the stream is fixed-sized or resizable. If the stream is +// resizable then seeking past the end and then writing will result in zeros +// filling the empty space. Seeking past the end of a resizable stream and +// reading will result in EOF. Seeking past the end of a fixed-sized stream will +// fail. +// +// Any operation that would result in a negative offset will fail. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - offset: #goffset. +// - typ: Type. +func (seekable *Seekable) Seek(ctx context.Context, offset int64, typ glib.SeekType) error { + var _arg0 *C.GSeekable // out + var _arg3 *C.GCancellable // out + var _arg1 C.goffset // out + var _arg2 C.GSeekType // out + var _cerr *C.GError // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.goffset(offset) + _arg2 = C.GSeekType(typ) + + C.g_seekable_seek(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(seekable) + runtime.KeepAlive(ctx) + runtime.KeepAlive(offset) + runtime.KeepAlive(typ) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Tell tells the current position within the stream. +// +// The function returns the following values: +// +// - gint64: (positive or zero) offset from the beginning of the buffer, +// zero if the target is not seekable. +func (seekable *Seekable) Tell() int64 { + var _arg0 *C.GSeekable // out + var _cret C.goffset // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + + _cret = C.g_seekable_tell(_arg0) + runtime.KeepAlive(seekable) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// Truncate sets the length of the stream to offset. If the stream was +// previously larger than offset, the extra data is discarded. If the stream was +// previously shorter than offset, it is extended with NUL ('\0') bytes. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - offset: new length for seekable, in bytes. +func (seekable *Seekable) Truncate(ctx context.Context, offset int64) error { + var _arg0 *C.GSeekable // out + var _arg2 *C.GCancellable // out + var _arg1 C.goffset // out + var _cerr *C.GError // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.goffset(offset) + + C.g_seekable_truncate(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(seekable) + runtime.KeepAlive(ctx) + runtime.KeepAlive(offset) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// canSeek tests if the stream supports the Iface. +// +// The function returns the following values: +// +// - ok: TRUE if seekable can be seeked. FALSE otherwise. +func (seekable *Seekable) canSeek() bool { + gclass := (*C.GSeekableIface)(coreglib.PeekParentClass(seekable)) + fnarg := gclass.can_seek + + var _arg0 *C.GSeekable // out + var _cret C.gboolean // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + + _cret = C._gotk4_gio2_Seekable_virtual_can_seek(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(seekable) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canTruncate tests if the length of the stream can be adjusted with +// g_seekable_truncate(). +// +// The function returns the following values: +// +// - ok: TRUE if the stream can be truncated, FALSE otherwise. +func (seekable *Seekable) canTruncate() bool { + gclass := (*C.GSeekableIface)(coreglib.PeekParentClass(seekable)) + fnarg := gclass.can_truncate + + var _arg0 *C.GSeekable // out + var _cret C.gboolean // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + + _cret = C._gotk4_gio2_Seekable_virtual_can_truncate(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(seekable) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Seek seeks in the stream by the given offset, modified by type. +// +// Attempting to seek past the end of the stream will have different results +// depending on if the stream is fixed-sized or resizable. If the stream is +// resizable then seeking past the end and then writing will result in zeros +// filling the empty space. Seeking past the end of a resizable stream and +// reading will result in EOF. Seeking past the end of a fixed-sized stream will +// fail. +// +// Any operation that would result in a negative offset will fail. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - offset: #goffset. +// - typ: Type. +func (seekable *Seekable) seek(ctx context.Context, offset int64, typ glib.SeekType) error { + gclass := (*C.GSeekableIface)(coreglib.PeekParentClass(seekable)) + fnarg := gclass.seek + + var _arg0 *C.GSeekable // out + var _arg3 *C.GCancellable // out + var _arg1 C.goffset // out + var _arg2 C.GSeekType // out + var _cerr *C.GError // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.goffset(offset) + _arg2 = C.GSeekType(typ) + + C._gotk4_gio2_Seekable_virtual_seek(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(seekable) + runtime.KeepAlive(ctx) + runtime.KeepAlive(offset) + runtime.KeepAlive(typ) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Tell tells the current position within the stream. +// +// The function returns the following values: +// +// - gint64: (positive or zero) offset from the beginning of the buffer, +// zero if the target is not seekable. +func (seekable *Seekable) tell() int64 { + gclass := (*C.GSeekableIface)(coreglib.PeekParentClass(seekable)) + fnarg := gclass.tell + + var _arg0 *C.GSeekable // out + var _cret C.goffset // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + + _cret = C._gotk4_gio2_Seekable_virtual_tell(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(seekable) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// truncateFn sets the length of the stream to offset. If the stream was +// previously larger than offset, the extra data is discarded. If the stream was +// previously shorter than offset, it is extended with NUL ('\0') bytes. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - offset: new length for seekable, in bytes. +func (seekable *Seekable) truncateFn(ctx context.Context, offset int64) error { + gclass := (*C.GSeekableIface)(coreglib.PeekParentClass(seekable)) + fnarg := gclass.truncate_fn + + var _arg0 *C.GSeekable // out + var _arg2 *C.GCancellable // out + var _arg1 C.goffset // out + var _cerr *C.GError // in + + _arg0 = (*C.GSeekable)(unsafe.Pointer(coreglib.InternObject(seekable).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.goffset(offset) + + C._gotk4_gio2_Seekable_virtual_truncate_fn(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(seekable) + runtime.KeepAlive(ctx) + runtime.KeepAlive(offset) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SocketConnectable objects that describe one or more potential +// socket endpoints implement GSocketConnectable. Callers can then use +// gio.SocketConnectable.Enumerate() to get a gio.SocketAddressEnumerator to try +// out each socket address in turn until one succeeds, as shown in the sample +// code below. +// +// MyConnectionType * +// connect_to_host (const char *hostname, +// guint16 port, +// GCancellable *cancellable, +// GError **error) +// { +// MyConnection *conn = NULL; +// GSocketConnectable *addr; +// GSocketAddressEnumerator *enumerator; +// GSocketAddress *sockaddr; +// GError *conn_error = NULL; +// +// addr = g_network_address_new (hostname, port); +// enumerator = g_socket_connectable_enumerate (addr); +// g_object_unref (addr); +// +// // Try each sockaddr until we succeed. Record the first connection error, +// // but not any further ones (since they'll probably be basically the same +// // as the first). +// while (!conn && (sockaddr = g_socket_address_enumerator_next (enumerator, cancellable, error)) +// { +// conn = connect_to_sockaddr (sockaddr, conn_error ? NULL : &conn_error); +// g_object_unref (sockaddr); +// } +// g_object_unref (enumerator); +// +// if (conn) +// { +// if (conn_error) +// { +// // We couldn't connect to the first address, but we succeeded +// // in connecting to a later address. +// g_error_free (conn_error); +// } +// return conn; +// } +// else if (error) +// { +// /// Either initial lookup failed, or else the caller cancelled us. +// if (conn_error) +// g_error_free (conn_error); +// return NULL; +// } +// else +// { +// g_error_propagate (error, conn_error); +// return NULL; +// } +// }. +// +// SocketConnectable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type SocketConnectable struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*SocketConnectable)(nil) +) + +// SocketConnectabler describes SocketConnectable's interface methods. +type SocketConnectabler interface { + coreglib.Objector + + // Enumerate creates a AddressEnumerator for connectable. + Enumerate() SocketAddressEnumeratorrer + // ProxyEnumerate creates a AddressEnumerator for connectable that will + // return a Address for each of its addresses that you must connect to via a + // proxy. + ProxyEnumerate() SocketAddressEnumeratorrer + // String: format a Connectable as a string. + String() string +} + +var _ SocketConnectabler = (*SocketConnectable)(nil) + +func wrapSocketConnectable(obj *coreglib.Object) *SocketConnectable { + return &SocketConnectable{ + Object: obj, + } +} + +func marshalSocketConnectable(p uintptr) (interface{}, error) { + return wrapSocketConnectable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Enumerate creates a AddressEnumerator for connectable. +// +// The function returns the following values: +// +// - socketAddressEnumerator: new AddressEnumerator. +func (connectable *SocketConnectable) Enumerate() SocketAddressEnumeratorrer { + var _arg0 *C.GSocketConnectable // out + var _cret *C.GSocketAddressEnumerator // in + + _arg0 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + + _cret = C.g_socket_connectable_enumerate(_arg0) + runtime.KeepAlive(connectable) + + var _socketAddressEnumerator SocketAddressEnumeratorrer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.SocketAddressEnumeratorrer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddressEnumeratorrer) + return ok + }) + rv, ok := casted.(SocketAddressEnumeratorrer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddressEnumeratorrer") + } + _socketAddressEnumerator = rv + } + + return _socketAddressEnumerator +} + +// ProxyEnumerate creates a AddressEnumerator for connectable that will return a +// Address for each of its addresses that you must connect to via a proxy. +// +// If connectable does not implement g_socket_connectable_proxy_enumerate(), +// this will fall back to calling g_socket_connectable_enumerate(). +// +// The function returns the following values: +// +// - socketAddressEnumerator: new AddressEnumerator. +func (connectable *SocketConnectable) ProxyEnumerate() SocketAddressEnumeratorrer { + var _arg0 *C.GSocketConnectable // out + var _cret *C.GSocketAddressEnumerator // in + + _arg0 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + + _cret = C.g_socket_connectable_proxy_enumerate(_arg0) + runtime.KeepAlive(connectable) + + var _socketAddressEnumerator SocketAddressEnumeratorrer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.SocketAddressEnumeratorrer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddressEnumeratorrer) + return ok + }) + rv, ok := casted.(SocketAddressEnumeratorrer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddressEnumeratorrer") + } + _socketAddressEnumerator = rv + } + + return _socketAddressEnumerator +} + +// String: format a Connectable as a string. This is a human-readable format for +// use in debugging output, and is not a stable serialization format. It is not +// suitable for use in user interfaces as it exposes too much information for a +// user. +// +// If the Connectable implementation does not support string formatting, +// the implementation’s type name will be returned as a fallback. +// +// The function returns the following values: +// +// - utf8: formatted string. +func (connectable *SocketConnectable) String() string { + var _arg0 *C.GSocketConnectable // out + var _cret *C.gchar // in + + _arg0 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + + _cret = C.g_socket_connectable_to_string(_arg0) + runtime.KeepAlive(connectable) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Enumerate creates a AddressEnumerator for connectable. +// +// The function returns the following values: +// +// - socketAddressEnumerator: new AddressEnumerator. +func (connectable *SocketConnectable) enumerate() SocketAddressEnumeratorrer { + gclass := (*C.GSocketConnectableIface)(coreglib.PeekParentClass(connectable)) + fnarg := gclass.enumerate + + var _arg0 *C.GSocketConnectable // out + var _cret *C.GSocketAddressEnumerator // in + + _arg0 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + + _cret = C._gotk4_gio2_SocketConnectable_virtual_enumerate(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(connectable) + + var _socketAddressEnumerator SocketAddressEnumeratorrer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.SocketAddressEnumeratorrer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddressEnumeratorrer) + return ok + }) + rv, ok := casted.(SocketAddressEnumeratorrer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddressEnumeratorrer") + } + _socketAddressEnumerator = rv + } + + return _socketAddressEnumerator +} + +// proXYEnumerate creates a AddressEnumerator for connectable that will return a +// Address for each of its addresses that you must connect to via a proxy. +// +// If connectable does not implement g_socket_connectable_proxy_enumerate(), +// this will fall back to calling g_socket_connectable_enumerate(). +// +// The function returns the following values: +// +// - socketAddressEnumerator: new AddressEnumerator. +func (connectable *SocketConnectable) proxyEnumerate() SocketAddressEnumeratorrer { + gclass := (*C.GSocketConnectableIface)(coreglib.PeekParentClass(connectable)) + fnarg := gclass.proxy_enumerate + + var _arg0 *C.GSocketConnectable // out + var _cret *C.GSocketAddressEnumerator // in + + _arg0 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + + _cret = C._gotk4_gio2_SocketConnectable_virtual_proxy_enumerate(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(connectable) + + var _socketAddressEnumerator SocketAddressEnumeratorrer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.SocketAddressEnumeratorrer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddressEnumeratorrer) + return ok + }) + rv, ok := casted.(SocketAddressEnumeratorrer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddressEnumeratorrer") + } + _socketAddressEnumerator = rv + } + + return _socketAddressEnumerator +} + +// Str: format a Connectable as a string. This is a human-readable format for +// use in debugging output, and is not a stable serialization format. It is not +// suitable for use in user interfaces as it exposes too much information for a +// user. +// +// If the Connectable implementation does not support string formatting, +// the implementation’s type name will be returned as a fallback. +// +// The function returns the following values: +// +// - utf8: formatted string. +func (connectable *SocketConnectable) str() string { + gclass := (*C.GSocketConnectableIface)(coreglib.PeekParentClass(connectable)) + fnarg := gclass.to_string + + var _arg0 *C.GSocketConnectable // out + var _cret *C.gchar // in + + _arg0 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + + _cret = C._gotk4_gio2_SocketConnectable_virtual_to_string(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(connectable) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// TLSBackend: TLS (Transport Layer Security, aka SSL) and DTLS backend. +// This is an internal type used to coordinate the different classes implemented +// by a TLS backend. +// +// TLSBackend wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type TLSBackend struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*TLSBackend)(nil) +) + +// TLSBackender describes TLSBackend's interface methods. +type TLSBackender interface { + coreglib.Objector + + // CertificateType gets the #GType of backend's Certificate implementation. + CertificateType() coreglib.Type + // ClientConnectionType gets the #GType of backend's ClientConnection + // implementation. + ClientConnectionType() coreglib.Type + // DefaultDatabase gets the default Database used to verify TLS connections. + DefaultDatabase() TLSDatabaser + // DTLSClientConnectionType gets the #GType of backend’s ClientConnection + // implementation. + DTLSClientConnectionType() coreglib.Type + // DTLSServerConnectionType gets the #GType of backend’s ServerConnection + // implementation. + DTLSServerConnectionType() coreglib.Type + // FileDatabaseType gets the #GType of backend's FileDatabase + // implementation. + FileDatabaseType() coreglib.Type + // ServerConnectionType gets the #GType of backend's ServerConnection + // implementation. + ServerConnectionType() coreglib.Type + // SetDefaultDatabase: set the default Database used to verify TLS + // connections. + SetDefaultDatabase(database TLSDatabaser) + // SupportsDTLS checks if DTLS is supported. + SupportsDTLS() bool + // SupportsTLS checks if TLS is supported; if this returns FALSE for the + // default Backend, it means no "real" TLS backend is available. + SupportsTLS() bool +} + +var _ TLSBackender = (*TLSBackend)(nil) + +func wrapTLSBackend(obj *coreglib.Object) *TLSBackend { + return &TLSBackend{ + Object: obj, + } +} + +func marshalTLSBackend(p uintptr) (interface{}, error) { + return wrapTLSBackend(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// CertificateType gets the #GType of backend's Certificate implementation. +// +// The function returns the following values: +// +// - gType of backend's Certificate implementation. +func (backend *TLSBackend) CertificateType() coreglib.Type { + var _arg0 *C.GTlsBackend // out + var _cret C.GType // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C.g_tls_backend_get_certificate_type(_arg0) + runtime.KeepAlive(backend) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// ClientConnectionType gets the #GType of backend's ClientConnection +// implementation. +// +// The function returns the following values: +// +// - gType of backend's ClientConnection implementation. +func (backend *TLSBackend) ClientConnectionType() coreglib.Type { + var _arg0 *C.GTlsBackend // out + var _cret C.GType // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C.g_tls_backend_get_client_connection_type(_arg0) + runtime.KeepAlive(backend) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// DefaultDatabase gets the default Database used to verify TLS connections. +// +// The function returns the following values: +// +// - tlsDatabase: default database, which should be unreffed when done. +func (backend *TLSBackend) DefaultDatabase() TLSDatabaser { + var _arg0 *C.GTlsBackend // out + var _cret *C.GTlsDatabase // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C.g_tls_backend_get_default_database(_arg0) + runtime.KeepAlive(backend) + + var _tlsDatabase TLSDatabaser // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.TLSDatabaser is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSDatabaser) + return ok + }) + rv, ok := casted.(TLSDatabaser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSDatabaser") + } + _tlsDatabase = rv + } + + return _tlsDatabase +} + +// DTLSClientConnectionType gets the #GType of backend’s ClientConnection +// implementation. +// +// The function returns the following values: +// +// - gType of backend’s ClientConnection implementation, or G_TYPE_INVALID if +// this backend doesn’t support DTLS. +func (backend *TLSBackend) DTLSClientConnectionType() coreglib.Type { + var _arg0 *C.GTlsBackend // out + var _cret C.GType // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C.g_tls_backend_get_dtls_client_connection_type(_arg0) + runtime.KeepAlive(backend) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// DTLSServerConnectionType gets the #GType of backend’s ServerConnection +// implementation. +// +// The function returns the following values: +// +// - gType of backend’s ServerConnection implementation, or G_TYPE_INVALID if +// this backend doesn’t support DTLS. +func (backend *TLSBackend) DTLSServerConnectionType() coreglib.Type { + var _arg0 *C.GTlsBackend // out + var _cret C.GType // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C.g_tls_backend_get_dtls_server_connection_type(_arg0) + runtime.KeepAlive(backend) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// FileDatabaseType gets the #GType of backend's FileDatabase implementation. +// +// The function returns the following values: +// +// - gType of backend's FileDatabase implementation. +func (backend *TLSBackend) FileDatabaseType() coreglib.Type { + var _arg0 *C.GTlsBackend // out + var _cret C.GType // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C.g_tls_backend_get_file_database_type(_arg0) + runtime.KeepAlive(backend) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// ServerConnectionType gets the #GType of backend's ServerConnection +// implementation. +// +// The function returns the following values: +// +// - gType of backend's ServerConnection implementation. +func (backend *TLSBackend) ServerConnectionType() coreglib.Type { + var _arg0 *C.GTlsBackend // out + var _cret C.GType // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C.g_tls_backend_get_server_connection_type(_arg0) + runtime.KeepAlive(backend) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// SetDefaultDatabase: set the default Database used to verify TLS connections +// +// Any subsequent call to g_tls_backend_get_default_database() will return +// the database set in this call. Existing databases and connections are not +// modified. +// +// Setting a NULL default database will reset to using the system default +// database as if g_tls_backend_set_default_database() had never been called. +// +// The function takes the following parameters: +// +// - database (optional): Database. +func (backend *TLSBackend) SetDefaultDatabase(database TLSDatabaser) { + var _arg0 *C.GTlsBackend // out + var _arg1 *C.GTlsDatabase // out + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + if database != nil { + _arg1 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(database).Native())) + } + + C.g_tls_backend_set_default_database(_arg0, _arg1) + runtime.KeepAlive(backend) + runtime.KeepAlive(database) +} + +// SupportsDTLS checks if DTLS is supported. DTLS support may not be available +// even if TLS support is available, and vice-versa. +// +// The function returns the following values: +// +// - ok: whether DTLS is supported. +func (backend *TLSBackend) SupportsDTLS() bool { + var _arg0 *C.GTlsBackend // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C.g_tls_backend_supports_dtls(_arg0) + runtime.KeepAlive(backend) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SupportsTLS checks if TLS is supported; if this returns FALSE for the default +// Backend, it means no "real" TLS backend is available. +// +// The function returns the following values: +// +// - ok: whether or not TLS is supported. +func (backend *TLSBackend) SupportsTLS() bool { + var _arg0 *C.GTlsBackend // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C.g_tls_backend_supports_tls(_arg0) + runtime.KeepAlive(backend) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// defaultDatabase gets the default Database used to verify TLS connections. +// +// The function returns the following values: +// +// - tlsDatabase: default database, which should be unreffed when done. +func (backend *TLSBackend) defaultDatabase() TLSDatabaser { + gclass := (*C.GTlsBackendInterface)(coreglib.PeekParentClass(backend)) + fnarg := gclass.get_default_database + + var _arg0 *C.GTlsBackend // out + var _cret *C.GTlsDatabase // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C._gotk4_gio2_TLSBackend_virtual_get_default_database(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(backend) + + var _tlsDatabase TLSDatabaser // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.TLSDatabaser is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSDatabaser) + return ok + }) + rv, ok := casted.(TLSDatabaser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSDatabaser") + } + _tlsDatabase = rv + } + + return _tlsDatabase +} + +// supportsDTLS checks if DTLS is supported. DTLS support may not be available +// even if TLS support is available, and vice-versa. +// +// The function returns the following values: +// +// - ok: whether DTLS is supported. +func (backend *TLSBackend) supportsDTLS() bool { + gclass := (*C.GTlsBackendInterface)(coreglib.PeekParentClass(backend)) + fnarg := gclass.supports_dtls + + var _arg0 *C.GTlsBackend // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C._gotk4_gio2_TLSBackend_virtual_supports_dtls(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(backend) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// supportsTLS checks if TLS is supported; if this returns FALSE for the default +// Backend, it means no "real" TLS backend is available. +// +// The function returns the following values: +// +// - ok: whether or not TLS is supported. +func (backend *TLSBackend) supportsTLS() bool { + gclass := (*C.GTlsBackendInterface)(coreglib.PeekParentClass(backend)) + fnarg := gclass.supports_tls + + var _arg0 *C.GTlsBackend // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsBackend)(unsafe.Pointer(coreglib.InternObject(backend).Native())) + + _cret = C._gotk4_gio2_TLSBackend_virtual_supports_tls(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(backend) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TLSBackendGetDefault gets the default Backend for the system. +// +// The function returns the following values: +// +// - tlsBackend which will be a dummy object if no TLS backend is available. +func TLSBackendGetDefault() *TLSBackend { + var _cret *C.GTlsBackend // in + + _cret = C.g_tls_backend_get_default() + + var _tlsBackend *TLSBackend // out + + _tlsBackend = wrapTLSBackend(coreglib.Take(unsafe.Pointer(_cret))) + + return _tlsBackend +} + +// TLSClientConnection: GTlsClientConnection is the client-side subclass of +// gio.TLSConnection, representing a client-side TLS connection. +// +// TLSClientConnection wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type TLSClientConnection struct { + _ [0]func() // equal guard + TLSConnection +} + +var ( + _ TLSConnectioner = (*TLSClientConnection)(nil) +) + +// TLSClientConnectioner describes TLSClientConnection's interface methods. +type TLSClientConnectioner interface { + coreglib.Objector + + // CopySessionState: possibly copies session state from one connection to + // another, for use in TLS session resumption. + CopySessionState(source TLSClientConnectioner) + // ServerIdentity gets conn's expected server identity. + ServerIdentity() *SocketConnectable + // UseSSL3: SSL 3.0 is no longer supported. + UseSSL3() bool + // ValidationFlags gets conn's validation flags. + ValidationFlags() TLSCertificateFlags + // SetServerIdentity sets conn's expected server identity, which is used + // both to tell servers on virtual hosts which certificate to present, + // and also to let conn know what name to look for in the certificate when + // performing G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled. + SetServerIdentity(identity SocketConnectabler) + // SetUseSSL3: since GLib 2.42.1, SSL 3.0 is no longer supported. + SetUseSSL3(useSsl3 bool) + // SetValidationFlags sets conn's validation flags, to override the default + // set of checks performed when validating a server certificate. + SetValidationFlags(flags TLSCertificateFlags) +} + +var _ TLSClientConnectioner = (*TLSClientConnection)(nil) + +func wrapTLSClientConnection(obj *coreglib.Object) *TLSClientConnection { + return &TLSClientConnection{ + TLSConnection: TLSConnection{ + IOStream: IOStream{ + Object: obj, + }, + }, + } +} + +func marshalTLSClientConnection(p uintptr) (interface{}, error) { + return wrapTLSClientConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// CopySessionState: possibly copies session state from one connection to +// another, for use in TLS session resumption. This is not normally needed, +// but may be used when the same session needs to be used between different +// endpoints, as is required by some protocols, such as FTP over TLS. source +// should have already completed a handshake and, since TLS 1.3, it should +// have been used to read data at least once. conn should not have completed a +// handshake. +// +// It is not possible to know whether a call to this function will actually do +// anything. Because session resumption is normally used only for performance +// benefit, the TLS backend might not implement this function. Even if +// implemented, it may not actually succeed in allowing conn to resume source's +// TLS session, because the server may not have sent a session resumption token +// to source, or it may refuse to accept the token from conn. There is no way to +// know whether a call to this function is actually successful. +// +// Using this function is not required to benefit from session resumption. +// If the TLS backend supports session resumption, the session will be resumed +// automatically if it is possible to do so without weakening the privacy +// guarantees normally provided by TLS, without need to call this function. +// For example, with TLS 1.3, a session ticket will be automatically copied from +// any ClientConnection that has previously received session tickets from the +// server, provided a ticket is available that has not previously been used for +// session resumption, since session ticket reuse would be a privacy weakness. +// Using this function causes the ticket to be copied without regard for privacy +// considerations. +// +// The function takes the following parameters: +// +// - source: ClientConnection. +func (conn *TLSClientConnection) CopySessionState(source TLSClientConnectioner) { + var _arg0 *C.GTlsClientConnection // out + var _arg1 *C.GTlsClientConnection // out + + _arg0 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(source).Native())) + + C.g_tls_client_connection_copy_session_state(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(source) +} + +// ServerIdentity gets conn's expected server identity. +// +// The function returns the following values: +// +// - socketConnectable (optional) describing the expected server identity, +// or NULL if the expected identity is not known. +func (conn *TLSClientConnection) ServerIdentity() *SocketConnectable { + var _arg0 *C.GTlsClientConnection // out + var _cret *C.GSocketConnectable // in + + _arg0 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_client_connection_get_server_identity(_arg0) + runtime.KeepAlive(conn) + + var _socketConnectable *SocketConnectable // out + + if _cret != nil { + _socketConnectable = wrapSocketConnectable(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _socketConnectable +} + +// UseSSL3: SSL 3.0 is no longer supported. See +// g_tls_client_connection_set_use_ssl3() for details. +// +// Deprecated: SSL 3.0 is insecure. +// +// The function returns the following values: +// +// - ok: FALSE. +func (conn *TLSClientConnection) UseSSL3() bool { + var _arg0 *C.GTlsClientConnection // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_client_connection_get_use_ssl3(_arg0) + runtime.KeepAlive(conn) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ValidationFlags gets conn's validation flags +// +// This function does not work as originally designed and is impossible to use +// correctly. See ClientConnection:validation-flags for more information. +// +// Deprecated: Do not attempt to ignore validation errors. +// +// The function returns the following values: +// +// - tlsCertificateFlags: validation flags. +func (conn *TLSClientConnection) ValidationFlags() TLSCertificateFlags { + var _arg0 *C.GTlsClientConnection // out + var _cret C.GTlsCertificateFlags // in + + _arg0 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_client_connection_get_validation_flags(_arg0) + runtime.KeepAlive(conn) + + var _tlsCertificateFlags TLSCertificateFlags // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + + return _tlsCertificateFlags +} + +// SetServerIdentity sets conn's expected server identity, which is used both +// to tell servers on virtual hosts which certificate to present, and also +// to let conn know what name to look for in the certificate when performing +// G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled. +// +// The function takes the following parameters: +// +// - identity describing the expected server identity. +func (conn *TLSClientConnection) SetServerIdentity(identity SocketConnectabler) { + var _arg0 *C.GTlsClientConnection // out + var _arg1 *C.GSocketConnectable // out + + _arg0 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(identity).Native())) + + C.g_tls_client_connection_set_server_identity(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(identity) +} + +// SetUseSSL3: since GLib 2.42.1, SSL 3.0 is no longer supported. +// +// From GLib 2.42.1 through GLib 2.62, this function could be used to force +// use of TLS 1.0, the lowest-supported TLS protocol version at the time. +// In the past, this was needed to connect to broken TLS servers that exhibited +// protocol version intolerance. Such servers are no longer common, and using +// TLS 1.0 is no longer considered acceptable. +// +// Since GLib 2.64, this function does nothing. +// +// Deprecated: SSL 3.0 is insecure. +// +// The function takes the following parameters: +// +// - useSsl3: #gboolean, ignored. +func (conn *TLSClientConnection) SetUseSSL3(useSsl3 bool) { + var _arg0 *C.GTlsClientConnection // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + if useSsl3 { + _arg1 = C.TRUE + } + + C.g_tls_client_connection_set_use_ssl3(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(useSsl3) +} + +// SetValidationFlags sets conn's validation flags, to override the default +// set of checks performed when validating a server certificate. By default, +// G_TLS_CERTIFICATE_VALIDATE_ALL is used. +// +// This function does not work as originally designed and is impossible to use +// correctly. See ClientConnection:validation-flags for more information. +// +// Deprecated: Do not attempt to ignore validation errors. +// +// The function takes the following parameters: +// +// - flags to use. +func (conn *TLSClientConnection) SetValidationFlags(flags TLSCertificateFlags) { + var _arg0 *C.GTlsClientConnection // out + var _arg1 C.GTlsCertificateFlags // out + + _arg0 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = C.GTlsCertificateFlags(flags) + + C.g_tls_client_connection_set_validation_flags(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(flags) +} + +// copySessionState: possibly copies session state from one connection to +// another, for use in TLS session resumption. This is not normally needed, +// but may be used when the same session needs to be used between different +// endpoints, as is required by some protocols, such as FTP over TLS. source +// should have already completed a handshake and, since TLS 1.3, it should +// have been used to read data at least once. conn should not have completed a +// handshake. +// +// It is not possible to know whether a call to this function will actually do +// anything. Because session resumption is normally used only for performance +// benefit, the TLS backend might not implement this function. Even if +// implemented, it may not actually succeed in allowing conn to resume source's +// TLS session, because the server may not have sent a session resumption token +// to source, or it may refuse to accept the token from conn. There is no way to +// know whether a call to this function is actually successful. +// +// Using this function is not required to benefit from session resumption. +// If the TLS backend supports session resumption, the session will be resumed +// automatically if it is possible to do so without weakening the privacy +// guarantees normally provided by TLS, without need to call this function. +// For example, with TLS 1.3, a session ticket will be automatically copied from +// any ClientConnection that has previously received session tickets from the +// server, provided a ticket is available that has not previously been used for +// session resumption, since session ticket reuse would be a privacy weakness. +// Using this function causes the ticket to be copied without regard for privacy +// considerations. +// +// The function takes the following parameters: +// +// - source: ClientConnection. +func (conn *TLSClientConnection) copySessionState(source TLSClientConnectioner) { + gclass := (*C.GTlsClientConnectionInterface)(coreglib.PeekParentClass(conn)) + fnarg := gclass.copy_session_state + + var _arg0 *C.GTlsClientConnection // out + var _arg1 *C.GTlsClientConnection // out + + _arg0 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GTlsClientConnection)(unsafe.Pointer(coreglib.InternObject(source).Native())) + + C._gotk4_gio2_TLSClientConnection_virtual_copy_session_state(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(source) +} + +// NewTLSClientConnection creates a new ClientConnection wrapping base_io_stream +// (which must have pollable input and output streams) which is assumed to +// communicate with the server identified by server_identity. +// +// See the documentation for Connection:base-io-stream for restrictions on when +// application code can run operations on the base_io_stream after this function +// has returned. +// +// The function takes the following parameters: +// +// - baseIoStream to wrap. +// - serverIdentity (optional): expected identity of the server. +// +// The function returns the following values: +// +// - tlsClientConnection: new ClientConnection, or NULL on error. +func NewTLSClientConnection(baseIoStream IOStreamer, serverIdentity SocketConnectabler) (*TLSClientConnection, error) { + var _arg1 *C.GIOStream // out + var _arg2 *C.GSocketConnectable // out + var _cret *C.GIOStream // in + var _cerr *C.GError // in + + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(baseIoStream).Native())) + if serverIdentity != nil { + _arg2 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(serverIdentity).Native())) + } + + _cret = C.g_tls_client_connection_new(_arg1, _arg2, &_cerr) + runtime.KeepAlive(baseIoStream) + runtime.KeepAlive(serverIdentity) + + var _tlsClientConnection *TLSClientConnection // out + var _goerr error // out + + _tlsClientConnection = wrapTLSClientConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsClientConnection, _goerr +} + +// TLSFileDatabaseOverrider contains methods that are overridable. +type TLSFileDatabaseOverrider interface { +} + +// TLSFileDatabase: GTlsFileDatabase is implemented by gio.TLSDatabase objects +// which load their certificate information from a file. It is an interface +// which TLS library specific subtypes implement. +// +// TLSFileDatabase wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type TLSFileDatabase struct { + _ [0]func() // equal guard + TLSDatabase +} + +var ( + _ TLSDatabaser = (*TLSFileDatabase)(nil) +) + +// TLSFileDatabaser describes TLSFileDatabase's interface methods. +type TLSFileDatabaser interface { + coreglib.Objector + + baseTLSFileDatabase() *TLSFileDatabase +} + +var _ TLSFileDatabaser = (*TLSFileDatabase)(nil) + +func ifaceInitTLSFileDatabaser(gifacePtr, data C.gpointer) { +} + +func wrapTLSFileDatabase(obj *coreglib.Object) *TLSFileDatabase { + return &TLSFileDatabase{ + TLSDatabase: TLSDatabase{ + Object: obj, + }, + } +} + +func marshalTLSFileDatabase(p uintptr) (interface{}, error) { + return wrapTLSFileDatabase(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *TLSFileDatabase) baseTLSFileDatabase() *TLSFileDatabase { + return v +} + +// BaseTLSFileDatabase returns the underlying base object. +func BaseTLSFileDatabase(obj TLSFileDatabaser) *TLSFileDatabase { + return obj.baseTLSFileDatabase() +} + +// NewTLSFileDatabase creates a new FileDatabase which uses anchor certificate +// authorities in anchors to verify certificate chains. +// +// The certificates in anchors must be PEM encoded. +// +// The function takes the following parameters: +// +// - anchors: filename of anchor certificate authorities. +// +// The function returns the following values: +// +// - tlsFileDatabase: new FileDatabase, or NULL on error. +func NewTLSFileDatabase(anchors string) (*TLSFileDatabase, error) { + var _arg1 *C.gchar // out + var _cret *C.GTlsDatabase // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(anchors))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_tls_file_database_new(_arg1, &_cerr) + runtime.KeepAlive(anchors) + + var _tlsFileDatabase *TLSFileDatabase // out + var _goerr error // out + + _tlsFileDatabase = wrapTLSFileDatabase(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsFileDatabase, _goerr +} + +// TLSServerConnectionOverrider contains methods that are overridable. +type TLSServerConnectionOverrider interface { +} + +// TLSServerConnection: GTlsServerConnection is the server-side subclass of +// gio.TLSConnection, representing a server-side TLS connection. +// +// TLSServerConnection wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type TLSServerConnection struct { + _ [0]func() // equal guard + TLSConnection +} + +var ( + _ TLSConnectioner = (*TLSServerConnection)(nil) +) + +// TLSServerConnectioner describes TLSServerConnection's interface methods. +type TLSServerConnectioner interface { + coreglib.Objector + + baseTLSServerConnection() *TLSServerConnection +} + +var _ TLSServerConnectioner = (*TLSServerConnection)(nil) + +func ifaceInitTLSServerConnectioner(gifacePtr, data C.gpointer) { +} + +func wrapTLSServerConnection(obj *coreglib.Object) *TLSServerConnection { + return &TLSServerConnection{ + TLSConnection: TLSConnection{ + IOStream: IOStream{ + Object: obj, + }, + }, + } +} + +func marshalTLSServerConnection(p uintptr) (interface{}, error) { + return wrapTLSServerConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *TLSServerConnection) baseTLSServerConnection() *TLSServerConnection { + return v +} + +// BaseTLSServerConnection returns the underlying base object. +func BaseTLSServerConnection(obj TLSServerConnectioner) *TLSServerConnection { + return obj.baseTLSServerConnection() +} + +// NewTLSServerConnection creates a new ServerConnection wrapping base_io_stream +// (which must have pollable input and output streams). +// +// See the documentation for Connection:base-io-stream for restrictions on when +// application code can run operations on the base_io_stream after this function +// has returned. +// +// The function takes the following parameters: +// +// - baseIoStream to wrap. +// - certificate (optional): default server certificate, or NULL. +// +// The function returns the following values: +// +// - tlsServerConnection: new ServerConnection, or NULL on error. +func NewTLSServerConnection(baseIoStream IOStreamer, certificate TLSCertificater) (*TLSServerConnection, error) { + var _arg1 *C.GIOStream // out + var _arg2 *C.GTlsCertificate // out + var _cret *C.GIOStream // in + var _cerr *C.GError // in + + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(baseIoStream).Native())) + if certificate != nil { + _arg2 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + } + + _cret = C.g_tls_server_connection_new(_arg1, _arg2, &_cerr) + runtime.KeepAlive(baseIoStream) + runtime.KeepAlive(certificate) + + var _tlsServerConnection *TLSServerConnection // out + var _goerr error // out + + _tlsServerConnection = wrapTLSServerConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsServerConnection, _goerr +} + +// Volume: GVolume interface represents user-visible objects that can be +// mounted. Note, when porting from GnomeVFS (migrating-gnome-vfs.html), GVolume +// is the moral equivalent of GnomeVFSDrive. +// +// Mounting a GVolume instance is an asynchronous operation. For more +// information about asynchronous operations, see gio.AsyncResult and gio.Task. +// To mount a GVolume, first call gio.Volume.Mount() with (at least) +// the GVolume instance, optionally a gio.MountOperation object and a +// gio.AsyncReadyCallback. +// +// Typically, one will only want to pass NULL for the gio.MountOperation +// if automounting all volumes when a desktop session starts since it’s not +// desirable to put up a lot of dialogs asking for credentials. +// +// The callback will be fired when the operation has resolved (either with +// success or failure), and a gio.AsyncResult instance will be passed to +// the callback. That callback should then call gio.Volume.MountFinish() +// with the GVolume instance and the gio.AsyncResult data to see if the +// operation was completed successfully. If a glib.Error is present when +// gio.Volume.MountFinish() is called, then it will be filled with any error +// information. +// +// # Volume Identifiers +// +// It is sometimes necessary to directly access the underlying operating system +// object behind a volume (e.g. for passing a volume to an application via the +// command line). For this purpose, GIO allows to obtain an ‘identifier’ for +// the volume. There can be different kinds of identifiers, such as Hal UDIs, +// filesystem labels, traditional Unix devices (e.g. /dev/sda2), UUIDs. +// GIO uses predefined strings as names for the different kinds of identifiers: +// G_VOLUME_IDENTIFIER_KIND_UUID, G_VOLUME_IDENTIFIER_KIND_LABEL, etc. Use +// gio.Volume.GetIdentifier() to obtain an identifier for a volume. +// +// Note that G_VOLUME_IDENTIFIER_KIND_HAL_UDI will only be available +// when the GVFS hal volume monitor is in use. Other volume monitors will +// generally be able to provide the G_VOLUME_IDENTIFIER_KIND_UNIX_DEVICE +// identifier, which can be used to obtain a hal device by means of +// libhal_manager_find_device_string_match(). +// +// Volume wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Volume struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Volume)(nil) +) + +// Volumer describes Volume's interface methods. +type Volumer interface { + coreglib.Objector + + // CanEject checks if a volume can be ejected. + CanEject() bool + // CanMount checks if a volume can be mounted. + CanMount() bool + // Eject ejects a volume. + Eject(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) + // EjectFinish finishes ejecting a volume. + EjectFinish(result AsyncResulter) error + // EjectWithOperation ejects a volume. + EjectWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // EjectWithOperationFinish finishes ejecting a volume. + EjectWithOperationFinish(result AsyncResulter) error + // EnumerateIdentifiers gets the kinds of identifiers (#volume-identifiers) + // that volume has. + EnumerateIdentifiers() []string + // ActivationRoot gets the activation root for a #GVolume if it is known + // ahead of mount time. + ActivationRoot() *File + // Drive gets the drive for the volume. + Drive() *Drive + // Icon gets the icon for volume. + Icon() *Icon + // Identifier gets the identifier of the given kind for volume. + Identifier(kind string) string + // GetMount gets the mount for the volume. + GetMount() *Mount + // Name gets the name of volume. + Name() string + // SortKey gets the sort key for volume, if any. + SortKey() string + // SymbolicIcon gets the symbolic icon for volume. + SymbolicIcon() *Icon + // UUID gets the UUID for the volume. + UUID() string + // Mount mounts a volume. + Mount(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) + // MountFinish finishes mounting a volume. + MountFinish(result AsyncResulter) error + // ShouldAutomount returns whether the volume should be automatically + // mounted. + ShouldAutomount() bool + + // Changed is emitted when the volume has been changed. + ConnectChanged(func()) coreglib.SignalHandle + // Removed: this signal is emitted when the #GVolume have been removed. + ConnectRemoved(func()) coreglib.SignalHandle +} + +var _ Volumer = (*Volume)(nil) + +func wrapVolume(obj *coreglib.Object) *Volume { + return &Volume{ + Object: obj, + } +} + +func marshalVolume(p uintptr) (interface{}, error) { + return wrapVolume(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectChanged is emitted when the volume has been changed. +func (volume *Volume) ConnectChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volume, "changed", false, unsafe.Pointer(C._gotk4_gio2_Volume_ConnectChanged), f) +} + +// ConnectRemoved: this signal is emitted when the #GVolume have been removed. +// If the recipient is holding references to the object they should release them +// so the object can be finalized. +func (volume *Volume) ConnectRemoved(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volume, "removed", false, unsafe.Pointer(C._gotk4_gio2_Volume_ConnectRemoved), f) +} + +// CanEject checks if a volume can be ejected. +// +// The function returns the following values: +// +// - ok: TRUE if the volume can be ejected. FALSE otherwise. +func (volume *Volume) CanEject() bool { + var _arg0 *C.GVolume // out + var _cret C.gboolean // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_can_eject(_arg0) + runtime.KeepAlive(volume) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanMount checks if a volume can be mounted. +// +// The function returns the following values: +// +// - ok: TRUE if the volume can be mounted. FALSE otherwise. +func (volume *Volume) CanMount() bool { + var _arg0 *C.GVolume // out + var _cret C.gboolean // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_can_mount(_arg0) + runtime.KeepAlive(volume) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Eject ejects a volume. This is an asynchronous operation, and is finished by +// calling g_volume_eject_finish() with the volume and Result returned in the +// callback. +// +// Deprecated: Use g_volume_eject_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - callback (optional) or NULL. +func (volume *Volume) Eject(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + var _arg0 *C.GVolume // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_volume_eject(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(volume) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// EjectFinish finishes ejecting a volume. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// Deprecated: Use g_volume_eject_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (volume *Volume) EjectFinish(result AsyncResulter) error { + var _arg0 *C.GVolume // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_volume_eject_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(volume) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// EjectWithOperation ejects a volume. This is an asynchronous operation, +// and is finished by calling g_volume_eject_with_operation_finish() with the +// volume and Result data returned in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (volume *Volume) EjectWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GVolume // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_volume_eject_with_operation(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(volume) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// EjectWithOperationFinish finishes ejecting a volume. If any errors occurred +// during the operation, error will be set to contain the errors and FALSE will +// be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (volume *Volume) EjectWithOperationFinish(result AsyncResulter) error { + var _arg0 *C.GVolume // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_volume_eject_with_operation_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(volume) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// EnumerateIdentifiers gets the kinds of identifiers (#volume-identifiers) +// that volume has. Use g_volume_get_identifier() to obtain the identifiers +// themselves. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of strings containing kinds of identifiers. +// Use g_strfreev() to free. +func (volume *Volume) EnumerateIdentifiers() []string { + var _arg0 *C.GVolume // out + var _cret **C.char // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_enumerate_identifiers(_arg0) + runtime.KeepAlive(volume) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// ActivationRoot gets the activation root for a #GVolume if it is known ahead +// of mount time. Returns NULL otherwise. If not NULL and if volume is mounted, +// then the result of g_mount_get_root() on the #GMount object obtained from +// g_volume_get_mount() will always either be equal or a prefix of what this +// function returns. In other words, in code +// +// (g_file_has_prefix (volume_activation_root, mount_root) || +// g_file_equal (volume_activation_root, mount_root)) +// +// will always be TRUE. +// +// Activation roots are typically used in Monitor implementations to find the +// underlying mount to shadow, see g_mount_is_shadowed() for more details. +// +// The function returns the following values: +// +// - file (optional): activation root of volume or NULL. Use g_object_unref() +// to free. +func (volume *Volume) ActivationRoot() *File { + var _arg0 *C.GVolume // out + var _cret *C.GFile // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_get_activation_root(_arg0) + runtime.KeepAlive(volume) + + var _file *File // out + + if _cret != nil { + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _file +} + +// Drive gets the drive for the volume. +// +// The function returns the following values: +// +// - drive (optional) or NULL if volume is not associated with a drive. +// The returned object should be unreffed with g_object_unref() when no +// longer needed. +func (volume *Volume) Drive() *Drive { + var _arg0 *C.GVolume // out + var _cret *C.GDrive // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_get_drive(_arg0) + runtime.KeepAlive(volume) + + var _drive *Drive // out + + if _cret != nil { + _drive = wrapDrive(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _drive +} + +// Icon gets the icon for volume. +// +// The function returns the following values: +// +// - icon: #GIcon. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (volume *Volume) Icon() *Icon { + var _arg0 *C.GVolume // out + var _cret *C.GIcon // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_get_icon(_arg0) + runtime.KeepAlive(volume) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// Identifier gets the identifier of the given kind for volume. See the +// introduction (#volume-identifiers) for more information about volume +// identifiers. +// +// The function takes the following parameters: +// +// - kind of identifier to return. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string containing the requested +// identifier, or NULL if the #GVolume doesn't have this kind of identifier. +func (volume *Volume) Identifier(kind string) string { + var _arg0 *C.GVolume // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(kind))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_volume_get_identifier(_arg0, _arg1) + runtime.KeepAlive(volume) + runtime.KeepAlive(kind) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// GetMount gets the mount for the volume. +// +// The function returns the following values: +// +// - mount (optional) or NULL if volume isn't mounted. The returned object +// should be unreffed with g_object_unref() when no longer needed. +func (volume *Volume) GetMount() *Mount { + var _arg0 *C.GVolume // out + var _cret *C.GMount // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_get_mount(_arg0) + runtime.KeepAlive(volume) + + var _mount *Mount // out + + if _cret != nil { + _mount = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _mount +} + +// Name gets the name of volume. +// +// The function returns the following values: +// +// - utf8: name for the given volume. The returned string should be freed with +// g_free() when no longer needed. +func (volume *Volume) Name() string { + var _arg0 *C.GVolume // out + var _cret *C.char // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_get_name(_arg0) + runtime.KeepAlive(volume) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// SortKey gets the sort key for volume, if any. +// +// The function returns the following values: +// +// - utf8 (optional): sorting key for volume or NULL if no such key is +// available. +func (volume *Volume) SortKey() string { + var _arg0 *C.GVolume // out + var _cret *C.gchar // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_get_sort_key(_arg0) + runtime.KeepAlive(volume) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// SymbolicIcon gets the symbolic icon for volume. +// +// The function returns the following values: +// +// - icon: #GIcon. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (volume *Volume) SymbolicIcon() *Icon { + var _arg0 *C.GVolume // out + var _cret *C.GIcon // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_get_symbolic_icon(_arg0) + runtime.KeepAlive(volume) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// UUID gets the UUID for the volume. The reference is typically based on the +// file system UUID for the volume in question and should be considered an +// opaque string. Returns NULL if there is no UUID available. +// +// The function returns the following values: +// +// - utf8 (optional): UUID for volume or NULL if no UUID can be computed. +// The returned string should be freed with g_free() when no longer needed. +func (volume *Volume) UUID() string { + var _arg0 *C.GVolume // out + var _cret *C.char // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_get_uuid(_arg0) + runtime.KeepAlive(volume) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Mount mounts a volume. This is an asynchronous operation, and is finished by +// calling g_volume_mount_finish() with the volume and Result returned in the +// callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (volume *Volume) Mount(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + var _arg0 *C.GVolume // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountMountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountMountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_volume_mount(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(volume) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// MountFinish finishes mounting a volume. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// If the mount operation succeeded, g_volume_get_mount() on volume is +// guaranteed to return the mount right after calling this function; there's no +// need to listen for the 'mount-added' signal on Monitor. +// +// The function takes the following parameters: +// +// - result: Result. +func (volume *Volume) MountFinish(result AsyncResulter) error { + var _arg0 *C.GVolume // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_volume_mount_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(volume) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ShouldAutomount returns whether the volume should be automatically mounted. +// +// The function returns the following values: +// +// - ok: TRUE if the volume should be automatically mounted. +func (volume *Volume) ShouldAutomount() bool { + var _arg0 *C.GVolume // out + var _cret C.gboolean // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C.g_volume_should_automount(_arg0) + runtime.KeepAlive(volume) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canEject checks if a volume can be ejected. +// +// The function returns the following values: +// +// - ok: TRUE if the volume can be ejected. FALSE otherwise. +func (volume *Volume) canEject() bool { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.can_eject + + var _arg0 *C.GVolume // out + var _cret C.gboolean // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_can_eject(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// canMount checks if a volume can be mounted. +// +// The function returns the following values: +// +// - ok: TRUE if the volume can be mounted. FALSE otherwise. +func (volume *Volume) canMount() bool { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.can_mount + + var _arg0 *C.GVolume // out + var _cret C.gboolean // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_can_mount(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Changed: changed signal that is emitted when the volume's state has changed. +func (volume *Volume) changed() { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.changed + + var _arg0 *C.GVolume // out + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + C._gotk4_gio2_Volume_virtual_changed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) +} + +// Eject ejects a volume. This is an asynchronous operation, and is finished by +// calling g_volume_eject_finish() with the volume and Result returned in the +// callback. +// +// Deprecated: Use g_volume_eject_with_operation() instead. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - callback (optional) or NULL. +func (volume *Volume) eject(ctx context.Context, flags MountUnmountFlags, callback AsyncReadyCallback) { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.eject + + var _arg0 *C.GVolume // out + var _arg2 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Volume_virtual_eject(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(volume) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// ejectFinish finishes ejecting a volume. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// Deprecated: Use g_volume_eject_with_operation_finish() instead. +// +// The function takes the following parameters: +// +// - result: Result. +func (volume *Volume) ejectFinish(result AsyncResulter) error { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.eject_finish + + var _arg0 *C.GVolume // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Volume_virtual_eject_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(volume) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ejectWithOperation ejects a volume. This is an asynchronous operation, +// and is finished by calling g_volume_eject_with_operation_finish() with the +// volume and Result data returned in the callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the unmount if required for eject. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (volume *Volume) ejectWithOperation(ctx context.Context, flags MountUnmountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.eject_with_operation + + var _arg0 *C.GVolume // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountUnmountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountUnmountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Volume_virtual_eject_with_operation(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(volume) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// ejectWithOperationFinish finishes ejecting a volume. If any errors occurred +// during the operation, error will be set to contain the errors and FALSE will +// be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (volume *Volume) ejectWithOperationFinish(result AsyncResulter) error { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.eject_with_operation_finish + + var _arg0 *C.GVolume // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Volume_virtual_eject_with_operation_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(volume) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// enumerateIdentifiers gets the kinds of identifiers (#volume-identifiers) +// that volume has. Use g_volume_get_identifier() to obtain the identifiers +// themselves. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of strings containing kinds of identifiers. +// Use g_strfreev() to free. +func (volume *Volume) enumerateIdentifiers() []string { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.enumerate_identifiers + + var _arg0 *C.GVolume // out + var _cret **C.char // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_enumerate_identifiers(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// activationRoot gets the activation root for a #GVolume if it is known ahead +// of mount time. Returns NULL otherwise. If not NULL and if volume is mounted, +// then the result of g_mount_get_root() on the #GMount object obtained from +// g_volume_get_mount() will always either be equal or a prefix of what this +// function returns. In other words, in code +// +// (g_file_has_prefix (volume_activation_root, mount_root) || +// g_file_equal (volume_activation_root, mount_root)) +// +// will always be TRUE. +// +// Activation roots are typically used in Monitor implementations to find the +// underlying mount to shadow, see g_mount_is_shadowed() for more details. +// +// The function returns the following values: +// +// - file (optional): activation root of volume or NULL. Use g_object_unref() +// to free. +func (volume *Volume) activationRoot() *File { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.get_activation_root + + var _arg0 *C.GVolume // out + var _cret *C.GFile // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_get_activation_root(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _file *File // out + + if _cret != nil { + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _file +} + +// Drive gets the drive for the volume. +// +// The function returns the following values: +// +// - drive (optional) or NULL if volume is not associated with a drive. +// The returned object should be unreffed with g_object_unref() when no +// longer needed. +func (volume *Volume) drive() *Drive { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.get_drive + + var _arg0 *C.GVolume // out + var _cret *C.GDrive // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_get_drive(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _drive *Drive // out + + if _cret != nil { + _drive = wrapDrive(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _drive +} + +// Icon gets the icon for volume. +// +// The function returns the following values: +// +// - icon: #GIcon. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (volume *Volume) icon() *Icon { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.get_icon + + var _arg0 *C.GVolume // out + var _cret *C.GIcon // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_get_icon(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// Identifier gets the identifier of the given kind for volume. See the +// introduction (#volume-identifiers) for more information about volume +// identifiers. +// +// The function takes the following parameters: +// +// - kind of identifier to return. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string containing the requested +// identifier, or NULL if the #GVolume doesn't have this kind of identifier. +func (volume *Volume) identifier(kind string) string { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.get_identifier + + var _arg0 *C.GVolume // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(kind))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_Volume_virtual_get_identifier(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volume) + runtime.KeepAlive(kind) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Mount gets the mount for the volume. +// +// The function returns the following values: +// +// - mount (optional) or NULL if volume isn't mounted. The returned object +// should be unreffed with g_object_unref() when no longer needed. +func (volume *Volume) mount() *Mount { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.get_mount + + var _arg0 *C.GVolume // out + var _cret *C.GMount // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_get_mount(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _mount *Mount // out + + if _cret != nil { + _mount = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _mount +} + +// Name gets the name of volume. +// +// The function returns the following values: +// +// - utf8: name for the given volume. The returned string should be freed with +// g_free() when no longer needed. +func (volume *Volume) name() string { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.get_name + + var _arg0 *C.GVolume // out + var _cret *C.char // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_get_name(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// sortKey gets the sort key for volume, if any. +// +// The function returns the following values: +// +// - utf8 (optional): sorting key for volume or NULL if no such key is +// available. +func (volume *Volume) sortKey() string { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.get_sort_key + + var _arg0 *C.GVolume // out + var _cret *C.gchar // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_get_sort_key(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// symbolicIcon gets the symbolic icon for volume. +// +// The function returns the following values: +// +// - icon: #GIcon. The returned object should be unreffed with +// g_object_unref() when no longer needed. +func (volume *Volume) symbolicIcon() *Icon { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.get_symbolic_icon + + var _arg0 *C.GVolume // out + var _cret *C.GIcon // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_get_symbolic_icon(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _icon +} + +// uuiD gets the UUID for the volume. The reference is typically based on the +// file system UUID for the volume in question and should be considered an +// opaque string. Returns NULL if there is no UUID available. +// +// The function returns the following values: +// +// - utf8 (optional): UUID for volume or NULL if no UUID can be computed. +// The returned string should be freed with g_free() when no longer needed. +func (volume *Volume) uuiD() string { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.get_uuid + + var _arg0 *C.GVolume // out + var _cret *C.char // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_get_uuid(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// mountFinish finishes mounting a volume. If any errors occurred during +// the operation, error will be set to contain the errors and FALSE will be +// returned. +// +// If the mount operation succeeded, g_volume_get_mount() on volume is +// guaranteed to return the mount right after calling this function; there's no +// need to listen for the 'mount-added' signal on Monitor. +// +// The function takes the following parameters: +// +// - result: Result. +func (volume *Volume) mountFinish(result AsyncResulter) error { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.mount_finish + + var _arg0 *C.GVolume // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Volume_virtual_mount_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(volume) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// mountFn mounts a volume. This is an asynchronous operation, and is finished +// by calling g_volume_mount_finish() with the volume and Result returned in the +// callback. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - flags affecting the operation. +// - mountOperation (optional) or NULL to avoid user interaction. +// - callback (optional) or NULL. +func (volume *Volume) mountFn(ctx context.Context, flags MountMountFlags, mountOperation *MountOperation, callback AsyncReadyCallback) { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.mount_fn + + var _arg0 *C.GVolume // out + var _arg3 *C.GCancellable // out + var _arg1 C.GMountMountFlags // out + var _arg2 *C.GMountOperation // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GMountMountFlags(flags) + if mountOperation != nil { + _arg2 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(mountOperation).Native())) + } + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Volume_virtual_mount_fn(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(volume) + runtime.KeepAlive(ctx) + runtime.KeepAlive(flags) + runtime.KeepAlive(mountOperation) + runtime.KeepAlive(callback) +} + +// Removed signal that is emitted when the #GVolume have been removed. If the +// recipient is holding references to the object they should release them so the +// object can be finalized. +func (volume *Volume) removed() { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.removed + + var _arg0 *C.GVolume // out + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + C._gotk4_gio2_Volume_virtual_removed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) +} + +// shouldAutomount returns whether the volume should be automatically mounted. +// +// The function returns the following values: +// +// - ok: TRUE if the volume should be automatically mounted. +func (volume *Volume) shouldAutomount() bool { + gclass := (*C.GVolumeIface)(coreglib.PeekParentClass(volume)) + fnarg := gclass.should_automount + + var _arg0 *C.GVolume // out + var _cret C.gboolean // in + + _arg0 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + _cret = C._gotk4_gio2_Volume_virtual_should_automount(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volume) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// AppInfoMonitor: GAppInfoMonitor monitors application information for changes. +// +// GAppInfoMonitor is a very simple object used for monitoring the app info +// database for changes (newly installed or removed applications). +// +// Call gio.AppInfoMonitor().Get to get a GAppInfoMonitor and connect to the +// gio.AppInfoMonitor::changed signal. The signal will be emitted once when +// the app info database changes, and will not be emitted again until after +// the next call to gio.AppInfo().GetAll or another g_app_info_*() function. +// This is because monitoring the app info database for changes is expensive. +// +// The following functions will re-arm the gio.AppInfoMonitor::changed signal so +// it can be emitted again: +// +// - gio.AppInfo().GetAll +// - gio.AppInfo().GetAllForType +// - gio.AppInfo().GetDefaultForType +// - gio.AppInfo().GetFallbackForType +// - gio.AppInfo().GetRecommendedForType +// - g_desktop_app_info_get_implementations() +// (../gio-unix/type_func.DesktopAppInfo.get_implementation.html) +// - g_desktop_app_info_new() (../gio-unix/ctor.DesktopAppInfo.new.html) +// - g_desktop_app_info_new_from_filename() +// (../gio-unix/ctor.DesktopAppInfo.new_from_filename.html) +// - g_desktop_app_info_new_from_keyfile() +// (../gio-unix/ctor.DesktopAppInfo.new_from_keyfile.html) +// - g_desktop_app_info_search() +// (../gio-unix/type_func.DesktopAppInfo.search.html) +// +// The latter functions are available if using GDesktopAppInfo +// (../gio-unix/class.DesktopAppInfo.html) from gio-unix-2.0.pc (GIR namespace +// GioUnix-2.0). +// +// In the usual case, applications should try to make note of the change +// (doing things like invalidating caches) but not act on it. In particular, +// applications should avoid making calls to GAppInfo APIs in response to +// the change signal, deferring these until the time that the updated data is +// actually required. The exception to this case is when application information +// is actually being displayed on the screen (for example, during a search or +// when the list of all applications is shown). The reason for this is that +// changes to the list of installed applications often come in groups (like +// during system updates) and rescanning the list on every change is pointless +// and expensive. +type AppInfoMonitor struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*AppInfoMonitor)(nil) +) + +func wrapAppInfoMonitor(obj *coreglib.Object) *AppInfoMonitor { + return &AppInfoMonitor{ + Object: obj, + } +} + +func marshalAppInfoMonitor(p uintptr) (interface{}, error) { + return wrapAppInfoMonitor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectChanged: signal emitted when the app info database changes, when +// applications are installed or removed. +func (v *AppInfoMonitor) ConnectChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(v, "changed", false, unsafe.Pointer(C._gotk4_gio2_AppInfoMonitor_ConnectChanged), f) +} + +// AppInfoMonitorGet gets the InfoMonitor for the current thread-default main +// context. +// +// The InfoMonitor will emit a "changed" signal in the thread-default main +// context whenever the list of installed applications (as reported by +// g_app_info_get_all()) may have changed. +// +// The InfoMonitor::changed signal will only be emitted once until +// g_app_info_get_all() (or another g_app_info_*() function) is called. Doing so +// will re-arm the signal ready to notify about the next change. +// +// You must only call g_object_unref() on the return value from under the same +// main context as you created it. +// +// The function returns the following values: +// +// - appInfoMonitor: reference to a InfoMonitor. +func AppInfoMonitorGet() *AppInfoMonitor { + var _cret *C.GAppInfoMonitor // in + + _cret = C.g_app_info_monitor_get() + + var _appInfoMonitor *AppInfoMonitor // out + + _appInfoMonitor = wrapAppInfoMonitor(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _appInfoMonitor +} + +// AppLaunchContextOverrides contains methods that are overridable. +type AppLaunchContextOverrides struct { + // Display gets the display string for the context. This is used to ensure + // new applications are started on the same display as the launching + // application, by setting the DISPLAY environment variable. + // + // The function takes the following parameters: + // + // - info: Info. + // - files of #GFile objects. + // + // The function returns the following values: + // + // - utf8 (optional): display string for the display. + Display func(info AppInfor, files []Filer) string + // StartupNotifyID initiates startup notification for the application and + // returns the XDG_ACTIVATION_TOKEN or DESKTOP_STARTUP_ID for the launched + // operation, if supported. + // + // The returned token may be referred to equivalently as an + // ‘activation token’ (using Wayland terminology) or a ‘startup + // sequence ID’ (using X11 terminology). The two are interoperable + // (https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/x11-interoperation.rst). + // + // Activation tokens are defined in the XDG Activation + // Protocol (https://wayland.app/protocols/xdg-activation-v1), + // and startup notification IDs are defined in the + // freedesktop.org Startup Notification Protocol + // (http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt). + // + // Support for the XDG Activation Protocol was added in GLib 2.76. + // + // The function takes the following parameters: + // + // - info: Info. + // - files of #GFile objects. + // + // The function returns the following values: + // + // - utf8 (optional): startup notification ID for the application, or NULL + // if not supported. + StartupNotifyID func(info AppInfor, files []Filer) string + // LaunchFailed: called when an application has failed to launch, + // so that it can cancel the application startup notification started in + // g_app_launch_context_get_startup_notify_id(). + // + // The function takes the following parameters: + // + // - startupNotifyId: startup notification id that was returned by + // g_app_launch_context_get_startup_notify_id(). + LaunchFailed func(startupNotifyId string) + // The function takes the following parameters: + // + // - info + // - platformData + LaunchStarted func(info AppInfor, platformData *glib.Variant) + // The function takes the following parameters: + // + // - info + // - platformData + Launched func(info AppInfor, platformData *glib.Variant) +} + +func defaultAppLaunchContextOverrides(v *AppLaunchContext) AppLaunchContextOverrides { + return AppLaunchContextOverrides{ + Display: v.display, + StartupNotifyID: v.startupNotifyID, + LaunchFailed: v.launchFailed, + LaunchStarted: v.launchStarted, + Launched: v.launched, + } +} + +// AppLaunchContext: integrating the launch with the launching application. +// This is used to handle for instance startup notification and launching the +// new application on the same screen as the launching window. +type AppLaunchContext struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*AppLaunchContext)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*AppLaunchContext, *AppLaunchContextClass, AppLaunchContextOverrides]( + GTypeAppLaunchContext, + initAppLaunchContextClass, + wrapAppLaunchContext, + defaultAppLaunchContextOverrides, + ) +} + +func initAppLaunchContextClass(gclass unsafe.Pointer, overrides AppLaunchContextOverrides, classInitFunc func(*AppLaunchContextClass)) { + pclass := (*C.GAppLaunchContextClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeAppLaunchContext)))) + + if overrides.Display != nil { + pclass.get_display = (*[0]byte)(C._gotk4_gio2_AppLaunchContextClass_get_display) + } + + if overrides.StartupNotifyID != nil { + pclass.get_startup_notify_id = (*[0]byte)(C._gotk4_gio2_AppLaunchContextClass_get_startup_notify_id) + } + + if overrides.LaunchFailed != nil { + pclass.launch_failed = (*[0]byte)(C._gotk4_gio2_AppLaunchContextClass_launch_failed) + } + + if overrides.LaunchStarted != nil { + pclass.launch_started = (*[0]byte)(C._gotk4_gio2_AppLaunchContextClass_launch_started) + } + + if overrides.Launched != nil { + pclass.launched = (*[0]byte)(C._gotk4_gio2_AppLaunchContextClass_launched) + } + + if classInitFunc != nil { + class := (*AppLaunchContextClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapAppLaunchContext(obj *coreglib.Object) *AppLaunchContext { + return &AppLaunchContext{ + Object: obj, + } +} + +func marshalAppLaunchContext(p uintptr) (interface{}, error) { + return wrapAppLaunchContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectLaunchFailed signal is emitted when a Info launch fails. The startup +// notification id is provided, so that the launcher can cancel the startup +// notification. +// +// Because a launch operation may involve spawning multiple instances of the +// target application, you should expect this signal to be emitted multiple +// times, one for each spawned instance. +func (context *AppLaunchContext) ConnectLaunchFailed(f func(startupNotifyId string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(context, "launch-failed", false, unsafe.Pointer(C._gotk4_gio2_AppLaunchContext_ConnectLaunchFailed), f) +} + +// ConnectLaunchStarted signal is emitted when a Info is about to be launched. +// If non-null the platform_data is an GVariant dictionary mapping strings to +// variants (ie a{sv}), which contains additional, platform-specific data about +// this launch. On UNIX, at least the startup-notification-id keys will be +// present. +// +// The value of the startup-notification-id key (type s) is a startup +// notification ID corresponding to the format from the [startup-notification +// specification](https://specifications.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt). +// It allows tracking the progress of the launchee through startup. +// +// It is guaranteed that this signal is followed by either a +// LaunchContext::launched or LaunchContext::launch-failed signal. +// +// Because a launch operation may involve spawning multiple instances of the +// target application, you should expect this signal to be emitted multiple +// times, one for each spawned instance. +func (context *AppLaunchContext) ConnectLaunchStarted(f func(info AppInfor, platformData *glib.Variant)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(context, "launch-started", false, unsafe.Pointer(C._gotk4_gio2_AppLaunchContext_ConnectLaunchStarted), f) +} + +// ConnectLaunched signal is emitted when a Info is successfully launched. +// +// Because a launch operation may involve spawning multiple instances of the +// target application, you should expect this signal to be emitted multiple +// times, one time for each spawned instance. +// +// The platform_data is an GVariant dictionary mapping strings to variants (ie +// a{sv}), which contains additional, platform-specific data about this launch. +// On UNIX, at least the pid and startup-notification-id keys will be present. +// +// Since 2.72 the pid may be 0 if the process id wasn't known (for example +// if the process was launched via D-Bus). The pid may not be set at all in +// subsequent releases. +// +// On Windows, pid is guaranteed to be valid only for the duration of the +// LaunchContext::launched signal emission; after the signal is emitted, +// GLib will call g_spawn_close_pid(). If you need to keep the #GPid after the +// signal has been emitted, then you can duplicate pid using DuplicateHandle(). +func (context *AppLaunchContext) ConnectLaunched(f func(info AppInfor, platformData *glib.Variant)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(context, "launched", false, unsafe.Pointer(C._gotk4_gio2_AppLaunchContext_ConnectLaunched), f) +} + +// NewAppLaunchContext creates a new application launch context. This is +// not normally used, instead you instantiate a subclass of this, such as +// AppLaunchContext. +// +// The function returns the following values: +// +// - appLaunchContext: LaunchContext. +func NewAppLaunchContext() *AppLaunchContext { + var _cret *C.GAppLaunchContext // in + + _cret = C.g_app_launch_context_new() + + var _appLaunchContext *AppLaunchContext // out + + _appLaunchContext = wrapAppLaunchContext(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _appLaunchContext +} + +// Display gets the display string for the context. This is used to ensure new +// applications are started on the same display as the launching application, +// by setting the DISPLAY environment variable. +// +// The function takes the following parameters: +// +// - info: Info. +// - files of #GFile objects. +// +// The function returns the following values: +// +// - utf8 (optional): display string for the display. +func (context *AppLaunchContext) Display(info AppInfor, files []Filer) string { + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.GAppInfo // out + var _arg2 *C.GList // out + var _cret *C.char // in + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + for i := len(files) - 1; i >= 0; i-- { + src := files[i] + var dst *C.GFile // out + dst = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg2 = C.g_list_prepend(_arg2, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg2) + + _cret = C.g_app_launch_context_get_display(_arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(info) + runtime.KeepAlive(files) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Environment gets the complete environment variable list to be passed to +// the child process when context is used to launch an application. This is a +// NULL-terminated array of strings, where each string has the form KEY=VALUE. +// +// The function returns the following values: +// +// - filenames: the child's environment. +func (context *AppLaunchContext) Environment() []string { + var _arg0 *C.GAppLaunchContext // out + var _cret **C.char // in + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + _cret = C.g_app_launch_context_get_environment(_arg0) + runtime.KeepAlive(context) + + var _filenames []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _filenames = make([]string, i) + for i := range src { + _filenames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _filenames +} + +// StartupNotifyID initiates startup notification for the application and +// returns the XDG_ACTIVATION_TOKEN or DESKTOP_STARTUP_ID for the launched +// operation, if supported. +// +// The returned token may be referred to equivalently as an +// ‘activation token’ (using Wayland terminology) or a ‘startup +// sequence ID’ (using X11 terminology). The two are interoperable +// (https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/x11-interoperation.rst). +// +// Activation tokens are defined in the XDG Activation Protocol +// (https://wayland.app/protocols/xdg-activation-v1), and startup notification +// IDs are defined in the freedesktop.org Startup Notification Protocol +// (http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt). +// +// Support for the XDG Activation Protocol was added in GLib 2.76. +// +// The function takes the following parameters: +// +// - info: Info. +// - files of #GFile objects. +// +// The function returns the following values: +// +// - utf8 (optional): startup notification ID for the application, or NULL if +// not supported. +func (context *AppLaunchContext) StartupNotifyID(info AppInfor, files []Filer) string { + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.GAppInfo // out + var _arg2 *C.GList // out + var _cret *C.char // in + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + for i := len(files) - 1; i >= 0; i-- { + src := files[i] + var dst *C.GFile // out + dst = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg2 = C.g_list_prepend(_arg2, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg2) + + _cret = C.g_app_launch_context_get_startup_notify_id(_arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(info) + runtime.KeepAlive(files) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// LaunchFailed: called when an application has failed to launch, +// so that it can cancel the application startup notification started in +// g_app_launch_context_get_startup_notify_id(). +// +// The function takes the following parameters: +// +// - startupNotifyId: startup notification id that was returned by +// g_app_launch_context_get_startup_notify_id(). +func (context *AppLaunchContext) LaunchFailed(startupNotifyId string) { + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.char // out + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(startupNotifyId))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_app_launch_context_launch_failed(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(startupNotifyId) +} + +// Setenv arranges for variable to be set to value in the child's environment +// when context is used to launch an application. +// +// The function takes the following parameters: +// +// - variable: environment variable to set. +// - value for to set the variable to. +func (context *AppLaunchContext) Setenv(variable, value string) { + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.char // out + var _arg2 *C.char // out + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(variable))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_app_launch_context_setenv(_arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(variable) + runtime.KeepAlive(value) +} + +// Unsetenv arranges for variable to be unset in the child's environment when +// context is used to launch an application. +// +// The function takes the following parameters: +// +// - variable: environment variable to remove. +func (context *AppLaunchContext) Unsetenv(variable string) { + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.char // out + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(variable))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_app_launch_context_unsetenv(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(variable) +} + +// Display gets the display string for the context. This is used to ensure new +// applications are started on the same display as the launching application, +// by setting the DISPLAY environment variable. +// +// The function takes the following parameters: +// +// - info: Info. +// - files of #GFile objects. +// +// The function returns the following values: +// +// - utf8 (optional): display string for the display. +func (context *AppLaunchContext) display(info AppInfor, files []Filer) string { + gclass := (*C.GAppLaunchContextClass)(coreglib.PeekParentClass(context)) + fnarg := gclass.get_display + + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.GAppInfo // out + var _arg2 *C.GList // out + var _cret *C.char // in + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + for i := len(files) - 1; i >= 0; i-- { + src := files[i] + var dst *C.GFile // out + dst = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg2 = C.g_list_prepend(_arg2, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg2) + + _cret = C._gotk4_gio2_AppLaunchContext_virtual_get_display(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(info) + runtime.KeepAlive(files) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// startupNotifyID initiates startup notification for the application and +// returns the XDG_ACTIVATION_TOKEN or DESKTOP_STARTUP_ID for the launched +// operation, if supported. +// +// The returned token may be referred to equivalently as an +// ‘activation token’ (using Wayland terminology) or a ‘startup +// sequence ID’ (using X11 terminology). The two are interoperable +// (https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/x11-interoperation.rst). +// +// Activation tokens are defined in the XDG Activation Protocol +// (https://wayland.app/protocols/xdg-activation-v1), and startup notification +// IDs are defined in the freedesktop.org Startup Notification Protocol +// (http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt). +// +// Support for the XDG Activation Protocol was added in GLib 2.76. +// +// The function takes the following parameters: +// +// - info: Info. +// - files of #GFile objects. +// +// The function returns the following values: +// +// - utf8 (optional): startup notification ID for the application, or NULL if +// not supported. +func (context *AppLaunchContext) startupNotifyID(info AppInfor, files []Filer) string { + gclass := (*C.GAppLaunchContextClass)(coreglib.PeekParentClass(context)) + fnarg := gclass.get_startup_notify_id + + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.GAppInfo // out + var _arg2 *C.GList // out + var _cret *C.char // in + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + for i := len(files) - 1; i >= 0; i-- { + src := files[i] + var dst *C.GFile // out + dst = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(src).Native())) + _arg2 = C.g_list_prepend(_arg2, C.gpointer(unsafe.Pointer(dst))) + } + defer C.g_list_free(_arg2) + + _cret = C._gotk4_gio2_AppLaunchContext_virtual_get_startup_notify_id(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(info) + runtime.KeepAlive(files) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// launchFailed: called when an application has failed to launch, +// so that it can cancel the application startup notification started in +// g_app_launch_context_get_startup_notify_id(). +// +// The function takes the following parameters: +// +// - startupNotifyId: startup notification id that was returned by +// g_app_launch_context_get_startup_notify_id(). +func (context *AppLaunchContext) launchFailed(startupNotifyId string) { + gclass := (*C.GAppLaunchContextClass)(coreglib.PeekParentClass(context)) + fnarg := gclass.launch_failed + + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.char // out + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(startupNotifyId))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_AppLaunchContext_virtual_launch_failed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(startupNotifyId) +} + +// The function takes the following parameters: +// +// - info +// - platformData +func (context *AppLaunchContext) launchStarted(info AppInfor, platformData *glib.Variant) { + gclass := (*C.GAppLaunchContextClass)(coreglib.PeekParentClass(context)) + fnarg := gclass.launch_started + + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.GAppInfo // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(platformData))) + + C._gotk4_gio2_AppLaunchContext_virtual_launch_started(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(info) + runtime.KeepAlive(platformData) +} + +// The function takes the following parameters: +// +// - info +// - platformData +func (context *AppLaunchContext) launched(info AppInfor, platformData *glib.Variant) { + gclass := (*C.GAppLaunchContextClass)(coreglib.PeekParentClass(context)) + fnarg := gclass.launched + + var _arg0 *C.GAppLaunchContext // out + var _arg1 *C.GAppInfo // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GAppLaunchContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.GAppInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(platformData))) + + C._gotk4_gio2_AppLaunchContext_virtual_launched(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(info) + runtime.KeepAlive(platformData) +} + +// ApplicationOverrides contains methods that are overridable. +type ApplicationOverrides struct { + // Activate activates the application. + // + // In essence, this results in the #GApplication::activate signal being + // emitted in the primary instance. + // + // The application must be registered before calling this function. + Activate func() + // AddPlatformData: invoked (locally) to add 'platform data' to be sent to + // the primary instance when activating, opening or invoking actions. + AddPlatformData func(builder *glib.VariantBuilder) + // AfterEmit: invoked on the primary instance after 'activate', 'open', + // 'command-line' or any action invocation, gets the 'platform data' from + // the calling instance. + AfterEmit func(platformData *glib.Variant) + // BeforeEmit: invoked on the primary instance before 'activate', 'open', + // 'command-line' or any action invocation, gets the 'platform data' from + // the calling instance. + BeforeEmit func(platformData *glib.Variant) + // CommandLine: invoked on the primary instance when a command-line is not + // handled locally. + CommandLine func(commandLine *ApplicationCommandLine) int + // DBusRegister: invoked locally during registration, if the application + // is using its D-Bus backend. You can use this to export extra objects + // on the bus, that need to exist before the application tries to own the + // bus name. The function is passed the BusConnection to to session bus, + // and the object path that #GApplication will use to export its D-Bus API. + // If this function returns TRUE, registration will proceed; otherwise + // registration will abort. Since: 2.34. + // + // The function takes the following parameters: + // + // - connection + // - objectPath + DBusRegister func(connection *DBusConnection, objectPath string) error + // DBusUnregister: invoked locally during unregistration, if the application + // is using its D-Bus backend. Use this to undo anything done by the + // dbus_register vfunc. Since: 2.34. + // + // The function takes the following parameters: + // + // - connection + // - objectPath + DBusUnregister func(connection *DBusConnection, objectPath string) + // HandleLocalOptions: invoked locally after the parsing of the commandline + // options has occurred. Since: 2.40. + HandleLocalOptions func(options *glib.VariantDict) int + // NameLost: invoked when another instance is taking over the name. Since: + // 2.60. + NameLost func() bool + // Open opens the given files. + // + // In essence, this results in the #GApplication::open signal being emitted + // in the primary instance. + // + // n_files must be greater than zero. + // + // hint is simply passed through to the ::open signal. It is intended to + // be used by applications that have multiple modes for opening files (eg: + // "view" vs "edit", etc). Unless you have a need for this functionality, + // you should use "". + // + // The application must be registered before calling this function and it + // must have the G_APPLICATION_HANDLES_OPEN flag set. + // + // The function takes the following parameters: + // + // - files: array of #GFiles to open. + // - hint (or ""), but never NULL. + Open func(files []Filer, hint string) + // QuitMainloop: used to be invoked on the primary instance when the use + // count of the application drops to zero (and after any inactivity timeout, + // if requested). Not used anymore since 2.32. + QuitMainloop func() + // RunMainloop: used to be invoked on the primary instance from + // g_application_run() if the use-count is non-zero. Since 2.32, + // GApplication is iterating the main context directly and is not using + // run_mainloop anymore. + RunMainloop func() + // Shutdown: invoked only on the registered primary instance immediately + // after the main loop terminates. + Shutdown func() + // Startup: invoked on the primary instance immediately after registration. + Startup func() +} + +func defaultApplicationOverrides(v *Application) ApplicationOverrides { + return ApplicationOverrides{ + Activate: v.activate, + AddPlatformData: v.addPlatformData, + AfterEmit: v.afterEmit, + BeforeEmit: v.beforeEmit, + CommandLine: v.commandLine, + DBusRegister: v.dBusRegister, + DBusUnregister: v.dBusUnregister, + HandleLocalOptions: v.handleLocalOptions, + NameLost: v.nameLost, + Open: v.open, + QuitMainloop: v.quitMainloop, + RunMainloop: v.runMainloop, + Shutdown: v.shutdown, + Startup: v.startup, + } +} + +// Application: GApplication is the core class for application support. +// +// A GApplication is the foundation of an application. It wraps some low-level +// platform-specific services and is intended to act as the foundation for +// higher-level application classes such as GtkApplication or MxApplication. In +// general, you should not use this class outside of a higher level framework. +// +// GApplication provides convenient life-cycle management by maintaining a "use +// count" for the primary application instance. The use count can be changed +// using gio.Application.Hold() and gio.Application.Release(). If it drops to +// zero, the application exits. Higher-level classes such as GtkApplication +// employ the use count to ensure that the application stays alive as long as it +// has any opened windows. +// +// Another feature that GApplication (optionally) provides is process +// uniqueness. Applications can make use of this functionality by providing a +// unique application ID. If given, only one application with this ID can be +// running at a time per session. The session concept is platform-dependent, +// but corresponds roughly to a graphical desktop login. When your application +// is launched again, its arguments are passed through platform communication to +// the already running program. The already running instance of the program is +// called the "primary instance"; for non-unique applications this is always the +// current instance. On Linux, the D-Bus session bus is used for communication. +// +// The use of GApplication differs from some other commonly-used uniqueness +// libraries (such as libunique) in important ways. The application is not +// expected to manually register itself and check if it is the primary instance. +// Instead, the main() function of a GApplication should do very little more +// than instantiating the application instance, possibly connecting signal +// handlers, then calling gio.Application.Run(). All checks for uniqueness +// are done internally. If the application is the primary instance then the +// startup signal is emitted and the mainloop runs. If the application is +// not the primary instance then a signal is sent to the primary instance and +// gio.Application.Run() promptly returns. See the code examples below. +// +// If used, the expected form of an application identifier +// is the same as that of a D-Bus well-known bus name +// (https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus). +// Examples include: com.example.MyApp, org.example.internal_apps.Calculator, +// org._7_zip.Archiver. For details on valid application identifiers, see +// gio.Application().IDIsValid. +// +// On Linux, the application identifier is claimed as a well-known bus name on +// the user's session bus. This means that the uniqueness of your application +// is scoped to the current session. It also means that your application may +// provide additional services (through registration of other object paths) at +// that bus name. The registration of these object paths should be done with +// the shared GDBus session bus. Note that due to the internal architecture of +// GDBus, method calls can be dispatched at any time (even if a main loop is +// not running). For this reason, you must ensure that any object paths that you +// wish to register are registered before #GApplication attempts to acquire the +// bus name of your application (which happens in gio.Application.Register()). +// Unfortunately, this means that you cannot use gio.Application:is-remote to +// decide if you want to register object paths. +// +// GApplication also implements the gio.ActionGroup and gio.ActionMap +// interfaces and lets you easily export actions by adding them with +// gio.ActionMap.AddAction(). When invoking an action by calling +// gio.ActionGroup.ActivateAction() on the application, it is always invoked +// in the primary instance. The actions are also exported on the session bus, +// and GIO provides the gio.DBusActionGroup wrapper to conveniently access +// them remotely. GIO provides a gio.DBusMenuModel wrapper for remote access to +// exported gio.MenuModels. +// +// Note: Due to the fact that actions are exported on the session bus, using +// maybe parameters is not supported, since D-Bus does not support maybe types. +// +// There is a number of different entry points into a GApplication: +// +// - via 'Activate' (i.e. just starting the application) +// +// - via 'Open' (i.e. opening some files) +// +// - by handling a command-line +// +// - via activating an action +// +// The gio.Application::startup signal lets you handle the application +// initialization for all of these in a single place. +// +// Regardless of which of these entry points is used to start the application, +// GApplication passes some ‘platform data’ from the launching instance +// to the primary instance, in the form of a glib.Variant dictionary +// mapping strings to variants. To use platform data, override the +// gio.Application.BeforeEmit() or gio.Application.AfterEmit() virtual functions +// in your GApplication subclass. When dealing with gio.ApplicationCommandLine +// objects, the platform data is directly available via +// gio.ApplicationCommandLine.GetCwd(), gio.ApplicationCommandLine.GetEnviron() +// and gio.ApplicationCommandLine.GetPlatformData(). +// +// As the name indicates, the platform data may vary depending on the +// operating system, but it always includes the current directory (key cwd), +// and optionally the environment (ie the set of environment variables and +// their values) of the calling process (key environ). The environment is only +// added to the platform data if the G_APPLICATION_SEND_ENVIRONMENT flag is set. +// GApplication subclasses can add their own platform data by overriding +// the gio.Application.AddPlatformData() virtual function. For instance, +// GtkApplication adds startup notification data in this way. +// +// To parse commandline arguments you may handle the +// gio.Application::command-line signal or override the +// gio.Application.LocalCommandLine() virtual funcion, to parse them in either +// the primary instance or the local instance, respectively. +// +// For an example of opening files with a +// GApplication, see gapplication-example-open.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-open.c). +// +// For an example of using actions with GApplication, +// see gapplication-example-actions.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-actions.c). +// +// For an example of using extra D-Bus hooks with +// GApplication, see gapplication-example-dbushooks.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-dbushooks.c). +type Application struct { + _ [0]func() // equal guard + *coreglib.Object + + ActionGroup + ActionMap +} + +var ( + _ coreglib.Objector = (*Application)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*Application, *ApplicationClass, ApplicationOverrides]( + GTypeApplication, + initApplicationClass, + wrapApplication, + defaultApplicationOverrides, + ) +} + +func initApplicationClass(gclass unsafe.Pointer, overrides ApplicationOverrides, classInitFunc func(*ApplicationClass)) { + pclass := (*C.GApplicationClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeApplication)))) + + if overrides.Activate != nil { + pclass.activate = (*[0]byte)(C._gotk4_gio2_ApplicationClass_activate) + } + + if overrides.AddPlatformData != nil { + pclass.add_platform_data = (*[0]byte)(C._gotk4_gio2_ApplicationClass_add_platform_data) + } + + if overrides.AfterEmit != nil { + pclass.after_emit = (*[0]byte)(C._gotk4_gio2_ApplicationClass_after_emit) + } + + if overrides.BeforeEmit != nil { + pclass.before_emit = (*[0]byte)(C._gotk4_gio2_ApplicationClass_before_emit) + } + + if overrides.CommandLine != nil { + pclass.command_line = (*[0]byte)(C._gotk4_gio2_ApplicationClass_command_line) + } + + if overrides.DBusRegister != nil { + pclass.dbus_register = (*[0]byte)(C._gotk4_gio2_ApplicationClass_dbus_register) + } + + if overrides.DBusUnregister != nil { + pclass.dbus_unregister = (*[0]byte)(C._gotk4_gio2_ApplicationClass_dbus_unregister) + } + + if overrides.HandleLocalOptions != nil { + pclass.handle_local_options = (*[0]byte)(C._gotk4_gio2_ApplicationClass_handle_local_options) + } + + if overrides.NameLost != nil { + pclass.name_lost = (*[0]byte)(C._gotk4_gio2_ApplicationClass_name_lost) + } + + if overrides.Open != nil { + pclass.open = (*[0]byte)(C._gotk4_gio2_ApplicationClass_open) + } + + if overrides.QuitMainloop != nil { + pclass.quit_mainloop = (*[0]byte)(C._gotk4_gio2_ApplicationClass_quit_mainloop) + } + + if overrides.RunMainloop != nil { + pclass.run_mainloop = (*[0]byte)(C._gotk4_gio2_ApplicationClass_run_mainloop) + } + + if overrides.Shutdown != nil { + pclass.shutdown = (*[0]byte)(C._gotk4_gio2_ApplicationClass_shutdown) + } + + if overrides.Startup != nil { + pclass.startup = (*[0]byte)(C._gotk4_gio2_ApplicationClass_startup) + } + + if classInitFunc != nil { + class := (*ApplicationClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapApplication(obj *coreglib.Object) *Application { + return &Application{ + Object: obj, + ActionGroup: ActionGroup{ + Object: obj, + }, + ActionMap: ActionMap{ + Object: obj, + }, + } +} + +func marshalApplication(p uintptr) (interface{}, error) { + return wrapApplication(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectActivate signal is emitted on the primary instance when an activation +// occurs. See g_application_activate(). +func (application *Application) ConnectActivate(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "activate", false, unsafe.Pointer(C._gotk4_gio2_Application_ConnectActivate), f) +} + +// ConnectCommandLine signal is emitted on the primary instance when a +// commandline is not handled locally. See g_application_run() and the +// CommandLine documentation for more information. +func (application *Application) ConnectCommandLine(f func(commandLine *ApplicationCommandLine) (gint int)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "command-line", false, unsafe.Pointer(C._gotk4_gio2_Application_ConnectCommandLine), f) +} + +// ConnectHandleLocalOptions signal is emitted on the local instance after the +// parsing of the commandline options has occurred. +// +// You can add options to be recognised during commandline option parsing using +// g_application_add_main_option_entries() and g_application_add_option_group(). +// +// Signal handlers can inspect options (along with values pointed to from +// the arg_data of an installed Entrys) in order to decide to perform certain +// actions, including direct local handling (which may be useful for options +// like --version). +// +// In the event that the application is marked +// G_APPLICATION_HANDLES_COMMAND_LINE the "normal processing" will send +// the options dictionary to the primary instance where it can be read with +// g_application_command_line_get_options_dict(). The signal handler can modify +// the dictionary before returning, and the modified dictionary will be sent. +// +// In the event that G_APPLICATION_HANDLES_COMMAND_LINE is not set, "normal +// processing" will treat the remaining uncollected command line arguments as +// filenames or URIs. If there are no arguments, the application is activated +// by g_application_activate(). One or more arguments results in a call to +// g_application_open(). +// +// If you want to handle the local commandline arguments for +// yourself by converting them to calls to g_application_open() or +// g_action_group_activate_action() then you must be sure to register the +// application first. You should probably not call g_application_activate() for +// yourself, however: just return -1 and allow the default handler to do it for +// you. This will ensure that the --gapplication-service switch works properly +// (i.e. no activation in that case). +// +// Note that this signal is emitted from the default implementation of +// local_command_line(). If you override that function and don't chain up then +// this signal will never be emitted. +// +// You can override local_command_line() if you need more powerful capabilities +// than what is provided here, but this should not normally be required. +func (application *Application) ConnectHandleLocalOptions(f func(options *glib.VariantDict) (gint int)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "handle-local-options", false, unsafe.Pointer(C._gotk4_gio2_Application_ConnectHandleLocalOptions), f) +} + +// ConnectNameLost signal is emitted only on the registered primary instance +// when a new instance has taken over. This can only happen if the application +// is using the G_APPLICATION_ALLOW_REPLACEMENT flag. +// +// The default handler for this signal calls g_application_quit(). +func (application *Application) ConnectNameLost(f func() (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "name-lost", false, unsafe.Pointer(C._gotk4_gio2_Application_ConnectNameLost), f) +} + +// ConnectOpen signal is emitted on the primary instance when there are files to +// open. See g_application_open() for more information. +func (application *Application) ConnectOpen(f func(files []Filer, hint string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "open", false, unsafe.Pointer(C._gotk4_gio2_Application_ConnectOpen), f) +} + +// ConnectShutdown signal is emitted only on the registered primary instance +// immediately after the main loop terminates. +func (application *Application) ConnectShutdown(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "shutdown", false, unsafe.Pointer(C._gotk4_gio2_Application_ConnectShutdown), f) +} + +// ConnectStartup signal is emitted on the primary instance immediately after +// registration. See g_application_register(). +func (application *Application) ConnectStartup(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "startup", false, unsafe.Pointer(C._gotk4_gio2_Application_ConnectStartup), f) +} + +// NewApplication creates a new #GApplication instance. +// +// If non-NULL, the application id must be valid. See +// g_application_id_is_valid(). +// +// If no application ID is given then some features of #GApplication (most +// notably application uniqueness) will be disabled. +// +// The function takes the following parameters: +// +// - applicationId (optional): application id. +// - flags: application flags. +// +// The function returns the following values: +// +// - application: new #GApplication instance. +func NewApplication(applicationId string, flags ApplicationFlags) *Application { + var _arg1 *C.gchar // out + var _arg2 C.GApplicationFlags // out + var _cret *C.GApplication // in + + if applicationId != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(applicationId))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = C.GApplicationFlags(flags) + + _cret = C.g_application_new(_arg1, _arg2) + runtime.KeepAlive(applicationId) + runtime.KeepAlive(flags) + + var _application *Application // out + + _application = wrapApplication(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _application +} + +// Activate activates the application. +// +// In essence, this results in the #GApplication::activate signal being emitted +// in the primary instance. +// +// The application must be registered before calling this function. +func (application *Application) Activate() { + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C.g_application_activate(_arg0) + runtime.KeepAlive(application) +} + +// AddMainOption: add an option to be handled by application. +// +// Calling this function is the equivalent of calling +// g_application_add_main_option_entries() with a single Entry that has its +// arg_data member set to NULL. +// +// The parsed arguments will be packed into a Dict which is passed to +// #GApplication::handle-local-options. If G_APPLICATION_HANDLES_COMMAND_LINE +// is set, then it will also be sent to the primary instance. See +// g_application_add_main_option_entries() for more details. +// +// See Entry for more documentation of the arguments. +// +// The function takes the following parameters: +// +// - longName: long name of an option used to specify it in a commandline. +// - shortName: short name of an option. +// - flags from Flags. +// - arg: type of the option, as a Arg. +// - description for the option in --help output. +// - argDescription (optional): placeholder to use for the extra argument +// parsed by the option in --help output. +func (application *Application) AddMainOption(longName string, shortName byte, flags glib.OptionFlags, arg glib.OptionArg, description, argDescription string) { + var _arg0 *C.GApplication // out + var _arg1 *C.char // out + var _arg2 C.char // out + var _arg3 C.GOptionFlags // out + var _arg4 C.GOptionArg // out + var _arg5 *C.char // out + var _arg6 *C.char // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(longName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.char(shortName) + _arg3 = C.GOptionFlags(flags) + _arg4 = C.GOptionArg(arg) + _arg5 = (*C.char)(unsafe.Pointer(C.CString(description))) + defer C.free(unsafe.Pointer(_arg5)) + if argDescription != "" { + _arg6 = (*C.char)(unsafe.Pointer(C.CString(argDescription))) + defer C.free(unsafe.Pointer(_arg6)) + } + + C.g_application_add_main_option(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(application) + runtime.KeepAlive(longName) + runtime.KeepAlive(shortName) + runtime.KeepAlive(flags) + runtime.KeepAlive(arg) + runtime.KeepAlive(description) + runtime.KeepAlive(argDescription) +} + +// AddMainOptionEntries adds main option entries to be handled by application. +// +// This function is comparable to g_option_context_add_main_entries(). +// +// After the commandline arguments are parsed, the +// #GApplication::handle-local-options signal will be emitted. At this point, +// the application can inspect the values pointed to by arg_data in the given +// Entrys. +// +// Unlike Context, #GApplication supports giving a NULL arg_data for a +// non-callback Entry. This results in the argument in question being packed +// into a Dict which is also passed to #GApplication::handle-local-options, +// where it can be inspected and modified. If G_APPLICATION_HANDLES_COMMAND_LINE +// is set, then the resulting dictionary is sent to the primary instance, +// where g_application_command_line_get_options_dict() will return it. +// As it has been passed outside the process at this point, the types of all +// values in the options dict must be checked before being used. This "packing" +// is done according to the type of the argument -- booleans for normal flags, +// strings for strings, bytestrings for filenames, etc. The packing only occurs +// if the flag is given (ie: we do not pack a "false" #GVariant in the case that +// a flag is missing). +// +// In general, it is recommended that all commandline arguments are parsed +// locally. The options dictionary should then be used to transmit the result +// of the parsing to the primary instance, where g_variant_dict_lookup() can +// be used. For local options, it is possible to either use arg_data in the +// usual way, or to consult (and potentially remove) the option from the options +// dictionary. +// +// This function is new in GLib 2.40. Before then, the only real choice +// was to send all of the commandline arguments (options and all) to the +// primary instance for handling. #GApplication ignored them completely on +// the local side. Calling this function "opts in" to the new behaviour, +// and in particular, means that unrecognised options will be treated +// as errors. Unrecognised options have never been ignored when +// G_APPLICATION_HANDLES_COMMAND_LINE is unset. +// +// If #GApplication::handle-local-options needs to see the list of filenames, +// then the use of G_OPTION_REMAINING is recommended. If arg_data is NULL +// then G_OPTION_REMAINING can be used as a key into the options dictionary. +// If you do use G_OPTION_REMAINING then you need to handle these arguments for +// yourself because once they are consumed, they will no longer be visible to +// the default handling (which treats them as filenames to be opened). +// +// It is important to use the proper GVariant format when retrieving the options +// with g_variant_dict_lookup(): +// +// - for G_OPTION_ARG_NONE, use b +// +// - for G_OPTION_ARG_STRING, use &s +// +// - for G_OPTION_ARG_INT, use i +// +// - for G_OPTION_ARG_INT64, use x +// +// - for G_OPTION_ARG_DOUBLE, use d +// +// - for G_OPTION_ARG_FILENAME, use ^&ay +// +// - for G_OPTION_ARG_STRING_ARRAY, use ^a&s +// +// - for G_OPTION_ARG_FILENAME_ARRAY, use ^a&ay. +// +// The function takes the following parameters: +// +// - entries: the main options for the application. +func (application *Application) AddMainOptionEntries(entries []glib.OptionEntry) { + var _arg0 *C.GApplication // out + var _arg1 *C.GOptionEntry // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + { + _arg1 = (*C.GOptionEntry)(C.calloc(C.size_t((len(entries) + 1)), C.size_t(C.sizeof_GOptionEntry))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(entries)+1) + var zero C.GOptionEntry + out[len(entries)] = zero + for i := range entries { + out[i] = *(*C.GOptionEntry)(gextras.StructNative(unsafe.Pointer((&entries[i])))) + } + } + } + + C.g_application_add_main_option_entries(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(entries) +} + +// AddOptionGroup adds a Group to the commandline handling of application. +// +// This function is comparable to g_option_context_add_group(). +// +// Unlike g_application_add_main_option_entries(), this function does not deal +// with NULL arg_data and never transmits options to the primary instance. +// +// The reason for that is because, by the time the options arrive at the primary +// instance, it is typically too late to do anything with them. Taking the GTK +// option group as an example: GTK will already have been initialised by the +// time the #GApplication::command-line handler runs. In the case that this is +// not the first-running instance of the application, the existing instance may +// already have been running for a very long time. +// +// This means that the options from Group are only really usable in the case +// that the instance of the application being run is the first instance. Passing +// options like --display= or --gdk-debug= on future runs will have no effect on +// the existing primary instance. +// +// Calling this function will cause the options in the supplied option +// group to be parsed, but it does not cause you to be "opted in" to the +// new functionality whereby unrecognised options are rejected even if +// G_APPLICATION_HANDLES_COMMAND_LINE was given. +// +// The function takes the following parameters: +// +// - group: Group. +func (application *Application) AddOptionGroup(group *glib.OptionGroup) { + var _arg0 *C.GApplication // out + var _arg1 *C.GOptionGroup // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GOptionGroup)(gextras.StructNative(unsafe.Pointer(group))) + + C.g_application_add_option_group(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(group) +} + +// BindBusyProperty marks application as busy (see g_application_mark_busy()) +// while property on object is TRUE. +// +// The binding holds a reference to application while it is active, but not to +// object. Instead, the binding is destroyed when object is finalized. +// +// The function takes the following parameters: +// +// - object: #GObject. +// - property: name of a boolean property of object. +func (application *Application) BindBusyProperty(object *coreglib.Object, property string) { + var _arg0 *C.GApplication // out + var _arg1 C.gpointer // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = C.gpointer(unsafe.Pointer(object.Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(property))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_application_bind_busy_property(_arg0, _arg1, _arg2) + runtime.KeepAlive(application) + runtime.KeepAlive(object) + runtime.KeepAlive(property) +} + +// ApplicationID gets the unique identifier for application. +// +// The function returns the following values: +// +// - utf8 (optional): identifier for application, owned by application. +func (application *Application) ApplicationID() string { + var _arg0 *C.GApplication // out + var _cret *C.gchar // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_application_id(_arg0) + runtime.KeepAlive(application) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// DBusConnection gets the BusConnection being used by the application, or NULL. +// +// If #GApplication is using its D-Bus backend then this function will return +// the BusConnection being used for uniqueness and communication with the +// desktop environment and other instances of the application. +// +// If #GApplication is not using D-Bus then this function will return NULL. +// This includes the situation where the D-Bus backend would normally be in use +// but we were unable to connect to the bus. +// +// This function must not be called before the application has been registered. +// See g_application_get_is_registered(). +// +// The function returns the following values: +// +// - dBusConnection (optional) or NULL. +func (application *Application) DBusConnection() *DBusConnection { + var _arg0 *C.GApplication // out + var _cret *C.GDBusConnection // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_dbus_connection(_arg0) + runtime.KeepAlive(application) + + var _dBusConnection *DBusConnection // out + + if _cret != nil { + _dBusConnection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _dBusConnection +} + +// DBusObjectPath gets the D-Bus object path being used by the application, +// or NULL. +// +// If #GApplication is using its D-Bus backend then this function will return +// the D-Bus object path that #GApplication is using. If the application is +// the primary instance then there is an object published at this path. If the +// application is not the primary instance then the result of this function is +// undefined. +// +// If #GApplication is not using D-Bus then this function will return NULL. +// This includes the situation where the D-Bus backend would normally be in use +// but we were unable to connect to the bus. +// +// This function must not be called before the application has been registered. +// See g_application_get_is_registered(). +// +// The function returns the following values: +// +// - utf8 (optional): object path, or NULL. +func (application *Application) DBusObjectPath() string { + var _arg0 *C.GApplication // out + var _cret *C.gchar // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_dbus_object_path(_arg0) + runtime.KeepAlive(application) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Flags gets the flags for application. +// +// See Flags. +// +// The function returns the following values: +// +// - applicationFlags flags for application. +func (application *Application) Flags() ApplicationFlags { + var _arg0 *C.GApplication // out + var _cret C.GApplicationFlags // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_flags(_arg0) + runtime.KeepAlive(application) + + var _applicationFlags ApplicationFlags // out + + _applicationFlags = ApplicationFlags(_cret) + + return _applicationFlags +} + +// InactivityTimeout gets the current inactivity timeout for the application. +// +// This is the amount of time (in milliseconds) after the last call to +// g_application_release() before the application stops running. +// +// The function returns the following values: +// +// - guint: timeout, in milliseconds. +func (application *Application) InactivityTimeout() uint { + var _arg0 *C.GApplication // out + var _cret C.guint // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_inactivity_timeout(_arg0) + runtime.KeepAlive(application) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// IsBusy gets the application's current busy state, as set through +// g_application_mark_busy() or g_application_bind_busy_property(). +// +// The function returns the following values: +// +// - ok: TRUE if application is currently marked as busy. +func (application *Application) IsBusy() bool { + var _arg0 *C.GApplication // out + var _cret C.gboolean // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_is_busy(_arg0) + runtime.KeepAlive(application) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsRegistered checks if application is registered. +// +// An application is registered if g_application_register() has been +// successfully called. +// +// The function returns the following values: +// +// - ok: TRUE if application is registered. +func (application *Application) IsRegistered() bool { + var _arg0 *C.GApplication // out + var _cret C.gboolean // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_is_registered(_arg0) + runtime.KeepAlive(application) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsRemote checks if application is remote. +// +// If application is remote then it means that another instance of application +// already exists (the 'primary' instance). Calls to perform actions on +// application will result in the actions being performed by the primary +// instance. +// +// The value of this property cannot be accessed before g_application_register() +// has been called. See g_application_get_is_registered(). +// +// The function returns the following values: +// +// - ok: TRUE if application is remote. +func (application *Application) IsRemote() bool { + var _arg0 *C.GApplication // out + var _cret C.gboolean // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_is_remote(_arg0) + runtime.KeepAlive(application) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ResourceBasePath gets the resource base path of application. +// +// See g_application_set_resource_base_path() for more information. +// +// The function returns the following values: +// +// - utf8 (optional): base resource path, if one is set. +func (application *Application) ResourceBasePath() string { + var _arg0 *C.GApplication // out + var _cret *C.gchar // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_resource_base_path(_arg0) + runtime.KeepAlive(application) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Version gets the version of application. +// +// The function returns the following values: +// +// - utf8 (optional): version of application. +func (application *Application) Version() string { + var _arg0 *C.GApplication // out + var _cret *C.gchar // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.g_application_get_version(_arg0) + runtime.KeepAlive(application) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Hold increases the use count of application. +// +// Use this function to indicate that the application has a reason to continue +// to run. For example, g_application_hold() is called by GTK when a toplevel +// window is on the screen. +// +// To cancel the hold, call g_application_release(). +func (application *Application) Hold() { + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C.g_application_hold(_arg0) + runtime.KeepAlive(application) +} + +// MarkBusy increases the busy count of application. +// +// Use this function to indicate that the application is busy, for instance +// while a long running operation is pending. +// +// The busy state will be exposed to other processes, so a session shell will +// use that information to indicate the state to the user (e.g. with a spinner). +// +// To cancel the busy indication, use g_application_unmark_busy(). +// +// The application must be registered before calling this function. +func (application *Application) MarkBusy() { + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C.g_application_mark_busy(_arg0) + runtime.KeepAlive(application) +} + +// Open opens the given files. +// +// In essence, this results in the #GApplication::open signal being emitted in +// the primary instance. +// +// n_files must be greater than zero. +// +// hint is simply passed through to the ::open signal. It is intended to be used +// by applications that have multiple modes for opening files (eg: "view" vs +// "edit", etc). Unless you have a need for this functionality, you should use +// "". +// +// The application must be registered before calling this function and it must +// have the G_APPLICATION_HANDLES_OPEN flag set. +// +// The function takes the following parameters: +// +// - files: array of #GFiles to open. +// - hint (or ""), but never NULL. +func (application *Application) Open(files []Filer, hint string) { + var _arg0 *C.GApplication // out + var _arg1 **C.GFile // out + var _arg2 C.gint + var _arg3 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg2 = (C.gint)(len(files)) + _arg1 = (**C.GFile)(C.calloc(C.size_t(len(files)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.GFile)(_arg1), len(files)) + for i := range files { + out[i] = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(files[i]).Native())) + } + } + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(hint))) + defer C.free(unsafe.Pointer(_arg3)) + + C.g_application_open(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(application) + runtime.KeepAlive(files) + runtime.KeepAlive(hint) +} + +// Quit: immediately quits the application. +// +// Upon return to the mainloop, g_application_run() will return, calling only +// the 'shutdown' function before doing so. +// +// The hold count is ignored. Take care if your code has called +// g_application_hold() on the application and is therefore still expecting it +// to exist. (Note that you may have called g_application_hold() indirectly, +// for example through gtk_application_add_window().) +// +// The result of calling g_application_run() again after it returns is +// unspecified. +func (application *Application) Quit() { + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C.g_application_quit(_arg0) + runtime.KeepAlive(application) +} + +// Register attempts registration of the application. +// +// This is the point at which the application discovers if it is the primary +// instance or merely acting as a remote for an already-existing primary +// instance. This is implemented by attempting to acquire the application +// identifier as a unique bus name on the session bus using GDBus. +// +// If there is no application ID or if G_APPLICATION_NON_UNIQUE was given, +// then this process will always become the primary instance. +// +// Due to the internal architecture of GDBus, method calls can be dispatched +// at any time (even if a main loop is not running). For this reason, you must +// ensure that any object paths that you wish to register are registered before +// calling this function. +// +// If the application has already been registered then TRUE is returned with no +// work performed. +// +// The #GApplication::startup signal is emitted if registration succeeds and +// application is the primary instance (including the non-unique case). +// +// In the event of an error (such as cancellable being cancelled, or a +// failure to connect to the session bus), FALSE is returned and error is set +// appropriately. +// +// Note: the return value of this function is not an indicator that this +// instance is or is not the primary instance of the application. See +// g_application_get_is_remote() for that. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (application *Application) Register(ctx context.Context) error { + var _arg0 *C.GApplication // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_application_register(_arg0, _arg1, &_cerr) + runtime.KeepAlive(application) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Release: decrease the use count of application. +// +// When the use count reaches zero, the application will stop running. +// +// Never call this function except to cancel the effect of a previous call to +// g_application_hold(). +func (application *Application) Release() { + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C.g_application_release(_arg0) + runtime.KeepAlive(application) +} + +// Run runs the application. +// +// This function is intended to be run from main() and its return value is +// intended to be returned by main(). Although you are expected to pass the +// argc, argv parameters from main() to this function, it is possible to pass +// NULL if argv is not available or commandline handling is not required. Note +// that on Windows, argc and argv are ignored, and g_win32_get_command_line() is +// called internally (for proper support of Unicode commandline arguments). +// +// #GApplication will attempt to parse the commandline arguments. +// You can add commandline flags to the list of recognised options +// by way of g_application_add_main_option_entries(). After this, +// the #GApplication::handle-local-options signal is emitted, from which the +// application can inspect the values of its Entrys. +// +// #GApplication::handle-local-options is a good place to handle options +// such as --version, where an immediate reply from the local process is +// desired (instead of communicating with an already-running instance). +// A #GApplication::handle-local-options handler can stop further processing +// by returning a non-negative value, which then becomes the exit status of the +// process. +// +// What happens next depends on the flags: if G_APPLICATION_HANDLES_COMMAND_LINE +// was specified then the remaining commandline arguments are sent to the +// primary instance, where a #GApplication::command-line signal is emitted. +// Otherwise, the remaining commandline arguments are assumed to be a list +// of files. If there are no files listed, the application is activated +// via the #GApplication::activate signal. If there are one or more files, +// and G_APPLICATION_HANDLES_OPEN was specified then the files are opened via +// the #GApplication::open signal. +// +// If you are interested in doing more complicated local handling of +// the commandline then you should implement your own #GApplication +// subclass and override local_command_line(). In this case, +// you most likely want to return TRUE from your local_command_line() +// implementation to suppress the default handling. See +// [gapplication-example-cmdline2.c][https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline2.c] +// for an example. +// +// If, after the above is done, the use count of the application is zero then +// the exit status is returned immediately. If the use count is non-zero then +// the default main context is iterated until the use count falls to zero, +// at which point 0 is returned. +// +// If the G_APPLICATION_IS_SERVICE flag is set, then the service will run +// for as much as 10 seconds with a use count of zero while waiting for the +// message that caused the activation to arrive. After that, if the use count +// falls to zero the application will exit immediately, except in the case that +// g_application_set_inactivity_timeout() is in use. +// +// This function sets the prgname (g_set_prgname()), if not already set, +// to the basename of argv[0]. +// +// Much like g_main_loop_run(), this function will acquire the main context for +// the duration that the application is running. +// +// Since 2.40, applications that are not explicitly flagged as services or +// launchers (ie: neither G_APPLICATION_IS_SERVICE or G_APPLICATION_IS_LAUNCHER +// are given as flags) will check (from the default handler for +// local_command_line) if "--gapplication-service" was given in the command +// line. If this flag is present then normal commandline processing is +// interrupted and the G_APPLICATION_IS_SERVICE flag is set. This provides +// a "compromise" solution whereby running an application directly from the +// commandline will invoke it in the normal way (which can be useful for +// debugging) while still allowing applications to be D-Bus activated in +// service mode. The D-Bus service file should invoke the executable with +// "--gapplication-service" as the sole commandline argument. This approach +// is suitable for use by most graphical applications but should not be used +// from applications like editors that need precise control over when processes +// invoked via the commandline will exit and what their exit status will be. +// +// The function takes the following parameters: +// +// - argv (optional): the argv from main(), or NULL. +// +// The function returns the following values: +// +// - gint: exit status. +func (application *Application) Run(argv []string) int { + var _arg0 *C.GApplication // out + var _arg2 **C.char // out + var _arg1 C.int + var _cret C.int // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (C.int)(len(argv)) + _arg2 = (**C.char)(C.calloc(C.size_t(len(argv)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((**C.char)(_arg2), len(argv)) + for i := range argv { + out[i] = (*C.char)(unsafe.Pointer(C.CString(argv[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + + _cret = C.g_application_run(_arg0, _arg1, _arg2) + runtime.KeepAlive(application) + runtime.KeepAlive(argv) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// SendNotification sends a notification on behalf of application to the desktop +// shell. There is no guarantee that the notification is displayed immediately, +// or even at all. +// +// Notifications may persist after the application exits. It will be +// D-Bus-activated when the notification or one of its actions is activated. +// +// Modifying notification after this call has no effect. However, the object can +// be reused for a later call to this function. +// +// id may be any string that uniquely identifies the event for the application. +// It does not need to be in any special format. For example, "new-message" +// might be appropriate for a notification about new messages. +// +// If a previous notification was sent with the same id, it will be replaced +// with notification and shown again as if it was a new notification. This works +// even for notifications sent from a previous execution of the application, +// as long as id is the same string. +// +// id may be NULL, but it is impossible to replace or withdraw notifications +// without an id. +// +// If notification is no longer relevant, it can be withdrawn with +// g_application_withdraw_notification(). +// +// It is an error to call this function if application has no application ID. +// +// The function takes the following parameters: +// +// - id (optional) of the notification, or NULL. +// - notification to send. +func (application *Application) SendNotification(id string, notification *Notification) { + var _arg0 *C.GApplication // out + var _arg1 *C.gchar // out + var _arg2 *C.GNotification // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + if id != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(id))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + + C.g_application_send_notification(_arg0, _arg1, _arg2) + runtime.KeepAlive(application) + runtime.KeepAlive(id) + runtime.KeepAlive(notification) +} + +// SetActionGroup: this used to be how actions were associated with a +// #GApplication. Now there is Map for that. +// +// Deprecated: Use the Map interface instead. Never ever mix use of this API +// with use of Map on the same application or things will go very badly wrong. +// This function is known to introduce buggy behaviour (ie: signals not emitted +// on changes to the action group), so you should really use Map instead. +// +// The function takes the following parameters: +// +// - actionGroup (optional) or NULL. +func (application *Application) SetActionGroup(actionGroup ActionGrouper) { + var _arg0 *C.GApplication // out + var _arg1 *C.GActionGroup // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + if actionGroup != nil { + _arg1 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + } + + C.g_application_set_action_group(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(actionGroup) +} + +// SetApplicationID sets the unique identifier for application. +// +// The application id can only be modified if application has not yet been +// registered. +// +// If non-NULL, the application id must be valid. See +// g_application_id_is_valid(). +// +// The function takes the following parameters: +// +// - applicationId (optional): identifier for application. +func (application *Application) SetApplicationID(applicationId string) { + var _arg0 *C.GApplication // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + if applicationId != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(applicationId))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_application_set_application_id(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(applicationId) +} + +// SetDefault sets or unsets the default application for the process, +// as returned by g_application_get_default(). +// +// This function does not take its own reference on application. If application +// is destroyed then the default application will revert back to NULL. +func (application *Application) SetDefault() { + var _arg0 *C.GApplication // out + + if application != nil { + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + } + + C.g_application_set_default(_arg0) + runtime.KeepAlive(application) +} + +// SetFlags sets the flags for application. +// +// The flags can only be modified if application has not yet been registered. +// +// See Flags. +// +// The function takes the following parameters: +// +// - flags for application. +func (application *Application) SetFlags(flags ApplicationFlags) { + var _arg0 *C.GApplication // out + var _arg1 C.GApplicationFlags // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = C.GApplicationFlags(flags) + + C.g_application_set_flags(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(flags) +} + +// SetInactivityTimeout sets the current inactivity timeout for the application. +// +// This is the amount of time (in milliseconds) after the last call to +// g_application_release() before the application stops running. +// +// This call has no side effects of its own. The value set here is only used for +// next time g_application_release() drops the use count to zero. Any timeouts +// currently in progress are not impacted. +// +// The function takes the following parameters: +// +// - inactivityTimeout: timeout, in milliseconds. +func (application *Application) SetInactivityTimeout(inactivityTimeout uint) { + var _arg0 *C.GApplication // out + var _arg1 C.guint // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = C.guint(inactivityTimeout) + + C.g_application_set_inactivity_timeout(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(inactivityTimeout) +} + +// SetOptionContextDescription adds a description to the application option +// context. +// +// See g_option_context_set_description() for more information. +// +// The function takes the following parameters: +// +// - description (optional): string to be shown in --help output after the +// list of options, or NULL. +func (application *Application) SetOptionContextDescription(description string) { + var _arg0 *C.GApplication // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + if description != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(description))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_application_set_option_context_description(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(description) +} + +// SetOptionContextParameterString sets the parameter string to be used by the +// commandline handling of application. +// +// This function registers the argument to be passed to g_option_context_new() +// when the internal Context of application is created. +// +// See g_option_context_new() for more information about parameter_string. +// +// The function takes the following parameters: +// +// - parameterString (optional): string which is displayed in the first line +// of --help output, after the usage summary programname [OPTION...]. +func (application *Application) SetOptionContextParameterString(parameterString string) { + var _arg0 *C.GApplication // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + if parameterString != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(parameterString))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_application_set_option_context_parameter_string(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(parameterString) +} + +// SetOptionContextSummary adds a summary to the application option context. +// +// See g_option_context_set_summary() for more information. +// +// The function takes the following parameters: +// +// - summary (optional): string to be shown in --help output before the list +// of options, or NULL. +func (application *Application) SetOptionContextSummary(summary string) { + var _arg0 *C.GApplication // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + if summary != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(summary))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_application_set_option_context_summary(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(summary) +} + +// SetResourceBasePath sets (or unsets) the base resource path of application. +// +// The path is used to automatically load various [application +// resources][gresource] such as menu layouts and action descriptions. The +// various types of resources will be found at fixed names relative to the given +// base path. +// +// By default, the resource base path is determined from the application ID by +// prefixing '/' and replacing each '.' with '/'. This is done at the time that +// the #GApplication object is constructed. Changes to the application ID after +// that point will not have an impact on the resource base path. +// +// As an example, if the application has an ID of "org.example.app" then +// the default resource base path will be "/org/example/app". If this is a +// Application (and you have not manually changed the path) then Gtk will then +// search for the menus of the application at "/org/example/app/gtk/menus.ui". +// +// See #GResource for more information about adding resources to your +// application. +// +// You can disable automatic resource loading functionality by setting the path +// to NULL. +// +// Changing the resource base path once the application is running is not +// recommended. The point at which the resource path is consulted for forming +// paths for various purposes is unspecified. When writing a sub-class of +// #GApplication you should either set the #GApplication:resource-base-path +// property at construction time, or call this function during the +// instance initialization. Alternatively, you can call this function in +// the Class.startup virtual function, before chaining up to the parent +// implementation. +// +// The function takes the following parameters: +// +// - resourcePath (optional): resource path to use. +func (application *Application) SetResourceBasePath(resourcePath string) { + var _arg0 *C.GApplication // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + if resourcePath != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(resourcePath))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_application_set_resource_base_path(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(resourcePath) +} + +// SetVersion sets the version number of application. This will be used to +// implement a --version command line argument +// +// The application version can only be modified if application has not yet been +// registered. +// +// The function takes the following parameters: +// +// - version of application. +func (application *Application) SetVersion(version string) { + var _arg0 *C.GApplication // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(version))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_application_set_version(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(version) +} + +// UnbindBusyProperty destroys a binding between property and +// the busy state of application that was previously created with +// g_application_bind_busy_property(). +// +// The function takes the following parameters: +// +// - object: #GObject. +// - property: name of a boolean property of object. +func (application *Application) UnbindBusyProperty(object *coreglib.Object, property string) { + var _arg0 *C.GApplication // out + var _arg1 C.gpointer // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = C.gpointer(unsafe.Pointer(object.Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(property))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_application_unbind_busy_property(_arg0, _arg1, _arg2) + runtime.KeepAlive(application) + runtime.KeepAlive(object) + runtime.KeepAlive(property) +} + +// UnmarkBusy decreases the busy count of application. +// +// When the busy count reaches zero, the new state will be propagated to other +// processes. +// +// This function must only be called to cancel the effect of a previous call to +// g_application_mark_busy(). +func (application *Application) UnmarkBusy() { + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C.g_application_unmark_busy(_arg0) + runtime.KeepAlive(application) +} + +// WithdrawNotification withdraws a notification that was sent with +// g_application_send_notification(). +// +// This call does nothing if a notification with id doesn't exist or the +// notification was never sent. +// +// This function works even for notifications sent in previous executions of +// this application, as long id is the same as it was for the sent notification. +// +// Note that notifications are dismissed when the user clicks on one of the +// buttons in a notification or triggers its default action, so there is no need +// to explicitly withdraw the notification in that case. +// +// The function takes the following parameters: +// +// - id of a previously sent notification. +func (application *Application) WithdrawNotification(id string) { + var _arg0 *C.GApplication // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(id))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_application_withdraw_notification(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(id) +} + +// Activate activates the application. +// +// In essence, this results in the #GApplication::activate signal being emitted +// in the primary instance. +// +// The application must be registered before calling this function. +func (application *Application) activate() { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.activate + + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C._gotk4_gio2_Application_virtual_activate(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(application) +} + +// addPlatformData: invoked (locally) to add 'platform data' to be sent to the +// primary instance when activating, opening or invoking actions. +func (application *Application) addPlatformData(builder *glib.VariantBuilder) { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.add_platform_data + + var _arg0 *C.GApplication // out + var _arg1 *C.GVariantBuilder // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GVariantBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + + C._gotk4_gio2_Application_virtual_add_platform_data(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(builder) +} + +// afterEmit: invoked on the primary instance after 'activate', 'open', +// 'command-line' or any action invocation, gets the 'platform data' from the +// calling instance. +func (application *Application) afterEmit(platformData *glib.Variant) { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.after_emit + + var _arg0 *C.GApplication // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(platformData))) + + C._gotk4_gio2_Application_virtual_after_emit(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(platformData) +} + +// beforeEmit: invoked on the primary instance before 'activate', 'open', +// 'command-line' or any action invocation, gets the 'platform data' from the +// calling instance. +func (application *Application) beforeEmit(platformData *glib.Variant) { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.before_emit + + var _arg0 *C.GApplication // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(platformData))) + + C._gotk4_gio2_Application_virtual_before_emit(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(platformData) +} + +// commandLine: invoked on the primary instance when a command-line is not +// handled locally. +func (application *Application) commandLine(commandLine *ApplicationCommandLine) int { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.command_line + + var _arg0 *C.GApplication // out + var _arg1 *C.GApplicationCommandLine // out + var _cret C.int // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(commandLine).Native())) + + _cret = C._gotk4_gio2_Application_virtual_command_line(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(commandLine) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// dBusRegister: invoked locally during registration, if the application is +// using its D-Bus backend. You can use this to export extra objects on the bus, +// that need to exist before the application tries to own the bus name. The +// function is passed the BusConnection to to session bus, and the object path +// that #GApplication will use to export its D-Bus API. If this function returns +// TRUE, registration will proceed; otherwise registration will abort. Since: +// 2.34. +// +// The function takes the following parameters: +// +// - connection +// - objectPath +func (application *Application) dBusRegister(connection *DBusConnection, objectPath string) error { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.dbus_register + + var _arg0 *C.GApplication // out + var _arg1 *C.GDBusConnection // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg2)) + + C._gotk4_gio2_Application_virtual_dbus_register(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(application) + runtime.KeepAlive(connection) + runtime.KeepAlive(objectPath) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// dBusUnregister: invoked locally during unregistration, if the application is +// using its D-Bus backend. Use this to undo anything done by the dbus_register +// vfunc. Since: 2.34. +// +// The function takes the following parameters: +// +// - connection +// - objectPath +func (application *Application) dBusUnregister(connection *DBusConnection, objectPath string) { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.dbus_unregister + + var _arg0 *C.GApplication // out + var _arg1 *C.GDBusConnection // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg2)) + + C._gotk4_gio2_Application_virtual_dbus_unregister(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(application) + runtime.KeepAlive(connection) + runtime.KeepAlive(objectPath) +} + +// handleLocalOptions: invoked locally after the parsing of the commandline +// options has occurred. Since: 2.40. +func (application *Application) handleLocalOptions(options *glib.VariantDict) int { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.handle_local_options + + var _arg0 *C.GApplication // out + var _arg1 *C.GVariantDict // out + var _cret C.gint // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GVariantDict)(gextras.StructNative(unsafe.Pointer(options))) + + _cret = C._gotk4_gio2_Application_virtual_handle_local_options(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(options) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// nameLost: invoked when another instance is taking over the name. Since: 2.60. +func (application *Application) nameLost() bool { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.name_lost + + var _arg0 *C.GApplication // out + var _cret C.gboolean // in + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C._gotk4_gio2_Application_virtual_name_lost(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(application) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Open opens the given files. +// +// In essence, this results in the #GApplication::open signal being emitted in +// the primary instance. +// +// n_files must be greater than zero. +// +// hint is simply passed through to the ::open signal. It is intended to be used +// by applications that have multiple modes for opening files (eg: "view" vs +// "edit", etc). Unless you have a need for this functionality, you should use +// "". +// +// The application must be registered before calling this function and it must +// have the G_APPLICATION_HANDLES_OPEN flag set. +// +// The function takes the following parameters: +// +// - files: array of #GFiles to open. +// - hint (or ""), but never NULL. +func (application *Application) open(files []Filer, hint string) { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.open + + var _arg0 *C.GApplication // out + var _arg1 **C.GFile // out + var _arg2 C.gint + var _arg3 *C.gchar // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg2 = (C.gint)(len(files)) + _arg1 = (**C.GFile)(C.calloc(C.size_t(len(files)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.GFile)(_arg1), len(files)) + for i := range files { + out[i] = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(files[i]).Native())) + } + } + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(hint))) + defer C.free(unsafe.Pointer(_arg3)) + + C._gotk4_gio2_Application_virtual_open(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(application) + runtime.KeepAlive(files) + runtime.KeepAlive(hint) +} + +// quitMainloop: used to be invoked on the primary instance when the use +// count of the application drops to zero (and after any inactivity timeout, +// if requested). Not used anymore since 2.32. +func (application *Application) quitMainloop() { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.quit_mainloop + + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C._gotk4_gio2_Application_virtual_quit_mainloop(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(application) +} + +// runMainloop: used to be invoked on the primary instance from +// g_application_run() if the use-count is non-zero. Since 2.32, GApplication is +// iterating the main context directly and is not using run_mainloop anymore. +func (application *Application) runMainloop() { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.run_mainloop + + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C._gotk4_gio2_Application_virtual_run_mainloop(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(application) +} + +// Shutdown: invoked only on the registered primary instance immediately after +// the main loop terminates. +func (application *Application) shutdown() { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.shutdown + + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C._gotk4_gio2_Application_virtual_shutdown(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(application) +} + +// Startup: invoked on the primary instance immediately after registration. +func (application *Application) startup() { + gclass := (*C.GApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.startup + + var _arg0 *C.GApplication // out + + _arg0 = (*C.GApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + C._gotk4_gio2_Application_virtual_startup(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(application) +} + +// ApplicationGetDefault returns the default #GApplication instance for this +// process. +// +// Normally there is only one #GApplication per process and it becomes the +// default when it is created. You can exercise more control over this by using +// g_application_set_default(). +// +// If there is no default application then NULL is returned. +// +// The function returns the following values: +// +// - application (optional): default application for this process, or NULL. +func ApplicationGetDefault() *Application { + var _cret *C.GApplication // in + + _cret = C.g_application_get_default() + + var _application *Application // out + + if _cret != nil { + _application = wrapApplication(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _application +} + +// ApplicationIDIsValid checks if application_id is a valid application +// identifier. +// +// A valid ID is required for calls to g_application_new() and +// g_application_set_application_id(). +// +// Application identifiers follow the same format as D-Bus well-known bus names +// (https://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus). +// For convenience, the restrictions on application identifiers are reproduced +// here: +// +// - Application identifiers are composed of 1 or more elements separated by a +// period (.) character. All elements must contain at least one character. +// +// - Each element must only contain the ASCII characters [A-Z][a-z][0-9]_-, +// with - discouraged in new application identifiers. Each element must not +// begin with a digit. +// +// - Application identifiers must contain at least one . (period) character (and +// thus at least two elements). +// +// - Application identifiers must not begin with a . (period) character. +// +// - Application identifiers must not exceed 255 characters. +// +// Note that the hyphen (-) character is allowed in application identifiers, +// but is problematic or not allowed in various specifications +// and APIs that refer to D-Bus, such as Flatpak application IDs +// (http://docs.flatpak.org/en/latest/introduction.html#identifiers), +// the DBusActivatable interface in the Desktop Entry Specification +// (https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#dbus), +// and the convention that an application's "main" interface and object path +// resemble its application identifier and bus name. To avoid situations that +// require special-case handling, it is recommended that new application +// identifiers consistently replace hyphens with underscores. +// +// Like D-Bus interface names, application identifiers should start with the +// reversed DNS domain name of the author of the interface (in lower-case), +// and it is conventional for the rest of the application identifier to consist +// of words run together, with initial capital letters. +// +// As with D-Bus interface names, if the author's DNS domain name contains +// hyphen/minus characters they should be replaced by underscores, and if it +// contains leading digits they should be escaped by prepending an underscore. +// For example, if the owner of 7-zip.org used an application identifier for an +// archiving application, it might be named org._7_zip.Archiver. +// +// The function takes the following parameters: +// +// - applicationId: potential application identifier. +// +// The function returns the following values: +// +// - ok: TRUE if application_id is valid. +func ApplicationIDIsValid(applicationId string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(applicationId))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_application_id_is_valid(_arg1) + runtime.KeepAlive(applicationId) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ApplicationCommandLineOverrides contains methods that are overridable. +type ApplicationCommandLineOverrides struct { + // Done signals that command line processing is completed. + // + // For remote invocation, it causes the invoking process to terminate. + // + // For local invocation, it does nothing. + // + // This method should be called in the gio.Application::command-line + // handler, after the exit status is set and all messages are printed. + // + // After this call, g_application_command_line_set_exit_status() has no + // effect. Subsequent calls to this method are no-ops. + // + // This method is automatically called when the CommandLine object is + // disposed — so you can omit the call in non-garbage collected languages. + Done func() + // Stdin gets the stdin of the invoking process. + // + // The Stream can be used to read data passed to the standard input of + // the invoking process. This doesn't work on all platforms. Presently, + // it is only available on UNIX when using a D-Bus daemon capable of passing + // file descriptors. If stdin is not available then NULL will be returned. + // In the future, support may be expanded to other platforms. + // + // You must only call this function once per commandline invocation. + // + // The function returns the following values: + // + // - inputStream (optional) for stdin. + Stdin func() InputStreamer + // PrintLiteral prints a message using the stdout print handler in the + // invoking process. + // + // Unlike g_application_command_line_print(), message is not a + // printf()-style format string. Use this function if message contains + // text you don't have control over, that could include printf() escape + // sequences. + // + // The function takes the following parameters: + // + // - message: message. + PrintLiteral func(message string) + // PrinterrLiteral prints a message using the stderr print handler in the + // invoking process. + // + // Unlike g_application_command_line_printerr(), message is not a + // printf()-style format string. Use this function if message contains + // text you don't have control over, that could include printf() escape + // sequences. + // + // The function takes the following parameters: + // + // - message: message. + PrinterrLiteral func(message string) +} + +func defaultApplicationCommandLineOverrides(v *ApplicationCommandLine) ApplicationCommandLineOverrides { + return ApplicationCommandLineOverrides{ + Done: v.done, + Stdin: v.stdin, + PrintLiteral: v.printLiteral, + PrinterrLiteral: v.printerrLiteral, + } +} + +// ApplicationCommandLine: GApplicationCommandLine represents a command-line +// invocation of an application. +// +// It is created by gio.Application and emitted in the +// gio.Application::command-line signal and virtual function. +// +// The class contains the list of arguments that the program was invoked with. +// It is also possible to query if the commandline invocation was local (ie: +// the current process is running in direct response to the invocation) or +// remote (ie: some other process forwarded the commandline to this process). +// +// The GApplicationCommandLine object can provide the argc and argv +// parameters for use with the glib.OptionContext command-line parsing API, +// with the gio.ApplicationCommandLine.GetArguments() function. See +// [gapplication-example-cmdline3.c][gapplication-example-cmdline3] for an +// example. +// +// The exit status of the originally-invoked process may be set and messages can +// be printed to stdout or stderr of that process. +// +// For remote invocation, the originally-invoked process exits when +// gio.ApplicationCommandLine.Done() method is called. This method is also +// automatically called when the object is disposed. +// +// The main use for GApplicationCommandLine (and the +// gio.Application::command-line signal) is 'Emacs server' like use cases: You +// can set the EDITOR environment variable to have e.g. git use your favourite +// editor to edit commit messages, and if you already have an instance of the +// editor running, the editing will happen in the running instance, instead of +// opening a new one. An important aspect of this use case is that the process +// that gets started by git does not return until the editing is done. +// +// Normally, the commandline is completely handled in the +// gio.Application::command-line handler. The launching instance exits once the +// signal handler in the primary instance has returned, and the return value of +// the signal handler becomes the exit status of the launching instance. +// +// static int +// command_line (GApplication *application, +// GApplicationCommandLine *cmdline) +// { +// gchar **argv; +// gint argc; +// gint i; +// +// argv = g_application_command_line_get_arguments (cmdline, &argc); +// +// g_application_command_line_print (cmdline, +// "This text is written back\n" +// "to stdout of the caller\n"); +// +// for (i = 0; i < argc; i++) +// g_print ("argument d: s\n", i, argv[i]); +// +// g_strfreev (argv); +// +// return 0; +// } +// +// The complete example can be found here: gapplication-example-cmdline.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline.c) +// +// In more complicated cases, the handling of the commandline can be split +// between the launcher and the primary instance. +// +// static gboolean +// test_local_cmdline (GApplication *application, +// gchar ***arguments, +// gint *exit_status) +// { +// gint i, j; +// gchar **argv; +// +// argv = *arguments; +// +// if (argv[0] == NULL) +// { +// *exit_status = 0; +// return FALSE; +// } +// +// i = 1; +// while (argv[i]) +// { +// if (g_str_has_prefix (argv[i], "--local-")) +// { +// g_print ("handling argument s locally\n", argv[i]); +// g_free (argv[i]); +// for (j = i; argv[j]; j++) +// argv[j] = argv[j + 1]; +// } +// else +// { +// g_print ("not handling argument s locally\n", argv[i]); +// i++; +// } +// } +// +// *exit_status = 0; +// +// return FALSE; +// } +// +// static void +// test_application_class_init (TestApplicationClass *class) +// { +// G_APPLICATION_CLASS (class)->local_command_line = test_local_cmdline; +// +// ... +// } +// +// In this example of split commandline handling, options that start +// with --local- are handled locally, all other options are passed to the +// gio.Application::command-line handler which runs in the primary instance. +// +// The complete example can be found here: gapplication-example-cmdline2.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline2.c) +// +// If handling the commandline requires a lot of work, it may be better to defer +// it. +// +// static gboolean +// my_cmdline_handler (gpointer data) +// { +// GApplicationCommandLine *cmdline = data; +// +// // do the heavy lifting in an idle +// +// g_application_command_line_set_exit_status (cmdline, 0); +// g_object_unref (cmdline); // this releases the application +// +// return G_SOURCE_REMOVE; +// } +// +// static int +// command_line (GApplication *application, +// GApplicationCommandLine *cmdline) +// { +// // keep the application running until we are done with this commandline +// g_application_hold (application); +// +// g_object_set_data_full (G_OBJECT (cmdline), +// "application", application, +// (GDestroyNotify)g_application_release); +// +// g_object_ref (cmdline); +// g_idle_add (my_cmdline_handler, cmdline); +// +// return 0; +// } +// +// In this example the commandline is not completely handled before the +// gio.Application::command-line handler returns. Instead, we keep a reference +// to the GApplicationCommandLine object and handle it later (in this example, +// in an idle). Note that it is necessary to hold the application until you are +// done with the commandline. +// +// The complete example can be found here: gapplication-example-cmdline3.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gapplication-example-cmdline3.c). +type ApplicationCommandLine struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ApplicationCommandLine)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ApplicationCommandLine, *ApplicationCommandLineClass, ApplicationCommandLineOverrides]( + GTypeApplicationCommandLine, + initApplicationCommandLineClass, + wrapApplicationCommandLine, + defaultApplicationCommandLineOverrides, + ) +} + +func initApplicationCommandLineClass(gclass unsafe.Pointer, overrides ApplicationCommandLineOverrides, classInitFunc func(*ApplicationCommandLineClass)) { + pclass := (*C.GApplicationCommandLineClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeApplicationCommandLine)))) + + if overrides.Done != nil { + pclass.done = (*[0]byte)(C._gotk4_gio2_ApplicationCommandLineClass_done) + } + + if overrides.Stdin != nil { + pclass.get_stdin = (*[0]byte)(C._gotk4_gio2_ApplicationCommandLineClass_get_stdin) + } + + if overrides.PrintLiteral != nil { + pclass.print_literal = (*[0]byte)(C._gotk4_gio2_ApplicationCommandLineClass_print_literal) + } + + if overrides.PrinterrLiteral != nil { + pclass.printerr_literal = (*[0]byte)(C._gotk4_gio2_ApplicationCommandLineClass_printerr_literal) + } + + if classInitFunc != nil { + class := (*ApplicationCommandLineClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapApplicationCommandLine(obj *coreglib.Object) *ApplicationCommandLine { + return &ApplicationCommandLine{ + Object: obj, + } +} + +func marshalApplicationCommandLine(p uintptr) (interface{}, error) { + return wrapApplicationCommandLine(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// CreateFileForArg creates a #GFile corresponding to a filename that was given +// as part of the invocation of cmdline. +// +// This differs from g_file_new_for_commandline_arg() in that it resolves +// relative pathnames using the current working directory of the invoking +// process rather than the local process. +// +// The function takes the following parameters: +// +// - arg: argument from cmdline. +// +// The function returns the following values: +// +// - file: new #GFile. +func (cmdline *ApplicationCommandLine) CreateFileForArg(arg string) *File { + var _arg0 *C.GApplicationCommandLine // out + var _arg1 *C.gchar // out + var _cret *C.GFile // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(arg))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_application_command_line_create_file_for_arg(_arg0, _arg1) + runtime.KeepAlive(cmdline) + runtime.KeepAlive(arg) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// Done signals that command line processing is completed. +// +// For remote invocation, it causes the invoking process to terminate. +// +// For local invocation, it does nothing. +// +// This method should be called in the gio.Application::command-line handler, +// after the exit status is set and all messages are printed. +// +// After this call, g_application_command_line_set_exit_status() has no effect. +// Subsequent calls to this method are no-ops. +// +// This method is automatically called when the CommandLine object is disposed — +// so you can omit the call in non-garbage collected languages. +func (cmdline *ApplicationCommandLine) Done() { + var _arg0 *C.GApplicationCommandLine // out + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + C.g_application_command_line_done(_arg0) + runtime.KeepAlive(cmdline) +} + +// Arguments gets the list of arguments that was passed on the command line. +// +// The strings in the array may contain non-UTF-8 data on UNIX (such as +// filenames or arguments given in the system locale) but are always in UTF-8 on +// Windows. +// +// If you wish to use the return value with Context, you must use +// g_option_context_parse_strv(). +// +// The return value is NULL-terminated and should be freed using g_strfreev(). +// +// The function returns the following values: +// +// - filenames: the string array containing the arguments (the argv). +func (cmdline *ApplicationCommandLine) Arguments() []string { + var _arg0 *C.GApplicationCommandLine // out + var _cret **C.gchar // in + var _arg1 C.int // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + _cret = C.g_application_command_line_get_arguments(_arg0, &_arg1) + runtime.KeepAlive(cmdline) + + var _filenames []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg1) + _filenames = make([]string, _arg1) + for i := 0; i < int(_arg1); i++ { + _filenames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _filenames +} + +// Cwd gets the working directory of the command line invocation. The string may +// contain non-utf8 data. +// +// It is possible that the remote application did not send a working directory, +// so this may be NULL. +// +// The return value should not be modified or freed and is valid for as long as +// cmdline exists. +// +// The function returns the following values: +// +// - filename (optional): current directory, or NULL. +func (cmdline *ApplicationCommandLine) Cwd() string { + var _arg0 *C.GApplicationCommandLine // out + var _cret *C.gchar // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + _cret = C.g_application_command_line_get_cwd(_arg0) + runtime.KeepAlive(cmdline) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// Environ gets the contents of the 'environ' variable of the command line +// invocation, as would be returned by g_get_environ(), ie as a NULL-terminated +// list of strings in the form 'NAME=VALUE'. The strings may contain non-utf8 +// data. +// +// The remote application usually does not send an environment. Use +// G_APPLICATION_SEND_ENVIRONMENT to affect that. Even with this flag set it +// is possible that the environment is still not available (due to invocation +// messages from other applications). +// +// The return value should not be modified or freed and is valid for as long as +// cmdline exists. +// +// See g_application_command_line_getenv() if you are only interested in the +// value of a single environment variable. +// +// The function returns the following values: +// +// - filenames: the environment strings, or NULL if they were not sent. +func (cmdline *ApplicationCommandLine) Environ() []string { + var _arg0 *C.GApplicationCommandLine // out + var _cret **C.gchar // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + _cret = C.g_application_command_line_get_environ(_arg0) + runtime.KeepAlive(cmdline) + + var _filenames []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _filenames = make([]string, i) + for i := range src { + _filenames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _filenames +} + +// ExitStatus gets the exit status of cmdline. See +// g_application_command_line_set_exit_status() for more information. +// +// The function returns the following values: +// +// - gint: exit status. +func (cmdline *ApplicationCommandLine) ExitStatus() int { + var _arg0 *C.GApplicationCommandLine // out + var _cret C.int // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + _cret = C.g_application_command_line_get_exit_status(_arg0) + runtime.KeepAlive(cmdline) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// IsRemote determines if cmdline represents a remote invocation. +// +// The function returns the following values: +// +// - ok: TRUE if the invocation was remote. +func (cmdline *ApplicationCommandLine) IsRemote() bool { + var _arg0 *C.GApplicationCommandLine // out + var _cret C.gboolean // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + _cret = C.g_application_command_line_get_is_remote(_arg0) + runtime.KeepAlive(cmdline) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// OptionsDict gets the options that were passed to +// g_application_command_line(). +// +// If you did not override local_command_line() then these are the same options +// that were parsed according to the Entrys added to the application with +// g_application_add_main_option_entries() and possibly modified from your +// GApplication::handle-local-options handler. +// +// If no options were sent then an empty dictionary is returned so that you +// don't need to check for NULL. +// +// The data has been passed via an untrusted external process, so the types of +// all values must be checked before being used. +// +// The function returns the following values: +// +// - variantDict with the options. +func (cmdline *ApplicationCommandLine) OptionsDict() *glib.VariantDict { + var _arg0 *C.GApplicationCommandLine // out + var _cret *C.GVariantDict // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + _cret = C.g_application_command_line_get_options_dict(_arg0) + runtime.KeepAlive(cmdline) + + var _variantDict *glib.VariantDict // out + + _variantDict = (*glib.VariantDict)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_dict_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variantDict)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_dict_unref((*C.GVariantDict)(intern.C)) + }, + ) + + return _variantDict +} + +// PlatformData gets the platform data associated with the invocation of +// cmdline. +// +// This is a #GVariant dictionary containing information about the context in +// which the invocation occurred. It typically contains information like the +// current working directory and the startup notification ID. +// +// It comes from an untrusted external process and hence the types of all values +// must be validated before being used. +// +// For local invocation, it will be NULL. +// +// The function returns the following values: +// +// - variant (optional): platform data, or NULL. +func (cmdline *ApplicationCommandLine) PlatformData() *glib.Variant { + var _arg0 *C.GApplicationCommandLine // out + var _cret *C.GVariant // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + _cret = C.g_application_command_line_get_platform_data(_arg0) + runtime.KeepAlive(cmdline) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// Stdin gets the stdin of the invoking process. +// +// The Stream can be used to read data passed to the standard input of +// the invoking process. This doesn't work on all platforms. Presently, +// it is only available on UNIX when using a D-Bus daemon capable of passing +// file descriptors. If stdin is not available then NULL will be returned. +// In the future, support may be expanded to other platforms. +// +// You must only call this function once per commandline invocation. +// +// The function returns the following values: +// +// - inputStream (optional) for stdin. +func (cmdline *ApplicationCommandLine) Stdin() InputStreamer { + var _arg0 *C.GApplicationCommandLine // out + var _cret *C.GInputStream // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + _cret = C.g_application_command_line_get_stdin(_arg0) + runtime.KeepAlive(cmdline) + + var _inputStream InputStreamer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + } + + return _inputStream +} + +// Env gets the value of a particular environment variable of the command line +// invocation, as would be returned by g_getenv(). The strings may contain +// non-utf8 data. +// +// The remote application usually does not send an environment. Use +// G_APPLICATION_SEND_ENVIRONMENT to affect that. Even with this flag set it +// is possible that the environment is still not available (due to invocation +// messages from other applications). +// +// The return value should not be modified or freed and is valid for as long as +// cmdline exists. +// +// The function takes the following parameters: +// +// - name: environment variable to get. +// +// The function returns the following values: +// +// - utf8 (optional): value of the variable, or NULL if unset or unsent. +func (cmdline *ApplicationCommandLine) env(name string) string { + var _arg0 *C.GApplicationCommandLine // out + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_application_command_line_getenv(_arg0, _arg1) + runtime.KeepAlive(cmdline) + runtime.KeepAlive(name) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// PrintLiteral prints a message using the stdout print handler in the invoking +// process. +// +// Unlike g_application_command_line_print(), message is not a printf()-style +// format string. Use this function if message contains text you don't have +// control over, that could include printf() escape sequences. +// +// The function takes the following parameters: +// +// - message: message. +func (cmdline *ApplicationCommandLine) PrintLiteral(message string) { + var _arg0 *C.GApplicationCommandLine // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_application_command_line_print_literal(_arg0, _arg1) + runtime.KeepAlive(cmdline) + runtime.KeepAlive(message) +} + +// PrinterrLiteral prints a message using the stderr print handler in the +// invoking process. +// +// Unlike g_application_command_line_printerr(), message is not a printf()-style +// format string. Use this function if message contains text you don't have +// control over, that could include printf() escape sequences. +// +// The function takes the following parameters: +// +// - message: message. +func (cmdline *ApplicationCommandLine) PrinterrLiteral(message string) { + var _arg0 *C.GApplicationCommandLine // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_application_command_line_printerr_literal(_arg0, _arg1) + runtime.KeepAlive(cmdline) + runtime.KeepAlive(message) +} + +// SetExitStatus sets the exit status that will be used when the invoking +// process exits. +// +// The return value of the #GApplication::command-line signal is passed to this +// function when the handler returns. This is the usual way of setting the exit +// status. +// +// In the event that you want the remote invocation to continue running and +// want to decide on the exit status in the future, you can use this call. +// For the case of a remote invocation, the remote process will typically exit +// when the last reference is dropped on cmdline. The exit status of the remote +// process will be equal to the last value that was set with this function. +// +// In the case that the commandline invocation is local, the situation is +// slightly more complicated. If the commandline invocation results in the +// mainloop running (ie: because the use-count of the application increased to a +// non-zero value) then the application is considered to have been 'successful' +// in a certain sense, and the exit status is always zero. If the application +// use count is zero, though, the exit status of the local CommandLine is used. +// +// This method is a no-op if g_application_command_line_done() has been called. +// +// The function takes the following parameters: +// +// - exitStatus: exit status. +func (cmdline *ApplicationCommandLine) SetExitStatus(exitStatus int) { + var _arg0 *C.GApplicationCommandLine // out + var _arg1 C.int // out + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + _arg1 = C.int(exitStatus) + + C.g_application_command_line_set_exit_status(_arg0, _arg1) + runtime.KeepAlive(cmdline) + runtime.KeepAlive(exitStatus) +} + +// Done signals that command line processing is completed. +// +// For remote invocation, it causes the invoking process to terminate. +// +// For local invocation, it does nothing. +// +// This method should be called in the gio.Application::command-line handler, +// after the exit status is set and all messages are printed. +// +// After this call, g_application_command_line_set_exit_status() has no effect. +// Subsequent calls to this method are no-ops. +// +// This method is automatically called when the CommandLine object is disposed — +// so you can omit the call in non-garbage collected languages. +func (cmdline *ApplicationCommandLine) done() { + gclass := (*C.GApplicationCommandLineClass)(coreglib.PeekParentClass(cmdline)) + fnarg := gclass.done + + var _arg0 *C.GApplicationCommandLine // out + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + C._gotk4_gio2_ApplicationCommandLine_virtual_done(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(cmdline) +} + +// Stdin gets the stdin of the invoking process. +// +// The Stream can be used to read data passed to the standard input of +// the invoking process. This doesn't work on all platforms. Presently, +// it is only available on UNIX when using a D-Bus daemon capable of passing +// file descriptors. If stdin is not available then NULL will be returned. +// In the future, support may be expanded to other platforms. +// +// You must only call this function once per commandline invocation. +// +// The function returns the following values: +// +// - inputStream (optional) for stdin. +func (cmdline *ApplicationCommandLine) stdin() InputStreamer { + gclass := (*C.GApplicationCommandLineClass)(coreglib.PeekParentClass(cmdline)) + fnarg := gclass.get_stdin + + var _arg0 *C.GApplicationCommandLine // out + var _cret *C.GInputStream // in + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + + _cret = C._gotk4_gio2_ApplicationCommandLine_virtual_get_stdin(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(cmdline) + + var _inputStream InputStreamer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + } + + return _inputStream +} + +// printLiteral prints a message using the stdout print handler in the invoking +// process. +// +// Unlike g_application_command_line_print(), message is not a printf()-style +// format string. Use this function if message contains text you don't have +// control over, that could include printf() escape sequences. +// +// The function takes the following parameters: +// +// - message: message. +func (cmdline *ApplicationCommandLine) printLiteral(message string) { + gclass := (*C.GApplicationCommandLineClass)(coreglib.PeekParentClass(cmdline)) + fnarg := gclass.print_literal + + var _arg0 *C.GApplicationCommandLine // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_ApplicationCommandLine_virtual_print_literal(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(cmdline) + runtime.KeepAlive(message) +} + +// printerrLiteral prints a message using the stderr print handler in the +// invoking process. +// +// Unlike g_application_command_line_printerr(), message is not a printf()-style +// format string. Use this function if message contains text you don't have +// control over, that could include printf() escape sequences. +// +// The function takes the following parameters: +// +// - message: message. +func (cmdline *ApplicationCommandLine) printerrLiteral(message string) { + gclass := (*C.GApplicationCommandLineClass)(coreglib.PeekParentClass(cmdline)) + fnarg := gclass.printerr_literal + + var _arg0 *C.GApplicationCommandLine // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GApplicationCommandLine)(unsafe.Pointer(coreglib.InternObject(cmdline).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_ApplicationCommandLine_virtual_printerr_literal(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(cmdline) + runtime.KeepAlive(message) +} + +// BufferedInputStreamOverrides contains methods that are overridable. +type BufferedInputStreamOverrides struct { + // Fill tries to read count bytes from the stream into the buffer. Will + // block during this read. + // + // If count is zero, returns zero and does nothing. A value of count larger + // than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. + // + // On success, the number of bytes read into the buffer is returned. + // It is not an error if this is not the same as the requested size, + // as it can happen e.g. near the end of a file. Zero is returned on end of + // file (or if count is zero), but never otherwise. + // + // If count is -1 then the attempted read size is equal to the number of + // bytes that are required to fill the buffer. + // + // If cancellable is not NULL, then the operation can be cancelled by + // triggering the cancellable object from another thread. If the operation + // was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an + // operation was partially finished when the operation was cancelled the + // partial result will be returned, without an error. + // + // On error -1 is returned and error is set accordingly. + // + // For the asynchronous, non-blocking, version of this function, see + // g_buffered_input_stream_fill_async(). + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable object, NULL to ignore. + // - count: number of bytes that will be read from the stream. + // + // The function returns the following values: + // + // - gssize: number of bytes read into stream's buffer, up to count, + // or -1 on error. + Fill func(ctx context.Context, count int) (int, error) + // FillFinish finishes an asynchronous read. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - gssize of the read stream, or -1 on an error. + FillFinish func(result AsyncResulter) (int, error) +} + +func defaultBufferedInputStreamOverrides(v *BufferedInputStream) BufferedInputStreamOverrides { + return BufferedInputStreamOverrides{ + Fill: v.fill, + FillFinish: v.fillFinish, + } +} + +// BufferedInputStream: buffered input stream implements InputStream and +// provides for buffered reads. +// +// By default, GBufferedInputStream's buffer size is set at 4 kilobytes. +// +// To create a buffered input stream, use gio.BufferedInputStream.New, +// or gio.BufferedInputStream.NewSized to specify the buffer's size at +// construction. +// +// To get the size of a buffer within a buffered input stream, use +// gio.BufferedInputStream.GetBufferSize(). To change the size of a buffered +// input stream's buffer, use gio.BufferedInputStream.SetBufferSize(). Note that +// the buffer's size cannot be reduced below the size of the data within the +// buffer. +type BufferedInputStream struct { + _ [0]func() // equal guard + FilterInputStream + + Seekable +} + +var ( + _ FilterInputStreamer = (*BufferedInputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*BufferedInputStream, *BufferedInputStreamClass, BufferedInputStreamOverrides]( + GTypeBufferedInputStream, + initBufferedInputStreamClass, + wrapBufferedInputStream, + defaultBufferedInputStreamOverrides, + ) +} + +func initBufferedInputStreamClass(gclass unsafe.Pointer, overrides BufferedInputStreamOverrides, classInitFunc func(*BufferedInputStreamClass)) { + pclass := (*C.GBufferedInputStreamClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeBufferedInputStream)))) + + if overrides.Fill != nil { + pclass.fill = (*[0]byte)(C._gotk4_gio2_BufferedInputStreamClass_fill) + } + + if overrides.FillFinish != nil { + pclass.fill_finish = (*[0]byte)(C._gotk4_gio2_BufferedInputStreamClass_fill_finish) + } + + if classInitFunc != nil { + class := (*BufferedInputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapBufferedInputStream(obj *coreglib.Object) *BufferedInputStream { + return &BufferedInputStream{ + FilterInputStream: FilterInputStream{ + InputStream: InputStream{ + Object: obj, + }, + }, + Seekable: Seekable{ + Object: obj, + }, + } +} + +func marshalBufferedInputStream(p uintptr) (interface{}, error) { + return wrapBufferedInputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBufferedInputStream creates a new Stream from the given base_stream, +// with a buffer set to the default size (4 kilobytes). +// +// The function takes the following parameters: +// +// - baseStream: Stream. +// +// The function returns the following values: +// +// - bufferedInputStream for the given base_stream. +func NewBufferedInputStream(baseStream InputStreamer) *BufferedInputStream { + var _arg1 *C.GInputStream // out + var _cret *C.GInputStream // in + + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(baseStream).Native())) + + _cret = C.g_buffered_input_stream_new(_arg1) + runtime.KeepAlive(baseStream) + + var _bufferedInputStream *BufferedInputStream // out + + _bufferedInputStream = wrapBufferedInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _bufferedInputStream +} + +// NewBufferedInputStreamSized creates a new InputStream from the given +// base_stream, with a buffer set to size. +// +// The function takes the following parameters: +// +// - baseStream: Stream. +// - size: #gsize. +// +// The function returns the following values: +// +// - bufferedInputStream: Stream. +func NewBufferedInputStreamSized(baseStream InputStreamer, size uint) *BufferedInputStream { + var _arg1 *C.GInputStream // out + var _arg2 C.gsize // out + var _cret *C.GInputStream // in + + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(baseStream).Native())) + _arg2 = C.gsize(size) + + _cret = C.g_buffered_input_stream_new_sized(_arg1, _arg2) + runtime.KeepAlive(baseStream) + runtime.KeepAlive(size) + + var _bufferedInputStream *BufferedInputStream // out + + _bufferedInputStream = wrapBufferedInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _bufferedInputStream +} + +// Fill tries to read count bytes from the stream into the buffer. Will block +// during this read. +// +// If count is zero, returns zero and does nothing. A value of count larger than +// G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes read into the buffer is returned. It is not +// an error if this is not the same as the requested size, as it can happen e.g. +// near the end of a file. Zero is returned on end of file (or if count is +// zero), but never otherwise. +// +// If count is -1 then the attempted read size is equal to the number of bytes +// that are required to fill the buffer. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// On error -1 is returned and error is set accordingly. +// +// For the asynchronous, non-blocking, version of this function, see +// g_buffered_input_stream_fill_async(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - count: number of bytes that will be read from the stream. +// +// The function returns the following values: +// +// - gssize: number of bytes read into stream's buffer, up to count, or -1 on +// error. +func (stream *BufferedInputStream) Fill(ctx context.Context, count int) (int, error) { + var _arg0 *C.GBufferedInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gssize // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gssize(count) + + _cret = C.g_buffered_input_stream_fill(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// FillAsync reads data into stream's buffer asynchronously, up to count size. +// io_priority can be used to prioritize reads. For the synchronous version of +// this function, see g_buffered_input_stream_fill(). +// +// If count is -1 then the attempted read size is equal to the number of bytes +// that are required to fill the buffer. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object. +// - count: number of bytes that will be read from the stream. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback. +func (stream *BufferedInputStream) FillAsync(ctx context.Context, count, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GBufferedInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 C.gssize // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gssize(count) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_buffered_input_stream_fill_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// FillFinish finishes an asynchronous read. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize of the read stream, or -1 on an error. +func (stream *BufferedInputStream) FillFinish(result AsyncResulter) (int, error) { + var _arg0 *C.GBufferedInputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_buffered_input_stream_fill_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// Available gets the size of the available data within the stream. +// +// The function returns the following values: +// +// - gsize: size of the available stream. +func (stream *BufferedInputStream) Available() uint { + var _arg0 *C.GBufferedInputStream // out + var _cret C.gsize // in + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_buffered_input_stream_get_available(_arg0) + runtime.KeepAlive(stream) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// BufferSize gets the size of the input buffer. +// +// The function returns the following values: +// +// - gsize: current buffer size. +func (stream *BufferedInputStream) BufferSize() uint { + var _arg0 *C.GBufferedInputStream // out + var _cret C.gsize // in + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_buffered_input_stream_get_buffer_size(_arg0) + runtime.KeepAlive(stream) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Peek peeks in the buffer, copying data of size count into buffer, offset +// offset bytes. +// +// The function takes the following parameters: +// +// - buffer: pointer to an allocated chunk of memory. +// - offset: #gsize. +// +// The function returns the following values: +// +// - gsize of the number of bytes peeked, or -1 on error. +func (stream *BufferedInputStream) Peek(buffer []byte, offset uint) uint { + var _arg0 *C.GBufferedInputStream // out + var _arg1 *C.void // out + var _arg3 C.gsize + var _arg2 C.gsize // out + var _cret C.gsize // in + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg3 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + _arg2 = C.gsize(offset) + + _cret = C.g_buffered_input_stream_peek(_arg0, unsafe.Pointer(_arg1), _arg2, _arg3) + runtime.KeepAlive(stream) + runtime.KeepAlive(buffer) + runtime.KeepAlive(offset) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// PeekBuffer returns the buffer with the currently available bytes. +// The returned buffer must not be modified and will become invalid when reading +// from the stream or filling the buffer. +// +// The function returns the following values: +// +// - guint8s: read-only buffer. +func (stream *BufferedInputStream) PeekBuffer() []byte { + var _arg0 *C.GBufferedInputStream // out + var _cret unsafe.Pointer // in + var _arg1 C.gsize // in + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_buffered_input_stream_peek_buffer(_arg0, &_arg1) + runtime.KeepAlive(stream) + + var _guint8s []byte // out + + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) + + return _guint8s +} + +// ReadByte tries to read a single byte from the stream or the buffer. Will +// block during this read. +// +// On success, the byte read from the stream is returned. On end of stream -1 is +// returned but it's not an exceptional error and error is not set. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// On error -1 is returned and error is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - gint: byte read from the stream, or -1 on end of stream or error. +func (stream *BufferedInputStream) ReadByte(ctx context.Context) (int, error) { + var _arg0 *C.GBufferedInputStream // out + var _arg1 *C.GCancellable // out + var _cret C.int // in + var _cerr *C.GError // in + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_buffered_input_stream_read_byte(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _gint int // out + var _goerr error // out + + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint, _goerr +} + +// SetBufferSize sets the size of the internal buffer of stream to size, +// or to the size of the contents of the buffer. The buffer can never be resized +// smaller than its current contents. +// +// The function takes the following parameters: +// +// - size: #gsize. +func (stream *BufferedInputStream) SetBufferSize(size uint) { + var _arg0 *C.GBufferedInputStream // out + var _arg1 C.gsize // out + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = C.gsize(size) + + C.g_buffered_input_stream_set_buffer_size(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(size) +} + +// Fill tries to read count bytes from the stream into the buffer. Will block +// during this read. +// +// If count is zero, returns zero and does nothing. A value of count larger than +// G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes read into the buffer is returned. It is not +// an error if this is not the same as the requested size, as it can happen e.g. +// near the end of a file. Zero is returned on end of file (or if count is +// zero), but never otherwise. +// +// If count is -1 then the attempted read size is equal to the number of bytes +// that are required to fill the buffer. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// On error -1 is returned and error is set accordingly. +// +// For the asynchronous, non-blocking, version of this function, see +// g_buffered_input_stream_fill_async(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - count: number of bytes that will be read from the stream. +// +// The function returns the following values: +// +// - gssize: number of bytes read into stream's buffer, up to count, or -1 on +// error. +func (stream *BufferedInputStream) fill(ctx context.Context, count int) (int, error) { + gclass := (*C.GBufferedInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.fill + + var _arg0 *C.GBufferedInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gssize // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gssize(count) + + _cret = C._gotk4_gio2_BufferedInputStream_virtual_fill(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// fillAsync reads data into stream's buffer asynchronously, up to count size. +// io_priority can be used to prioritize reads. For the synchronous version of +// this function, see g_buffered_input_stream_fill(). +// +// If count is -1 then the attempted read size is equal to the number of bytes +// that are required to fill the buffer. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object. +// - count: number of bytes that will be read from the stream. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback. +func (stream *BufferedInputStream) fillAsync(ctx context.Context, count, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GBufferedInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.fill_async + + var _arg0 *C.GBufferedInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 C.gssize // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gssize(count) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_BufferedInputStream_virtual_fill_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// fillFinish finishes an asynchronous read. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize of the read stream, or -1 on an error. +func (stream *BufferedInputStream) fillFinish(result AsyncResulter) (int, error) { + gclass := (*C.GBufferedInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.fill_finish + + var _arg0 *C.GBufferedInputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GBufferedInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_BufferedInputStream_virtual_fill_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// BufferedOutputStreamOverrides contains methods that are overridable. +type BufferedOutputStreamOverrides struct { +} + +func defaultBufferedOutputStreamOverrides(v *BufferedOutputStream) BufferedOutputStreamOverrides { + return BufferedOutputStreamOverrides{} +} + +// BufferedOutputStream: buffered output stream implements +// gio.FilterOutputStream and provides for buffered writes. +// +// By default, GBufferedOutputStream's buffer size is set at 4 kilobytes. +// +// To create a buffered output stream, use gio.BufferedOutputStream.New, +// or gio.BufferedOutputStream.NewSized to specify the buffer's size at +// construction. +// +// To get the size of a buffer within a buffered input stream, use +// gio.BufferedOutputStream.GetBufferSize(). To change the size of a buffered +// output stream's buffer, use gio.BufferedOutputStream.SetBufferSize(). Note +// that the buffer's size cannot be reduced below the size of the data within +// the buffer. +type BufferedOutputStream struct { + _ [0]func() // equal guard + FilterOutputStream + + Seekable +} + +var ( + _ FilterOutputStreamer = (*BufferedOutputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*BufferedOutputStream, *BufferedOutputStreamClass, BufferedOutputStreamOverrides]( + GTypeBufferedOutputStream, + initBufferedOutputStreamClass, + wrapBufferedOutputStream, + defaultBufferedOutputStreamOverrides, + ) +} + +func initBufferedOutputStreamClass(gclass unsafe.Pointer, overrides BufferedOutputStreamOverrides, classInitFunc func(*BufferedOutputStreamClass)) { + if classInitFunc != nil { + class := (*BufferedOutputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapBufferedOutputStream(obj *coreglib.Object) *BufferedOutputStream { + return &BufferedOutputStream{ + FilterOutputStream: FilterOutputStream{ + OutputStream: OutputStream{ + Object: obj, + }, + }, + Seekable: Seekable{ + Object: obj, + }, + } +} + +func marshalBufferedOutputStream(p uintptr) (interface{}, error) { + return wrapBufferedOutputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBufferedOutputStream creates a new buffered output stream for a base +// stream. +// +// The function takes the following parameters: +// +// - baseStream: Stream. +// +// The function returns the following values: +// +// - bufferedOutputStream for the given base_stream. +func NewBufferedOutputStream(baseStream OutputStreamer) *BufferedOutputStream { + var _arg1 *C.GOutputStream // out + var _cret *C.GOutputStream // in + + _arg1 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(baseStream).Native())) + + _cret = C.g_buffered_output_stream_new(_arg1) + runtime.KeepAlive(baseStream) + + var _bufferedOutputStream *BufferedOutputStream // out + + _bufferedOutputStream = wrapBufferedOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _bufferedOutputStream +} + +// NewBufferedOutputStreamSized creates a new buffered output stream with a +// given buffer size. +// +// The function takes the following parameters: +// +// - baseStream: Stream. +// - size: #gsize. +// +// The function returns the following values: +// +// - bufferedOutputStream with an internal buffer set to size. +func NewBufferedOutputStreamSized(baseStream OutputStreamer, size uint) *BufferedOutputStream { + var _arg1 *C.GOutputStream // out + var _arg2 C.gsize // out + var _cret *C.GOutputStream // in + + _arg1 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(baseStream).Native())) + _arg2 = C.gsize(size) + + _cret = C.g_buffered_output_stream_new_sized(_arg1, _arg2) + runtime.KeepAlive(baseStream) + runtime.KeepAlive(size) + + var _bufferedOutputStream *BufferedOutputStream // out + + _bufferedOutputStream = wrapBufferedOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _bufferedOutputStream +} + +// AutoGrow checks if the buffer automatically grows as data is added. +// +// The function returns the following values: +// +// - ok: TRUE if the stream's buffer automatically grows, FALSE otherwise. +func (stream *BufferedOutputStream) AutoGrow() bool { + var _arg0 *C.GBufferedOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GBufferedOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_buffered_output_stream_get_auto_grow(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// BufferSize gets the size of the buffer in the stream. +// +// The function returns the following values: +// +// - gsize: current size of the buffer. +func (stream *BufferedOutputStream) BufferSize() uint { + var _arg0 *C.GBufferedOutputStream // out + var _cret C.gsize // in + + _arg0 = (*C.GBufferedOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_buffered_output_stream_get_buffer_size(_arg0) + runtime.KeepAlive(stream) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// SetAutoGrow sets whether or not the stream's buffer should automatically +// grow. If auto_grow is true, then each write will just make the buffer larger, +// and you must manually flush the buffer to actually write out the data to the +// underlying stream. +// +// The function takes the following parameters: +// +// - autoGrow: #gboolean. +func (stream *BufferedOutputStream) SetAutoGrow(autoGrow bool) { + var _arg0 *C.GBufferedOutputStream // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GBufferedOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + if autoGrow { + _arg1 = C.TRUE + } + + C.g_buffered_output_stream_set_auto_grow(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(autoGrow) +} + +// SetBufferSize sets the size of the internal buffer to size. +// +// The function takes the following parameters: +// +// - size: #gsize. +func (stream *BufferedOutputStream) SetBufferSize(size uint) { + var _arg0 *C.GBufferedOutputStream // out + var _arg1 C.gsize // out + + _arg0 = (*C.GBufferedOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = C.gsize(size) + + C.g_buffered_output_stream_set_buffer_size(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(size) +} + +// BytesIcon: GBytesIcon specifies an image held in memory in a common format +// (usually PNG) to be used as icon. +type BytesIcon struct { + _ [0]func() // equal guard + *coreglib.Object + + LoadableIcon +} + +var ( + _ coreglib.Objector = (*BytesIcon)(nil) +) + +func wrapBytesIcon(obj *coreglib.Object) *BytesIcon { + return &BytesIcon{ + Object: obj, + LoadableIcon: LoadableIcon{ + Icon: Icon{ + Object: obj, + }, + }, + } +} + +func marshalBytesIcon(p uintptr) (interface{}, error) { + return wrapBytesIcon(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBytesIcon creates a new icon for a bytes. +// +// This cannot fail, but loading and interpreting the bytes may fail later on +// (for example, if g_loadable_icon_load() is called) if the image is invalid. +// +// The function takes the following parameters: +// +// - bytes: #GBytes. +// +// The function returns the following values: +// +// - bytesIcon for the given bytes. +func NewBytesIcon(bytes *glib.Bytes) *BytesIcon { + var _arg1 *C.GBytes // out + var _cret *C.GIcon // in + + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + + _cret = C.g_bytes_icon_new(_arg1) + runtime.KeepAlive(bytes) + + var _bytesIcon *BytesIcon // out + + _bytesIcon = wrapBytesIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _bytesIcon +} + +// Bytes gets the #GBytes associated with the given icon. +// +// The function returns the following values: +// +// - bytes: #GBytes. +func (icon *BytesIcon) Bytes() *glib.Bytes { + var _arg0 *C.GBytesIcon // out + var _cret *C.GBytes // in + + _arg0 = (*C.GBytesIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + _cret = C.g_bytes_icon_get_bytes(_arg0) + runtime.KeepAlive(icon) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_bytes_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// CancellableOverrides contains methods that are overridable. +type CancellableOverrides struct { + Cancelled func() +} + +func defaultCancellableOverrides(v *Cancellable) CancellableOverrides { + return CancellableOverrides{ + Cancelled: v.cancelled, + } +} + +// Cancellable: GCancellable allows operations to be cancelled. +// +// GCancellable is a thread-safe operation cancellation stack used throughout +// GIO to allow for cancellation of synchronous and asynchronous operations. +type Cancellable struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Cancellable)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*Cancellable, *CancellableClass, CancellableOverrides]( + GTypeCancellable, + initCancellableClass, + wrapCancellable, + defaultCancellableOverrides, + ) +} + +func initCancellableClass(gclass unsafe.Pointer, overrides CancellableOverrides, classInitFunc func(*CancellableClass)) { + pclass := (*C.GCancellableClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeCancellable)))) + + if overrides.Cancelled != nil { + pclass.cancelled = (*[0]byte)(C._gotk4_gio2_CancellableClass_cancelled) + } + + if classInitFunc != nil { + class := (*CancellableClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapCancellable(obj *coreglib.Object) *Cancellable { + return &Cancellable{ + Object: obj, + } +} + +func marshalCancellable(p uintptr) (interface{}, error) { + return wrapCancellable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectCancelled is emitted when the operation has been cancelled. +// +// Can be used by implementations of cancellable operations. If the operation is +// cancelled from another thread, the signal will be emitted in the thread that +// cancelled the operation, not the thread that is running the operation. +// +// Note that disconnecting from this signal (or any signal) in a +// multi-threaded program is prone to race conditions. For instance it +// is possible that a signal handler may be invoked even after a call to +// g_signal_handler_disconnect() for that handler has already returned. +// +// There is also a problem when cancellation happens right before connecting +// to the signal. If this happens the signal will unexpectedly not be emitted, +// and checking before connecting to the signal leaves a race condition where +// this is still happening. +// +// In order to make it safe and easy to connect handlers there are two helper +// functions: g_cancellable_connect() and g_cancellable_disconnect() which +// protect against problems like this. +// +// An example of how to us this: +// +// // Make sure we don't do unnecessary work if already cancelled +// if (g_cancellable_set_error_if_cancelled (cancellable, error)) +// return; +// +// // Set up all the data needed to be able to handle cancellation +// // of the operation +// my_data = my_data_new (...); +// +// id = 0; +// if (cancellable) +// id = g_cancellable_connect (cancellable, +// G_CALLBACK (cancelled_handler) +// data, NULL); +// +// // cancellable operation here... +// +// g_cancellable_disconnect (cancellable, id); +// +// // cancelled_handler is never called after this, it is now safe +// // to free the data +// my_data_free (my_data); +// +// Note that the cancelled signal is emitted in the thread that the user +// cancelled from, which may be the main thread. So, the cancellable signal +// should not do something that can block. +func (cancellable *Cancellable) ConnectCancelled(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(cancellable, "cancelled", false, unsafe.Pointer(C._gotk4_gio2_Cancellable_ConnectCancelled), f) +} + +// NewCancellable creates a new #GCancellable object. +// +// Applications that want to start one or more operations that should be +// cancellable should create a #GCancellable and pass it to the operations. +// +// One #GCancellable can be used in multiple consecutive operations or in +// multiple concurrent operations. +// +// The function returns the following values: +// +// - cancellable: #GCancellable. +func NewCancellable() *Cancellable { + var _cret *C.GCancellable // in + + _cret = C.g_cancellable_new() + + var _cancellable *Cancellable // out + + _cancellable = wrapCancellable(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _cancellable +} + +// Cancel will set cancellable to cancelled, and will emit the +// #GCancellable::cancelled signal. (However, see the warning about race +// conditions in the documentation for that signal if you are planning to +// connect to it.) +// +// This function is thread-safe. In other words, you can safely call it from +// a thread other than the one running the operation that was passed the +// cancellable. +// +// If cancellable is NULL, this function returns immediately for convenience. +// +// The convention within GIO is that cancelling an asynchronous operation causes +// it to complete asynchronously. That is, if you cancel the operation from the +// same thread in which it is running, then the operation's ReadyCallback will +// not be invoked until the application returns to the main loop. +func (cancellable *Cancellable) Cancel() { + var _arg0 *C.GCancellable // out + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + C.g_cancellable_cancel(_arg0) + runtime.KeepAlive(cancellable) +} + +// Disconnect disconnects a handler from a cancellable instance similar to +// g_signal_handler_disconnect(). Additionally, in the event that a signal +// handler is currently running, this call will block until the handler has +// finished. Calling this function from a #GCancellable::cancelled signal +// handler will therefore result in a deadlock. +// +// This avoids a race condition where a thread cancels at the same time as +// the cancellable operation is finished and the signal handler is removed. +// See #GCancellable::cancelled for details on how to use this. +// +// If cancellable is NULL or handler_id is 0 this function does nothing. +// +// The function takes the following parameters: +// +// - handlerId: handler id of the handler to be disconnected, or 0. +func (cancellable *Cancellable) Disconnect(handlerId uint32) { + var _arg0 *C.GCancellable // out + var _arg1 C.gulong // out + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + _arg1 = C.gulong(handlerId) + + C.g_cancellable_disconnect(_arg0, _arg1) + runtime.KeepAlive(cancellable) + runtime.KeepAlive(handlerId) +} + +// Fd gets the file descriptor for a cancellable job. This can be used to +// implement cancellable operations on Unix systems. The returned fd will turn +// readable when cancellable is cancelled. +// +// You are not supposed to read from the fd yourself, just check for +// readable status. Reading to unset the readable status is done with +// g_cancellable_reset(). +// +// After a successful return from this function, you should use +// g_cancellable_release_fd() to free up resources allocated for the returned +// file descriptor. +// +// See also g_cancellable_make_pollfd(). +// +// The function returns the following values: +// +// - gint: valid file descriptor. -1 if the file descriptor is not supported, +// or on errors. +func (cancellable *Cancellable) Fd() int { + var _arg0 *C.GCancellable // out + var _cret C.int // in + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + _cret = C.g_cancellable_get_fd(_arg0) + runtime.KeepAlive(cancellable) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// IsCancelled checks if a cancellable job has been cancelled. +// +// The function returns the following values: +// +// - ok: TRUE if cancellable is cancelled, FALSE if called with NULL or if +// item is not cancelled. +func (cancellable *Cancellable) IsCancelled() bool { + var _arg0 *C.GCancellable // out + var _cret C.gboolean // in + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + _cret = C.g_cancellable_is_cancelled(_arg0) + runtime.KeepAlive(cancellable) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PopCurrent pops cancellable off the cancellable stack (verifying that +// cancellable is on the top of the stack). +func (cancellable *Cancellable) PopCurrent() { + var _arg0 *C.GCancellable // out + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + C.g_cancellable_pop_current(_arg0) + runtime.KeepAlive(cancellable) +} + +// PushCurrent pushes cancellable onto the cancellable stack. The current +// cancellable can then be received using g_cancellable_get_current(). +// +// This is useful when implementing cancellable operations in code that does not +// allow you to pass down the cancellable object. +// +// This is typically called automatically by e.g. #GFile operations, so you +// rarely have to call this yourself. +func (cancellable *Cancellable) PushCurrent() { + var _arg0 *C.GCancellable // out + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + C.g_cancellable_push_current(_arg0) + runtime.KeepAlive(cancellable) +} + +// ReleaseFd releases a resources previously allocated by g_cancellable_get_fd() +// or g_cancellable_make_pollfd(). +// +// For compatibility reasons with older releases, calling this function is +// not strictly required, the resources will be automatically freed when the +// cancellable is finalized. However, the cancellable will block scarce file +// descriptors until it is finalized if this function is not called. This can +// cause the application to run out of file descriptors when many #GCancellables +// are used at the same time. +func (cancellable *Cancellable) ReleaseFd() { + var _arg0 *C.GCancellable // out + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + C.g_cancellable_release_fd(_arg0) + runtime.KeepAlive(cancellable) +} + +// Reset resets cancellable to its uncancelled state. +// +// If cancellable is currently in use by any cancellable operation then the +// behavior of this function is undefined. +// +// Note that it is generally not a good idea to reuse an existing cancellable +// for more operations after it has been cancelled once, as this function +// might tempt you to do. The recommended practice is to drop the reference +// to a cancellable after cancelling it, and let it die with the outstanding +// async operations. You should create a fresh cancellable for further async +// operations. +func (cancellable *Cancellable) Reset() { + var _arg0 *C.GCancellable // out + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + C.g_cancellable_reset(_arg0) + runtime.KeepAlive(cancellable) +} + +// SetErrorIfCancelled: if the cancellable is cancelled, sets the error to +// notify that the operation was cancelled. +func (cancellable *Cancellable) SetErrorIfCancelled() error { + var _arg0 *C.GCancellable // out + var _cerr *C.GError // in + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + C.g_cancellable_set_error_if_cancelled(_arg0, &_cerr) + runtime.KeepAlive(cancellable) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// NewSource creates a source that triggers if cancellable is cancelled and +// calls its callback of type SourceFunc. This is primarily useful for attaching +// to another (non-cancellable) source with g_source_add_child_source() to add +// cancellability to it. +// +// For convenience, you can call this with a NULL #GCancellable, in which case +// the source will never trigger. +// +// The new #GSource will hold a reference to the #GCancellable. +// +// The function returns the following values: +// +// - source: new #GSource. +func (cancellable *Cancellable) NewSource() *glib.Source { + var _arg0 *C.GCancellable // out + var _cret *C.GSource // in + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + _cret = C.g_cancellable_source_new(_arg0) + runtime.KeepAlive(cancellable) + + var _source *glib.Source // out + + _source = (*glib.Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +func (cancellable *Cancellable) cancelled() { + gclass := (*C.GCancellableClass)(coreglib.PeekParentClass(cancellable)) + fnarg := gclass.cancelled + + var _arg0 *C.GCancellable // out + + if cancellable != nil { + _arg0 = (*C.GCancellable)(unsafe.Pointer(coreglib.InternObject(cancellable).Native())) + } + + C._gotk4_gio2_Cancellable_virtual_cancelled(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(cancellable) +} + +// CancellableGetCurrent gets the top cancellable from the stack. +// +// The function returns the following values: +// +// - cancellable (optional) from the top of the stack, or NULL if the stack is +// empty. +func CancellableGetCurrent() *Cancellable { + var _cret *C.GCancellable // in + + _cret = C.g_cancellable_get_current() + + var _cancellable *Cancellable // out + + if _cret != nil { + _cancellable = wrapCancellable(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _cancellable +} + +// CharsetConverterOverrides contains methods that are overridable. +type CharsetConverterOverrides struct { +} + +func defaultCharsetConverterOverrides(v *CharsetConverter) CharsetConverterOverrides { + return CharsetConverterOverrides{} +} + +// CharsetConverter: GCharsetConverter is an implementation of gio.Converter +// based on glib.IConv. +type CharsetConverter struct { + _ [0]func() // equal guard + *coreglib.Object + + Converter + Initable +} + +var ( + _ coreglib.Objector = (*CharsetConverter)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*CharsetConverter, *CharsetConverterClass, CharsetConverterOverrides]( + GTypeCharsetConverter, + initCharsetConverterClass, + wrapCharsetConverter, + defaultCharsetConverterOverrides, + ) +} + +func initCharsetConverterClass(gclass unsafe.Pointer, overrides CharsetConverterOverrides, classInitFunc func(*CharsetConverterClass)) { + if classInitFunc != nil { + class := (*CharsetConverterClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapCharsetConverter(obj *coreglib.Object) *CharsetConverter { + return &CharsetConverter{ + Object: obj, + Converter: Converter{ + Object: obj, + }, + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalCharsetConverter(p uintptr) (interface{}, error) { + return wrapCharsetConverter(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewCharsetConverter creates a new Converter. +// +// The function takes the following parameters: +// +// - toCharset: destination charset. +// - fromCharset: source charset. +// +// The function returns the following values: +// +// - charsetConverter: new Converter or NULL on error. +func NewCharsetConverter(toCharset, fromCharset string) (*CharsetConverter, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GCharsetConverter // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(toCharset))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(fromCharset))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_charset_converter_new(_arg1, _arg2, &_cerr) + runtime.KeepAlive(toCharset) + runtime.KeepAlive(fromCharset) + + var _charsetConverter *CharsetConverter // out + var _goerr error // out + + _charsetConverter = wrapCharsetConverter(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _charsetConverter, _goerr +} + +// NumFallbacks gets the number of fallbacks that converter has applied so far. +// +// The function returns the following values: +// +// - guint: number of fallbacks that converter has applied. +func (converter *CharsetConverter) NumFallbacks() uint { + var _arg0 *C.GCharsetConverter // out + var _cret C.guint // in + + _arg0 = (*C.GCharsetConverter)(unsafe.Pointer(coreglib.InternObject(converter).Native())) + + _cret = C.g_charset_converter_get_num_fallbacks(_arg0) + runtime.KeepAlive(converter) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// UseFallback gets the Converter:use-fallback property. +// +// The function returns the following values: +// +// - ok: TRUE if fallbacks are used by converter. +func (converter *CharsetConverter) UseFallback() bool { + var _arg0 *C.GCharsetConverter // out + var _cret C.gboolean // in + + _arg0 = (*C.GCharsetConverter)(unsafe.Pointer(coreglib.InternObject(converter).Native())) + + _cret = C.g_charset_converter_get_use_fallback(_arg0) + runtime.KeepAlive(converter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetUseFallback sets the Converter:use-fallback property. +// +// The function takes the following parameters: +// +// - useFallback: TRUE to use fallbacks. +func (converter *CharsetConverter) SetUseFallback(useFallback bool) { + var _arg0 *C.GCharsetConverter // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GCharsetConverter)(unsafe.Pointer(coreglib.InternObject(converter).Native())) + if useFallback { + _arg1 = C.TRUE + } + + C.g_charset_converter_set_use_fallback(_arg0, _arg1) + runtime.KeepAlive(converter) + runtime.KeepAlive(useFallback) +} + +// ConverterInputStreamOverrides contains methods that are overridable. +type ConverterInputStreamOverrides struct { +} + +func defaultConverterInputStreamOverrides(v *ConverterInputStream) ConverterInputStreamOverrides { + return ConverterInputStreamOverrides{} +} + +// ConverterInputStream: converter input stream implements gio.InputStream and +// allows conversion of data of various types during reading. +// +// As of GLib 2.34, GConverterInputStream implements gio.PollableInputStream. +type ConverterInputStream struct { + _ [0]func() // equal guard + FilterInputStream + + *coreglib.Object + InputStream + PollableInputStream +} + +var ( + _ FilterInputStreamer = (*ConverterInputStream)(nil) + _ coreglib.Objector = (*ConverterInputStream)(nil) + _ InputStreamer = (*ConverterInputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ConverterInputStream, *ConverterInputStreamClass, ConverterInputStreamOverrides]( + GTypeConverterInputStream, + initConverterInputStreamClass, + wrapConverterInputStream, + defaultConverterInputStreamOverrides, + ) +} + +func initConverterInputStreamClass(gclass unsafe.Pointer, overrides ConverterInputStreamOverrides, classInitFunc func(*ConverterInputStreamClass)) { + if classInitFunc != nil { + class := (*ConverterInputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapConverterInputStream(obj *coreglib.Object) *ConverterInputStream { + return &ConverterInputStream{ + FilterInputStream: FilterInputStream{ + InputStream: InputStream{ + Object: obj, + }, + }, + Object: obj, + InputStream: InputStream{ + Object: obj, + }, + PollableInputStream: PollableInputStream{ + InputStream: InputStream{ + Object: obj, + }, + }, + } +} + +func marshalConverterInputStream(p uintptr) (interface{}, error) { + return wrapConverterInputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewConverterInputStream creates a new converter input stream for the +// base_stream. +// +// The function takes the following parameters: +// +// - baseStream: Stream. +// - converter: #GConverter. +// +// The function returns the following values: +// +// - converterInputStream: new Stream. +func NewConverterInputStream(baseStream InputStreamer, converter Converterer) *ConverterInputStream { + var _arg1 *C.GInputStream // out + var _arg2 *C.GConverter // out + var _cret *C.GInputStream // in + + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(baseStream).Native())) + _arg2 = (*C.GConverter)(unsafe.Pointer(coreglib.InternObject(converter).Native())) + + _cret = C.g_converter_input_stream_new(_arg1, _arg2) + runtime.KeepAlive(baseStream) + runtime.KeepAlive(converter) + + var _converterInputStream *ConverterInputStream // out + + _converterInputStream = wrapConverterInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _converterInputStream +} + +// Converter gets the #GConverter that is used by converter_stream. +// +// The function returns the following values: +// +// - converter of the converter input stream. +func (converterStream *ConverterInputStream) Converter() *Converter { + var _arg0 *C.GConverterInputStream // out + var _cret *C.GConverter // in + + _arg0 = (*C.GConverterInputStream)(unsafe.Pointer(coreglib.InternObject(converterStream).Native())) + + _cret = C.g_converter_input_stream_get_converter(_arg0) + runtime.KeepAlive(converterStream) + + var _converter *Converter // out + + _converter = wrapConverter(coreglib.Take(unsafe.Pointer(_cret))) + + return _converter +} + +// ConverterOutputStreamOverrides contains methods that are overridable. +type ConverterOutputStreamOverrides struct { +} + +func defaultConverterOutputStreamOverrides(v *ConverterOutputStream) ConverterOutputStreamOverrides { + return ConverterOutputStreamOverrides{} +} + +// ConverterOutputStream: converter output stream implements gio.OutputStream +// and allows conversion of data of various types during reading. +// +// As of GLib 2.34, GConverterOutputStream implements gio.PollableOutputStream. +type ConverterOutputStream struct { + _ [0]func() // equal guard + FilterOutputStream + + *coreglib.Object + OutputStream + PollableOutputStream +} + +var ( + _ FilterOutputStreamer = (*ConverterOutputStream)(nil) + _ coreglib.Objector = (*ConverterOutputStream)(nil) + _ OutputStreamer = (*ConverterOutputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ConverterOutputStream, *ConverterOutputStreamClass, ConverterOutputStreamOverrides]( + GTypeConverterOutputStream, + initConverterOutputStreamClass, + wrapConverterOutputStream, + defaultConverterOutputStreamOverrides, + ) +} + +func initConverterOutputStreamClass(gclass unsafe.Pointer, overrides ConverterOutputStreamOverrides, classInitFunc func(*ConverterOutputStreamClass)) { + if classInitFunc != nil { + class := (*ConverterOutputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapConverterOutputStream(obj *coreglib.Object) *ConverterOutputStream { + return &ConverterOutputStream{ + FilterOutputStream: FilterOutputStream{ + OutputStream: OutputStream{ + Object: obj, + }, + }, + Object: obj, + OutputStream: OutputStream{ + Object: obj, + }, + PollableOutputStream: PollableOutputStream{ + OutputStream: OutputStream{ + Object: obj, + }, + }, + } +} + +func marshalConverterOutputStream(p uintptr) (interface{}, error) { + return wrapConverterOutputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewConverterOutputStream creates a new converter output stream for the +// base_stream. +// +// The function takes the following parameters: +// +// - baseStream: Stream. +// - converter: #GConverter. +// +// The function returns the following values: +// +// - converterOutputStream: new Stream. +func NewConverterOutputStream(baseStream OutputStreamer, converter Converterer) *ConverterOutputStream { + var _arg1 *C.GOutputStream // out + var _arg2 *C.GConverter // out + var _cret *C.GOutputStream // in + + _arg1 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(baseStream).Native())) + _arg2 = (*C.GConverter)(unsafe.Pointer(coreglib.InternObject(converter).Native())) + + _cret = C.g_converter_output_stream_new(_arg1, _arg2) + runtime.KeepAlive(baseStream) + runtime.KeepAlive(converter) + + var _converterOutputStream *ConverterOutputStream // out + + _converterOutputStream = wrapConverterOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _converterOutputStream +} + +// Converter gets the #GConverter that is used by converter_stream. +// +// The function returns the following values: +// +// - converter of the converter output stream. +func (converterStream *ConverterOutputStream) Converter() *Converter { + var _arg0 *C.GConverterOutputStream // out + var _cret *C.GConverter // in + + _arg0 = (*C.GConverterOutputStream)(unsafe.Pointer(coreglib.InternObject(converterStream).Native())) + + _cret = C.g_converter_output_stream_get_converter(_arg0) + runtime.KeepAlive(converterStream) + + var _converter *Converter // out + + _converter = wrapConverter(coreglib.Take(unsafe.Pointer(_cret))) + + return _converter +} + +// Credentials: GCredentials type is a reference-counted wrapper for native +// credentials. +// +// The information in GCredentials is typically used for identifying, +// authenticating and authorizing other processes. +// +// Some operating systems supports looking up the credentials of the remote peer +// of a communication endpoint - see e.g. gio.Socket.GetCredentials(). +// +// Some operating systems supports securely sending and +// receiving credentials over a Unix Domain Socket, see +// gio.UnixCredentialsMessage, gio.UnixConnection.SendCredentials() and +// gio.UnixConnection.ReceiveCredentials() for details. +// +// On Linux, the native credential type is a struct ucred - see the +// unix(7) man page (man:unix(7)) for details. This corresponds to +// G_CREDENTIALS_TYPE_LINUX_UCRED. +// +// On Apple operating systems (including iOS, tvOS, and macOS), +// the native credential type is a struct xucred. This corresponds to +// G_CREDENTIALS_TYPE_APPLE_XUCRED. +// +// On FreeBSD, Debian GNU/kFreeBSD, and GNU/Hurd, the native credential type is +// a struct cmsgcred. This corresponds to G_CREDENTIALS_TYPE_FREEBSD_CMSGCRED. +// +// On NetBSD, the native credential type is a struct unpcbid. This corresponds +// to G_CREDENTIALS_TYPE_NETBSD_UNPCBID. +// +// On OpenBSD, the native credential type is a struct sockpeercred. This +// corresponds to G_CREDENTIALS_TYPE_OPENBSD_SOCKPEERCRED. +// +// On Solaris (including OpenSolaris and its derivatives), the native credential +// type is a ucred_t. This corresponds to G_CREDENTIALS_TYPE_SOLARIS_UCRED. +// +// Since GLib 2.72, on Windows, the native credentials may contain the PID of a +// process. This corresponds to G_CREDENTIALS_TYPE_WIN32_PID. +type Credentials struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Credentials)(nil) +) + +func wrapCredentials(obj *coreglib.Object) *Credentials { + return &Credentials{ + Object: obj, + } +} + +func marshalCredentials(p uintptr) (interface{}, error) { + return wrapCredentials(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewCredentials creates a new #GCredentials object with credentials matching +// the the current process. +// +// The function returns the following values: +// +// - credentials Free with g_object_unref(). +func NewCredentials() *Credentials { + var _cret *C.GCredentials // in + + _cret = C.g_credentials_new() + + var _credentials *Credentials // out + + _credentials = wrapCredentials(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _credentials +} + +// IsSameUser checks if credentials and other_credentials is the same user. +// +// This operation can fail if #GCredentials is not supported on the the OS. +// +// The function takes the following parameters: +// +// - otherCredentials: #GCredentials. +func (credentials *Credentials) IsSameUser(otherCredentials *Credentials) error { + var _arg0 *C.GCredentials // out + var _arg1 *C.GCredentials // out + var _cerr *C.GError // in + + _arg0 = (*C.GCredentials)(unsafe.Pointer(coreglib.InternObject(credentials).Native())) + _arg1 = (*C.GCredentials)(unsafe.Pointer(coreglib.InternObject(otherCredentials).Native())) + + C.g_credentials_is_same_user(_arg0, _arg1, &_cerr) + runtime.KeepAlive(credentials) + runtime.KeepAlive(otherCredentials) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetNative copies the native credentials of type native_type from native into +// credentials. +// +// It is a programming error (which will cause a warning to be logged) to use +// this method if there is no #GCredentials support for the OS or if native_type +// isn't supported by the OS. +// +// The function takes the following parameters: +// +// - nativeType: type of native credentials to set. +// - native: pointer to native credentials. +func (credentials *Credentials) SetNative(nativeType CredentialsType, native unsafe.Pointer) { + var _arg0 *C.GCredentials // out + var _arg1 C.GCredentialsType // out + var _arg2 C.gpointer // out + + _arg0 = (*C.GCredentials)(unsafe.Pointer(coreglib.InternObject(credentials).Native())) + _arg1 = C.GCredentialsType(nativeType) + _arg2 = (C.gpointer)(unsafe.Pointer(native)) + + C.g_credentials_set_native(_arg0, _arg1, _arg2) + runtime.KeepAlive(credentials) + runtime.KeepAlive(nativeType) + runtime.KeepAlive(native) +} + +// String creates a human-readable textual representation of credentials that +// can be used in logging and debug messages. The format of the returned string +// may change in future GLib release. +// +// The function returns the following values: +// +// - utf8: string that should be freed with g_free(). +func (credentials *Credentials) String() string { + var _arg0 *C.GCredentials // out + var _cret *C.gchar // in + + _arg0 = (*C.GCredentials)(unsafe.Pointer(coreglib.InternObject(credentials).Native())) + + _cret = C.g_credentials_to_string(_arg0) + runtime.KeepAlive(credentials) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// DBusActionGroup: GDBusActionGroup is an implementation of the gio.ActionGroup +// interface. +// +// GDBusActionGroup can be used as a proxy for an action group that is exported +// over D-Bus with gio.DBusConnection.ExportActionGroup(). +type DBusActionGroup struct { + _ [0]func() // equal guard + *coreglib.Object + + RemoteActionGroup +} + +var ( + _ coreglib.Objector = (*DBusActionGroup)(nil) +) + +func wrapDBusActionGroup(obj *coreglib.Object) *DBusActionGroup { + return &DBusActionGroup{ + Object: obj, + RemoteActionGroup: RemoteActionGroup{ + ActionGroup: ActionGroup{ + Object: obj, + }, + }, + } +} + +func marshalDBusActionGroup(p uintptr) (interface{}, error) { + return wrapDBusActionGroup(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// DBusActionGroupGet obtains a BusActionGroup for the action group which is +// exported at the given bus_name and object_path. +// +// The thread default main context is taken at the time of this call. All +// signals on the menu model (and any linked models) are reported with respect +// to this context. All calls on the returned menu model (and linked models) +// must also originate from this same context, with the thread default main +// context unchanged. +// +// This call is non-blocking. The returned action group may or may not already +// be filled in. The correct thing to do is connect the signals for the action +// group to monitor for changes and then to call g_action_group_list_actions() +// to get the initial list. +// +// The function takes the following parameters: +// +// - connection: BusConnection. +// - busName (optional) bus name which exports the action group or NULL if +// connection is not a message bus connection. +// - objectPath: object path at which the action group is exported. +// +// The function returns the following values: +// +// - dBusActionGroup: BusActionGroup. +func DBusActionGroupGet(connection *DBusConnection, busName, objectPath string) *DBusActionGroup { + var _arg1 *C.GDBusConnection // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret *C.GDBusActionGroup // in + + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + if busName != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(busName))) + defer C.free(unsafe.Pointer(_arg2)) + } + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.g_dbus_action_group_get(_arg1, _arg2, _arg3) + runtime.KeepAlive(connection) + runtime.KeepAlive(busName) + runtime.KeepAlive(objectPath) + + var _dBusActionGroup *DBusActionGroup // out + + _dBusActionGroup = wrapDBusActionGroup(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusActionGroup +} + +// DBusAuthObserver: GDBusAuthObserver provides a mechanism for participating in +// how a gio.DBusServer (or a gio.DBusConnection) authenticates remote peers. +// +// Simply instantiate a GDBusAuthObserver and connect to the signals you are +// interested in. Note that new signals may be added in the future. +// +// # Controlling Authentication Mechanisms +// +// By default, a GDBusServer or server-side GDBusConnection will allow any +// authentication mechanism to be used. If you only want to allow D-Bus +// connections with the EXTERNAL mechanism, which makes use of credentials +// passing and is the recommended mechanism for modern Unix platforms such as +// Linux and the BSD family, you would use a signal handler like this: +// +// static gboolean +// on_allow_mechanism (GDBusAuthObserver *observer, +// const gchar *mechanism, +// gpointer user_data) +// { +// if (g_strcmp0 (mechanism, "EXTERNAL") == 0) +// { +// return TRUE; +// } +// +// return FALSE; +// } +// +// # Controlling Authorization +// +// By default, a GDBusServer or server-side GDBusConnection will accept +// connections from any successfully authenticated user (but not from anonymous +// connections using the ANONYMOUS mechanism). If you only want to allow D-Bus +// connections from processes owned by the same uid as the server, since GLib +// 2.68, you should use the G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER +// flag. It’s equivalent to the following signal handler: +// +// static gboolean +// on_authorize_authenticated_peer (GDBusAuthObserver *observer, +// GIOStream *stream, +// GCredentials *credentials, +// gpointer user_data) +// { +// gboolean authorized; +// +// authorized = FALSE; +// if (credentials != NULL) +// { +// GCredentials *own_credentials; +// own_credentials = g_credentials_new (); +// if (g_credentials_is_same_user (credentials, own_credentials, NULL)) +// authorized = TRUE; +// g_object_unref (own_credentials); +// } +// +// return authorized; +// }. +type DBusAuthObserver struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DBusAuthObserver)(nil) +) + +func wrapDBusAuthObserver(obj *coreglib.Object) *DBusAuthObserver { + return &DBusAuthObserver{ + Object: obj, + } +} + +func marshalDBusAuthObserver(p uintptr) (interface{}, error) { + return wrapDBusAuthObserver(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectAllowMechanism is emitted to check if mechanism is allowed to be used. +func (observer *DBusAuthObserver) ConnectAllowMechanism(f func(mechanism string) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(observer, "allow-mechanism", false, unsafe.Pointer(C._gotk4_gio2_DBusAuthObserver_ConnectAllowMechanism), f) +} + +// ConnectAuthorizeAuthenticatedPeer is emitted to check if a peer that is +// successfully authenticated is authorized. +func (observer *DBusAuthObserver) ConnectAuthorizeAuthenticatedPeer(f func(stream IOStreamer, credentials *Credentials) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(observer, "authorize-authenticated-peer", false, unsafe.Pointer(C._gotk4_gio2_DBusAuthObserver_ConnectAuthorizeAuthenticatedPeer), f) +} + +// NewDBusAuthObserver creates a new BusAuthObserver object. +// +// The function returns the following values: +// +// - dBusAuthObserver Free with g_object_unref(). +func NewDBusAuthObserver() *DBusAuthObserver { + var _cret *C.GDBusAuthObserver // in + + _cret = C.g_dbus_auth_observer_new() + + var _dBusAuthObserver *DBusAuthObserver // out + + _dBusAuthObserver = wrapDBusAuthObserver(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusAuthObserver +} + +// AllowMechanism emits the BusAuthObserver::allow-mechanism signal on observer. +// +// The function takes the following parameters: +// +// - mechanism: name of the mechanism, e.g. DBUS_COOKIE_SHA1. +// +// The function returns the following values: +// +// - ok: TRUE if mechanism can be used to authenticate the other peer, +// FALSE if not. +func (observer *DBusAuthObserver) AllowMechanism(mechanism string) bool { + var _arg0 *C.GDBusAuthObserver // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusAuthObserver)(unsafe.Pointer(coreglib.InternObject(observer).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(mechanism))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_auth_observer_allow_mechanism(_arg0, _arg1) + runtime.KeepAlive(observer) + runtime.KeepAlive(mechanism) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// AuthorizeAuthenticatedPeer emits the +// BusAuthObserver::authorize-authenticated-peer signal on observer. +// +// The function takes the following parameters: +// +// - stream for the BusConnection. +// - credentials (optional) credentials received from the peer or NULL. +// +// The function returns the following values: +// +// - ok: TRUE if the peer is authorized, FALSE if not. +func (observer *DBusAuthObserver) AuthorizeAuthenticatedPeer(stream IOStreamer, credentials *Credentials) bool { + var _arg0 *C.GDBusAuthObserver // out + var _arg1 *C.GIOStream // out + var _arg2 *C.GCredentials // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusAuthObserver)(unsafe.Pointer(coreglib.InternObject(observer).Native())) + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + if credentials != nil { + _arg2 = (*C.GCredentials)(unsafe.Pointer(coreglib.InternObject(credentials).Native())) + } + + _cret = C.g_dbus_auth_observer_authorize_authenticated_peer(_arg0, _arg1, _arg2) + runtime.KeepAlive(observer) + runtime.KeepAlive(stream) + runtime.KeepAlive(credentials) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusConnection: GDBusConnection type is used for D-Bus connections to remote +// peers such as a message buses. +// +// It is a low-level API that offers a lot of flexibility. For instance, +// it lets you establish a connection over any transport that can by represented +// as a gio.IOStream. +// +// This class is rarely used directly in D-Bus clients. If you are writing +// a D-Bus client, it is often easier to use the gio.BusOwnName(), +// gio.BusWatchName() or gio.DBusProxy().NewForBus APIs. +// +// As an exception to the usual GLib rule that a particular object must not be +// used by two threads at the same time, GDBusConnections methods may be called +// from any thread. This is so that gio.BusGet() and gio.BusGetSync() can safely +// return the same GDBusConnection when called from any thread. +// +// Most of the ways to obtain a GDBusConnection automatically initialize +// it (i.e. connect to D-Bus): for instance, gio.DBusConnection().New +// and gio.BusGet(), and the synchronous versions of those methods, +// give you an initialized connection. Language bindings for GIO should use +// gio.Initable().New or gio.AsyncInitable().NewAsync, which also initialize the +// connection. +// +// If you construct an uninitialized GDBusConnection, such as via +// gobject.Object.New, you must initialize it via gio.Initable.Init() or +// gio.AsyncInitable.InitAsync() before using its methods or properties. +// Calling methods or accessing properties on a GDBusConnection that has not +// completed initialization successfully is considered to be invalid, and leads +// to undefined behaviour. In particular, if initialization fails with a GError, +// the only valid thing you can do with that GDBusConnection is to free it with +// gobject.Object.Unref(). +// +// # An example D-Bus server +// +// Here is an example for a D-Bus server: gdbus-example-server.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-server.c) +// +// # An example for exporting a subtree +// +// Here is an example for exporting a subtree: gdbus-example-subtree.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-subtree.c) +// +// # An example for file descriptor passing +// +// Here is an example for passing UNIX file descriptors: gdbus-unix-fd-client.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-unix-fd-client.c) +// +// # An example for exporting a GObject +// +// Here is an example for exporting a #GObject: gdbus-example-export.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-export.c). +type DBusConnection struct { + _ [0]func() // equal guard + *coreglib.Object + + AsyncInitable + Initable +} + +var ( + _ coreglib.Objector = (*DBusConnection)(nil) +) + +func wrapDBusConnection(obj *coreglib.Object) *DBusConnection { + return &DBusConnection{ + Object: obj, + AsyncInitable: AsyncInitable{ + Object: obj, + }, + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalDBusConnection(p uintptr) (interface{}, error) { + return wrapDBusConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectClosed is emitted when the connection is closed. +// +// # The cause of this event can be +// +// - If g_dbus_connection_close() is called. In this case remote_peer_vanished +// is set to FALSE and error is NULL. +// +// - If the remote peer closes the connection. In this case remote_peer_vanished +// is set to TRUE and error is set. +// +// - If the remote peer sends invalid or malformed data. In this case +// remote_peer_vanished is set to FALSE and error is set. +// +// Upon receiving this signal, you should give up your reference to connection. +// You are guaranteed that this signal is emitted only once. +func (connection *DBusConnection) ConnectClosed(f func(remotePeerVanished bool, err error)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(connection, "closed", false, unsafe.Pointer(C._gotk4_gio2_DBusConnection_ConnectClosed), f) +} + +// NewDBusConnectionFinish finishes an operation started with +// g_dbus_connection_new(). +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to g_dbus_connection_new(). +// +// The function returns the following values: +// +// - dBusConnection or NULL if error is set. Free with g_object_unref(). +func NewDBusConnectionFinish(res AsyncResulter) (*DBusConnection, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GDBusConnection // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_connection_new_finish(_arg1, &_cerr) + runtime.KeepAlive(res) + + var _dBusConnection *DBusConnection // out + var _goerr error // out + + _dBusConnection = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusConnection, _goerr +} + +// NewDBusConnectionForAddressFinish finishes an operation started with +// g_dbus_connection_new_for_address(). +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to g_dbus_connection_new(). +// +// The function returns the following values: +// +// - dBusConnection or NULL if error is set. Free with g_object_unref(). +func NewDBusConnectionForAddressFinish(res AsyncResulter) (*DBusConnection, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GDBusConnection // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_connection_new_for_address_finish(_arg1, &_cerr) + runtime.KeepAlive(res) + + var _dBusConnection *DBusConnection // out + var _goerr error // out + + _dBusConnection = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusConnection, _goerr +} + +// NewDBusConnectionForAddressSync: synchronously connects and sets +// up a D-Bus client connection for exchanging D-Bus messages with an +// endpoint specified by address which must be in the D-Bus address format +// (https://dbus.freedesktop.org/doc/dbus-specification.html#addresses). +// +// This constructor can only be used to initiate client-side connections - use +// g_dbus_connection_new_sync() if you need to act as the server. In particular, +// flags cannot contain the G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER, +// G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS or +// G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER flags. +// +// This is a synchronous failable constructor. See +// g_dbus_connection_new_for_address() for the asynchronous version. +// +// If observer is not NULL it may be used to control the authentication process. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - address d-Bus address. +// - flags describing how to make the connection. +// - observer (optional) or NULL. +// +// The function returns the following values: +// +// - dBusConnection or NULL if error is set. Free with g_object_unref(). +func NewDBusConnectionForAddressSync(ctx context.Context, address string, flags DBusConnectionFlags, observer *DBusAuthObserver) (*DBusConnection, error) { + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GDBusConnectionFlags // out + var _arg3 *C.GDBusAuthObserver // out + var _cret *C.GDBusConnection // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(address))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GDBusConnectionFlags(flags) + if observer != nil { + _arg3 = (*C.GDBusAuthObserver)(unsafe.Pointer(coreglib.InternObject(observer).Native())) + } + + _cret = C.g_dbus_connection_new_for_address_sync(_arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(flags) + runtime.KeepAlive(observer) + + var _dBusConnection *DBusConnection // out + var _goerr error // out + + _dBusConnection = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusConnection, _goerr +} + +// NewDBusConnectionSync: synchronously sets up a D-Bus connection for +// exchanging D-Bus messages with the end represented by stream. +// +// If stream is a Connection, then the corresponding #GSocket will be put into +// non-blocking mode. +// +// The D-Bus connection will interact with stream from a worker thread. As a +// result, the caller should not interact with stream after this method has been +// called, except by calling g_object_unref() on it. +// +// If observer is not NULL it may be used to control the authentication process. +// +// This is a synchronous failable constructor. See g_dbus_connection_new() for +// the asynchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - stream: OStream. +// - guid (optional): GUID to use if authenticating as a server or NULL. +// - flags describing how to make the connection. +// - observer (optional) or NULL. +// +// The function returns the following values: +// +// - dBusConnection or NULL if error is set. Free with g_object_unref(). +func NewDBusConnectionSync(ctx context.Context, stream IOStreamer, guid string, flags DBusConnectionFlags, observer *DBusAuthObserver) (*DBusConnection, error) { + var _arg5 *C.GCancellable // out + var _arg1 *C.GIOStream // out + var _arg2 *C.gchar // out + var _arg3 C.GDBusConnectionFlags // out + var _arg4 *C.GDBusAuthObserver // out + var _cret *C.GDBusConnection // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + if guid != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(guid))) + defer C.free(unsafe.Pointer(_arg2)) + } + _arg3 = C.GDBusConnectionFlags(flags) + if observer != nil { + _arg4 = (*C.GDBusAuthObserver)(unsafe.Pointer(coreglib.InternObject(observer).Native())) + } + + _cret = C.g_dbus_connection_new_sync(_arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(guid) + runtime.KeepAlive(flags) + runtime.KeepAlive(observer) + + var _dBusConnection *DBusConnection // out + var _goerr error // out + + _dBusConnection = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusConnection, _goerr +} + +// AddFilter adds a message filter. Filters are handlers that are run on all +// incoming and outgoing messages, prior to standard dispatch. Filters are +// run in the order that they were added. The same handler can be added as a +// filter more than once, in which case it will be run more than once. Filters +// added during a filter callback won't be run on the message being processed. +// Filter functions are allowed to modify and even drop messages. +// +// Note that filters are run in a dedicated message handling thread +// so they can't block and, generally, can't do anything but signal +// a worker thread. Also note that filters are rarely needed - +// use API such as g_dbus_connection_send_message_with_reply(), +// g_dbus_connection_signal_subscribe() or g_dbus_connection_call() instead. +// +// If a filter consumes an incoming message the message is not +// dispatched anywhere else - not even the standard dispatch machinery +// (that API such as g_dbus_connection_signal_subscribe() and +// g_dbus_connection_send_message_with_reply() relies on) will see the message. +// Similarly, if a filter consumes an outgoing message, the message will not be +// sent to the other peer. +// +// If user_data_free_func is non-NULL, it will be called (in the thread-default +// main context of the thread you are calling this method from) at some point +// after user_data is no longer needed. (It is not guaranteed to be called +// synchronously when the filter is removed, and may be called after connection +// has been destroyed.). +// +// The function takes the following parameters: +// +// - filterFunction: filter function. +// +// The function returns the following values: +// +// - guint: filter identifier that can be used with +// g_dbus_connection_remove_filter(). +func (connection *DBusConnection) AddFilter(filterFunction DBusMessageFilterFunction) uint { + var _arg0 *C.GDBusConnection // out + var _arg1 C.GDBusMessageFilterFunction // out + var _arg2 C.gpointer + var _arg3 C.GDestroyNotify + var _cret C.guint // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*[0]byte)(C._gotk4_gio2_DBusMessageFilterFunction) + _arg2 = C.gpointer(gbox.Assign(filterFunction)) + _arg3 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + + _cret = C.g_dbus_connection_add_filter(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(connection) + runtime.KeepAlive(filterFunction) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Call: asynchronously invokes the method_name method on the interface_name +// D-Bus interface on the remote object at object_path owned by bus_name. +// +// If connection is closed then the operation will fail with G_IO_ERROR_CLOSED. +// If cancellable is canceled, the operation will fail with +// G_IO_ERROR_CANCELLED. If parameters contains a value not compatible with the +// D-Bus protocol, the operation fails with G_IO_ERROR_INVALID_ARGUMENT. +// +// If reply_type is non-NULL then the reply will be checked for having this +// type and an error will be raised if it does not match. Said another way, +// if you give a reply_type then any non-NULL return value will be of this type. +// Unless it’s G_VARIANT_TYPE_UNIT, the reply_type will be a tuple containing +// one or more values. +// +// If the parameters #GVariant is floating, it is consumed. This allows +// convenient 'inline' use of g_variant_new(), e.g.: +// +// g_dbus_connection_call (connection, +// "org.freedesktop.StringThings", +// "/org/freedesktop/StringThings", +// "org.freedesktop.StringThings", +// "TwoStrings", +// g_variant_new ("(ss)", +// "Thing One", +// "Thing Two"), +// NULL, +// G_DBUS_CALL_FLAGS_NONE, +// -1, +// NULL, +// (GAsyncReadyCallback) two_strings_done, +// NULL); +// +// This is an asynchronous method. When the operation is finished, +// callback will be invoked in the [thread-default main +// context][g-main-context-push-thread-default] of the thread you are calling +// this method from. You can then call g_dbus_connection_call_finish() to +// get the result of the operation. See g_dbus_connection_call_sync() for the +// synchronous version of this function. +// +// If callback is NULL then the D-Bus method call message will be sent with the +// G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - busName (optional): unique or well-known bus name or NULL if connection +// is not a message bus connection. +// - objectPath: path of remote object. +// - interfaceName d-Bus interface to invoke method on. +// - methodName: name of the method to invoke. +// - parameters (optional) tuple with parameters for the method or NULL if not +// passing parameters. +// - replyType (optional): expected type of the reply (which will be a tuple), +// or NULL. +// - flags from the BusCallFlags enumeration. +// - timeoutMsec: timeout in milliseconds, -1 to use the default timeout or +// G_MAXINT for no timeout. +// - callback (optional) to call when the request is satisfied or NULL if you +// don't care about the result of the method invocation. +func (connection *DBusConnection) Call(ctx context.Context, busName, objectPath, interfaceName, methodName string, parameters *glib.Variant, replyType *glib.VariantType, flags DBusCallFlags, timeoutMsec int, callback AsyncReadyCallback) { + var _arg0 *C.GDBusConnection // out + var _arg9 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 *C.GVariant // out + var _arg6 *C.GVariantType // out + var _arg7 C.GDBusCallFlags // out + var _arg8 C.gint // out + var _arg10 C.GAsyncReadyCallback // out + var _arg11 C.gpointer + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg9 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if busName != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(busName))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(methodName))) + defer C.free(unsafe.Pointer(_arg4)) + if parameters != nil { + _arg5 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameters))) + } + if replyType != nil { + _arg6 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(replyType))) + } + _arg7 = C.GDBusCallFlags(flags) + _arg8 = C.gint(timeoutMsec) + if callback != nil { + _arg10 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg11 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_connection_call(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + runtime.KeepAlive(busName) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceName) + runtime.KeepAlive(methodName) + runtime.KeepAlive(parameters) + runtime.KeepAlive(replyType) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeoutMsec) + runtime.KeepAlive(callback) +} + +// CallFinish finishes an operation started with g_dbus_connection_call(). +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to g_dbus_connection_call(). +// +// The function returns the following values: +// +// - variant: NULL if error is set. Otherwise a non-floating #GVariant tuple +// with return values. Free with g_variant_unref(). +func (connection *DBusConnection) CallFinish(res AsyncResulter) (*glib.Variant, error) { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GVariant // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_connection_call_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(res) + + var _variant *glib.Variant // out + var _goerr error // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _variant, _goerr +} + +// CallSync: synchronously invokes the method_name method on the interface_name +// D-Bus interface on the remote object at object_path owned by bus_name. +// +// If connection is closed then the operation will fail with G_IO_ERROR_CLOSED. +// If cancellable is canceled, the operation will fail with +// G_IO_ERROR_CANCELLED. If parameters contains a value not compatible with the +// D-Bus protocol, the operation fails with G_IO_ERROR_INVALID_ARGUMENT. +// +// If reply_type is non-NULL then the reply will be checked for having this +// type and an error will be raised if it does not match. Said another way, +// if you give a reply_type then any non-NULL return value will be of this type. +// +// If the parameters #GVariant is floating, it is consumed. This allows +// convenient 'inline' use of g_variant_new(), e.g.: +// +// g_dbus_connection_call_sync (connection, +// "org.freedesktop.StringThings", +// "/org/freedesktop/StringThings", +// "org.freedesktop.StringThings", +// "TwoStrings", +// g_variant_new ("(ss)", +// "Thing One", +// "Thing Two"), +// NULL, +// G_DBUS_CALL_FLAGS_NONE, +// -1, +// NULL, +// &error); +// +// The calling thread is blocked until a reply is received. See +// g_dbus_connection_call() for the asynchronous version of this method. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - busName (optional): unique or well-known bus name or NULL if connection +// is not a message bus connection. +// - objectPath: path of remote object. +// - interfaceName d-Bus interface to invoke method on. +// - methodName: name of the method to invoke. +// - parameters (optional) tuple with parameters for the method or NULL if not +// passing parameters. +// - replyType (optional): expected type of the reply, or NULL. +// - flags from the BusCallFlags enumeration. +// - timeoutMsec: timeout in milliseconds, -1 to use the default timeout or +// G_MAXINT for no timeout. +// +// The function returns the following values: +// +// - variant: NULL if error is set. Otherwise a non-floating #GVariant tuple +// with return values. Free with g_variant_unref(). +func (connection *DBusConnection) CallSync(ctx context.Context, busName, objectPath, interfaceName, methodName string, parameters *glib.Variant, replyType *glib.VariantType, flags DBusCallFlags, timeoutMsec int) (*glib.Variant, error) { + var _arg0 *C.GDBusConnection // out + var _arg9 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 *C.GVariant // out + var _arg6 *C.GVariantType // out + var _arg7 C.GDBusCallFlags // out + var _arg8 C.gint // out + var _cret *C.GVariant // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg9 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if busName != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(busName))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(methodName))) + defer C.free(unsafe.Pointer(_arg4)) + if parameters != nil { + _arg5 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameters))) + } + if replyType != nil { + _arg6 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(replyType))) + } + _arg7 = C.GDBusCallFlags(flags) + _arg8 = C.gint(timeoutMsec) + + _cret = C.g_dbus_connection_call_sync(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + runtime.KeepAlive(busName) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceName) + runtime.KeepAlive(methodName) + runtime.KeepAlive(parameters) + runtime.KeepAlive(replyType) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeoutMsec) + + var _variant *glib.Variant // out + var _goerr error // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _variant, _goerr +} + +// Close closes connection. Note that this never causes the process to exit +// (this might only happen if the other end of a shared message bus connection +// disconnects, see BusConnection:exit-on-close). +// +// Once the connection is closed, operations such as sending a message +// will return with the error G_IO_ERROR_CLOSED. Closing a connection will +// not automatically flush the connection so queued messages may be lost. +// Use g_dbus_connection_flush() if you need such guarantees. +// +// If connection is already closed, this method fails with G_IO_ERROR_CLOSED. +// +// When connection has been closed, the BusConnection::closed signal is emitted +// in the [thread-default main context][g-main-context-push-thread-default] of +// the thread that connection was constructed in. +// +// This is an asynchronous method. When the operation is finished, +// callback will be invoked in the [thread-default main +// context][g-main-context-push-thread-default] of the thread you are calling +// this method from. You can then call g_dbus_connection_close_finish() to +// get the result of the operation. See g_dbus_connection_close_sync() for the +// synchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - callback (optional) to call when the request is satisfied or NULL if you +// don't care about the result. +func (connection *DBusConnection) Close(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_connection_close(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// CloseFinish finishes an operation started with g_dbus_connection_close(). +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to g_dbus_connection_close(). +func (connection *DBusConnection) CloseFinish(res AsyncResulter) error { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C.g_dbus_connection_close_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(res) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CloseSync: synchronously closes connection. The calling thread is blocked +// until this is done. See g_dbus_connection_close() for the asynchronous +// version of this method and more details about what it does. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (connection *DBusConnection) CloseSync(ctx context.Context) error { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_dbus_connection_close_sync(_arg0, _arg1, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// EmitSignal emits a signal. +// +// If the parameters GVariant is floating, it is consumed. +// +// This can only fail if parameters is not compatible with the D-Bus +// protocol (G_IO_ERROR_INVALID_ARGUMENT), or if connection has been closed +// (G_IO_ERROR_CLOSED). +// +// The function takes the following parameters: +// +// - destinationBusName (optional): unique bus name for the destination for +// the signal or NULL to emit to all listeners. +// - objectPath: path of remote object. +// - interfaceName d-Bus interface to emit a signal on. +// - signalName: name of the signal to emit. +// - parameters (optional) tuple with parameters for the signal or NULL if not +// passing parameters. +func (connection *DBusConnection) EmitSignal(destinationBusName, objectPath, interfaceName, signalName string, parameters *glib.Variant) error { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 *C.GVariant // out + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + if destinationBusName != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(destinationBusName))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(signalName))) + defer C.free(unsafe.Pointer(_arg4)) + if parameters != nil { + _arg5 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameters))) + } + + C.g_dbus_connection_emit_signal(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(destinationBusName) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceName) + runtime.KeepAlive(signalName) + runtime.KeepAlive(parameters) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ExportActionGroup exports action_group on connection at object_path. +// +// The implemented D-Bus API should be considered private. It is subject to +// change in the future. +// +// A given object path can only have one action group exported on it. If this +// constraint is violated, the export will fail and 0 will be returned (with +// error set accordingly). +// +// You can unexport the action group using +// g_dbus_connection_unexport_action_group() with the return value of this +// function. +// +// The thread default main context is taken at the time of this call. +// All incoming action activations and state change requests are reported from +// this context. Any changes on the action group that cause it to emit signals +// must also come from this same context. Since incoming action activations and +// state change requests are rather likely to cause changes on the action group, +// this effectively limits a given action group to being exported from only one +// main context. +// +// The function takes the following parameters: +// +// - objectPath d-Bus object path. +// - actionGroup: Group. +// +// The function returns the following values: +// +// - guint: ID of the export (never zero), or 0 in case of failure. +func (connection *DBusConnection) ExportActionGroup(objectPath string, actionGroup ActionGrouper) (uint, error) { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.gchar // out + var _arg2 *C.GActionGroup // out + var _cret C.guint // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GActionGroup)(unsafe.Pointer(coreglib.InternObject(actionGroup).Native())) + + _cret = C.g_dbus_connection_export_action_group(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(actionGroup) + + var _guint uint // out + var _goerr error // out + + _guint = uint(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint, _goerr +} + +// ExportMenuModel exports menu on connection at object_path. +// +// The implemented D-Bus API should be considered private. It is subject to +// change in the future. +// +// An object path can only have one menu model exported on it. If this +// constraint is violated, the export will fail and 0 will be returned (with +// error set accordingly). +// +// Exporting menus with sections containing more than +// G_MENU_EXPORTER_MAX_SECTION_SIZE items is not supported and results in +// undefined behavior. +// +// You can unexport the menu model using g_dbus_connection_unexport_menu_model() +// with the return value of this function. +// +// The function takes the following parameters: +// +// - objectPath d-Bus object path. +// - menu: Model. +// +// The function returns the following values: +// +// - guint: ID of the export (never zero), or 0 in case of failure. +func (connection *DBusConnection) ExportMenuModel(objectPath string, menu MenuModeller) (uint, error) { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.gchar // out + var _arg2 *C.GMenuModel // out + var _cret C.guint // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + + _cret = C.g_dbus_connection_export_menu_model(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(menu) + + var _guint uint // out + var _goerr error // out + + _guint = uint(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint, _goerr +} + +// Flush: asynchronously flushes connection, that is, writes all queued +// outgoing message to the transport and then flushes the transport (using +// g_output_stream_flush_async()). This is useful in programs that wants to emit +// a D-Bus signal and then exit immediately. Without flushing the connection, +// there is no guaranteed that the message has been sent to the networking +// buffers in the OS kernel. +// +// This is an asynchronous method. When the operation is finished, +// callback will be invoked in the [thread-default main +// context][g-main-context-push-thread-default] of the thread you are calling +// this method from. You can then call g_dbus_connection_flush_finish() to +// get the result of the operation. See g_dbus_connection_flush_sync() for the +// synchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - callback (optional) to call when the request is satisfied or NULL if you +// don't care about the result. +func (connection *DBusConnection) Flush(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_connection_flush(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// FlushFinish finishes an operation started with g_dbus_connection_flush(). +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to g_dbus_connection_flush(). +func (connection *DBusConnection) FlushFinish(res AsyncResulter) error { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + C.g_dbus_connection_flush_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(res) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// FlushSync: synchronously flushes connection. The calling thread is blocked +// until this is done. See g_dbus_connection_flush() for the asynchronous +// version of this method and more details about what it does. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (connection *DBusConnection) FlushSync(ctx context.Context) error { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_dbus_connection_flush_sync(_arg0, _arg1, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Capabilities gets the capabilities negotiated with the remote peer. +// +// The function returns the following values: +// +// - dBusCapabilityFlags: zero or more flags from the BusCapabilityFlags +// enumeration. +func (connection *DBusConnection) Capabilities() DBusCapabilityFlags { + var _arg0 *C.GDBusConnection // out + var _cret C.GDBusCapabilityFlags // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_connection_get_capabilities(_arg0) + runtime.KeepAlive(connection) + + var _dBusCapabilityFlags DBusCapabilityFlags // out + + _dBusCapabilityFlags = DBusCapabilityFlags(_cret) + + return _dBusCapabilityFlags +} + +// ExitOnClose gets whether the process is terminated when connection is closed +// by the remote peer. See BusConnection:exit-on-close for more details. +// +// The function returns the following values: +// +// - ok: whether the process is terminated when connection is closed by the +// remote peer. +func (connection *DBusConnection) ExitOnClose() bool { + var _arg0 *C.GDBusConnection // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_connection_get_exit_on_close(_arg0) + runtime.KeepAlive(connection) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Flags gets the flags used to construct this connection. +// +// The function returns the following values: +// +// - dBusConnectionFlags: zero or more flags from the BusConnectionFlags +// enumeration. +func (connection *DBusConnection) Flags() DBusConnectionFlags { + var _arg0 *C.GDBusConnection // out + var _cret C.GDBusConnectionFlags // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_connection_get_flags(_arg0) + runtime.KeepAlive(connection) + + var _dBusConnectionFlags DBusConnectionFlags // out + + _dBusConnectionFlags = DBusConnectionFlags(_cret) + + return _dBusConnectionFlags +} + +// GUID of the peer performing the role of server when authenticating. See +// BusConnection:guid for more details. +// +// The function returns the following values: +// +// - utf8: GUID. Do not free this string, it is owned by connection. +func (connection *DBusConnection) GUID() string { + var _arg0 *C.GDBusConnection // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_connection_get_guid(_arg0) + runtime.KeepAlive(connection) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// LastSerial retrieves the last serial number assigned to a BusMessage +// on the current thread. This includes messages sent via both low-level +// API such as g_dbus_connection_send_message() as well as high-level API +// such as g_dbus_connection_emit_signal(), g_dbus_connection_call() or +// g_dbus_proxy_call(). +// +// The function returns the following values: +// +// - guint32: last used serial or zero when no message has been sent within +// the current thread. +func (connection *DBusConnection) LastSerial() uint32 { + var _arg0 *C.GDBusConnection // out + var _cret C.guint32 // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_connection_get_last_serial(_arg0) + runtime.KeepAlive(connection) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// PeerCredentials gets the credentials of the authenticated peer. +// This will always return NULL unless connection acted as a server (e.g. +// G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER was passed) when set up and the +// client passed credentials as part of the authentication process. +// +// In a message bus setup, the message bus is always the server and each +// application is a client. So this method will always return NULL for message +// bus clients. +// +// The function returns the following values: +// +// - credentials (optional) or NULL if not available. Do not free this object, +// it is owned by connection. +func (connection *DBusConnection) PeerCredentials() *Credentials { + var _arg0 *C.GDBusConnection // out + var _cret *C.GCredentials // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_connection_get_peer_credentials(_arg0) + runtime.KeepAlive(connection) + + var _credentials *Credentials // out + + if _cret != nil { + _credentials = wrapCredentials(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _credentials +} + +// Stream gets the underlying stream used for IO. +// +// While the BusConnection is active, it will interact with this stream from a +// worker thread, so it is not safe to interact with the stream directly. +// +// The function returns the following values: +// +// - ioStream: stream used for IO. +func (connection *DBusConnection) Stream() IOStreamer { + var _arg0 *C.GDBusConnection // out + var _cret *C.GIOStream // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_connection_get_stream(_arg0) + runtime.KeepAlive(connection) + + var _ioStream IOStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _ioStream = rv + } + + return _ioStream +} + +// UniqueName gets the unique name of connection as assigned by the message bus. +// This can also be used to figure out if connection is a message bus +// connection. +// +// The function returns the following values: +// +// - utf8 (optional): unique name or NULL if connection is not a message bus +// connection. Do not free this string, it is owned by connection. +func (connection *DBusConnection) UniqueName() string { + var _arg0 *C.GDBusConnection // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_connection_get_unique_name(_arg0) + runtime.KeepAlive(connection) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// IsClosed gets whether connection is closed. +// +// The function returns the following values: +// +// - ok: TRUE if the connection is closed, FALSE otherwise. +func (connection *DBusConnection) IsClosed() bool { + var _arg0 *C.GDBusConnection // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_connection_is_closed(_arg0) + runtime.KeepAlive(connection) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RegisterObject: version of g_dbus_connection_register_object() using closures +// instead of a BusInterfaceVTable for easier binding in other languages. +// +// The function takes the following parameters: +// +// - objectPath: object path to register at. +// - interfaceInfo: introspection data for the interface. +// - methodCallClosure (optional) for handling incoming method calls. +// - getPropertyClosure (optional) for getting a property. +// - setPropertyClosure (optional) for setting a property. +// +// The function returns the following values: +// +// - guint: 0 if error is set, otherwise a registration ID (never 0) that can +// be used with g_dbus_connection_unregister_object() . +func (connection *DBusConnection) RegisterObject(objectPath string, interfaceInfo *DBusInterfaceInfo, methodCallClosure, getPropertyClosure, setPropertyClosure coreglib.AnyClosure) (uint, error) { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.gchar // out + var _arg2 *C.GDBusInterfaceInfo // out + var _arg3 *C.GClosure // out + var _arg4 *C.GClosure // out + var _arg5 *C.GClosure // out + var _cret C.guint // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(interfaceInfo))) + _arg3 = (*C.GClosure)(coreglib.NewClosure(coreglib.InternObject(connection), methodCallClosure)) + _arg4 = (*C.GClosure)(coreglib.NewClosure(coreglib.InternObject(connection), getPropertyClosure)) + _arg5 = (*C.GClosure)(coreglib.NewClosure(coreglib.InternObject(connection), setPropertyClosure)) + + _cret = C.g_dbus_connection_register_object_with_closures(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceInfo) + runtime.KeepAlive(methodCallClosure) + runtime.KeepAlive(getPropertyClosure) + runtime.KeepAlive(setPropertyClosure) + + var _guint uint // out + var _goerr error // out + + _guint = uint(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint, _goerr +} + +// RemoveFilter removes a filter. +// +// Note that since filters run in a different thread, there is a race +// condition where it is possible that the filter will be running even after +// calling g_dbus_connection_remove_filter(), so you cannot just free data +// that the filter might be using. Instead, you should pass a Notify to +// g_dbus_connection_add_filter(), which will be called when it is guaranteed +// that the data is no longer needed. +// +// The function takes the following parameters: +// +// - filterId: identifier obtained from g_dbus_connection_add_filter(). +func (connection *DBusConnection) RemoveFilter(filterId uint) { + var _arg0 *C.GDBusConnection // out + var _arg1 C.guint // out + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = C.guint(filterId) + + C.g_dbus_connection_remove_filter(_arg0, _arg1) + runtime.KeepAlive(connection) + runtime.KeepAlive(filterId) +} + +// SendMessage: asynchronously sends message to the peer represented by +// connection. +// +// Unless flags contain the G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, +// the serial number will be assigned by connection and set on message via +// g_dbus_message_set_serial(). If out_serial is not NULL, then the serial +// number used will be written to this location prior to submitting the message +// to the underlying transport. While it has a volatile qualifier, this is a +// historical artifact and the argument passed to it should not be volatile. +// +// If connection is closed then the operation will fail with +// G_IO_ERROR_CLOSED. If message is not well-formed, the operation fails with +// G_IO_ERROR_INVALID_ARGUMENT. +// +// See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for +// an example of how to use this low-level API to send and receive UNIX file +// descriptors. +// +// Note that message must be unlocked, unless flags contain the +// G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. +// +// The function takes the following parameters: +// +// - message: BusMessage. +// - flags affecting how the message is sent. +// +// The function returns the following values: +// +// - outSerial (optional): return location for serial number assigned to +// message when sending it or NULL. +func (connection *DBusConnection) SendMessage(message *DBusMessage, flags DBusSendMessageFlags) (uint32, error) { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.GDBusMessage // out + var _arg2 C.GDBusSendMessageFlags // out + var _arg3 C.guint32 // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg2 = C.GDBusSendMessageFlags(flags) + + C.g_dbus_connection_send_message(_arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(message) + runtime.KeepAlive(flags) + + var _outSerial uint32 // out + var _goerr error // out + + _outSerial = uint32(_arg3) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _outSerial, _goerr +} + +// SendMessageWithReply: asynchronously sends message to the peer represented by +// connection. +// +// Unless flags contain the G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, +// the serial number will be assigned by connection and set on message via +// g_dbus_message_set_serial(). If out_serial is not NULL, then the serial +// number used will be written to this location prior to submitting the message +// to the underlying transport. While it has a volatile qualifier, this is a +// historical artifact and the argument passed to it should not be volatile. +// +// If connection is closed then the operation will fail with G_IO_ERROR_CLOSED. +// If cancellable is canceled, the operation will fail with +// G_IO_ERROR_CANCELLED. If message is not well-formed, the operation fails with +// G_IO_ERROR_INVALID_ARGUMENT. +// +// This is an asynchronous method. When the operation is +// finished, callback will be invoked in the [thread-default +// main context][g-main-context-push-thread-default] of the +// thread you are calling this method from. You can then call +// g_dbus_connection_send_message_with_reply_finish() to get the result of +// the operation. See g_dbus_connection_send_message_with_reply_sync() for the +// synchronous version. +// +// Note that message must be unlocked, unless flags contain the +// G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. +// +// See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for +// an example of how to use this low-level API to send and receive UNIX file +// descriptors. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - message: BusMessage. +// - flags affecting how the message is sent. +// - timeoutMsec: timeout in milliseconds, -1 to use the default timeout or +// G_MAXINT for no timeout. +// - callback (optional) to call when the request is satisfied or NULL if you +// don't care about the result. +// +// The function returns the following values: +// +// - outSerial (optional): return location for serial number assigned to +// message when sending it or NULL. +func (connection *DBusConnection) SendMessageWithReply(ctx context.Context, message *DBusMessage, flags DBusSendMessageFlags, timeoutMsec int, callback AsyncReadyCallback) uint32 { + var _arg0 *C.GDBusConnection // out + var _arg5 *C.GCancellable // out + var _arg1 *C.GDBusMessage // out + var _arg2 C.GDBusSendMessageFlags // out + var _arg3 C.gint // out + var _arg4 C.guint32 // in + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg2 = C.GDBusSendMessageFlags(flags) + _arg3 = C.gint(timeoutMsec) + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_connection_send_message_with_reply(_arg0, _arg1, _arg2, _arg3, &_arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + runtime.KeepAlive(message) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeoutMsec) + runtime.KeepAlive(callback) + + var _outSerial uint32 // out + + _outSerial = uint32(_arg4) + + return _outSerial +} + +// SendMessageWithReplyFinish finishes an operation started with +// g_dbus_connection_send_message_with_reply(). +// +// Note that error is only set if a local in-process error occurred. +// That is to say that the returned BusMessage object may be of type +// G_DBUS_MESSAGE_TYPE_ERROR. Use g_dbus_message_to_gerror() to transcode this +// to a #GError. +// +// See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for +// an example of how to use this low-level API to send and receive UNIX file +// descriptors. +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to +// g_dbus_connection_send_message_with_reply(). +// +// The function returns the following values: +// +// - dBusMessage: locked BusMessage or NULL if error is set. +func (connection *DBusConnection) SendMessageWithReplyFinish(res AsyncResulter) (*DBusMessage, error) { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GDBusMessage // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_connection_send_message_with_reply_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(res) + + var _dBusMessage *DBusMessage // out + var _goerr error // out + + _dBusMessage = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusMessage, _goerr +} + +// SendMessageWithReplySync: synchronously sends message to the peer represented +// by connection and blocks the calling thread until a reply is received or the +// timeout is reached. See g_dbus_connection_send_message_with_reply() for the +// asynchronous version of this method. +// +// Unless flags contain the G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag, +// the serial number will be assigned by connection and set on message via +// g_dbus_message_set_serial(). If out_serial is not NULL, then the serial +// number used will be written to this location prior to submitting the message +// to the underlying transport. While it has a volatile qualifier, this is a +// historical artifact and the argument passed to it should not be volatile. +// +// If connection is closed then the operation will fail with G_IO_ERROR_CLOSED. +// If cancellable is canceled, the operation will fail with +// G_IO_ERROR_CANCELLED. If message is not well-formed, the operation fails with +// G_IO_ERROR_INVALID_ARGUMENT. +// +// Note that error is only set if a local in-process error occurred. +// That is to say that the returned BusMessage object may be of type +// G_DBUS_MESSAGE_TYPE_ERROR. Use g_dbus_message_to_gerror() to transcode this +// to a #GError. +// +// See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for +// an example of how to use this low-level API to send and receive UNIX file +// descriptors. +// +// Note that message must be unlocked, unless flags contain the +// G_DBUS_SEND_MESSAGE_FLAGS_PRESERVE_SERIAL flag. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - message: BusMessage. +// - flags affecting how the message is sent. +// - timeoutMsec: timeout in milliseconds, -1 to use the default timeout or +// G_MAXINT for no timeout. +// +// The function returns the following values: +// +// - outSerial (optional): return location for serial number assigned to +// message when sending it or NULL. +// - dBusMessage: locked BusMessage that is the reply to message or NULL if +// error is set. +func (connection *DBusConnection) SendMessageWithReplySync(ctx context.Context, message *DBusMessage, flags DBusSendMessageFlags, timeoutMsec int) (uint32, *DBusMessage, error) { + var _arg0 *C.GDBusConnection // out + var _arg5 *C.GCancellable // out + var _arg1 *C.GDBusMessage // out + var _arg2 C.GDBusSendMessageFlags // out + var _arg3 C.gint // out + var _arg4 C.guint32 // in + var _cret *C.GDBusMessage // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg2 = C.GDBusSendMessageFlags(flags) + _arg3 = C.gint(timeoutMsec) + + _cret = C.g_dbus_connection_send_message_with_reply_sync(_arg0, _arg1, _arg2, _arg3, &_arg4, _arg5, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + runtime.KeepAlive(message) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeoutMsec) + + var _outSerial uint32 // out + var _dBusMessage *DBusMessage // out + var _goerr error // out + + _outSerial = uint32(_arg4) + _dBusMessage = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _outSerial, _dBusMessage, _goerr +} + +// SetExitOnClose sets whether the process should be terminated when connection +// is closed by the remote peer. See BusConnection:exit-on-close for more +// details. +// +// Note that this function should be used with care. Most modern UNIX desktops +// tie the notion of a user session with the session bus, and expect all of +// a user's applications to quit when their bus connection goes away. If you +// are setting exit_on_close to FALSE for the shared session bus connection, +// you should make sure that your application exits when the user session ends. +// +// The function takes the following parameters: +// +// - exitOnClose: whether the process should be terminated when connection is +// closed by the remote peer. +func (connection *DBusConnection) SetExitOnClose(exitOnClose bool) { + var _arg0 *C.GDBusConnection // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + if exitOnClose { + _arg1 = C.TRUE + } + + C.g_dbus_connection_set_exit_on_close(_arg0, _arg1) + runtime.KeepAlive(connection) + runtime.KeepAlive(exitOnClose) +} + +// SignalSubscribe subscribes to signals on connection and invokes callback +// whenever the signal is received. Note that callback will be invoked in the +// [thread-default main context][g-main-context-push-thread-default] of the +// thread you are calling this method from. +// +// If connection is not a message bus connection, sender must be NULL. +// +// If sender is a well-known name note that callback is invoked with the unique +// name for the owner of sender, not the well-known name as one would expect. +// This is because the message bus rewrites the name. As such, to avoid certain +// race conditions, users should be tracking the name owner of the well-known +// name and use that when processing the received signal. +// +// If one of G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_NAMESPACE or +// G_DBUS_SIGNAL_FLAGS_MATCH_ARG0_PATH are given, arg0 is interpreted as part of +// a namespace or path. The first argument of a signal is matched against that +// part as specified by D-Bus. +// +// If user_data_free_func is non-NULL, it will be called (in the thread-default +// main context of the thread you are calling this method from) at some point +// after user_data is no longer needed. (It is not guaranteed to be called +// synchronously when the signal is unsubscribed from, and may be called after +// connection has been destroyed.) +// +// As callback is potentially invoked in a different thread from +// where it’s emitted, it’s possible for this to happen after +// g_dbus_connection_signal_unsubscribe() has been called in another thread. +// Due to this, user_data should have a strong reference which is freed with +// user_data_free_func, rather than pointing to data whose lifecycle is tied +// to the signal subscription. For example, if a #GObject is used to store the +// subscription ID from g_dbus_connection_signal_subscribe(), a strong reference +// to that #GObject must be passed to user_data, and g_object_unref() passed to +// user_data_free_func. You are responsible for breaking the resulting reference +// count cycle by explicitly unsubscribing from the signal when dropping the +// last external reference to the #GObject. Alternatively, a weak reference may +// be used. +// +// It is guaranteed that if you unsubscribe from a signal using +// g_dbus_connection_signal_unsubscribe() from the same thread which made the +// corresponding g_dbus_connection_signal_subscribe() call, callback will not be +// invoked after g_dbus_connection_signal_unsubscribe() returns. +// +// The returned subscription identifier is an opaque value which is guaranteed +// to never be zero. +// +// This function can never fail. +// +// The function takes the following parameters: +// +// - sender (optional) name to match on (unique or well-known name) or NULL to +// listen from all senders. +// - interfaceName (optional) d-Bus interface name to match on or NULL to +// match on all interfaces. +// - member (optional) d-Bus signal name to match on or NULL to match on all +// signals. +// - objectPath (optional): object path to match on or NULL to match on all +// object paths. +// - arg0 (optional) contents of first string argument to match on or NULL to +// match on all kinds of arguments. +// - flags describing how arg0 is used in subscribing to the signal. +// - callback to invoke when there is a signal matching the requested data. +// +// The function returns the following values: +// +// - guint: subscription identifier that can be used with +// g_dbus_connection_signal_unsubscribe(). +func (connection *DBusConnection) SignalSubscribe(sender, interfaceName, member, objectPath, arg0 string, flags DBusSignalFlags, callback DBusSignalCallback) uint { + var _arg0 *C.GDBusConnection // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 *C.gchar // out + var _arg6 C.GDBusSignalFlags // out + var _arg7 C.GDBusSignalCallback // out + var _arg8 C.gpointer + var _arg9 C.GDestroyNotify + var _cret C.guint // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + if sender != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(sender))) + defer C.free(unsafe.Pointer(_arg1)) + } + if interfaceName != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg2)) + } + if member != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(member))) + defer C.free(unsafe.Pointer(_arg3)) + } + if objectPath != "" { + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg4)) + } + if arg0 != "" { + _arg5 = (*C.gchar)(unsafe.Pointer(C.CString(arg0))) + defer C.free(unsafe.Pointer(_arg5)) + } + _arg6 = C.GDBusSignalFlags(flags) + _arg7 = (*[0]byte)(C._gotk4_gio2_DBusSignalCallback) + _arg8 = C.gpointer(gbox.Assign(callback)) + _arg9 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + + _cret = C.g_dbus_connection_signal_subscribe(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9) + runtime.KeepAlive(connection) + runtime.KeepAlive(sender) + runtime.KeepAlive(interfaceName) + runtime.KeepAlive(member) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(arg0) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// SignalUnsubscribe unsubscribes from signals. +// +// Note that there may still be D-Bus traffic to process (relating to this +// signal subscription) in the current thread-default Context after this +// function has returned. You should continue to iterate the Context until the +// Notify function passed to g_dbus_connection_signal_subscribe() is called, +// in order to avoid memory leaks through callbacks queued on the Context after +// it’s stopped being iterated. Alternatively, any idle source with a priority +// lower than G_PRIORITY_DEFAULT that was scheduled after unsubscription, +// also indicates that all resources of this subscription are released. +// +// The function takes the following parameters: +// +// - subscriptionId: subscription id obtained from +// g_dbus_connection_signal_subscribe(). +func (connection *DBusConnection) SignalUnsubscribe(subscriptionId uint) { + var _arg0 *C.GDBusConnection // out + var _arg1 C.guint // out + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = C.guint(subscriptionId) + + C.g_dbus_connection_signal_unsubscribe(_arg0, _arg1) + runtime.KeepAlive(connection) + runtime.KeepAlive(subscriptionId) +} + +// StartMessageProcessing: if connection was created with +// G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING, this method starts +// processing messages. Does nothing on if connection wasn't created with this +// flag or if the method has already been called. +func (connection *DBusConnection) StartMessageProcessing() { + var _arg0 *C.GDBusConnection // out + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + C.g_dbus_connection_start_message_processing(_arg0) + runtime.KeepAlive(connection) +} + +// UnexportActionGroup reverses the effect of a previous call to +// g_dbus_connection_export_action_group(). +// +// It is an error to call this function with an ID that wasn't returned from +// g_dbus_connection_export_action_group() or to call it with the same ID more +// than once. +// +// The function takes the following parameters: +// +// - exportId: ID from g_dbus_connection_export_action_group(). +func (connection *DBusConnection) UnexportActionGroup(exportId uint) { + var _arg0 *C.GDBusConnection // out + var _arg1 C.guint // out + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = C.guint(exportId) + + C.g_dbus_connection_unexport_action_group(_arg0, _arg1) + runtime.KeepAlive(connection) + runtime.KeepAlive(exportId) +} + +// UnexportMenuModel reverses the effect of a previous call to +// g_dbus_connection_export_menu_model(). +// +// It is an error to call this function with an ID that wasn't returned from +// g_dbus_connection_export_menu_model() or to call it with the same ID more +// than once. +// +// The function takes the following parameters: +// +// - exportId: ID from g_dbus_connection_export_menu_model(). +func (connection *DBusConnection) UnexportMenuModel(exportId uint) { + var _arg0 *C.GDBusConnection // out + var _arg1 C.guint // out + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = C.guint(exportId) + + C.g_dbus_connection_unexport_menu_model(_arg0, _arg1) + runtime.KeepAlive(connection) + runtime.KeepAlive(exportId) +} + +// UnregisterObject unregisters an object. +// +// The function takes the following parameters: +// +// - registrationId: registration id obtained from +// g_dbus_connection_register_object(). +// +// The function returns the following values: +// +// - ok: TRUE if the object was unregistered, FALSE otherwise. +func (connection *DBusConnection) UnregisterObject(registrationId uint) bool { + var _arg0 *C.GDBusConnection // out + var _arg1 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = C.guint(registrationId) + + _cret = C.g_dbus_connection_unregister_object(_arg0, _arg1) + runtime.KeepAlive(connection) + runtime.KeepAlive(registrationId) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnregisterSubtree unregisters a subtree. +// +// The function takes the following parameters: +// +// - registrationId: subtree registration id obtained from +// g_dbus_connection_register_subtree(). +// +// The function returns the following values: +// +// - ok: TRUE if the subtree was unregistered, FALSE otherwise. +func (connection *DBusConnection) UnregisterSubtree(registrationId uint) bool { + var _arg0 *C.GDBusConnection // out + var _arg1 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = C.guint(registrationId) + + _cret = C.g_dbus_connection_unregister_subtree(_arg0, _arg1) + runtime.KeepAlive(connection) + runtime.KeepAlive(registrationId) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// NewDBusConnection: asynchronously sets up a D-Bus connection for exchanging +// D-Bus messages with the end represented by stream. +// +// If stream is a Connection, then the corresponding #GSocket will be put into +// non-blocking mode. +// +// The D-Bus connection will interact with stream from a worker thread. As a +// result, the caller should not interact with stream after this method has been +// called, except by calling g_object_unref() on it. +// +// If observer is not NULL it may be used to control the authentication process. +// +// When the operation is finished, callback will be invoked. You can then call +// g_dbus_connection_new_finish() to get the result of the operation. +// +// This is an asynchronous failable constructor. See +// g_dbus_connection_new_sync() for the synchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - stream: OStream. +// - guid (optional): GUID to use if authenticating as a server or NULL. +// - flags describing how to make the connection. +// - observer (optional) or NULL. +// - callback (optional) to call when the request is satisfied. +func NewDBusConnection(ctx context.Context, stream IOStreamer, guid string, flags DBusConnectionFlags, observer *DBusAuthObserver, callback AsyncReadyCallback) { + var _arg5 *C.GCancellable // out + var _arg1 *C.GIOStream // out + var _arg2 *C.gchar // out + var _arg3 C.GDBusConnectionFlags // out + var _arg4 *C.GDBusAuthObserver // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + if guid != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(guid))) + defer C.free(unsafe.Pointer(_arg2)) + } + _arg3 = C.GDBusConnectionFlags(flags) + if observer != nil { + _arg4 = (*C.GDBusAuthObserver)(unsafe.Pointer(coreglib.InternObject(observer).Native())) + } + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_connection_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream) + runtime.KeepAlive(guid) + runtime.KeepAlive(flags) + runtime.KeepAlive(observer) + runtime.KeepAlive(callback) +} + +// NewDBusConnectionForAddress: asynchronously connects and sets up a +// D-Bus client connection for exchanging D-Bus messages with an endpoint +// specified by address which must be in the D-Bus address format +// (https://dbus.freedesktop.org/doc/dbus-specification.html#addresses). +// +// This constructor can only be used to initiate client-side connections - use +// g_dbus_connection_new() if you need to act as the server. In particular, +// flags cannot contain the G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER, +// G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS or +// G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER flags. +// +// When the operation is finished, callback will be invoked. You can then +// call g_dbus_connection_new_for_address_finish() to get the result of the +// operation. +// +// If observer is not NULL it may be used to control the authentication process. +// +// This is an asynchronous failable constructor. See +// g_dbus_connection_new_for_address_sync() for the synchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - address d-Bus address. +// - flags describing how to make the connection. +// - observer (optional) or NULL. +// - callback (optional) to call when the request is satisfied. +func NewDBusConnectionForAddress(ctx context.Context, address string, flags DBusConnectionFlags, observer *DBusAuthObserver, callback AsyncReadyCallback) { + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GDBusConnectionFlags // out + var _arg3 *C.GDBusAuthObserver // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(address))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GDBusConnectionFlags(flags) + if observer != nil { + _arg3 = (*C.GDBusAuthObserver)(unsafe.Pointer(coreglib.InternObject(observer).Native())) + } + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_connection_new_for_address(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(flags) + runtime.KeepAlive(observer) + runtime.KeepAlive(callback) +} + +// DBusInterfaceSkeletonOverrides contains methods that are overridable. +type DBusInterfaceSkeletonOverrides struct { + // Flush: if interface_ has outstanding changes, request for these changes + // to be emitted immediately. + // + // For example, an exported D-Bus interface may queue up property changes + // and emit the org.freedesktop.DBus.Properties.PropertiesChanged signal + // later (e.g. in an idle handler). This technique is useful for collapsing + // multiple property changes into one. + Flush func() + // GAuthorizeMethod: signal class handler for the + // BusInterfaceSkeleton::g-authorize-method signal. + GAuthorizeMethod func(invocation *DBusMethodInvocation) bool + // Info gets D-Bus introspection information for the D-Bus interface + // implemented by interface_. + // + // The function returns the following values: + // + // - dBusInterfaceInfo (never NULL). Do not free. + Info func() *DBusInterfaceInfo + // Properties gets all D-Bus properties for interface_. + // + // The function returns the following values: + // + // - variant of type ['a{sv}'][G-VARIANT-TYPE-VARDICT:CAPS]. Free with + // g_variant_unref(). + Properties func() *glib.Variant + // Vtable gets the interface vtable for the D-Bus interface implemented + // by interface_. The returned function pointers should expect interface_ + // itself to be passed as user_data. + // + // The function returns the following values: + // + // - dBusInterfaceVTable: vtable of the D-Bus interface implemented by the + // skeleton. + Vtable func() *DBusInterfaceVTable +} + +func defaultDBusInterfaceSkeletonOverrides(v *DBusInterfaceSkeleton) DBusInterfaceSkeletonOverrides { + return DBusInterfaceSkeletonOverrides{ + Flush: v.flush, + GAuthorizeMethod: v.gAuthorizeMethod, + Info: v.info, + Properties: v.properties, + Vtable: v.vtable, + } +} + +// DBusInterfaceSkeleton: abstract base class for D-Bus interfaces on the +// service side. +type DBusInterfaceSkeleton struct { + _ [0]func() // equal guard + *coreglib.Object + + DBusInterface +} + +var ( + _ coreglib.Objector = (*DBusInterfaceSkeleton)(nil) +) + +// DBusInterfaceSkeletonner describes types inherited from class DBusInterfaceSkeleton. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type DBusInterfaceSkeletonner interface { + coreglib.Objector + baseDBusInterfaceSkeleton() *DBusInterfaceSkeleton +} + +var _ DBusInterfaceSkeletonner = (*DBusInterfaceSkeleton)(nil) + +func init() { + coreglib.RegisterClassInfo[*DBusInterfaceSkeleton, *DBusInterfaceSkeletonClass, DBusInterfaceSkeletonOverrides]( + GTypeDBusInterfaceSkeleton, + initDBusInterfaceSkeletonClass, + wrapDBusInterfaceSkeleton, + defaultDBusInterfaceSkeletonOverrides, + ) +} + +func initDBusInterfaceSkeletonClass(gclass unsafe.Pointer, overrides DBusInterfaceSkeletonOverrides, classInitFunc func(*DBusInterfaceSkeletonClass)) { + pclass := (*C.GDBusInterfaceSkeletonClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeDBusInterfaceSkeleton)))) + + if overrides.Flush != nil { + pclass.flush = (*[0]byte)(C._gotk4_gio2_DBusInterfaceSkeletonClass_flush) + } + + if overrides.GAuthorizeMethod != nil { + pclass.g_authorize_method = (*[0]byte)(C._gotk4_gio2_DBusInterfaceSkeletonClass_g_authorize_method) + } + + if overrides.Info != nil { + pclass.get_info = (*[0]byte)(C._gotk4_gio2_DBusInterfaceSkeletonClass_get_info) + } + + if overrides.Properties != nil { + pclass.get_properties = (*[0]byte)(C._gotk4_gio2_DBusInterfaceSkeletonClass_get_properties) + } + + if overrides.Vtable != nil { + pclass.get_vtable = (*[0]byte)(C._gotk4_gio2_DBusInterfaceSkeletonClass_get_vtable) + } + + if classInitFunc != nil { + class := (*DBusInterfaceSkeletonClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapDBusInterfaceSkeleton(obj *coreglib.Object) *DBusInterfaceSkeleton { + return &DBusInterfaceSkeleton{ + Object: obj, + DBusInterface: DBusInterface{ + Object: obj, + }, + } +} + +func marshalDBusInterfaceSkeleton(p uintptr) (interface{}, error) { + return wrapDBusInterfaceSkeleton(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (interface_ *DBusInterfaceSkeleton) baseDBusInterfaceSkeleton() *DBusInterfaceSkeleton { + return interface_ +} + +// BaseDBusInterfaceSkeleton returns the underlying base object. +func BaseDBusInterfaceSkeleton(obj DBusInterfaceSkeletonner) *DBusInterfaceSkeleton { + return obj.baseDBusInterfaceSkeleton() +} + +// ConnectGAuthorizeMethod is emitted when a method is invoked by a remote +// caller and used to determine if the method call is authorized. +// +// Note that this signal is emitted in a thread dedicated to handling the +// method call so handlers are allowed to perform blocking IO. This means that +// it is appropriate to call e.g. polkit_authority_check_authorization_sync() +// (http://hal.freedesktop.org/docs/polkit/PolkitAuthority.html#polkit-authority-check-authorization-sync) +// with the POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION +// (http://hal.freedesktop.org/docs/polkit/PolkitAuthority.htmlLKIT-CHECK-AUTHORIZATION-FLAGS-ALLOW-USER-INTERACTION:CAPS) +// flag set. +// +// If FALSE is returned then no further handlers are run and the signal handler +// must take a reference to invocation and finish handling the call (e.g. +// return an error via g_dbus_method_invocation_return_error()). +// +// Otherwise, if TRUE is returned, signal emission continues. If no handlers +// return FALSE, then the method is dispatched. If interface has an enclosing +// BusObjectSkeleton, then the BusObjectSkeleton::authorize-method signal +// handlers run before the handlers for this signal. +// +// The default class handler just returns TRUE. +// +// Please note that the common case is optimized: if no signals +// handlers are connected and the default class handler isn't +// overridden (for both interface and the enclosing BusObjectSkeleton, +// if any) and BusInterfaceSkeleton:g-flags does not have the +// G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD flags +// set, no dedicated thread is ever used and the call will be handled in the +// same thread as the object that interface belongs to was exported in. +func (interface_ *DBusInterfaceSkeleton) ConnectGAuthorizeMethod(f func(invocation *DBusMethodInvocation) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(interface_, "g-authorize-method", false, unsafe.Pointer(C._gotk4_gio2_DBusInterfaceSkeleton_ConnectGAuthorizeMethod), f) +} + +// Export exports interface_ at object_path on connection. +// +// This can be called multiple times to export the same interface_ onto multiple +// connections however the object_path provided must be the same for all +// connections. +// +// Use g_dbus_interface_skeleton_unexport() to unexport the object. +// +// The function takes the following parameters: +// +// - connection to export interface_ on. +// - objectPath: path to export the interface at. +func (interface_ *DBusInterfaceSkeleton) Export(connection *DBusConnection, objectPath string) error { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _arg1 *C.GDBusConnection // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_dbus_interface_skeleton_export(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(interface_) + runtime.KeepAlive(connection) + runtime.KeepAlive(objectPath) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Flush: if interface_ has outstanding changes, request for these changes to be +// emitted immediately. +// +// For example, an exported D-Bus interface may queue up property changes and +// emit the org.freedesktop.DBus.Properties.PropertiesChanged signal later (e.g. +// in an idle handler). This technique is useful for collapsing multiple +// property changes into one. +func (interface_ *DBusInterfaceSkeleton) Flush() { + var _arg0 *C.GDBusInterfaceSkeleton // out + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + C.g_dbus_interface_skeleton_flush(_arg0) + runtime.KeepAlive(interface_) +} + +// Connection gets the first connection that interface_ is exported on, if any. +// +// The function returns the following values: +// +// - dBusConnection (optional) or NULL if interface_ is not exported anywhere. +// Do not free, the object belongs to interface_. +func (interface_ *DBusInterfaceSkeleton) Connection() *DBusConnection { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret *C.GDBusConnection // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C.g_dbus_interface_skeleton_get_connection(_arg0) + runtime.KeepAlive(interface_) + + var _dBusConnection *DBusConnection // out + + if _cret != nil { + _dBusConnection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _dBusConnection +} + +// Connections gets a list of the connections that interface_ is exported on. +// +// The function returns the following values: +// +// - list of all the connections that interface_ is exported on. The returned +// list should be freed with g_list_free() after each element has been freed +// with g_object_unref(). +func (interface_ *DBusInterfaceSkeleton) Connections() []*DBusConnection { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret *C.GList // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C.g_dbus_interface_skeleton_get_connections(_arg0) + runtime.KeepAlive(interface_) + + var _list []*DBusConnection // out + + _list = make([]*DBusConnection, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GDBusConnection)(v) + var dst *DBusConnection // out + dst = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// Flags gets the BusInterfaceSkeletonFlags that describes what the behavior of +// interface_. +// +// The function returns the following values: +// +// - dBusInterfaceSkeletonFlags: one or more flags from the +// BusInterfaceSkeletonFlags enumeration. +func (interface_ *DBusInterfaceSkeleton) Flags() DBusInterfaceSkeletonFlags { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret C.GDBusInterfaceSkeletonFlags // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C.g_dbus_interface_skeleton_get_flags(_arg0) + runtime.KeepAlive(interface_) + + var _dBusInterfaceSkeletonFlags DBusInterfaceSkeletonFlags // out + + _dBusInterfaceSkeletonFlags = DBusInterfaceSkeletonFlags(_cret) + + return _dBusInterfaceSkeletonFlags +} + +// Info gets D-Bus introspection information for the D-Bus interface implemented +// by interface_. +// +// The function returns the following values: +// +// - dBusInterfaceInfo (never NULL). Do not free. +func (interface_ *DBusInterfaceSkeleton) Info() *DBusInterfaceInfo { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret *C.GDBusInterfaceInfo // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C.g_dbus_interface_skeleton_get_info(_arg0) + runtime.KeepAlive(interface_) + + var _dBusInterfaceInfo *DBusInterfaceInfo // out + + _dBusInterfaceInfo = (*DBusInterfaceInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_interface_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusInterfaceInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_interface_info_unref((*C.GDBusInterfaceInfo)(intern.C)) + }, + ) + + return _dBusInterfaceInfo +} + +// ObjectPath gets the object path that interface_ is exported on, if any. +// +// The function returns the following values: +// +// - utf8 (optional): string owned by interface_ or NULL if interface_ is not +// exported anywhere. Do not free, the string belongs to interface_. +func (interface_ *DBusInterfaceSkeleton) ObjectPath() string { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C.g_dbus_interface_skeleton_get_object_path(_arg0) + runtime.KeepAlive(interface_) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Properties gets all D-Bus properties for interface_. +// +// The function returns the following values: +// +// - variant of type ['a{sv}'][G-VARIANT-TYPE-VARDICT:CAPS]. Free with +// g_variant_unref(). +func (interface_ *DBusInterfaceSkeleton) Properties() *glib.Variant { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret *C.GVariant // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C.g_dbus_interface_skeleton_get_properties(_arg0) + runtime.KeepAlive(interface_) + + var _variant *glib.Variant // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// Vtable gets the interface vtable for the D-Bus interface implemented by +// interface_. The returned function pointers should expect interface_ itself to +// be passed as user_data. +// +// The function returns the following values: +// +// - dBusInterfaceVTable: vtable of the D-Bus interface implemented by the +// skeleton. +func (interface_ *DBusInterfaceSkeleton) Vtable() *DBusInterfaceVTable { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret *C.GDBusInterfaceVTable // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C.g_dbus_interface_skeleton_get_vtable(_arg0) + runtime.KeepAlive(interface_) + + var _dBusInterfaceVTable *DBusInterfaceVTable // out + + _dBusInterfaceVTable = (*DBusInterfaceVTable)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _dBusInterfaceVTable +} + +// HasConnection checks if interface_ is exported on connection. +// +// The function takes the following parameters: +// +// - connection: BusConnection. +// +// The function returns the following values: +// +// - ok: TRUE if interface_ is exported on connection, FALSE otherwise. +func (interface_ *DBusInterfaceSkeleton) HasConnection(connection *DBusConnection) bool { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _arg1 *C.GDBusConnection // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_dbus_interface_skeleton_has_connection(_arg0, _arg1) + runtime.KeepAlive(interface_) + runtime.KeepAlive(connection) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetFlags sets flags describing what the behavior of skeleton should be. +// +// The function takes the following parameters: +// +// - flags flags from the BusInterfaceSkeletonFlags enumeration. +func (interface_ *DBusInterfaceSkeleton) SetFlags(flags DBusInterfaceSkeletonFlags) { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _arg1 C.GDBusInterfaceSkeletonFlags // out + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + _arg1 = C.GDBusInterfaceSkeletonFlags(flags) + + C.g_dbus_interface_skeleton_set_flags(_arg0, _arg1) + runtime.KeepAlive(interface_) + runtime.KeepAlive(flags) +} + +// Unexport stops exporting interface_ on all connections it is exported on. +// +// To unexport interface_ from only a single connection, use +// g_dbus_interface_skeleton_unexport_from_connection(). +func (interface_ *DBusInterfaceSkeleton) Unexport() { + var _arg0 *C.GDBusInterfaceSkeleton // out + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + C.g_dbus_interface_skeleton_unexport(_arg0) + runtime.KeepAlive(interface_) +} + +// UnexportFromConnection stops exporting interface_ on connection. +// +// To stop exporting on all connections the interface is exported on, use +// g_dbus_interface_skeleton_unexport(). +// +// The function takes the following parameters: +// +// - connection: BusConnection. +func (interface_ *DBusInterfaceSkeleton) UnexportFromConnection(connection *DBusConnection) { + var _arg0 *C.GDBusInterfaceSkeleton // out + var _arg1 *C.GDBusConnection // out + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + C.g_dbus_interface_skeleton_unexport_from_connection(_arg0, _arg1) + runtime.KeepAlive(interface_) + runtime.KeepAlive(connection) +} + +// Flush: if interface_ has outstanding changes, request for these changes to be +// emitted immediately. +// +// For example, an exported D-Bus interface may queue up property changes and +// emit the org.freedesktop.DBus.Properties.PropertiesChanged signal later (e.g. +// in an idle handler). This technique is useful for collapsing multiple +// property changes into one. +func (interface_ *DBusInterfaceSkeleton) flush() { + gclass := (*C.GDBusInterfaceSkeletonClass)(coreglib.PeekParentClass(interface_)) + fnarg := gclass.flush + + var _arg0 *C.GDBusInterfaceSkeleton // out + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + C._gotk4_gio2_DBusInterfaceSkeleton_virtual_flush(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(interface_) +} + +// gAuthorizeMethod: signal class handler for the +// BusInterfaceSkeleton::g-authorize-method signal. +func (interface_ *DBusInterfaceSkeleton) gAuthorizeMethod(invocation *DBusMethodInvocation) bool { + gclass := (*C.GDBusInterfaceSkeletonClass)(coreglib.PeekParentClass(interface_)) + fnarg := gclass.g_authorize_method + + var _arg0 *C.GDBusInterfaceSkeleton // out + var _arg1 *C.GDBusMethodInvocation // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + _arg1 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C._gotk4_gio2_DBusInterfaceSkeleton_virtual_g_authorize_method(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(interface_) + runtime.KeepAlive(invocation) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Info gets D-Bus introspection information for the D-Bus interface implemented +// by interface_. +// +// The function returns the following values: +// +// - dBusInterfaceInfo (never NULL). Do not free. +func (interface_ *DBusInterfaceSkeleton) info() *DBusInterfaceInfo { + gclass := (*C.GDBusInterfaceSkeletonClass)(coreglib.PeekParentClass(interface_)) + fnarg := gclass.get_info + + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret *C.GDBusInterfaceInfo // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C._gotk4_gio2_DBusInterfaceSkeleton_virtual_get_info(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(interface_) + + var _dBusInterfaceInfo *DBusInterfaceInfo // out + + _dBusInterfaceInfo = (*DBusInterfaceInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_interface_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusInterfaceInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_interface_info_unref((*C.GDBusInterfaceInfo)(intern.C)) + }, + ) + + return _dBusInterfaceInfo +} + +// Properties gets all D-Bus properties for interface_. +// +// The function returns the following values: +// +// - variant of type ['a{sv}'][G-VARIANT-TYPE-VARDICT:CAPS]. Free with +// g_variant_unref(). +func (interface_ *DBusInterfaceSkeleton) properties() *glib.Variant { + gclass := (*C.GDBusInterfaceSkeletonClass)(coreglib.PeekParentClass(interface_)) + fnarg := gclass.get_properties + + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret *C.GVariant // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C._gotk4_gio2_DBusInterfaceSkeleton_virtual_get_properties(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(interface_) + + var _variant *glib.Variant // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// Vtable gets the interface vtable for the D-Bus interface implemented by +// interface_. The returned function pointers should expect interface_ itself to +// be passed as user_data. +// +// The function returns the following values: +// +// - dBusInterfaceVTable: vtable of the D-Bus interface implemented by the +// skeleton. +func (interface_ *DBusInterfaceSkeleton) vtable() *DBusInterfaceVTable { + gclass := (*C.GDBusInterfaceSkeletonClass)(coreglib.PeekParentClass(interface_)) + fnarg := gclass.get_vtable + + var _arg0 *C.GDBusInterfaceSkeleton // out + var _cret *C.GDBusInterfaceVTable // in + + _arg0 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + _cret = C._gotk4_gio2_DBusInterfaceSkeleton_virtual_get_vtable(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(interface_) + + var _dBusInterfaceVTable *DBusInterfaceVTable // out + + _dBusInterfaceVTable = (*DBusInterfaceVTable)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _dBusInterfaceVTable +} + +// DBusMenuModel: GDBusMenuModel is an implementation of gio.MenuModel that +// can be used as a proxy for a menu model that is exported over D-Bus with +// gio.DBusConnection.ExportMenuModel(). +type DBusMenuModel struct { + _ [0]func() // equal guard + MenuModel +} + +var ( + _ MenuModeller = (*DBusMenuModel)(nil) +) + +func wrapDBusMenuModel(obj *coreglib.Object) *DBusMenuModel { + return &DBusMenuModel{ + MenuModel: MenuModel{ + Object: obj, + }, + } +} + +func marshalDBusMenuModel(p uintptr) (interface{}, error) { + return wrapDBusMenuModel(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// DBusMenuModelGet obtains a BusMenuModel for the menu model which is exported +// at the given bus_name and object_path. +// +// The thread default main context is taken at the time of this call. All +// signals on the menu model (and any linked models) are reported with respect +// to this context. All calls on the returned menu model (and linked models) +// must also originate from this same context, with the thread default main +// context unchanged. +// +// The function takes the following parameters: +// +// - connection: BusConnection. +// - busName (optional) bus name which exports the menu model or NULL if +// connection is not a message bus connection. +// - objectPath: object path at which the menu model is exported. +// +// The function returns the following values: +// +// - dBusMenuModel object. Free with g_object_unref(). +func DBusMenuModelGet(connection *DBusConnection, busName, objectPath string) *DBusMenuModel { + var _arg1 *C.GDBusConnection // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret *C.GDBusMenuModel // in + + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + if busName != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(busName))) + defer C.free(unsafe.Pointer(_arg2)) + } + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.g_dbus_menu_model_get(_arg1, _arg2, _arg3) + runtime.KeepAlive(connection) + runtime.KeepAlive(busName) + runtime.KeepAlive(objectPath) + + var _dBusMenuModel *DBusMenuModel // out + + _dBusMenuModel = wrapDBusMenuModel(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusMenuModel +} + +// DBusMessage: type for representing D-Bus messages that can be sent or +// received on a gio.DBusConnection. +type DBusMessage struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DBusMessage)(nil) +) + +func wrapDBusMessage(obj *coreglib.Object) *DBusMessage { + return &DBusMessage{ + Object: obj, + } +} + +func marshalDBusMessage(p uintptr) (interface{}, error) { + return wrapDBusMessage(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewDBusMessage creates a new empty BusMessage. +// +// The function returns the following values: +// +// - dBusMessage Free with g_object_unref(). +func NewDBusMessage() *DBusMessage { + var _cret *C.GDBusMessage // in + + _cret = C.g_dbus_message_new() + + var _dBusMessage *DBusMessage // out + + _dBusMessage = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusMessage +} + +// NewDBusMessageFromBlob creates a new BusMessage from the data stored +// at blob. The byte order that the message was in can be retrieved using +// g_dbus_message_get_byte_order(). +// +// If the blob cannot be parsed, contains invalid fields, or contains invalid +// headers, G_IO_ERROR_INVALID_ARGUMENT will be returned. +// +// The function takes the following parameters: +// +// - blob representing a binary D-Bus message. +// - capabilities describing what protocol features are supported. +// +// The function returns the following values: +// +// - dBusMessage: new BusMessage or NULL if error is set. Free with +// g_object_unref(). +func NewDBusMessageFromBlob(blob []byte, capabilities DBusCapabilityFlags) (*DBusMessage, error) { + var _arg1 *C.guchar // out + var _arg2 C.gsize + var _arg3 C.GDBusCapabilityFlags // out + var _cret *C.GDBusMessage // in + var _cerr *C.GError // in + + _arg2 = (C.gsize)(len(blob)) + if len(blob) > 0 { + _arg1 = (*C.guchar)(unsafe.Pointer(&blob[0])) + } + _arg3 = C.GDBusCapabilityFlags(capabilities) + + _cret = C.g_dbus_message_new_from_blob(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(blob) + runtime.KeepAlive(capabilities) + + var _dBusMessage *DBusMessage // out + var _goerr error // out + + _dBusMessage = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusMessage, _goerr +} + +// NewDBusMessageMethodCall creates a new BusMessage for a method call. +// +// The function takes the following parameters: +// +// - name (optional): valid D-Bus name or NULL. +// - path: valid object path. +// - interface_ (optional): valid D-Bus interface name or NULL. +// - method: valid method name. +// +// The function returns the following values: +// +// - dBusMessage Free with g_object_unref(). +func NewDBusMessageMethodCall(name, path, interface_, method string) *DBusMessage { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _cret *C.GDBusMessage // in + + if name != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg2)) + if interface_ != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(interface_))) + defer C.free(unsafe.Pointer(_arg3)) + } + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(method))) + defer C.free(unsafe.Pointer(_arg4)) + + _cret = C.g_dbus_message_new_method_call(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(name) + runtime.KeepAlive(path) + runtime.KeepAlive(interface_) + runtime.KeepAlive(method) + + var _dBusMessage *DBusMessage // out + + _dBusMessage = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusMessage +} + +// NewDBusMessageSignal creates a new BusMessage for a signal emission. +// +// The function takes the following parameters: +// +// - path: valid object path. +// - interface_: valid D-Bus interface name. +// - signal: valid signal name. +// +// The function returns the following values: +// +// - dBusMessage Free with g_object_unref(). +func NewDBusMessageSignal(path, interface_, signal string) *DBusMessage { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret *C.GDBusMessage // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(interface_))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(signal))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.g_dbus_message_new_signal(_arg1, _arg2, _arg3) + runtime.KeepAlive(path) + runtime.KeepAlive(interface_) + runtime.KeepAlive(signal) + + var _dBusMessage *DBusMessage // out + + _dBusMessage = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusMessage +} + +// Copy copies message. The copy is a deep copy and the returned BusMessage is +// completely identical except that it is guaranteed to not be locked. +// +// This operation can fail if e.g. message contains file descriptors and the +// per-process or system-wide open files limit is reached. +// +// The function returns the following values: +// +// - dBusMessage: new BusMessage or NULL if error is set. Free with +// g_object_unref(). +func (message *DBusMessage) Copy() (*DBusMessage, error) { + var _arg0 *C.GDBusMessage // out + var _cret *C.GDBusMessage // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_copy(_arg0, &_cerr) + runtime.KeepAlive(message) + + var _dBusMessage *DBusMessage // out + var _goerr error // out + + _dBusMessage = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusMessage, _goerr +} + +// Arg0: convenience to get the first item in the body of message. +// +// See gio.DBusMessage.GetArg0Path() for returning object-path-typed arg0 +// values. +// +// The function returns the following values: +// +// - utf8 (optional): string item or NULL if the first item in the body of +// message is not a string. +func (message *DBusMessage) Arg0() string { + var _arg0 *C.GDBusMessage // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_arg0(_arg0) + runtime.KeepAlive(message) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Arg0Path: convenience to get the first item in the body of message. +// +// See gio.DBusMessage.GetArg0() for returning string-typed arg0 values. +// +// The function returns the following values: +// +// - utf8 (optional): object path item or NULL if the first item in the body +// of message is not an object path. +func (message *DBusMessage) Arg0Path() string { + var _arg0 *C.GDBusMessage // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_arg0_path(_arg0) + runtime.KeepAlive(message) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Body gets the body of a message. +// +// The function returns the following values: +// +// - variant (optional) or NULL if the body is empty. Do not free, it is owned +// by message. +func (message *DBusMessage) Body() *glib.Variant { + var _arg0 *C.GDBusMessage // out + var _cret *C.GVariant // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_body(_arg0) + runtime.KeepAlive(message) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// ByteOrder gets the byte order of message. +// +// The function returns the following values: +// +// - dBusMessageByteOrder: byte order. +func (message *DBusMessage) ByteOrder() DBusMessageByteOrder { + var _arg0 *C.GDBusMessage // out + var _cret C.GDBusMessageByteOrder // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_byte_order(_arg0) + runtime.KeepAlive(message) + + var _dBusMessageByteOrder DBusMessageByteOrder // out + + _dBusMessageByteOrder = DBusMessageByteOrder(_cret) + + return _dBusMessageByteOrder +} + +// Destination: convenience getter for the +// G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field. +// +// The function returns the following values: +// +// - utf8 (optional): value. +func (message *DBusMessage) Destination() string { + var _arg0 *C.GDBusMessage // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_destination(_arg0) + runtime.KeepAlive(message) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ErrorName: convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME +// header field. +// +// The function returns the following values: +// +// - utf8 (optional): value. +func (message *DBusMessage) ErrorName() string { + var _arg0 *C.GDBusMessage // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_error_name(_arg0) + runtime.KeepAlive(message) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Flags gets the flags for message. +// +// The function returns the following values: +// +// - dBusMessageFlags flags that are set (typically values from the +// BusMessageFlags enumeration bitwise ORed together). +func (message *DBusMessage) Flags() DBusMessageFlags { + var _arg0 *C.GDBusMessage // out + var _cret C.GDBusMessageFlags // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_flags(_arg0) + runtime.KeepAlive(message) + + var _dBusMessageFlags DBusMessageFlags // out + + _dBusMessageFlags = DBusMessageFlags(_cret) + + return _dBusMessageFlags +} + +// Header gets a header field on message. +// +// The caller is responsible for checking the type of the returned #GVariant +// matches what is expected. +// +// The function takes the following parameters: +// +// - headerField: 8-bit unsigned integer (typically a value from the +// BusMessageHeaderField enumeration). +// +// The function returns the following values: +// +// - variant (optional) with the value if the header was found, NULL +// otherwise. Do not free, it is owned by message. +func (message *DBusMessage) Header(headerField DBusMessageHeaderField) *glib.Variant { + var _arg0 *C.GDBusMessage // out + var _arg1 C.GDBusMessageHeaderField // out + var _cret *C.GVariant // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = C.GDBusMessageHeaderField(headerField) + + _cret = C.g_dbus_message_get_header(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(headerField) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// HeaderFields gets an array of all header fields on message that are set. +// +// The function returns the following values: +// +// - guint8s: array of header fields terminated by +// G_DBUS_MESSAGE_HEADER_FIELD_INVALID. Each element is a #guchar. Free with +// g_free(). +func (message *DBusMessage) HeaderFields() []byte { + var _arg0 *C.GDBusMessage // out + var _cret *C.guchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_header_fields(_arg0) + runtime.KeepAlive(message) + + var _guint8s []byte // out + + { + var i int + var z C.guchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _guint8s = make([]byte, i) + for i := range src { + _guint8s[i] = byte(src[i]) + } + } + + return _guint8s +} + +// Interface: convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE +// header field. +// +// The function returns the following values: +// +// - utf8 (optional): value. +func (message *DBusMessage) Interface() string { + var _arg0 *C.GDBusMessage // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_interface(_arg0) + runtime.KeepAlive(message) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Locked checks whether message is locked. To monitor changes to this value, +// conncet to the #GObject::notify signal to listen for changes on the +// BusMessage:locked property. +// +// The function returns the following values: +// +// - ok: TRUE if message is locked, FALSE otherwise. +func (message *DBusMessage) Locked() bool { + var _arg0 *C.GDBusMessage // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_locked(_arg0) + runtime.KeepAlive(message) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Member: convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_MEMBER header +// field. +// +// The function returns the following values: +// +// - utf8 (optional): value. +func (message *DBusMessage) Member() string { + var _arg0 *C.GDBusMessage // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_member(_arg0) + runtime.KeepAlive(message) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// MessageType gets the type of message. +// +// The function returns the following values: +// +// - dBusMessageType: 8-bit unsigned integer (typically a value from the +// BusMessageType enumeration). +func (message *DBusMessage) MessageType() DBusMessageType { + var _arg0 *C.GDBusMessage // out + var _cret C.GDBusMessageType // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_message_type(_arg0) + runtime.KeepAlive(message) + + var _dBusMessageType DBusMessageType // out + + _dBusMessageType = DBusMessageType(_cret) + + return _dBusMessageType +} + +// Path: convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_PATH header +// field. +// +// The function returns the following values: +// +// - utf8 (optional): value. +func (message *DBusMessage) Path() string { + var _arg0 *C.GDBusMessage // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_path(_arg0) + runtime.KeepAlive(message) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ReplySerial: convenience getter for the +// G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field. +// +// The function returns the following values: +// +// - guint32: value. +func (message *DBusMessage) ReplySerial() uint32 { + var _arg0 *C.GDBusMessage // out + var _cret C.guint32 // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_reply_serial(_arg0) + runtime.KeepAlive(message) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// Sender: convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_SENDER header +// field. +// +// The function returns the following values: +// +// - utf8 (optional): value. +func (message *DBusMessage) Sender() string { + var _arg0 *C.GDBusMessage // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_sender(_arg0) + runtime.KeepAlive(message) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Serial gets the serial for message. +// +// The function returns the following values: +// +// - guint32: #guint32. +func (message *DBusMessage) Serial() uint32 { + var _arg0 *C.GDBusMessage // out + var _cret C.guint32 // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_serial(_arg0) + runtime.KeepAlive(message) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// Signature: convenience getter for the G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE +// header field. +// +// This will always be non-NULL, but may be an empty string. +// +// The function returns the following values: +// +// - utf8: value. +func (message *DBusMessage) Signature() string { + var _arg0 *C.GDBusMessage // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_dbus_message_get_signature(_arg0) + runtime.KeepAlive(message) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Lock: if message is locked, does nothing. Otherwise locks the message. +func (message *DBusMessage) Lock() { + var _arg0 *C.GDBusMessage // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + C.g_dbus_message_lock(_arg0) + runtime.KeepAlive(message) +} + +// NewMethodErrorLiteral creates a new BusMessage that is an error reply to +// method_call_message. +// +// The function takes the following parameters: +// +// - errorName: valid D-Bus error name. +// - errorMessage d-Bus error message. +// +// The function returns the following values: +// +// - dBusMessage Free with g_object_unref(). +func (methodCallMessage *DBusMessage) NewMethodErrorLiteral(errorName, errorMessage string) *DBusMessage { + var _arg0 *C.GDBusMessage // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GDBusMessage // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(methodCallMessage).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(errorName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(errorMessage))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_dbus_message_new_method_error_literal(_arg0, _arg1, _arg2) + runtime.KeepAlive(methodCallMessage) + runtime.KeepAlive(errorName) + runtime.KeepAlive(errorMessage) + + var _dBusMessage *DBusMessage // out + + _dBusMessage = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusMessage +} + +// NewMethodReply creates a new BusMessage that is a reply to +// method_call_message. +// +// The function returns the following values: +// +// - dBusMessage Free with g_object_unref(). +func (methodCallMessage *DBusMessage) NewMethodReply() *DBusMessage { + var _arg0 *C.GDBusMessage // out + var _cret *C.GDBusMessage // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(methodCallMessage).Native())) + + _cret = C.g_dbus_message_new_method_reply(_arg0) + runtime.KeepAlive(methodCallMessage) + + var _dBusMessage *DBusMessage // out + + _dBusMessage = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusMessage +} + +// Print produces a human-readable multi-line description of message. +// +// The contents of the description has no ABI guarantees, the contents and +// formatting is subject to change at any time. Typical output looks something +// like this: +// +// Flags: none +// Version: 0 +// Serial: 4 +// Headers: +// path -> objectpath '/org/gtk/GDBus/TestObject' +// interface -> 'org.gtk.GDBus.TestInterface' +// member -> 'GimmeStdout' +// destination -> ':1.146' +// Body: () +// UNIX File Descriptors: +// (none) +// +// or +// +// Flags: no-reply-expected +// Version: 0 +// Serial: 477 +// Headers: +// reply-serial -> uint32 4 +// destination -> ':1.159' +// sender -> ':1.146' +// num-unix-fds -> uint32 1 +// Body: () +// UNIX File Descriptors: +// fd 12: dev=0:10,mode=020620,ino=5,uid=500,gid=5,rdev=136:2,size=0,atime=1273085037,mtime=1273085851,ctime=1272982635. +// +// The function takes the following parameters: +// +// - indent: indentation level. +// +// The function returns the following values: +// +// - utf8: string that should be freed with glib.Free(). +func (message *DBusMessage) Print(indent uint) string { + var _arg0 *C.GDBusMessage // out + var _arg1 C.guint // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = C.guint(indent) + + _cret = C.g_dbus_message_print(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(indent) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// SetBody sets the body message. As a side-effect the +// G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field is set to the type string +// of body (or cleared if body is NULL). +// +// If body is floating, message assumes ownership of body. +// +// The function takes the following parameters: +// +// - body: either NULL or a #GVariant that is a tuple. +func (message *DBusMessage) SetBody(body *glib.Variant) { + var _arg0 *C.GDBusMessage // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(body))) + + C.g_dbus_message_set_body(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(body) +} + +// SetByteOrder sets the byte order of message. +// +// The function takes the following parameters: +// +// - byteOrder: byte order. +func (message *DBusMessage) SetByteOrder(byteOrder DBusMessageByteOrder) { + var _arg0 *C.GDBusMessage // out + var _arg1 C.GDBusMessageByteOrder // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = C.GDBusMessageByteOrder(byteOrder) + + C.g_dbus_message_set_byte_order(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(byteOrder) +} + +// SetDestination: convenience setter for the +// G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION header field. +// +// The function takes the following parameters: +// +// - value (optional) to set. +func (message *DBusMessage) SetDestination(value string) { + var _arg0 *C.GDBusMessage // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + if value != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_dbus_message_set_destination(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(value) +} + +// SetErrorName: convenience setter for the +// G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field. +// +// The function takes the following parameters: +// +// - value to set. +func (message *DBusMessage) SetErrorName(value string) { + var _arg0 *C.GDBusMessage // out + var _arg1 *C.gchar // out + + if message != nil { + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_dbus_message_set_error_name(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(value) +} + +// SetFlags sets the flags to set on message. +// +// The function takes the following parameters: +// +// - flags flags for message that are set (typically values from the +// BusMessageFlags enumeration bitwise ORed together). +func (message *DBusMessage) SetFlags(flags DBusMessageFlags) { + var _arg0 *C.GDBusMessage // out + var _arg1 C.GDBusMessageFlags // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = C.GDBusMessageFlags(flags) + + C.g_dbus_message_set_flags(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(flags) +} + +// SetHeader sets a header field on message. +// +// If value is floating, message assumes ownership of value. +// +// The function takes the following parameters: +// +// - headerField: 8-bit unsigned integer (typically a value from the +// BusMessageHeaderField enumeration). +// - value (optional) to set the header field or NULL to clear the header +// field. +func (message *DBusMessage) SetHeader(headerField DBusMessageHeaderField, value *glib.Variant) { + var _arg0 *C.GDBusMessage // out + var _arg1 C.GDBusMessageHeaderField // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = C.GDBusMessageHeaderField(headerField) + if value != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + } + + C.g_dbus_message_set_header(_arg0, _arg1, _arg2) + runtime.KeepAlive(message) + runtime.KeepAlive(headerField) + runtime.KeepAlive(value) +} + +// SetInterface: convenience setter for the +// G_DBUS_MESSAGE_HEADER_FIELD_INTERFACE header field. +// +// The function takes the following parameters: +// +// - value (optional) to set. +func (message *DBusMessage) SetInterface(value string) { + var _arg0 *C.GDBusMessage // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + if value != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_dbus_message_set_interface(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(value) +} + +// SetMember: convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_MEMBER +// header field. +// +// The function takes the following parameters: +// +// - value (optional) to set. +func (message *DBusMessage) SetMember(value string) { + var _arg0 *C.GDBusMessage // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + if value != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_dbus_message_set_member(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(value) +} + +// SetMessageType sets message to be of type. +// +// The function takes the following parameters: +// +// - typ: 8-bit unsigned integer (typically a value from the BusMessageType +// enumeration). +func (message *DBusMessage) SetMessageType(typ DBusMessageType) { + var _arg0 *C.GDBusMessage // out + var _arg1 C.GDBusMessageType // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = C.GDBusMessageType(typ) + + C.g_dbus_message_set_message_type(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(typ) +} + +// SetPath: convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_PATH header +// field. +// +// The function takes the following parameters: +// +// - value (optional) to set. +func (message *DBusMessage) SetPath(value string) { + var _arg0 *C.GDBusMessage // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + if value != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_dbus_message_set_path(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(value) +} + +// SetReplySerial: convenience setter for the +// G_DBUS_MESSAGE_HEADER_FIELD_REPLY_SERIAL header field. +// +// The function takes the following parameters: +// +// - value to set. +func (message *DBusMessage) SetReplySerial(value uint32) { + var _arg0 *C.GDBusMessage // out + var _arg1 C.guint32 // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = C.guint32(value) + + C.g_dbus_message_set_reply_serial(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(value) +} + +// SetSender: convenience setter for the G_DBUS_MESSAGE_HEADER_FIELD_SENDER +// header field. +// +// The function takes the following parameters: +// +// - value (optional) to set. +func (message *DBusMessage) SetSender(value string) { + var _arg0 *C.GDBusMessage // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + if value != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_dbus_message_set_sender(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(value) +} + +// SetSerial sets the serial for message. +// +// The function takes the following parameters: +// +// - serial: #guint32. +func (message *DBusMessage) SetSerial(serial uint32) { + var _arg0 *C.GDBusMessage // out + var _arg1 C.guint32 // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = C.guint32(serial) + + C.g_dbus_message_set_serial(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(serial) +} + +// SetSignature: convenience setter for the +// G_DBUS_MESSAGE_HEADER_FIELD_SIGNATURE header field. +// +// The function takes the following parameters: +// +// - value (optional) to set. +func (message *DBusMessage) SetSignature(value string) { + var _arg0 *C.GDBusMessage // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + if value != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_dbus_message_set_signature(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(value) +} + +// ToBlob serializes message to a blob. The byte order returned by +// g_dbus_message_get_byte_order() will be used. +// +// The function takes the following parameters: +// +// - capabilities describing what protocol features are supported. +// +// The function returns the following values: +// +// - guint8s: pointer to a valid binary D-Bus message of out_size bytes +// generated by message or NULL if error is set. Free with g_free(). +func (message *DBusMessage) ToBlob(capabilities DBusCapabilityFlags) ([]byte, error) { + var _arg0 *C.GDBusMessage // out + var _arg2 C.GDBusCapabilityFlags // out + var _cret *C.guchar // in + var _arg1 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg2 = C.GDBusCapabilityFlags(capabilities) + + _cret = C.g_dbus_message_to_blob(_arg0, &_arg1, _arg2, &_cerr) + runtime.KeepAlive(message) + runtime.KeepAlive(capabilities) + + var _guint8s []byte // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint8s, _goerr +} + +// ToGError: if message is not of type G_DBUS_MESSAGE_TYPE_ERROR does nothing +// and returns FALSE. +// +// Otherwise this method encodes the error in message as a #GError +// using g_dbus_error_set_dbus_error() using the information in the +// G_DBUS_MESSAGE_HEADER_FIELD_ERROR_NAME header field of message as well as the +// first string item in message's body. +func (message *DBusMessage) ToGError() error { + var _arg0 *C.GDBusMessage // out + var _cerr *C.GError // in + + _arg0 = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + C.g_dbus_message_to_gerror(_arg0, &_cerr) + runtime.KeepAlive(message) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// DBusMessageBytesNeeded: utility function to calculate how many bytes are +// needed to completely deserialize the D-Bus message stored at blob. +// +// The function takes the following parameters: +// +// - blob representing a binary D-Bus message. +// +// The function returns the following values: +// +// - gssize: number of bytes needed or -1 if error is set (e.g. if blob +// contains invalid data or not enough data is available to determine the +// size). +func DBusMessageBytesNeeded(blob []byte) (int, error) { + var _arg1 *C.guchar // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg2 = (C.gsize)(len(blob)) + if len(blob) > 0 { + _arg1 = (*C.guchar)(unsafe.Pointer(&blob[0])) + } + + _cret = C.g_dbus_message_bytes_needed(_arg1, _arg2, &_cerr) + runtime.KeepAlive(blob) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// DBusMethodInvocation instances of the GDBusMethodInvocation class are used +// when handling D-Bus method calls. It provides a way to asynchronously return +// results and errors. +// +// The normal way to obtain a GDBusMethodInvocation object is to receive it as +// an argument to the handle_method_call() function in a gio.DBusInterfaceVTable +// that was passed to gio.DBusConnection.RegisterObject(). +type DBusMethodInvocation struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*DBusMethodInvocation)(nil) +) + +func wrapDBusMethodInvocation(obj *coreglib.Object) *DBusMethodInvocation { + return &DBusMethodInvocation{ + Object: obj, + } +} + +func marshalDBusMethodInvocation(p uintptr) (interface{}, error) { + return wrapDBusMethodInvocation(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Connection gets the BusConnection the method was invoked on. +// +// The function returns the following values: +// +// - dBusConnection Do not free, it is owned by invocation. +func (invocation *DBusMethodInvocation) Connection() *DBusConnection { + var _arg0 *C.GDBusMethodInvocation // out + var _cret *C.GDBusConnection // in + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C.g_dbus_method_invocation_get_connection(_arg0) + runtime.KeepAlive(invocation) + + var _dBusConnection *DBusConnection // out + + _dBusConnection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(_cret))) + + return _dBusConnection +} + +// InterfaceName gets the name of the D-Bus interface the method was invoked on. +// +// If this method call is a property Get, Set or GetAll call that has been +// redirected to the method call handler then "org.freedesktop.DBus.Properties" +// will be returned. See BusInterfaceVTable for more information. +// +// The function returns the following values: +// +// - utf8: string. Do not free, it is owned by invocation. +func (invocation *DBusMethodInvocation) InterfaceName() string { + var _arg0 *C.GDBusMethodInvocation // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C.g_dbus_method_invocation_get_interface_name(_arg0) + runtime.KeepAlive(invocation) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Message gets the BusMessage for the method invocation. This is useful if +// you need to use low-level protocol features, such as UNIX file descriptor +// passing, that cannot be properly expressed in the #GVariant API. +// +// See this [server][gdbus-server] and [client][gdbus-unix-fd-client] for +// an example of how to use this low-level API to send and receive UNIX file +// descriptors. +// +// The function returns the following values: +// +// - dBusMessage Do not free, it is owned by invocation. +func (invocation *DBusMethodInvocation) Message() *DBusMessage { + var _arg0 *C.GDBusMethodInvocation // out + var _cret *C.GDBusMessage // in + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C.g_dbus_method_invocation_get_message(_arg0) + runtime.KeepAlive(invocation) + + var _dBusMessage *DBusMessage // out + + _dBusMessage = wrapDBusMessage(coreglib.Take(unsafe.Pointer(_cret))) + + return _dBusMessage +} + +// MethodInfo gets information about the method call, if any. +// +// If this method invocation is a property Get, Set or GetAll call that has +// been redirected to the method call handler then NULL will be returned. +// See g_dbus_method_invocation_get_property_info() and BusInterfaceVTable for +// more information. +// +// The function returns the following values: +// +// - dBusMethodInfo (optional) or NULL. Do not free, it is owned by +// invocation. +func (invocation *DBusMethodInvocation) MethodInfo() *DBusMethodInfo { + var _arg0 *C.GDBusMethodInvocation // out + var _cret *C.GDBusMethodInfo // in + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C.g_dbus_method_invocation_get_method_info(_arg0) + runtime.KeepAlive(invocation) + + var _dBusMethodInfo *DBusMethodInfo // out + + if _cret != nil { + _dBusMethodInfo = (*DBusMethodInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_method_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusMethodInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_method_info_unref((*C.GDBusMethodInfo)(intern.C)) + }, + ) + } + + return _dBusMethodInfo +} + +// MethodName gets the name of the method that was invoked. +// +// The function returns the following values: +// +// - utf8: string. Do not free, it is owned by invocation. +func (invocation *DBusMethodInvocation) MethodName() string { + var _arg0 *C.GDBusMethodInvocation // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C.g_dbus_method_invocation_get_method_name(_arg0) + runtime.KeepAlive(invocation) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// ObjectPath gets the object path the method was invoked on. +// +// The function returns the following values: +// +// - utf8: string. Do not free, it is owned by invocation. +func (invocation *DBusMethodInvocation) ObjectPath() string { + var _arg0 *C.GDBusMethodInvocation // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C.g_dbus_method_invocation_get_object_path(_arg0) + runtime.KeepAlive(invocation) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Parameters gets the parameters of the method invocation. If there are no +// input parameters then this will return a GVariant with 0 children rather than +// NULL. +// +// The function returns the following values: +// +// - variant tuple. Do not unref this because it is owned by invocation. +func (invocation *DBusMethodInvocation) Parameters() *glib.Variant { + var _arg0 *C.GDBusMethodInvocation // out + var _cret *C.GVariant // in + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C.g_dbus_method_invocation_get_parameters(_arg0) + runtime.KeepAlive(invocation) + + var _variant *glib.Variant // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// PropertyInfo gets information about the property that this method call is +// for, if any. +// +// This will only be set in the case of an invocation in response to a property +// Get or Set call that has been directed to the method call handler for an +// object on account of its property_get() or property_set() vtable pointers +// being unset. +// +// See BusInterfaceVTable for more information. +// +// If the call was GetAll, NULL will be returned. +// +// The function returns the following values: +// +// - dBusPropertyInfo (optional) or NULL. +func (invocation *DBusMethodInvocation) PropertyInfo() *DBusPropertyInfo { + var _arg0 *C.GDBusMethodInvocation // out + var _cret *C.GDBusPropertyInfo // in + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C.g_dbus_method_invocation_get_property_info(_arg0) + runtime.KeepAlive(invocation) + + var _dBusPropertyInfo *DBusPropertyInfo // out + + if _cret != nil { + _dBusPropertyInfo = (*DBusPropertyInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_property_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusPropertyInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_property_info_unref((*C.GDBusPropertyInfo)(intern.C)) + }, + ) + } + + return _dBusPropertyInfo +} + +// Sender gets the bus name that invoked the method. +// +// The function returns the following values: +// +// - utf8: string. Do not free, it is owned by invocation. +func (invocation *DBusMethodInvocation) Sender() string { + var _arg0 *C.GDBusMethodInvocation // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C.g_dbus_method_invocation_get_sender(_arg0) + runtime.KeepAlive(invocation) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// ReturnDBusError finishes handling a D-Bus method call by returning an error. +// +// This method will take ownership of invocation. See BusInterfaceVTable for +// more information about the ownership of invocation. +// +// The function takes the following parameters: +// +// - errorName: valid D-Bus error name. +// - errorMessage: valid D-Bus error message. +func (invocation *DBusMethodInvocation) ReturnDBusError(errorName, errorMessage string) { + var _arg0 *C.GDBusMethodInvocation // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(invocation).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(errorName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(errorMessage))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_dbus_method_invocation_return_dbus_error(_arg0, _arg1, _arg2) + runtime.KeepAlive(invocation) + runtime.KeepAlive(errorName) + runtime.KeepAlive(errorMessage) +} + +// ReturnErrorLiteral: like g_dbus_method_invocation_return_error() but without +// printf()-style formatting. +// +// This method will take ownership of invocation. See BusInterfaceVTable for +// more information about the ownership of invocation. +// +// The function takes the following parameters: +// +// - domain for the #GError error domain. +// - code: error code. +// - message: error message. +func (invocation *DBusMethodInvocation) ReturnErrorLiteral(domain glib.Quark, code int, message string) { + var _arg0 *C.GDBusMethodInvocation // out + var _arg1 C.GQuark // out + var _arg2 C.gint // out + var _arg3 *C.gchar // out + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(invocation).Native())) + _arg1 = C.GQuark(domain) + _arg2 = C.gint(code) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg3)) + + C.g_dbus_method_invocation_return_error_literal(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(invocation) + runtime.KeepAlive(domain) + runtime.KeepAlive(code) + runtime.KeepAlive(message) +} + +// ReturnGError: like g_dbus_method_invocation_return_error() but takes a +// #GError instead of the error domain, error code and message. +// +// This method will take ownership of invocation. See BusInterfaceVTable for +// more information about the ownership of invocation. +// +// The function takes the following parameters: +// +// - err: #GError. +func (invocation *DBusMethodInvocation) ReturnGError(err error) { + var _arg0 *C.GDBusMethodInvocation // out + var _arg1 *C.GError // out + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(invocation).Native())) + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + + C.g_dbus_method_invocation_return_gerror(_arg0, _arg1) + runtime.KeepAlive(invocation) + runtime.KeepAlive(err) +} + +// ReturnValue finishes handling a D-Bus method call by returning parameters. +// If the parameters GVariant is floating, it is consumed. +// +// It is an error if parameters is not of the right format: it must be a tuple +// containing the out-parameters of the D-Bus method. Even if the method has a +// single out-parameter, it must be contained in a tuple. If the method has no +// out-parameters, parameters may be NULL or an empty tuple. +// +// GDBusMethodInvocation *invocation = some_invocation; +// g_autofree gchar *result_string = NULL; +// g_autoptr (GError) error = NULL; +// +// result_string = calculate_result (&error); +// +// if (error != NULL) +// g_dbus_method_invocation_return_gerror (invocation, error); +// else +// g_dbus_method_invocation_return_value (invocation, +// g_variant_new ("(s)", result_string)); +// +// // Do not free invocation here; returning a value does that +// +// This method will take ownership of invocation. See BusInterfaceVTable for +// more information about the ownership of invocation. +// +// Since 2.48, if the method call requested for a reply not to be sent then this +// call will sink parameters and free invocation, but otherwise do nothing (as +// per the recommendations of the D-Bus specification). +// +// The function takes the following parameters: +// +// - parameters (optional) tuple with out parameters for the method or NULL if +// not passing any parameters. +func (invocation *DBusMethodInvocation) ReturnValue(parameters *glib.Variant) { + var _arg0 *C.GDBusMethodInvocation // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(invocation).Native())) + if parameters != nil { + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameters))) + } + + C.g_dbus_method_invocation_return_value(_arg0, _arg1) + runtime.KeepAlive(invocation) + runtime.KeepAlive(parameters) +} + +// DBusObjectManagerClientOverrides contains methods that are overridable. +type DBusObjectManagerClientOverrides struct { + // InterfaceProxySignal: signal class handler for the + // BusObjectManagerClient::interface-proxy-signal signal. + // + // The function takes the following parameters: + // + // - objectProxy + // - interfaceProxy + // - senderName + // - signalName + // - parameters + InterfaceProxySignal func(objectProxy *DBusObjectProxy, interfaceProxy *DBusProxy, senderName, signalName string, parameters *glib.Variant) +} + +func defaultDBusObjectManagerClientOverrides(v *DBusObjectManagerClient) DBusObjectManagerClientOverrides { + return DBusObjectManagerClientOverrides{ + InterfaceProxySignal: v.interfaceProxySignal, + } +} + +// DBusObjectManagerClient: GDBusObjectManagerClient is used +// to create, monitor and delete object proxies for remote +// objects exported by a gio.DBusObjectManagerServer (or any +// code implementing the org.freedesktop.DBus.ObjectManager +// (http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager) +// interface). +// +// Once an instance of this type has been created, you can connect to the +// gio.DBusObjectManager::object-added and gio.DBusObjectManager::object-removed +// signals and inspect the gio.DBusObjectProxy objects returned by +// gio.DBusObjectManager.GetObjects(). +// +// If the name for a GDBusObjectManagerClient is not owned by anyone at +// object construction time, the default behavior is to request the message +// bus to launch an owner for the name. This behavior can be disabled using +// the G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START flag. It’s also +// worth noting that this only works if the name of interest is activatable +// in the first place. E.g. in some cases it is not possible to launch an +// owner for the requested name. In this case, GDBusObjectManagerClient object +// construction still succeeds but there will be no object proxies (e.g. +// gio.DBusObjectManager.GetObjects() returns the empty list) and the +// gio.DBusObjectManagerClient:name-owner property is NULL. +// +// The owner of the requested name can come and go (for example consider a +// system service being restarted) – GDBusObjectManagerClient handles this +// case too; simply connect to the gobject.Object::notify signal to watch for +// changes on the gio.DBusObjectManagerClient:name-owner property. When the name +// owner vanishes, the behavior is that gio.DBusObjectManagerClient:name-owner +// is set to NULL (this includes emission of the gobject.Object::notify +// signal) and then gio.DBusObjectManager::object-removed signals +// are synthesized for all currently existing object proxies. Since +// gio.DBusObjectManagerClient:name-owner is NULL when this happens, +// you can use this information to disambiguate a synthesized signal from a +// genuine signal caused by object removal on the remote gio.DBusObjectManager. +// Similarly, when a new name owner appears, gio.DBusObjectManager::object-added +// signals are synthesized while gio.DBusObjectManagerClient:name-owner +// is still NULL. Only when all object proxies have been added, the +// gio.DBusObjectManagerClient:name-owner is set to the new name owner (this +// includes emission of the gobject.Object::notify signal). Furthermore, +// you are guaranteed that gio.DBusObjectManagerClient:name-owner will alternate +// between a name owner (e.g. :1.42) and NULL even in the case where the name of +// interest is atomically replaced +// +// Ultimately, GDBusObjectManagerClient is used to obtain +// gio.DBusProxy instances. All signals (including the +// org.freedesktop.DBus.Properties::PropertiesChanged signal) delivered to +// gio.DBusProxy instances are guaranteed to originate from the name owner. +// This guarantee along with the behavior described above, means that certain +// race conditions including the “half the proxy is from the old owner and the +// other half is from the new owner” problem cannot happen. +// +// To avoid having the application connect to signals on the +// returned gio.DBusObjectProxy and gio.DBusProxy objects, the +// gio.DBusObject::interface-added, gio.DBusObject::interface-removed, +// gio.DBusProxy::g-properties-changed and gio.DBusProxy::g-signal signals +// are also emitted on the GDBusObjectManagerClient instance managing these +// objects. The signals emitted are gio.DBusObjectManager::interface-added, +// gio.DBusObjectManager::interface-removed, +// gio.DBusObjectManagerClient::interface-proxy-properties-changed and +// gio.DBusObjectManagerClient::interface-proxy-signal. +// +// Note that all callbacks and signals are emitted in the thread-default +// main context (see glib.MainContext.PushThreadDefault()) that the +// GDBusObjectManagerClient object was constructed in. Additionally, +// the gio.DBusObjectProxy and gio.DBusProxy objects originating from the +// GDBusObjectManagerClient object will be created in the same context and, +// consequently, will deliver signals in the same main loop. +type DBusObjectManagerClient struct { + _ [0]func() // equal guard + *coreglib.Object + + AsyncInitable + DBusObjectManager + Initable +} + +var ( + _ coreglib.Objector = (*DBusObjectManagerClient)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*DBusObjectManagerClient, *DBusObjectManagerClientClass, DBusObjectManagerClientOverrides]( + GTypeDBusObjectManagerClient, + initDBusObjectManagerClientClass, + wrapDBusObjectManagerClient, + defaultDBusObjectManagerClientOverrides, + ) +} + +func initDBusObjectManagerClientClass(gclass unsafe.Pointer, overrides DBusObjectManagerClientOverrides, classInitFunc func(*DBusObjectManagerClientClass)) { + pclass := (*C.GDBusObjectManagerClientClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeDBusObjectManagerClient)))) + + if overrides.InterfaceProxySignal != nil { + pclass.interface_proxy_signal = (*[0]byte)(C._gotk4_gio2_DBusObjectManagerClientClass_interface_proxy_signal) + } + + if classInitFunc != nil { + class := (*DBusObjectManagerClientClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapDBusObjectManagerClient(obj *coreglib.Object) *DBusObjectManagerClient { + return &DBusObjectManagerClient{ + Object: obj, + AsyncInitable: AsyncInitable{ + Object: obj, + }, + DBusObjectManager: DBusObjectManager{ + Object: obj, + }, + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalDBusObjectManagerClient(p uintptr) (interface{}, error) { + return wrapDBusObjectManagerClient(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectInterfaceProxyPropertiesChanged is emitted when one or more +// D-Bus properties on proxy changes. The local cache has already been +// updated when this signal fires. Note that both changed_properties and +// invalidated_properties are guaranteed to never be NULL (either may be empty +// though). +// +// This signal exists purely as a convenience to avoid having to connect signals +// to all interface proxies managed by manager. +// +// This signal is emitted in the [thread-default main +// context][g-main-context-push-thread-default] that manager was constructed in. +func (manager *DBusObjectManagerClient) ConnectInterfaceProxyPropertiesChanged(f func(objectProxy *DBusObjectProxy, interfaceProxy *DBusProxy, changedProperties *glib.Variant, invalidatedProperties []string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(manager, "interface-proxy-properties-changed", false, unsafe.Pointer(C._gotk4_gio2_DBusObjectManagerClient_ConnectInterfaceProxyPropertiesChanged), f) +} + +// ConnectInterfaceProxySignal is emitted when a D-Bus signal is received on +// interface_proxy. +// +// This signal exists purely as a convenience to avoid having to connect signals +// to all interface proxies managed by manager. +// +// This signal is emitted in the [thread-default main +// context][g-main-context-push-thread-default] that manager was constructed in. +func (manager *DBusObjectManagerClient) ConnectInterfaceProxySignal(f func(objectProxy *DBusObjectProxy, interfaceProxy *DBusProxy, senderName, signalName string, parameters *glib.Variant)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(manager, "interface-proxy-signal", false, unsafe.Pointer(C._gotk4_gio2_DBusObjectManagerClient_ConnectInterfaceProxySignal), f) +} + +// NewDBusObjectManagerClientFinish finishes an operation started with +// g_dbus_object_manager_client_new(). +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to +// g_dbus_object_manager_client_new(). +// +// The function returns the following values: +// +// - dBusObjectManagerClient: a BusObjectManagerClient object or NULL if error +// is set. Free with g_object_unref(). +func NewDBusObjectManagerClientFinish(res AsyncResulter) (*DBusObjectManagerClient, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GDBusObjectManager // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_object_manager_client_new_finish(_arg1, &_cerr) + runtime.KeepAlive(res) + + var _dBusObjectManagerClient *DBusObjectManagerClient // out + var _goerr error // out + + _dBusObjectManagerClient = wrapDBusObjectManagerClient(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusObjectManagerClient, _goerr +} + +// NewDBusObjectManagerClientForBusFinish finishes an operation started with +// g_dbus_object_manager_client_new_for_bus(). +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to +// g_dbus_object_manager_client_new_for_bus(). +// +// The function returns the following values: +// +// - dBusObjectManagerClient: a BusObjectManagerClient object or NULL if error +// is set. Free with g_object_unref(). +func NewDBusObjectManagerClientForBusFinish(res AsyncResulter) (*DBusObjectManagerClient, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GDBusObjectManager // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_object_manager_client_new_for_bus_finish(_arg1, &_cerr) + runtime.KeepAlive(res) + + var _dBusObjectManagerClient *DBusObjectManagerClient // out + var _goerr error // out + + _dBusObjectManagerClient = wrapDBusObjectManagerClient(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusObjectManagerClient, _goerr +} + +// Connection gets the BusConnection used by manager. +// +// The function returns the following values: +// +// - dBusConnection object. Do not free, the object belongs to manager. +func (manager *DBusObjectManagerClient) Connection() *DBusConnection { + var _arg0 *C.GDBusObjectManagerClient // out + var _cret *C.GDBusConnection // in + + _arg0 = (*C.GDBusObjectManagerClient)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C.g_dbus_object_manager_client_get_connection(_arg0) + runtime.KeepAlive(manager) + + var _dBusConnection *DBusConnection // out + + _dBusConnection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(_cret))) + + return _dBusConnection +} + +// Flags gets the flags that manager was constructed with. +// +// The function returns the following values: +// +// - dBusObjectManagerClientFlags: zero of more flags from the +// BusObjectManagerClientFlags enumeration. +func (manager *DBusObjectManagerClient) Flags() DBusObjectManagerClientFlags { + var _arg0 *C.GDBusObjectManagerClient // out + var _cret C.GDBusObjectManagerClientFlags // in + + _arg0 = (*C.GDBusObjectManagerClient)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C.g_dbus_object_manager_client_get_flags(_arg0) + runtime.KeepAlive(manager) + + var _dBusObjectManagerClientFlags DBusObjectManagerClientFlags // out + + _dBusObjectManagerClientFlags = DBusObjectManagerClientFlags(_cret) + + return _dBusObjectManagerClientFlags +} + +// Name gets the name that manager is for, or NULL if not a message bus +// connection. +// +// The function returns the following values: +// +// - utf8: unique or well-known name. Do not free, the string belongs to +// manager. +func (manager *DBusObjectManagerClient) Name() string { + var _arg0 *C.GDBusObjectManagerClient // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusObjectManagerClient)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C.g_dbus_object_manager_client_get_name(_arg0) + runtime.KeepAlive(manager) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// NameOwner: unique name that owns the name that manager is for or NULL if +// no-one currently owns that name. You can connect to the #GObject::notify +// signal to track changes to the BusObjectManagerClient:name-owner property. +// +// The function returns the following values: +// +// - utf8 (optional): name owner or NULL if no name owner exists. Free with +// g_free(). +func (manager *DBusObjectManagerClient) NameOwner() string { + var _arg0 *C.GDBusObjectManagerClient // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusObjectManagerClient)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C.g_dbus_object_manager_client_get_name_owner(_arg0) + runtime.KeepAlive(manager) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// interfaceProxySignal: signal class handler for the +// BusObjectManagerClient::interface-proxy-signal signal. +// +// The function takes the following parameters: +// +// - objectProxy +// - interfaceProxy +// - senderName +// - signalName +// - parameters +func (manager *DBusObjectManagerClient) interfaceProxySignal(objectProxy *DBusObjectProxy, interfaceProxy *DBusProxy, senderName, signalName string, parameters *glib.Variant) { + gclass := (*C.GDBusObjectManagerClientClass)(coreglib.PeekParentClass(manager)) + fnarg := gclass.interface_proxy_signal + + var _arg0 *C.GDBusObjectManagerClient // out + var _arg1 *C.GDBusObjectProxy // out + var _arg2 *C.GDBusProxy // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 *C.GVariant // out + + _arg0 = (*C.GDBusObjectManagerClient)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.GDBusObjectProxy)(unsafe.Pointer(coreglib.InternObject(objectProxy).Native())) + _arg2 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(interfaceProxy).Native())) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(senderName))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(signalName))) + defer C.free(unsafe.Pointer(_arg4)) + _arg5 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameters))) + + C._gotk4_gio2_DBusObjectManagerClient_virtual_interface_proxy_signal(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(manager) + runtime.KeepAlive(objectProxy) + runtime.KeepAlive(interfaceProxy) + runtime.KeepAlive(senderName) + runtime.KeepAlive(signalName) + runtime.KeepAlive(parameters) +} + +// DBusObjectManagerServerOverrides contains methods that are overridable. +type DBusObjectManagerServerOverrides struct { +} + +func defaultDBusObjectManagerServerOverrides(v *DBusObjectManagerServer) DBusObjectManagerServerOverrides { + return DBusObjectManagerServerOverrides{} +} + +// DBusObjectManagerServer: GDBusObjectManagerServer +// is used to export gio.DBusObject instances using +// the standardized org.freedesktop.DBus.ObjectManager +// (http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager) +// interface. For example, remote D-Bus clients can get all objects and +// properties in a single call. Additionally, any change in the object hierarchy +// is broadcast using signals. This means that D-Bus clients can keep caches up +// to date by only listening to D-Bus signals. +// +// The recommended path to export an object manager at is the path form of +// the well-known name of a D-Bus service, or below. For example, if a D-Bus +// service is available at the well-known name net.example.ExampleService1, the +// object manager should typically be exported at /net/example/ExampleService1, +// or below (to allow for multiple object managers in a service). +// +// It is supported, but not recommended, to export an object manager at the root +// path, /. +// +// See gio.DBusObjectManagerClient for the client-side code that is intended to +// be used with GDBusObjectManagerServer or any D-Bus object implementing the +// org.freedesktop.DBus.ObjectManager interface. +type DBusObjectManagerServer struct { + _ [0]func() // equal guard + *coreglib.Object + + DBusObjectManager +} + +var ( + _ coreglib.Objector = (*DBusObjectManagerServer)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*DBusObjectManagerServer, *DBusObjectManagerServerClass, DBusObjectManagerServerOverrides]( + GTypeDBusObjectManagerServer, + initDBusObjectManagerServerClass, + wrapDBusObjectManagerServer, + defaultDBusObjectManagerServerOverrides, + ) +} + +func initDBusObjectManagerServerClass(gclass unsafe.Pointer, overrides DBusObjectManagerServerOverrides, classInitFunc func(*DBusObjectManagerServerClass)) { + if classInitFunc != nil { + class := (*DBusObjectManagerServerClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapDBusObjectManagerServer(obj *coreglib.Object) *DBusObjectManagerServer { + return &DBusObjectManagerServer{ + Object: obj, + DBusObjectManager: DBusObjectManager{ + Object: obj, + }, + } +} + +func marshalDBusObjectManagerServer(p uintptr) (interface{}, error) { + return wrapDBusObjectManagerServer(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewDBusObjectManagerServer creates a new BusObjectManagerServer object. +// +// The returned server isn't yet exported on any connection. To do so, +// use g_dbus_object_manager_server_set_connection(). Normally you want +// to export all of your objects before doing so to avoid InterfacesAdded +// (http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager) +// signals being emitted. +// +// The function takes the following parameters: +// +// - objectPath: object path to export the manager object at. +// +// The function returns the following values: +// +// - dBusObjectManagerServer object. Free with g_object_unref(). +func NewDBusObjectManagerServer(objectPath string) *DBusObjectManagerServer { + var _arg1 *C.gchar // out + var _cret *C.GDBusObjectManagerServer // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_object_manager_server_new(_arg1) + runtime.KeepAlive(objectPath) + + var _dBusObjectManagerServer *DBusObjectManagerServer // out + + _dBusObjectManagerServer = wrapDBusObjectManagerServer(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusObjectManagerServer +} + +// Export exports object on manager. +// +// If there is already a BusObject exported at the object path, then the old +// object is removed. +// +// The object path for object must be in the hierarchy rooted by the object path +// for manager. +// +// Note that manager will take a reference on object for as long as it is +// exported. +// +// The function takes the following parameters: +// +// - object: BusObjectSkeleton. +func (manager *DBusObjectManagerServer) Export(object *DBusObjectSkeleton) { + var _arg0 *C.GDBusObjectManagerServer // out + var _arg1 *C.GDBusObjectSkeleton // out + + _arg0 = (*C.GDBusObjectManagerServer)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.GDBusObjectSkeleton)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + C.g_dbus_object_manager_server_export(_arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(object) +} + +// ExportUniquely: like g_dbus_object_manager_server_export() but appends +// a string of the form _N (with N being a natural number) to object's +// object path if an object with the given path already exists. As such, +// the BusObjectProxy:g-object-path property of object may be modified. +// +// The function takes the following parameters: +// +// - object: object. +func (manager *DBusObjectManagerServer) ExportUniquely(object *DBusObjectSkeleton) { + var _arg0 *C.GDBusObjectManagerServer // out + var _arg1 *C.GDBusObjectSkeleton // out + + _arg0 = (*C.GDBusObjectManagerServer)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.GDBusObjectSkeleton)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + C.g_dbus_object_manager_server_export_uniquely(_arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(object) +} + +// Connection gets the BusConnection used by manager. +// +// The function returns the following values: +// +// - dBusConnection (optional) object or NULL if manager isn't exported on a +// connection. The returned object should be freed with g_object_unref(). +func (manager *DBusObjectManagerServer) Connection() *DBusConnection { + var _arg0 *C.GDBusObjectManagerServer // out + var _cret *C.GDBusConnection // in + + _arg0 = (*C.GDBusObjectManagerServer)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + + _cret = C.g_dbus_object_manager_server_get_connection(_arg0) + runtime.KeepAlive(manager) + + var _dBusConnection *DBusConnection // out + + if _cret != nil { + _dBusConnection = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _dBusConnection +} + +// IsExported returns whether object is currently exported on manager. +// +// The function takes the following parameters: +// +// - object: object. +// +// The function returns the following values: +// +// - ok: TRUE if object is exported. +func (manager *DBusObjectManagerServer) IsExported(object *DBusObjectSkeleton) bool { + var _arg0 *C.GDBusObjectManagerServer // out + var _arg1 *C.GDBusObjectSkeleton // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusObjectManagerServer)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.GDBusObjectSkeleton)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + _cret = C.g_dbus_object_manager_server_is_exported(_arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(object) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetConnection exports all objects managed by manager on connection. +// If connection is NULL, stops exporting objects. +// +// The function takes the following parameters: +// +// - connection (optional) or NULL. +func (manager *DBusObjectManagerServer) SetConnection(connection *DBusConnection) { + var _arg0 *C.GDBusObjectManagerServer // out + var _arg1 *C.GDBusConnection // out + + _arg0 = (*C.GDBusObjectManagerServer)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + if connection != nil { + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + } + + C.g_dbus_object_manager_server_set_connection(_arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(connection) +} + +// Unexport: if manager has an object at path, removes the object. Otherwise +// does nothing. +// +// Note that object_path must be in the hierarchy rooted by the object path for +// manager. +// +// The function takes the following parameters: +// +// - objectPath: object path. +// +// The function returns the following values: +// +// - ok: TRUE if object at object_path was removed, FALSE otherwise. +func (manager *DBusObjectManagerServer) Unexport(objectPath string) bool { + var _arg0 *C.GDBusObjectManagerServer // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusObjectManagerServer)(unsafe.Pointer(coreglib.InternObject(manager).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_object_manager_server_unexport(_arg0, _arg1) + runtime.KeepAlive(manager) + runtime.KeepAlive(objectPath) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusObjectProxyOverrides contains methods that are overridable. +type DBusObjectProxyOverrides struct { +} + +func defaultDBusObjectProxyOverrides(v *DBusObjectProxy) DBusObjectProxyOverrides { + return DBusObjectProxyOverrides{} +} + +// DBusObjectProxy: GDBusObjectProxy is an object used to represent a remote +// object with one or more D-Bus interfaces. Normally, you don’t instantiate a +// GDBusObjectProxy yourself — typically gio.DBusObjectManagerClient is used to +// obtain it. +type DBusObjectProxy struct { + _ [0]func() // equal guard + *coreglib.Object + + DBusObject +} + +var ( + _ coreglib.Objector = (*DBusObjectProxy)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*DBusObjectProxy, *DBusObjectProxyClass, DBusObjectProxyOverrides]( + GTypeDBusObjectProxy, + initDBusObjectProxyClass, + wrapDBusObjectProxy, + defaultDBusObjectProxyOverrides, + ) +} + +func initDBusObjectProxyClass(gclass unsafe.Pointer, overrides DBusObjectProxyOverrides, classInitFunc func(*DBusObjectProxyClass)) { + if classInitFunc != nil { + class := (*DBusObjectProxyClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapDBusObjectProxy(obj *coreglib.Object) *DBusObjectProxy { + return &DBusObjectProxy{ + Object: obj, + DBusObject: DBusObject{ + Object: obj, + }, + } +} + +func marshalDBusObjectProxy(p uintptr) (interface{}, error) { + return wrapDBusObjectProxy(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewDBusObjectProxy creates a new BusObjectProxy for the given connection and +// object path. +// +// The function takes the following parameters: +// +// - connection: BusConnection. +// - objectPath: object path. +// +// The function returns the following values: +// +// - dBusObjectProxy: new BusObjectProxy. +func NewDBusObjectProxy(connection *DBusConnection, objectPath string) *DBusObjectProxy { + var _arg1 *C.GDBusConnection // out + var _arg2 *C.gchar // out + var _cret *C.GDBusObjectProxy // in + + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_dbus_object_proxy_new(_arg1, _arg2) + runtime.KeepAlive(connection) + runtime.KeepAlive(objectPath) + + var _dBusObjectProxy *DBusObjectProxy // out + + _dBusObjectProxy = wrapDBusObjectProxy(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusObjectProxy +} + +// Connection gets the connection that proxy is for. +// +// The function returns the following values: +// +// - dBusConnection Do not free, the object is owned by proxy. +func (proxy *DBusObjectProxy) Connection() *DBusConnection { + var _arg0 *C.GDBusObjectProxy // out + var _cret *C.GDBusConnection // in + + _arg0 = (*C.GDBusObjectProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_object_proxy_get_connection(_arg0) + runtime.KeepAlive(proxy) + + var _dBusConnection *DBusConnection // out + + _dBusConnection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(_cret))) + + return _dBusConnection +} + +// DBusObjectSkeletonOverrides contains methods that are overridable. +type DBusObjectSkeletonOverrides struct { + // AuthorizeMethod: signal class handler for the + // BusObjectSkeleton::authorize-method signal. + // + // The function takes the following parameters: + // + // - interface_ + // - invocation + AuthorizeMethod func(interface_ DBusInterfaceSkeletonner, invocation *DBusMethodInvocation) bool +} + +func defaultDBusObjectSkeletonOverrides(v *DBusObjectSkeleton) DBusObjectSkeletonOverrides { + return DBusObjectSkeletonOverrides{ + AuthorizeMethod: v.authorizeMethod, + } +} + +// DBusObjectSkeleton: GDBusObjectSkeleton instance is essentially a group of +// D-Bus interfaces. The set of exported interfaces on the object may be dynamic +// and change at runtime. +// +// This type is intended to be used with gio.DBusObjectManager. +type DBusObjectSkeleton struct { + _ [0]func() // equal guard + *coreglib.Object + + DBusObject +} + +var ( + _ coreglib.Objector = (*DBusObjectSkeleton)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*DBusObjectSkeleton, *DBusObjectSkeletonClass, DBusObjectSkeletonOverrides]( + GTypeDBusObjectSkeleton, + initDBusObjectSkeletonClass, + wrapDBusObjectSkeleton, + defaultDBusObjectSkeletonOverrides, + ) +} + +func initDBusObjectSkeletonClass(gclass unsafe.Pointer, overrides DBusObjectSkeletonOverrides, classInitFunc func(*DBusObjectSkeletonClass)) { + pclass := (*C.GDBusObjectSkeletonClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeDBusObjectSkeleton)))) + + if overrides.AuthorizeMethod != nil { + pclass.authorize_method = (*[0]byte)(C._gotk4_gio2_DBusObjectSkeletonClass_authorize_method) + } + + if classInitFunc != nil { + class := (*DBusObjectSkeletonClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapDBusObjectSkeleton(obj *coreglib.Object) *DBusObjectSkeleton { + return &DBusObjectSkeleton{ + Object: obj, + DBusObject: DBusObject{ + Object: obj, + }, + } +} + +func marshalDBusObjectSkeleton(p uintptr) (interface{}, error) { + return wrapDBusObjectSkeleton(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectAuthorizeMethod is emitted when a method is invoked by a remote caller +// and used to determine if the method call is authorized. +// +// This signal is like BusInterfaceSkeleton's +// BusInterfaceSkeleton::g-authorize-method signal, except that it is for the +// enclosing object. +// +// The default class handler just returns TRUE. +func (object *DBusObjectSkeleton) ConnectAuthorizeMethod(f func(iface DBusInterfaceSkeletonner, invocation *DBusMethodInvocation) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(object, "authorize-method", false, unsafe.Pointer(C._gotk4_gio2_DBusObjectSkeleton_ConnectAuthorizeMethod), f) +} + +// NewDBusObjectSkeleton creates a new BusObjectSkeleton. +// +// The function takes the following parameters: +// +// - objectPath: object path. +// +// The function returns the following values: +// +// - dBusObjectSkeleton Free with g_object_unref(). +func NewDBusObjectSkeleton(objectPath string) *DBusObjectSkeleton { + var _arg1 *C.gchar // out + var _cret *C.GDBusObjectSkeleton // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_object_skeleton_new(_arg1) + runtime.KeepAlive(objectPath) + + var _dBusObjectSkeleton *DBusObjectSkeleton // out + + _dBusObjectSkeleton = wrapDBusObjectSkeleton(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dBusObjectSkeleton +} + +// AddInterface adds interface_ to object. +// +// If object already contains a BusInterfaceSkeleton with the same interface +// name, it is removed before interface_ is added. +// +// Note that object takes its own reference on interface_ and holds it until +// removed. +// +// The function takes the following parameters: +// +// - interface_: BusInterfaceSkeleton. +func (object *DBusObjectSkeleton) AddInterface(interface_ DBusInterfaceSkeletonner) { + var _arg0 *C.GDBusObjectSkeleton // out + var _arg1 *C.GDBusInterfaceSkeleton // out + + _arg0 = (*C.GDBusObjectSkeleton)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg1 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + C.g_dbus_object_skeleton_add_interface(_arg0, _arg1) + runtime.KeepAlive(object) + runtime.KeepAlive(interface_) +} + +// Flush: this method simply calls g_dbus_interface_skeleton_flush() on all +// interfaces belonging to object. See that method for when flushing is useful. +func (object *DBusObjectSkeleton) Flush() { + var _arg0 *C.GDBusObjectSkeleton // out + + _arg0 = (*C.GDBusObjectSkeleton)(unsafe.Pointer(coreglib.InternObject(object).Native())) + + C.g_dbus_object_skeleton_flush(_arg0) + runtime.KeepAlive(object) +} + +// RemoveInterface removes interface_ from object. +// +// The function takes the following parameters: +// +// - interface_: BusInterfaceSkeleton. +func (object *DBusObjectSkeleton) RemoveInterface(interface_ DBusInterfaceSkeletonner) { + var _arg0 *C.GDBusObjectSkeleton // out + var _arg1 *C.GDBusInterfaceSkeleton // out + + _arg0 = (*C.GDBusObjectSkeleton)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg1 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + + C.g_dbus_object_skeleton_remove_interface(_arg0, _arg1) + runtime.KeepAlive(object) + runtime.KeepAlive(interface_) +} + +// RemoveInterfaceByName removes the BusInterface with interface_name from +// object. +// +// If no D-Bus interface of the given interface exists, this function does +// nothing. +// +// The function takes the following parameters: +// +// - interfaceName d-Bus interface name. +func (object *DBusObjectSkeleton) RemoveInterfaceByName(interfaceName string) { + var _arg0 *C.GDBusObjectSkeleton // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GDBusObjectSkeleton)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_dbus_object_skeleton_remove_interface_by_name(_arg0, _arg1) + runtime.KeepAlive(object) + runtime.KeepAlive(interfaceName) +} + +// SetObjectPath sets the object path for object. +// +// The function takes the following parameters: +// +// - objectPath: valid D-Bus object path. +func (object *DBusObjectSkeleton) SetObjectPath(objectPath string) { + var _arg0 *C.GDBusObjectSkeleton // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GDBusObjectSkeleton)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_dbus_object_skeleton_set_object_path(_arg0, _arg1) + runtime.KeepAlive(object) + runtime.KeepAlive(objectPath) +} + +// authorizeMethod: signal class handler for the +// BusObjectSkeleton::authorize-method signal. +// +// The function takes the following parameters: +// +// - interface_ +// - invocation +func (object *DBusObjectSkeleton) authorizeMethod(interface_ DBusInterfaceSkeletonner, invocation *DBusMethodInvocation) bool { + gclass := (*C.GDBusObjectSkeletonClass)(coreglib.PeekParentClass(object)) + fnarg := gclass.authorize_method + + var _arg0 *C.GDBusObjectSkeleton // out + var _arg1 *C.GDBusInterfaceSkeleton // out + var _arg2 *C.GDBusMethodInvocation // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusObjectSkeleton)(unsafe.Pointer(coreglib.InternObject(object).Native())) + _arg1 = (*C.GDBusInterfaceSkeleton)(unsafe.Pointer(coreglib.InternObject(interface_).Native())) + _arg2 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C._gotk4_gio2_DBusObjectSkeleton_virtual_authorize_method(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(object) + runtime.KeepAlive(interface_) + runtime.KeepAlive(invocation) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DBusProxyOverrides contains methods that are overridable. +type DBusProxyOverrides struct { + // GSignal: signal class handler for the BusProxy::g-signal signal. + // + // The function takes the following parameters: + // + // - senderName + // - signalName + // - parameters + GSignal func(senderName, signalName string, parameters *glib.Variant) +} + +func defaultDBusProxyOverrides(v *DBusProxy) DBusProxyOverrides { + return DBusProxyOverrides{ + GSignal: v.gSignal, + } +} + +// DBusProxy: GDBusProxy is a base class used for proxies to access a D-Bus +// interface on a remote object. A GDBusProxy can be constructed for both +// well-known and unique names. +// +// By default, GDBusProxy will cache all properties (and listen to changes) of +// the remote object, and proxy all signals that get emitted. This behaviour can +// be changed by passing suitable gio.DBusProxyFlags when the proxy is created. +// If the proxy is for a well-known name, the property cache is flushed when the +// name owner vanishes and reloaded when a name owner appears. +// +// The unique name owner of the proxy’s name is tracked and can be read from +// gio.DBusProxy:g-name-owner. Connect to the gobject.Object::notify signal to +// get notified of changes. Additionally, only signals and property changes +// emitted from the current name owner are considered and calls are always +// sent to the current name owner. This avoids a number of race conditions +// when the name is lost by one owner and claimed by another. However, +// if no name owner currently exists, then calls will be sent to the well-known +// name which may result in the message bus launching an owner (unless +// G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START is set). +// +// If the proxy is for a stateless D-Bus service, where the name owner may be +// started and stopped between calls, the gio.DBusProxy:g-name-owner tracking +// of GDBusProxy will cause the proxy to drop signal and property changes from +// the service after it has restarted for the first time. When interacting with +// a stateless D-Bus service, do not use GDBusProxy — use direct D-Bus method +// calls and signal connections. +// +// The generic gio.DBusProxy::g-properties-changed and gio.DBusProxy::g-signal +// signals are not very convenient to work with. Therefore, the recommended +// way of working with proxies is to subclass GDBusProxy, and have more +// natural properties and signals in your derived class. This example +// (migrating-gdbus.html#using-gdbus-codegen) shows how this can easily be done +// using the gdbus-codegen (gdbus-codegen.html) tool. +// +// A GDBusProxy instance can be used from multiple threads but note that all +// signals (e.g. gio.DBusProxy::g-signal, gio.DBusProxy::g-properties-changed +// and gobject.Object::notify) are emitted in the thread-default main context +// (see glib.MainContext.PushThreadDefault()) of the thread where the instance +// was constructed. +// +// An example using a proxy for a well-known name +// can be found in gdbus-example-watch-proxy.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-watch-proxy.c). +type DBusProxy struct { + _ [0]func() // equal guard + *coreglib.Object + + AsyncInitable + DBusInterface + Initable +} + +var ( + _ coreglib.Objector = (*DBusProxy)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*DBusProxy, *DBusProxyClass, DBusProxyOverrides]( + GTypeDBusProxy, + initDBusProxyClass, + wrapDBusProxy, + defaultDBusProxyOverrides, + ) +} + +func initDBusProxyClass(gclass unsafe.Pointer, overrides DBusProxyOverrides, classInitFunc func(*DBusProxyClass)) { + pclass := (*C.GDBusProxyClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeDBusProxy)))) + + if overrides.GSignal != nil { + pclass.g_signal = (*[0]byte)(C._gotk4_gio2_DBusProxyClass_g_signal) + } + + if classInitFunc != nil { + class := (*DBusProxyClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapDBusProxy(obj *coreglib.Object) *DBusProxy { + return &DBusProxy{ + Object: obj, + AsyncInitable: AsyncInitable{ + Object: obj, + }, + DBusInterface: DBusInterface{ + Object: obj, + }, + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalDBusProxy(p uintptr) (interface{}, error) { + return wrapDBusProxy(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectGPropertiesChanged is emitted when one or more D-Bus properties on +// proxy changes. The local cache has already been updated when this signal +// fires. Note that both changed_properties and invalidated_properties are +// guaranteed to never be NULL (either may be empty though). +// +// If the proxy has the flag G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES set, +// then invalidated_properties will always be empty. +// +// This signal corresponds to the PropertiesChanged D-Bus signal on the +// org.freedesktop.DBus.Properties interface. +func (proxy *DBusProxy) ConnectGPropertiesChanged(f func(changedProperties *glib.Variant, invalidatedProperties []string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(proxy, "g-properties-changed", false, unsafe.Pointer(C._gotk4_gio2_DBusProxy_ConnectGPropertiesChanged), f) +} + +// ConnectGSignal is emitted when a signal from the remote object and interface +// that proxy is for, has been received. +// +// Since 2.72 this signal supports detailed connections. You can connect to the +// detailed signal g-signal::x in order to receive callbacks only when signal x +// is received from the remote object. +func (proxy *DBusProxy) ConnectGSignal(f func(senderName, signalName string, parameters *glib.Variant)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(proxy, "g-signal", false, unsafe.Pointer(C._gotk4_gio2_DBusProxy_ConnectGSignal), f) +} + +// NewDBusProxyFinish finishes creating a BusProxy. +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback function passed to +// g_dbus_proxy_new(). +// +// The function returns the following values: +// +// - dBusProxy or NULL if error is set. Free with g_object_unref(). +func NewDBusProxyFinish(res AsyncResulter) (*DBusProxy, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GDBusProxy // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_proxy_new_finish(_arg1, &_cerr) + runtime.KeepAlive(res) + + var _dBusProxy *DBusProxy // out + var _goerr error // out + + _dBusProxy = wrapDBusProxy(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusProxy, _goerr +} + +// NewDBusProxyForBusFinish finishes creating a BusProxy. +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback function passed to +// g_dbus_proxy_new_for_bus(). +// +// The function returns the following values: +// +// - dBusProxy or NULL if error is set. Free with g_object_unref(). +func NewDBusProxyForBusFinish(res AsyncResulter) (*DBusProxy, error) { + var _arg1 *C.GAsyncResult // out + var _cret *C.GDBusProxy // in + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_proxy_new_for_bus_finish(_arg1, &_cerr) + runtime.KeepAlive(res) + + var _dBusProxy *DBusProxy // out + var _goerr error // out + + _dBusProxy = wrapDBusProxy(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusProxy, _goerr +} + +// NewDBusProxyForBusSync: like g_dbus_proxy_new_sync() but takes a Type instead +// of a BusConnection. +// +// BusProxy is used in this [example][gdbus-wellknown-proxy]. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - busType: Type. +// - flags flags used when constructing the proxy. +// - info (optional) specifying the minimal interface that proxy conforms to +// or NULL. +// - name bus name (well-known or unique). +// - objectPath: object path. +// - interfaceName d-Bus interface name. +// +// The function returns the following values: +// +// - dBusProxy or NULL if error is set. Free with g_object_unref(). +func NewDBusProxyForBusSync(ctx context.Context, busType BusType, flags DBusProxyFlags, info *DBusInterfaceInfo, name, objectPath, interfaceName string) (*DBusProxy, error) { + var _arg7 *C.GCancellable // out + var _arg1 C.GBusType // out + var _arg2 C.GDBusProxyFlags // out + var _arg3 *C.GDBusInterfaceInfo // out + var _arg4 *C.gchar // out + var _arg5 *C.gchar // out + var _arg6 *C.gchar // out + var _cret *C.GDBusProxy // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg7 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GBusType(busType) + _arg2 = C.GDBusProxyFlags(flags) + if info != nil { + _arg3 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + } + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg4)) + _arg5 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg5)) + _arg6 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg6)) + + _cret = C.g_dbus_proxy_new_for_bus_sync(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(busType) + runtime.KeepAlive(flags) + runtime.KeepAlive(info) + runtime.KeepAlive(name) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceName) + + var _dBusProxy *DBusProxy // out + var _goerr error // out + + _dBusProxy = wrapDBusProxy(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusProxy, _goerr +} + +// NewDBusProxySync creates a proxy for accessing interface_name on the remote +// object at object_path owned by name at connection and synchronously loads +// D-Bus properties unless the G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flag is +// used. +// +// If the G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS flag is not set, also sets +// up match rules for signals. Connect to the BusProxy::g-signal signal to +// handle signals from the remote object. +// +// If both G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES and +// G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS are set, this constructor is +// guaranteed to return immediately without blocking. +// +// If name is a well-known name and the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START and +// G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION flags aren't set and no +// name owner currently exists, the message bus will be requested to launch a +// name owner for the name. +// +// This is a synchronous failable constructor. See g_dbus_proxy_new() and +// g_dbus_proxy_new_finish() for the asynchronous version. +// +// BusProxy is used in this [example][gdbus-wellknown-proxy]. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - connection: BusConnection. +// - flags flags used when constructing the proxy. +// - info (optional) specifying the minimal interface that proxy conforms to +// or NULL. +// - name (optional) bus name (well-known or unique) or NULL if connection is +// not a message bus connection. +// - objectPath: object path. +// - interfaceName d-Bus interface name. +// +// The function returns the following values: +// +// - dBusProxy or NULL if error is set. Free with g_object_unref(). +func NewDBusProxySync(ctx context.Context, connection *DBusConnection, flags DBusProxyFlags, info *DBusInterfaceInfo, name, objectPath, interfaceName string) (*DBusProxy, error) { + var _arg7 *C.GCancellable // out + var _arg1 *C.GDBusConnection // out + var _arg2 C.GDBusProxyFlags // out + var _arg3 *C.GDBusInterfaceInfo // out + var _arg4 *C.gchar // out + var _arg5 *C.gchar // out + var _arg6 *C.gchar // out + var _cret *C.GDBusProxy // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg7 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = C.GDBusProxyFlags(flags) + if info != nil { + _arg3 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + } + if name != "" { + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg4)) + } + _arg5 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg5)) + _arg6 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg6)) + + _cret = C.g_dbus_proxy_new_sync(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(flags) + runtime.KeepAlive(info) + runtime.KeepAlive(name) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceName) + + var _dBusProxy *DBusProxy // out + var _goerr error // out + + _dBusProxy = wrapDBusProxy(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusProxy, _goerr +} + +// Call: asynchronously invokes the method_name method on proxy. +// +// If method_name contains any dots, then name is split into interface and +// method name parts. This allows using proxy for invoking methods on other +// interfaces. +// +// If the BusConnection associated with proxy is closed then the operation +// will fail with G_IO_ERROR_CLOSED. If cancellable is canceled, the +// operation will fail with G_IO_ERROR_CANCELLED. If parameters contains a +// value not compatible with the D-Bus protocol, the operation fails with +// G_IO_ERROR_INVALID_ARGUMENT. +// +// If the parameters #GVariant is floating, it is consumed. This allows +// convenient 'inline' use of g_variant_new(), e.g.: +// +// g_dbus_proxy_call (proxy, +// "TwoStrings", +// g_variant_new ("(ss)", +// "Thing One", +// "Thing Two"), +// G_DBUS_CALL_FLAGS_NONE, +// -1, +// NULL, +// (GAsyncReadyCallback) two_strings_done, +// &data); +// +// If proxy has an expected interface (see BusProxy:g-interface-info) and +// method_name is referenced by it, then the return value is checked against the +// return type. +// +// This is an asynchronous method. When the operation is finished, +// callback will be invoked in the [thread-default main +// context][g-main-context-push-thread-default] of the thread you are calling +// this method from. You can then call g_dbus_proxy_call_finish() to get the +// result of the operation. See g_dbus_proxy_call_sync() for the synchronous +// version of this method. +// +// If callback is NULL then the D-Bus method call message will be sent with the +// G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - methodName: name of method to invoke. +// - parameters (optional) tuple with parameters for the signal or NULL if not +// passing parameters. +// - flags flags from the BusCallFlags enumeration. +// - timeoutMsec: timeout in milliseconds (with G_MAXINT meaning "infinite") +// or -1 to use the proxy default timeout. +// - callback (optional) to call when the request is satisfied or NULL if you +// don't care about the result of the method invocation. +func (proxy *DBusProxy) Call(ctx context.Context, methodName string, parameters *glib.Variant, flags DBusCallFlags, timeoutMsec int, callback AsyncReadyCallback) { + var _arg0 *C.GDBusProxy // out + var _arg5 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + var _arg3 C.GDBusCallFlags // out + var _arg4 C.gint // out + var _arg6 C.GAsyncReadyCallback // out + var _arg7 C.gpointer + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(methodName))) + defer C.free(unsafe.Pointer(_arg1)) + if parameters != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameters))) + } + _arg3 = C.GDBusCallFlags(flags) + _arg4 = C.gint(timeoutMsec) + if callback != nil { + _arg6 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg7 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_proxy_call(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(proxy) + runtime.KeepAlive(ctx) + runtime.KeepAlive(methodName) + runtime.KeepAlive(parameters) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeoutMsec) + runtime.KeepAlive(callback) +} + +// CallFinish finishes an operation started with g_dbus_proxy_call(). +// +// The function takes the following parameters: +// +// - res obtained from the ReadyCallback passed to g_dbus_proxy_call(). +// +// The function returns the following values: +// +// - variant: NULL if error is set. Otherwise a #GVariant tuple with return +// values. Free with g_variant_unref(). +func (proxy *DBusProxy) CallFinish(res AsyncResulter) (*glib.Variant, error) { + var _arg0 *C.GDBusProxy // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GVariant // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(res).Native())) + + _cret = C.g_dbus_proxy_call_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(proxy) + runtime.KeepAlive(res) + + var _variant *glib.Variant // out + var _goerr error // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _variant, _goerr +} + +// CallSync: synchronously invokes the method_name method on proxy. +// +// If method_name contains any dots, then name is split into interface and +// method name parts. This allows using proxy for invoking methods on other +// interfaces. +// +// If the BusConnection associated with proxy is disconnected then the +// operation will fail with G_IO_ERROR_CLOSED. If cancellable is canceled, +// the operation will fail with G_IO_ERROR_CANCELLED. If parameters contains +// a value not compatible with the D-Bus protocol, the operation fails with +// G_IO_ERROR_INVALID_ARGUMENT. +// +// If the parameters #GVariant is floating, it is consumed. This allows +// convenient 'inline' use of g_variant_new(), e.g.: +// +// g_dbus_proxy_call_sync (proxy, +// "TwoStrings", +// g_variant_new ("(ss)", +// "Thing One", +// "Thing Two"), +// G_DBUS_CALL_FLAGS_NONE, +// -1, +// NULL, +// &error); +// +// The calling thread is blocked until a reply is received. See +// g_dbus_proxy_call() for the asynchronous version of this method. +// +// If proxy has an expected interface (see BusProxy:g-interface-info) and +// method_name is referenced by it, then the return value is checked against the +// return type. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - methodName: name of method to invoke. +// - parameters (optional) tuple with parameters for the signal or NULL if not +// passing parameters. +// - flags flags from the BusCallFlags enumeration. +// - timeoutMsec: timeout in milliseconds (with G_MAXINT meaning "infinite") +// or -1 to use the proxy default timeout. +// +// The function returns the following values: +// +// - variant: NULL if error is set. Otherwise a #GVariant tuple with return +// values. Free with g_variant_unref(). +func (proxy *DBusProxy) CallSync(ctx context.Context, methodName string, parameters *glib.Variant, flags DBusCallFlags, timeoutMsec int) (*glib.Variant, error) { + var _arg0 *C.GDBusProxy // out + var _arg5 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + var _arg3 C.GDBusCallFlags // out + var _arg4 C.gint // out + var _cret *C.GVariant // in + var _cerr *C.GError // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(methodName))) + defer C.free(unsafe.Pointer(_arg1)) + if parameters != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameters))) + } + _arg3 = C.GDBusCallFlags(flags) + _arg4 = C.gint(timeoutMsec) + + _cret = C.g_dbus_proxy_call_sync(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(proxy) + runtime.KeepAlive(ctx) + runtime.KeepAlive(methodName) + runtime.KeepAlive(parameters) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeoutMsec) + + var _variant *glib.Variant // out + var _goerr error // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _variant, _goerr +} + +// CachedProperty looks up the value for a property from the cache. This call +// does no blocking IO. +// +// If proxy has an expected interface (see BusProxy:g-interface-info) and +// property_name is referenced by it, then value is checked against the type of +// the property. +// +// The function takes the following parameters: +// +// - propertyName: property name. +// +// The function returns the following values: +// +// - variant (optional): reference to the #GVariant instance that holds +// the value for property_name or NULL if the value is not in the cache. +// The returned reference must be freed with g_variant_unref(). +func (proxy *DBusProxy) CachedProperty(propertyName string) *glib.Variant { + var _arg0 *C.GDBusProxy // out + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(propertyName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_proxy_get_cached_property(_arg0, _arg1) + runtime.KeepAlive(proxy) + runtime.KeepAlive(propertyName) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// CachedPropertyNames gets the names of all cached properties on proxy. +// +// The function returns the following values: +// +// - utf8s (optional): a NULL-terminated array of strings or NULL if proxy has +// no cached properties. Free the returned array with g_strfreev(). +func (proxy *DBusProxy) CachedPropertyNames() []string { + var _arg0 *C.GDBusProxy // out + var _cret **C.gchar // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_proxy_get_cached_property_names(_arg0) + runtime.KeepAlive(proxy) + + var _utf8s []string // out + + if _cret != nil { + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + } + + return _utf8s +} + +// Connection gets the connection proxy is for. +// +// The function returns the following values: +// +// - dBusConnection owned by proxy. Do not free. +func (proxy *DBusProxy) Connection() *DBusConnection { + var _arg0 *C.GDBusProxy // out + var _cret *C.GDBusConnection // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_proxy_get_connection(_arg0) + runtime.KeepAlive(proxy) + + var _dBusConnection *DBusConnection // out + + _dBusConnection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(_cret))) + + return _dBusConnection +} + +// DefaultTimeout gets the timeout to use if -1 (specifying default +// timeout) is passed as timeout_msec in the g_dbus_proxy_call() and +// g_dbus_proxy_call_sync() functions. +// +// See the BusProxy:g-default-timeout property for more details. +// +// The function returns the following values: +// +// - gint: timeout to use for proxy. +func (proxy *DBusProxy) DefaultTimeout() int { + var _arg0 *C.GDBusProxy // out + var _cret C.gint // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_proxy_get_default_timeout(_arg0) + runtime.KeepAlive(proxy) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Flags gets the flags that proxy was constructed with. +// +// The function returns the following values: +// +// - dBusProxyFlags flags from the BusProxyFlags enumeration. +func (proxy *DBusProxy) Flags() DBusProxyFlags { + var _arg0 *C.GDBusProxy // out + var _cret C.GDBusProxyFlags // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_proxy_get_flags(_arg0) + runtime.KeepAlive(proxy) + + var _dBusProxyFlags DBusProxyFlags // out + + _dBusProxyFlags = DBusProxyFlags(_cret) + + return _dBusProxyFlags +} + +// InterfaceInfo returns the BusInterfaceInfo, if any, specifying the interface +// that proxy conforms to. See the BusProxy:g-interface-info property for more +// details. +// +// The function returns the following values: +// +// - dBusInterfaceInfo (optional) or NULL. Do not unref the returned object, +// it is owned by proxy. +func (proxy *DBusProxy) InterfaceInfo() *DBusInterfaceInfo { + var _arg0 *C.GDBusProxy // out + var _cret *C.GDBusInterfaceInfo // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_proxy_get_interface_info(_arg0) + runtime.KeepAlive(proxy) + + var _dBusInterfaceInfo *DBusInterfaceInfo // out + + if _cret != nil { + _dBusInterfaceInfo = (*DBusInterfaceInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_interface_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusInterfaceInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_interface_info_unref((*C.GDBusInterfaceInfo)(intern.C)) + }, + ) + } + + return _dBusInterfaceInfo +} + +// InterfaceName gets the D-Bus interface name proxy is for. +// +// The function returns the following values: +// +// - utf8: string owned by proxy. Do not free. +func (proxy *DBusProxy) InterfaceName() string { + var _arg0 *C.GDBusProxy // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_proxy_get_interface_name(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Name gets the name that proxy was constructed for. +// +// When connected to a message bus, this will usually be non-NULL. However, +// it may be NULL for a proxy that communicates using a peer-to-peer pattern. +// +// The function returns the following values: +// +// - utf8 (optional): string owned by proxy. Do not free. +func (proxy *DBusProxy) Name() string { + var _arg0 *C.GDBusProxy // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_proxy_get_name(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// NameOwner: unique name that owns the name that proxy is for or NULL if no-one +// currently owns that name. You may connect to the #GObject::notify signal to +// track changes to the BusProxy:g-name-owner property. +// +// The function returns the following values: +// +// - utf8 (optional): name owner or NULL if no name owner exists. Free with +// g_free(). +func (proxy *DBusProxy) NameOwner() string { + var _arg0 *C.GDBusProxy // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_proxy_get_name_owner(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// ObjectPath gets the object path proxy is for. +// +// The function returns the following values: +// +// - utf8: string owned by proxy. Do not free. +func (proxy *DBusProxy) ObjectPath() string { + var _arg0 *C.GDBusProxy // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_dbus_proxy_get_object_path(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// SetCachedProperty: if value is not NULL, sets the cached value for the +// property with name property_name to the value in value. +// +// If value is NULL, then the cached value is removed from the property cache. +// +// If proxy has an expected interface (see BusProxy:g-interface-info) and +// property_name is referenced by it, then value is checked against the type of +// the property. +// +// If the value #GVariant is floating, it is consumed. This allows convenient +// 'inline' use of g_variant_new(), e.g. +// +// g_dbus_proxy_set_cached_property (proxy, +// "SomeProperty", +// g_variant_new ("(si)", +// "A String", +// 42)); +// +// Normally you will not need to use this method since proxy is tracking changes +// using the org.freedesktop.DBus.Properties.PropertiesChanged D-Bus signal. +// However, for performance reasons an object may decide to not use this signal +// for some properties and instead use a proprietary out-of-band mechanism to +// transmit changes. +// +// As a concrete example, consider an object with a property +// ChatroomParticipants which is an array of strings. Instead of +// transmitting the same (long) array every time the property changes, +// it is more efficient to only transmit the delta using e.g. signals +// ChatroomParticipantJoined(String name) and ChatroomParticipantParted(String +// name). +// +// The function takes the following parameters: +// +// - propertyName: property name. +// - value (optional): value for the property or NULL to remove it from the +// cache. +func (proxy *DBusProxy) SetCachedProperty(propertyName string, value *glib.Variant) { + var _arg0 *C.GDBusProxy // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(propertyName))) + defer C.free(unsafe.Pointer(_arg1)) + if value != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + } + + C.g_dbus_proxy_set_cached_property(_arg0, _arg1, _arg2) + runtime.KeepAlive(proxy) + runtime.KeepAlive(propertyName) + runtime.KeepAlive(value) +} + +// SetDefaultTimeout sets the timeout to use if -1 (specifying default +// timeout) is passed as timeout_msec in the g_dbus_proxy_call() and +// g_dbus_proxy_call_sync() functions. +// +// See the BusProxy:g-default-timeout property for more details. +// +// The function takes the following parameters: +// +// - timeoutMsec: timeout in milliseconds. +func (proxy *DBusProxy) SetDefaultTimeout(timeoutMsec int) { + var _arg0 *C.GDBusProxy // out + var _arg1 C.gint // out + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + _arg1 = C.gint(timeoutMsec) + + C.g_dbus_proxy_set_default_timeout(_arg0, _arg1) + runtime.KeepAlive(proxy) + runtime.KeepAlive(timeoutMsec) +} + +// SetInterfaceInfo: ensure that interactions with proxy conform to the given +// interface. See the BusProxy:g-interface-info property for more details. +// +// The function takes the following parameters: +// +// - info (optional): minimum interface this proxy conforms to or NULL to +// unset. +func (proxy *DBusProxy) SetInterfaceInfo(info *DBusInterfaceInfo) { + var _arg0 *C.GDBusProxy // out + var _arg1 *C.GDBusInterfaceInfo // out + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + if info != nil { + _arg1 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + } + + C.g_dbus_proxy_set_interface_info(_arg0, _arg1) + runtime.KeepAlive(proxy) + runtime.KeepAlive(info) +} + +// gSignal: signal class handler for the BusProxy::g-signal signal. +// +// The function takes the following parameters: +// +// - senderName +// - signalName +// - parameters +func (proxy *DBusProxy) gSignal(senderName, signalName string, parameters *glib.Variant) { + gclass := (*C.GDBusProxyClass)(coreglib.PeekParentClass(proxy)) + fnarg := gclass.g_signal + + var _arg0 *C.GDBusProxy // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.GVariant // out + + _arg0 = (*C.GDBusProxy)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(senderName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(signalName))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(parameters))) + + C._gotk4_gio2_DBusProxy_virtual_g_signal(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(proxy) + runtime.KeepAlive(senderName) + runtime.KeepAlive(signalName) + runtime.KeepAlive(parameters) +} + +// NewDBusProxy creates a proxy for accessing interface_name on the remote +// object at object_path owned by name at connection and asynchronously loads +// D-Bus properties unless the G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES flag is +// used. Connect to the BusProxy::g-properties-changed signal to get notified +// about property changes. +// +// If the G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS flag is not set, also sets +// up match rules for signals. Connect to the BusProxy::g-signal signal to +// handle signals from the remote object. +// +// If both G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES and +// G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS are set, this constructor is +// guaranteed to complete immediately without blocking. +// +// If name is a well-known name and the G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START and +// G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START_AT_CONSTRUCTION flags aren't set and no +// name owner currently exists, the message bus will be requested to launch a +// name owner for the name. +// +// This is a failable asynchronous constructor - when the proxy is ready, +// callback will be invoked and you can use g_dbus_proxy_new_finish() to get the +// result. +// +// See g_dbus_proxy_new_sync() and for a synchronous version of this +// constructor. +// +// BusProxy is used in this [example][gdbus-wellknown-proxy]. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - connection: BusConnection. +// - flags flags used when constructing the proxy. +// - info (optional) specifying the minimal interface that proxy conforms to +// or NULL. +// - name (optional) bus name (well-known or unique) or NULL if connection is +// not a message bus connection. +// - objectPath: object path. +// - interfaceName d-Bus interface name. +// - callback (optional): callback function to invoke when the proxy is ready. +func NewDBusProxy(ctx context.Context, connection *DBusConnection, flags DBusProxyFlags, info *DBusInterfaceInfo, name, objectPath, interfaceName string, callback AsyncReadyCallback) { + var _arg7 *C.GCancellable // out + var _arg1 *C.GDBusConnection // out + var _arg2 C.GDBusProxyFlags // out + var _arg3 *C.GDBusInterfaceInfo // out + var _arg4 *C.gchar // out + var _arg5 *C.gchar // out + var _arg6 *C.gchar // out + var _arg8 C.GAsyncReadyCallback // out + var _arg9 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg7 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = C.GDBusProxyFlags(flags) + if info != nil { + _arg3 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + } + if name != "" { + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg4)) + } + _arg5 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg5)) + _arg6 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg6)) + if callback != nil { + _arg8 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg9 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_proxy_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(flags) + runtime.KeepAlive(info) + runtime.KeepAlive(name) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceName) + runtime.KeepAlive(callback) +} + +// NewDBusProxyForBus: like g_dbus_proxy_new() but takes a Type instead of a +// BusConnection. +// +// BusProxy is used in this [example][gdbus-wellknown-proxy]. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - busType: Type. +// - flags flags used when constructing the proxy. +// - info (optional) specifying the minimal interface that proxy conforms to +// or NULL. +// - name bus name (well-known or unique). +// - objectPath: object path. +// - interfaceName d-Bus interface name. +// - callback (optional): callback function to invoke when the proxy is ready. +func NewDBusProxyForBus(ctx context.Context, busType BusType, flags DBusProxyFlags, info *DBusInterfaceInfo, name, objectPath, interfaceName string, callback AsyncReadyCallback) { + var _arg7 *C.GCancellable // out + var _arg1 C.GBusType // out + var _arg2 C.GDBusProxyFlags // out + var _arg3 *C.GDBusInterfaceInfo // out + var _arg4 *C.gchar // out + var _arg5 *C.gchar // out + var _arg6 *C.gchar // out + var _arg8 C.GAsyncReadyCallback // out + var _arg9 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg7 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GBusType(busType) + _arg2 = C.GDBusProxyFlags(flags) + if info != nil { + _arg3 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + } + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg4)) + _arg5 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg5)) + _arg6 = (*C.gchar)(unsafe.Pointer(C.CString(interfaceName))) + defer C.free(unsafe.Pointer(_arg6)) + if callback != nil { + _arg8 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg9 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_dbus_proxy_new_for_bus(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9) + runtime.KeepAlive(ctx) + runtime.KeepAlive(busType) + runtime.KeepAlive(flags) + runtime.KeepAlive(info) + runtime.KeepAlive(name) + runtime.KeepAlive(objectPath) + runtime.KeepAlive(interfaceName) + runtime.KeepAlive(callback) +} + +// DBusServer: GDBusServer is a helper for listening to and accepting +// D-Bus connections. This can be used to create a new D-Bus server, +// allowing two peers to use the D-Bus protocol for their own specialized +// communication. A server instance provided in this way will not perform +// message routing or implement the org.freedesktop.DBus interface +// (https://dbus.freedesktop.org/doc/dbus-specification.html#message-bus-messages). +// +// To just export an object on a well-known name on a message bus, such as the +// session or system bus, you should instead use gio.BusOwnName(). +// +// An example of peer-to-peer communication with +// GDBus can be found in gdbus-example-peer.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-example-peer.c). +// +// Note that a minimal GDBusServer will accept connections from any peer. In +// many use-cases it will be necessary to add a gio.DBusAuthObserver that only +// accepts connections that have successfully authenticated as the same user +// that is running the GDBusServer. Since GLib 2.68 this can be achieved more +// simply by passing the G_DBUS_SERVER_FLAGS_AUTHENTICATION_REQUIRE_SAME_USER +// flag to the server. +type DBusServer struct { + _ [0]func() // equal guard + *coreglib.Object + + Initable +} + +var ( + _ coreglib.Objector = (*DBusServer)(nil) +) + +func wrapDBusServer(obj *coreglib.Object) *DBusServer { + return &DBusServer{ + Object: obj, + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalDBusServer(p uintptr) (interface{}, error) { + return wrapDBusServer(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectNewConnection is emitted when a new authenticated connection has +// been made. Use g_dbus_connection_get_peer_credentials() to figure out what +// identity (if any), was authenticated. +// +// If you want to accept the connection, take a reference to the connection +// object and return TRUE. When you are done with the connection call +// g_dbus_connection_close() and give up your reference. Note that the other +// peer may disconnect at any time - a typical thing to do when accepting a +// connection is to listen to the BusConnection::closed signal. +// +// If BusServer:flags contains G_DBUS_SERVER_FLAGS_RUN_IN_THREAD then +// the signal is emitted in a new thread dedicated to the connection. +// Otherwise the signal is emitted in the [thread-default main +// context][g-main-context-push-thread-default] of the thread that server was +// constructed in. +// +// You are guaranteed that signal handlers for this signal runs before incoming +// messages on connection are processed. This means that it's suitable to call +// g_dbus_connection_register_object() or similar from the signal handler. +func (server *DBusServer) ConnectNewConnection(f func(connection *DBusConnection) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(server, "new-connection", false, unsafe.Pointer(C._gotk4_gio2_DBusServer_ConnectNewConnection), f) +} + +// NewDBusServerSync creates a new D-Bus server that listens on the first +// address in address that works. +// +// Once constructed, you can use g_dbus_server_get_client_address() to get a +// D-Bus address string that clients can use to connect. +// +// To have control over the available authentication mechanisms and the users +// that are authorized to connect, it is strongly recommended to provide a +// non-NULL BusAuthObserver. +// +// Connect to the BusServer::new-connection signal to handle incoming +// connections. +// +// The returned BusServer isn't active - you have to start it with +// g_dbus_server_start(). +// +// BusServer is used in this [example][gdbus-peer-to-peer]. +// +// This is a synchronous failable constructor. There is currently no +// asynchronous version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - address d-Bus address. +// - flags flags from the BusServerFlags enumeration. +// - guid d-Bus GUID. +// - observer (optional) or NULL. +// +// The function returns the following values: +// +// - dBusServer or NULL if error is set. Free with g_object_unref(). +func NewDBusServerSync(ctx context.Context, address string, flags DBusServerFlags, guid string, observer *DBusAuthObserver) (*DBusServer, error) { + var _arg5 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GDBusServerFlags // out + var _arg3 *C.gchar // out + var _arg4 *C.GDBusAuthObserver // out + var _cret *C.GDBusServer // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg5 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(address))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GDBusServerFlags(flags) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(guid))) + defer C.free(unsafe.Pointer(_arg3)) + if observer != nil { + _arg4 = (*C.GDBusAuthObserver)(unsafe.Pointer(coreglib.InternObject(observer).Native())) + } + + _cret = C.g_dbus_server_new_sync(_arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(flags) + runtime.KeepAlive(guid) + runtime.KeepAlive(observer) + + var _dBusServer *DBusServer // out + var _goerr error // out + + _dBusServer = wrapDBusServer(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusServer, _goerr +} + +// ClientAddress gets a D-Bus address +// (https://dbus.freedesktop.org/doc/dbus-specification.html#addresses) string +// that can be used by clients to connect to server. +// +// This is valid and non-empty if initializing the BusServer succeeded. +// +// The function returns the following values: +// +// - utf8 d-Bus address string. Do not free, the string is owned by server. +func (server *DBusServer) ClientAddress() string { + var _arg0 *C.GDBusServer // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusServer)(unsafe.Pointer(coreglib.InternObject(server).Native())) + + _cret = C.g_dbus_server_get_client_address(_arg0) + runtime.KeepAlive(server) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Flags gets the flags for server. +// +// The function returns the following values: +// +// - dBusServerFlags: set of flags from the BusServerFlags enumeration. +func (server *DBusServer) Flags() DBusServerFlags { + var _arg0 *C.GDBusServer // out + var _cret C.GDBusServerFlags // in + + _arg0 = (*C.GDBusServer)(unsafe.Pointer(coreglib.InternObject(server).Native())) + + _cret = C.g_dbus_server_get_flags(_arg0) + runtime.KeepAlive(server) + + var _dBusServerFlags DBusServerFlags // out + + _dBusServerFlags = DBusServerFlags(_cret) + + return _dBusServerFlags +} + +// GUID gets the GUID for server, as provided to g_dbus_server_new_sync(). +// +// The function returns the following values: +// +// - utf8 d-Bus GUID. Do not free this string, it is owned by server. +func (server *DBusServer) GUID() string { + var _arg0 *C.GDBusServer // out + var _cret *C.gchar // in + + _arg0 = (*C.GDBusServer)(unsafe.Pointer(coreglib.InternObject(server).Native())) + + _cret = C.g_dbus_server_get_guid(_arg0) + runtime.KeepAlive(server) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// IsActive gets whether server is active. +// +// The function returns the following values: +// +// - ok: TRUE if server is active, FALSE otherwise. +func (server *DBusServer) IsActive() bool { + var _arg0 *C.GDBusServer // out + var _cret C.gboolean // in + + _arg0 = (*C.GDBusServer)(unsafe.Pointer(coreglib.InternObject(server).Native())) + + _cret = C.g_dbus_server_is_active(_arg0) + runtime.KeepAlive(server) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Start starts server. +func (server *DBusServer) Start() { + var _arg0 *C.GDBusServer // out + + _arg0 = (*C.GDBusServer)(unsafe.Pointer(coreglib.InternObject(server).Native())) + + C.g_dbus_server_start(_arg0) + runtime.KeepAlive(server) +} + +// Stop stops server. +func (server *DBusServer) Stop() { + var _arg0 *C.GDBusServer // out + + _arg0 = (*C.GDBusServer)(unsafe.Pointer(coreglib.InternObject(server).Native())) + + C.g_dbus_server_stop(_arg0) + runtime.KeepAlive(server) +} + +// DataInputStreamOverrides contains methods that are overridable. +type DataInputStreamOverrides struct { +} + +func defaultDataInputStreamOverrides(v *DataInputStream) DataInputStreamOverrides { + return DataInputStreamOverrides{} +} + +// DataInputStream: data input stream implements gio.InputStream and includes +// functions for reading structured data directly from a binary input stream. +type DataInputStream struct { + _ [0]func() // equal guard + BufferedInputStream +} + +var ( + _ FilterInputStreamer = (*DataInputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*DataInputStream, *DataInputStreamClass, DataInputStreamOverrides]( + GTypeDataInputStream, + initDataInputStreamClass, + wrapDataInputStream, + defaultDataInputStreamOverrides, + ) +} + +func initDataInputStreamClass(gclass unsafe.Pointer, overrides DataInputStreamOverrides, classInitFunc func(*DataInputStreamClass)) { + if classInitFunc != nil { + class := (*DataInputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapDataInputStream(obj *coreglib.Object) *DataInputStream { + return &DataInputStream{ + BufferedInputStream: BufferedInputStream{ + FilterInputStream: FilterInputStream{ + InputStream: InputStream{ + Object: obj, + }, + }, + Seekable: Seekable{ + Object: obj, + }, + }, + } +} + +func marshalDataInputStream(p uintptr) (interface{}, error) { + return wrapDataInputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewDataInputStream creates a new data input stream for the base_stream. +// +// The function takes the following parameters: +// +// - baseStream: Stream. +// +// The function returns the following values: +// +// - dataInputStream: new InputStream. +func NewDataInputStream(baseStream InputStreamer) *DataInputStream { + var _arg1 *C.GInputStream // out + var _cret *C.GDataInputStream // in + + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(baseStream).Native())) + + _cret = C.g_data_input_stream_new(_arg1) + runtime.KeepAlive(baseStream) + + var _dataInputStream *DataInputStream // out + + _dataInputStream = wrapDataInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dataInputStream +} + +// ByteOrder gets the byte order for the data input stream. +// +// The function returns the following values: +// +// - dataStreamByteOrder stream's current StreamByteOrder. +func (stream *DataInputStream) ByteOrder() DataStreamByteOrder { + var _arg0 *C.GDataInputStream // out + var _cret C.GDataStreamByteOrder // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_data_input_stream_get_byte_order(_arg0) + runtime.KeepAlive(stream) + + var _dataStreamByteOrder DataStreamByteOrder // out + + _dataStreamByteOrder = DataStreamByteOrder(_cret) + + return _dataStreamByteOrder +} + +// NewlineType gets the current newline type for the stream. +// +// The function returns the following values: +// +// - dataStreamNewlineType for the given stream. +func (stream *DataInputStream) NewlineType() DataStreamNewlineType { + var _arg0 *C.GDataInputStream // out + var _cret C.GDataStreamNewlineType // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_data_input_stream_get_newline_type(_arg0) + runtime.KeepAlive(stream) + + var _dataStreamNewlineType DataStreamNewlineType // out + + _dataStreamNewlineType = DataStreamNewlineType(_cret) + + return _dataStreamNewlineType +} + +// ReadByte reads an unsigned 8-bit/1-byte value from stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - guint8: unsigned 8-bit/1-byte value read from the stream or 0 if an error +// occurred. +func (stream *DataInputStream) ReadByte(ctx context.Context) (byte, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GCancellable // out + var _cret C.guchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_data_input_stream_read_byte(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _guint8 byte // out + var _goerr error // out + + _guint8 = byte(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint8, _goerr +} + +// ReadInt16 reads a 16-bit/2-byte value from stream. +// +// In order to get the correct byte order for this read +// operation, see g_data_input_stream_get_byte_order() and +// g_data_input_stream_set_byte_order(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - gint16: signed 16-bit/2-byte value read from stream or 0 if an error +// occurred. +func (stream *DataInputStream) ReadInt16(ctx context.Context) (int16, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GCancellable // out + var _cret C.gint16 // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_data_input_stream_read_int16(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _gint16 int16 // out + var _goerr error // out + + _gint16 = int16(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint16, _goerr +} + +// ReadInt32 reads a signed 32-bit/4-byte value from stream. +// +// In order to get the correct byte order for this read +// operation, see g_data_input_stream_get_byte_order() and +// g_data_input_stream_set_byte_order(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - gint32: signed 32-bit/4-byte value read from the stream or 0 if an error +// occurred. +func (stream *DataInputStream) ReadInt32(ctx context.Context) (int32, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GCancellable // out + var _cret C.gint32 // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_data_input_stream_read_int32(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _gint32 int32 // out + var _goerr error // out + + _gint32 = int32(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint32, _goerr +} + +// ReadInt64 reads a 64-bit/8-byte value from stream. +// +// In order to get the correct byte order for this read +// operation, see g_data_input_stream_get_byte_order() and +// g_data_input_stream_set_byte_order(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - gint64: signed 64-bit/8-byte value read from stream or 0 if an error +// occurred. +func (stream *DataInputStream) ReadInt64(ctx context.Context) (int64, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GCancellable // out + var _cret C.gint64 // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_data_input_stream_read_int64(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _gint64 int64 // out + var _goerr error // out + + _gint64 = int64(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint64, _goerr +} + +// ReadLine reads a line from the data input stream. Note that no encoding +// checks or conversion is performed; the input is not guaranteed to be UTF-8, +// and may in fact have embedded NUL characters. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - length (optional) to get the length of the data read in. +// - guint8s (optional): a NUL terminated byte array with the line that was +// read in (without the newlines). Set length to a #gsize to get the length +// of the read line. On an error, it will return NULL and error will be set. +// If there's no content to read, it will still return NULL, but error won't +// be set. +func (stream *DataInputStream) ReadLine(ctx context.Context) (uint, []byte, error) { + var _arg0 *C.GDataInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gsize // in + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_data_input_stream_read_line(_arg0, &_arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _length uint // out + var _guint8s []byte // out + var _goerr error // out + + _length = uint(_arg1) + if _cret != nil { + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _guint8s = make([]byte, i) + for i := range src { + _guint8s[i] = byte(src[i]) + } + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _guint8s, _goerr +} + +// ReadLineAsync asynchronous version of g_data_input_stream_read_line(). +// It is an error to have two outstanding calls to this function. +// +// When the operation is finished, callback will be called. You can then call +// g_data_input_stream_read_line_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (stream *DataInputStream) ReadLineAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GDataInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gint // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gint(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_data_input_stream_read_line_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadLineFinish: finish an asynchronous call started by +// g_data_input_stream_read_line_async(). Note the warning about string encoding +// in g_data_input_stream_read_line() applies here as well. +// +// The function takes the following parameters: +// +// - result that was provided to the callback. +// +// The function returns the following values: +// +// - length (optional) to get the length of the data read in. +// - guint8s (optional): a NUL-terminated byte array with the line that was +// read in (without the newlines). Set length to a #gsize to get the length +// of the read line. On an error, it will return NULL and error will be set. +// If there's no content to read, it will still return NULL, but error won't +// be set. +func (stream *DataInputStream) ReadLineFinish(result AsyncResulter) (uint, []byte, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.gsize // in + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_data_input_stream_read_line_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _length uint // out + var _guint8s []byte // out + var _goerr error // out + + _length = uint(_arg2) + if _cret != nil { + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _guint8s = make([]byte, i) + for i := range src { + _guint8s[i] = byte(src[i]) + } + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _guint8s, _goerr +} + +// ReadLineFinishUTF8: finish an asynchronous call started by +// g_data_input_stream_read_line_async(). +// +// The function takes the following parameters: +// +// - result that was provided to the callback. +// +// The function returns the following values: +// +// - length (optional) to get the length of the data read in. +// - utf8 (optional): string with the line that was read in (without the +// newlines). Set length to a #gsize to get the length of the read line. On +// an error, it will return NULL and error will be set. For UTF-8 conversion +// errors, the set error domain is G_CONVERT_ERROR. If there's no content to +// read, it will still return NULL, but error won't be set. +func (stream *DataInputStream) ReadLineFinishUTF8(result AsyncResulter) (uint, string, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.gsize // in + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_data_input_stream_read_line_finish_utf8(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _length uint // out + var _utf8 string // out + var _goerr error // out + + _length = uint(_arg2) + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _utf8, _goerr +} + +// ReadLineUTF8 reads a UTF-8 encoded line from the data input stream. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - length (optional) to get the length of the data read in. +// - utf8 (optional): NUL terminated UTF-8 string with the line that was read +// in (without the newlines). Set length to a #gsize to get the length of +// the read line. On an error, it will return NULL and error will be set. +// For UTF-8 conversion errors, the set error domain is G_CONVERT_ERROR. +// If there's no content to read, it will still return NULL, but error won't +// be set. +func (stream *DataInputStream) ReadLineUTF8(ctx context.Context) (uint, string, error) { + var _arg0 *C.GDataInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gsize // in + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_data_input_stream_read_line_utf8(_arg0, &_arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _length uint // out + var _utf8 string // out + var _goerr error // out + + _length = uint(_arg1) + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _utf8, _goerr +} + +// ReadUint16 reads an unsigned 16-bit/2-byte value from stream. +// +// In order to get the correct byte order for this read +// operation, see g_data_input_stream_get_byte_order() and +// g_data_input_stream_set_byte_order(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - guint16: unsigned 16-bit/2-byte value read from the stream or 0 if an +// error occurred. +func (stream *DataInputStream) ReadUint16(ctx context.Context) (uint16, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GCancellable // out + var _cret C.guint16 // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_data_input_stream_read_uint16(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _guint16 uint16 // out + var _goerr error // out + + _guint16 = uint16(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint16, _goerr +} + +// ReadUint32 reads an unsigned 32-bit/4-byte value from stream. +// +// In order to get the correct byte order for this read +// operation, see g_data_input_stream_get_byte_order() and +// g_data_input_stream_set_byte_order(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - guint32: unsigned 32-bit/4-byte value read from the stream or 0 if an +// error occurred. +func (stream *DataInputStream) ReadUint32(ctx context.Context) (uint32, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GCancellable // out + var _cret C.guint32 // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_data_input_stream_read_uint32(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _guint32 uint32 // out + var _goerr error // out + + _guint32 = uint32(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint32, _goerr +} + +// ReadUint64 reads an unsigned 64-bit/8-byte value from stream. +// +// In order to get the correct byte order for this read operation, see +// g_data_input_stream_get_byte_order(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - guint64: unsigned 64-bit/8-byte read from stream or 0 if an error +// occurred. +func (stream *DataInputStream) ReadUint64(ctx context.Context) (uint64, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GCancellable // out + var _cret C.guint64 // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_data_input_stream_read_uint64(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _guint64 uint64 // out + var _goerr error // out + + _guint64 = uint64(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint64, _goerr +} + +// ReadUntil reads a string from the data input stream, up to the first +// occurrence of any of the stop characters. +// +// Note that, in contrast to g_data_input_stream_read_until_async(), this +// function consumes the stop character that it finds. +// +// Don't use this function in new code. Its functionality is inconsistent with +// g_data_input_stream_read_until_async(). Both functions will be marked as +// deprecated in a future release. Use g_data_input_stream_read_upto() instead, +// but note that that function does not consume the stop character. +// +// Deprecated: Use g_data_input_stream_read_upto() instead, which has more +// consistent behaviour regarding the stop character. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - stopChars characters to terminate the read. +// +// The function returns the following values: +// +// - length (optional) to get the length of the data read in. +// - utf8: string with the data that was read before encountering any of the +// stop characters. Set length to a #gsize to get the length of the string. +// This function will return NULL on an error. +func (stream *DataInputStream) ReadUntil(ctx context.Context, stopChars string) (uint, string, error) { + var _arg0 *C.GDataInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.gsize // in + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(stopChars))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_data_input_stream_read_until(_arg0, _arg1, &_arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stopChars) + + var _length uint // out + var _utf8 string // out + var _goerr error // out + + _length = uint(_arg2) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _utf8, _goerr +} + +// ReadUntilAsync asynchronous version of g_data_input_stream_read_until(). +// It is an error to have two outstanding calls to this function. +// +// Note that, in contrast to g_data_input_stream_read_until(), this function +// does not consume the stop character that it finds. You must read it for +// yourself. +// +// When the operation is finished, callback will be called. You can then call +// g_data_input_stream_read_until_finish() to get the result of the operation. +// +// Don't use this function in new code. Its functionality is inconsistent with +// g_data_input_stream_read_until(). Both functions will be marked as deprecated +// in a future release. Use g_data_input_stream_read_upto_async() instead. +// +// Deprecated: Use g_data_input_stream_read_upto_async() instead, which has more +// consistent behaviour regarding the stop character. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - stopChars characters to terminate the read. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (stream *DataInputStream) ReadUntilAsync(ctx context.Context, stopChars string, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GDataInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.gint // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(stopChars))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_data_input_stream_read_until_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stopChars) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadUntilFinish: finish an asynchronous call started by +// g_data_input_stream_read_until_async(). +// +// Deprecated: Use g_data_input_stream_read_upto_finish() instead, which has +// more consistent behaviour regarding the stop character. +// +// The function takes the following parameters: +// +// - result that was provided to the callback. +// +// The function returns the following values: +// +// - length (optional) to get the length of the data read in. +// - utf8: string with the data that was read before encountering any of the +// stop characters. Set length to a #gsize to get the length of the string. +// This function will return NULL on an error. +func (stream *DataInputStream) ReadUntilFinish(result AsyncResulter) (uint, string, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.gsize // in + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_data_input_stream_read_until_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _length uint // out + var _utf8 string // out + var _goerr error // out + + _length = uint(_arg2) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _utf8, _goerr +} + +// ReadUpto reads a string from the data input stream, up to the first +// occurrence of any of the stop characters. +// +// In contrast to g_data_input_stream_read_until(), this function does not +// consume the stop character. You have to use g_data_input_stream_read_byte() +// to get it before calling g_data_input_stream_read_upto() again. +// +// Note that stop_chars may contain '\0' if stop_chars_len is specified. +// +// The returned string will always be nul-terminated on success. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - stopChars characters to terminate the read. +// +// The function returns the following values: +// +// - length (optional) to get the length of the data read in. +// - utf8: string with the data that was read before encountering any of the +// stop characters. Set length to a #gsize to get the length of the string. +// This function will return NULL on an error. +func (stream *DataInputStream) ReadUpto(ctx context.Context, stopChars string) (uint, string, error) { + var _arg0 *C.GDataInputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 C.gsize // in + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gssize)(len(stopChars)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(stopChars) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(stopChars)), stopChars) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_data_input_stream_read_upto(_arg0, _arg1, _arg2, &_arg3, _arg4, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stopChars) + + var _length uint // out + var _utf8 string // out + var _goerr error // out + + _length = uint(_arg3) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _utf8, _goerr +} + +// ReadUptoAsync asynchronous version of g_data_input_stream_read_upto(). +// It is an error to have two outstanding calls to this function. +// +// In contrast to g_data_input_stream_read_until(), this function does not +// consume the stop character. You have to use g_data_input_stream_read_byte() +// to get it before calling g_data_input_stream_read_upto() again. +// +// Note that stop_chars may contain '\0' if stop_chars_len is specified. +// +// When the operation is finished, callback will be called. You can then call +// g_data_input_stream_read_upto_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - stopChars characters to terminate the read. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the request is satisfied. +func (stream *DataInputStream) ReadUptoAsync(ctx context.Context, stopChars string, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GDataInputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 C.gint // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gssize)(len(stopChars)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(stopChars) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(stopChars)), stopChars) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = C.gint(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_data_input_stream_read_upto_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stopChars) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadUptoFinish: finish an asynchronous call started by +// g_data_input_stream_read_upto_async(). +// +// Note that this function does not consume the stop character. +// You have to use g_data_input_stream_read_byte() to get it before calling +// g_data_input_stream_read_upto_async() again. +// +// The returned string will always be nul-terminated on success. +// +// The function takes the following parameters: +// +// - result that was provided to the callback. +// +// The function returns the following values: +// +// - length (optional) to get the length of the data read in. +// - utf8: string with the data that was read before encountering any of the +// stop characters. Set length to a #gsize to get the length of the string. +// This function will return NULL on an error. +func (stream *DataInputStream) ReadUptoFinish(result AsyncResulter) (uint, string, error) { + var _arg0 *C.GDataInputStream // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.gsize // in + var _cret *C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_data_input_stream_read_upto_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _length uint // out + var _utf8 string // out + var _goerr error // out + + _length = uint(_arg2) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _utf8, _goerr +} + +// SetByteOrder: this function sets the byte order for the given stream. +// All subsequent reads from the stream will be read in the given order. +// +// The function takes the following parameters: +// +// - order to set. +func (stream *DataInputStream) SetByteOrder(order DataStreamByteOrder) { + var _arg0 *C.GDataInputStream // out + var _arg1 C.GDataStreamByteOrder // out + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = C.GDataStreamByteOrder(order) + + C.g_data_input_stream_set_byte_order(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(order) +} + +// SetNewlineType sets the newline type for the stream. +// +// Note that using G_DATA_STREAM_NEWLINE_TYPE_ANY is slightly unsafe. If a read +// chunk ends in "CR" we must read an additional byte to know if this is "CR" or +// "CR LF", and this might block if there is no more data available. +// +// The function takes the following parameters: +// +// - typ: type of new line return as StreamNewlineType. +func (stream *DataInputStream) SetNewlineType(typ DataStreamNewlineType) { + var _arg0 *C.GDataInputStream // out + var _arg1 C.GDataStreamNewlineType // out + + _arg0 = (*C.GDataInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = C.GDataStreamNewlineType(typ) + + C.g_data_input_stream_set_newline_type(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(typ) +} + +// DataOutputStreamOverrides contains methods that are overridable. +type DataOutputStreamOverrides struct { +} + +func defaultDataOutputStreamOverrides(v *DataOutputStream) DataOutputStreamOverrides { + return DataOutputStreamOverrides{} +} + +// DataOutputStream: data output stream implements gio.OutputStream and includes +// functions for writing data directly to an output stream. +type DataOutputStream struct { + _ [0]func() // equal guard + FilterOutputStream + + Seekable +} + +var ( + _ FilterOutputStreamer = (*DataOutputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*DataOutputStream, *DataOutputStreamClass, DataOutputStreamOverrides]( + GTypeDataOutputStream, + initDataOutputStreamClass, + wrapDataOutputStream, + defaultDataOutputStreamOverrides, + ) +} + +func initDataOutputStreamClass(gclass unsafe.Pointer, overrides DataOutputStreamOverrides, classInitFunc func(*DataOutputStreamClass)) { + if classInitFunc != nil { + class := (*DataOutputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapDataOutputStream(obj *coreglib.Object) *DataOutputStream { + return &DataOutputStream{ + FilterOutputStream: FilterOutputStream{ + OutputStream: OutputStream{ + Object: obj, + }, + }, + Seekable: Seekable{ + Object: obj, + }, + } +} + +func marshalDataOutputStream(p uintptr) (interface{}, error) { + return wrapDataOutputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewDataOutputStream creates a new data output stream for base_stream. +// +// The function takes the following parameters: +// +// - baseStream: Stream. +// +// The function returns the following values: +// +// - dataOutputStream: OutputStream. +func NewDataOutputStream(baseStream OutputStreamer) *DataOutputStream { + var _arg1 *C.GOutputStream // out + var _cret *C.GDataOutputStream // in + + _arg1 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(baseStream).Native())) + + _cret = C.g_data_output_stream_new(_arg1) + runtime.KeepAlive(baseStream) + + var _dataOutputStream *DataOutputStream // out + + _dataOutputStream = wrapDataOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dataOutputStream +} + +// ByteOrder gets the byte order for the stream. +// +// The function returns the following values: +// +// - dataStreamByteOrder for the stream. +func (stream *DataOutputStream) ByteOrder() DataStreamByteOrder { + var _arg0 *C.GDataOutputStream // out + var _cret C.GDataStreamByteOrder // in + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_data_output_stream_get_byte_order(_arg0) + runtime.KeepAlive(stream) + + var _dataStreamByteOrder DataStreamByteOrder // out + + _dataStreamByteOrder = DataStreamByteOrder(_cret) + + return _dataStreamByteOrder +} + +// PutByte puts a byte into the output stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - data: #guchar. +func (stream *DataOutputStream) PutByte(ctx context.Context, data byte) error { + var _arg0 *C.GDataOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.guchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.guchar(data) + + C.g_data_output_stream_put_byte(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PutInt16 puts a signed 16-bit integer into the output stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - data: #gint16. +func (stream *DataOutputStream) PutInt16(ctx context.Context, data int16) error { + var _arg0 *C.GDataOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gint16 // out + var _cerr *C.GError // in + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gint16(data) + + C.g_data_output_stream_put_int16(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PutInt32 puts a signed 32-bit integer into the output stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - data: #gint32. +func (stream *DataOutputStream) PutInt32(ctx context.Context, data int32) error { + var _arg0 *C.GDataOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gint32 // out + var _cerr *C.GError // in + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gint32(data) + + C.g_data_output_stream_put_int32(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PutInt64 puts a signed 64-bit integer into the stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - data: #gint64. +func (stream *DataOutputStream) PutInt64(ctx context.Context, data int64) error { + var _arg0 *C.GDataOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gint64 // out + var _cerr *C.GError // in + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gint64(data) + + C.g_data_output_stream_put_int64(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PutString puts a string into the output stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - str: string. +func (stream *DataOutputStream) PutString(ctx context.Context, str string) error { + var _arg0 *C.GDataOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_data_output_stream_put_string(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(str) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PutUint16 puts an unsigned 16-bit integer into the output stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - data: #guint16. +func (stream *DataOutputStream) PutUint16(ctx context.Context, data uint16) error { + var _arg0 *C.GDataOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.guint16 // out + var _cerr *C.GError // in + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.guint16(data) + + C.g_data_output_stream_put_uint16(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PutUint32 puts an unsigned 32-bit integer into the stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - data: #guint32. +func (stream *DataOutputStream) PutUint32(ctx context.Context, data uint32) error { + var _arg0 *C.GDataOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.guint32 // out + var _cerr *C.GError // in + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.guint32(data) + + C.g_data_output_stream_put_uint32(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PutUint64 puts an unsigned 64-bit integer into the stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - data: #guint64. +func (stream *DataOutputStream) PutUint64(ctx context.Context, data uint64) error { + var _arg0 *C.GDataOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.guint64 // out + var _cerr *C.GError // in + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.guint64(data) + + C.g_data_output_stream_put_uint64(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetByteOrder sets the byte order of the data output stream to order. +// +// The function takes the following parameters: +// +// - order: GDataStreamByteOrder. +func (stream *DataOutputStream) SetByteOrder(order DataStreamByteOrder) { + var _arg0 *C.GDataOutputStream // out + var _arg1 C.GDataStreamByteOrder // out + + _arg0 = (*C.GDataOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = C.GDataStreamByteOrder(order) + + C.g_data_output_stream_set_byte_order(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(order) +} + +// DebugControllerDBusOverrides contains methods that are overridable. +type DebugControllerDBusOverrides struct { + // Authorize: default handler for the ControllerDBus::authorize signal. + Authorize func(invocation *DBusMethodInvocation) bool +} + +func defaultDebugControllerDBusOverrides(v *DebugControllerDBus) DebugControllerDBusOverrides { + return DebugControllerDBusOverrides{ + Authorize: v.authorize, + } +} + +// DebugControllerDBus: GDebugControllerDBus is an implementation of +// gio.DebugController which exposes debug settings as a D-Bus object. +// +// It is a gio.Initable object, and will register an object at +// /org/gtk/Debugging on the bus given as gio.DebugControllerDBus:connection +// once it’s initialized. The object will be unregistered when the last +// reference to the GDebugControllerDBus is dropped. +// +// This D-Bus object can be used by remote processes to enable or +// disable debug output in this process. Remote processes calling +// org.gtk.Debugging.SetDebugEnabled() will affect the value of +// gio.DebugController:debug-enabled and, by default, glib.LogGetDebugEnabled(). +// +// By default, no processes are allowed to call SetDebugEnabled() unless a +// gio.DebugControllerDBus::authorize signal handler is installed. This is +// because the process may be privileged, or might expose sensitive information +// in its debug output. You may want to restrict the ability to enable debug +// output to privileged users or processes. +// +// One option is to install a D-Bus security policy which restricts +// access to SetDebugEnabled(), installing something like the following in +// $datadir/dbus-1/system.d/: +// +// +// +// +// +// +// +// +// +// +// +// +// This will prevent the SetDebugEnabled() method from being called by all +// except root. It will not prevent the DebugEnabled property from being read, +// as it’s accessed through the org.freedesktop.DBus.Properties interface. +// +// Another option is to use polkit to allow or deny requests on a case-by-case +// basis, allowing for the possibility of dynamic authorisation. To do this, +// connect to the gio.DebugControllerDBus::authorize signal and query polkit in +// it: +// +// g_autoptr(GError) child_error = NULL; +// g_autoptr(GDBusConnection) connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); +// gulong debug_controller_authorize_id = 0; +// +// // Set up the debug controller. +// debug_controller = G_DEBUG_CONTROLLER (g_debug_controller_dbus_new (priv->connection, NULL, &child_error)); +// if (debug_controller == NULL) +// { +// g_error ("Could not register debug controller on bus: s"), +// child_error->message); +// } +// +// debug_controller_authorize_id = g_signal_connect (debug_controller, +// "authorize", +// G_CALLBACK (debug_controller_authorize_cb), +// self); +// +// static gboolean +// debug_controller_authorize_cb (GDebugControllerDBus *debug_controller, +// GDBusMethodInvocation *invocation, +// gpointer user_data) +// { +// g_autoptr(PolkitAuthority) authority = NULL; +// g_autoptr(PolkitSubject) subject = NULL; +// g_autoptr(PolkitAuthorizationResult) auth_result = NULL; +// g_autoptr(GError) local_error = NULL; +// GDBusMessage *message; +// GDBusMessageFlags message_flags; +// PolkitCheckAuthorizationFlags flags = POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE; +// +// message = g_dbus_method_invocation_get_message (invocation); +// message_flags = g_dbus_message_get_flags (message); +// +// authority = polkit_authority_get_sync (NULL, &local_error); +// if (authority == NULL) +// { +// g_warning ("Failed to get polkit authority: s", local_error->message); +// return FALSE; +// } +// +// if (message_flags & G_DBUS_MESSAGE_FLAGS_ALLOW_INTERACTIVE_AUTHORIZATION) +// flags |= POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION; +// +// subject = polkit_system_bus_name_new (g_dbus_method_invocation_get_sender (invocation)); +// +// auth_result = polkit_authority_check_authorization_sync (authority, +// subject, +// "com.example.MyService.set-debug-enabled", +// NULL, +// flags, +// NULL, +// &local_error); +// if (auth_result == NULL) +// { +// g_warning ("Failed to get check polkit authorization: s", local_error->message); +// return FALSE; +// } +// +// return polkit_authorization_result_get_is_authorized (auth_result); +// }. +type DebugControllerDBus struct { + _ [0]func() // equal guard + *coreglib.Object + + DebugController +} + +var ( + _ coreglib.Objector = (*DebugControllerDBus)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*DebugControllerDBus, *DebugControllerDBusClass, DebugControllerDBusOverrides]( + GTypeDebugControllerDBus, + initDebugControllerDBusClass, + wrapDebugControllerDBus, + defaultDebugControllerDBusOverrides, + ) +} + +func initDebugControllerDBusClass(gclass unsafe.Pointer, overrides DebugControllerDBusOverrides, classInitFunc func(*DebugControllerDBusClass)) { + pclass := (*C.GDebugControllerDBusClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeDebugControllerDBus)))) + + if overrides.Authorize != nil { + pclass.authorize = (*[0]byte)(C._gotk4_gio2_DebugControllerDBusClass_authorize) + } + + if classInitFunc != nil { + class := (*DebugControllerDBusClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapDebugControllerDBus(obj *coreglib.Object) *DebugControllerDBus { + return &DebugControllerDBus{ + Object: obj, + DebugController: DebugController{ + Initable: Initable{ + Object: obj, + }, + }, + } +} + +func marshalDebugControllerDBus(p uintptr) (interface{}, error) { + return wrapDebugControllerDBus(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectAuthorize is emitted when a D-Bus peer is trying to change the debug +// settings and used to determine if that is authorized. +// +// This signal is emitted in a dedicated worker thread, so handlers are allowed +// to perform blocking I/O. This means that, for example, it is appropriate to +// call polkit_authority_check_authorization_sync() to check authorization using +// polkit. +// +// If FALSE is returned then no further handlers are run and the request to +// change the debug settings is rejected. +// +// Otherwise, if TRUE is returned, signal emission continues. If no handlers +// return FALSE, then the debug settings are allowed to be changed. +// +// Signal handlers must not modify invocation, or cause it to return a value. +// +// The default class handler just returns TRUE. +func (self *DebugControllerDBus) ConnectAuthorize(f func(invocation *DBusMethodInvocation) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(self, "authorize", false, unsafe.Pointer(C._gotk4_gio2_DebugControllerDBus_ConnectAuthorize), f) +} + +// NewDebugControllerDBus: create a new ControllerDBus and synchronously +// initialize it. +// +// Initializing the object will export the debug object on connection. The +// object will remain registered until the last reference to the ControllerDBus +// is dropped. +// +// Initialization may fail if registering the object on connection fails. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - connection to register the debug object on. +// +// The function returns the following values: +// +// - debugControllerDBus (optional): new ControllerDBus, or NULL on failure. +func NewDebugControllerDBus(ctx context.Context, connection *DBusConnection) (*DebugControllerDBus, error) { + var _arg2 *C.GCancellable // out + var _arg1 *C.GDBusConnection // out + var _cret *C.GDebugControllerDBus // in + var _cerr *C.GError // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_debug_controller_dbus_new(_arg1, _arg2, &_cerr) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + + var _debugControllerDBus *DebugControllerDBus // out + var _goerr error // out + + if _cret != nil { + _debugControllerDBus = wrapDebugControllerDBus(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _debugControllerDBus, _goerr +} + +// Stop the debug controller, unregistering its object from the bus. +// +// Any pending method calls to the object will complete successfully, +// but new ones will return an error. This method will block until all +// pending ControllerDBus::authorize signals have been handled. This is +// expected to not take long, as it will just be waiting for threads to join. +// If any ControllerDBus::authorize signal handlers are still executing in other +// threads, this will block until after they have returned. +// +// This method will be called automatically when the final reference to the +// ControllerDBus is dropped. You may want to call it explicitly to know when +// the controller has been fully removed from the bus, or to break reference +// count cycles. +// +// Calling this method from within a ControllerDBus::authorize signal handler +// will cause a deadlock and must not be done. +func (self *DebugControllerDBus) Stop() { + var _arg0 *C.GDebugControllerDBus // out + + _arg0 = (*C.GDebugControllerDBus)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.g_debug_controller_dbus_stop(_arg0) + runtime.KeepAlive(self) +} + +// Authorize: default handler for the ControllerDBus::authorize signal. +func (controller *DebugControllerDBus) authorize(invocation *DBusMethodInvocation) bool { + gclass := (*C.GDebugControllerDBusClass)(coreglib.PeekParentClass(controller)) + fnarg := gclass.authorize + + var _arg0 *C.GDebugControllerDBus // out + var _arg1 *C.GDBusMethodInvocation // out + var _cret C.gboolean // in + + _arg0 = (*C.GDebugControllerDBus)(unsafe.Pointer(coreglib.InternObject(controller).Native())) + _arg1 = (*C.GDBusMethodInvocation)(unsafe.Pointer(coreglib.InternObject(invocation).Native())) + + _cret = C._gotk4_gio2_DebugControllerDBus_virtual_authorize(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(controller) + runtime.KeepAlive(invocation) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Emblem: GEmblem is an implementation of gio.Icon that supports having an +// emblem, which is an icon with additional properties. It can than be added to +// a gio.EmblemedIcon. +// +// Currently, only metainformation about the emblem's origin is supported. +// More may be added in the future. +type Emblem struct { + _ [0]func() // equal guard + *coreglib.Object + + Icon +} + +var ( + _ coreglib.Objector = (*Emblem)(nil) +) + +func wrapEmblem(obj *coreglib.Object) *Emblem { + return &Emblem{ + Object: obj, + Icon: Icon{ + Object: obj, + }, + } +} + +func marshalEmblem(p uintptr) (interface{}, error) { + return wrapEmblem(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewEmblem creates a new emblem for icon. +// +// The function takes the following parameters: +// +// - icon: GIcon containing the icon. +// +// The function returns the following values: +// +// - emblem: new #GEmblem. +func NewEmblem(icon Iconner) *Emblem { + var _arg1 *C.GIcon // out + var _cret *C.GEmblem // in + + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + _cret = C.g_emblem_new(_arg1) + runtime.KeepAlive(icon) + + var _emblem *Emblem // out + + _emblem = wrapEmblem(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _emblem +} + +// NewEmblemWithOrigin creates a new emblem for icon. +// +// The function takes the following parameters: +// +// - icon: GIcon containing the icon. +// - origin: GEmblemOrigin enum defining the emblem's origin. +// +// The function returns the following values: +// +// - emblem: new #GEmblem. +func NewEmblemWithOrigin(icon Iconner, origin EmblemOrigin) *Emblem { + var _arg1 *C.GIcon // out + var _arg2 C.GEmblemOrigin // out + var _cret *C.GEmblem // in + + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + _arg2 = C.GEmblemOrigin(origin) + + _cret = C.g_emblem_new_with_origin(_arg1, _arg2) + runtime.KeepAlive(icon) + runtime.KeepAlive(origin) + + var _emblem *Emblem // out + + _emblem = wrapEmblem(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _emblem +} + +// GetIcon gives back the icon from emblem. +// +// The function returns the following values: +// +// - icon The returned object belongs to the emblem and should not be modified +// or freed. +func (emblem *Emblem) GetIcon() *Icon { + var _arg0 *C.GEmblem // out + var _cret *C.GIcon // in + + _arg0 = (*C.GEmblem)(unsafe.Pointer(coreglib.InternObject(emblem).Native())) + + _cret = C.g_emblem_get_icon(_arg0) + runtime.KeepAlive(emblem) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.Take(unsafe.Pointer(_cret))) + + return _icon +} + +// Origin gets the origin of the emblem. +// +// The function returns the following values: +// +// - emblemOrigin: origin of the emblem. +func (emblem *Emblem) Origin() EmblemOrigin { + var _arg0 *C.GEmblem // out + var _cret C.GEmblemOrigin // in + + _arg0 = (*C.GEmblem)(unsafe.Pointer(coreglib.InternObject(emblem).Native())) + + _cret = C.g_emblem_get_origin(_arg0) + runtime.KeepAlive(emblem) + + var _emblemOrigin EmblemOrigin // out + + _emblemOrigin = EmblemOrigin(_cret) + + return _emblemOrigin +} + +// EmblemedIconOverrides contains methods that are overridable. +type EmblemedIconOverrides struct { +} + +func defaultEmblemedIconOverrides(v *EmblemedIcon) EmblemedIconOverrides { + return EmblemedIconOverrides{} +} + +// EmblemedIcon: GEmblemedIcon is an implementation of gio.Icon that supports +// adding an emblem to an icon. Adding multiple emblems to an icon is ensured +// via gio.EmblemedIcon.AddEmblem(). +// +// Note that GEmblemedIcon allows no control over the position of the emblems. +// See also gio.Emblem for more information. +type EmblemedIcon struct { + _ [0]func() // equal guard + *coreglib.Object + + Icon +} + +var ( + _ coreglib.Objector = (*EmblemedIcon)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*EmblemedIcon, *EmblemedIconClass, EmblemedIconOverrides]( + GTypeEmblemedIcon, + initEmblemedIconClass, + wrapEmblemedIcon, + defaultEmblemedIconOverrides, + ) +} + +func initEmblemedIconClass(gclass unsafe.Pointer, overrides EmblemedIconOverrides, classInitFunc func(*EmblemedIconClass)) { + if classInitFunc != nil { + class := (*EmblemedIconClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapEmblemedIcon(obj *coreglib.Object) *EmblemedIcon { + return &EmblemedIcon{ + Object: obj, + Icon: Icon{ + Object: obj, + }, + } +} + +func marshalEmblemedIcon(p uintptr) (interface{}, error) { + return wrapEmblemedIcon(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewEmblemedIcon creates a new emblemed icon for icon with the emblem emblem. +// +// The function takes the following parameters: +// +// - icon: #GIcon. +// - emblem (optional) or NULL. +// +// The function returns the following values: +// +// - emblemedIcon: new #GIcon. +func NewEmblemedIcon(icon Iconner, emblem *Emblem) *EmblemedIcon { + var _arg1 *C.GIcon // out + var _arg2 *C.GEmblem // out + var _cret *C.GIcon // in + + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + if emblem != nil { + _arg2 = (*C.GEmblem)(unsafe.Pointer(coreglib.InternObject(emblem).Native())) + } + + _cret = C.g_emblemed_icon_new(_arg1, _arg2) + runtime.KeepAlive(icon) + runtime.KeepAlive(emblem) + + var _emblemedIcon *EmblemedIcon // out + + _emblemedIcon = wrapEmblemedIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _emblemedIcon +} + +// AddEmblem adds emblem to the #GList of #GEmblems. +// +// The function takes the following parameters: +// +// - emblem: #GEmblem. +func (emblemed *EmblemedIcon) AddEmblem(emblem *Emblem) { + var _arg0 *C.GEmblemedIcon // out + var _arg1 *C.GEmblem // out + + _arg0 = (*C.GEmblemedIcon)(unsafe.Pointer(coreglib.InternObject(emblemed).Native())) + _arg1 = (*C.GEmblem)(unsafe.Pointer(coreglib.InternObject(emblem).Native())) + + C.g_emblemed_icon_add_emblem(_arg0, _arg1) + runtime.KeepAlive(emblemed) + runtime.KeepAlive(emblem) +} + +// ClearEmblems removes all the emblems from icon. +func (emblemed *EmblemedIcon) ClearEmblems() { + var _arg0 *C.GEmblemedIcon // out + + _arg0 = (*C.GEmblemedIcon)(unsafe.Pointer(coreglib.InternObject(emblemed).Native())) + + C.g_emblemed_icon_clear_emblems(_arg0) + runtime.KeepAlive(emblemed) +} + +// Emblems gets the list of emblems for the icon. +// +// The function returns the following values: +// +// - list of #GEmblems that is owned by emblemed. +func (emblemed *EmblemedIcon) Emblems() []*Emblem { + var _arg0 *C.GEmblemedIcon // out + var _cret *C.GList // in + + _arg0 = (*C.GEmblemedIcon)(unsafe.Pointer(coreglib.InternObject(emblemed).Native())) + + _cret = C.g_emblemed_icon_get_emblems(_arg0) + runtime.KeepAlive(emblemed) + + var _list []*Emblem // out + + _list = make([]*Emblem, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), false, func(v unsafe.Pointer) { + src := (*C.GEmblem)(v) + var dst *Emblem // out + dst = wrapEmblem(coreglib.Take(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// GetIcon gets the main icon for emblemed. +// +// The function returns the following values: +// +// - icon that is owned by emblemed. +func (emblemed *EmblemedIcon) GetIcon() *Icon { + var _arg0 *C.GEmblemedIcon // out + var _cret *C.GIcon // in + + _arg0 = (*C.GEmblemedIcon)(unsafe.Pointer(coreglib.InternObject(emblemed).Native())) + + _cret = C.g_emblemed_icon_get_icon(_arg0) + runtime.KeepAlive(emblemed) + + var _icon *Icon // out + + _icon = wrapIcon(coreglib.Take(unsafe.Pointer(_cret))) + + return _icon +} + +// FileEnumeratorOverrides contains methods that are overridable. +type FileEnumeratorOverrides struct { + // CloseFinish finishes closing a file enumerator, started from + // g_file_enumerator_close_async(). + // + // If the file enumerator was already closed when + // g_file_enumerator_close_async() was called, then this function will + // report G_IO_ERROR_CLOSED in error, and return FALSE. If the file + // enumerator had pending operation when the close operation was started, + // then this function will report G_IO_ERROR_PENDING, and return FALSE. + // If cancellable was not NULL, then the operation may have been cancelled + // by triggering the cancellable object from another thread. If the + // operation was cancelled, the error G_IO_ERROR_CANCELLED will be set, + // and FALSE will be returned. + // + // The function takes the following parameters: + // + // - result: Result. + CloseFinish func(result AsyncResulter) error + CloseFn func(ctx context.Context) error + // NextFile returns information for the next file in the enumerated object. + // Will block until the information is available. The Info returned from + // this function will contain attributes that match the attribute string + // that was passed when the Enumerator was created. + // + // See the documentation of Enumerator for information about the order of + // returned files. + // + // On error, returns NULL and sets error to the error. If the enumerator is + // at the end, NULL will be returned and error will be unset. + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable object, NULL to ignore. + // + // The function returns the following values: + // + // - fileInfo (optional) or NULL on error or end of enumerator. Free the + // returned object with g_object_unref() when no longer needed. + NextFile func(ctx context.Context) (*FileInfo, error) + // NextFilesFinish finishes the asynchronous operation started with + // g_file_enumerator_next_files_async(). + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - list of Infos. You must free the list with g_list_free() and unref + // the infos with g_object_unref() when you're done with them. + NextFilesFinish func(result AsyncResulter) ([]*FileInfo, error) +} + +func defaultFileEnumeratorOverrides(v *FileEnumerator) FileEnumeratorOverrides { + return FileEnumeratorOverrides{ + CloseFinish: v.closeFinish, + CloseFn: v.closeFn, + NextFile: v.nextFile, + NextFilesFinish: v.nextFilesFinish, + } +} + +// FileEnumerator: GFileEnumerator allows you to operate on a set of gio.File +// objects, returning a gio.FileInfo structure for each file enumerated (e.g. +// gio.File.EnumerateChildren() will return a GFileEnumerator for each of the +// children within a directory). +// +// To get the next file's information from a GFileEnumerator, +// use gio.FileEnumerator.NextFile() or its asynchronous version, +// gio.FileEnumerator.NextFilesAsync(). Note that the asynchronous version will +// return a list of gio.FileInfo objects, whereas the synchronous will only +// return the next file in the enumerator. +// +// The ordering of returned files is unspecified for non-Unix platforms; for +// more information, see glib.Dir.ReadName(). On Unix, when operating on local +// files, returned files will be sorted by inode number. Effectively you can +// assume that the ordering of returned files will be stable between successive +// calls (and applications) assuming the directory is unchanged. +// +// If your application needs a specific ordering, such as by name or +// modification time, you will have to implement that in your application code. +// +// To close a GFileEnumerator, use gio.FileEnumerator.Close(), or its +// asynchronous version, gio.FileEnumerator.CloseAsync(). Once a GFileEnumerator +// is closed, no further actions may be performed on it, and it should be freed +// with gobject.Object.Unref(). +type FileEnumerator struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*FileEnumerator)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*FileEnumerator, *FileEnumeratorClass, FileEnumeratorOverrides]( + GTypeFileEnumerator, + initFileEnumeratorClass, + wrapFileEnumerator, + defaultFileEnumeratorOverrides, + ) +} + +func initFileEnumeratorClass(gclass unsafe.Pointer, overrides FileEnumeratorOverrides, classInitFunc func(*FileEnumeratorClass)) { + pclass := (*C.GFileEnumeratorClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeFileEnumerator)))) + + if overrides.CloseFinish != nil { + pclass.close_finish = (*[0]byte)(C._gotk4_gio2_FileEnumeratorClass_close_finish) + } + + if overrides.CloseFn != nil { + pclass.close_fn = (*[0]byte)(C._gotk4_gio2_FileEnumeratorClass_close_fn) + } + + if overrides.NextFile != nil { + pclass.next_file = (*[0]byte)(C._gotk4_gio2_FileEnumeratorClass_next_file) + } + + if overrides.NextFilesFinish != nil { + pclass.next_files_finish = (*[0]byte)(C._gotk4_gio2_FileEnumeratorClass_next_files_finish) + } + + if classInitFunc != nil { + class := (*FileEnumeratorClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapFileEnumerator(obj *coreglib.Object) *FileEnumerator { + return &FileEnumerator{ + Object: obj, + } +} + +func marshalFileEnumerator(p uintptr) (interface{}, error) { + return wrapFileEnumerator(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Close releases all resources used by this enumerator, making the enumerator +// return G_IO_ERROR_CLOSED on all calls. +// +// This will be automatically called when the last reference is dropped, but you +// might want to call this function to make sure resources are released as early +// as possible. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (enumerator *FileEnumerator) Close(ctx context.Context) error { + var _arg0 *C.GFileEnumerator // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_file_enumerator_close(_arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CloseAsync: asynchronously closes the file enumerator. +// +// If cancellable is not NULL, then the operation can be cancelled by +// triggering the cancellable object from another thread. If the operation +// was cancelled, the error G_IO_ERROR_CANCELLED will be returned in +// g_file_enumerator_close_finish(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (enumerator *FileEnumerator) CloseAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFileEnumerator // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_enumerator_close_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// CloseFinish finishes closing a file enumerator, started from +// g_file_enumerator_close_async(). +// +// If the file enumerator was already closed when +// g_file_enumerator_close_async() was called, then this function will report +// G_IO_ERROR_CLOSED in error, and return FALSE. If the file enumerator had +// pending operation when the close operation was started, then this function +// will report G_IO_ERROR_PENDING, and return FALSE. If cancellable was +// not NULL, then the operation may have been cancelled by triggering the +// cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be set, and FALSE will be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (enumerator *FileEnumerator) CloseFinish(result AsyncResulter) error { + var _arg0 *C.GFileEnumerator // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_file_enumerator_close_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Child: return a new #GFile which refers to the file named by info in the +// source directory of enumerator. This function is primarily intended to be +// used inside loops with g_file_enumerator_next_file(). +// +// To use this, G_FILE_ATTRIBUTE_STANDARD_NAME must have been listed in the +// attributes list used when creating the Enumerator. +// +// This is a convenience method that's equivalent to: +// +// gchar *name = g_file_info_get_name (info); +// GFile *child = g_file_get_child (g_file_enumerator_get_container (enumr), +// name);. +// +// The function takes the following parameters: +// +// - info gotten from g_file_enumerator_next_file() or the async equivalents. +// +// The function returns the following values: +// +// - file for the Info passed it. +func (enumerator *FileEnumerator) Child(info *FileInfo) *File { + var _arg0 *C.GFileEnumerator // out + var _arg1 *C.GFileInfo // out + var _cret *C.GFile // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + _arg1 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_enumerator_get_child(_arg0, _arg1) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(info) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// Container: get the #GFile container which is being enumerated. +// +// The function returns the following values: +// +// - file which is being enumerated. +func (enumerator *FileEnumerator) Container() *File { + var _arg0 *C.GFileEnumerator // out + var _cret *C.GFile // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + + _cret = C.g_file_enumerator_get_container(_arg0) + runtime.KeepAlive(enumerator) + + var _file *File // out + + _file = wrapFile(coreglib.Take(unsafe.Pointer(_cret))) + + return _file +} + +// HasPending checks if the file enumerator has pending operations. +// +// The function returns the following values: +// +// - ok: TRUE if the enumerator has pending operations. +func (enumerator *FileEnumerator) HasPending() bool { + var _arg0 *C.GFileEnumerator // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + + _cret = C.g_file_enumerator_has_pending(_arg0) + runtime.KeepAlive(enumerator) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsClosed checks if the file enumerator has been closed. +// +// The function returns the following values: +// +// - ok: TRUE if the enumerator is closed. +func (enumerator *FileEnumerator) IsClosed() bool { + var _arg0 *C.GFileEnumerator // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + + _cret = C.g_file_enumerator_is_closed(_arg0) + runtime.KeepAlive(enumerator) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Iterate: this is a version of g_file_enumerator_next_file() that's easier +// to use correctly from C programs. With g_file_enumerator_next_file(), the +// gboolean return value signifies "end of iteration or error", which requires +// allocation of a temporary #GError. +// +// In contrast, with this function, a FALSE return from +// g_file_enumerator_iterate() *always* means "error". End of iteration is +// signaled by out_info or out_child being NULL. +// +// Another crucial difference is that the references for out_info and out_child +// are owned by direnum (they are cached as hidden properties). You must not +// unref them in your own code. This makes memory management significantly +// easier for C code in combination with loops. +// +// Finally, this function optionally allows retrieving a #GFile as well. +// +// You must specify at least one of out_info or out_child. +// +// The code pattern for correctly using g_file_enumerator_iterate() from C is: +// +// direnum = g_file_enumerate_children (file, ...); +// while (TRUE) +// { +// GFileInfo *info; +// if (!g_file_enumerator_iterate (direnum, &info, NULL, cancellable, error)) +// goto out; +// if (!info) +// break; +// ... do stuff with "info"; do not unref it! ... +// } +// +// out: +// g_object_unref (direnum); // Note: frees the last info. +// +// The function takes the following parameters: +// +// - ctx (optional): #GCancellable. +// +// The function returns the following values: +// +// - outInfo (optional): output location for the next Info, or NULL. +// - outChild (optional): output location for the next #GFile, or NULL. +func (direnum *FileEnumerator) Iterate(ctx context.Context) (*FileInfo, *File, error) { + var _arg0 *C.GFileEnumerator // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GFileInfo // in + var _arg2 *C.GFile // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(direnum).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_file_enumerator_iterate(_arg0, &_arg1, &_arg2, _arg3, &_cerr) + runtime.KeepAlive(direnum) + runtime.KeepAlive(ctx) + + var _outInfo *FileInfo // out + var _outChild *File // out + var _goerr error // out + + if _arg1 != nil { + _outInfo = wrapFileInfo(coreglib.Take(unsafe.Pointer(_arg1))) + } + if _arg2 != nil { + _outChild = wrapFile(coreglib.Take(unsafe.Pointer(_arg2))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _outInfo, _outChild, _goerr +} + +// NextFile returns information for the next file in the enumerated object. +// Will block until the information is available. The Info returned from this +// function will contain attributes that match the attribute string that was +// passed when the Enumerator was created. +// +// See the documentation of Enumerator for information about the order of +// returned files. +// +// On error, returns NULL and sets error to the error. If the enumerator is at +// the end, NULL will be returned and error will be unset. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - fileInfo (optional) or NULL on error or end of enumerator. Free the +// returned object with g_object_unref() when no longer needed. +func (enumerator *FileEnumerator) NextFile(ctx context.Context) (*FileInfo, error) { + var _arg0 *C.GFileEnumerator // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_file_enumerator_next_file(_arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + + var _fileInfo *FileInfo // out + var _goerr error // out + + if _cret != nil { + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// NextFilesAsync: request information for a number of files from the enumerator +// asynchronously. When all I/O for the operation is finished the callback will +// be called with the requested information. +// +// See the documentation of Enumerator for information about the order of +// returned files. +// +// Once the end of the enumerator is reached, or if an error occurs, the +// callback will be called with an empty list. In this case, the previous call +// to g_file_enumerator_next_files_async() will typically have returned fewer +// than num_files items. +// +// If a request is cancelled the callback will be called with +// G_IO_ERROR_CANCELLED. +// +// This leads to the following pseudo-code usage: +// +// g_autoptr(GFile) dir = get_directory (); +// g_autoptr(GFileEnumerator) enumerator = NULL; +// g_autolist(GFileInfo) files = NULL; +// g_autoptr(GError) local_error = NULL; +// +// enumerator = yield g_file_enumerate_children_async (dir, +// G_FILE_ATTRIBUTE_STANDARD_NAME "," +// G_FILE_ATTRIBUTE_STANDARD_TYPE, +// G_FILE_QUERY_INFO_NONE, +// G_PRIORITY_DEFAULT, +// cancellable, +// …, +// &local_error); +// if (enumerator == NULL) +// g_error ("Error enumerating: s", local_error->message); +// +// // Loop until no files are returned, either because the end of the enumerator +// // has been reached, or an error was returned. +// do +// { +// files = yield g_file_enumerator_next_files_async (enumerator, +// 5, // number of files to request +// G_PRIORITY_DEFAULT, +// cancellable, +// …, +// &local_error); +// +// // Process the returned files, but don’t assume that exactly 5 were returned. +// for (GList *l = files; l != NULL; l = l->next) +// { +// GFileInfo *info = l->data; +// handle_file_info (info); +// } +// } +// while (files != NULL); +// +// if (local_error != NULL && +// !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) +// g_error ("Error while enumerating: s", local_error->message); +// +// During an async request no other sync and async calls are allowed, and will +// result in G_IO_ERROR_PENDING errors. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - numFiles: number of file info objects to request. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (enumerator *FileEnumerator) NextFilesAsync(ctx context.Context, numFiles, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFileEnumerator // out + var _arg3 *C.GCancellable // out + var _arg1 C.int // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(numFiles) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_enumerator_next_files_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + runtime.KeepAlive(numFiles) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// NextFilesFinish finishes the asynchronous operation started with +// g_file_enumerator_next_files_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - list of Infos. You must free the list with g_list_free() and unref the +// infos with g_object_unref() when you're done with them. +func (enumerator *FileEnumerator) NextFilesFinish(result AsyncResulter) ([]*FileInfo, error) { + var _arg0 *C.GFileEnumerator // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_file_enumerator_next_files_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(result) + + var _list []*FileInfo // out + var _goerr error // out + + _list = make([]*FileInfo, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GFileInfo)(v) + var dst *FileInfo // out + dst = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// SetPending sets the file enumerator as having pending operations. +// +// The function takes the following parameters: +// +// - pending: boolean value. +func (enumerator *FileEnumerator) SetPending(pending bool) { + var _arg0 *C.GFileEnumerator // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + if pending { + _arg1 = C.TRUE + } + + C.g_file_enumerator_set_pending(_arg0, _arg1) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(pending) +} + +// closeAsync: asynchronously closes the file enumerator. +// +// If cancellable is not NULL, then the operation can be cancelled by +// triggering the cancellable object from another thread. If the operation +// was cancelled, the error G_IO_ERROR_CANCELLED will be returned in +// g_file_enumerator_close_finish(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (enumerator *FileEnumerator) closeAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileEnumeratorClass)(coreglib.PeekParentClass(enumerator)) + fnarg := gclass.close_async + + var _arg0 *C.GFileEnumerator // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_FileEnumerator_virtual_close_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// closeFinish finishes closing a file enumerator, started from +// g_file_enumerator_close_async(). +// +// If the file enumerator was already closed when +// g_file_enumerator_close_async() was called, then this function will report +// G_IO_ERROR_CLOSED in error, and return FALSE. If the file enumerator had +// pending operation when the close operation was started, then this function +// will report G_IO_ERROR_PENDING, and return FALSE. If cancellable was +// not NULL, then the operation may have been cancelled by triggering the +// cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be set, and FALSE will be returned. +// +// The function takes the following parameters: +// +// - result: Result. +func (enumerator *FileEnumerator) closeFinish(result AsyncResulter) error { + gclass := (*C.GFileEnumeratorClass)(coreglib.PeekParentClass(enumerator)) + fnarg := gclass.close_finish + + var _arg0 *C.GFileEnumerator // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_FileEnumerator_virtual_close_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func (enumerator *FileEnumerator) closeFn(ctx context.Context) error { + gclass := (*C.GFileEnumeratorClass)(coreglib.PeekParentClass(enumerator)) + fnarg := gclass.close_fn + + var _arg0 *C.GFileEnumerator // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_FileEnumerator_virtual_close_fn(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// nextFile returns information for the next file in the enumerated object. +// Will block until the information is available. The Info returned from this +// function will contain attributes that match the attribute string that was +// passed when the Enumerator was created. +// +// See the documentation of Enumerator for information about the order of +// returned files. +// +// On error, returns NULL and sets error to the error. If the enumerator is at +// the end, NULL will be returned and error will be unset. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - fileInfo (optional) or NULL on error or end of enumerator. Free the +// returned object with g_object_unref() when no longer needed. +func (enumerator *FileEnumerator) nextFile(ctx context.Context) (*FileInfo, error) { + gclass := (*C.GFileEnumeratorClass)(coreglib.PeekParentClass(enumerator)) + fnarg := gclass.next_file + + var _arg0 *C.GFileEnumerator // out + var _arg1 *C.GCancellable // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C._gotk4_gio2_FileEnumerator_virtual_next_file(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + + var _fileInfo *FileInfo // out + var _goerr error // out + + if _cret != nil { + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// nextFilesAsync: request information for a number of files from the enumerator +// asynchronously. When all I/O for the operation is finished the callback will +// be called with the requested information. +// +// See the documentation of Enumerator for information about the order of +// returned files. +// +// Once the end of the enumerator is reached, or if an error occurs, the +// callback will be called with an empty list. In this case, the previous call +// to g_file_enumerator_next_files_async() will typically have returned fewer +// than num_files items. +// +// If a request is cancelled the callback will be called with +// G_IO_ERROR_CANCELLED. +// +// This leads to the following pseudo-code usage: +// +// g_autoptr(GFile) dir = get_directory (); +// g_autoptr(GFileEnumerator) enumerator = NULL; +// g_autolist(GFileInfo) files = NULL; +// g_autoptr(GError) local_error = NULL; +// +// enumerator = yield g_file_enumerate_children_async (dir, +// G_FILE_ATTRIBUTE_STANDARD_NAME "," +// G_FILE_ATTRIBUTE_STANDARD_TYPE, +// G_FILE_QUERY_INFO_NONE, +// G_PRIORITY_DEFAULT, +// cancellable, +// …, +// &local_error); +// if (enumerator == NULL) +// g_error ("Error enumerating: s", local_error->message); +// +// // Loop until no files are returned, either because the end of the enumerator +// // has been reached, or an error was returned. +// do +// { +// files = yield g_file_enumerator_next_files_async (enumerator, +// 5, // number of files to request +// G_PRIORITY_DEFAULT, +// cancellable, +// …, +// &local_error); +// +// // Process the returned files, but don’t assume that exactly 5 were returned. +// for (GList *l = files; l != NULL; l = l->next) +// { +// GFileInfo *info = l->data; +// handle_file_info (info); +// } +// } +// while (files != NULL); +// +// if (local_error != NULL && +// !g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) +// g_error ("Error while enumerating: s", local_error->message); +// +// During an async request no other sync and async calls are allowed, and will +// result in G_IO_ERROR_PENDING errors. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - numFiles: number of file info objects to request. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (enumerator *FileEnumerator) nextFilesAsync(ctx context.Context, numFiles, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileEnumeratorClass)(coreglib.PeekParentClass(enumerator)) + fnarg := gclass.next_files_async + + var _arg0 *C.GFileEnumerator // out + var _arg3 *C.GCancellable // out + var _arg1 C.int // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(numFiles) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_FileEnumerator_virtual_next_files_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + runtime.KeepAlive(numFiles) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// nextFilesFinish finishes the asynchronous operation started with +// g_file_enumerator_next_files_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - list of Infos. You must free the list with g_list_free() and unref the +// infos with g_object_unref() when you're done with them. +func (enumerator *FileEnumerator) nextFilesFinish(result AsyncResulter) ([]*FileInfo, error) { + gclass := (*C.GFileEnumeratorClass)(coreglib.PeekParentClass(enumerator)) + fnarg := gclass.next_files_finish + + var _arg0 *C.GFileEnumerator // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_FileEnumerator_virtual_next_files_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(result) + + var _list []*FileInfo // out + var _goerr error // out + + _list = make([]*FileInfo, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GFileInfo)(v) + var dst *FileInfo // out + dst = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// FileIOStreamOverrides contains methods that are overridable. +type FileIOStreamOverrides struct { + CanSeek func() bool + CanTruncate func() bool + // ETag gets the entity tag for the file when it has been written. This must + // be called after the stream has been written and closed, as the etag can + // change while writing. + // + // The function returns the following values: + // + // - utf8 (optional): entity tag for the stream. + ETag func() string + // QueryInfo queries a file io stream for the given attributes. This + // function blocks while querying the stream. For the asynchronous version + // of this function, see g_file_io_stream_query_info_async(). While the + // stream is blocked, the stream will set the pending flag internally, + // and any other operations on the stream will fail with G_IO_ERROR_PENDING. + // + // Can fail if the stream was already closed (with error being set to + // G_IO_ERROR_CLOSED), the stream has pending operations (with error being + // set to G_IO_ERROR_PENDING), or if querying info is not supported for the + // stream's interface (with error being set to G_IO_ERROR_NOT_SUPPORTED). + // I all cases of failure, NULL will be returned. + // + // If cancellable is not NULL, then the operation can be cancelled by + // triggering the cancellable object from another thread. If the operation + // was cancelled, the error G_IO_ERROR_CANCELLED will be set, and NULL will + // be returned. + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable object, NULL to ignore. + // - attributes: file attribute query string. + // + // The function returns the following values: + // + // - fileInfo for the stream, or NULL on error. + QueryInfo func(ctx context.Context, attributes string) (*FileInfo, error) + // QueryInfoFinish finalizes the asynchronous query started by + // g_file_io_stream_query_info_async(). + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - fileInfo for the finished query. + QueryInfoFinish func(result AsyncResulter) (*FileInfo, error) + // The function takes the following parameters: + // + // - ctx (optional) + // - offset + // - typ + Seek func(ctx context.Context, offset int64, typ glib.SeekType) error + Tell func() int64 + // The function takes the following parameters: + // + // - ctx (optional) + // - size + TruncateFn func(ctx context.Context, size int64) error +} + +func defaultFileIOStreamOverrides(v *FileIOStream) FileIOStreamOverrides { + return FileIOStreamOverrides{ + CanSeek: v.canSeek, + CanTruncate: v.canTruncate, + ETag: v.eTag, + QueryInfo: v.queryInfo, + QueryInfoFinish: v.queryInfoFinish, + Seek: v.seek, + Tell: v.tell, + TruncateFn: v.truncateFn, + } +} + +// FileIOStream: GFileIOStream provides I/O streams that both read and write to +// the same file handle. +// +// GFileIOStream implements gio.Seekable, which allows the I/O stream to jump +// to arbitrary positions in the file and to truncate the file, provided the +// filesystem of the file supports these operations. +// +// To find the position of a file I/O stream, use gio.Seekable.Tell(). +// +// To find out if a file I/O stream supports seeking, +// use gio.Seekable.CanSeek(). To position a file I/O stream, use +// gio.Seekable.Seek(). To find out if a file I/O stream supports truncating, +// use gio.Seekable.CanTruncate(). To truncate a file I/O stream, use +// gio.Seekable.Truncate(). +// +// The default implementation of all the GFileIOStream operations and the +// implementation of gio.Seekable just call into the same operations on the +// output stream. +type FileIOStream struct { + _ [0]func() // equal guard + IOStream + + *coreglib.Object + Seekable +} + +var ( + _ IOStreamer = (*FileIOStream)(nil) + _ coreglib.Objector = (*FileIOStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*FileIOStream, *FileIOStreamClass, FileIOStreamOverrides]( + GTypeFileIOStream, + initFileIOStreamClass, + wrapFileIOStream, + defaultFileIOStreamOverrides, + ) +} + +func initFileIOStreamClass(gclass unsafe.Pointer, overrides FileIOStreamOverrides, classInitFunc func(*FileIOStreamClass)) { + pclass := (*C.GFileIOStreamClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeFileIOStream)))) + + if overrides.CanSeek != nil { + pclass.can_seek = (*[0]byte)(C._gotk4_gio2_FileIOStreamClass_can_seek) + } + + if overrides.CanTruncate != nil { + pclass.can_truncate = (*[0]byte)(C._gotk4_gio2_FileIOStreamClass_can_truncate) + } + + if overrides.ETag != nil { + pclass.get_etag = (*[0]byte)(C._gotk4_gio2_FileIOStreamClass_get_etag) + } + + if overrides.QueryInfo != nil { + pclass.query_info = (*[0]byte)(C._gotk4_gio2_FileIOStreamClass_query_info) + } + + if overrides.QueryInfoFinish != nil { + pclass.query_info_finish = (*[0]byte)(C._gotk4_gio2_FileIOStreamClass_query_info_finish) + } + + if overrides.Seek != nil { + pclass.seek = (*[0]byte)(C._gotk4_gio2_FileIOStreamClass_seek) + } + + if overrides.Tell != nil { + pclass.tell = (*[0]byte)(C._gotk4_gio2_FileIOStreamClass_tell) + } + + if overrides.TruncateFn != nil { + pclass.truncate_fn = (*[0]byte)(C._gotk4_gio2_FileIOStreamClass_truncate_fn) + } + + if classInitFunc != nil { + class := (*FileIOStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapFileIOStream(obj *coreglib.Object) *FileIOStream { + return &FileIOStream{ + IOStream: IOStream{ + Object: obj, + }, + Object: obj, + Seekable: Seekable{ + Object: obj, + }, + } +} + +func marshalFileIOStream(p uintptr) (interface{}, error) { + return wrapFileIOStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ETag gets the entity tag for the file when it has been written. This must be +// called after the stream has been written and closed, as the etag can change +// while writing. +// +// The function returns the following values: +// +// - utf8 (optional): entity tag for the stream. +func (stream *FileIOStream) ETag() string { + var _arg0 *C.GFileIOStream // out + var _cret *C.char // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_file_io_stream_get_etag(_arg0) + runtime.KeepAlive(stream) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// QueryInfo queries a file io stream for the given attributes. This function +// blocks while querying the stream. For the asynchronous version of this +// function, see g_file_io_stream_query_info_async(). While the stream is +// blocked, the stream will set the pending flag internally, and any other +// operations on the stream will fail with G_IO_ERROR_PENDING. +// +// Can fail if the stream was already closed (with error being set to +// G_IO_ERROR_CLOSED), the stream has pending operations (with error being set +// to G_IO_ERROR_PENDING), or if querying info is not supported for the stream's +// interface (with error being set to G_IO_ERROR_NOT_SUPPORTED). I all cases of +// failure, NULL will be returned. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be set, and NULL will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// +// The function returns the following values: +// +// - fileInfo for the stream, or NULL on error. +func (stream *FileIOStream) QueryInfo(ctx context.Context, attributes string) (*FileInfo, error) { + var _arg0 *C.GFileIOStream // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_io_stream_query_info(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// QueryInfoAsync: asynchronously queries the stream for a Info. When completed, +// callback will be called with a Result which can be used to finish the +// operation with g_file_io_stream_query_info_finish(). +// +// For the synchronous version of this function, see +// g_file_io_stream_query_info(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// - ioPriority: I/O priority (iface.AsyncResult.html#io-priority) of the +// request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *FileIOStream) QueryInfoAsync(ctx context.Context, attributes string, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFileIOStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_io_stream_query_info_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// QueryInfoFinish finalizes the asynchronous query started by +// g_file_io_stream_query_info_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - fileInfo for the finished query. +func (stream *FileIOStream) QueryInfoFinish(result AsyncResulter) (*FileInfo, error) { + var _arg0 *C.GFileIOStream // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_file_io_stream_query_info_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +func (stream *FileIOStream) canSeek() bool { + gclass := (*C.GFileIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.can_seek + + var _arg0 *C.GFileIOStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileIOStream_virtual_can_seek(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +func (stream *FileIOStream) canTruncate() bool { + gclass := (*C.GFileIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.can_truncate + + var _arg0 *C.GFileIOStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileIOStream_virtual_can_truncate(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// eTag gets the entity tag for the file when it has been written. This must be +// called after the stream has been written and closed, as the etag can change +// while writing. +// +// The function returns the following values: +// +// - utf8 (optional): entity tag for the stream. +func (stream *FileIOStream) eTag() string { + gclass := (*C.GFileIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.get_etag + + var _arg0 *C.GFileIOStream // out + var _cret *C.char // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileIOStream_virtual_get_etag(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// queryInfo queries a file io stream for the given attributes. This function +// blocks while querying the stream. For the asynchronous version of this +// function, see g_file_io_stream_query_info_async(). While the stream is +// blocked, the stream will set the pending flag internally, and any other +// operations on the stream will fail with G_IO_ERROR_PENDING. +// +// Can fail if the stream was already closed (with error being set to +// G_IO_ERROR_CLOSED), the stream has pending operations (with error being set +// to G_IO_ERROR_PENDING), or if querying info is not supported for the stream's +// interface (with error being set to G_IO_ERROR_NOT_SUPPORTED). I all cases of +// failure, NULL will be returned. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be set, and NULL will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// +// The function returns the following values: +// +// - fileInfo for the stream, or NULL on error. +func (stream *FileIOStream) queryInfo(ctx context.Context, attributes string) (*FileInfo, error) { + gclass := (*C.GFileIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.query_info + + var _arg0 *C.GFileIOStream // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_FileIOStream_virtual_query_info(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// queryInfoAsync: asynchronously queries the stream for a Info. When completed, +// callback will be called with a Result which can be used to finish the +// operation with g_file_io_stream_query_info_finish(). +// +// For the synchronous version of this function, see +// g_file_io_stream_query_info(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// - ioPriority: I/O priority (iface.AsyncResult.html#io-priority) of the +// request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *FileIOStream) queryInfoAsync(ctx context.Context, attributes string, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.query_info_async + + var _arg0 *C.GFileIOStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_FileIOStream_virtual_query_info_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// queryInfoFinish finalizes the asynchronous query started by +// g_file_io_stream_query_info_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - fileInfo for the finished query. +func (stream *FileIOStream) queryInfoFinish(result AsyncResulter) (*FileInfo, error) { + gclass := (*C.GFileIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.query_info_finish + + var _arg0 *C.GFileIOStream // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_FileIOStream_virtual_query_info_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// The function takes the following parameters: +// +// - ctx (optional) +// - offset +// - typ +func (stream *FileIOStream) seek(ctx context.Context, offset int64, typ glib.SeekType) error { + gclass := (*C.GFileIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.seek + + var _arg0 *C.GFileIOStream // out + var _arg3 *C.GCancellable // out + var _arg1 C.goffset // out + var _arg2 C.GSeekType // out + var _cerr *C.GError // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.goffset(offset) + _arg2 = C.GSeekType(typ) + + C._gotk4_gio2_FileIOStream_virtual_seek(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(offset) + runtime.KeepAlive(typ) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func (stream *FileIOStream) tell() int64 { + gclass := (*C.GFileIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.tell + + var _arg0 *C.GFileIOStream // out + var _cret C.goffset // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileIOStream_virtual_tell(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// The function takes the following parameters: +// +// - ctx (optional) +// - size +func (stream *FileIOStream) truncateFn(ctx context.Context, size int64) error { + gclass := (*C.GFileIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.truncate_fn + + var _arg0 *C.GFileIOStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.goffset // out + var _cerr *C.GError // in + + _arg0 = (*C.GFileIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.goffset(size) + + C._gotk4_gio2_FileIOStream_virtual_truncate_fn(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(size) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// FileIcon: GFileIcon specifies an icon by pointing to an image file to be used +// as icon. +// +// It implements gio.LoadableIcon. +type FileIcon struct { + _ [0]func() // equal guard + *coreglib.Object + + LoadableIcon +} + +var ( + _ coreglib.Objector = (*FileIcon)(nil) +) + +func wrapFileIcon(obj *coreglib.Object) *FileIcon { + return &FileIcon{ + Object: obj, + LoadableIcon: LoadableIcon{ + Icon: Icon{ + Object: obj, + }, + }, + } +} + +func marshalFileIcon(p uintptr) (interface{}, error) { + return wrapFileIcon(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewFileIcon creates a new icon for a file. +// +// The function takes the following parameters: +// +// - file: #GFile. +// +// The function returns the following values: +// +// - fileIcon for the given file, or NULL on error. +func NewFileIcon(file Filer) *FileIcon { + var _arg1 *C.GFile // out + var _cret *C.GIcon // in + + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.g_file_icon_new(_arg1) + runtime.KeepAlive(file) + + var _fileIcon *FileIcon // out + + _fileIcon = wrapFileIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _fileIcon +} + +// File gets the #GFile associated with the given icon. +// +// The function returns the following values: +// +// - file: #GFile. +func (icon *FileIcon) File() *File { + var _arg0 *C.GFileIcon // out + var _cret *C.GFile // in + + _arg0 = (*C.GFileIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + _cret = C.g_file_icon_get_file(_arg0) + runtime.KeepAlive(icon) + + var _file *File // out + + _file = wrapFile(coreglib.Take(unsafe.Pointer(_cret))) + + return _file +} + +// FileInfo stores information about a file system object referenced by a +// gio.File. +// +// Functionality for manipulating basic metadata for files. GFileInfo implements +// methods for getting information that all files should contain, and allows for +// manipulation of extended attributes. +// +// See file-attributes.html (file attributes) for more information on how GIO +// handles file attributes. +// +// To obtain a GFileInfo for a gio.File, use gio.File.QueryInfo() (or its +// async variant). To obtain a GFileInfo for a file input or output stream, +// use gio.FileInputStream.QueryInfo() or gio.FileOutputStream.QueryInfo() (or +// their async variants). +// +// To change the actual attributes of a file, you should then set the +// attribute in the GFileInfo and call gio.File.SetAttributesFromInfo() or +// gio.File.SetAttributesAsync() on a GFile. +// +// However, not all attributes can be changed in the file. For instance, +// the actual size of a file cannot be changed via gio.FileInfo.SetSize(). +// You may call gio.File.QuerySettableAttributes() and +// gio.File.QueryWritableNamespaces() to discover the settable attributes of a +// particular file at runtime. +// +// The direct accessors, such as gio.FileInfo.GetName(), are slightly +// more optimized than the generic attribute accessors, such as +// gio.FileInfo.GetAttributeByteString().This optimization will matter only if +// calling the API in a tight loop. +// +// It is an error to call these accessors without specifying their required file +// attributes when creating the GFileInfo. Use gio.FileInfo.HasAttribute() or +// gio.FileInfo.ListAttributes() to check what attributes are specified for a +// GFileInfo. +// +// gio.FileAttributeMatcher allows for searching through a GFileInfo for +// attributes. +type FileInfo struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*FileInfo)(nil) +) + +func wrapFileInfo(obj *coreglib.Object) *FileInfo { + return &FileInfo{ + Object: obj, + } +} + +func marshalFileInfo(p uintptr) (interface{}, error) { + return wrapFileInfo(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewFileInfo creates a new file info structure. +// +// The function returns the following values: +// +// - fileInfo: Info. +func NewFileInfo() *FileInfo { + var _cret *C.GFileInfo // in + + _cret = C.g_file_info_new() + + var _fileInfo *FileInfo // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _fileInfo +} + +// ClearStatus clears the status information from info. +func (info *FileInfo) ClearStatus() { + var _arg0 *C.GFileInfo // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + C.g_file_info_clear_status(_arg0) + runtime.KeepAlive(info) +} + +// CopyInto: first clears all of the [GFileAttribute][gio-GFileAttribute] +// of dest_info, and then copies all of the file attributes from src_info to +// dest_info. +// +// The function takes the following parameters: +// +// - destInfo: destination to copy attributes to. +func (srcInfo *FileInfo) CopyInto(destInfo *FileInfo) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.GFileInfo // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(srcInfo).Native())) + _arg1 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(destInfo).Native())) + + C.g_file_info_copy_into(_arg0, _arg1) + runtime.KeepAlive(srcInfo) + runtime.KeepAlive(destInfo) +} + +// Dup duplicates a file info structure. +// +// The function returns the following values: +// +// - fileInfo: duplicate Info of other. +func (other *FileInfo) Dup() *FileInfo { + var _arg0 *C.GFileInfo // out + var _cret *C.GFileInfo // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(other).Native())) + + _cret = C.g_file_info_dup(_arg0) + runtime.KeepAlive(other) + + var _fileInfo *FileInfo // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _fileInfo +} + +// AccessDateTime gets the access time of the current info and returns it as a +// Time. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_TIME_ACCESS. If G_FILE_ATTRIBUTE_TIME_ACCESS_USEC is +// provided, the resulting Time will additionally have microsecond precision. +// +// If nanosecond precision is needed, G_FILE_ATTRIBUTE_TIME_ACCESS_NSEC must be +// queried separately using g_file_info_get_attribute_uint32(). +// +// The function returns the following values: +// +// - dateTime (optional) access time, or NULL if unknown. +func (info *FileInfo) AccessDateTime() *glib.DateTime { + var _arg0 *C.GFileInfo // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_access_date_time(_arg0) + runtime.KeepAlive(info) + + var _dateTime *glib.DateTime // out + + if _cret != nil { + _dateTime = (*glib.DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// AttributeAsString gets the value of an attribute, formatted as a string. +// This escapes things as needed to make the string valid UTF-8. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - utf8 (optional): UTF-8 string associated with the given attribute, +// or NULL if the attribute wasn’t set. When you're done with the string it +// must be freed with g_free(). +func (info *FileInfo) AttributeAsString(attribute string) string { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_as_string(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// AttributeBoolean gets the value of a boolean attribute. If the attribute does +// not contain a boolean value, FALSE will be returned. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - ok: boolean value contained within the attribute. +func (info *FileInfo) AttributeBoolean(attribute string) bool { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_boolean(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// AttributeByteString gets the value of a byte string attribute. If the +// attribute does not contain a byte string, NULL will be returned. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - utf8 (optional) contents of the attribute value as a byte string, +// or NULL otherwise. +func (info *FileInfo) AttributeByteString(attribute string) string { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_byte_string(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// AttributeData gets the attribute type, value and status for an attribute key. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - typ (optional): return location for the attribute type, or NULL. +// - valuePp (optional): return location for the attribute value, or NULL; +// the attribute value will not be NULL. +// - status (optional): return location for the attribute status, or NULL. +// - ok: TRUE if info has an attribute named attribute, FALSE otherwise. +func (info *FileInfo) AttributeData(attribute string) (FileAttributeType, unsafe.Pointer, FileAttributeStatus, bool) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 C.GFileAttributeType // in + var _arg3 C.gpointer // in + var _arg4 C.GFileAttributeStatus // in + var _cret C.gboolean // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_data(_arg0, _arg1, &_arg2, &_arg3, &_arg4) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _typ FileAttributeType // out + var _valuePp unsafe.Pointer // out + var _status FileAttributeStatus // out + var _ok bool // out + + _typ = FileAttributeType(_arg2) + _valuePp = (unsafe.Pointer)(unsafe.Pointer(_arg3)) + _status = FileAttributeStatus(_arg4) + if _cret != 0 { + _ok = true + } + + return _typ, _valuePp, _status, _ok +} + +// AttributeFilePath gets the value of a byte string attribute as a file path. +// +// If the attribute does not contain a byte string, NULL will be returned. +// +// This function is meant to be used by language bindings that have specific +// handling for Unix paths. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - filename (optional) contents of the attribute value as a file path, +// or NULL otherwise. +func (info *FileInfo) AttributeFilePath(attribute string) string { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_file_path(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// AttributeInt32 gets a signed 32-bit integer contained within the attribute. +// If the attribute does not contain a signed 32-bit integer, or is invalid, +// 0 will be returned. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - gint32: signed 32-bit integer from the attribute. +func (info *FileInfo) AttributeInt32(attribute string) int32 { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret C.gint32 // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_int32(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _gint32 int32 // out + + _gint32 = int32(_cret) + + return _gint32 +} + +// AttributeInt64 gets a signed 64-bit integer contained within the attribute. +// If the attribute does not contain a signed 64-bit integer, or is invalid, +// 0 will be returned. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - gint64: signed 64-bit integer from the attribute. +func (info *FileInfo) AttributeInt64(attribute string) int64 { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret C.gint64 // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_int64(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// AttributeObject gets the value of a #GObject attribute. If the attribute does +// not contain a #GObject, NULL will be returned. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - object (optional) associated with the given attribute, or NULL otherwise. +func (info *FileInfo) AttributeObject(attribute string) *coreglib.Object { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret *C.GObject // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_object(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _object *coreglib.Object // out + + if _cret != nil { + _object = coreglib.Take(unsafe.Pointer(_cret)) + } + + return _object +} + +// AttributeStatus gets the attribute status for an attribute key. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - fileAttributeStatus for the given attribute, or +// G_FILE_ATTRIBUTE_STATUS_UNSET if the key is invalid. +func (info *FileInfo) AttributeStatus(attribute string) FileAttributeStatus { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret C.GFileAttributeStatus // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_status(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _fileAttributeStatus FileAttributeStatus // out + + _fileAttributeStatus = FileAttributeStatus(_cret) + + return _fileAttributeStatus +} + +// AttributeString gets the value of a string attribute. If the attribute does +// not contain a string, NULL will be returned. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - utf8 (optional) contents of the attribute value as a UTF-8 string, +// or NULL otherwise. +func (info *FileInfo) AttributeString(attribute string) string { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_string(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// AttributeStringv gets the value of a stringv attribute. If the attribute does +// not contain a stringv, NULL will be returned. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - utf8s (optional) contents of the attribute value as a stringv, or NULL +// otherwise. Do not free. These returned strings are UTF-8. +func (info *FileInfo) AttributeStringv(attribute string) []string { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret **C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_stringv(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _utf8s []string // out + + if _cret != nil { + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + } + + return _utf8s +} + +// AttributeType gets the attribute type for an attribute key. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - fileAttributeType for the given attribute, or +// G_FILE_ATTRIBUTE_TYPE_INVALID if the key is not set. +func (info *FileInfo) AttributeType(attribute string) FileAttributeType { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret C.GFileAttributeType // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_type(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _fileAttributeType FileAttributeType // out + + _fileAttributeType = FileAttributeType(_cret) + + return _fileAttributeType +} + +// AttributeUint32 gets an unsigned 32-bit integer contained within the +// attribute. If the attribute does not contain an unsigned 32-bit integer, +// or is invalid, 0 will be returned. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - guint32: unsigned 32-bit integer from the attribute. +func (info *FileInfo) AttributeUint32(attribute string) uint32 { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret C.guint32 // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_uint32(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// AttributeUint64 gets a unsigned 64-bit integer contained within the +// attribute. If the attribute does not contain an unsigned 64-bit integer, +// or is invalid, 0 will be returned. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - guint64: unsigned 64-bit integer from the attribute. +func (info *FileInfo) AttributeUint64(attribute string) uint64 { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret C.guint64 // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_get_attribute_uint64(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _guint64 uint64 // out + + _guint64 = uint64(_cret) + + return _guint64 +} + +// ContentType gets the file's content type. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the file's content type, or NULL if +// unknown. +func (info *FileInfo) ContentType() string { + var _arg0 *C.GFileInfo // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_content_type(_arg0) + runtime.KeepAlive(info) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// CreationDateTime gets the creation time of the current info and returns it as +// a Time. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_TIME_CREATED. If G_FILE_ATTRIBUTE_TIME_CREATED_USEC is +// provided, the resulting Time will additionally have microsecond precision. +// +// If nanosecond precision is needed, G_FILE_ATTRIBUTE_TIME_CREATED_NSEC must be +// queried separately using g_file_info_get_attribute_uint32(). +// +// The function returns the following values: +// +// - dateTime (optional): creation time, or NULL if unknown. +func (info *FileInfo) CreationDateTime() *glib.DateTime { + var _arg0 *C.GFileInfo // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_creation_date_time(_arg0) + runtime.KeepAlive(info) + + var _dateTime *glib.DateTime // out + + if _cret != nil { + _dateTime = (*glib.DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// DeletionDate returns the Time representing the deletion date of the +// file, as available in G_FILE_ATTRIBUTE_TRASH_DELETION_DATE. If the +// G_FILE_ATTRIBUTE_TRASH_DELETION_DATE attribute is unset, NULL is returned. +// +// The function returns the following values: +// +// - dateTime (optional) or NULL. +func (info *FileInfo) DeletionDate() *glib.DateTime { + var _arg0 *C.GFileInfo // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_deletion_date(_arg0) + runtime.KeepAlive(info) + + var _dateTime *glib.DateTime // out + + if _cret != nil { + _dateTime = (*glib.DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// DisplayName gets a display name for a file. This is guaranteed to always be +// set. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME. +// +// The function returns the following values: +// +// - utf8: string containing the display name. +func (info *FileInfo) DisplayName() string { + var _arg0 *C.GFileInfo // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_display_name(_arg0) + runtime.KeepAlive(info) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// EditName gets the edit name for a file. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME. +// +// The function returns the following values: +// +// - utf8: string containing the edit name. +func (info *FileInfo) EditName() string { + var _arg0 *C.GFileInfo // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_edit_name(_arg0) + runtime.KeepAlive(info) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// ETag gets the entity tag (iface.File.html#entity-tags) for a given Info. +// See G_FILE_ATTRIBUTE_ETAG_VALUE. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_ETAG_VALUE. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the value of the "etag:value" +// attribute. +func (info *FileInfo) ETag() string { + var _arg0 *C.GFileInfo // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_etag(_arg0) + runtime.KeepAlive(info) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// FileType gets a file's type (whether it is a regular file, +// symlink, etc). This is different from the file's content type, see +// g_file_info_get_content_type(). +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_TYPE. +// +// The function returns the following values: +// +// - fileType for the given file. +func (info *FileInfo) FileType() FileType { + var _arg0 *C.GFileInfo // out + var _cret C.GFileType // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_file_type(_arg0) + runtime.KeepAlive(info) + + var _fileType FileType // out + + _fileType = FileType(_cret) + + return _fileType +} + +// Icon gets the icon for a file. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_ICON. +// +// The function returns the following values: +// +// - icon (optional) for the given info. +func (info *FileInfo) Icon() *Icon { + var _arg0 *C.GFileInfo // out + var _cret *C.GIcon // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_icon(_arg0) + runtime.KeepAlive(info) + + var _icon *Icon // out + + if _cret != nil { + _icon = wrapIcon(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _icon +} + +// IsBackup checks if a file is a backup file. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_IS_BACKUP. +// +// The function returns the following values: +// +// - ok: TRUE if file is a backup file, FALSE otherwise. +func (info *FileInfo) IsBackup() bool { + var _arg0 *C.GFileInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_is_backup(_arg0) + runtime.KeepAlive(info) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsHidden checks if a file is hidden. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN. +// +// The function returns the following values: +// +// - ok: TRUE if the file is a hidden file, FALSE otherwise. +func (info *FileInfo) IsHidden() bool { + var _arg0 *C.GFileInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_is_hidden(_arg0) + runtime.KeepAlive(info) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsSymlink checks if a file is a symlink. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK. +// +// The function returns the following values: +// +// - ok: TRUE if the given info is a symlink. +func (info *FileInfo) IsSymlink() bool { + var _arg0 *C.GFileInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_is_symlink(_arg0) + runtime.KeepAlive(info) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ModificationDateTime gets the modification time of the current info and +// returns it as a Time. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_TIME_MODIFIED. If G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is +// provided, the resulting Time will additionally have microsecond precision. +// +// If nanosecond precision is needed, G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC must +// be queried separately using g_file_info_get_attribute_uint32(). +// +// The function returns the following values: +// +// - dateTime (optional): modification time, or NULL if unknown. +func (info *FileInfo) ModificationDateTime() *glib.DateTime { + var _arg0 *C.GFileInfo // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_modification_date_time(_arg0) + runtime.KeepAlive(info) + + var _dateTime *glib.DateTime // out + + if _cret != nil { + _dateTime = (*glib.DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// ModificationTime gets the modification time of the current info and sets it +// in result. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_TIME_MODIFIED. If G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is +// provided it will be used too. +// +// Deprecated: Use g_file_info_get_modification_date_time() instead, as Val is +// deprecated due to the year 2038 problem. +// +// The function returns the following values: +// +// - result: Val. +func (info *FileInfo) ModificationTime() *glib.TimeVal { + var _arg0 *C.GFileInfo // out + var _arg1 C.GTimeVal // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + C.g_file_info_get_modification_time(_arg0, &_arg1) + runtime.KeepAlive(info) + + var _result *glib.TimeVal // out + + _result = (*glib.TimeVal)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _result +} + +// Name gets the name for a file. This is guaranteed to always be set. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_NAME. +// +// The function returns the following values: +// +// - filename: string containing the file name. +func (info *FileInfo) Name() string { + var _arg0 *C.GFileInfo // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_name(_arg0) + runtime.KeepAlive(info) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// Size gets the file's size (in bytes). The size is retrieved through the +// value of the G_FILE_ATTRIBUTE_STANDARD_SIZE attribute and is converted from +// #guint64 to #goffset before returning the result. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_SIZE. +// +// The function returns the following values: +// +// - gint64 containing the file's size (in bytes). +func (info *FileInfo) Size() int64 { + var _arg0 *C.GFileInfo // out + var _cret C.goffset // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_size(_arg0) + runtime.KeepAlive(info) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// SortOrder gets the value of the sort_order attribute from the Info. +// See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. +// +// The function returns the following values: +// +// - gint32 containing the value of the "standard::sort_order" attribute. +func (info *FileInfo) SortOrder() int32 { + var _arg0 *C.GFileInfo // out + var _cret C.gint32 // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_sort_order(_arg0) + runtime.KeepAlive(info) + + var _gint32 int32 // out + + _gint32 = int32(_cret) + + return _gint32 +} + +// SymbolicIcon gets the symbolic icon for a file. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON. +// +// The function returns the following values: +// +// - icon (optional) for the given info. +func (info *FileInfo) SymbolicIcon() *Icon { + var _arg0 *C.GFileInfo // out + var _cret *C.GIcon // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_symbolic_icon(_arg0) + runtime.KeepAlive(info) + + var _icon *Icon // out + + if _cret != nil { + _icon = wrapIcon(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _icon +} + +// SymlinkTarget gets the symlink target for a given Info. +// +// It is an error to call this if the Info does not contain +// G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET. +// +// The function returns the following values: +// +// - filename (optional): string containing the symlink target. +func (info *FileInfo) SymlinkTarget() string { + var _arg0 *C.GFileInfo // out + var _cret *C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + _cret = C.g_file_info_get_symlink_target(_arg0) + runtime.KeepAlive(info) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// HasAttribute checks if a file info structure has an attribute named +// attribute. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - ok: TRUE if info has an attribute named attribute, FALSE otherwise. +func (info *FileInfo) HasAttribute(attribute string) bool { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_has_attribute(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HasNamespace checks if a file info structure has an attribute in the +// specified name_space. +// +// The function takes the following parameters: +// +// - nameSpace: file attribute namespace. +// +// The function returns the following values: +// +// - ok: TRUE if info has an attribute in name_space, FALSE otherwise. +func (info *FileInfo) HasNamespace(nameSpace string) bool { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(nameSpace))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_info_has_namespace(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(nameSpace) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ListAttributes lists the file info structure's attributes. +// +// The function takes the following parameters: +// +// - nameSpace (optional): file attribute key's namespace, or NULL to list all +// attributes. +// +// The function returns the following values: +// +// - utf8s (optional): a null-terminated array of strings of all of the +// possible attribute types for the given name_space, or NULL on error. +func (info *FileInfo) ListAttributes(nameSpace string) []string { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _cret **C.char // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + if nameSpace != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(nameSpace))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_file_info_list_attributes(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(nameSpace) + + var _utf8s []string // out + + if _cret != nil { + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + } + + return _utf8s +} + +// RemoveAttribute removes all cases of attribute from info if it exists. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +func (info *FileInfo) RemoveAttribute(attribute string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_file_info_remove_attribute(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) +} + +// SetAccessDateTime sets the G_FILE_ATTRIBUTE_TIME_ACCESS and +// G_FILE_ATTRIBUTE_TIME_ACCESS_USEC attributes in the file info to the given +// date/time value. +// +// G_FILE_ATTRIBUTE_TIME_ACCESS_NSEC will be cleared. +// +// The function takes the following parameters: +// +// - atime: Time. +func (info *FileInfo) SetAccessDateTime(atime *glib.DateTime) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.GDateTime // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(atime))) + + C.g_file_info_set_access_date_time(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(atime) +} + +// SetAttribute sets the attribute to contain the given value, if possible. +// To unset the attribute, use G_FILE_ATTRIBUTE_TYPE_INVALID for type. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - typ: AttributeType. +// - valueP: pointer to the value. +func (info *FileInfo) SetAttribute(attribute string, typ FileAttributeType, valueP unsafe.Pointer) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 C.GFileAttributeType // out + var _arg3 C.gpointer // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileAttributeType(typ) + _arg3 = (C.gpointer)(unsafe.Pointer(valueP)) + + C.g_file_info_set_attribute(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(typ) + runtime.KeepAlive(valueP) +} + +// SetAttributeBoolean sets the attribute to contain the given attr_value, +// if possible. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - attrValue: boolean value. +func (info *FileInfo) SetAttributeBoolean(attribute string, attrValue bool) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + if attrValue { + _arg2 = C.TRUE + } + + C.g_file_info_set_attribute_boolean(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetAttributeByteString sets the attribute to contain the given attr_value, +// if possible. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - attrValue: byte string. +func (info *FileInfo) SetAttributeByteString(attribute, attrValue string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 *C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(attrValue))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_file_info_set_attribute_byte_string(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetAttributeFilePath sets the attribute to contain the given attr_value, +// if possible. +// +// This function is meant to be used by language bindings that have specific +// handling for Unix paths. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - attrValue: file path. +func (info *FileInfo) SetAttributeFilePath(attribute, attrValue string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 *C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(attrValue))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_file_info_set_attribute_file_path(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetAttributeInt32 sets the attribute to contain the given attr_value, +// if possible. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - attrValue: signed 32-bit integer. +func (info *FileInfo) SetAttributeInt32(attribute string, attrValue int32) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 C.gint32 // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint32(attrValue) + + C.g_file_info_set_attribute_int32(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetAttributeInt64 sets the attribute to contain the given attr_value, +// if possible. +// +// The function takes the following parameters: +// +// - attribute name to set. +// - attrValue: int64 value to set attribute to. +func (info *FileInfo) SetAttributeInt64(attribute string, attrValue int64) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 C.gint64 // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint64(attrValue) + + C.g_file_info_set_attribute_int64(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetAttributeMask sets mask on info to match specific attribute types. +// +// The function takes the following parameters: +// +// - mask: AttributeMatcher. +func (info *FileInfo) SetAttributeMask(mask *FileAttributeMatcher) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.GFileAttributeMatcher // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.GFileAttributeMatcher)(gextras.StructNative(unsafe.Pointer(mask))) + + C.g_file_info_set_attribute_mask(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(mask) +} + +// SetAttributeObject sets the attribute to contain the given attr_value, +// if possible. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - attrValue: #GObject. +func (info *FileInfo) SetAttributeObject(attribute string, attrValue *coreglib.Object) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 *C.GObject // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GObject)(unsafe.Pointer(attrValue.Native())) + + C.g_file_info_set_attribute_object(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetAttributeStatus sets the attribute status for an attribute key. This is +// only needed by external code that implement g_file_set_attributes_from_info() +// or similar functions. +// +// The attribute must exist in info for this to work. Otherwise FALSE is +// returned and info is unchanged. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - status: AttributeStatus. +// +// The function returns the following values: +// +// - ok: TRUE if the status was changed, FALSE if the key was not set. +func (info *FileInfo) SetAttributeStatus(attribute string, status FileAttributeStatus) bool { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 C.GFileAttributeStatus // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileAttributeStatus(status) + + _cret = C.g_file_info_set_attribute_status(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(status) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetAttributeString sets the attribute to contain the given attr_value, +// if possible. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - attrValue: UTF-8 string. +func (info *FileInfo) SetAttributeString(attribute, attrValue string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 *C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(attrValue))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_file_info_set_attribute_string(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetAttributeStringv sets the attribute to contain the given attr_value, +// if possible. +// +// Sinze: 2.22. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - attrValue: NULL terminated array of UTF-8 strings. +func (info *FileInfo) SetAttributeStringv(attribute string, attrValue []string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 **C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + { + _arg2 = (**C.char)(C.calloc(C.size_t((len(attrValue) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice(_arg2, len(attrValue)+1) + var zero *C.char + out[len(attrValue)] = zero + for i := range attrValue { + out[i] = (*C.char)(unsafe.Pointer(C.CString(attrValue[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.g_file_info_set_attribute_stringv(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetAttributeUint32 sets the attribute to contain the given attr_value, +// if possible. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - attrValue: unsigned 32-bit integer. +func (info *FileInfo) SetAttributeUint32(attribute string, attrValue uint32) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 C.guint32 // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint32(attrValue) + + C.g_file_info_set_attribute_uint32(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetAttributeUint64 sets the attribute to contain the given attr_value, +// if possible. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// - attrValue: unsigned 64-bit integer. +func (info *FileInfo) SetAttributeUint64(attribute string, attrValue uint64) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + var _arg2 C.guint64 // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint64(attrValue) + + C.g_file_info_set_attribute_uint64(_arg0, _arg1, _arg2) + runtime.KeepAlive(info) + runtime.KeepAlive(attribute) + runtime.KeepAlive(attrValue) +} + +// SetContentType sets the content type attribute for a given Info. See +// G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE. +// +// The function takes the following parameters: +// +// - contentType: content type. See [GContentType][gio-GContentType]. +func (info *FileInfo) SetContentType(contentType string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_file_info_set_content_type(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(contentType) +} + +// SetCreationDateTime sets the G_FILE_ATTRIBUTE_TIME_CREATED and +// G_FILE_ATTRIBUTE_TIME_CREATED_USEC attributes in the file info to the given +// date/time value. +// +// G_FILE_ATTRIBUTE_TIME_CREATED_NSEC will be cleared. +// +// The function takes the following parameters: +// +// - creationTime: Time. +func (info *FileInfo) SetCreationDateTime(creationTime *glib.DateTime) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.GDateTime // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(creationTime))) + + C.g_file_info_set_creation_date_time(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(creationTime) +} + +// SetDisplayName sets the display name for the current Info. See +// G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME. +// +// The function takes the following parameters: +// +// - displayName: string containing a display name. +func (info *FileInfo) SetDisplayName(displayName string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(displayName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_file_info_set_display_name(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(displayName) +} + +// SetEditName sets the edit name for the current file. See +// G_FILE_ATTRIBUTE_STANDARD_EDIT_NAME. +// +// The function takes the following parameters: +// +// - editName: string containing an edit name. +func (info *FileInfo) SetEditName(editName string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(editName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_file_info_set_edit_name(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(editName) +} + +// SetFileType sets the file type in a Info to type. See +// G_FILE_ATTRIBUTE_STANDARD_TYPE. +// +// The function takes the following parameters: +// +// - typ: Type. +func (info *FileInfo) SetFileType(typ FileType) { + var _arg0 *C.GFileInfo // out + var _arg1 C.GFileType // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = C.GFileType(typ) + + C.g_file_info_set_file_type(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(typ) +} + +// SetIcon sets the icon for a given Info. See G_FILE_ATTRIBUTE_STANDARD_ICON. +// +// The function takes the following parameters: +// +// - icon: #GIcon. +func (info *FileInfo) SetIcon(icon Iconner) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.GIcon // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + C.g_file_info_set_icon(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(icon) +} + +// SetIsHidden sets the "is_hidden" attribute in a Info according to is_hidden. +// See G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN. +// +// The function takes the following parameters: +// +// - isHidden: #gboolean. +func (info *FileInfo) SetIsHidden(isHidden bool) { + var _arg0 *C.GFileInfo // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + if isHidden { + _arg1 = C.TRUE + } + + C.g_file_info_set_is_hidden(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(isHidden) +} + +// SetIsSymlink sets the "is_symlink" attribute in a Info according to +// is_symlink. See G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK. +// +// The function takes the following parameters: +// +// - isSymlink: #gboolean. +func (info *FileInfo) SetIsSymlink(isSymlink bool) { + var _arg0 *C.GFileInfo // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + if isSymlink { + _arg1 = C.TRUE + } + + C.g_file_info_set_is_symlink(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(isSymlink) +} + +// SetModificationDateTime sets the G_FILE_ATTRIBUTE_TIME_MODIFIED and +// G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given +// date/time value. +// +// G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC will be cleared. +// +// The function takes the following parameters: +// +// - mtime: Time. +func (info *FileInfo) SetModificationDateTime(mtime *glib.DateTime) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.GDateTime // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(mtime))) + + C.g_file_info_set_modification_date_time(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(mtime) +} + +// SetModificationTime sets the G_FILE_ATTRIBUTE_TIME_MODIFIED and +// G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC attributes in the file info to the given +// time value. +// +// G_FILE_ATTRIBUTE_TIME_MODIFIED_NSEC will be cleared. +// +// Deprecated: Use g_file_info_set_modification_date_time() instead, as Val is +// deprecated due to the year 2038 problem. +// +// The function takes the following parameters: +// +// - mtime: Val. +func (info *FileInfo) SetModificationTime(mtime *glib.TimeVal) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.GTimeVal // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(mtime))) + + C.g_file_info_set_modification_time(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(mtime) +} + +// SetName sets the name attribute for the current Info. See +// G_FILE_ATTRIBUTE_STANDARD_NAME. +// +// The function takes the following parameters: +// +// - name: string containing a name. +func (info *FileInfo) SetName(name string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_file_info_set_name(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(name) +} + +// SetSize sets the G_FILE_ATTRIBUTE_STANDARD_SIZE attribute in the file info to +// the given size. +// +// The function takes the following parameters: +// +// - size containing the file's size. +func (info *FileInfo) SetSize(size int64) { + var _arg0 *C.GFileInfo // out + var _arg1 C.goffset // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = C.goffset(size) + + C.g_file_info_set_size(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(size) +} + +// SetSortOrder sets the sort order attribute in the file info structure. +// See G_FILE_ATTRIBUTE_STANDARD_SORT_ORDER. +// +// The function takes the following parameters: +// +// - sortOrder: sort order integer. +func (info *FileInfo) SetSortOrder(sortOrder int32) { + var _arg0 *C.GFileInfo // out + var _arg1 C.gint32 // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = C.gint32(sortOrder) + + C.g_file_info_set_sort_order(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(sortOrder) +} + +// SetSymbolicIcon sets the symbolic icon for a given Info. See +// G_FILE_ATTRIBUTE_STANDARD_SYMBOLIC_ICON. +// +// The function takes the following parameters: +// +// - icon: #GIcon. +func (info *FileInfo) SetSymbolicIcon(icon Iconner) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.GIcon // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + C.g_file_info_set_symbolic_icon(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(icon) +} + +// SetSymlinkTarget sets the G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET attribute +// in the file info to the given symlink target. +// +// The function takes the following parameters: +// +// - symlinkTarget: static string containing a path to a symlink target. +func (info *FileInfo) SetSymlinkTarget(symlinkTarget string) { + var _arg0 *C.GFileInfo // out + var _arg1 *C.char // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(symlinkTarget))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_file_info_set_symlink_target(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(symlinkTarget) +} + +// UnsetAttributeMask unsets a mask set by g_file_info_set_attribute_mask(), +// if one is set. +func (info *FileInfo) UnsetAttributeMask() { + var _arg0 *C.GFileInfo // out + + _arg0 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + + C.g_file_info_unset_attribute_mask(_arg0) + runtime.KeepAlive(info) +} + +// FileInputStreamOverrides contains methods that are overridable. +type FileInputStreamOverrides struct { + CanSeek func() bool + // QueryInfo queries a file input stream the given attributes. This function + // blocks while querying the stream. For the asynchronous (non-blocking) + // version of this function, see g_file_input_stream_query_info_async(). + // While the stream is blocked, the stream will set the pending flag + // internally, and any other operations on the stream will fail with + // G_IO_ERROR_PENDING. + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable object, NULL to ignore. + // - attributes: file attribute query string. + // + // The function returns the following values: + // + // - fileInfo or NULL on error. + QueryInfo func(ctx context.Context, attributes string) (*FileInfo, error) + // QueryInfoFinish finishes an asynchronous info query operation. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - fileInfo: Info. + QueryInfoFinish func(result AsyncResulter) (*FileInfo, error) + // The function takes the following parameters: + // + // - ctx (optional) + // - offset + // - typ + Seek func(ctx context.Context, offset int64, typ glib.SeekType) error + Tell func() int64 +} + +func defaultFileInputStreamOverrides(v *FileInputStream) FileInputStreamOverrides { + return FileInputStreamOverrides{ + CanSeek: v.canSeek, + QueryInfo: v.queryInfo, + QueryInfoFinish: v.queryInfoFinish, + Seek: v.seek, + Tell: v.tell, + } +} + +// FileInputStream: GFileInputStream provides input streams that take their +// content from a file. +// +// GFileInputStream implements gio.Seekable, which allows the input stream +// to jump to arbitrary positions in the file, provided the filesystem +// of the file allows it. To find the position of a file input stream, +// use gio.Seekable.Tell(). To find out if a file input stream supports +// seeking, use gio.Seekable.CanSeek(). To position a file input stream, +// use gio.Seekable.Seek(). +type FileInputStream struct { + _ [0]func() // equal guard + InputStream + + *coreglib.Object + Seekable +} + +var ( + _ InputStreamer = (*FileInputStream)(nil) + _ coreglib.Objector = (*FileInputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*FileInputStream, *FileInputStreamClass, FileInputStreamOverrides]( + GTypeFileInputStream, + initFileInputStreamClass, + wrapFileInputStream, + defaultFileInputStreamOverrides, + ) +} + +func initFileInputStreamClass(gclass unsafe.Pointer, overrides FileInputStreamOverrides, classInitFunc func(*FileInputStreamClass)) { + pclass := (*C.GFileInputStreamClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeFileInputStream)))) + + if overrides.CanSeek != nil { + pclass.can_seek = (*[0]byte)(C._gotk4_gio2_FileInputStreamClass_can_seek) + } + + if overrides.QueryInfo != nil { + pclass.query_info = (*[0]byte)(C._gotk4_gio2_FileInputStreamClass_query_info) + } + + if overrides.QueryInfoFinish != nil { + pclass.query_info_finish = (*[0]byte)(C._gotk4_gio2_FileInputStreamClass_query_info_finish) + } + + if overrides.Seek != nil { + pclass.seek = (*[0]byte)(C._gotk4_gio2_FileInputStreamClass_seek) + } + + if overrides.Tell != nil { + pclass.tell = (*[0]byte)(C._gotk4_gio2_FileInputStreamClass_tell) + } + + if classInitFunc != nil { + class := (*FileInputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapFileInputStream(obj *coreglib.Object) *FileInputStream { + return &FileInputStream{ + InputStream: InputStream{ + Object: obj, + }, + Object: obj, + Seekable: Seekable{ + Object: obj, + }, + } +} + +func marshalFileInputStream(p uintptr) (interface{}, error) { + return wrapFileInputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// QueryInfo queries a file input stream the given attributes. This function +// blocks while querying the stream. For the asynchronous (non-blocking) +// version of this function, see g_file_input_stream_query_info_async(). +// While the stream is blocked, the stream will set the pending flag internally, +// and any other operations on the stream will fail with G_IO_ERROR_PENDING. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// +// The function returns the following values: +// +// - fileInfo or NULL on error. +func (stream *FileInputStream) QueryInfo(ctx context.Context, attributes string) (*FileInfo, error) { + var _arg0 *C.GFileInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_input_stream_query_info(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// QueryInfoAsync queries the stream information asynchronously. When +// the operation is finished callback will be called. You can then call +// g_file_input_stream_query_info_finish() to get the result of the operation. +// +// For the synchronous version of this function, see +// g_file_input_stream_query_info(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be set. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *FileInputStream) QueryInfoAsync(ctx context.Context, attributes string, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFileInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFileInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_input_stream_query_info_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// QueryInfoFinish finishes an asynchronous info query operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - fileInfo: Info. +func (stream *FileInputStream) QueryInfoFinish(result AsyncResulter) (*FileInfo, error) { + var _arg0 *C.GFileInputStream // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_file_input_stream_query_info_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +func (stream *FileInputStream) canSeek() bool { + gclass := (*C.GFileInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.can_seek + + var _arg0 *C.GFileInputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileInputStream_virtual_can_seek(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// queryInfo queries a file input stream the given attributes. This function +// blocks while querying the stream. For the asynchronous (non-blocking) +// version of this function, see g_file_input_stream_query_info_async(). +// While the stream is blocked, the stream will set the pending flag internally, +// and any other operations on the stream will fail with G_IO_ERROR_PENDING. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// +// The function returns the following values: +// +// - fileInfo or NULL on error. +func (stream *FileInputStream) queryInfo(ctx context.Context, attributes string) (*FileInfo, error) { + gclass := (*C.GFileInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.query_info + + var _arg0 *C.GFileInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_FileInputStream_virtual_query_info(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// queryInfoAsync queries the stream information asynchronously. When +// the operation is finished callback will be called. You can then call +// g_file_input_stream_query_info_finish() to get the result of the operation. +// +// For the synchronous version of this function, see +// g_file_input_stream_query_info(). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be set. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *FileInputStream) queryInfoAsync(ctx context.Context, attributes string, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.query_info_async + + var _arg0 *C.GFileInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFileInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_FileInputStream_virtual_query_info_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// queryInfoFinish finishes an asynchronous info query operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - fileInfo: Info. +func (stream *FileInputStream) queryInfoFinish(result AsyncResulter) (*FileInfo, error) { + gclass := (*C.GFileInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.query_info_finish + + var _arg0 *C.GFileInputStream // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_FileInputStream_virtual_query_info_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// The function takes the following parameters: +// +// - ctx (optional) +// - offset +// - typ +func (stream *FileInputStream) seek(ctx context.Context, offset int64, typ glib.SeekType) error { + gclass := (*C.GFileInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.seek + + var _arg0 *C.GFileInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 C.goffset // out + var _arg2 C.GSeekType // out + var _cerr *C.GError // in + + _arg0 = (*C.GFileInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.goffset(offset) + _arg2 = C.GSeekType(typ) + + C._gotk4_gio2_FileInputStream_virtual_seek(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(offset) + runtime.KeepAlive(typ) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func (stream *FileInputStream) tell() int64 { + gclass := (*C.GFileInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.tell + + var _arg0 *C.GFileInputStream // out + var _cret C.goffset // in + + _arg0 = (*C.GFileInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileInputStream_virtual_tell(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// FileMonitorOverrides contains methods that are overridable. +type FileMonitorOverrides struct { + // Cancel cancels a file monitor. + // + // The function returns the following values: + // + // - ok always TRUE. + Cancel func() bool + // The function takes the following parameters: + // + // - file + // - otherFile + // - eventType + Changed func(file, otherFile Filer, eventType FileMonitorEvent) +} + +func defaultFileMonitorOverrides(v *FileMonitor) FileMonitorOverrides { + return FileMonitorOverrides{ + Cancel: v.cancel, + Changed: v.changed, + } +} + +// FileMonitor monitors a file or directory for changes. +// +// To obtain a GFileMonitor for a file or directory, use gio.File.Monitor(), +// gio.File.MonitorFile(), or gio.File.MonitorDirectory(). +// +// To get informed about changes to the file or directory you are monitoring, +// connect to the gio.FileMonitor::changed signal. The signal will be emitted in +// the thread-default main context (see glib.MainContext.PushThreadDefault()) of +// the thread that the monitor was created in (though if the global default main +// context is blocked, this may cause notifications to be blocked even if the +// thread-default context is still running). +type FileMonitor struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*FileMonitor)(nil) +) + +// FileMonitorrer describes types inherited from class FileMonitor. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type FileMonitorrer interface { + coreglib.Objector + baseFileMonitor() *FileMonitor +} + +var _ FileMonitorrer = (*FileMonitor)(nil) + +func init() { + coreglib.RegisterClassInfo[*FileMonitor, *FileMonitorClass, FileMonitorOverrides]( + GTypeFileMonitor, + initFileMonitorClass, + wrapFileMonitor, + defaultFileMonitorOverrides, + ) +} + +func initFileMonitorClass(gclass unsafe.Pointer, overrides FileMonitorOverrides, classInitFunc func(*FileMonitorClass)) { + pclass := (*C.GFileMonitorClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeFileMonitor)))) + + if overrides.Cancel != nil { + pclass.cancel = (*[0]byte)(C._gotk4_gio2_FileMonitorClass_cancel) + } + + if overrides.Changed != nil { + pclass.changed = (*[0]byte)(C._gotk4_gio2_FileMonitorClass_changed) + } + + if classInitFunc != nil { + class := (*FileMonitorClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapFileMonitor(obj *coreglib.Object) *FileMonitor { + return &FileMonitor{ + Object: obj, + } +} + +func marshalFileMonitor(p uintptr) (interface{}, error) { + return wrapFileMonitor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (monitor *FileMonitor) baseFileMonitor() *FileMonitor { + return monitor +} + +// BaseFileMonitor returns the underlying base object. +func BaseFileMonitor(obj FileMonitorrer) *FileMonitor { + return obj.baseFileMonitor() +} + +// ConnectChanged is emitted when file has been changed. +// +// If using G_FILE_MONITOR_WATCH_MOVES on a directory monitor, and the +// information is available (and if supported by the backend), event_type +// may be G_FILE_MONITOR_EVENT_RENAMED, G_FILE_MONITOR_EVENT_MOVED_IN or +// G_FILE_MONITOR_EVENT_MOVED_OUT. +// +// In all cases file will be a child of the monitored directory. For renames, +// file will be the old name and other_file is the new name. For "moved in" +// events, file is the name of the file that appeared and other_file is the old +// name that it was moved from (in another directory). For "moved out" events, +// file is the name of the file that used to be in this directory and other_file +// is the name of the file at its new location. +// +// It makes sense to treat G_FILE_MONITOR_EVENT_MOVED_IN as equivalent +// to G_FILE_MONITOR_EVENT_CREATED and G_FILE_MONITOR_EVENT_MOVED_OUT as +// equivalent to G_FILE_MONITOR_EVENT_DELETED, with extra information. +// G_FILE_MONITOR_EVENT_RENAMED is equivalent to a delete/create pair. +// This is exactly how the events will be reported in the case that the +// G_FILE_MONITOR_WATCH_MOVES flag is not in use. +// +// If using the deprecated flag G_FILE_MONITOR_SEND_MOVED flag and event_type is +// G_FILE_MONITOR_EVENT_MOVED, file will be set to a #GFile containing the old +// path, and other_file will be set to a #GFile containing the new path. +// +// In all the other cases, other_file will be set to LL. +func (monitor *FileMonitor) ConnectChanged(f func(file, otherFile Filer, eventType FileMonitorEvent)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(monitor, "changed", false, unsafe.Pointer(C._gotk4_gio2_FileMonitor_ConnectChanged), f) +} + +// Cancel cancels a file monitor. +// +// The function returns the following values: +// +// - ok always TRUE. +func (monitor *FileMonitor) Cancel() bool { + var _arg0 *C.GFileMonitor // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.g_file_monitor_cancel(_arg0) + runtime.KeepAlive(monitor) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// EmitEvent emits the Monitor::changed signal if a change has taken place. +// Should be called from file monitor implementations only. +// +// Implementations are responsible to call this method from the [thread-default +// main context][g-main-context-push-thread-default] of the thread that the +// monitor was created in. +// +// The function takes the following parameters: +// +// - child: #GFile. +// - otherFile: #GFile. +// - eventType: set of MonitorEvent flags. +func (monitor *FileMonitor) EmitEvent(child, otherFile Filer, eventType FileMonitorEvent) { + var _arg0 *C.GFileMonitor // out + var _arg1 *C.GFile // out + var _arg2 *C.GFile // out + var _arg3 C.GFileMonitorEvent // out + + _arg0 = (*C.GFileMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(otherFile).Native())) + _arg3 = C.GFileMonitorEvent(eventType) + + C.g_file_monitor_emit_event(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(monitor) + runtime.KeepAlive(child) + runtime.KeepAlive(otherFile) + runtime.KeepAlive(eventType) +} + +// IsCancelled returns whether the monitor is canceled. +// +// The function returns the following values: +// +// - ok: TRUE if monitor is canceled. FALSE otherwise. +func (monitor *FileMonitor) IsCancelled() bool { + var _arg0 *C.GFileMonitor // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C.g_file_monitor_is_cancelled(_arg0) + runtime.KeepAlive(monitor) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetRateLimit sets the rate limit to which the monitor will report consecutive +// change events to the same file. +// +// The function takes the following parameters: +// +// - limitMsecs: non-negative integer with the limit in milliseconds to poll +// for changes. +func (monitor *FileMonitor) SetRateLimit(limitMsecs int) { + var _arg0 *C.GFileMonitor // out + var _arg1 C.gint // out + + _arg0 = (*C.GFileMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + _arg1 = C.gint(limitMsecs) + + C.g_file_monitor_set_rate_limit(_arg0, _arg1) + runtime.KeepAlive(monitor) + runtime.KeepAlive(limitMsecs) +} + +// Cancel cancels a file monitor. +// +// The function returns the following values: +// +// - ok always TRUE. +func (monitor *FileMonitor) cancel() bool { + gclass := (*C.GFileMonitorClass)(coreglib.PeekParentClass(monitor)) + fnarg := gclass.cancel + + var _arg0 *C.GFileMonitor // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + + _cret = C._gotk4_gio2_FileMonitor_virtual_cancel(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(monitor) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// The function takes the following parameters: +// +// - file +// - otherFile +// - eventType +func (monitor *FileMonitor) changed(file, otherFile Filer, eventType FileMonitorEvent) { + gclass := (*C.GFileMonitorClass)(coreglib.PeekParentClass(monitor)) + fnarg := gclass.changed + + var _arg0 *C.GFileMonitor // out + var _arg1 *C.GFile // out + var _arg2 *C.GFile // out + var _arg3 C.GFileMonitorEvent // out + + _arg0 = (*C.GFileMonitor)(unsafe.Pointer(coreglib.InternObject(monitor).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg2 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(otherFile).Native())) + _arg3 = C.GFileMonitorEvent(eventType) + + C._gotk4_gio2_FileMonitor_virtual_changed(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(monitor) + runtime.KeepAlive(file) + runtime.KeepAlive(otherFile) + runtime.KeepAlive(eventType) +} + +// FileOutputStreamOverrides contains methods that are overridable. +type FileOutputStreamOverrides struct { + CanSeek func() bool + CanTruncate func() bool + // ETag gets the entity tag for the file when it has been written. This must + // be called after the stream has been written and closed, as the etag can + // change while writing. + // + // The function returns the following values: + // + // - utf8 (optional): entity tag for the stream. + ETag func() string + // QueryInfo queries a file output stream for the given attributes. This + // function blocks while querying the stream. For the asynchronous version + // of this function, see g_file_output_stream_query_info_async(). While + // the stream is blocked, the stream will set the pending flag internally, + // and any other operations on the stream will fail with G_IO_ERROR_PENDING. + // + // Can fail if the stream was already closed (with error being set to + // G_IO_ERROR_CLOSED), the stream has pending operations (with error being + // set to G_IO_ERROR_PENDING), or if querying info is not supported for the + // stream's interface (with error being set to G_IO_ERROR_NOT_SUPPORTED). + // In all cases of failure, NULL will be returned. + // + // If cancellable is not NULL, then the operation can be cancelled by + // triggering the cancellable object from another thread. If the operation + // was cancelled, the error G_IO_ERROR_CANCELLED will be set, and NULL will + // be returned. + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable object, NULL to ignore. + // - attributes: file attribute query string. + // + // The function returns the following values: + // + // - fileInfo for the stream, or NULL on error. + QueryInfo func(ctx context.Context, attributes string) (*FileInfo, error) + // QueryInfoFinish finalizes the asynchronous query started by + // g_file_output_stream_query_info_async(). + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - fileInfo for the finished query. + QueryInfoFinish func(result AsyncResulter) (*FileInfo, error) + // The function takes the following parameters: + // + // - ctx (optional) + // - offset + // - typ + Seek func(ctx context.Context, offset int64, typ glib.SeekType) error + Tell func() int64 + // The function takes the following parameters: + // + // - ctx (optional) + // - size + TruncateFn func(ctx context.Context, size int64) error +} + +func defaultFileOutputStreamOverrides(v *FileOutputStream) FileOutputStreamOverrides { + return FileOutputStreamOverrides{ + CanSeek: v.canSeek, + CanTruncate: v.canTruncate, + ETag: v.eTag, + QueryInfo: v.queryInfo, + QueryInfoFinish: v.queryInfoFinish, + Seek: v.seek, + Tell: v.tell, + TruncateFn: v.truncateFn, + } +} + +// FileOutputStream: GFileOutputStream provides output streams that write their +// content to a file. +// +// GFileOutputStream implements gio.Seekable, which allows the output stream to +// jump to arbitrary positions in the file and to truncate the file, provided +// the filesystem of the file supports these operations. +// +// To find the position of a file output stream, use gio.Seekable.Tell(). +// To find out if a file output stream supports seeking, +// use gio.Seekable.CanSeek().To position a file output stream, use +// gio.Seekable.Seek(). To find out if a file output stream supports truncating, +// use gio.Seekable.CanTruncate(). To truncate a file output stream, use +// gio.Seekable.Truncate(). +type FileOutputStream struct { + _ [0]func() // equal guard + OutputStream + + *coreglib.Object + Seekable +} + +var ( + _ OutputStreamer = (*FileOutputStream)(nil) + _ coreglib.Objector = (*FileOutputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*FileOutputStream, *FileOutputStreamClass, FileOutputStreamOverrides]( + GTypeFileOutputStream, + initFileOutputStreamClass, + wrapFileOutputStream, + defaultFileOutputStreamOverrides, + ) +} + +func initFileOutputStreamClass(gclass unsafe.Pointer, overrides FileOutputStreamOverrides, classInitFunc func(*FileOutputStreamClass)) { + pclass := (*C.GFileOutputStreamClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeFileOutputStream)))) + + if overrides.CanSeek != nil { + pclass.can_seek = (*[0]byte)(C._gotk4_gio2_FileOutputStreamClass_can_seek) + } + + if overrides.CanTruncate != nil { + pclass.can_truncate = (*[0]byte)(C._gotk4_gio2_FileOutputStreamClass_can_truncate) + } + + if overrides.ETag != nil { + pclass.get_etag = (*[0]byte)(C._gotk4_gio2_FileOutputStreamClass_get_etag) + } + + if overrides.QueryInfo != nil { + pclass.query_info = (*[0]byte)(C._gotk4_gio2_FileOutputStreamClass_query_info) + } + + if overrides.QueryInfoFinish != nil { + pclass.query_info_finish = (*[0]byte)(C._gotk4_gio2_FileOutputStreamClass_query_info_finish) + } + + if overrides.Seek != nil { + pclass.seek = (*[0]byte)(C._gotk4_gio2_FileOutputStreamClass_seek) + } + + if overrides.Tell != nil { + pclass.tell = (*[0]byte)(C._gotk4_gio2_FileOutputStreamClass_tell) + } + + if overrides.TruncateFn != nil { + pclass.truncate_fn = (*[0]byte)(C._gotk4_gio2_FileOutputStreamClass_truncate_fn) + } + + if classInitFunc != nil { + class := (*FileOutputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapFileOutputStream(obj *coreglib.Object) *FileOutputStream { + return &FileOutputStream{ + OutputStream: OutputStream{ + Object: obj, + }, + Object: obj, + Seekable: Seekable{ + Object: obj, + }, + } +} + +func marshalFileOutputStream(p uintptr) (interface{}, error) { + return wrapFileOutputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ETag gets the entity tag for the file when it has been written. This must be +// called after the stream has been written and closed, as the etag can change +// while writing. +// +// The function returns the following values: +// +// - utf8 (optional): entity tag for the stream. +func (stream *FileOutputStream) ETag() string { + var _arg0 *C.GFileOutputStream // out + var _cret *C.char // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_file_output_stream_get_etag(_arg0) + runtime.KeepAlive(stream) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// QueryInfo queries a file output stream for the given attributes. This +// function blocks while querying the stream. For the asynchronous version of +// this function, see g_file_output_stream_query_info_async(). While the stream +// is blocked, the stream will set the pending flag internally, and any other +// operations on the stream will fail with G_IO_ERROR_PENDING. +// +// Can fail if the stream was already closed (with error being set to +// G_IO_ERROR_CLOSED), the stream has pending operations (with error being set +// to G_IO_ERROR_PENDING), or if querying info is not supported for the stream's +// interface (with error being set to G_IO_ERROR_NOT_SUPPORTED). In all cases of +// failure, NULL will be returned. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be set, and NULL will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// +// The function returns the following values: +// +// - fileInfo for the stream, or NULL on error. +func (stream *FileOutputStream) QueryInfo(ctx context.Context, attributes string) (*FileInfo, error) { + var _arg0 *C.GFileOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_output_stream_query_info(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// QueryInfoAsync: asynchronously queries the stream for a Info. When completed, +// callback will be called with a Result which can be used to finish the +// operation with g_file_output_stream_query_info_finish(). +// +// For the synchronous version of this function, see +// g_file_output_stream_query_info(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// - ioPriority: I/O priority (iface.AsyncResult.html#io-priority) of the +// request. +// - callback (optional) to call when the request is satisfied. +func (stream *FileOutputStream) QueryInfoAsync(ctx context.Context, attributes string, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GFileOutputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_file_output_stream_query_info_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// QueryInfoFinish finalizes the asynchronous query started by +// g_file_output_stream_query_info_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - fileInfo for the finished query. +func (stream *FileOutputStream) QueryInfoFinish(result AsyncResulter) (*FileInfo, error) { + var _arg0 *C.GFileOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_file_output_stream_query_info_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +func (stream *FileOutputStream) canSeek() bool { + gclass := (*C.GFileOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.can_seek + + var _arg0 *C.GFileOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileOutputStream_virtual_can_seek(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +func (stream *FileOutputStream) canTruncate() bool { + gclass := (*C.GFileOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.can_truncate + + var _arg0 *C.GFileOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileOutputStream_virtual_can_truncate(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// eTag gets the entity tag for the file when it has been written. This must be +// called after the stream has been written and closed, as the etag can change +// while writing. +// +// The function returns the following values: +// +// - utf8 (optional): entity tag for the stream. +func (stream *FileOutputStream) eTag() string { + gclass := (*C.GFileOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.get_etag + + var _arg0 *C.GFileOutputStream // out + var _cret *C.char // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileOutputStream_virtual_get_etag(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// queryInfo queries a file output stream for the given attributes. This +// function blocks while querying the stream. For the asynchronous version of +// this function, see g_file_output_stream_query_info_async(). While the stream +// is blocked, the stream will set the pending flag internally, and any other +// operations on the stream will fail with G_IO_ERROR_PENDING. +// +// Can fail if the stream was already closed (with error being set to +// G_IO_ERROR_CLOSED), the stream has pending operations (with error being set +// to G_IO_ERROR_PENDING), or if querying info is not supported for the stream's +// interface (with error being set to G_IO_ERROR_NOT_SUPPORTED). In all cases of +// failure, NULL will be returned. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be set, and NULL will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// +// The function returns the following values: +// +// - fileInfo for the stream, or NULL on error. +func (stream *FileOutputStream) queryInfo(ctx context.Context, attributes string) (*FileInfo, error) { + gclass := (*C.GFileOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.query_info + + var _arg0 *C.GFileOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 *C.char // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_FileOutputStream_virtual_query_info(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// queryInfoAsync: asynchronously queries the stream for a Info. When completed, +// callback will be called with a Result which can be used to finish the +// operation with g_file_output_stream_query_info_finish(). +// +// For the synchronous version of this function, see +// g_file_output_stream_query_info(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - attributes: file attribute query string. +// - ioPriority: I/O priority (iface.AsyncResult.html#io-priority) of the +// request. +// - callback (optional) to call when the request is satisfied. +func (stream *FileOutputStream) queryInfoAsync(ctx context.Context, attributes string, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GFileOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.query_info_async + + var _arg0 *C.GFileOutputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_FileOutputStream_virtual_query_info_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(attributes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// queryInfoFinish finalizes the asynchronous query started by +// g_file_output_stream_query_info_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - fileInfo for the finished query. +func (stream *FileOutputStream) queryInfoFinish(result AsyncResulter) (*FileInfo, error) { + gclass := (*C.GFileOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.query_info_finish + + var _arg0 *C.GFileOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GFileInfo // in + var _cerr *C.GError // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_FileOutputStream_virtual_query_info_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _fileInfo *FileInfo // out + var _goerr error // out + + _fileInfo = wrapFileInfo(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fileInfo, _goerr +} + +// The function takes the following parameters: +// +// - ctx (optional) +// - offset +// - typ +func (stream *FileOutputStream) seek(ctx context.Context, offset int64, typ glib.SeekType) error { + gclass := (*C.GFileOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.seek + + var _arg0 *C.GFileOutputStream // out + var _arg3 *C.GCancellable // out + var _arg1 C.goffset // out + var _arg2 C.GSeekType // out + var _cerr *C.GError // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.goffset(offset) + _arg2 = C.GSeekType(typ) + + C._gotk4_gio2_FileOutputStream_virtual_seek(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(offset) + runtime.KeepAlive(typ) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func (stream *FileOutputStream) tell() int64 { + gclass := (*C.GFileOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.tell + + var _arg0 *C.GFileOutputStream // out + var _cret C.goffset // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_FileOutputStream_virtual_tell(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// The function takes the following parameters: +// +// - ctx (optional) +// - size +func (stream *FileOutputStream) truncateFn(ctx context.Context, size int64) error { + gclass := (*C.GFileOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.truncate_fn + + var _arg0 *C.GFileOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.goffset // out + var _cerr *C.GError // in + + _arg0 = (*C.GFileOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.goffset(size) + + C._gotk4_gio2_FileOutputStream_virtual_truncate_fn(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(size) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// FilenameCompleterOverrides contains methods that are overridable. +type FilenameCompleterOverrides struct { + GotCompletionData func() +} + +func defaultFilenameCompleterOverrides(v *FilenameCompleter) FilenameCompleterOverrides { + return FilenameCompleterOverrides{ + GotCompletionData: v.gotCompletionData, + } +} + +// FilenameCompleter completes partial file and directory names given a partial +// string by looking in the file system for clues. Can return a list of possible +// completion strings for widget implementations. +type FilenameCompleter struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*FilenameCompleter)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*FilenameCompleter, *FilenameCompleterClass, FilenameCompleterOverrides]( + GTypeFilenameCompleter, + initFilenameCompleterClass, + wrapFilenameCompleter, + defaultFilenameCompleterOverrides, + ) +} + +func initFilenameCompleterClass(gclass unsafe.Pointer, overrides FilenameCompleterOverrides, classInitFunc func(*FilenameCompleterClass)) { + pclass := (*C.GFilenameCompleterClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeFilenameCompleter)))) + + if overrides.GotCompletionData != nil { + pclass.got_completion_data = (*[0]byte)(C._gotk4_gio2_FilenameCompleterClass_got_completion_data) + } + + if classInitFunc != nil { + class := (*FilenameCompleterClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapFilenameCompleter(obj *coreglib.Object) *FilenameCompleter { + return &FilenameCompleter{ + Object: obj, + } +} + +func marshalFilenameCompleter(p uintptr) (interface{}, error) { + return wrapFilenameCompleter(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectGotCompletionData is emitted when the file name completion information +// comes available. +func (completer *FilenameCompleter) ConnectGotCompletionData(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(completer, "got-completion-data", false, unsafe.Pointer(C._gotk4_gio2_FilenameCompleter_ConnectGotCompletionData), f) +} + +// NewFilenameCompleter creates a new filename completer. +// +// The function returns the following values: +// +// - filenameCompleter: Completer. +func NewFilenameCompleter() *FilenameCompleter { + var _cret *C.GFilenameCompleter // in + + _cret = C.g_filename_completer_new() + + var _filenameCompleter *FilenameCompleter // out + + _filenameCompleter = wrapFilenameCompleter(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _filenameCompleter +} + +// CompletionSuffix obtains a completion for initial_text from completer. +// +// The function takes the following parameters: +// +// - initialText: text to be completed. +// +// The function returns the following values: +// +// - utf8 (optional): completed string, or NULL if no completion exists. This +// string is not owned by GIO, so remember to g_free() it when finished. +func (completer *FilenameCompleter) CompletionSuffix(initialText string) string { + var _arg0 *C.GFilenameCompleter // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GFilenameCompleter)(unsafe.Pointer(coreglib.InternObject(completer).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(initialText))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_filename_completer_get_completion_suffix(_arg0, _arg1) + runtime.KeepAlive(completer) + runtime.KeepAlive(initialText) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Completions gets an array of completion strings for a given initial text. +// +// The function takes the following parameters: +// +// - initialText: text to be completed. +// +// The function returns the following values: +// +// - utf8s: array of strings with possible completions for initial_text. +// This array must be freed by g_strfreev() when finished. +func (completer *FilenameCompleter) Completions(initialText string) []string { + var _arg0 *C.GFilenameCompleter // out + var _arg1 *C.char // out + var _cret **C.char // in + + _arg0 = (*C.GFilenameCompleter)(unsafe.Pointer(coreglib.InternObject(completer).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(initialText))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_filename_completer_get_completions(_arg0, _arg1) + runtime.KeepAlive(completer) + runtime.KeepAlive(initialText) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// SetDirsOnly: if dirs_only is TRUE, completer will only complete directory +// names, and not file names. +// +// The function takes the following parameters: +// +// - dirsOnly: #gboolean. +func (completer *FilenameCompleter) SetDirsOnly(dirsOnly bool) { + var _arg0 *C.GFilenameCompleter // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GFilenameCompleter)(unsafe.Pointer(coreglib.InternObject(completer).Native())) + if dirsOnly { + _arg1 = C.TRUE + } + + C.g_filename_completer_set_dirs_only(_arg0, _arg1) + runtime.KeepAlive(completer) + runtime.KeepAlive(dirsOnly) +} + +func (filenameCompleter *FilenameCompleter) gotCompletionData() { + gclass := (*C.GFilenameCompleterClass)(coreglib.PeekParentClass(filenameCompleter)) + fnarg := gclass.got_completion_data + + var _arg0 *C.GFilenameCompleter // out + + _arg0 = (*C.GFilenameCompleter)(unsafe.Pointer(coreglib.InternObject(filenameCompleter).Native())) + + C._gotk4_gio2_FilenameCompleter_virtual_got_completion_data(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(filenameCompleter) +} + +// FilterInputStreamOverrides contains methods that are overridable. +type FilterInputStreamOverrides struct { +} + +func defaultFilterInputStreamOverrides(v *FilterInputStream) FilterInputStreamOverrides { + return FilterInputStreamOverrides{} +} + +// FilterInputStream: base class for input stream implementations that perform +// some kind of filtering operation on a base stream. Typical examples of +// filtering operations are character set conversion, compression and byte order +// flipping. +type FilterInputStream struct { + _ [0]func() // equal guard + InputStream +} + +var ( + _ InputStreamer = (*FilterInputStream)(nil) +) + +// FilterInputStreamer describes types inherited from class FilterInputStream. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type FilterInputStreamer interface { + coreglib.Objector + baseFilterInputStream() *FilterInputStream +} + +var _ FilterInputStreamer = (*FilterInputStream)(nil) + +func init() { + coreglib.RegisterClassInfo[*FilterInputStream, *FilterInputStreamClass, FilterInputStreamOverrides]( + GTypeFilterInputStream, + initFilterInputStreamClass, + wrapFilterInputStream, + defaultFilterInputStreamOverrides, + ) +} + +func initFilterInputStreamClass(gclass unsafe.Pointer, overrides FilterInputStreamOverrides, classInitFunc func(*FilterInputStreamClass)) { + if classInitFunc != nil { + class := (*FilterInputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapFilterInputStream(obj *coreglib.Object) *FilterInputStream { + return &FilterInputStream{ + InputStream: InputStream{ + Object: obj, + }, + } +} + +func marshalFilterInputStream(p uintptr) (interface{}, error) { + return wrapFilterInputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (stream *FilterInputStream) baseFilterInputStream() *FilterInputStream { + return stream +} + +// BaseFilterInputStream returns the underlying base object. +func BaseFilterInputStream(obj FilterInputStreamer) *FilterInputStream { + return obj.baseFilterInputStream() +} + +// BaseStream gets the base stream for the filter stream. +// +// The function returns the following values: +// +// - inputStream: Stream. +func (stream *FilterInputStream) BaseStream() InputStreamer { + var _arg0 *C.GFilterInputStream // out + var _cret *C.GInputStream // in + + _arg0 = (*C.GFilterInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_filter_input_stream_get_base_stream(_arg0) + runtime.KeepAlive(stream) + + var _inputStream InputStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + + return _inputStream +} + +// CloseBaseStream returns whether the base stream will be closed when stream is +// closed. +// +// The function returns the following values: +// +// - ok: TRUE if the base stream will be closed. +func (stream *FilterInputStream) CloseBaseStream() bool { + var _arg0 *C.GFilterInputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GFilterInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_filter_input_stream_get_close_base_stream(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetCloseBaseStream sets whether the base stream will be closed when stream is +// closed. +// +// The function takes the following parameters: +// +// - closeBase: TRUE to close the base stream. +func (stream *FilterInputStream) SetCloseBaseStream(closeBase bool) { + var _arg0 *C.GFilterInputStream // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GFilterInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + if closeBase { + _arg1 = C.TRUE + } + + C.g_filter_input_stream_set_close_base_stream(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(closeBase) +} + +// FilterOutputStreamOverrides contains methods that are overridable. +type FilterOutputStreamOverrides struct { +} + +func defaultFilterOutputStreamOverrides(v *FilterOutputStream) FilterOutputStreamOverrides { + return FilterOutputStreamOverrides{} +} + +// FilterOutputStream: base class for output stream implementations that perform +// some kind of filtering operation on a base stream. Typical examples of +// filtering operations are character set conversion, compression and byte order +// flipping. +type FilterOutputStream struct { + _ [0]func() // equal guard + OutputStream +} + +var ( + _ OutputStreamer = (*FilterOutputStream)(nil) +) + +// FilterOutputStreamer describes types inherited from class FilterOutputStream. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type FilterOutputStreamer interface { + coreglib.Objector + baseFilterOutputStream() *FilterOutputStream +} + +var _ FilterOutputStreamer = (*FilterOutputStream)(nil) + +func init() { + coreglib.RegisterClassInfo[*FilterOutputStream, *FilterOutputStreamClass, FilterOutputStreamOverrides]( + GTypeFilterOutputStream, + initFilterOutputStreamClass, + wrapFilterOutputStream, + defaultFilterOutputStreamOverrides, + ) +} + +func initFilterOutputStreamClass(gclass unsafe.Pointer, overrides FilterOutputStreamOverrides, classInitFunc func(*FilterOutputStreamClass)) { + if classInitFunc != nil { + class := (*FilterOutputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapFilterOutputStream(obj *coreglib.Object) *FilterOutputStream { + return &FilterOutputStream{ + OutputStream: OutputStream{ + Object: obj, + }, + } +} + +func marshalFilterOutputStream(p uintptr) (interface{}, error) { + return wrapFilterOutputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (stream *FilterOutputStream) baseFilterOutputStream() *FilterOutputStream { + return stream +} + +// BaseFilterOutputStream returns the underlying base object. +func BaseFilterOutputStream(obj FilterOutputStreamer) *FilterOutputStream { + return obj.baseFilterOutputStream() +} + +// BaseStream gets the base stream for the filter stream. +// +// The function returns the following values: +// +// - outputStream: Stream. +func (stream *FilterOutputStream) BaseStream() OutputStreamer { + var _arg0 *C.GFilterOutputStream // out + var _cret *C.GOutputStream // in + + _arg0 = (*C.GFilterOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_filter_output_stream_get_base_stream(_arg0) + runtime.KeepAlive(stream) + + var _outputStream OutputStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.OutputStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(OutputStreamer) + return ok + }) + rv, ok := casted.(OutputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.OutputStreamer") + } + _outputStream = rv + } + + return _outputStream +} + +// CloseBaseStream returns whether the base stream will be closed when stream is +// closed. +// +// The function returns the following values: +// +// - ok: TRUE if the base stream will be closed. +func (stream *FilterOutputStream) CloseBaseStream() bool { + var _arg0 *C.GFilterOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GFilterOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_filter_output_stream_get_close_base_stream(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetCloseBaseStream sets whether the base stream will be closed when stream is +// closed. +// +// The function takes the following parameters: +// +// - closeBase: TRUE to close the base stream. +func (stream *FilterOutputStream) SetCloseBaseStream(closeBase bool) { + var _arg0 *C.GFilterOutputStream // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GFilterOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + if closeBase { + _arg1 = C.TRUE + } + + C.g_filter_output_stream_set_close_base_stream(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(closeBase) +} + +// IOStreamOverrides contains methods that are overridable. +type IOStreamOverrides struct { + // CloseFinish closes a stream. + // + // The function takes the following parameters: + // + // - result: Result. + CloseFinish func(result AsyncResulter) error + CloseFn func(ctx context.Context) error + // InputStream gets the input stream for this object. This is used for + // reading. + // + // The function returns the following values: + // + // - inputStream owned by the OStream. Do not free. + InputStream func() InputStreamer + // OutputStream gets the output stream for this object. This is used for + // writing. + // + // The function returns the following values: + // + // - outputStream owned by the OStream. Do not free. + OutputStream func() OutputStreamer +} + +func defaultIOStreamOverrides(v *IOStream) IOStreamOverrides { + return IOStreamOverrides{ + CloseFinish: v.closeFinish, + CloseFn: v.closeFn, + InputStream: v.inputStream, + OutputStream: v.outputStream, + } +} + +// IOStream: GIOStream represents an object that has both read and write +// streams. Generally the two streams act as separate input and output streams, +// but they share some common resources and state. For instance, for seekable +// streams, both streams may use the same position. +// +// Examples of GIOStream objects are gio.SocketConnection, which represents a +// two-way network connection; and gio.FileIOStream, which represents a file +// handle opened in read-write mode. +// +// To do the actual reading and writing you need to get the substreams with +// gio.IOStream.GetInputStream() and gio.IOStream.GetOutputStream(). +// +// The GIOStream object owns the input and the output streams, not the other way +// around, so keeping the substreams alive will not keep the GIOStream object +// alive. If the GIOStream object is freed it will be closed, thus closing the +// substreams, so even if the substreams stay alive they will always return +// G_IO_ERROR_CLOSED for all operations. +// +// To close a stream use gio.IOStream.Close() which will close the common stream +// object and also the individual substreams. You can also close the substreams +// themselves. In most cases this only marks the substream as closed, so further +// I/O on it fails but common state in the GIOStream may still be open. However, +// some streams may support ‘half-closed’ states where one direction of the +// stream is actually shut down. +// +// Operations on GIOStreams cannot be started while another operation on the +// GIOStream or its substreams is in progress. Specifically, an application +// can read from the gio.InputStream and write to the gio.OutputStream +// simultaneously (either in separate threads, or as asynchronous operations +// in the same thread), but an application cannot start any GIOStream operation +// while there is a GIOStream, GInputStream or GOutputStream operation in +// progress, and an application can’t start any GInputStream or GOutputStream +// operation while there is a GIOStream operation in progress. +// +// This is a product of individual stream operations being associated with a +// given glib.MainContext (the thread-default context at the time the operation +// was started), rather than entire streams being associated with a single +// GMainContext. +// +// GIO may run operations on GIOStreams from other (worker) threads, and this +// may be exposed to application code in the behaviour of wrapper streams, +// such as gio.BufferedInputStream or gio.TLSConnection. With such wrapper APIs, +// application code may only run operations on the base (wrapped) stream when +// the wrapper stream is idle. Note that the semantics of such operations may +// not be well-defined due to the state the wrapper stream leaves the base +// stream in (though they are guaranteed not to crash). +type IOStream struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*IOStream)(nil) +) + +// IOStreamer describes types inherited from class IOStream. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type IOStreamer interface { + coreglib.Objector + baseIOStream() *IOStream +} + +var _ IOStreamer = (*IOStream)(nil) + +func init() { + coreglib.RegisterClassInfo[*IOStream, *IOStreamClass, IOStreamOverrides]( + GTypeIOStream, + initIOStreamClass, + wrapIOStream, + defaultIOStreamOverrides, + ) +} + +func initIOStreamClass(gclass unsafe.Pointer, overrides IOStreamOverrides, classInitFunc func(*IOStreamClass)) { + pclass := (*C.GIOStreamClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeIOStream)))) + + if overrides.CloseFinish != nil { + pclass.close_finish = (*[0]byte)(C._gotk4_gio2_IOStreamClass_close_finish) + } + + if overrides.CloseFn != nil { + pclass.close_fn = (*[0]byte)(C._gotk4_gio2_IOStreamClass_close_fn) + } + + if overrides.InputStream != nil { + pclass.get_input_stream = (*[0]byte)(C._gotk4_gio2_IOStreamClass_get_input_stream) + } + + if overrides.OutputStream != nil { + pclass.get_output_stream = (*[0]byte)(C._gotk4_gio2_IOStreamClass_get_output_stream) + } + + if classInitFunc != nil { + class := (*IOStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapIOStream(obj *coreglib.Object) *IOStream { + return &IOStream{ + Object: obj, + } +} + +func marshalIOStream(p uintptr) (interface{}, error) { + return wrapIOStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (stream *IOStream) baseIOStream() *IOStream { + return stream +} + +// BaseIOStream returns the underlying base object. +func BaseIOStream(obj IOStreamer) *IOStream { + return obj.baseIOStream() +} + +// ClearPending clears the pending flag on stream. +func (stream *IOStream) ClearPending() { + var _arg0 *C.GIOStream // out + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + C.g_io_stream_clear_pending(_arg0) + runtime.KeepAlive(stream) +} + +// Close closes the stream, releasing resources related to it. This will also +// close the individual input and output streams, if they are not already +// closed. +// +// Once the stream is closed, all other operations will return +// G_IO_ERROR_CLOSED. Closing a stream multiple times will not return an error. +// +// Closing a stream will automatically flush any outstanding buffers in the +// stream. +// +// Streams will be automatically closed when the last reference is dropped, +// but you might want to call this function to make sure resources are released +// as early as possible. +// +// Some streams might keep the backing store of the stream (e.g. a file +// descriptor) open after the stream is closed. See the documentation for the +// individual stream for details. +// +// On failure the first error that happened will be reported, but the close +// operation will finish as much as possible. A stream that failed to close will +// still return G_IO_ERROR_CLOSED for all operations. Still, it is important to +// check and report the error to the user, otherwise there might be a loss of +// data as all data might not be written. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. Cancelling a close will +// still leave the stream closed, but some streams can use a faster close that +// doesn't block to e.g. check errors. +// +// The default implementation of this method just calls close on the individual +// input/output streams. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (stream *IOStream) Close(ctx context.Context) error { + var _arg0 *C.GIOStream // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_io_stream_close(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CloseAsync requests an asynchronous close of the stream, releasing resources +// related to it. When the operation is finished callback will be called. You +// can then call g_io_stream_close_finish() to get the result of the operation. +// +// For behaviour details see g_io_stream_close(). +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *IOStream) CloseAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GIOStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_io_stream_close_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// CloseFinish closes a stream. +// +// The function takes the following parameters: +// +// - result: Result. +func (stream *IOStream) CloseFinish(result AsyncResulter) error { + var _arg0 *C.GIOStream // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_io_stream_close_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// InputStream gets the input stream for this object. This is used for reading. +// +// The function returns the following values: +// +// - inputStream owned by the OStream. Do not free. +func (stream *IOStream) InputStream() InputStreamer { + var _arg0 *C.GIOStream // out + var _cret *C.GInputStream // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_io_stream_get_input_stream(_arg0) + runtime.KeepAlive(stream) + + var _inputStream InputStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + + return _inputStream +} + +// OutputStream gets the output stream for this object. This is used for +// writing. +// +// The function returns the following values: +// +// - outputStream owned by the OStream. Do not free. +func (stream *IOStream) OutputStream() OutputStreamer { + var _arg0 *C.GIOStream // out + var _cret *C.GOutputStream // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_io_stream_get_output_stream(_arg0) + runtime.KeepAlive(stream) + + var _outputStream OutputStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.OutputStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(OutputStreamer) + return ok + }) + rv, ok := casted.(OutputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.OutputStreamer") + } + _outputStream = rv + } + + return _outputStream +} + +// HasPending checks if a stream has pending actions. +// +// The function returns the following values: +// +// - ok: TRUE if stream has pending actions. +func (stream *IOStream) HasPending() bool { + var _arg0 *C.GIOStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_io_stream_has_pending(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsClosed checks if a stream is closed. +// +// The function returns the following values: +// +// - ok: TRUE if the stream is closed. +func (stream *IOStream) IsClosed() bool { + var _arg0 *C.GIOStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_io_stream_is_closed(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetPending sets stream to have actions pending. If the pending flag is +// already set or stream is closed, it will return FALSE and set error. +func (stream *IOStream) SetPending() error { + var _arg0 *C.GIOStream // out + var _cerr *C.GError // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + C.g_io_stream_set_pending(_arg0, &_cerr) + runtime.KeepAlive(stream) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SpliceAsync: asynchronously splice the output stream of stream1 to the input +// stream of stream2, and splice the output stream of stream2 to the input +// stream of stream1. +// +// When the operation is finished callback will be called. You can then call +// g_io_stream_splice_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - stream2: OStream. +// - flags: set of OStreamSpliceFlags. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream1 *IOStream) SpliceAsync(ctx context.Context, stream2 IOStreamer, flags IOStreamSpliceFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GIOStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GIOStream // out + var _arg2 C.GIOStreamSpliceFlags // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream1).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream2).Native())) + _arg2 = C.GIOStreamSpliceFlags(flags) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_io_stream_splice_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream1) + runtime.KeepAlive(ctx) + runtime.KeepAlive(stream2) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// closeAsync requests an asynchronous close of the stream, releasing resources +// related to it. When the operation is finished callback will be called. You +// can then call g_io_stream_close_finish() to get the result of the operation. +// +// For behaviour details see g_io_stream_close(). +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *IOStream) closeAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.close_async + + var _arg0 *C.GIOStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_IOStream_virtual_close_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// closeFinish closes a stream. +// +// The function takes the following parameters: +// +// - result: Result. +func (stream *IOStream) closeFinish(result AsyncResulter) error { + gclass := (*C.GIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.close_finish + + var _arg0 *C.GIOStream // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_IOStream_virtual_close_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func (stream *IOStream) closeFn(ctx context.Context) error { + gclass := (*C.GIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.close_fn + + var _arg0 *C.GIOStream // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_IOStream_virtual_close_fn(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// inputStream gets the input stream for this object. This is used for reading. +// +// The function returns the following values: +// +// - inputStream owned by the OStream. Do not free. +func (stream *IOStream) inputStream() InputStreamer { + gclass := (*C.GIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.get_input_stream + + var _arg0 *C.GIOStream // out + var _cret *C.GInputStream // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_IOStream_virtual_get_input_stream(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _inputStream InputStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + + return _inputStream +} + +// outputStream gets the output stream for this object. This is used for +// writing. +// +// The function returns the following values: +// +// - outputStream owned by the OStream. Do not free. +func (stream *IOStream) outputStream() OutputStreamer { + gclass := (*C.GIOStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.get_output_stream + + var _arg0 *C.GIOStream // out + var _cret *C.GOutputStream // in + + _arg0 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C._gotk4_gio2_IOStream_virtual_get_output_stream(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(stream) + + var _outputStream OutputStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.OutputStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(OutputStreamer) + return ok + }) + rv, ok := casted.(OutputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.OutputStreamer") + } + _outputStream = rv + } + + return _outputStream +} + +// IOStreamSpliceFinish finishes an asynchronous io stream splice operation. +// +// The function takes the following parameters: +// +// - result: Result. +func IOStreamSpliceFinish(result AsyncResulter) error { + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_io_stream_splice_finish(_arg1, &_cerr) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// InetAddressOverrides contains methods that are overridable. +type InetAddressOverrides struct { + // String converts address to string form. + // + // The function returns the following values: + // + // - utf8: representation of address as a string, which should be freed + // after use. + String func() string +} + +func defaultInetAddressOverrides(v *InetAddress) InetAddressOverrides { + return InetAddressOverrides{ + String: v.str, + } +} + +// InetAddress: GInetAddress represents an IPv4 or IPv6 internet address. +// Use gio.Resolver.LookupByName() or gio.Resolver.LookupByNameAsync() to look +// up the GInetAddress for a hostname. Use gio.Resolver.LookupByAddress() +// or gio.Resolver.LookupByAddressAsync() to look up the hostname for a +// GInetAddress. +// +// To actually connect to a remote host, you will need a gio.InetSocketAddress +// (which includes a GInetAddress as well as a port number). +type InetAddress struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*InetAddress)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*InetAddress, *InetAddressClass, InetAddressOverrides]( + GTypeInetAddress, + initInetAddressClass, + wrapInetAddress, + defaultInetAddressOverrides, + ) +} + +func initInetAddressClass(gclass unsafe.Pointer, overrides InetAddressOverrides, classInitFunc func(*InetAddressClass)) { + pclass := (*C.GInetAddressClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeInetAddress)))) + + if overrides.String != nil { + pclass.to_string = (*[0]byte)(C._gotk4_gio2_InetAddressClass_to_string) + } + + if classInitFunc != nil { + class := (*InetAddressClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapInetAddress(obj *coreglib.Object) *InetAddress { + return &InetAddress{ + Object: obj, + } +} + +func marshalInetAddress(p uintptr) (interface{}, error) { + return wrapInetAddress(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewInetAddressAny creates a Address for the "any" address (unassigned/"don't +// care") for family. +// +// The function takes the following parameters: +// +// - family address family. +// +// The function returns the following values: +// +// - inetAddress: new Address corresponding to the "any" address for family. +// Free the returned object with g_object_unref(). +func NewInetAddressAny(family SocketFamily) *InetAddress { + var _arg1 C.GSocketFamily // out + var _cret *C.GInetAddress // in + + _arg1 = C.GSocketFamily(family) + + _cret = C.g_inet_address_new_any(_arg1) + runtime.KeepAlive(family) + + var _inetAddress *InetAddress // out + + _inetAddress = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _inetAddress +} + +// NewInetAddressFromString parses string as an IP address and creates a new +// Address. +// +// The function takes the following parameters: +// +// - str: string representation of an IP address. +// +// The function returns the following values: +// +// - inetAddress (optional): new Address corresponding to string, +// or NULL if string could not be parsed. Free the returned object with +// g_object_unref(). +func NewInetAddressFromString(str string) *InetAddress { + var _arg1 *C.gchar // out + var _cret *C.GInetAddress // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_inet_address_new_from_string(_arg1) + runtime.KeepAlive(str) + + var _inetAddress *InetAddress // out + + if _cret != nil { + _inetAddress = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _inetAddress +} + +// NewInetAddressLoopback creates a Address for the loopback address for family. +// +// The function takes the following parameters: +// +// - family address family. +// +// The function returns the following values: +// +// - inetAddress: new Address corresponding to the loopback address for +// family. Free the returned object with g_object_unref(). +func NewInetAddressLoopback(family SocketFamily) *InetAddress { + var _arg1 C.GSocketFamily // out + var _cret *C.GInetAddress // in + + _arg1 = C.GSocketFamily(family) + + _cret = C.g_inet_address_new_loopback(_arg1) + runtime.KeepAlive(family) + + var _inetAddress *InetAddress // out + + _inetAddress = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _inetAddress +} + +// Equal checks if two Address instances are equal, e.g. the same address. +// +// The function takes the following parameters: +// +// - otherAddress: another Address. +// +// The function returns the following values: +// +// - ok: TRUE if address and other_address are equal, FALSE otherwise. +func (address *InetAddress) Equal(otherAddress *InetAddress) bool { + var _arg0 *C.GInetAddress // out + var _arg1 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(otherAddress).Native())) + + _cret = C.g_inet_address_equal(_arg0, _arg1) + runtime.KeepAlive(address) + runtime.KeepAlive(otherAddress) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Family gets address's family. +// +// The function returns the following values: +// +// - socketFamily address's family. +func (address *InetAddress) Family() SocketFamily { + var _arg0 *C.GInetAddress // out + var _cret C.GSocketFamily // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_family(_arg0) + runtime.KeepAlive(address) + + var _socketFamily SocketFamily // out + + _socketFamily = SocketFamily(_cret) + + return _socketFamily +} + +// IsAny tests whether address is the "any" address for its family. +// +// The function returns the following values: +// +// - ok: TRUE if address is the "any" address for its family. +func (address *InetAddress) IsAny() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_any(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsLinkLocal tests whether address is a link-local address (that is, if it +// identifies a host on a local network that is not connected to the Internet). +// +// The function returns the following values: +// +// - ok: TRUE if address is a link-local address. +func (address *InetAddress) IsLinkLocal() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_link_local(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsLoopback tests whether address is the loopback address for its family. +// +// The function returns the following values: +// +// - ok: TRUE if address is the loopback address for its family. +func (address *InetAddress) IsLoopback() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_loopback(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsMcGlobal tests whether address is a global multicast address. +// +// The function returns the following values: +// +// - ok: TRUE if address is a global multicast address. +func (address *InetAddress) IsMcGlobal() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_mc_global(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsMcLinkLocal tests whether address is a link-local multicast address. +// +// The function returns the following values: +// +// - ok: TRUE if address is a link-local multicast address. +func (address *InetAddress) IsMcLinkLocal() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_mc_link_local(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsMcNodeLocal tests whether address is a node-local multicast address. +// +// The function returns the following values: +// +// - ok: TRUE if address is a node-local multicast address. +func (address *InetAddress) IsMcNodeLocal() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_mc_node_local(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsMcOrgLocal tests whether address is an organization-local multicast +// address. +// +// The function returns the following values: +// +// - ok: TRUE if address is an organization-local multicast address. +func (address *InetAddress) IsMcOrgLocal() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_mc_org_local(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsMcSiteLocal tests whether address is a site-local multicast address. +// +// The function returns the following values: +// +// - ok: TRUE if address is a site-local multicast address. +func (address *InetAddress) IsMcSiteLocal() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_mc_site_local(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsMulticast tests whether address is a multicast address. +// +// The function returns the following values: +// +// - ok: TRUE if address is a multicast address. +func (address *InetAddress) IsMulticast() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_multicast(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsSiteLocal tests whether address is a site-local address such as 10.0.0.1 +// (that is, the address identifies a host on a local network that can not be +// reached directly from the Internet, but which may have outgoing Internet +// connectivity via a NAT or firewall). +// +// The function returns the following values: +// +// - ok: TRUE if address is a site-local address. +func (address *InetAddress) IsSiteLocal() bool { + var _arg0 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_is_site_local(_arg0) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// NativeSize gets the size of the native raw binary address for address. +// This is the size of the data that you get from g_inet_address_to_bytes(). +// +// The function returns the following values: +// +// - gsize: number of bytes used for the native version of address. +func (address *InetAddress) NativeSize() uint { + var _arg0 *C.GInetAddress // out + var _cret C.gsize // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_get_native_size(_arg0) + runtime.KeepAlive(address) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// String converts address to string form. +// +// The function returns the following values: +// +// - utf8: representation of address as a string, which should be freed after +// use. +func (address *InetAddress) String() string { + var _arg0 *C.GInetAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_to_string(_arg0) + runtime.KeepAlive(address) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Str converts address to string form. +// +// The function returns the following values: +// +// - utf8: representation of address as a string, which should be freed after +// use. +func (address *InetAddress) str() string { + gclass := (*C.GInetAddressClass)(coreglib.PeekParentClass(address)) + fnarg := gclass.to_string + + var _arg0 *C.GInetAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C._gotk4_gio2_InetAddress_virtual_to_string(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(address) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// InetAddressMaskOverrides contains methods that are overridable. +type InetAddressMaskOverrides struct { +} + +func defaultInetAddressMaskOverrides(v *InetAddressMask) InetAddressMaskOverrides { + return InetAddressMaskOverrides{} +} + +// InetAddressMask: GInetAddressMask represents a range of IPv4 or IPv6 +// addresses described by a base address and a length indicating how many bits +// of the base address are relevant for matching purposes. These are often given +// in string form. For example, 10.0.0.0/8, or fe80::/10. +type InetAddressMask struct { + _ [0]func() // equal guard + *coreglib.Object + + Initable +} + +var ( + _ coreglib.Objector = (*InetAddressMask)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*InetAddressMask, *InetAddressMaskClass, InetAddressMaskOverrides]( + GTypeInetAddressMask, + initInetAddressMaskClass, + wrapInetAddressMask, + defaultInetAddressMaskOverrides, + ) +} + +func initInetAddressMaskClass(gclass unsafe.Pointer, overrides InetAddressMaskOverrides, classInitFunc func(*InetAddressMaskClass)) { + if classInitFunc != nil { + class := (*InetAddressMaskClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapInetAddressMask(obj *coreglib.Object) *InetAddressMask { + return &InetAddressMask{ + Object: obj, + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalInetAddressMask(p uintptr) (interface{}, error) { + return wrapInetAddressMask(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewInetAddressMask creates a new AddressMask representing all addresses whose +// first length bits match addr. +// +// The function takes the following parameters: +// +// - addr: Address. +// - length: number of bits of addr to use. +// +// The function returns the following values: +// +// - inetAddressMask: new AddressMask, or NULL on error. +func NewInetAddressMask(addr *InetAddress, length uint) (*InetAddressMask, error) { + var _arg1 *C.GInetAddress // out + var _arg2 C.guint // out + var _cret *C.GInetAddressMask // in + var _cerr *C.GError // in + + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(addr).Native())) + _arg2 = C.guint(length) + + _cret = C.g_inet_address_mask_new(_arg1, _arg2, &_cerr) + runtime.KeepAlive(addr) + runtime.KeepAlive(length) + + var _inetAddressMask *InetAddressMask // out + var _goerr error // out + + _inetAddressMask = wrapInetAddressMask(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _inetAddressMask, _goerr +} + +// NewInetAddressMaskFromString parses mask_string as an IP address and +// (optional) length, and creates a new AddressMask. The length, if present, +// is delimited by a "/". If it is not present, then the length is assumed to be +// the full length of the address. +// +// The function takes the following parameters: +// +// - maskString: IP address or address/length string. +// +// The function returns the following values: +// +// - inetAddressMask: new AddressMask corresponding to string, or NULL on +// error. +func NewInetAddressMaskFromString(maskString string) (*InetAddressMask, error) { + var _arg1 *C.gchar // out + var _cret *C.GInetAddressMask // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(maskString))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_inet_address_mask_new_from_string(_arg1, &_cerr) + runtime.KeepAlive(maskString) + + var _inetAddressMask *InetAddressMask // out + var _goerr error // out + + _inetAddressMask = wrapInetAddressMask(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _inetAddressMask, _goerr +} + +// Equal tests if mask and mask2 are the same mask. +// +// The function takes the following parameters: +// +// - mask2: another AddressMask. +// +// The function returns the following values: +// +// - ok: whether mask and mask2 are the same mask. +func (mask *InetAddressMask) Equal(mask2 *InetAddressMask) bool { + var _arg0 *C.GInetAddressMask // out + var _arg1 *C.GInetAddressMask // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddressMask)(unsafe.Pointer(coreglib.InternObject(mask).Native())) + _arg1 = (*C.GInetAddressMask)(unsafe.Pointer(coreglib.InternObject(mask2).Native())) + + _cret = C.g_inet_address_mask_equal(_arg0, _arg1) + runtime.KeepAlive(mask) + runtime.KeepAlive(mask2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Address gets mask's base address. +// +// The function returns the following values: +// +// - inetAddress mask's base address. +func (mask *InetAddressMask) Address() *InetAddress { + var _arg0 *C.GInetAddressMask // out + var _cret *C.GInetAddress // in + + _arg0 = (*C.GInetAddressMask)(unsafe.Pointer(coreglib.InternObject(mask).Native())) + + _cret = C.g_inet_address_mask_get_address(_arg0) + runtime.KeepAlive(mask) + + var _inetAddress *InetAddress // out + + _inetAddress = wrapInetAddress(coreglib.Take(unsafe.Pointer(_cret))) + + return _inetAddress +} + +// Family gets the Family of mask's address. +// +// The function returns the following values: +// +// - socketFamily of mask's address. +func (mask *InetAddressMask) Family() SocketFamily { + var _arg0 *C.GInetAddressMask // out + var _cret C.GSocketFamily // in + + _arg0 = (*C.GInetAddressMask)(unsafe.Pointer(coreglib.InternObject(mask).Native())) + + _cret = C.g_inet_address_mask_get_family(_arg0) + runtime.KeepAlive(mask) + + var _socketFamily SocketFamily // out + + _socketFamily = SocketFamily(_cret) + + return _socketFamily +} + +// Length gets mask's length. +// +// The function returns the following values: +// +// - guint mask's length. +func (mask *InetAddressMask) Length() uint { + var _arg0 *C.GInetAddressMask // out + var _cret C.guint // in + + _arg0 = (*C.GInetAddressMask)(unsafe.Pointer(coreglib.InternObject(mask).Native())) + + _cret = C.g_inet_address_mask_get_length(_arg0) + runtime.KeepAlive(mask) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Matches tests if address falls within the range described by mask. +// +// The function takes the following parameters: +// +// - address: Address. +// +// The function returns the following values: +// +// - ok: whether address falls within the range described by mask. +func (mask *InetAddressMask) Matches(address *InetAddress) bool { + var _arg0 *C.GInetAddressMask // out + var _arg1 *C.GInetAddress // out + var _cret C.gboolean // in + + _arg0 = (*C.GInetAddressMask)(unsafe.Pointer(coreglib.InternObject(mask).Native())) + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_address_mask_matches(_arg0, _arg1) + runtime.KeepAlive(mask) + runtime.KeepAlive(address) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// String converts mask back to its corresponding string form. +// +// The function returns the following values: +// +// - utf8: string corresponding to mask. +func (mask *InetAddressMask) String() string { + var _arg0 *C.GInetAddressMask // out + var _cret *C.gchar // in + + _arg0 = (*C.GInetAddressMask)(unsafe.Pointer(coreglib.InternObject(mask).Native())) + + _cret = C.g_inet_address_mask_to_string(_arg0) + runtime.KeepAlive(mask) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// InetSocketAddressOverrides contains methods that are overridable. +type InetSocketAddressOverrides struct { +} + +func defaultInetSocketAddressOverrides(v *InetSocketAddress) InetSocketAddressOverrides { + return InetSocketAddressOverrides{} +} + +// InetSocketAddress: IPv4 or IPv6 socket address. That is, the combination of a +// gio.InetAddress and a port number. +// +// In UNIX terms, GInetSocketAddress corresponds to a struct sockaddr_in or +// struct sockaddr_in6 (man:sockaddr(3type)). +type InetSocketAddress struct { + _ [0]func() // equal guard + SocketAddress +} + +var ( + _ SocketAddresser = (*InetSocketAddress)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*InetSocketAddress, *InetSocketAddressClass, InetSocketAddressOverrides]( + GTypeInetSocketAddress, + initInetSocketAddressClass, + wrapInetSocketAddress, + defaultInetSocketAddressOverrides, + ) +} + +func initInetSocketAddressClass(gclass unsafe.Pointer, overrides InetSocketAddressOverrides, classInitFunc func(*InetSocketAddressClass)) { + if classInitFunc != nil { + class := (*InetSocketAddressClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapInetSocketAddress(obj *coreglib.Object) *InetSocketAddress { + return &InetSocketAddress{ + SocketAddress: SocketAddress{ + Object: obj, + SocketConnectable: SocketConnectable{ + Object: obj, + }, + }, + } +} + +func marshalInetSocketAddress(p uintptr) (interface{}, error) { + return wrapInetSocketAddress(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewInetSocketAddress creates a new SocketAddress for address and port. +// +// The function takes the following parameters: +// +// - address: Address. +// - port number. +// +// The function returns the following values: +// +// - inetSocketAddress: new SocketAddress. +func NewInetSocketAddress(address *InetAddress, port uint16) *InetSocketAddress { + var _arg1 *C.GInetAddress // out + var _arg2 C.guint16 // out + var _cret *C.GSocketAddress // in + + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + _arg2 = C.guint16(port) + + _cret = C.g_inet_socket_address_new(_arg1, _arg2) + runtime.KeepAlive(address) + runtime.KeepAlive(port) + + var _inetSocketAddress *InetSocketAddress // out + + _inetSocketAddress = wrapInetSocketAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _inetSocketAddress +} + +// NewInetSocketAddressFromString creates a new SocketAddress for address and +// port. +// +// If address is an IPv6 address, it can also contain a scope ID (separated from +// the address by a %). +// +// The function takes the following parameters: +// +// - address: string form of an IP address. +// - port number. +// +// The function returns the following values: +// +// - inetSocketAddress (optional): new SocketAddress, or NULL if address +// cannot be parsed. +func NewInetSocketAddressFromString(address string, port uint) *InetSocketAddress { + var _arg1 *C.char // out + var _arg2 C.guint // out + var _cret *C.GSocketAddress // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(address))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint(port) + + _cret = C.g_inet_socket_address_new_from_string(_arg1, _arg2) + runtime.KeepAlive(address) + runtime.KeepAlive(port) + + var _inetSocketAddress *InetSocketAddress // out + + if _cret != nil { + _inetSocketAddress = wrapInetSocketAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _inetSocketAddress +} + +// Address gets address's Address. +// +// The function returns the following values: +// +// - inetAddress for address, which must be g_object_ref()'d if it will be +// stored. +func (address *InetSocketAddress) Address() *InetAddress { + var _arg0 *C.GInetSocketAddress // out + var _cret *C.GInetAddress // in + + _arg0 = (*C.GInetSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_socket_address_get_address(_arg0) + runtime.KeepAlive(address) + + var _inetAddress *InetAddress // out + + _inetAddress = wrapInetAddress(coreglib.Take(unsafe.Pointer(_cret))) + + return _inetAddress +} + +// Flowinfo gets the sin6_flowinfo field from address, which must be an IPv6 +// address. +// +// The function returns the following values: +// +// - guint32: flowinfo field. +func (address *InetSocketAddress) Flowinfo() uint32 { + var _arg0 *C.GInetSocketAddress // out + var _cret C.guint32 // in + + _arg0 = (*C.GInetSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_socket_address_get_flowinfo(_arg0) + runtime.KeepAlive(address) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// Port gets address's port. +// +// The function returns the following values: +// +// - guint16: port for address. +func (address *InetSocketAddress) Port() uint16 { + var _arg0 *C.GInetSocketAddress // out + var _cret C.guint16 // in + + _arg0 = (*C.GInetSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_socket_address_get_port(_arg0) + runtime.KeepAlive(address) + + var _guint16 uint16 // out + + _guint16 = uint16(_cret) + + return _guint16 +} + +// ScopeID gets the sin6_scope_id field from address, which must be an IPv6 +// address. +// +// The function returns the following values: +// +// - guint32: scope id field. +func (address *InetSocketAddress) ScopeID() uint32 { + var _arg0 *C.GInetSocketAddress // out + var _cret C.guint32 // in + + _arg0 = (*C.GInetSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_inet_socket_address_get_scope_id(_arg0) + runtime.KeepAlive(address) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// InputStreamOverrides contains methods that are overridable. +type InputStreamOverrides struct { + // CloseFinish finishes closing a stream asynchronously, started from + // g_input_stream_close_async(). + // + // The function takes the following parameters: + // + // - result: Result. + CloseFinish func(result AsyncResulter) error + CloseFn func(ctx context.Context) error + // ReadFinish finishes an asynchronous stream read operation. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - gssize: number of bytes read in, or -1 on error, or 0 on end of file. + ReadFinish func(result AsyncResulter) (int, error) + // Skip tries to skip count bytes from the stream. Will block during the + // operation. + // + // This is identical to g_input_stream_read(), from a behaviour standpoint, + // but the bytes that are skipped are not returned to the user. Some streams + // have an implementation that is more efficient than reading the data. + // + // This function is optional for inherited classes, as the default + // implementation emulates it using read. + // + // If cancellable is not NULL, then the operation can be cancelled by + // triggering the cancellable object from another thread. If the operation + // was cancelled, the error G_IO_ERROR_CANCELLED will be returned. If an + // operation was partially finished when the operation was cancelled the + // partial result will be returned, without an error. + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable object, NULL to ignore. + // - count: number of bytes that will be skipped from the stream. + // + // The function returns the following values: + // + // - gssize: number of bytes skipped, or -1 on error. + Skip func(ctx context.Context, count uint) (int, error) + // SkipFinish finishes a stream skip operation. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - gssize: size of the bytes skipped, or -1 on error. + SkipFinish func(result AsyncResulter) (int, error) +} + +func defaultInputStreamOverrides(v *InputStream) InputStreamOverrides { + return InputStreamOverrides{ + CloseFinish: v.closeFinish, + CloseFn: v.closeFn, + ReadFinish: v.readFinish, + Skip: v.skip, + SkipFinish: v.skipFinish, + } +} + +// InputStream: GInputStream is a base class for implementing streaming input. +// +// It has functions to read from a stream (gio.InputStream.Read()), +// to close a stream (gio.InputStream.Close()) and to skip some content +// (gio.InputStream.Skip()). +// +// To copy the content of an input stream to an output stream without manually +// handling the reads and writes, use gio.OutputStream.Splice(). +// +// See the documentation for gio.IOStream for details of thread safety of +// streaming APIs. +// +// All of these functions have async variants too. +type InputStream struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*InputStream)(nil) +) + +// InputStreamer describes types inherited from class InputStream. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type InputStreamer interface { + coreglib.Objector + baseInputStream() *InputStream +} + +var _ InputStreamer = (*InputStream)(nil) + +func init() { + coreglib.RegisterClassInfo[*InputStream, *InputStreamClass, InputStreamOverrides]( + GTypeInputStream, + initInputStreamClass, + wrapInputStream, + defaultInputStreamOverrides, + ) +} + +func initInputStreamClass(gclass unsafe.Pointer, overrides InputStreamOverrides, classInitFunc func(*InputStreamClass)) { + pclass := (*C.GInputStreamClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeInputStream)))) + + if overrides.CloseFinish != nil { + pclass.close_finish = (*[0]byte)(C._gotk4_gio2_InputStreamClass_close_finish) + } + + if overrides.CloseFn != nil { + pclass.close_fn = (*[0]byte)(C._gotk4_gio2_InputStreamClass_close_fn) + } + + if overrides.ReadFinish != nil { + pclass.read_finish = (*[0]byte)(C._gotk4_gio2_InputStreamClass_read_finish) + } + + if overrides.Skip != nil { + pclass.skip = (*[0]byte)(C._gotk4_gio2_InputStreamClass_skip) + } + + if overrides.SkipFinish != nil { + pclass.skip_finish = (*[0]byte)(C._gotk4_gio2_InputStreamClass_skip_finish) + } + + if classInitFunc != nil { + class := (*InputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapInputStream(obj *coreglib.Object) *InputStream { + return &InputStream{ + Object: obj, + } +} + +func marshalInputStream(p uintptr) (interface{}, error) { + return wrapInputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (stream *InputStream) baseInputStream() *InputStream { + return stream +} + +// BaseInputStream returns the underlying base object. +func BaseInputStream(obj InputStreamer) *InputStream { + return obj.baseInputStream() +} + +// ClearPending clears the pending flag on stream. +func (stream *InputStream) ClearPending() { + var _arg0 *C.GInputStream // out + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + C.g_input_stream_clear_pending(_arg0) + runtime.KeepAlive(stream) +} + +// Close closes the stream, releasing resources related to it. +// +// Once the stream is closed, all other operations will return +// G_IO_ERROR_CLOSED. Closing a stream multiple times will not return an error. +// +// Streams will be automatically closed when the last reference is dropped, +// but you might want to call this function to make sure resources are released +// as early as possible. +// +// Some streams might keep the backing store of the stream (e.g. a file +// descriptor) open after the stream is closed. See the documentation for the +// individual stream for details. +// +// On failure the first error that happened will be reported, but the close +// operation will finish as much as possible. A stream that failed to close will +// still return G_IO_ERROR_CLOSED for all operations. Still, it is important to +// check and report the error to the user. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. Cancelling a close will +// still leave the stream closed, but some streams can use a faster close that +// doesn't block to e.g. check errors. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +func (stream *InputStream) Close(ctx context.Context) error { + var _arg0 *C.GInputStream // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_input_stream_close(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CloseAsync requests an asynchronous closes of the stream, releasing resources +// related to it. When the operation is finished callback will be called. +// You can then call g_input_stream_close_finish() to get the result of the +// operation. +// +// For behaviour details see g_input_stream_close(). +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *InputStream) CloseAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_input_stream_close_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// CloseFinish finishes closing a stream asynchronously, started from +// g_input_stream_close_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (stream *InputStream) CloseFinish(result AsyncResulter) error { + var _arg0 *C.GInputStream // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_input_stream_close_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// HasPending checks if an input stream has pending actions. +// +// The function returns the following values: +// +// - ok: TRUE if stream has pending actions. +func (stream *InputStream) HasPending() bool { + var _arg0 *C.GInputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_input_stream_has_pending(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsClosed checks if an input stream is closed. +// +// The function returns the following values: +// +// - ok: TRUE if the stream is closed. +func (stream *InputStream) IsClosed() bool { + var _arg0 *C.GInputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_input_stream_is_closed(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Read tries to read count bytes from the stream into the buffer starting at +// buffer. Will block during this read. +// +// If count is zero returns zero and does nothing. A value of count larger than +// G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes read into the buffer is returned. It is not +// an error if this is not the same as the requested size, as it can happen e.g. +// near the end of a file. Zero is returned on end of file (or if count is +// zero), but never otherwise. +// +// The returned buffer is not a nul-terminated string, it can contain nul bytes +// at any position, and this function doesn't nul-terminate the buffer. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// On error -1 is returned and error is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - buffer: a buffer to read data into (which should be at least count bytes +// long). +// +// The function returns the following values: +// +// - gssize: number of bytes read, or -1 on error, or 0 on end of file. +func (stream *InputStream) Read(ctx context.Context, buffer []byte) (int, error) { + var _arg0 *C.GInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + + _cret = C.g_input_stream_read(_arg0, unsafe.Pointer(_arg1), _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// ReadAll tries to read count bytes from the stream into the buffer starting at +// buffer. Will block during this read. +// +// This function is similar to g_input_stream_read(), except it tries to read as +// many bytes as requested, only stopping on an error or end of stream. +// +// On a successful read of count bytes, or if we reached the end of the stream, +// TRUE is returned, and bytes_read is set to the number of bytes read into +// buffer. +// +// If there is an error during the operation FALSE is returned and error is set +// to indicate the error status. +// +// As a special exception to the normal conventions for functions that use +// #GError, if this function returns FALSE (and sets error) then bytes_read +// will be set to the number of bytes that were successfully read before +// the error was encountered. This functionality is only available from C. +// If you need it from another language then you must write your own loop around +// g_input_stream_read(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - buffer: a buffer to read data into (which should be at least count bytes +// long). +// +// The function returns the following values: +// +// - bytesRead: location to store the number of bytes that was read from the +// stream. +func (stream *InputStream) ReadAll(ctx context.Context, buffer []byte) (uint, error) { + var _arg0 *C.GInputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + + C.g_input_stream_read_all(_arg0, unsafe.Pointer(_arg1), _arg2, &_arg3, _arg4, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _bytesRead uint // out + var _goerr error // out + + _bytesRead = uint(_arg3) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _goerr +} + +// ReadAllAsync: request an asynchronous read of count bytes from the stream +// into the buffer starting at buffer. +// +// This is the asynchronous equivalent of g_input_stream_read_all(). +// +// Call g_input_stream_read_all_finish() to collect the result. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - buffer: a buffer to read data into (which should be at least count bytes +// long). +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *InputStream) ReadAllAsync(ctx context.Context, buffer []byte, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GInputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_input_stream_read_all_async(_arg0, unsafe.Pointer(_arg1), _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadAllFinish finishes an asynchronous stream read operation started with +// g_input_stream_read_all_async(). +// +// As a special exception to the normal conventions for functions that use +// #GError, if this function returns FALSE (and sets error) then bytes_read +// will be set to the number of bytes that were successfully read before +// the error was encountered. This functionality is only available from C. +// If you need it from another language then you must write your own loop around +// g_input_stream_read_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - bytesRead: location to store the number of bytes that was read from the +// stream. +func (stream *InputStream) ReadAllFinish(result AsyncResulter) (uint, error) { + var _arg0 *C.GInputStream // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_input_stream_read_all_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _bytesRead uint // out + var _goerr error // out + + _bytesRead = uint(_arg2) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _goerr +} + +// ReadAsync: request an asynchronous read of count bytes from the stream into +// the buffer starting at buffer. When the operation is finished callback will +// be called. You can then call g_input_stream_read_finish() to get the result +// of the operation. +// +// During an async request no other sync and async calls are allowed on stream, +// and will result in G_IO_ERROR_PENDING errors. +// +// A value of count larger than G_MAXSSIZE will cause a +// G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes read into the buffer will be passed to the +// callback. It is not an error if this is not the same as the requested size, +// as it can happen e.g. near the end of a file, but generally we try to read +// as many bytes as requested. Zero is returned on end of file (or if count is +// zero), but never otherwise. +// +// Any outstanding i/o request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - buffer: a buffer to read data into (which should be at least count bytes +// long). +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *InputStream) ReadAsync(ctx context.Context, buffer []byte, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GInputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_input_stream_read_async(_arg0, unsafe.Pointer(_arg1), _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadBytes: like g_input_stream_read(), this tries to read count bytes +// from the stream in a blocking fashion. However, rather than reading into a +// user-supplied buffer, this will create a new #GBytes containing the data that +// was read. This may be easier to use from language bindings. +// +// If count is zero, returns a zero-length #GBytes and does nothing. A value of +// count larger than G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, a new #GBytes is returned. It is not an error if the size of +// this object is not the same as the requested size, as it can happen e.g. +// near the end of a file. A zero-length #GBytes is returned on end of file (or +// if count is zero), but never otherwise. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// On error NULL is returned and error is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - count: maximum number of bytes that will be read from the stream. +// Common values include 4096 and 8192. +// +// The function returns the following values: +// +// - bytes: new #GBytes, or NULL on error. +func (stream *InputStream) ReadBytes(ctx context.Context, count uint) (*glib.Bytes, error) { + var _arg0 *C.GInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gsize // out + var _cret *C.GBytes // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gsize(count) + + _cret = C.g_input_stream_read_bytes(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + + var _bytes *glib.Bytes // out + var _goerr error // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytes, _goerr +} + +// ReadBytesAsync: request an asynchronous read of count bytes from the stream +// into a new #GBytes. When the operation is finished callback will be called. +// You can then call g_input_stream_read_bytes_finish() to get the result of the +// operation. +// +// During an async request no other sync and async calls are allowed on stream, +// and will result in G_IO_ERROR_PENDING errors. +// +// A value of count larger than G_MAXSSIZE will cause a +// G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the new #GBytes will be passed to the callback. It is not an +// error if this is smaller than the requested size, as it can happen e.g. near +// the end of a file, but generally we try to read as many bytes as requested. +// Zero is returned on end of file (or if count is zero), but never otherwise. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - count: number of bytes that will be read from the stream. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *InputStream) ReadBytesAsync(ctx context.Context, count uint, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 C.gsize // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gsize(count) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_input_stream_read_bytes_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// ReadBytesFinish finishes an asynchronous stream read-into-#GBytes operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - bytes: newly-allocated #GBytes, or NULL on error. +func (stream *InputStream) ReadBytesFinish(result AsyncResulter) (*glib.Bytes, error) { + var _arg0 *C.GInputStream // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GBytes // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_input_stream_read_bytes_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _bytes *glib.Bytes // out + var _goerr error // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytes, _goerr +} + +// ReadFinish finishes an asynchronous stream read operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize: number of bytes read in, or -1 on error, or 0 on end of file. +func (stream *InputStream) ReadFinish(result AsyncResulter) (int, error) { + var _arg0 *C.GInputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_input_stream_read_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// SetPending sets stream to have actions pending. If the pending flag is +// already set or stream is closed, it will return FALSE and set error. +func (stream *InputStream) SetPending() error { + var _arg0 *C.GInputStream // out + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + C.g_input_stream_set_pending(_arg0, &_cerr) + runtime.KeepAlive(stream) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Skip tries to skip count bytes from the stream. Will block during the +// operation. +// +// This is identical to g_input_stream_read(), from a behaviour standpoint, +// but the bytes that are skipped are not returned to the user. Some streams +// have an implementation that is more efficient than reading the data. +// +// This function is optional for inherited classes, as the default +// implementation emulates it using read. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - count: number of bytes that will be skipped from the stream. +// +// The function returns the following values: +// +// - gssize: number of bytes skipped, or -1 on error. +func (stream *InputStream) Skip(ctx context.Context, count uint) (int, error) { + var _arg0 *C.GInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gsize // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gsize(count) + + _cret = C.g_input_stream_skip(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// SkipAsync: request an asynchronous skip of count bytes from the stream. +// When the operation is finished callback will be called. You can then call +// g_input_stream_skip_finish() to get the result of the operation. +// +// During an async request no other sync and async calls are allowed, and will +// result in G_IO_ERROR_PENDING errors. +// +// A value of count larger than G_MAXSSIZE will cause a +// G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes skipped will be passed to the callback. +// It is not an error if this is not the same as the requested size, as it can +// happen e.g. near the end of a file, but generally we try to skip as many +// bytes as requested. Zero is returned on end of file (or if count is zero), +// but never otherwise. +// +// Any outstanding i/o request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one, you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - count: number of bytes that will be skipped from the stream. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *InputStream) SkipAsync(ctx context.Context, count uint, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 C.gsize // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gsize(count) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_input_stream_skip_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// SkipFinish finishes a stream skip operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize: size of the bytes skipped, or -1 on error. +func (stream *InputStream) SkipFinish(result AsyncResulter) (int, error) { + var _arg0 *C.GInputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_input_stream_skip_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// closeAsync requests an asynchronous closes of the stream, releasing resources +// related to it. When the operation is finished callback will be called. +// You can then call g_input_stream_close_finish() to get the result of the +// operation. +// +// For behaviour details see g_input_stream_close(). +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *InputStream) closeAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.close_async + + var _arg0 *C.GInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_InputStream_virtual_close_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// closeFinish finishes closing a stream asynchronously, started from +// g_input_stream_close_async(). +// +// The function takes the following parameters: +// +// - result: Result. +func (stream *InputStream) closeFinish(result AsyncResulter) error { + gclass := (*C.GInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.close_finish + + var _arg0 *C.GInputStream // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_InputStream_virtual_close_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func (stream *InputStream) closeFn(ctx context.Context) error { + gclass := (*C.GInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.close_fn + + var _arg0 *C.GInputStream // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_InputStream_virtual_close_fn(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// readAsync: request an asynchronous read of count bytes from the stream into +// the buffer starting at buffer. When the operation is finished callback will +// be called. You can then call g_input_stream_read_finish() to get the result +// of the operation. +// +// During an async request no other sync and async calls are allowed on stream, +// and will result in G_IO_ERROR_PENDING errors. +// +// A value of count larger than G_MAXSSIZE will cause a +// G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes read into the buffer will be passed to the +// callback. It is not an error if this is not the same as the requested size, +// as it can happen e.g. near the end of a file, but generally we try to read +// as many bytes as requested. Zero is returned on end of file (or if count is +// zero), but never otherwise. +// +// Any outstanding i/o request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - buffer (optional): a buffer to read data into (which should be at least +// count bytes long). +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *InputStream) readAsync(ctx context.Context, buffer []byte, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.read_async + + var _arg0 *C.GInputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_InputStream_virtual_read_async(unsafe.Pointer(fnarg), _arg0, unsafe.Pointer(_arg1), _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// readFinish finishes an asynchronous stream read operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize: number of bytes read in, or -1 on error, or 0 on end of file. +func (stream *InputStream) readFinish(result AsyncResulter) (int, error) { + gclass := (*C.GInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.read_finish + + var _arg0 *C.GInputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_InputStream_virtual_read_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// Skip tries to skip count bytes from the stream. Will block during the +// operation. +// +// This is identical to g_input_stream_read(), from a behaviour standpoint, +// but the bytes that are skipped are not returned to the user. Some streams +// have an implementation that is more efficient than reading the data. +// +// This function is optional for inherited classes, as the default +// implementation emulates it using read. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - count: number of bytes that will be skipped from the stream. +// +// The function returns the following values: +// +// - gssize: number of bytes skipped, or -1 on error. +func (stream *InputStream) skip(ctx context.Context, count uint) (int, error) { + gclass := (*C.GInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.skip + + var _arg0 *C.GInputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.gsize // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gsize(count) + + _cret = C._gotk4_gio2_InputStream_virtual_skip(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// skipAsync: request an asynchronous skip of count bytes from the stream. +// When the operation is finished callback will be called. You can then call +// g_input_stream_skip_finish() to get the result of the operation. +// +// During an async request no other sync and async calls are allowed, and will +// result in G_IO_ERROR_PENDING errors. +// +// A value of count larger than G_MAXSSIZE will cause a +// G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes skipped will be passed to the callback. +// It is not an error if this is not the same as the requested size, as it can +// happen e.g. near the end of a file, but generally we try to skip as many +// bytes as requested. Zero is returned on end of file (or if count is zero), +// but never otherwise. +// +// Any outstanding i/o request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one, you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - count: number of bytes that will be skipped from the stream. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *InputStream) skipAsync(ctx context.Context, count uint, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.skip_async + + var _arg0 *C.GInputStream // out + var _arg3 *C.GCancellable // out + var _arg1 C.gsize // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gsize(count) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_InputStream_virtual_skip_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(count) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// skipFinish finishes a stream skip operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize: size of the bytes skipped, or -1 on error. +func (stream *InputStream) skipFinish(result AsyncResulter) (int, error) { + gclass := (*C.GInputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.skip_finish + + var _arg0 *C.GInputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_InputStream_virtual_skip_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// ListStoreOverrides contains methods that are overridable. +type ListStoreOverrides struct { +} + +func defaultListStoreOverrides(v *ListStore) ListStoreOverrides { + return ListStoreOverrides{} +} + +// ListStore: GListStore is a simple implementation of gio.ListModel that stores +// all items in memory. +// +// It provides insertions, deletions, and lookups in logarithmic time with a +// fast path for the common case of iterating the list linearly. +type ListStore struct { + _ [0]func() // equal guard + *coreglib.Object + + ListModel +} + +var ( + _ coreglib.Objector = (*ListStore)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ListStore, *ListStoreClass, ListStoreOverrides]( + GTypeListStore, + initListStoreClass, + wrapListStore, + defaultListStoreOverrides, + ) +} + +func initListStoreClass(gclass unsafe.Pointer, overrides ListStoreOverrides, classInitFunc func(*ListStoreClass)) { + if classInitFunc != nil { + class := (*ListStoreClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapListStore(obj *coreglib.Object) *ListStore { + return &ListStore{ + Object: obj, + ListModel: ListModel{ + Object: obj, + }, + } +} + +func marshalListStore(p uintptr) (interface{}, error) { + return wrapListStore(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewListStore creates a new Store with items of type item_type. item_type must +// be a subclass of #GObject. +// +// The function takes the following parameters: +// +// - itemType of items in the list. +// +// The function returns the following values: +// +// - listStore: new Store. +func NewListStore(itemType coreglib.Type) *ListStore { + var _arg1 C.GType // out + var _cret *C.GListStore // in + + _arg1 = C.GType(itemType) + + _cret = C.g_list_store_new(_arg1) + runtime.KeepAlive(itemType) + + var _listStore *ListStore // out + + _listStore = wrapListStore(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _listStore +} + +// Append appends item to store. item must be of type Store:item-type. +// +// This function takes a ref on item. +// +// Use g_list_store_splice() to append multiple items at the same time +// efficiently. +// +// The function takes the following parameters: +// +// - item: new item. +func (store *ListStore) Append(item *coreglib.Object) { + var _arg0 *C.GListStore // out + var _arg1 C.gpointer // out + + _arg0 = (*C.GListStore)(unsafe.Pointer(coreglib.InternObject(store).Native())) + _arg1 = C.gpointer(unsafe.Pointer(item.Native())) + + C.g_list_store_append(_arg0, _arg1) + runtime.KeepAlive(store) + runtime.KeepAlive(item) +} + +// Find looks up the given item in the list store by looping over the items +// until the first occurrence of item. If item was not found, then position will +// not be set, and this method will return FALSE. +// +// If you need to compare the two items with a custom comparison function, +// use g_list_store_find_with_equal_func() with a custom Func instead. +// +// The function takes the following parameters: +// +// - item: item. +// +// The function returns the following values: +// +// - position (optional): first position of item, if it was found. +// - ok: whether store contains item. If it was found, position will be set to +// the position where item occurred for the first time. +func (store *ListStore) Find(item *coreglib.Object) (uint, bool) { + var _arg0 *C.GListStore // out + var _arg1 C.gpointer // out + var _arg2 C.guint // in + var _cret C.gboolean // in + + _arg0 = (*C.GListStore)(unsafe.Pointer(coreglib.InternObject(store).Native())) + _arg1 = C.gpointer(unsafe.Pointer(item.Native())) + + _cret = C.g_list_store_find(_arg0, _arg1, &_arg2) + runtime.KeepAlive(store) + runtime.KeepAlive(item) + + var _position uint // out + var _ok bool // out + + _position = uint(_arg2) + if _cret != 0 { + _ok = true + } + + return _position, _ok +} + +// FindWithEqualFuncFull: like g_list_store_find_with_equal_func() but with an +// additional user_data that is passed to equal_func. +// +// item is always passed as second parameter to equal_func. +// +// Since GLib 2.76 it is possible to pass NULL for item. +// +// The function takes the following parameters: +// +// - item (optional): item. +// - equalFunc: custom equality check function. +// +// The function returns the following values: +// +// - position (optional): first position of item, if it was found. +// - ok: whether store contains item. If it was found, position will be set to +// the position where item occurred for the first time. +func (store *ListStore) FindWithEqualFuncFull(item *coreglib.Object, equalFunc glib.EqualFuncFull) (uint, bool) { + var _arg0 *C.GListStore // out + var _arg1 C.gpointer // out + var _arg2 C.GEqualFuncFull // out + var _arg3 C.gpointer + var _arg4 C.guint // in + var _cret C.gboolean // in + + _arg0 = (*C.GListStore)(unsafe.Pointer(coreglib.InternObject(store).Native())) + _arg1 = C.gpointer(unsafe.Pointer(item.Native())) + _arg2 = (*[0]byte)(C._gotk4_glib2_EqualFuncFull) + _arg3 = C.gpointer(gbox.Assign(equalFunc)) + defer gbox.Delete(uintptr(_arg3)) + + _cret = C.g_list_store_find_with_equal_func_full(_arg0, _arg1, _arg2, _arg3, &_arg4) + runtime.KeepAlive(store) + runtime.KeepAlive(item) + runtime.KeepAlive(equalFunc) + + var _position uint // out + var _ok bool // out + + _position = uint(_arg4) + if _cret != 0 { + _ok = true + } + + return _position, _ok +} + +// Insert inserts item into store at position. item must be of type +// Store:item-type or derived from it. position must be smaller than the length +// of the list, or equal to it to append. +// +// This function takes a ref on item. +// +// Use g_list_store_splice() to insert multiple items at the same time +// efficiently. +// +// The function takes the following parameters: +// +// - position at which to insert the new item. +// - item: new item. +func (store *ListStore) Insert(position uint, item *coreglib.Object) { + var _arg0 *C.GListStore // out + var _arg1 C.guint // out + var _arg2 C.gpointer // out + + _arg0 = (*C.GListStore)(unsafe.Pointer(coreglib.InternObject(store).Native())) + _arg1 = C.guint(position) + _arg2 = C.gpointer(unsafe.Pointer(item.Native())) + + C.g_list_store_insert(_arg0, _arg1, _arg2) + runtime.KeepAlive(store) + runtime.KeepAlive(position) + runtime.KeepAlive(item) +} + +// InsertSorted inserts item into store at a position to be determined by the +// compare_func. +// +// The list must already be sorted before calling this function or the result +// is undefined. Usually you would approach this by only ever inserting items by +// way of this function. +// +// This function takes a ref on item. +// +// The function takes the following parameters: +// +// - item: new item. +// - compareFunc: pairwise comparison function for sorting. +// +// The function returns the following values: +// +// - guint: position at which item was inserted. +func (store *ListStore) InsertSorted(item *coreglib.Object, compareFunc glib.CompareDataFunc) uint { + var _arg0 *C.GListStore // out + var _arg1 C.gpointer // out + var _arg2 C.GCompareDataFunc // out + var _arg3 C.gpointer + var _cret C.guint // in + + _arg0 = (*C.GListStore)(unsafe.Pointer(coreglib.InternObject(store).Native())) + _arg1 = C.gpointer(unsafe.Pointer(item.Native())) + _arg2 = (*[0]byte)(C._gotk4_glib2_CompareDataFunc) + _arg3 = C.gpointer(gbox.Assign(compareFunc)) + defer gbox.Delete(uintptr(_arg3)) + + _cret = C.g_list_store_insert_sorted(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(store) + runtime.KeepAlive(item) + runtime.KeepAlive(compareFunc) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Remove removes the item from store that is at position. position must be +// smaller than the current length of the list. +// +// Use g_list_store_splice() to remove multiple items at the same time +// efficiently. +// +// The function takes the following parameters: +// +// - position of the item that is to be removed. +func (store *ListStore) Remove(position uint) { + var _arg0 *C.GListStore // out + var _arg1 C.guint // out + + _arg0 = (*C.GListStore)(unsafe.Pointer(coreglib.InternObject(store).Native())) + _arg1 = C.guint(position) + + C.g_list_store_remove(_arg0, _arg1) + runtime.KeepAlive(store) + runtime.KeepAlive(position) +} + +// RemoveAll removes all items from store. +func (store *ListStore) RemoveAll() { + var _arg0 *C.GListStore // out + + _arg0 = (*C.GListStore)(unsafe.Pointer(coreglib.InternObject(store).Native())) + + C.g_list_store_remove_all(_arg0) + runtime.KeepAlive(store) +} + +// Sort the items in store according to compare_func. +// +// The function takes the following parameters: +// +// - compareFunc: pairwise comparison function for sorting. +func (store *ListStore) Sort(compareFunc glib.CompareDataFunc) { + var _arg0 *C.GListStore // out + var _arg1 C.GCompareDataFunc // out + var _arg2 C.gpointer + + _arg0 = (*C.GListStore)(unsafe.Pointer(coreglib.InternObject(store).Native())) + _arg1 = (*[0]byte)(C._gotk4_glib2_CompareDataFunc) + _arg2 = C.gpointer(gbox.Assign(compareFunc)) + defer gbox.Delete(uintptr(_arg2)) + + C.g_list_store_sort(_arg0, _arg1, _arg2) + runtime.KeepAlive(store) + runtime.KeepAlive(compareFunc) +} + +// Splice changes store by removing n_removals items and adding n_additions +// items to it. additions must contain n_additions items of type +// Store:item-type. NULL is not permitted. +// +// This function is more efficient than g_list_store_insert() and +// g_list_store_remove(), because it only emits Model::items-changed once for +// the change. +// +// This function takes a ref on each item in additions. +// +// The parameters position and n_removals must be correct (ie: position + +// n_removals must be less than or equal to the length of the list at the time +// this function is called). +// +// The function takes the following parameters: +// +// - position at which to make the change. +// - nRemovals: number of items to remove. +// - additions items to add. +func (store *ListStore) Splice(position, nRemovals uint, additions []*coreglib.Object) { + var _arg0 *C.GListStore // out + var _arg1 C.guint // out + var _arg2 C.guint // out + var _arg3 *C.gpointer // out + var _arg4 C.guint + + _arg0 = (*C.GListStore)(unsafe.Pointer(coreglib.InternObject(store).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(nRemovals) + _arg4 = (C.guint)(len(additions)) + _arg3 = (*C.gpointer)(C.calloc(C.size_t(len(additions)), C.size_t(C.sizeof_gpointer))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice((*C.gpointer)(_arg3), len(additions)) + for i := range additions { + out[i] = C.gpointer(unsafe.Pointer(additions[i].Native())) + } + } + + C.g_list_store_splice(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(store) + runtime.KeepAlive(position) + runtime.KeepAlive(nRemovals) + runtime.KeepAlive(additions) +} + +// MemoryInputStreamOverrides contains methods that are overridable. +type MemoryInputStreamOverrides struct { +} + +func defaultMemoryInputStreamOverrides(v *MemoryInputStream) MemoryInputStreamOverrides { + return MemoryInputStreamOverrides{} +} + +// MemoryInputStream: GMemoryInputStream is a class for using arbitrary memory +// chunks as input for GIO streaming input operations. +// +// As of GLib 2.34, GMemoryInputStream implements gio.PollableInputStream. +type MemoryInputStream struct { + _ [0]func() // equal guard + InputStream + + *coreglib.Object + PollableInputStream + Seekable +} + +var ( + _ InputStreamer = (*MemoryInputStream)(nil) + _ coreglib.Objector = (*MemoryInputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*MemoryInputStream, *MemoryInputStreamClass, MemoryInputStreamOverrides]( + GTypeMemoryInputStream, + initMemoryInputStreamClass, + wrapMemoryInputStream, + defaultMemoryInputStreamOverrides, + ) +} + +func initMemoryInputStreamClass(gclass unsafe.Pointer, overrides MemoryInputStreamOverrides, classInitFunc func(*MemoryInputStreamClass)) { + if classInitFunc != nil { + class := (*MemoryInputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapMemoryInputStream(obj *coreglib.Object) *MemoryInputStream { + return &MemoryInputStream{ + InputStream: InputStream{ + Object: obj, + }, + Object: obj, + PollableInputStream: PollableInputStream{ + InputStream: InputStream{ + Object: obj, + }, + }, + Seekable: Seekable{ + Object: obj, + }, + } +} + +func marshalMemoryInputStream(p uintptr) (interface{}, error) { + return wrapMemoryInputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewMemoryInputStream creates a new empty InputStream. +// +// The function returns the following values: +// +// - memoryInputStream: new Stream. +func NewMemoryInputStream() *MemoryInputStream { + var _cret *C.GInputStream // in + + _cret = C.g_memory_input_stream_new() + + var _memoryInputStream *MemoryInputStream // out + + _memoryInputStream = wrapMemoryInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _memoryInputStream +} + +// NewMemoryInputStreamFromBytes creates a new InputStream with data from the +// given bytes. +// +// The function takes the following parameters: +// +// - bytes: #GBytes. +// +// The function returns the following values: +// +// - memoryInputStream: new Stream read from bytes. +func NewMemoryInputStreamFromBytes(bytes *glib.Bytes) *MemoryInputStream { + var _arg1 *C.GBytes // out + var _cret *C.GInputStream // in + + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + + _cret = C.g_memory_input_stream_new_from_bytes(_arg1) + runtime.KeepAlive(bytes) + + var _memoryInputStream *MemoryInputStream // out + + _memoryInputStream = wrapMemoryInputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _memoryInputStream +} + +// AddBytes appends bytes to data that can be read from the input stream. +// +// The function takes the following parameters: +// +// - bytes: input data. +func (stream *MemoryInputStream) AddBytes(bytes *glib.Bytes) { + var _arg0 *C.GMemoryInputStream // out + var _arg1 *C.GBytes // out + + _arg0 = (*C.GMemoryInputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + + C.g_memory_input_stream_add_bytes(_arg0, _arg1) + runtime.KeepAlive(stream) + runtime.KeepAlive(bytes) +} + +// MemoryOutputStreamOverrides contains methods that are overridable. +type MemoryOutputStreamOverrides struct { +} + +func defaultMemoryOutputStreamOverrides(v *MemoryOutputStream) MemoryOutputStreamOverrides { + return MemoryOutputStreamOverrides{} +} + +// MemoryOutputStream: GMemoryOutputStream is a class for using arbitrary memory +// chunks as output for GIO streaming output operations. +// +// As of GLib 2.34, GMemoryOutputStream trivially implements +// gio.PollableOutputStream: it always polls as ready. +type MemoryOutputStream struct { + _ [0]func() // equal guard + OutputStream + + *coreglib.Object + PollableOutputStream + Seekable +} + +var ( + _ OutputStreamer = (*MemoryOutputStream)(nil) + _ coreglib.Objector = (*MemoryOutputStream)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*MemoryOutputStream, *MemoryOutputStreamClass, MemoryOutputStreamOverrides]( + GTypeMemoryOutputStream, + initMemoryOutputStreamClass, + wrapMemoryOutputStream, + defaultMemoryOutputStreamOverrides, + ) +} + +func initMemoryOutputStreamClass(gclass unsafe.Pointer, overrides MemoryOutputStreamOverrides, classInitFunc func(*MemoryOutputStreamClass)) { + if classInitFunc != nil { + class := (*MemoryOutputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapMemoryOutputStream(obj *coreglib.Object) *MemoryOutputStream { + return &MemoryOutputStream{ + OutputStream: OutputStream{ + Object: obj, + }, + Object: obj, + PollableOutputStream: PollableOutputStream{ + OutputStream: OutputStream{ + Object: obj, + }, + }, + Seekable: Seekable{ + Object: obj, + }, + } +} + +func marshalMemoryOutputStream(p uintptr) (interface{}, error) { + return wrapMemoryOutputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewMemoryOutputStreamResizable creates a new OutputStream, using g_realloc() +// and g_free() for memory allocation. +func NewMemoryOutputStreamResizable() *MemoryOutputStream { + var _cret *C.GOutputStream // in + + _cret = C.g_memory_output_stream_new_resizable() + + var _memoryOutputStream *MemoryOutputStream // out + + _memoryOutputStream = wrapMemoryOutputStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _memoryOutputStream +} + +// Data gets any loaded data from the ostream. +// +// Note that the returned pointer may become invalid on the next write or +// truncate operation on the stream. +// +// The function returns the following values: +// +// - gpointer (optional): pointer to the stream's data, or NULL if the data +// has been stolen. +func (ostream *MemoryOutputStream) Data() unsafe.Pointer { + var _arg0 *C.GMemoryOutputStream // out + var _cret C.gpointer // in + + _arg0 = (*C.GMemoryOutputStream)(unsafe.Pointer(coreglib.InternObject(ostream).Native())) + + _cret = C.g_memory_output_stream_get_data(_arg0) + runtime.KeepAlive(ostream) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// DataSize returns the number of bytes from the start up to including the last +// byte written in the stream that has not been truncated away. +// +// The function returns the following values: +// +// - gsize: number of bytes written to the stream. +func (ostream *MemoryOutputStream) DataSize() uint { + var _arg0 *C.GMemoryOutputStream // out + var _cret C.gsize // in + + _arg0 = (*C.GMemoryOutputStream)(unsafe.Pointer(coreglib.InternObject(ostream).Native())) + + _cret = C.g_memory_output_stream_get_data_size(_arg0) + runtime.KeepAlive(ostream) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Size gets the size of the currently allocated data area (available from +// g_memory_output_stream_get_data()). +// +// You probably don't want to use this function on resizable streams. +// See g_memory_output_stream_get_data_size() instead. For resizable streams the +// size returned by this function is an implementation detail and may be change +// at any time in response to operations on the stream. +// +// If the stream is fixed-sized (ie: no realloc was passed to +// g_memory_output_stream_new()) then this is the maximum size of the stream and +// further writes will return G_IO_ERROR_NO_SPACE. +// +// In any case, if you want the number of bytes currently written to the stream, +// use g_memory_output_stream_get_data_size(). +// +// The function returns the following values: +// +// - gsize: number of bytes allocated for the data buffer. +func (ostream *MemoryOutputStream) Size() uint { + var _arg0 *C.GMemoryOutputStream // out + var _cret C.gsize // in + + _arg0 = (*C.GMemoryOutputStream)(unsafe.Pointer(coreglib.InternObject(ostream).Native())) + + _cret = C.g_memory_output_stream_get_size(_arg0) + runtime.KeepAlive(ostream) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// StealAsBytes returns data from the ostream as a #GBytes. ostream must be +// closed before calling this function. +// +// The function returns the following values: +// +// - bytes stream's data. +func (ostream *MemoryOutputStream) StealAsBytes() *glib.Bytes { + var _arg0 *C.GMemoryOutputStream // out + var _cret *C.GBytes // in + + _arg0 = (*C.GMemoryOutputStream)(unsafe.Pointer(coreglib.InternObject(ostream).Native())) + + _cret = C.g_memory_output_stream_steal_as_bytes(_arg0) + runtime.KeepAlive(ostream) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// StealData gets any loaded data from the ostream. Ownership of the data is +// transferred to the caller; when no longer needed it must be freed using the +// free function set in ostream's OutputStream:destroy-function property. +// +// ostream must be closed before calling this function. +// +// The function returns the following values: +// +// - gpointer (optional) stream's data, or NULL if it has previously been +// stolen. +func (ostream *MemoryOutputStream) StealData() unsafe.Pointer { + var _arg0 *C.GMemoryOutputStream // out + var _cret C.gpointer // in + + _arg0 = (*C.GMemoryOutputStream)(unsafe.Pointer(coreglib.InternObject(ostream).Native())) + + _cret = C.g_memory_output_stream_steal_data(_arg0) + runtime.KeepAlive(ostream) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// Menu: GMenu is a simple implementation of gio.MenuModel. You populate a GMenu +// by adding gio.MenuItem instances to it. +// +// There are some convenience functions to allow you to directly add items +// (avoiding gio.MenuItem) for the common cases. To add a regular item, +// use gio.Menu.Insert(). To add a section, use gio.Menu.InsertSection(). +// To add a submenu, use gio.Menu.InsertSubmenu(). +type Menu struct { + _ [0]func() // equal guard + MenuModel +} + +var ( + _ MenuModeller = (*Menu)(nil) +) + +func wrapMenu(obj *coreglib.Object) *Menu { + return &Menu{ + MenuModel: MenuModel{ + Object: obj, + }, + } +} + +func marshalMenu(p uintptr) (interface{}, error) { + return wrapMenu(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewMenu creates a new #GMenu. +// +// The new menu has no items. +// +// The function returns the following values: +// +// - menu: new #GMenu. +func NewMenu() *Menu { + var _cret *C.GMenu // in + + _cret = C.g_menu_new() + + var _menu *Menu // out + + _menu = wrapMenu(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _menu +} + +// Append: convenience function for appending a normal menu item to the end of +// menu. Combine g_menu_item_new() and g_menu_insert_item() for a more flexible +// alternative. +// +// The function takes the following parameters: +// +// - label (optional): section label, or NULL. +// - detailedAction (optional): detailed action string, or NULL. +func (menu *Menu) Append(label, detailedAction string) { + var _arg0 *C.GMenu // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + if detailedAction != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(detailedAction))) + defer C.free(unsafe.Pointer(_arg2)) + } + + C.g_menu_append(_arg0, _arg1, _arg2) + runtime.KeepAlive(menu) + runtime.KeepAlive(label) + runtime.KeepAlive(detailedAction) +} + +// AppendItem appends item to the end of menu. +// +// See g_menu_insert_item() for more information. +// +// The function takes the following parameters: +// +// - item to append. +func (menu *Menu) AppendItem(item *MenuItem) { + var _arg0 *C.GMenu // out + var _arg1 *C.GMenuItem // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + _arg1 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(item).Native())) + + C.g_menu_append_item(_arg0, _arg1) + runtime.KeepAlive(menu) + runtime.KeepAlive(item) +} + +// AppendSection: convenience function for appending a section menu item to the +// end of menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a +// more flexible alternative. +// +// The function takes the following parameters: +// +// - label (optional): section label, or NULL. +// - section with the items of the section. +func (menu *Menu) AppendSection(label string, section MenuModeller) { + var _arg0 *C.GMenu // out + var _arg1 *C.gchar // out + var _arg2 *C.GMenuModel // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(section).Native())) + + C.g_menu_append_section(_arg0, _arg1, _arg2) + runtime.KeepAlive(menu) + runtime.KeepAlive(label) + runtime.KeepAlive(section) +} + +// AppendSubmenu: convenience function for appending a submenu menu item to the +// end of menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a +// more flexible alternative. +// +// The function takes the following parameters: +// +// - label (optional): section label, or NULL. +// - submenu with the items of the submenu. +func (menu *Menu) AppendSubmenu(label string, submenu MenuModeller) { + var _arg0 *C.GMenu // out + var _arg1 *C.gchar // out + var _arg2 *C.GMenuModel // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(submenu).Native())) + + C.g_menu_append_submenu(_arg0, _arg1, _arg2) + runtime.KeepAlive(menu) + runtime.KeepAlive(label) + runtime.KeepAlive(submenu) +} + +// Freeze marks menu as frozen. +// +// After the menu is frozen, it is an error to attempt to make any changes to +// it. In effect this means that the #GMenu API must no longer be used. +// +// This function causes g_menu_model_is_mutable() to begin returning FALSE, +// which has some positive performance implications. +func (menu *Menu) Freeze() { + var _arg0 *C.GMenu // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + + C.g_menu_freeze(_arg0) + runtime.KeepAlive(menu) +} + +// Insert: convenience function for inserting a normal menu item into menu. +// Combine g_menu_item_new() and g_menu_insert_item() for a more flexible +// alternative. +// +// The function takes the following parameters: +// +// - position at which to insert the item. +// - label (optional): section label, or NULL. +// - detailedAction (optional): detailed action string, or NULL. +func (menu *Menu) Insert(position int, label, detailedAction string) { + var _arg0 *C.GMenu // out + var _arg1 C.gint // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + _arg1 = C.gint(position) + if label != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg2)) + } + if detailedAction != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(detailedAction))) + defer C.free(unsafe.Pointer(_arg3)) + } + + C.g_menu_insert(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(menu) + runtime.KeepAlive(position) + runtime.KeepAlive(label) + runtime.KeepAlive(detailedAction) +} + +// InsertItem inserts item into menu. +// +// The "insertion" is actually done by copying all of the attribute and link +// values of item and using them to form a new item within menu. As such, +// item itself is not really inserted, but rather, a menu item that is exactly +// the same as the one presently described by item. +// +// This means that item is essentially useless after the insertion occurs. +// Any changes you make to it are ignored unless it is inserted again (at which +// point its updated values will be copied). +// +// You should probably just free item once you're done. +// +// There are many convenience functions to take care of common cases. See +// g_menu_insert(), g_menu_insert_section() and g_menu_insert_submenu() as well +// as "prepend" and "append" variants of each of these functions. +// +// The function takes the following parameters: +// +// - position at which to insert the item. +// - item to insert. +func (menu *Menu) InsertItem(position int, item *MenuItem) { + var _arg0 *C.GMenu // out + var _arg1 C.gint // out + var _arg2 *C.GMenuItem // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + _arg1 = C.gint(position) + _arg2 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(item).Native())) + + C.g_menu_insert_item(_arg0, _arg1, _arg2) + runtime.KeepAlive(menu) + runtime.KeepAlive(position) + runtime.KeepAlive(item) +} + +// InsertSection: convenience function for inserting a section menu item into +// menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a more +// flexible alternative. +// +// The function takes the following parameters: +// +// - position at which to insert the item. +// - label (optional): section label, or NULL. +// - section with the items of the section. +func (menu *Menu) InsertSection(position int, label string, section MenuModeller) { + var _arg0 *C.GMenu // out + var _arg1 C.gint // out + var _arg2 *C.gchar // out + var _arg3 *C.GMenuModel // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + _arg1 = C.gint(position) + if label != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg2)) + } + _arg3 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(section).Native())) + + C.g_menu_insert_section(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(menu) + runtime.KeepAlive(position) + runtime.KeepAlive(label) + runtime.KeepAlive(section) +} + +// InsertSubmenu: convenience function for inserting a submenu menu item into +// menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more +// flexible alternative. +// +// The function takes the following parameters: +// +// - position at which to insert the item. +// - label (optional): section label, or NULL. +// - submenu with the items of the submenu. +func (menu *Menu) InsertSubmenu(position int, label string, submenu MenuModeller) { + var _arg0 *C.GMenu // out + var _arg1 C.gint // out + var _arg2 *C.gchar // out + var _arg3 *C.GMenuModel // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + _arg1 = C.gint(position) + if label != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg2)) + } + _arg3 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(submenu).Native())) + + C.g_menu_insert_submenu(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(menu) + runtime.KeepAlive(position) + runtime.KeepAlive(label) + runtime.KeepAlive(submenu) +} + +// Prepend: convenience function for prepending a normal menu item to the +// start of menu. Combine g_menu_item_new() and g_menu_insert_item() for a more +// flexible alternative. +// +// The function takes the following parameters: +// +// - label (optional): section label, or NULL. +// - detailedAction (optional): detailed action string, or NULL. +func (menu *Menu) Prepend(label, detailedAction string) { + var _arg0 *C.GMenu // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + if detailedAction != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(detailedAction))) + defer C.free(unsafe.Pointer(_arg2)) + } + + C.g_menu_prepend(_arg0, _arg1, _arg2) + runtime.KeepAlive(menu) + runtime.KeepAlive(label) + runtime.KeepAlive(detailedAction) +} + +// PrependItem prepends item to the start of menu. +// +// See g_menu_insert_item() for more information. +// +// The function takes the following parameters: +// +// - item to prepend. +func (menu *Menu) PrependItem(item *MenuItem) { + var _arg0 *C.GMenu // out + var _arg1 *C.GMenuItem // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + _arg1 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(item).Native())) + + C.g_menu_prepend_item(_arg0, _arg1) + runtime.KeepAlive(menu) + runtime.KeepAlive(item) +} + +// PrependSection: convenience function for prepending a section menu item to +// the start of menu. Combine g_menu_item_new_section() and g_menu_insert_item() +// for a more flexible alternative. +// +// The function takes the following parameters: +// +// - label (optional): section label, or NULL. +// - section with the items of the section. +func (menu *Menu) PrependSection(label string, section MenuModeller) { + var _arg0 *C.GMenu // out + var _arg1 *C.gchar // out + var _arg2 *C.GMenuModel // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(section).Native())) + + C.g_menu_prepend_section(_arg0, _arg1, _arg2) + runtime.KeepAlive(menu) + runtime.KeepAlive(label) + runtime.KeepAlive(section) +} + +// PrependSubmenu: convenience function for prepending a submenu menu item to +// the start of menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() +// for a more flexible alternative. +// +// The function takes the following parameters: +// +// - label (optional): section label, or NULL. +// - submenu with the items of the submenu. +func (menu *Menu) PrependSubmenu(label string, submenu MenuModeller) { + var _arg0 *C.GMenu // out + var _arg1 *C.gchar // out + var _arg2 *C.GMenuModel // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(submenu).Native())) + + C.g_menu_prepend_submenu(_arg0, _arg1, _arg2) + runtime.KeepAlive(menu) + runtime.KeepAlive(label) + runtime.KeepAlive(submenu) +} + +// Remove removes an item from the menu. +// +// position gives the index of the item to remove. +// +// It is an error if position is not in range the range from 0 to one less than +// the number of items in the menu. +// +// It is not possible to remove items by identity since items are added to the +// menu simply by copying their links and attributes (ie: identity of the item +// itself is not preserved). +// +// The function takes the following parameters: +// +// - position of the item to remove. +func (menu *Menu) Remove(position int) { + var _arg0 *C.GMenu // out + var _arg1 C.gint // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + _arg1 = C.gint(position) + + C.g_menu_remove(_arg0, _arg1) + runtime.KeepAlive(menu) + runtime.KeepAlive(position) +} + +// RemoveAll removes all items in the menu. +func (menu *Menu) RemoveAll() { + var _arg0 *C.GMenu // out + + _arg0 = (*C.GMenu)(unsafe.Pointer(coreglib.InternObject(menu).Native())) + + C.g_menu_remove_all(_arg0) + runtime.KeepAlive(menu) +} + +// MenuAttributeIterOverrides contains methods that are overridable. +type MenuAttributeIterOverrides struct { + // Next: this function combines g_menu_attribute_iter_next() with + // g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value(). + // + // First the iterator is advanced to the next (possibly first) attribute. + // If that fails, then FALSE is returned and there are no other effects. + // + // If successful, name and value are set to the name and value of + // the attribute that has just been advanced to. At this point, + // g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value() + // will return the same values again. + // + // The value returned in name remains valid for as long as the iterator + // remains at the current position. The value returned in value must be + // unreffed using g_variant_unref() when it is no longer in use. + // + // The function returns the following values: + // + // - outName (optional): type of the attribute. + // - value (optional): attribute value. + // - ok: TRUE on success, or FALSE if there is no additional attribute. + Next func() (string, *glib.Variant, bool) +} + +func defaultMenuAttributeIterOverrides(v *MenuAttributeIter) MenuAttributeIterOverrides { + return MenuAttributeIterOverrides{ + Next: v.next, + } +} + +// MenuAttributeIter is an opaque structure type. You must access it using the +// functions below. +type MenuAttributeIter struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*MenuAttributeIter)(nil) +) + +// MenuAttributeIterer describes types inherited from class MenuAttributeIter. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type MenuAttributeIterer interface { + coreglib.Objector + baseMenuAttributeIter() *MenuAttributeIter +} + +var _ MenuAttributeIterer = (*MenuAttributeIter)(nil) + +func init() { + coreglib.RegisterClassInfo[*MenuAttributeIter, *MenuAttributeIterClass, MenuAttributeIterOverrides]( + GTypeMenuAttributeIter, + initMenuAttributeIterClass, + wrapMenuAttributeIter, + defaultMenuAttributeIterOverrides, + ) +} + +func initMenuAttributeIterClass(gclass unsafe.Pointer, overrides MenuAttributeIterOverrides, classInitFunc func(*MenuAttributeIterClass)) { + pclass := (*C.GMenuAttributeIterClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeMenuAttributeIter)))) + + if overrides.Next != nil { + pclass.get_next = (*[0]byte)(C._gotk4_gio2_MenuAttributeIterClass_get_next) + } + + if classInitFunc != nil { + class := (*MenuAttributeIterClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapMenuAttributeIter(obj *coreglib.Object) *MenuAttributeIter { + return &MenuAttributeIter{ + Object: obj, + } +} + +func marshalMenuAttributeIter(p uintptr) (interface{}, error) { + return wrapMenuAttributeIter(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (iter *MenuAttributeIter) baseMenuAttributeIter() *MenuAttributeIter { + return iter +} + +// BaseMenuAttributeIter returns the underlying base object. +func BaseMenuAttributeIter(obj MenuAttributeIterer) *MenuAttributeIter { + return obj.baseMenuAttributeIter() +} + +// Name gets the name of the attribute at the current iterator position, +// as a string. +// +// The iterator is not advanced. +// +// The function returns the following values: +// +// - utf8: name of the attribute. +func (iter *MenuAttributeIter) Name() string { + var _arg0 *C.GMenuAttributeIter // out + var _cret *C.gchar // in + + _arg0 = (*C.GMenuAttributeIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.g_menu_attribute_iter_get_name(_arg0) + runtime.KeepAlive(iter) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// GetNext: this function combines g_menu_attribute_iter_next() with +// g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value(). +// +// First the iterator is advanced to the next (possibly first) attribute. +// If that fails, then FALSE is returned and there are no other effects. +// +// If successful, name and value are set to the name and value of +// the attribute that has just been advanced to. At this point, +// g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value() will +// return the same values again. +// +// The value returned in name remains valid for as long as the iterator remains +// at the current position. The value returned in value must be unreffed using +// g_variant_unref() when it is no longer in use. +// +// The function returns the following values: +// +// - outName (optional): type of the attribute. +// - value (optional): attribute value. +// - ok: TRUE on success, or FALSE if there is no additional attribute. +func (iter *MenuAttributeIter) GetNext() (string, *glib.Variant, bool) { + var _arg0 *C.GMenuAttributeIter // out + var _arg1 *C.gchar // in + var _arg2 *C.GVariant // in + var _cret C.gboolean // in + + _arg0 = (*C.GMenuAttributeIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.g_menu_attribute_iter_get_next(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(iter) + + var _outName string // out + var _value *glib.Variant // out + var _ok bool // out + + if _arg1 != nil { + _outName = C.GoString((*C.gchar)(unsafe.Pointer(_arg1))) + } + if _arg2 != nil { + _value = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_arg2))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_value)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + if _cret != 0 { + _ok = true + } + + return _outName, _value, _ok +} + +// Value gets the value of the attribute at the current iterator position. +// +// The iterator is not advanced. +// +// The function returns the following values: +// +// - variant: value of the current attribute. +func (iter *MenuAttributeIter) Value() *glib.Variant { + var _arg0 *C.GMenuAttributeIter // out + var _cret *C.GVariant // in + + _arg0 = (*C.GMenuAttributeIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.g_menu_attribute_iter_get_value(_arg0) + runtime.KeepAlive(iter) + + var _variant *glib.Variant // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// Next attempts to advance the iterator to the next (possibly first) attribute. +// +// TRUE is returned on success, or FALSE if there are no more attributes. +// +// You must call this function when you first acquire the iterator to advance it +// to the first attribute (and determine if the first attribute exists at all). +// +// The function returns the following values: +// +// - ok: TRUE on success, or FALSE when there are no more attributes. +func (iter *MenuAttributeIter) Next() bool { + var _arg0 *C.GMenuAttributeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GMenuAttributeIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.g_menu_attribute_iter_next(_arg0) + runtime.KeepAlive(iter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Next: this function combines g_menu_attribute_iter_next() with +// g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value(). +// +// First the iterator is advanced to the next (possibly first) attribute. +// If that fails, then FALSE is returned and there are no other effects. +// +// If successful, name and value are set to the name and value of +// the attribute that has just been advanced to. At this point, +// g_menu_attribute_iter_get_name() and g_menu_attribute_iter_get_value() will +// return the same values again. +// +// The value returned in name remains valid for as long as the iterator remains +// at the current position. The value returned in value must be unreffed using +// g_variant_unref() when it is no longer in use. +// +// The function returns the following values: +// +// - outName (optional): type of the attribute. +// - value (optional): attribute value. +// - ok: TRUE on success, or FALSE if there is no additional attribute. +func (iter *MenuAttributeIter) next() (string, *glib.Variant, bool) { + gclass := (*C.GMenuAttributeIterClass)(coreglib.PeekParentClass(iter)) + fnarg := gclass.get_next + + var _arg0 *C.GMenuAttributeIter // out + var _arg1 *C.gchar // in + var _arg2 *C.GVariant // in + var _cret C.gboolean // in + + _arg0 = (*C.GMenuAttributeIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C._gotk4_gio2_MenuAttributeIter_virtual_get_next(unsafe.Pointer(fnarg), _arg0, &_arg1, &_arg2) + runtime.KeepAlive(iter) + + var _outName string // out + var _value *glib.Variant // out + var _ok bool // out + + if _arg1 != nil { + _outName = C.GoString((*C.gchar)(unsafe.Pointer(_arg1))) + } + if _arg2 != nil { + _value = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_arg2))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_value)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + if _cret != 0 { + _ok = true + } + + return _outName, _value, _ok +} + +// MenuItem is an opaque structure type. You must access it using the functions +// below. +type MenuItem struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*MenuItem)(nil) +) + +func wrapMenuItem(obj *coreglib.Object) *MenuItem { + return &MenuItem{ + Object: obj, + } +} + +func marshalMenuItem(p uintptr) (interface{}, error) { + return wrapMenuItem(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewMenuItem creates a new Item. +// +// If label is non-NULL it is used to set the "label" attribute of the new item. +// +// If detailed_action is non-NULL it is used to set the "action" and possibly +// the "target" attribute of the new item. See g_menu_item_set_detailed_action() +// for more information. +// +// The function takes the following parameters: +// +// - label (optional): section label, or NULL. +// - detailedAction (optional): detailed action string, or NULL. +// +// The function returns the following values: +// +// - menuItem: new Item. +func NewMenuItem(label, detailedAction string) *MenuItem { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GMenuItem // in + + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + if detailedAction != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(detailedAction))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.g_menu_item_new(_arg1, _arg2) + runtime.KeepAlive(label) + runtime.KeepAlive(detailedAction) + + var _menuItem *MenuItem // out + + _menuItem = wrapMenuItem(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _menuItem +} + +// NewMenuItemFromModel creates a Item as an exact copy of an existing menu item +// in a Model. +// +// item_index must be valid (ie: be sure to call g_menu_model_get_n_items() +// first). +// +// The function takes the following parameters: +// +// - model: Model. +// - itemIndex: index of an item in model. +// +// The function returns the following values: +// +// - menuItem: new Item. +func NewMenuItemFromModel(model MenuModeller, itemIndex int) *MenuItem { + var _arg1 *C.GMenuModel // out + var _arg2 C.gint // out + var _cret *C.GMenuItem // in + + _arg1 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg2 = C.gint(itemIndex) + + _cret = C.g_menu_item_new_from_model(_arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + + var _menuItem *MenuItem // out + + _menuItem = wrapMenuItem(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _menuItem +} + +// NewMenuItemSection creates a new Item representing a section. +// +// This is a convenience API around g_menu_item_new() and +// g_menu_item_set_section(). +// +// The effect of having one menu appear as a section of another is exactly +// as it sounds: the items from section become a direct part of the menu that +// menu_item is added to. +// +// Visual separation is typically displayed between two non-empty sections. If +// label is non-NULL then it will be encorporated into this visual indication. +// This allows for labeled subsections of a menu. +// +// As a simple example, consider a typical "Edit" menu from a simple program. +// It probably contains an "Undo" and "Redo" item, followed by a separator, +// followed by "Cut", "Copy" and "Paste". +// +// This would be accomplished by creating three #GMenu instances. The first +// would be populated with the "Undo" and "Redo" items, and the second with the +// "Cut", "Copy" and "Paste" items. The first and second menus would then be +// added as submenus of the third. In XML format, this would look something like +// the following: +// +// +//
+// +// +//
+//
+// +// +// +//
+//
+// +// The following example is exactly equivalent. It is more illustrative of the +// exact relationship between the menus and items (keeping in mind that the +// 'link' element defines a new menu that is linked to the containing one). +// The style of the second example is more verbose and difficult to read (and +// therefore not recommended except for the purpose of understanding what is +// really going on). +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// . +// +// The function takes the following parameters: +// +// - label (optional): section label, or NULL. +// - section with the items of the section. +// +// The function returns the following values: +// +// - menuItem: new Item. +func NewMenuItemSection(label string, section MenuModeller) *MenuItem { + var _arg1 *C.gchar // out + var _arg2 *C.GMenuModel // out + var _cret *C.GMenuItem // in + + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(section).Native())) + + _cret = C.g_menu_item_new_section(_arg1, _arg2) + runtime.KeepAlive(label) + runtime.KeepAlive(section) + + var _menuItem *MenuItem // out + + _menuItem = wrapMenuItem(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _menuItem +} + +// NewMenuItemSubmenu creates a new Item representing a submenu. +// +// This is a convenience API around g_menu_item_new() and +// g_menu_item_set_submenu(). +// +// The function takes the following parameters: +// +// - label (optional): section label, or NULL. +// - submenu with the items of the submenu. +// +// The function returns the following values: +// +// - menuItem: new Item. +func NewMenuItemSubmenu(label string, submenu MenuModeller) *MenuItem { + var _arg1 *C.gchar // out + var _arg2 *C.GMenuModel // out + var _cret *C.GMenuItem // in + + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(submenu).Native())) + + _cret = C.g_menu_item_new_submenu(_arg1, _arg2) + runtime.KeepAlive(label) + runtime.KeepAlive(submenu) + + var _menuItem *MenuItem // out + + _menuItem = wrapMenuItem(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _menuItem +} + +// AttributeValue queries the named attribute on menu_item. +// +// If expected_type is specified and the attribute does not have this type, NULL +// is returned. NULL is also returned if the attribute simply does not exist. +// +// The function takes the following parameters: +// +// - attribute name to query. +// - expectedType (optional): expected type of the attribute. +// +// The function returns the following values: +// +// - variant (optional): attribute value, or NULL. +func (menuItem *MenuItem) AttributeValue(attribute string, expectedType *glib.VariantType) *glib.Variant { + var _arg0 *C.GMenuItem // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariantType // out + var _cret *C.GVariant // in + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + if expectedType != nil { + _arg2 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(expectedType))) + } + + _cret = C.g_menu_item_get_attribute_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(attribute) + runtime.KeepAlive(expectedType) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// Link queries the named link on menu_item. +// +// The function takes the following parameters: +// +// - link name to query. +// +// The function returns the following values: +// +// - menuModel (optional): link, or NULL. +func (menuItem *MenuItem) Link(link string) MenuModeller { + var _arg0 *C.GMenuItem // out + var _arg1 *C.gchar // out + var _cret *C.GMenuModel // in + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(link))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_menu_item_get_link(_arg0, _arg1) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(link) + + var _menuModel MenuModeller // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuModeller) + return ok + }) + rv, ok := casted.(MenuModeller) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuModeller") + } + _menuModel = rv + } + } + + return _menuModel +} + +// SetActionAndTargetValue sets or unsets the "action" and "target" attributes +// of menu_item. +// +// If action is NULL then both the "action" and "target" attributes are unset +// (and target_value is ignored). +// +// If action is non-NULL then the "action" attribute is set. The "target" +// attribute is then set to the value of target_value if it is non-NULL or unset +// otherwise. +// +// Normal menu items (ie: not submenu, section or other custom item types) are +// expected to have the "action" attribute set to identify the action that +// they are associated with. The state type of the action help to determine +// the disposition of the menu item. See #GAction and Group for an overview of +// actions. +// +// In general, clicking on the menu item will result in activation of the named +// action with the "target" attribute given as the parameter to the action +// invocation. If the "target" attribute is not set then the action is invoked +// with no parameter. +// +// If the action has no state then the menu item is usually drawn as a plain +// menu item (ie: with no additional decoration). +// +// If the action has a boolean state then the menu item is usually drawn as a +// toggle menu item (ie: with a checkmark or equivalent indication). The item +// should be marked as 'toggled' or 'checked' when the boolean state is TRUE. +// +// If the action has a string state then the menu item is usually drawn as a +// radio menu item (ie: with a radio bullet or equivalent indication). The item +// should be marked as 'selected' when the string state is equal to the value of +// the target property. +// +// See g_menu_item_set_action_and_target() or g_menu_item_set_detailed_action() +// for two equivalent calls that are probably more convenient for most uses. +// +// The function takes the following parameters: +// +// - action (optional): name of the action for this item. +// - targetValue (optional) to use as the action target. +func (menuItem *MenuItem) SetActionAndTargetValue(action string, targetValue *glib.Variant) { + var _arg0 *C.GMenuItem // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + if action != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(action))) + defer C.free(unsafe.Pointer(_arg1)) + } + if targetValue != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(targetValue))) + } + + C.g_menu_item_set_action_and_target_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(action) + runtime.KeepAlive(targetValue) +} + +// SetAttributeValue sets or unsets an attribute on menu_item. +// +// The attribute to set or unset is specified by attribute. This can be one of +// the standard attribute names G_MENU_ATTRIBUTE_LABEL, G_MENU_ATTRIBUTE_ACTION, +// G_MENU_ATTRIBUTE_TARGET, or a custom attribute name. Attribute names are +// restricted to lowercase characters, numbers and '-'. Furthermore, the names +// must begin with a lowercase character, must not end with a '-', and must not +// contain consecutive dashes. +// +// must consist only of lowercase ASCII characters, digits and '-'. +// +// If value is non-NULL then it is used as the new value for the attribute. +// If value is NULL then the attribute is unset. If the value #GVariant is +// floating, it is consumed. +// +// See also g_menu_item_set_attribute() for a more convenient way to do the +// same. +// +// The function takes the following parameters: +// +// - attribute to set. +// - value (optional) to use as the value, or NULL. +func (menuItem *MenuItem) SetAttributeValue(attribute string, value *glib.Variant) { + var _arg0 *C.GMenuItem // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + if value != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + } + + C.g_menu_item_set_attribute_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(attribute) + runtime.KeepAlive(value) +} + +// SetDetailedAction sets the "action" and possibly the "target" attribute of +// menu_item. +// +// The format of detailed_action is the same format parsed by +// g_action_parse_detailed_name(). +// +// See g_menu_item_set_action_and_target() or +// g_menu_item_set_action_and_target_value() for more flexible (but slightly +// less convenient) alternatives. +// +// See also g_menu_item_set_action_and_target_value() for a description of the +// semantics of the action and target attributes. +// +// The function takes the following parameters: +// +// - detailedAction: "detailed" action string. +func (menuItem *MenuItem) SetDetailedAction(detailedAction string) { + var _arg0 *C.GMenuItem // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(detailedAction))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_menu_item_set_detailed_action(_arg0, _arg1) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(detailedAction) +} + +// SetIcon sets (or unsets) the icon on menu_item. +// +// This call is the same as calling g_icon_serialize() and using the result as +// the value to g_menu_item_set_attribute_value() for G_MENU_ATTRIBUTE_ICON. +// +// This API is only intended for use with "noun" menu items; things like +// bookmarks or applications in an "Open With" menu. Don't use it on menu items +// corresponding to verbs (eg: stock icons for 'Save' or 'Quit'). +// +// If icon is NULL then the icon is unset. +// +// The function takes the following parameters: +// +// - icon or NULL. +func (menuItem *MenuItem) SetIcon(icon Iconner) { + var _arg0 *C.GMenuItem // out + var _arg1 *C.GIcon // out + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + C.g_menu_item_set_icon(_arg0, _arg1) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(icon) +} + +// SetLabel sets or unsets the "label" attribute of menu_item. +// +// If label is non-NULL it is used as the label for the menu item. If it is NULL +// then the label attribute is unset. +// +// The function takes the following parameters: +// +// - label (optional) to set, or NULL to unset. +func (menuItem *MenuItem) SetLabel(label string) { + var _arg0 *C.GMenuItem // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + if label != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_menu_item_set_label(_arg0, _arg1) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(label) +} + +// SetLink creates a link from menu_item to model if non-NULL, or unsets it. +// +// Links are used to establish a relationship between a particular menu item +// and another menu. For example, G_MENU_LINK_SUBMENU is used to associate +// a submenu with a particular menu item, and G_MENU_LINK_SECTION is used to +// create a section. Other types of link can be used, but there is no guarantee +// that clients will be able to make sense of them. Link types are restricted +// to lowercase characters, numbers and '-'. Furthermore, the names must begin +// with a lowercase character, must not end with a '-', and must not contain +// consecutive dashes. +// +// The function takes the following parameters: +// +// - link: type of link to establish or unset. +// - model (optional) to link to (or NULL to unset). +func (menuItem *MenuItem) SetLink(link string, model MenuModeller) { + var _arg0 *C.GMenuItem // out + var _arg1 *C.gchar // out + var _arg2 *C.GMenuModel // out + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(link))) + defer C.free(unsafe.Pointer(_arg1)) + if model != nil { + _arg2 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + } + + C.g_menu_item_set_link(_arg0, _arg1, _arg2) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(link) + runtime.KeepAlive(model) +} + +// SetSection sets or unsets the "section" link of menu_item to section. +// +// The effect of having one menu appear as a section of another is exactly +// as it sounds: the items from section become a direct part of the menu that +// menu_item is added to. See g_menu_item_new_section() for more information +// about what it means for a menu item to be a section. +// +// The function takes the following parameters: +// +// - section (optional) or NULL. +func (menuItem *MenuItem) SetSection(section MenuModeller) { + var _arg0 *C.GMenuItem // out + var _arg1 *C.GMenuModel // out + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + if section != nil { + _arg1 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(section).Native())) + } + + C.g_menu_item_set_section(_arg0, _arg1) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(section) +} + +// SetSubmenu sets or unsets the "submenu" link of menu_item to submenu. +// +// If submenu is non-NULL, it is linked to. If it is NULL then the link is +// unset. +// +// The effect of having one menu appear as a submenu of another is exactly as it +// sounds. +// +// The function takes the following parameters: +// +// - submenu (optional) or NULL. +func (menuItem *MenuItem) SetSubmenu(submenu MenuModeller) { + var _arg0 *C.GMenuItem // out + var _arg1 *C.GMenuModel // out + + _arg0 = (*C.GMenuItem)(unsafe.Pointer(coreglib.InternObject(menuItem).Native())) + if submenu != nil { + _arg1 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(submenu).Native())) + } + + C.g_menu_item_set_submenu(_arg0, _arg1) + runtime.KeepAlive(menuItem) + runtime.KeepAlive(submenu) +} + +// MenuLinkIterOverrides contains methods that are overridable. +type MenuLinkIterOverrides struct { + // Next: this function combines g_menu_link_iter_next() with + // g_menu_link_iter_get_name() and g_menu_link_iter_get_value(). + // + // First the iterator is advanced to the next (possibly first) link. + // If that fails, then FALSE is returned and there are no other effects. + // + // If successful, out_link and value are set to the name and Model + // of the link that has just been advanced to. At this point, + // g_menu_link_iter_get_name() and g_menu_link_iter_get_value() will return + // the same values again. + // + // The value returned in out_link remains valid for as long as the iterator + // remains at the current position. The value returned in value must be + // unreffed using g_object_unref() when it is no longer in use. + // + // The function returns the following values: + // + // - outLink (optional): name of the link. + // - value (optional): linked Model. + // - ok: TRUE on success, or FALSE if there is no additional link. + Next func() (string, MenuModeller, bool) +} + +func defaultMenuLinkIterOverrides(v *MenuLinkIter) MenuLinkIterOverrides { + return MenuLinkIterOverrides{ + Next: v.next, + } +} + +// MenuLinkIter is an opaque structure type. You must access it using the +// functions below. +type MenuLinkIter struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*MenuLinkIter)(nil) +) + +// MenuLinkIterer describes types inherited from class MenuLinkIter. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type MenuLinkIterer interface { + coreglib.Objector + baseMenuLinkIter() *MenuLinkIter +} + +var _ MenuLinkIterer = (*MenuLinkIter)(nil) + +func init() { + coreglib.RegisterClassInfo[*MenuLinkIter, *MenuLinkIterClass, MenuLinkIterOverrides]( + GTypeMenuLinkIter, + initMenuLinkIterClass, + wrapMenuLinkIter, + defaultMenuLinkIterOverrides, + ) +} + +func initMenuLinkIterClass(gclass unsafe.Pointer, overrides MenuLinkIterOverrides, classInitFunc func(*MenuLinkIterClass)) { + pclass := (*C.GMenuLinkIterClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeMenuLinkIter)))) + + if overrides.Next != nil { + pclass.get_next = (*[0]byte)(C._gotk4_gio2_MenuLinkIterClass_get_next) + } + + if classInitFunc != nil { + class := (*MenuLinkIterClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapMenuLinkIter(obj *coreglib.Object) *MenuLinkIter { + return &MenuLinkIter{ + Object: obj, + } +} + +func marshalMenuLinkIter(p uintptr) (interface{}, error) { + return wrapMenuLinkIter(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (iter *MenuLinkIter) baseMenuLinkIter() *MenuLinkIter { + return iter +} + +// BaseMenuLinkIter returns the underlying base object. +func BaseMenuLinkIter(obj MenuLinkIterer) *MenuLinkIter { + return obj.baseMenuLinkIter() +} + +// Name gets the name of the link at the current iterator position. +// +// The iterator is not advanced. +// +// The function returns the following values: +// +// - utf8: type of the link. +func (iter *MenuLinkIter) Name() string { + var _arg0 *C.GMenuLinkIter // out + var _cret *C.gchar // in + + _arg0 = (*C.GMenuLinkIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.g_menu_link_iter_get_name(_arg0) + runtime.KeepAlive(iter) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// GetNext: this function combines g_menu_link_iter_next() with +// g_menu_link_iter_get_name() and g_menu_link_iter_get_value(). +// +// First the iterator is advanced to the next (possibly first) link. If that +// fails, then FALSE is returned and there are no other effects. +// +// If successful, out_link and value are set to the name and Model of the link +// that has just been advanced to. At this point, g_menu_link_iter_get_name() +// and g_menu_link_iter_get_value() will return the same values again. +// +// The value returned in out_link remains valid for as long as the iterator +// remains at the current position. The value returned in value must be unreffed +// using g_object_unref() when it is no longer in use. +// +// The function returns the following values: +// +// - outLink (optional): name of the link. +// - value (optional): linked Model. +// - ok: TRUE on success, or FALSE if there is no additional link. +func (iter *MenuLinkIter) GetNext() (string, MenuModeller, bool) { + var _arg0 *C.GMenuLinkIter // out + var _arg1 *C.gchar // in + var _arg2 *C.GMenuModel // in + var _cret C.gboolean // in + + _arg0 = (*C.GMenuLinkIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.g_menu_link_iter_get_next(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(iter) + + var _outLink string // out + var _value MenuModeller // out + var _ok bool // out + + if _arg1 != nil { + _outLink = C.GoString((*C.gchar)(unsafe.Pointer(_arg1))) + } + if _arg2 != nil { + { + objptr := unsafe.Pointer(_arg2) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuModeller) + return ok + }) + rv, ok := casted.(MenuModeller) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuModeller") + } + _value = rv + } + } + if _cret != 0 { + _ok = true + } + + return _outLink, _value, _ok +} + +// Value gets the linked Model at the current iterator position. +// +// The iterator is not advanced. +// +// The function returns the following values: +// +// - menuModel that is linked to. +func (iter *MenuLinkIter) Value() MenuModeller { + var _arg0 *C.GMenuLinkIter // out + var _cret *C.GMenuModel // in + + _arg0 = (*C.GMenuLinkIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.g_menu_link_iter_get_value(_arg0) + runtime.KeepAlive(iter) + + var _menuModel MenuModeller // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.MenuModeller is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuModeller) + return ok + }) + rv, ok := casted.(MenuModeller) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuModeller") + } + _menuModel = rv + } + + return _menuModel +} + +// Next attempts to advance the iterator to the next (possibly first) link. +// +// TRUE is returned on success, or FALSE if there are no more links. +// +// You must call this function when you first acquire the iterator to advance it +// to the first link (and determine if the first link exists at all). +// +// The function returns the following values: +// +// - ok: TRUE on success, or FALSE when there are no more links. +func (iter *MenuLinkIter) Next() bool { + var _arg0 *C.GMenuLinkIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GMenuLinkIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C.g_menu_link_iter_next(_arg0) + runtime.KeepAlive(iter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Next: this function combines g_menu_link_iter_next() with +// g_menu_link_iter_get_name() and g_menu_link_iter_get_value(). +// +// First the iterator is advanced to the next (possibly first) link. If that +// fails, then FALSE is returned and there are no other effects. +// +// If successful, out_link and value are set to the name and Model of the link +// that has just been advanced to. At this point, g_menu_link_iter_get_name() +// and g_menu_link_iter_get_value() will return the same values again. +// +// The value returned in out_link remains valid for as long as the iterator +// remains at the current position. The value returned in value must be unreffed +// using g_object_unref() when it is no longer in use. +// +// The function returns the following values: +// +// - outLink (optional): name of the link. +// - value (optional): linked Model. +// - ok: TRUE on success, or FALSE if there is no additional link. +func (iter *MenuLinkIter) next() (string, MenuModeller, bool) { + gclass := (*C.GMenuLinkIterClass)(coreglib.PeekParentClass(iter)) + fnarg := gclass.get_next + + var _arg0 *C.GMenuLinkIter // out + var _arg1 *C.gchar // in + var _arg2 *C.GMenuModel // in + var _cret C.gboolean // in + + _arg0 = (*C.GMenuLinkIter)(unsafe.Pointer(coreglib.InternObject(iter).Native())) + + _cret = C._gotk4_gio2_MenuLinkIter_virtual_get_next(unsafe.Pointer(fnarg), _arg0, &_arg1, &_arg2) + runtime.KeepAlive(iter) + + var _outLink string // out + var _value MenuModeller // out + var _ok bool // out + + if _arg1 != nil { + _outLink = C.GoString((*C.gchar)(unsafe.Pointer(_arg1))) + } + if _arg2 != nil { + { + objptr := unsafe.Pointer(_arg2) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuModeller) + return ok + }) + rv, ok := casted.(MenuModeller) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuModeller") + } + _value = rv + } + } + if _cret != 0 { + _ok = true + } + + return _outLink, _value, _ok +} + +// MenuModelOverrides contains methods that are overridable. +type MenuModelOverrides struct { + // ItemAttributeValue queries the item at position item_index in model for + // the attribute specified by attribute. + // + // If expected_type is non-NULL then it specifies the expected type of the + // attribute. If it is NULL then any type will be accepted. + // + // If the attribute exists and matches expected_type (or if the expected + // type is unspecified) then the value is returned. + // + // If the attribute does not exist, or does not match the expected type then + // NULL is returned. + // + // The function takes the following parameters: + // + // - itemIndex: index of the item. + // - attribute to query. + // - expectedType (optional): expected type of the attribute, or NULL. + // + // The function returns the following values: + // + // - variant (optional): value of the attribute. + ItemAttributeValue func(itemIndex int, attribute string, expectedType *glib.VariantType) *glib.Variant + // ItemAttributes gets all the attributes associated with the item in the + // menu model. + // + // The function takes the following parameters: + // + // - itemIndex to query. + // + // The function returns the following values: + // + // - attributes attributes on the item. + ItemAttributes func(itemIndex int) map[string]*glib.Variant + // ItemLink queries the item at position item_index in model for the link + // specified by link. + // + // If the link exists, the linked Model is returned. If the link does not + // exist, NULL is returned. + // + // The function takes the following parameters: + // + // - itemIndex: index of the item. + // - link to query. + // + // The function returns the following values: + // + // - menuModel (optional): linked Model, or NULL. + ItemLink func(itemIndex int, link string) MenuModeller + // ItemLinks gets all the links associated with the item in the menu model. + // + // The function takes the following parameters: + // + // - itemIndex to query. + // + // The function returns the following values: + // + // - links links from the item. + ItemLinks func(itemIndex int) map[string]MenuModeller + // NItems: query the number of items in model. + // + // The function returns the following values: + // + // - gint: number of items. + NItems func() int + // IsMutable queries if model is mutable. + // + // An immutable Model will never emit the Model::items-changed signal. + // Consumers of the model may make optimisations accordingly. + // + // The function returns the following values: + // + // - ok: TRUE if the model is mutable (ie: "items-changed" may be + // emitted). + IsMutable func() bool + // IterateItemAttributes creates a AttributeIter to iterate over the + // attributes of the item at position item_index in model. + // + // You must free the iterator with g_object_unref() when you are done. + // + // The function takes the following parameters: + // + // - itemIndex: index of the item. + // + // The function returns the following values: + // + // - menuAttributeIter: new AttributeIter. + IterateItemAttributes func(itemIndex int) MenuAttributeIterer + // IterateItemLinks creates a LinkIter to iterate over the links of the item + // at position item_index in model. + // + // You must free the iterator with g_object_unref() when you are done. + // + // The function takes the following parameters: + // + // - itemIndex: index of the item. + // + // The function returns the following values: + // + // - menuLinkIter: new LinkIter. + IterateItemLinks func(itemIndex int) MenuLinkIterer +} + +func defaultMenuModelOverrides(v *MenuModel) MenuModelOverrides { + return MenuModelOverrides{ + ItemAttributeValue: v.itemAttributeValue, + ItemAttributes: v.itemAttributes, + ItemLink: v.itemLink, + ItemLinks: v.itemLinks, + NItems: v.nItems, + IsMutable: v.isMutable, + IterateItemAttributes: v.iterateItemAttributes, + IterateItemLinks: v.iterateItemLinks, + } +} + +// MenuModel: GMenuModel represents the contents of a menu — an ordered +// list of menu items. The items are associated with actions, which can be +// activated through them. Items can be grouped in sections, and may have +// submenus associated with them. Both items and sections usually have some +// representation data, such as labels or icons. The type of the associated +// action (ie whether it is stateful, and what kind of state it has) can +// influence the representation of the item. +// +// The conceptual model of menus in GMenuModel is hierarchical: sections and +// submenus are again represented by GMenuModels. Menus themselves do not define +// their own roles. Rather, the role of a particular GMenuModel is defined by +// the item that references it (or, in the case of the ‘root’ menu, is defined +// by the context in which it is used). +// +// As an example, consider the visible portions of this menu: +// +// # An example menu +// +// ! (menu-example.png) +// +// There are 8 ‘menus’ visible in the screenshot: one menubar, two submenus and +// 5 sections: +// +// - the toplevel menubar (containing 4 items) +// +// - the View submenu (containing 3 sections) +// +// - the first section of the View submenu (containing 2 items) +// +// - the second section of the View submenu (containing 1 item) +// +// - the final section of the View submenu (containing 1 item) +// +// - the Highlight Mode submenu (containing 2 sections) +// +// - the Sources section (containing 2 items) +// +// - the Markup section (containing 2 items) +// +// The example (#a-menu-example) illustrates the conceptual connection between +// these 8 menus. Each large block in the figure represents a menu and the +// smaller blocks within the large block represent items in that menu. Some +// items contain references to other menus. +// +// # A menu example +// +// ! (menu-model.png) +// +// Notice that the separators visible in the example (#an-example-menu) appear +// nowhere in the menu model (#a-menu-example). This is because separators +// are not explicitly represented in the menu model. Instead, a separator is +// inserted between any two non-empty sections of a menu. Section items can have +// labels just like any other item. In that case, a display system may show a +// section header instead of a separator. +// +// The motivation for this abstract model of application controls is that +// modern user interfaces tend to make these controls available outside +// the application. Examples include global menus, jumplists, dash boards, +// etc. To support such uses, it is necessary to ‘export’ information about +// actions and their representation in menus, which is exactly what the action +// group exporter and the menu model exporter do for gio.ActionGroup and +// gio.MenuModel. The client-side counterparts to make use of the exported +// information are gio.DBusActionGroup and gio.DBusMenuModel. +// +// The API of GMenuModel is very generic, with iterators for the attributes +// and links of an item, see gio.MenuModel.IterateItemAttributes() and +// gio.MenuModel.IterateItemLinks(). The ‘standard’ attributes and link types +// have predefined names: G_MENU_ATTRIBUTE_LABEL, G_MENU_ATTRIBUTE_ACTION, +// G_MENU_ATTRIBUTE_TARGET, G_MENU_LINK_SECTION and G_MENU_LINK_SUBMENU. +// +// Items in a GMenuModel represent active controls if they refer to +// an action that can get activated when the user interacts with the +// menu item. The reference to the action is encoded by the string ID +// in the G_MENU_ATTRIBUTE_ACTION attribute. An action ID uniquely +// identifies an action in an action group. Which action group(s) provide +// actions depends on the context in which the menu model is used. E.g. +// when the model is exported as the application menu of a GtkApplication +// (https://docs.gtk.org/gtk4/class.Application.html), actions can be +// application-wide or window-specific (and thus come from two different action +// groups). By convention, the application-wide actions have names that start +// with app., while the names of window-specific actions start with win.. +// +// While a wide variety of stateful actions is possible, the following is +// the minimum that is expected to be supported by all users of exported menu +// information: +// +// - an action with no parameter type and no state +// +// - an action with no parameter type and boolean state +// +// - an action with string parameter type and string state +// +// # Stateless +// +// A stateless action typically corresponds to an ordinary menu item. +// +// Selecting such a menu item will activate the action (with no parameter). +// +// # Boolean State +// +// An action with a boolean state will most typically be used with a ‘toggle’ or +// ‘switch’ menu item. The state can be set directly, but activating the action +// (with no parameter) results in the state being toggled. +// +// Selecting a toggle menu item will activate the action. The menu item should +// be rendered as ‘checked’ when the state is true. +// +// # String Parameter and State +// +// Actions with string parameters and state will most typically be used to +// represent an enumerated choice over the items available for a group of radio +// menu items. Activating the action with a string parameter is equivalent to +// setting that parameter as the state. +// +// Radio menu items, in addition to being associated with the action, will +// have a target value. Selecting that menu item will result in activation of +// the action with the target value as the parameter. The menu item should be +// rendered as ‘selected’ when the state of the action is equal to the target +// value of the menu item. +type MenuModel struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*MenuModel)(nil) +) + +// MenuModeller describes types inherited from class MenuModel. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type MenuModeller interface { + coreglib.Objector + baseMenuModel() *MenuModel +} + +var _ MenuModeller = (*MenuModel)(nil) + +func init() { + coreglib.RegisterClassInfo[*MenuModel, *MenuModelClass, MenuModelOverrides]( + GTypeMenuModel, + initMenuModelClass, + wrapMenuModel, + defaultMenuModelOverrides, + ) +} + +func initMenuModelClass(gclass unsafe.Pointer, overrides MenuModelOverrides, classInitFunc func(*MenuModelClass)) { + pclass := (*C.GMenuModelClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeMenuModel)))) + + if overrides.ItemAttributeValue != nil { + pclass.get_item_attribute_value = (*[0]byte)(C._gotk4_gio2_MenuModelClass_get_item_attribute_value) + } + + if overrides.ItemAttributes != nil { + pclass.get_item_attributes = (*[0]byte)(C._gotk4_gio2_MenuModelClass_get_item_attributes) + } + + if overrides.ItemLink != nil { + pclass.get_item_link = (*[0]byte)(C._gotk4_gio2_MenuModelClass_get_item_link) + } + + if overrides.ItemLinks != nil { + pclass.get_item_links = (*[0]byte)(C._gotk4_gio2_MenuModelClass_get_item_links) + } + + if overrides.NItems != nil { + pclass.get_n_items = (*[0]byte)(C._gotk4_gio2_MenuModelClass_get_n_items) + } + + if overrides.IsMutable != nil { + pclass.is_mutable = (*[0]byte)(C._gotk4_gio2_MenuModelClass_is_mutable) + } + + if overrides.IterateItemAttributes != nil { + pclass.iterate_item_attributes = (*[0]byte)(C._gotk4_gio2_MenuModelClass_iterate_item_attributes) + } + + if overrides.IterateItemLinks != nil { + pclass.iterate_item_links = (*[0]byte)(C._gotk4_gio2_MenuModelClass_iterate_item_links) + } + + if classInitFunc != nil { + class := (*MenuModelClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapMenuModel(obj *coreglib.Object) *MenuModel { + return &MenuModel{ + Object: obj, + } +} + +func marshalMenuModel(p uintptr) (interface{}, error) { + return wrapMenuModel(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (model *MenuModel) baseMenuModel() *MenuModel { + return model +} + +// BaseMenuModel returns the underlying base object. +func BaseMenuModel(obj MenuModeller) *MenuModel { + return obj.baseMenuModel() +} + +// ConnectItemsChanged is emitted when a change has occurred to the menu. +// +// The only changes that can occur to a menu is that items are removed or added. +// Items may not change (except by being removed and added back in the same +// location). This signal is capable of describing both of those changes (at the +// same time). +// +// The signal means that starting at the index position, removed items were +// removed and added items were added in their place. If removed is zero then +// only items were added. If added is zero then only items were removed. +// +// As an example, if the menu contains items a, b, c, d (in that order) and the +// signal (2, 1, 3) occurs then the new composition of the menu will be a, b, _, +// _, _, d (with each _ representing some new item). +// +// Signal handlers may query the model (particularly the added items) and expect +// to see the results of the modification that is being reported. The signal is +// emitted after the modification. +func (model *MenuModel) ConnectItemsChanged(f func(position, removed, added int)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(model, "items-changed", false, unsafe.Pointer(C._gotk4_gio2_MenuModel_ConnectItemsChanged), f) +} + +// ItemAttributeValue queries the item at position item_index in model for the +// attribute specified by attribute. +// +// If expected_type is non-NULL then it specifies the expected type of the +// attribute. If it is NULL then any type will be accepted. +// +// If the attribute exists and matches expected_type (or if the expected type is +// unspecified) then the value is returned. +// +// If the attribute does not exist, or does not match the expected type then +// NULL is returned. +// +// The function takes the following parameters: +// +// - itemIndex: index of the item. +// - attribute to query. +// - expectedType (optional): expected type of the attribute, or NULL. +// +// The function returns the following values: +// +// - variant (optional): value of the attribute. +func (model *MenuModel) ItemAttributeValue(itemIndex int, attribute string, expectedType *glib.VariantType) *glib.Variant { + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _arg2 *C.gchar // out + var _arg3 *C.GVariantType // out + var _cret *C.GVariant // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg2)) + if expectedType != nil { + _arg3 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(expectedType))) + } + + _cret = C.g_menu_model_get_item_attribute_value(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + runtime.KeepAlive(attribute) + runtime.KeepAlive(expectedType) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// ItemLink queries the item at position item_index in model for the link +// specified by link. +// +// If the link exists, the linked Model is returned. If the link does not exist, +// NULL is returned. +// +// The function takes the following parameters: +// +// - itemIndex: index of the item. +// - link to query. +// +// The function returns the following values: +// +// - menuModel (optional): linked Model, or NULL. +func (model *MenuModel) ItemLink(itemIndex int, link string) MenuModeller { + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _arg2 *C.gchar // out + var _cret *C.GMenuModel // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(link))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_menu_model_get_item_link(_arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + runtime.KeepAlive(link) + + var _menuModel MenuModeller // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuModeller) + return ok + }) + rv, ok := casted.(MenuModeller) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuModeller") + } + _menuModel = rv + } + } + + return _menuModel +} + +// NItems: query the number of items in model. +// +// The function returns the following values: +// +// - gint: number of items. +func (model *MenuModel) NItems() int { + var _arg0 *C.GMenuModel // out + var _cret C.gint // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + + _cret = C.g_menu_model_get_n_items(_arg0) + runtime.KeepAlive(model) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// IsMutable queries if model is mutable. +// +// An immutable Model will never emit the Model::items-changed signal. Consumers +// of the model may make optimisations accordingly. +// +// The function returns the following values: +// +// - ok: TRUE if the model is mutable (ie: "items-changed" may be emitted). +func (model *MenuModel) IsMutable() bool { + var _arg0 *C.GMenuModel // out + var _cret C.gboolean // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + + _cret = C.g_menu_model_is_mutable(_arg0) + runtime.KeepAlive(model) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ItemsChanged requests emission of the Model::items-changed signal on model. +// +// This function should never be called except by Model subclasses. Any other +// calls to this function will very likely lead to a violation of the interface +// of the model. +// +// The implementation should update its internal representation of the menu +// before emitting the signal. The implementation should further expect to +// receive queries about the new state of the menu (and particularly added menu +// items) while signal handlers are running. +// +// The implementation must dispatch this call directly from a mainloop entry +// and not in response to calls -- particularly those from the Model API. +// Said another way: the menu must not change while user code is running without +// returning to the mainloop. +// +// The function takes the following parameters: +// +// - position of the change. +// - removed: number of items removed. +// - added: number of items added. +func (model *MenuModel) ItemsChanged(position, removed, added int) { + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _arg2 C.gint // out + var _arg3 C.gint // out + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(position) + _arg2 = C.gint(removed) + _arg3 = C.gint(added) + + C.g_menu_model_items_changed(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(removed) + runtime.KeepAlive(added) +} + +// IterateItemAttributes creates a AttributeIter to iterate over the attributes +// of the item at position item_index in model. +// +// You must free the iterator with g_object_unref() when you are done. +// +// The function takes the following parameters: +// +// - itemIndex: index of the item. +// +// The function returns the following values: +// +// - menuAttributeIter: new AttributeIter. +func (model *MenuModel) IterateItemAttributes(itemIndex int) MenuAttributeIterer { + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _cret *C.GMenuAttributeIter // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + + _cret = C.g_menu_model_iterate_item_attributes(_arg0, _arg1) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + + var _menuAttributeIter MenuAttributeIterer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.MenuAttributeIterer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuAttributeIterer) + return ok + }) + rv, ok := casted.(MenuAttributeIterer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuAttributeIterer") + } + _menuAttributeIter = rv + } + + return _menuAttributeIter +} + +// IterateItemLinks creates a LinkIter to iterate over the links of the item at +// position item_index in model. +// +// You must free the iterator with g_object_unref() when you are done. +// +// The function takes the following parameters: +// +// - itemIndex: index of the item. +// +// The function returns the following values: +// +// - menuLinkIter: new LinkIter. +func (model *MenuModel) IterateItemLinks(itemIndex int) MenuLinkIterer { + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _cret *C.GMenuLinkIter // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + + _cret = C.g_menu_model_iterate_item_links(_arg0, _arg1) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + + var _menuLinkIter MenuLinkIterer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.MenuLinkIterer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuLinkIterer) + return ok + }) + rv, ok := casted.(MenuLinkIterer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuLinkIterer") + } + _menuLinkIter = rv + } + + return _menuLinkIter +} + +// itemAttributeValue queries the item at position item_index in model for the +// attribute specified by attribute. +// +// If expected_type is non-NULL then it specifies the expected type of the +// attribute. If it is NULL then any type will be accepted. +// +// If the attribute exists and matches expected_type (or if the expected type is +// unspecified) then the value is returned. +// +// If the attribute does not exist, or does not match the expected type then +// NULL is returned. +// +// The function takes the following parameters: +// +// - itemIndex: index of the item. +// - attribute to query. +// - expectedType (optional): expected type of the attribute, or NULL. +// +// The function returns the following values: +// +// - variant (optional): value of the attribute. +func (model *MenuModel) itemAttributeValue(itemIndex int, attribute string, expectedType *glib.VariantType) *glib.Variant { + gclass := (*C.GMenuModelClass)(coreglib.PeekParentClass(model)) + fnarg := gclass.get_item_attribute_value + + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _arg2 *C.gchar // out + var _arg3 *C.GVariantType // out + var _cret *C.GVariant // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg2)) + if expectedType != nil { + _arg3 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(expectedType))) + } + + _cret = C._gotk4_gio2_MenuModel_virtual_get_item_attribute_value(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + runtime.KeepAlive(attribute) + runtime.KeepAlive(expectedType) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// itemAttributes gets all the attributes associated with the item in the menu +// model. +// +// The function takes the following parameters: +// +// - itemIndex to query. +// +// The function returns the following values: +// +// - attributes attributes on the item. +func (model *MenuModel) itemAttributes(itemIndex int) map[string]*glib.Variant { + gclass := (*C.GMenuModelClass)(coreglib.PeekParentClass(model)) + fnarg := gclass.get_item_attributes + + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _arg2 *C.GHashTable // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + + C._gotk4_gio2_MenuModel_virtual_get_item_attributes(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + + var _attributes map[string]*glib.Variant // out + + _attributes = make(map[string]*glib.Variant, gextras.HashTableSize(unsafe.Pointer(_arg2))) + gextras.MoveHashTable(unsafe.Pointer(_arg2), true, func(k, v unsafe.Pointer) { + ksrc := *(**C.gchar)(k) + vsrc := *(**C.GVariant)(v) + var kdst string // out + var vdst *glib.Variant // out + kdst = C.GoString((*C.gchar)(unsafe.Pointer(ksrc))) + vdst = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(vsrc))) + C.g_variant_ref(vsrc) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(vdst)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + _attributes[kdst] = vdst + }) + + return _attributes +} + +// itemLink queries the item at position item_index in model for the link +// specified by link. +// +// If the link exists, the linked Model is returned. If the link does not exist, +// NULL is returned. +// +// The function takes the following parameters: +// +// - itemIndex: index of the item. +// - link to query. +// +// The function returns the following values: +// +// - menuModel (optional): linked Model, or NULL. +func (model *MenuModel) itemLink(itemIndex int, link string) MenuModeller { + gclass := (*C.GMenuModelClass)(coreglib.PeekParentClass(model)) + fnarg := gclass.get_item_link + + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _arg2 *C.gchar // out + var _cret *C.GMenuModel // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(link))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C._gotk4_gio2_MenuModel_virtual_get_item_link(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + runtime.KeepAlive(link) + + var _menuModel MenuModeller // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuModeller) + return ok + }) + rv, ok := casted.(MenuModeller) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuModeller") + } + _menuModel = rv + } + } + + return _menuModel +} + +// itemLinks gets all the links associated with the item in the menu model. +// +// The function takes the following parameters: +// +// - itemIndex to query. +// +// The function returns the following values: +// +// - links links from the item. +func (model *MenuModel) itemLinks(itemIndex int) map[string]MenuModeller { + gclass := (*C.GMenuModelClass)(coreglib.PeekParentClass(model)) + fnarg := gclass.get_item_links + + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _arg2 *C.GHashTable // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + + C._gotk4_gio2_MenuModel_virtual_get_item_links(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + + var _links map[string]MenuModeller // out + + _links = make(map[string]MenuModeller, gextras.HashTableSize(unsafe.Pointer(_arg2))) + gextras.MoveHashTable(unsafe.Pointer(_arg2), true, func(k, v unsafe.Pointer) { + ksrc := *(**C.gchar)(k) + vsrc := *(**C.GMenuModel)(v) + var kdst string // out + var vdst MenuModeller // out + kdst = C.GoString((*C.gchar)(unsafe.Pointer(ksrc))) + { + objptr := unsafe.Pointer(vsrc) + if objptr == nil { + panic("object of type gio.MenuModeller is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuModeller) + return ok + }) + rv, ok := casted.(MenuModeller) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuModeller") + } + vdst = rv + } + _links[kdst] = vdst + }) + + return _links +} + +// nItems: query the number of items in model. +// +// The function returns the following values: +// +// - gint: number of items. +func (model *MenuModel) nItems() int { + gclass := (*C.GMenuModelClass)(coreglib.PeekParentClass(model)) + fnarg := gclass.get_n_items + + var _arg0 *C.GMenuModel // out + var _cret C.gint // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + + _cret = C._gotk4_gio2_MenuModel_virtual_get_n_items(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(model) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// isMutable queries if model is mutable. +// +// An immutable Model will never emit the Model::items-changed signal. Consumers +// of the model may make optimisations accordingly. +// +// The function returns the following values: +// +// - ok: TRUE if the model is mutable (ie: "items-changed" may be emitted). +func (model *MenuModel) isMutable() bool { + gclass := (*C.GMenuModelClass)(coreglib.PeekParentClass(model)) + fnarg := gclass.is_mutable + + var _arg0 *C.GMenuModel // out + var _cret C.gboolean // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + + _cret = C._gotk4_gio2_MenuModel_virtual_is_mutable(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(model) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// iterateItemAttributes creates a AttributeIter to iterate over the attributes +// of the item at position item_index in model. +// +// You must free the iterator with g_object_unref() when you are done. +// +// The function takes the following parameters: +// +// - itemIndex: index of the item. +// +// The function returns the following values: +// +// - menuAttributeIter: new AttributeIter. +func (model *MenuModel) iterateItemAttributes(itemIndex int) MenuAttributeIterer { + gclass := (*C.GMenuModelClass)(coreglib.PeekParentClass(model)) + fnarg := gclass.iterate_item_attributes + + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _cret *C.GMenuAttributeIter // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + + _cret = C._gotk4_gio2_MenuModel_virtual_iterate_item_attributes(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + + var _menuAttributeIter MenuAttributeIterer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.MenuAttributeIterer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuAttributeIterer) + return ok + }) + rv, ok := casted.(MenuAttributeIterer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuAttributeIterer") + } + _menuAttributeIter = rv + } + + return _menuAttributeIter +} + +// iterateItemLinks creates a LinkIter to iterate over the links of the item at +// position item_index in model. +// +// You must free the iterator with g_object_unref() when you are done. +// +// The function takes the following parameters: +// +// - itemIndex: index of the item. +// +// The function returns the following values: +// +// - menuLinkIter: new LinkIter. +func (model *MenuModel) iterateItemLinks(itemIndex int) MenuLinkIterer { + gclass := (*C.GMenuModelClass)(coreglib.PeekParentClass(model)) + fnarg := gclass.iterate_item_links + + var _arg0 *C.GMenuModel // out + var _arg1 C.gint // out + var _cret *C.GMenuLinkIter // in + + _arg0 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.gint(itemIndex) + + _cret = C._gotk4_gio2_MenuModel_virtual_iterate_item_links(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(model) + runtime.KeepAlive(itemIndex) + + var _menuLinkIter MenuLinkIterer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.MenuLinkIterer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(MenuLinkIterer) + return ok + }) + rv, ok := casted.(MenuLinkIterer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuLinkIterer") + } + _menuLinkIter = rv + } + + return _menuLinkIter +} + +// MountOperationOverrides contains methods that are overridable. +type MountOperationOverrides struct { + Aborted func() + // The function takes the following parameters: + // + // - message + // - defaultUser + // - defaultDomain + // - flags + AskPassword func(message, defaultUser, defaultDomain string, flags AskPasswordFlags) + // AskQuestion: virtual implementation of Operation::ask-question. + // + // The function takes the following parameters: + // + // - message: string containing a message to display to the user. + // - choices: array of strings for each possible choice. + AskQuestion func(message string, choices []string) + // Reply emits the Operation::reply signal. + // + // The function takes the following parameters: + // + // - result: OperationResult. + Reply func(result MountOperationResult) + // The function takes the following parameters: + // + // - message + // - timeLeft + // - bytesLeft + ShowUnmountProgress func(message string, timeLeft, bytesLeft int64) +} + +func defaultMountOperationOverrides(v *MountOperation) MountOperationOverrides { + return MountOperationOverrides{ + Aborted: v.aborted, + AskPassword: v.askPassword, + AskQuestion: v.askQuestion, + Reply: v.reply, + ShowUnmountProgress: v.showUnmountProgress, + } +} + +// MountOperation: GMountOperation provides a mechanism for interacting +// with the user. It can be used for authenticating mountable operations, +// such as loop mounting files, hard drive partitions or server locations. +// It can also be used to ask the user questions or show a list of applications +// preventing unmount or eject operations from completing. +// +// Note that GMountOperation is used for more than just gio.Mount objects – for +// example it is also used in gio.Drive.Start() and gio.Drive.Stop(). +// +// Users should instantiate a subclass of this that implements all the +// various callbacks to show the required dialogs, such as GtkMountOperation +// (https://docs.gtk.org/gtk4/class.MountOperation.html). If no user interaction +// is desired (for example when automounting filesystems at login time), usually +// NULL can be passed, see each method taking a GMountOperation for details. +// +// Throughout the API, the term ‘TCRYPT’ is used to mean ‘compatible with +// TrueCrypt and VeraCrypt’. TrueCrypt (https://en.wikipedia.org/wiki/TrueCrypt) +// is a discontinued system for encrypting file containers, partitions or whole +// disks, typically used with Windows. VeraCrypt (https://www.veracrypt.fr/) is +// a maintained fork of TrueCrypt with various improvements and auditing fixes. +type MountOperation struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*MountOperation)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*MountOperation, *MountOperationClass, MountOperationOverrides]( + GTypeMountOperation, + initMountOperationClass, + wrapMountOperation, + defaultMountOperationOverrides, + ) +} + +func initMountOperationClass(gclass unsafe.Pointer, overrides MountOperationOverrides, classInitFunc func(*MountOperationClass)) { + pclass := (*C.GMountOperationClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeMountOperation)))) + + if overrides.Aborted != nil { + pclass.aborted = (*[0]byte)(C._gotk4_gio2_MountOperationClass_aborted) + } + + if overrides.AskPassword != nil { + pclass.ask_password = (*[0]byte)(C._gotk4_gio2_MountOperationClass_ask_password) + } + + if overrides.AskQuestion != nil { + pclass.ask_question = (*[0]byte)(C._gotk4_gio2_MountOperationClass_ask_question) + } + + if overrides.Reply != nil { + pclass.reply = (*[0]byte)(C._gotk4_gio2_MountOperationClass_reply) + } + + if overrides.ShowUnmountProgress != nil { + pclass.show_unmount_progress = (*[0]byte)(C._gotk4_gio2_MountOperationClass_show_unmount_progress) + } + + if classInitFunc != nil { + class := (*MountOperationClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapMountOperation(obj *coreglib.Object) *MountOperation { + return &MountOperation{ + Object: obj, + } +} + +func marshalMountOperation(p uintptr) (interface{}, error) { + return wrapMountOperation(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectAborted is emitted by the backend when e.g. a device becomes +// unavailable while a mount operation is in progress. +// +// Implementations of GMountOperation should handle this signal by dismissing +// open password dialogs. +func (op *MountOperation) ConnectAborted(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(op, "aborted", false, unsafe.Pointer(C._gotk4_gio2_MountOperation_ConnectAborted), f) +} + +// ConnectAskPassword is emitted when a mount operation asks the user for a +// password. +// +// If the message contains a line break, the first line should be presented as a +// heading. For example, it may be used as the primary text in a MessageDialog. +func (op *MountOperation) ConnectAskPassword(f func(message, defaultUser, defaultDomain string, flags AskPasswordFlags)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(op, "ask-password", false, unsafe.Pointer(C._gotk4_gio2_MountOperation_ConnectAskPassword), f) +} + +// ConnectAskQuestion is emitted when asking the user a question and gives a +// list of choices for the user to choose from. +// +// If the message contains a line break, the first line should be presented as a +// heading. For example, it may be used as the primary text in a MessageDialog. +func (op *MountOperation) ConnectAskQuestion(f func(message string, choices []string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(op, "ask-question", false, unsafe.Pointer(C._gotk4_gio2_MountOperation_ConnectAskQuestion), f) +} + +// ConnectReply is emitted when the user has replied to the mount operation. +func (op *MountOperation) ConnectReply(f func(result MountOperationResult)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(op, "reply", false, unsafe.Pointer(C._gotk4_gio2_MountOperation_ConnectReply), f) +} + +// ConnectShowUnmountProgress is emitted when an unmount operation has been busy +// for more than some time (typically 1.5 seconds). +// +// When unmounting or ejecting a volume, the kernel might need to flush pending +// data in its buffers to the volume stable storage, and this operation can take +// a considerable amount of time. This signal may be emitted several times as +// long as the unmount operation is outstanding, and then one last time when the +// operation is completed, with bytes_left set to zero. +// +// Implementations of GMountOperation should handle this signal by showing +// an UI notification, and then dismiss it, or show another notification of +// completion, when bytes_left reaches zero. +// +// If the message contains a line break, the first line should be presented as a +// heading. For example, it may be used as the primary text in a MessageDialog. +func (op *MountOperation) ConnectShowUnmountProgress(f func(message string, timeLeft, bytesLeft int64)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(op, "show-unmount-progress", false, unsafe.Pointer(C._gotk4_gio2_MountOperation_ConnectShowUnmountProgress), f) +} + +// NewMountOperation creates a new mount operation. +// +// The function returns the following values: +// +// - mountOperation: Operation. +func NewMountOperation() *MountOperation { + var _cret *C.GMountOperation // in + + _cret = C.g_mount_operation_new() + + var _mountOperation *MountOperation // out + + _mountOperation = wrapMountOperation(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _mountOperation +} + +// Anonymous: check to see whether the mount operation is being used for an +// anonymous user. +// +// The function returns the following values: +// +// - ok: TRUE if mount operation is anonymous. +func (op *MountOperation) Anonymous() bool { + var _arg0 *C.GMountOperation // out + var _cret C.gboolean // in + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + _cret = C.g_mount_operation_get_anonymous(_arg0) + runtime.KeepAlive(op) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Choice gets a choice from the mount operation. +// +// The function returns the following values: +// +// - gint: integer containing an index of the user's choice from the choice's +// list, or 0. +func (op *MountOperation) Choice() int { + var _arg0 *C.GMountOperation // out + var _cret C.int // in + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + _cret = C.g_mount_operation_get_choice(_arg0) + runtime.KeepAlive(op) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Domain gets the domain of the mount operation. +// +// The function returns the following values: +// +// - utf8 (optional): string set to the domain. +func (op *MountOperation) Domain() string { + var _arg0 *C.GMountOperation // out + var _cret *C.char // in + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + _cret = C.g_mount_operation_get_domain(_arg0) + runtime.KeepAlive(op) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// IsTcryptHiddenVolume: check to see whether the mount operation is being used +// for a TCRYPT hidden volume. +// +// The function returns the following values: +// +// - ok: TRUE if mount operation is for hidden volume. +func (op *MountOperation) IsTcryptHiddenVolume() bool { + var _arg0 *C.GMountOperation // out + var _cret C.gboolean // in + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + _cret = C.g_mount_operation_get_is_tcrypt_hidden_volume(_arg0) + runtime.KeepAlive(op) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsTcryptSystemVolume: check to see whether the mount operation is being used +// for a TCRYPT system volume. +// +// The function returns the following values: +// +// - ok: TRUE if mount operation is for system volume. +func (op *MountOperation) IsTcryptSystemVolume() bool { + var _arg0 *C.GMountOperation // out + var _cret C.gboolean // in + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + _cret = C.g_mount_operation_get_is_tcrypt_system_volume(_arg0) + runtime.KeepAlive(op) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Password gets a password from the mount operation. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the password within op. +func (op *MountOperation) Password() string { + var _arg0 *C.GMountOperation // out + var _cret *C.char // in + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + _cret = C.g_mount_operation_get_password(_arg0) + runtime.KeepAlive(op) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// PasswordSave gets the state of saving passwords for the mount operation. +// +// The function returns the following values: +// +// - passwordSave: Save flag. +func (op *MountOperation) PasswordSave() PasswordSave { + var _arg0 *C.GMountOperation // out + var _cret C.GPasswordSave // in + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + _cret = C.g_mount_operation_get_password_save(_arg0) + runtime.KeepAlive(op) + + var _passwordSave PasswordSave // out + + _passwordSave = PasswordSave(_cret) + + return _passwordSave +} + +// Pim gets a PIM from the mount operation. +// +// The function returns the following values: +// +// - guint: veraCrypt PIM within op. +func (op *MountOperation) Pim() uint { + var _arg0 *C.GMountOperation // out + var _cret C.guint // in + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + _cret = C.g_mount_operation_get_pim(_arg0) + runtime.KeepAlive(op) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Username: get the user name from the mount operation. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the user name. +func (op *MountOperation) Username() string { + var _arg0 *C.GMountOperation // out + var _cret *C.char // in + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + _cret = C.g_mount_operation_get_username(_arg0) + runtime.KeepAlive(op) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Reply emits the Operation::reply signal. +// +// The function takes the following parameters: +// +// - result: OperationResult. +func (op *MountOperation) Reply(result MountOperationResult) { + var _arg0 *C.GMountOperation // out + var _arg1 C.GMountOperationResult // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + _arg1 = C.GMountOperationResult(result) + + C.g_mount_operation_reply(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(result) +} + +// SetAnonymous sets the mount operation to use an anonymous user if anonymous +// is TRUE. +// +// The function takes the following parameters: +// +// - anonymous: boolean value. +func (op *MountOperation) SetAnonymous(anonymous bool) { + var _arg0 *C.GMountOperation // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + if anonymous { + _arg1 = C.TRUE + } + + C.g_mount_operation_set_anonymous(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(anonymous) +} + +// SetChoice sets a default choice for the mount operation. +// +// The function takes the following parameters: +// +// - choice: integer. +func (op *MountOperation) SetChoice(choice int) { + var _arg0 *C.GMountOperation // out + var _arg1 C.int // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + _arg1 = C.int(choice) + + C.g_mount_operation_set_choice(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(choice) +} + +// SetDomain sets the mount operation's domain. +// +// The function takes the following parameters: +// +// - domain (optional) to set. +func (op *MountOperation) SetDomain(domain string) { + var _arg0 *C.GMountOperation // out + var _arg1 *C.char // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + if domain != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_mount_operation_set_domain(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(domain) +} + +// SetIsTcryptHiddenVolume sets the mount operation to use a hidden volume if +// hidden_volume is TRUE. +// +// The function takes the following parameters: +// +// - hiddenVolume: boolean value. +func (op *MountOperation) SetIsTcryptHiddenVolume(hiddenVolume bool) { + var _arg0 *C.GMountOperation // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + if hiddenVolume { + _arg1 = C.TRUE + } + + C.g_mount_operation_set_is_tcrypt_hidden_volume(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(hiddenVolume) +} + +// SetIsTcryptSystemVolume sets the mount operation to use a system volume if +// system_volume is TRUE. +// +// The function takes the following parameters: +// +// - systemVolume: boolean value. +func (op *MountOperation) SetIsTcryptSystemVolume(systemVolume bool) { + var _arg0 *C.GMountOperation // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + if systemVolume { + _arg1 = C.TRUE + } + + C.g_mount_operation_set_is_tcrypt_system_volume(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(systemVolume) +} + +// SetPassword sets the mount operation's password to password. +// +// The function takes the following parameters: +// +// - password (optional) to set. +func (op *MountOperation) SetPassword(password string) { + var _arg0 *C.GMountOperation // out + var _arg1 *C.char // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + if password != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(password))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_mount_operation_set_password(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(password) +} + +// SetPasswordSave sets the state of saving passwords for the mount operation. +// +// The function takes the following parameters: +// +// - save: set of Save flags. +func (op *MountOperation) SetPasswordSave(save PasswordSave) { + var _arg0 *C.GMountOperation // out + var _arg1 C.GPasswordSave // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + _arg1 = C.GPasswordSave(save) + + C.g_mount_operation_set_password_save(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(save) +} + +// SetPim sets the mount operation's PIM to pim. +// +// The function takes the following parameters: +// +// - pim: unsigned integer. +func (op *MountOperation) SetPim(pim uint) { + var _arg0 *C.GMountOperation // out + var _arg1 C.guint // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + _arg1 = C.guint(pim) + + C.g_mount_operation_set_pim(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(pim) +} + +// SetUsername sets the user name within op to username. +// +// The function takes the following parameters: +// +// - username (optional): input username. +func (op *MountOperation) SetUsername(username string) { + var _arg0 *C.GMountOperation // out + var _arg1 *C.char // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + if username != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(username))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_mount_operation_set_username(_arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(username) +} + +func (op *MountOperation) aborted() { + gclass := (*C.GMountOperationClass)(coreglib.PeekParentClass(op)) + fnarg := gclass.aborted + + var _arg0 *C.GMountOperation // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + + C._gotk4_gio2_MountOperation_virtual_aborted(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(op) +} + +// The function takes the following parameters: +// +// - message +// - defaultUser +// - defaultDomain +// - flags +func (op *MountOperation) askPassword(message, defaultUser, defaultDomain string, flags AskPasswordFlags) { + gclass := (*C.GMountOperationClass)(coreglib.PeekParentClass(op)) + fnarg := gclass.ask_password + + var _arg0 *C.GMountOperation // out + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 *C.char // out + var _arg4 C.GAskPasswordFlags // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(defaultUser))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.char)(unsafe.Pointer(C.CString(defaultDomain))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = C.GAskPasswordFlags(flags) + + C._gotk4_gio2_MountOperation_virtual_ask_password(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(op) + runtime.KeepAlive(message) + runtime.KeepAlive(defaultUser) + runtime.KeepAlive(defaultDomain) + runtime.KeepAlive(flags) +} + +// askQuestion: virtual implementation of Operation::ask-question. +// +// The function takes the following parameters: +// +// - message: string containing a message to display to the user. +// - choices: array of strings for each possible choice. +func (op *MountOperation) askQuestion(message string, choices []string) { + gclass := (*C.GMountOperationClass)(coreglib.PeekParentClass(op)) + fnarg := gclass.ask_question + + var _arg0 *C.GMountOperation // out + var _arg1 *C.char // out + var _arg2 **C.char // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg1)) + { + _arg2 = (**C.char)(C.calloc(C.size_t((len(choices) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice(_arg2, len(choices)+1) + var zero *C.char + out[len(choices)] = zero + for i := range choices { + out[i] = (*C.char)(unsafe.Pointer(C.CString(choices[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C._gotk4_gio2_MountOperation_virtual_ask_question(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(op) + runtime.KeepAlive(message) + runtime.KeepAlive(choices) +} + +// Reply emits the Operation::reply signal. +// +// The function takes the following parameters: +// +// - result: OperationResult. +func (op *MountOperation) reply(result MountOperationResult) { + gclass := (*C.GMountOperationClass)(coreglib.PeekParentClass(op)) + fnarg := gclass.reply + + var _arg0 *C.GMountOperation // out + var _arg1 C.GMountOperationResult // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + _arg1 = C.GMountOperationResult(result) + + C._gotk4_gio2_MountOperation_virtual_reply(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(op) + runtime.KeepAlive(result) +} + +// The function takes the following parameters: +// +// - message +// - timeLeft +// - bytesLeft +func (op *MountOperation) showUnmountProgress(message string, timeLeft, bytesLeft int64) { + gclass := (*C.GMountOperationClass)(coreglib.PeekParentClass(op)) + fnarg := gclass.show_unmount_progress + + var _arg0 *C.GMountOperation // out + var _arg1 *C.gchar // out + var _arg2 C.gint64 // out + var _arg3 C.gint64 // out + + _arg0 = (*C.GMountOperation)(unsafe.Pointer(coreglib.InternObject(op).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint64(timeLeft) + _arg3 = C.gint64(bytesLeft) + + C._gotk4_gio2_MountOperation_virtual_show_unmount_progress(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(op) + runtime.KeepAlive(message) + runtime.KeepAlive(timeLeft) + runtime.KeepAlive(bytesLeft) +} + +// NativeSocketAddressOverrides contains methods that are overridable. +type NativeSocketAddressOverrides struct { +} + +func defaultNativeSocketAddressOverrides(v *NativeSocketAddress) NativeSocketAddressOverrides { + return NativeSocketAddressOverrides{} +} + +// NativeSocketAddress: socket address of some unknown native type. +// +// This corresponds to a general struct sockaddr of a type not otherwise handled +// by GLib. +type NativeSocketAddress struct { + _ [0]func() // equal guard + SocketAddress +} + +var ( + _ SocketAddresser = (*NativeSocketAddress)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*NativeSocketAddress, *NativeSocketAddressClass, NativeSocketAddressOverrides]( + GTypeNativeSocketAddress, + initNativeSocketAddressClass, + wrapNativeSocketAddress, + defaultNativeSocketAddressOverrides, + ) +} + +func initNativeSocketAddressClass(gclass unsafe.Pointer, overrides NativeSocketAddressOverrides, classInitFunc func(*NativeSocketAddressClass)) { + if classInitFunc != nil { + class := (*NativeSocketAddressClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapNativeSocketAddress(obj *coreglib.Object) *NativeSocketAddress { + return &NativeSocketAddress{ + SocketAddress: SocketAddress{ + Object: obj, + SocketConnectable: SocketConnectable{ + Object: obj, + }, + }, + } +} + +func marshalNativeSocketAddress(p uintptr) (interface{}, error) { + return wrapNativeSocketAddress(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewNativeSocketAddress creates a new SocketAddress for native and len. +// +// The function takes the following parameters: +// +// - native (optional) address object. +// - len: length of native, in bytes. +// +// The function returns the following values: +// +// - nativeSocketAddress: new SocketAddress. +func NewNativeSocketAddress(native unsafe.Pointer, len uint) *NativeSocketAddress { + var _arg1 C.gpointer // out + var _arg2 C.gsize // out + var _cret *C.GSocketAddress // in + + _arg1 = (C.gpointer)(unsafe.Pointer(native)) + _arg2 = C.gsize(len) + + _cret = C.g_native_socket_address_new(_arg1, _arg2) + runtime.KeepAlive(native) + runtime.KeepAlive(len) + + var _nativeSocketAddress *NativeSocketAddress // out + + _nativeSocketAddress = wrapNativeSocketAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _nativeSocketAddress +} + +// NativeVolumeMonitorOverrides contains methods that are overridable. +type NativeVolumeMonitorOverrides struct { +} + +func defaultNativeVolumeMonitorOverrides(v *NativeVolumeMonitor) NativeVolumeMonitorOverrides { + return NativeVolumeMonitorOverrides{} +} + +type NativeVolumeMonitor struct { + _ [0]func() // equal guard + VolumeMonitor +} + +var ( + _ coreglib.Objector = (*NativeVolumeMonitor)(nil) +) + +// NativeVolumeMonitorrer describes types inherited from class NativeVolumeMonitor. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type NativeVolumeMonitorrer interface { + coreglib.Objector + baseNativeVolumeMonitor() *NativeVolumeMonitor +} + +var _ NativeVolumeMonitorrer = (*NativeVolumeMonitor)(nil) + +func init() { + coreglib.RegisterClassInfo[*NativeVolumeMonitor, *NativeVolumeMonitorClass, NativeVolumeMonitorOverrides]( + GTypeNativeVolumeMonitor, + initNativeVolumeMonitorClass, + wrapNativeVolumeMonitor, + defaultNativeVolumeMonitorOverrides, + ) +} + +func initNativeVolumeMonitorClass(gclass unsafe.Pointer, overrides NativeVolumeMonitorOverrides, classInitFunc func(*NativeVolumeMonitorClass)) { + if classInitFunc != nil { + class := (*NativeVolumeMonitorClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapNativeVolumeMonitor(obj *coreglib.Object) *NativeVolumeMonitor { + return &NativeVolumeMonitor{ + VolumeMonitor: VolumeMonitor{ + Object: obj, + }, + } +} + +func marshalNativeVolumeMonitor(p uintptr) (interface{}, error) { + return wrapNativeVolumeMonitor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *NativeVolumeMonitor) baseNativeVolumeMonitor() *NativeVolumeMonitor { + return v +} + +// BaseNativeVolumeMonitor returns the underlying base object. +func BaseNativeVolumeMonitor(obj NativeVolumeMonitorrer) *NativeVolumeMonitor { + return obj.baseNativeVolumeMonitor() +} + +// NetworkAddressOverrides contains methods that are overridable. +type NetworkAddressOverrides struct { +} + +func defaultNetworkAddressOverrides(v *NetworkAddress) NetworkAddressOverrides { + return NetworkAddressOverrides{} +} + +// NetworkAddress: GNetworkAddress provides an easy way to resolve a hostname +// and then attempt to connect to that host, handling the possibility of +// multiple IP addresses and multiple address families. +// +// The enumeration results of resolved addresses *may* be cached as long as this +// object is kept alive which may have unexpected results if alive for too long. +// +// See gio.SocketConnectable for an example of using the connectable interface. +type NetworkAddress struct { + _ [0]func() // equal guard + *coreglib.Object + + SocketConnectable +} + +var ( + _ coreglib.Objector = (*NetworkAddress)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*NetworkAddress, *NetworkAddressClass, NetworkAddressOverrides]( + GTypeNetworkAddress, + initNetworkAddressClass, + wrapNetworkAddress, + defaultNetworkAddressOverrides, + ) +} + +func initNetworkAddressClass(gclass unsafe.Pointer, overrides NetworkAddressOverrides, classInitFunc func(*NetworkAddressClass)) { + if classInitFunc != nil { + class := (*NetworkAddressClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapNetworkAddress(obj *coreglib.Object) *NetworkAddress { + return &NetworkAddress{ + Object: obj, + SocketConnectable: SocketConnectable{ + Object: obj, + }, + } +} + +func marshalNetworkAddress(p uintptr) (interface{}, error) { + return wrapNetworkAddress(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewNetworkAddress creates a new Connectable for connecting to the given +// hostname and port. +// +// Note that depending on the configuration of the machine, a hostname of +// localhost may refer to the IPv4 loopback address only, or to both IPv4 +// and IPv6; use g_network_address_new_loopback() to create a Address that is +// guaranteed to resolve to both addresses. +// +// The function takes the following parameters: +// +// - hostname: hostname. +// - port: port. +// +// The function returns the following values: +// +// - networkAddress: new Address. +func NewNetworkAddress(hostname string, port uint16) *NetworkAddress { + var _arg1 *C.gchar // out + var _arg2 C.guint16 // out + var _cret *C.GSocketConnectable // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint16(port) + + _cret = C.g_network_address_new(_arg1, _arg2) + runtime.KeepAlive(hostname) + runtime.KeepAlive(port) + + var _networkAddress *NetworkAddress // out + + _networkAddress = wrapNetworkAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _networkAddress +} + +// NewNetworkAddressLoopback creates a new Connectable for connecting to the +// local host over a loopback connection to the given port. This is intended for +// use in connecting to local services which may be running on IPv4 or IPv6. +// +// The connectable will return IPv4 and IPv6 loopback addresses, regardless of +// how the host resolves localhost. By contrast, g_network_address_new() will +// often only return an IPv4 address when resolving localhost, and an IPv6 +// address for localhost6. +// +// g_network_address_get_hostname() will always return localhost for a Address +// created with this constructor. +// +// The function takes the following parameters: +// +// - port: port. +// +// The function returns the following values: +// +// - networkAddress: new Address. +func NewNetworkAddressLoopback(port uint16) *NetworkAddress { + var _arg1 C.guint16 // out + var _cret *C.GSocketConnectable // in + + _arg1 = C.guint16(port) + + _cret = C.g_network_address_new_loopback(_arg1) + runtime.KeepAlive(port) + + var _networkAddress *NetworkAddress // out + + _networkAddress = wrapNetworkAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _networkAddress +} + +// Hostname gets addr's hostname. This might be either UTF-8 or ASCII-encoded, +// depending on what addr was created with. +// +// The function returns the following values: +// +// - utf8 addr's hostname. +func (addr *NetworkAddress) Hostname() string { + var _arg0 *C.GNetworkAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GNetworkAddress)(unsafe.Pointer(coreglib.InternObject(addr).Native())) + + _cret = C.g_network_address_get_hostname(_arg0) + runtime.KeepAlive(addr) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Port gets addr's port number. +// +// The function returns the following values: +// +// - guint16 addr's port (which may be 0). +func (addr *NetworkAddress) Port() uint16 { + var _arg0 *C.GNetworkAddress // out + var _cret C.guint16 // in + + _arg0 = (*C.GNetworkAddress)(unsafe.Pointer(coreglib.InternObject(addr).Native())) + + _cret = C.g_network_address_get_port(_arg0) + runtime.KeepAlive(addr) + + var _guint16 uint16 // out + + _guint16 = uint16(_cret) + + return _guint16 +} + +// Scheme gets addr's scheme. +// +// The function returns the following values: +// +// - utf8 (optional) addr's scheme (NULL if not built from URI). +func (addr *NetworkAddress) Scheme() string { + var _arg0 *C.GNetworkAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GNetworkAddress)(unsafe.Pointer(coreglib.InternObject(addr).Native())) + + _cret = C.g_network_address_get_scheme(_arg0) + runtime.KeepAlive(addr) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// NetworkAddressParse creates a new Connectable for connecting to the given +// hostname and port. May fail and return NULL in case parsing host_and_port +// fails. +// +// host_and_port may be in any of a number of recognised formats; an IPv6 +// address, an IPv4 address, or a domain name (in which case a DNS lookup +// is performed). Quoting with [] is supported for all address types. A port +// override may be specified in the usual way with a colon. +// +// If no port is specified in host_and_port then default_port will be used as +// the port number to connect to. +// +// In general, host_and_port is expected to be provided by the user (allowing +// them to give the hostname, and a port override if necessary) and default_port +// is expected to be provided by the application. +// +// (The port component of host_and_port can also be specified as a service +// name rather than as a numeric port, but this functionality is deprecated, +// because it depends on the contents of /etc/services, which is generally quite +// sparse on platforms other than Linux.). +// +// The function takes the following parameters: +// +// - hostAndPort: hostname and optionally a port. +// - defaultPort: default port if not in host_and_port. +// +// The function returns the following values: +// +// - networkAddress: new Address, or NULL on error. +func NetworkAddressParse(hostAndPort string, defaultPort uint16) (*NetworkAddress, error) { + var _arg1 *C.gchar // out + var _arg2 C.guint16 // out + var _cret *C.GSocketConnectable // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostAndPort))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint16(defaultPort) + + _cret = C.g_network_address_parse(_arg1, _arg2, &_cerr) + runtime.KeepAlive(hostAndPort) + runtime.KeepAlive(defaultPort) + + var _networkAddress *NetworkAddress // out + var _goerr error // out + + _networkAddress = wrapNetworkAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _networkAddress, _goerr +} + +// NetworkAddressParseURI creates a new Connectable for connecting to the given +// uri. May fail and return NULL in case parsing uri fails. +// +// Using this rather than g_network_address_new() or g_network_address_parse() +// allows Client to determine when to use application-specific proxy protocols. +// +// The function takes the following parameters: +// +// - uri: hostname and optionally a port. +// - defaultPort: default port if none is found in the URI. +// +// The function returns the following values: +// +// - networkAddress: new Address, or NULL on error. +func NetworkAddressParseURI(uri string, defaultPort uint16) (*NetworkAddress, error) { + var _arg1 *C.gchar // out + var _arg2 C.guint16 // out + var _cret *C.GSocketConnectable // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint16(defaultPort) + + _cret = C.g_network_address_parse_uri(_arg1, _arg2, &_cerr) + runtime.KeepAlive(uri) + runtime.KeepAlive(defaultPort) + + var _networkAddress *NetworkAddress // out + var _goerr error // out + + _networkAddress = wrapNetworkAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _networkAddress, _goerr +} + +// NetworkServiceOverrides contains methods that are overridable. +type NetworkServiceOverrides struct { +} + +func defaultNetworkServiceOverrides(v *NetworkService) NetworkServiceOverrides { + return NetworkServiceOverrides{} +} + +// NetworkService: like gio.NetworkAddress does with hostnames, GNetworkService +// provides an easy way to resolve a SRV record, and then attempt to connect +// to one of the hosts that implements that service, handling service +// priority/weighting, multiple IP addresses, and multiple address families. +// +// See gio.SrvTarget for more information about SRV records, and see +// gio.SocketConnectable for an example of using the connectable interface. +type NetworkService struct { + _ [0]func() // equal guard + *coreglib.Object + + SocketConnectable +} + +var ( + _ coreglib.Objector = (*NetworkService)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*NetworkService, *NetworkServiceClass, NetworkServiceOverrides]( + GTypeNetworkService, + initNetworkServiceClass, + wrapNetworkService, + defaultNetworkServiceOverrides, + ) +} + +func initNetworkServiceClass(gclass unsafe.Pointer, overrides NetworkServiceOverrides, classInitFunc func(*NetworkServiceClass)) { + if classInitFunc != nil { + class := (*NetworkServiceClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapNetworkService(obj *coreglib.Object) *NetworkService { + return &NetworkService{ + Object: obj, + SocketConnectable: SocketConnectable{ + Object: obj, + }, + } +} + +func marshalNetworkService(p uintptr) (interface{}, error) { + return wrapNetworkService(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewNetworkService creates a new Service representing the given service, +// protocol, and domain. This will initially be unresolved; use the Connectable +// interface to resolve it. +// +// The function takes the following parameters: +// +// - service type to look up (eg, "ldap"). +// - protocol: networking protocol to use for service (eg, "tcp"). +// - domain: DNS domain to look up the service in. +// +// The function returns the following values: +// +// - networkService: new Service. +func NewNetworkService(service, protocol, domain string) *NetworkService { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret *C.GSocketConnectable // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(service))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(protocol))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.g_network_service_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(service) + runtime.KeepAlive(protocol) + runtime.KeepAlive(domain) + + var _networkService *NetworkService // out + + _networkService = wrapNetworkService(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _networkService +} + +// Domain gets the domain that srv serves. This might be either UTF-8 or +// ASCII-encoded, depending on what srv was created with. +// +// The function returns the following values: +// +// - utf8 srv's domain name. +func (srv *NetworkService) Domain() string { + var _arg0 *C.GNetworkService // out + var _cret *C.gchar // in + + _arg0 = (*C.GNetworkService)(unsafe.Pointer(coreglib.InternObject(srv).Native())) + + _cret = C.g_network_service_get_domain(_arg0) + runtime.KeepAlive(srv) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Protocol gets srv's protocol name (eg, "tcp"). +// +// The function returns the following values: +// +// - utf8 srv's protocol name. +func (srv *NetworkService) Protocol() string { + var _arg0 *C.GNetworkService // out + var _cret *C.gchar // in + + _arg0 = (*C.GNetworkService)(unsafe.Pointer(coreglib.InternObject(srv).Native())) + + _cret = C.g_network_service_get_protocol(_arg0) + runtime.KeepAlive(srv) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Scheme gets the URI scheme used to resolve proxies. By default, the service +// name is used as scheme. +// +// The function returns the following values: +// +// - utf8 srv's scheme name. +func (srv *NetworkService) Scheme() string { + var _arg0 *C.GNetworkService // out + var _cret *C.gchar // in + + _arg0 = (*C.GNetworkService)(unsafe.Pointer(coreglib.InternObject(srv).Native())) + + _cret = C.g_network_service_get_scheme(_arg0) + runtime.KeepAlive(srv) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Service gets srv's service name (eg, "ldap"). +// +// The function returns the following values: +// +// - utf8 srv's service name. +func (srv *NetworkService) Service() string { + var _arg0 *C.GNetworkService // out + var _cret *C.gchar // in + + _arg0 = (*C.GNetworkService)(unsafe.Pointer(coreglib.InternObject(srv).Native())) + + _cret = C.g_network_service_get_service(_arg0) + runtime.KeepAlive(srv) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// SetScheme set's the URI scheme used to resolve proxies. By default, the +// service name is used as scheme. +// +// The function takes the following parameters: +// +// - scheme: URI scheme. +func (srv *NetworkService) SetScheme(scheme string) { + var _arg0 *C.GNetworkService // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GNetworkService)(unsafe.Pointer(coreglib.InternObject(srv).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(scheme))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_network_service_set_scheme(_arg0, _arg1) + runtime.KeepAlive(srv) + runtime.KeepAlive(scheme) +} + +// Notification: GNotification is a mechanism for creating a notification to +// be shown to the user — typically as a pop-up notification presented by the +// desktop environment shell. +// +// The key difference between GNotification and other similar APIs is that, if +// supported by the desktop environment, notifications sent with GNotification +// will persist after the application has exited, and even across system +// reboots. +// +// Since the user may click on a notification while the application is not +// running, applications using GNotification should be able to be started as a +// D-Bus service, using gio.Application. +// +// In order for GNotification to work, the application must have installed a +// .desktop file. For example: +// +// [Desktop Entry] +// Name=Test Application +// Comment=Description of what Test Application does +// Exec=gnome-test-application +// Icon=org.gnome.TestApplication +// Terminal=false +// Type=Application +// Categories=GNOME;GTK;TestApplication Category; +// StartupNotify=true +// DBusActivatable=true +// X-GNOME-UsesNotifications=true +// +// The X-GNOME-UsesNotifications key indicates to GNOME Control Center that this +// application uses notifications, so it can be listed in the Control Center’s +// ‘Notifications’ panel. +// +// The .desktop file must be named as org.gnome.TestApplication.desktop, +// where org.gnome.TestApplication is the ID passed to gio.Application.New. +// +// User interaction with a notification (either the default action, or buttons) +// must be associated with actions on the application (ie: app. actions). +// It is not possible to route user interaction through the notification itself, +// because the object will not exist if the application is autostarted as a +// result of a notification being clicked. +// +// A notification can be sent with gio.Application.SendNotification(). +type Notification struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Notification)(nil) +) + +func wrapNotification(obj *coreglib.Object) *Notification { + return &Notification{ + Object: obj, + } +} + +func marshalNotification(p uintptr) (interface{}, error) { + return wrapNotification(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewNotification creates a new #GNotification with title as its title. +// +// After populating notification with more details, it can be sent to the +// desktop shell with g_application_send_notification(). Changing any properties +// after this call will not have any effect until resending notification. +// +// The function takes the following parameters: +// +// - title of the notification. +// +// The function returns the following values: +// +// - notification: new #GNotification instance. +func NewNotification(title string) *Notification { + var _arg1 *C.gchar // out + var _cret *C.GNotification // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(title))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_notification_new(_arg1) + runtime.KeepAlive(title) + + var _notification *Notification // out + + _notification = wrapNotification(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _notification +} + +// AddButton adds a button to notification that activates the action in +// detailed_action when clicked. That action must be an application-wide action +// (starting with "app."). If detailed_action contains a target, the action will +// be activated with that target as its parameter. +// +// See g_action_parse_detailed_name() for a description of the format for +// detailed_action. +// +// The function takes the following parameters: +// +// - label of the button. +// - detailedAction: detailed action name. +func (notification *Notification) AddButton(label, detailedAction string) { + var _arg0 *C.GNotification // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(detailedAction))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_notification_add_button(_arg0, _arg1, _arg2) + runtime.KeepAlive(notification) + runtime.KeepAlive(label) + runtime.KeepAlive(detailedAction) +} + +// AddButtonWithTarget adds a button to notification that activates action +// when clicked. action must be an application-wide action (it must start with +// "app."). +// +// If target is non-NULL, action will be activated with target as its parameter. +// +// The function takes the following parameters: +// +// - label of the button. +// - action name. +// - target (optional) to use as action's parameter, or NULL. +func (notification *Notification) AddButtonWithTarget(label, action string, target *glib.Variant) { + var _arg0 *C.GNotification // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.GVariant // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(action))) + defer C.free(unsafe.Pointer(_arg2)) + if target != nil { + _arg3 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(target))) + } + + C.g_notification_add_button_with_target_value(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(notification) + runtime.KeepAlive(label) + runtime.KeepAlive(action) + runtime.KeepAlive(target) +} + +// SetBody sets the body of notification to body. +// +// The function takes the following parameters: +// +// - body (optional): new body for notification, or NULL. +func (notification *Notification) SetBody(body string) { + var _arg0 *C.GNotification // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + if body != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(body))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_notification_set_body(_arg0, _arg1) + runtime.KeepAlive(notification) + runtime.KeepAlive(body) +} + +// SetCategory sets the type of notification to category. Categories have a main +// type like email, im or device and can have a detail separated by a ., e.g. +// im.received or email.arrived. Setting the category helps the notification +// server to select proper feedback to the user. +// +// Standard categories are listed in the specification +// (https://specifications.freedesktop.org/notification-spec/latest/ar01s06.html). +// +// The function takes the following parameters: +// +// - category (optional) for notification, or NULL for no category. +func (notification *Notification) SetCategory(category string) { + var _arg0 *C.GNotification // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + if category != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(category))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_notification_set_category(_arg0, _arg1) + runtime.KeepAlive(notification) + runtime.KeepAlive(category) +} + +// SetDefaultAction sets the default action of notification to detailed_action. +// This action is activated when the notification is clicked on. +// +// The action in detailed_action must be an application-wide action +// (it must start with "app."). If detailed_action contains a target, +// the given action will be activated with that target as its parameter. +// See g_action_parse_detailed_name() for a description of the format for +// detailed_action. +// +// When no default action is set, the application that the notification was sent +// on is activated. +// +// The function takes the following parameters: +// +// - detailedAction: detailed action name. +func (notification *Notification) SetDefaultAction(detailedAction string) { + var _arg0 *C.GNotification // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(detailedAction))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_notification_set_default_action(_arg0, _arg1) + runtime.KeepAlive(notification) + runtime.KeepAlive(detailedAction) +} + +// SetDefaultActionAndTarget sets the default action of notification to action. +// This action is activated when the notification is clicked on. It must be an +// application-wide action (start with "app."). +// +// If target is non-NULL, action will be activated with target as its parameter. +// If target is floating, it will be consumed. +// +// When no default action is set, the application that the notification was sent +// on is activated. +// +// The function takes the following parameters: +// +// - action name. +// - target (optional) to use as action's parameter, or NULL. +func (notification *Notification) SetDefaultActionAndTarget(action string, target *glib.Variant) { + var _arg0 *C.GNotification // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(action))) + defer C.free(unsafe.Pointer(_arg1)) + if target != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(target))) + } + + C.g_notification_set_default_action_and_target_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(notification) + runtime.KeepAlive(action) + runtime.KeepAlive(target) +} + +// SetIcon sets the icon of notification to icon. +// +// The function takes the following parameters: +// +// - icon to be shown in notification, as a #GIcon. +func (notification *Notification) SetIcon(icon Iconner) { + var _arg0 *C.GNotification // out + var _arg1 *C.GIcon // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + _arg1 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + C.g_notification_set_icon(_arg0, _arg1) + runtime.KeepAlive(notification) + runtime.KeepAlive(icon) +} + +// SetPriority sets the priority of notification to priority. See Priority for +// possible values. +// +// The function takes the following parameters: +// +// - priority: Priority. +func (notification *Notification) SetPriority(priority NotificationPriority) { + var _arg0 *C.GNotification // out + var _arg1 C.GNotificationPriority // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + _arg1 = C.GNotificationPriority(priority) + + C.g_notification_set_priority(_arg0, _arg1) + runtime.KeepAlive(notification) + runtime.KeepAlive(priority) +} + +// SetTitle sets the title of notification to title. +// +// The function takes the following parameters: +// +// - title: new title for notification. +func (notification *Notification) SetTitle(title string) { + var _arg0 *C.GNotification // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(title))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_notification_set_title(_arg0, _arg1) + runtime.KeepAlive(notification) + runtime.KeepAlive(title) +} + +// SetUrgent: deprecated in favor of g_notification_set_priority(). +// +// Deprecated: Since 2.42, this has been deprecated in favour of +// g_notification_set_priority(). +// +// The function takes the following parameters: +// +// - urgent: TRUE if notification is urgent. +func (notification *Notification) SetUrgent(urgent bool) { + var _arg0 *C.GNotification // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GNotification)(unsafe.Pointer(coreglib.InternObject(notification).Native())) + if urgent { + _arg1 = C.TRUE + } + + C.g_notification_set_urgent(_arg0, _arg1) + runtime.KeepAlive(notification) + runtime.KeepAlive(urgent) +} + +// OutputStreamOverrides contains methods that are overridable. +type OutputStreamOverrides struct { + // CloseFinish closes an output stream. + // + // The function takes the following parameters: + // + // - result: Result. + CloseFinish func(result AsyncResulter) error + CloseFn func(ctx context.Context) error + // Flush forces a write of all user-space buffered data for the given + // stream. Will block during the operation. Closing the stream will + // implicitly cause a flush. + // + // This function is optional for inherited classes. + // + // If cancellable is not NULL, then the operation can be cancelled by + // triggering the cancellable object from another thread. If the operation + // was cancelled, the error G_IO_ERROR_CANCELLED will be returned. + // + // The function takes the following parameters: + // + // - ctx (optional): optional cancellable object. + Flush func(ctx context.Context) error + // FlushFinish finishes flushing an output stream. + // + // The function takes the following parameters: + // + // - result: GAsyncResult. + FlushFinish func(result AsyncResulter) error + // Splice splices an input stream into an output stream. + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable object, NULL to ignore. + // - source: Stream. + // - flags: set of StreamSpliceFlags. + // + // The function returns the following values: + // + // - gssize containing the size of the data spliced, or -1 if an error + // occurred. Note that if the number of bytes spliced is greater than + // G_MAXSSIZE, then that will be returned, and there is no way to + // determine the actual number of bytes spliced. + Splice func(ctx context.Context, source InputStreamer, flags OutputStreamSpliceFlags) (int, error) + // SpliceFinish finishes an asynchronous stream splice operation. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - gssize of the number of bytes spliced. Note that if the number of + // bytes spliced is greater than G_MAXSSIZE, then that will be returned, + // and there is no way to determine the actual number of bytes spliced. + SpliceFinish func(result AsyncResulter) (int, error) + // WriteFinish finishes a stream write operation. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - gssize containing the number of bytes written to the stream. + WriteFinish func(result AsyncResulter) (int, error) + // WritevFinish finishes a stream writev operation. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - bytesWritten (optional): location to store the number of bytes that + // were written to the stream. + WritevFinish func(result AsyncResulter) (uint, error) +} + +func defaultOutputStreamOverrides(v *OutputStream) OutputStreamOverrides { + return OutputStreamOverrides{ + CloseFinish: v.closeFinish, + CloseFn: v.closeFn, + Flush: v.flush, + FlushFinish: v.flushFinish, + Splice: v.splice, + SpliceFinish: v.spliceFinish, + WriteFinish: v.writeFinish, + WritevFinish: v.writevFinish, + } +} + +// OutputStream: GOutputStream is a base class for implementing streaming +// output. +// +// It has functions to write to a stream (gio.OutputStream.Write()), +// to close a stream (gio.OutputStream.Close()) and to flush pending writes +// (gio.OutputStream.Flush()). +// +// To copy the content of an input stream to an output stream without manually +// handling the reads and writes, use gio.OutputStream.Splice(). +// +// See the documentation for gio.IOStream for details of thread safety of +// streaming APIs. +// +// All of these functions have async variants too. +// +// All classes derived from GOutputStream *should* implement synchronous +// writing, splicing, flushing and closing streams, but *may* implement +// asynchronous versions. +type OutputStream struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*OutputStream)(nil) +) + +// OutputStreamer describes types inherited from class OutputStream. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type OutputStreamer interface { + coreglib.Objector + baseOutputStream() *OutputStream +} + +var _ OutputStreamer = (*OutputStream)(nil) + +func init() { + coreglib.RegisterClassInfo[*OutputStream, *OutputStreamClass, OutputStreamOverrides]( + GTypeOutputStream, + initOutputStreamClass, + wrapOutputStream, + defaultOutputStreamOverrides, + ) +} + +func initOutputStreamClass(gclass unsafe.Pointer, overrides OutputStreamOverrides, classInitFunc func(*OutputStreamClass)) { + pclass := (*C.GOutputStreamClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeOutputStream)))) + + if overrides.CloseFinish != nil { + pclass.close_finish = (*[0]byte)(C._gotk4_gio2_OutputStreamClass_close_finish) + } + + if overrides.CloseFn != nil { + pclass.close_fn = (*[0]byte)(C._gotk4_gio2_OutputStreamClass_close_fn) + } + + if overrides.Flush != nil { + pclass.flush = (*[0]byte)(C._gotk4_gio2_OutputStreamClass_flush) + } + + if overrides.FlushFinish != nil { + pclass.flush_finish = (*[0]byte)(C._gotk4_gio2_OutputStreamClass_flush_finish) + } + + if overrides.Splice != nil { + pclass.splice = (*[0]byte)(C._gotk4_gio2_OutputStreamClass_splice) + } + + if overrides.SpliceFinish != nil { + pclass.splice_finish = (*[0]byte)(C._gotk4_gio2_OutputStreamClass_splice_finish) + } + + if overrides.WriteFinish != nil { + pclass.write_finish = (*[0]byte)(C._gotk4_gio2_OutputStreamClass_write_finish) + } + + if overrides.WritevFinish != nil { + pclass.writev_finish = (*[0]byte)(C._gotk4_gio2_OutputStreamClass_writev_finish) + } + + if classInitFunc != nil { + class := (*OutputStreamClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapOutputStream(obj *coreglib.Object) *OutputStream { + return &OutputStream{ + Object: obj, + } +} + +func marshalOutputStream(p uintptr) (interface{}, error) { + return wrapOutputStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (stream *OutputStream) baseOutputStream() *OutputStream { + return stream +} + +// BaseOutputStream returns the underlying base object. +func BaseOutputStream(obj OutputStreamer) *OutputStream { + return obj.baseOutputStream() +} + +// ClearPending clears the pending flag on stream. +func (stream *OutputStream) ClearPending() { + var _arg0 *C.GOutputStream // out + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + C.g_output_stream_clear_pending(_arg0) + runtime.KeepAlive(stream) +} + +// Close closes the stream, releasing resources related to it. +// +// Once the stream is closed, all other operations will return +// G_IO_ERROR_CLOSED. Closing a stream multiple times will not return an error. +// +// Closing a stream will automatically flush any outstanding buffers in the +// stream. +// +// Streams will be automatically closed when the last reference is dropped, +// but you might want to call this function to make sure resources are released +// as early as possible. +// +// Some streams might keep the backing store of the stream (e.g. a file +// descriptor) open after the stream is closed. See the documentation for the +// individual stream for details. +// +// On failure the first error that happened will be reported, but the close +// operation will finish as much as possible. A stream that failed to close will +// still return G_IO_ERROR_CLOSED for all operations. Still, it is important to +// check and report the error to the user, otherwise there might be a loss of +// data as all data might not be written. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. Cancelling a close will +// still leave the stream closed, but there some streams can use a faster close +// that doesn't block to e.g. check errors. On cancellation (as with any error) +// there is no guarantee that all written data will reach the target. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +func (stream *OutputStream) Close(ctx context.Context) error { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_output_stream_close(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CloseAsync requests an asynchronous close of the stream, releasing resources +// related to it. When the operation is finished callback will be called. +// You can then call g_output_stream_close_finish() to get the result of the +// operation. +// +// For behaviour details see g_output_stream_close(). +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) CloseAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_output_stream_close_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// CloseFinish closes an output stream. +// +// The function takes the following parameters: +// +// - result: Result. +func (stream *OutputStream) CloseFinish(result AsyncResulter) error { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_output_stream_close_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Flush forces a write of all user-space buffered data for the given stream. +// Will block during the operation. Closing the stream will implicitly cause a +// flush. +// +// This function is optional for inherited classes. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +func (stream *OutputStream) Flush(ctx context.Context) error { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_output_stream_flush(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// FlushAsync forces an asynchronous write of all user-space buffered data for +// the given stream. For behaviour details see g_output_stream_flush(). +// +// When the operation is finished callback will be called. You can then call +// g_output_stream_flush_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) FlushAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_output_stream_flush_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// FlushFinish finishes flushing an output stream. +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +func (stream *OutputStream) FlushFinish(result AsyncResulter) error { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_output_stream_flush_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// HasPending checks if an output stream has pending actions. +// +// The function returns the following values: +// +// - ok: TRUE if stream has pending actions. +func (stream *OutputStream) HasPending() bool { + var _arg0 *C.GOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_output_stream_has_pending(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsClosed checks if an output stream has already been closed. +// +// The function returns the following values: +// +// - ok: TRUE if stream is closed. FALSE otherwise. +func (stream *OutputStream) IsClosed() bool { + var _arg0 *C.GOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_output_stream_is_closed(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsClosing checks if an output stream is being closed. This can be used inside +// e.g. a flush implementation to see if the flush (or other i/o operation) is +// called from within the closing operation. +// +// The function returns the following values: +// +// - ok: TRUE if stream is being closed. FALSE otherwise. +func (stream *OutputStream) IsClosing() bool { + var _arg0 *C.GOutputStream // out + var _cret C.gboolean // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + _cret = C.g_output_stream_is_closing(_arg0) + runtime.KeepAlive(stream) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetPending sets stream to have actions pending. If the pending flag is +// already set or stream is closed, it will return FALSE and set error. +func (stream *OutputStream) SetPending() error { + var _arg0 *C.GOutputStream // out + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + + C.g_output_stream_set_pending(_arg0, &_cerr) + runtime.KeepAlive(stream) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Splice splices an input stream into an output stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - source: Stream. +// - flags: set of StreamSpliceFlags. +// +// The function returns the following values: +// +// - gssize containing the size of the data spliced, or -1 if an error +// occurred. Note that if the number of bytes spliced is greater than +// G_MAXSSIZE, then that will be returned, and there is no way to determine +// the actual number of bytes spliced. +func (stream *OutputStream) Splice(ctx context.Context, source InputStreamer, flags OutputStreamSpliceFlags) (int, error) { + var _arg0 *C.GOutputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg2 C.GOutputStreamSpliceFlags // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(source).Native())) + _arg2 = C.GOutputStreamSpliceFlags(flags) + + _cret = C.g_output_stream_splice(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(source) + runtime.KeepAlive(flags) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// SpliceAsync splices a stream asynchronously. When the operation is finished +// callback will be called. You can then call g_output_stream_splice_finish() to +// get the result of the operation. +// +// For the synchronous, blocking version of this function, see +// g_output_stream_splice(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - source: Stream. +// - flags: set of StreamSpliceFlags. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) SpliceAsync(ctx context.Context, source InputStreamer, flags OutputStreamSpliceFlags, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg2 C.GOutputStreamSpliceFlags // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(source).Native())) + _arg2 = C.GOutputStreamSpliceFlags(flags) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_output_stream_splice_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(source) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// SpliceFinish finishes an asynchronous stream splice operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize of the number of bytes spliced. Note that if the number of bytes +// spliced is greater than G_MAXSSIZE, then that will be returned, and there +// is no way to determine the actual number of bytes spliced. +func (stream *OutputStream) SpliceFinish(result AsyncResulter) (int, error) { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_output_stream_splice_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// Write tries to write count bytes from buffer into the stream. Will block +// during the operation. +// +// If count is 0, returns 0 and does nothing. A value of count larger than +// G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes written to the stream is returned. It is not +// an error if this is not the same as the requested size, as it can happen e.g. +// on a partial I/O error, or if there is not enough storage in the stream. +// All writes block until at least one byte is written or an error occurs; +// 0 is never returned (unless count is 0). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// On error -1 is returned and error is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - buffer containing the data to write. +// +// The function returns the following values: +// +// - gssize: number of bytes written, or -1 on error. +func (stream *OutputStream) Write(ctx context.Context, buffer []byte) (int, error) { + var _arg0 *C.GOutputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + + _cret = C.g_output_stream_write(_arg0, unsafe.Pointer(_arg1), _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// WriteAll tries to write count bytes from buffer into the stream. Will block +// during the operation. +// +// This function is similar to g_output_stream_write(), except it tries to write +// as many bytes as requested, only stopping on an error. +// +// On a successful write of count bytes, TRUE is returned, and bytes_written is +// set to count. +// +// If there is an error during the operation FALSE is returned and error is set +// to indicate the error status. +// +// As a special exception to the normal conventions for functions that use +// #GError, if this function returns FALSE (and sets error) then bytes_written +// will be set to the number of bytes that were successfully written before +// the error was encountered. This functionality is only available from C. +// If you need it from another language then you must write your own loop around +// g_output_stream_write(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - buffer containing the data to write. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that was +// written to the stream. +func (stream *OutputStream) WriteAll(ctx context.Context, buffer []byte) (uint, error) { + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + + C.g_output_stream_write_all(_arg0, unsafe.Pointer(_arg1), _arg2, &_arg3, _arg4, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _bytesWritten uint // out + var _goerr error // out + + _bytesWritten = uint(_arg3) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _goerr +} + +// WriteAllAsync: request an asynchronous write of count bytes from buffer +// into the stream. When the operation is finished callback will be called. +// You can then call g_output_stream_write_all_finish() to get the result of the +// operation. +// +// This is the asynchronous version of g_output_stream_write_all(). +// +// Call g_output_stream_write_all_finish() to collect the result. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// Note that no copy of buffer will be made, so it must stay valid until +// callback is called. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - buffer containing the data to write. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) WriteAllAsync(ctx context.Context, buffer []byte, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_output_stream_write_all_async(_arg0, unsafe.Pointer(_arg1), _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// WriteAllFinish finishes an asynchronous stream write operation started with +// g_output_stream_write_all_async(). +// +// As a special exception to the normal conventions for functions that use +// #GError, if this function returns FALSE (and sets error) then bytes_written +// will be set to the number of bytes that were successfully written before +// the error was encountered. This functionality is only available from C. +// If you need it from another language then you must write your own loop around +// g_output_stream_write_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that was +// written to the stream. +func (stream *OutputStream) WriteAllFinish(result AsyncResulter) (uint, error) { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_output_stream_write_all_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _bytesWritten uint // out + var _goerr error // out + + _bytesWritten = uint(_arg2) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _goerr +} + +// WriteAsync: request an asynchronous write of count bytes from buffer into the +// stream. When the operation is finished callback will be called. You can then +// call g_output_stream_write_finish() to get the result of the operation. +// +// During an async request no other sync and async calls are allowed, and will +// result in G_IO_ERROR_PENDING errors. +// +// A value of count larger than G_MAXSSIZE will cause a +// G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes written will be passed to the callback. +// It is not an error if this is not the same as the requested size, as it can +// happen e.g. on a partial I/O error, but generally we try to write as many +// bytes as requested. +// +// You are guaranteed that this method will never fail with +// G_IO_ERROR_WOULD_BLOCK - if stream can't accept more data, the method will +// just wait until this changes. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// For the synchronous, blocking version of this function, see +// g_output_stream_write(). +// +// Note that no copy of buffer will be made, so it must stay valid until +// callback is called. See g_output_stream_write_bytes_async() for a #GBytes +// version that will automatically hold a reference to the contents (without +// copying) for the duration of the call. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - buffer containing the data to write. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) WriteAsync(ctx context.Context, buffer []byte, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_output_stream_write_async(_arg0, unsafe.Pointer(_arg1), _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// WriteBytes: wrapper function for g_output_stream_write() which takes a +// #GBytes as input. This can be more convenient for use by language bindings or +// in other cases where the refcounted nature of #GBytes is helpful over a bare +// pointer interface. +// +// However, note that this function may still perform partial writes, +// just like g_output_stream_write(). If that occurs, to continue writing, +// you will need to create a new #GBytes containing just the remaining bytes, +// using g_bytes_new_from_bytes(). Passing the same #GBytes instance multiple +// times potentially can result in duplicated data in the output stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - bytes to write. +// +// The function returns the following values: +// +// - gssize: number of bytes written, or -1 on error. +func (stream *OutputStream) WriteBytes(ctx context.Context, bytes *glib.Bytes) (int, error) { + var _arg0 *C.GOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GBytes // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + + _cret = C.g_output_stream_write_bytes(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(bytes) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// WriteBytesAsync: this function is similar to g_output_stream_write_async(), +// but takes a #GBytes as input. Due to the refcounted nature of #GBytes, +// this allows the stream to avoid taking a copy of the data. +// +// However, note that this function may still perform partial writes, +// just like g_output_stream_write_async(). If that occurs, to continue writing, +// you will need to create a new #GBytes containing just the remaining bytes, +// using g_bytes_new_from_bytes(). Passing the same #GBytes instance multiple +// times potentially can result in duplicated data in the output stream. +// +// For the synchronous, blocking version of this function, see +// g_output_stream_write_bytes(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - bytes to write. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) WriteBytesAsync(ctx context.Context, bytes *glib.Bytes, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GOutputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GBytes // out + var _arg2 C.int // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + _arg2 = C.int(ioPriority) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_output_stream_write_bytes_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(bytes) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// WriteBytesFinish finishes a stream write-from-#GBytes operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize containing the number of bytes written to the stream. +func (stream *OutputStream) WriteBytesFinish(result AsyncResulter) (int, error) { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_output_stream_write_bytes_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// WriteFinish finishes a stream write operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize containing the number of bytes written to the stream. +func (stream *OutputStream) WriteFinish(result AsyncResulter) (int, error) { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_output_stream_write_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// Writev tries to write the bytes contained in the n_vectors vectors into the +// stream. Will block during the operation. +// +// If n_vectors is 0 or the sum of all bytes in vectors is 0, returns 0 and does +// nothing. +// +// On success, the number of bytes written to the stream is returned. It is not +// an error if this is not the same as the requested size, as it can happen e.g. +// on a partial I/O error, or if there is not enough storage in the stream. +// All writes block until at least one byte is written or an error occurs; +// 0 is never returned (unless n_vectors is 0 or the sum of all bytes in vectors +// is 0). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// Some implementations of g_output_stream_writev() may have limitations on the +// aggregate buffer size, and will return G_IO_ERROR_INVALID_ARGUMENT if these +// are exceeded. For example, when writing to a local file on UNIX platforms, +// the aggregate buffer size must not exceed G_MAXSSIZE bytes. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - vectors: buffer containing the Vectors to write. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that were +// written to the stream. +func (stream *OutputStream) Writev(ctx context.Context, vectors []OutputVector) (uint, error) { + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GOutputVector // out + var _arg2 C.gsize + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(vectors)) + _arg1 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg1), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + + C.g_output_stream_writev(_arg0, _arg1, _arg2, &_arg3, _arg4, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(vectors) + + var _bytesWritten uint // out + var _goerr error // out + + _bytesWritten = uint(_arg3) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _goerr +} + +// WritevAll tries to write the bytes contained in the n_vectors vectors into +// the stream. Will block during the operation. +// +// This function is similar to g_output_stream_writev(), except it tries to +// write as many bytes as requested, only stopping on an error. +// +// On a successful write of all n_vectors vectors, TRUE is returned, and +// bytes_written is set to the sum of all the sizes of vectors. +// +// If there is an error during the operation FALSE is returned and error is set +// to indicate the error status. +// +// As a special exception to the normal conventions for functions that use +// #GError, if this function returns FALSE (and sets error) then bytes_written +// will be set to the number of bytes that were successfully written before +// the error was encountered. This functionality is only available from C. +// If you need it from another language then you must write your own loop around +// g_output_stream_write(). +// +// The content of the individual elements of vectors might be changed by this +// function. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - vectors: buffer containing the Vectors to write. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that were +// written to the stream. +func (stream *OutputStream) WritevAll(ctx context.Context, vectors []OutputVector) (uint, error) { + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GOutputVector // out + var _arg2 C.gsize + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(vectors)) + _arg1 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg1), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + + C.g_output_stream_writev_all(_arg0, _arg1, _arg2, &_arg3, _arg4, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(vectors) + + var _bytesWritten uint // out + var _goerr error // out + + _bytesWritten = uint(_arg3) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _goerr +} + +// WritevAllAsync: request an asynchronous write of the bytes contained in the +// n_vectors vectors into the stream. When the operation is finished callback +// will be called. You can then call g_output_stream_writev_all_finish() to get +// the result of the operation. +// +// This is the asynchronous version of g_output_stream_writev_all(). +// +// Call g_output_stream_writev_all_finish() to collect the result. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// Note that no copy of vectors will be made, so it must stay valid until +// callback is called. The content of the individual elements of vectors might +// be changed by this function. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - vectors: buffer containing the Vectors to write. +// - ioPriority: i/O priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) WritevAllAsync(ctx context.Context, vectors []OutputVector, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GOutputVector // out + var _arg2 C.gsize + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(vectors)) + _arg1 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg1), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_output_stream_writev_all_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(vectors) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// WritevAllFinish finishes an asynchronous stream write operation started with +// g_output_stream_writev_all_async(). +// +// As a special exception to the normal conventions for functions that use +// #GError, if this function returns FALSE (and sets error) then bytes_written +// will be set to the number of bytes that were successfully written before +// the error was encountered. This functionality is only available from C. +// If you need it from another language then you must write your own loop around +// g_output_stream_writev_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that were +// written to the stream. +func (stream *OutputStream) WritevAllFinish(result AsyncResulter) (uint, error) { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_output_stream_writev_all_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _bytesWritten uint // out + var _goerr error // out + + _bytesWritten = uint(_arg2) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _goerr +} + +// WritevAsync: request an asynchronous write of the bytes contained in +// n_vectors vectors into the stream. When the operation is finished callback +// will be called. You can then call g_output_stream_writev_finish() to get the +// result of the operation. +// +// During an async request no other sync and async calls are allowed, and will +// result in G_IO_ERROR_PENDING errors. +// +// On success, the number of bytes written will be passed to the callback. +// It is not an error if this is not the same as the requested size, as it can +// happen e.g. on a partial I/O error, but generally we try to write as many +// bytes as requested. +// +// You are guaranteed that this method will never fail with +// G_IO_ERROR_WOULD_BLOCK — if stream can't accept more data, the method will +// just wait until this changes. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// For the synchronous, blocking version of this function, see +// g_output_stream_writev(). +// +// Note that no copy of vectors will be made, so it must stay valid until +// callback is called. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - vectors: buffer containing the Vectors to write. +// - ioPriority: i/O priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) WritevAsync(ctx context.Context, vectors []OutputVector, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GOutputVector // out + var _arg2 C.gsize + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(vectors)) + _arg1 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg1), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_output_stream_writev_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(vectors) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// WritevFinish finishes a stream writev operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that were +// written to the stream. +func (stream *OutputStream) WritevFinish(result AsyncResulter) (uint, error) { + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_output_stream_writev_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _bytesWritten uint // out + var _goerr error // out + + _bytesWritten = uint(_arg2) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _goerr +} + +// closeAsync requests an asynchronous close of the stream, releasing resources +// related to it. When the operation is finished callback will be called. +// You can then call g_output_stream_close_finish() to get the result of the +// operation. +// +// For behaviour details see g_output_stream_close(). +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) closeAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.close_async + + var _arg0 *C.GOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_OutputStream_virtual_close_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// closeFinish closes an output stream. +// +// The function takes the following parameters: +// +// - result: Result. +func (stream *OutputStream) closeFinish(result AsyncResulter) error { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.close_finish + + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_OutputStream_virtual_close_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func (stream *OutputStream) closeFn(ctx context.Context) error { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.close_fn + + var _arg0 *C.GOutputStream // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_OutputStream_virtual_close_fn(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Flush forces a write of all user-space buffered data for the given stream. +// Will block during the operation. Closing the stream will implicitly cause a +// flush. +// +// This function is optional for inherited classes. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +func (stream *OutputStream) flush(ctx context.Context) error { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.flush + + var _arg0 *C.GOutputStream // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_OutputStream_virtual_flush(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// flushAsync forces an asynchronous write of all user-space buffered data for +// the given stream. For behaviour details see g_output_stream_flush(). +// +// When the operation is finished callback will be called. You can then call +// g_output_stream_flush_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) flushAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.flush_async + + var _arg0 *C.GOutputStream // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_OutputStream_virtual_flush_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// flushFinish finishes flushing an output stream. +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +func (stream *OutputStream) flushFinish(result AsyncResulter) error { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.flush_finish + + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_OutputStream_virtual_flush_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Splice splices an input stream into an output stream. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - source: Stream. +// - flags: set of StreamSpliceFlags. +// +// The function returns the following values: +// +// - gssize containing the size of the data spliced, or -1 if an error +// occurred. Note that if the number of bytes spliced is greater than +// G_MAXSSIZE, then that will be returned, and there is no way to determine +// the actual number of bytes spliced. +func (stream *OutputStream) splice(ctx context.Context, source InputStreamer, flags OutputStreamSpliceFlags) (int, error) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.splice + + var _arg0 *C.GOutputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg2 C.GOutputStreamSpliceFlags // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(source).Native())) + _arg2 = C.GOutputStreamSpliceFlags(flags) + + _cret = C._gotk4_gio2_OutputStream_virtual_splice(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(source) + runtime.KeepAlive(flags) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// spliceAsync splices a stream asynchronously. When the operation is finished +// callback will be called. You can then call g_output_stream_splice_finish() to +// get the result of the operation. +// +// For the synchronous, blocking version of this function, see +// g_output_stream_splice(). +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - source: Stream. +// - flags: set of StreamSpliceFlags. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) spliceAsync(ctx context.Context, source InputStreamer, flags OutputStreamSpliceFlags, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.splice_async + + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GInputStream // out + var _arg2 C.GOutputStreamSpliceFlags // out + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(source).Native())) + _arg2 = C.GOutputStreamSpliceFlags(flags) + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_OutputStream_virtual_splice_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(source) + runtime.KeepAlive(flags) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// spliceFinish finishes an asynchronous stream splice operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize of the number of bytes spliced. Note that if the number of bytes +// spliced is greater than G_MAXSSIZE, then that will be returned, and there +// is no way to determine the actual number of bytes spliced. +func (stream *OutputStream) spliceFinish(result AsyncResulter) (int, error) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.splice_finish + + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_OutputStream_virtual_splice_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// writeAsync: request an asynchronous write of count bytes from buffer into the +// stream. When the operation is finished callback will be called. You can then +// call g_output_stream_write_finish() to get the result of the operation. +// +// During an async request no other sync and async calls are allowed, and will +// result in G_IO_ERROR_PENDING errors. +// +// A value of count larger than G_MAXSSIZE will cause a +// G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes written will be passed to the callback. +// It is not an error if this is not the same as the requested size, as it can +// happen e.g. on a partial I/O error, but generally we try to write as many +// bytes as requested. +// +// You are guaranteed that this method will never fail with +// G_IO_ERROR_WOULD_BLOCK - if stream can't accept more data, the method will +// just wait until this changes. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// For the synchronous, blocking version of this function, see +// g_output_stream_write(). +// +// Note that no copy of buffer will be made, so it must stay valid until +// callback is called. See g_output_stream_write_bytes_async() for a #GBytes +// version that will automatically hold a reference to the contents (without +// copying) for the duration of the call. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - buffer (optional) containing the data to write. +// - ioPriority: io priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) writeAsync(ctx context.Context, buffer []byte, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.write_async + + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_OutputStream_virtual_write_async(unsafe.Pointer(fnarg), _arg0, unsafe.Pointer(_arg1), _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// writeFinish finishes a stream write operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - gssize containing the number of bytes written to the stream. +func (stream *OutputStream) writeFinish(result AsyncResulter) (int, error) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.write_finish + + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_OutputStream_virtual_write_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// writeFn tries to write count bytes from buffer into the stream. Will block +// during the operation. +// +// If count is 0, returns 0 and does nothing. A value of count larger than +// G_MAXSSIZE will cause a G_IO_ERROR_INVALID_ARGUMENT error. +// +// On success, the number of bytes written to the stream is returned. It is not +// an error if this is not the same as the requested size, as it can happen e.g. +// on a partial I/O error, or if there is not enough storage in the stream. +// All writes block until at least one byte is written or an error occurs; +// 0 is never returned (unless count is 0). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// On error -1 is returned and error is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - buffer (optional) containing the data to write. +// +// The function returns the following values: +// +// - gssize: number of bytes written, or -1 on error. +func (stream *OutputStream) writeFn(ctx context.Context, buffer []byte) (int, error) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.write_fn + + var _arg0 *C.GOutputStream // out + var _arg3 *C.GCancellable // out + var _arg1 *C.void // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + if len(buffer) > 0 { + _arg1 = (*C.void)(unsafe.Pointer(&buffer[0])) + } + + _cret = C._gotk4_gio2_OutputStream_virtual_write_fn(unsafe.Pointer(fnarg), _arg0, unsafe.Pointer(_arg1), _arg2, _arg3, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// writevAsync: request an asynchronous write of the bytes contained in +// n_vectors vectors into the stream. When the operation is finished callback +// will be called. You can then call g_output_stream_writev_finish() to get the +// result of the operation. +// +// During an async request no other sync and async calls are allowed, and will +// result in G_IO_ERROR_PENDING errors. +// +// On success, the number of bytes written will be passed to the callback. +// It is not an error if this is not the same as the requested size, as it can +// happen e.g. on a partial I/O error, but generally we try to write as many +// bytes as requested. +// +// You are guaranteed that this method will never fail with +// G_IO_ERROR_WOULD_BLOCK — if stream can't accept more data, the method will +// just wait until this changes. +// +// Any outstanding I/O request with higher priority (lower numerical value) +// will be executed before an outstanding request with lower priority. Default +// priority is G_PRIORITY_DEFAULT. +// +// The asynchronous methods have a default fallback that uses threads to +// implement asynchronicity, so they are optional for inheriting classes. +// However, if you override one you must override all. +// +// For the synchronous, blocking version of this function, see +// g_output_stream_writev(). +// +// Note that no copy of vectors will be made, so it must stay valid until +// callback is called. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - vectors: buffer containing the Vectors to write. +// - ioPriority: i/O priority of the request. +// - callback (optional): ReadyCallback to call when the request is satisfied. +func (stream *OutputStream) writevAsync(ctx context.Context, vectors []OutputVector, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.writev_async + + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GOutputVector // out + var _arg2 C.gsize + var _arg3 C.int // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(vectors)) + _arg1 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg1), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + _arg3 = C.int(ioPriority) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_OutputStream_virtual_writev_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(vectors) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// writevFinish finishes a stream writev operation. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that were +// written to the stream. +func (stream *OutputStream) writevFinish(result AsyncResulter) (uint, error) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.writev_finish + + var _arg0 *C.GOutputStream // out + var _arg1 *C.GAsyncResult // out + var _arg2 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_OutputStream_virtual_writev_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(result) + + var _bytesWritten uint // out + var _goerr error // out + + _bytesWritten = uint(_arg2) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _goerr +} + +// writevFn tries to write the bytes contained in the n_vectors vectors into the +// stream. Will block during the operation. +// +// If n_vectors is 0 or the sum of all bytes in vectors is 0, returns 0 and does +// nothing. +// +// On success, the number of bytes written to the stream is returned. It is not +// an error if this is not the same as the requested size, as it can happen e.g. +// on a partial I/O error, or if there is not enough storage in the stream. +// All writes block until at least one byte is written or an error occurs; +// 0 is never returned (unless n_vectors is 0 or the sum of all bytes in vectors +// is 0). +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. If an operation was +// partially finished when the operation was cancelled the partial result will +// be returned, without an error. +// +// Some implementations of g_output_stream_writev() may have limitations on the +// aggregate buffer size, and will return G_IO_ERROR_INVALID_ARGUMENT if these +// are exceeded. For example, when writing to a local file on UNIX platforms, +// the aggregate buffer size must not exceed G_MAXSSIZE bytes. +// +// The function takes the following parameters: +// +// - ctx (optional): optional cancellable object. +// - vectors: buffer containing the Vectors to write. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that were +// written to the stream. +func (stream *OutputStream) writevFn(ctx context.Context, vectors []OutputVector) (uint, error) { + gclass := (*C.GOutputStreamClass)(coreglib.PeekParentClass(stream)) + fnarg := gclass.writev_fn + + var _arg0 *C.GOutputStream // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GOutputVector // out + var _arg2 C.gsize + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(stream).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(vectors)) + _arg1 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg1), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + + C._gotk4_gio2_OutputStream_virtual_writev_fn(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_arg3, _arg4, &_cerr) + runtime.KeepAlive(stream) + runtime.KeepAlive(ctx) + runtime.KeepAlive(vectors) + + var _bytesWritten uint // out + var _goerr error // out + + _bytesWritten = uint(_arg3) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _goerr +} + +// PermissionOverrides contains methods that are overridable. +type PermissionOverrides struct { + // Acquire attempts to acquire the permission represented by permission. + // + // The precise method by which this happens depends on the permission and + // the underlying authentication mechanism. A simple example is that a + // dialog may appear asking the user to enter their password. + // + // You should check with g_permission_get_can_acquire() before calling this + // function. + // + // If the permission is acquired then TRUE is returned. Otherwise, FALSE is + // returned and error is set appropriately. + // + // This call is blocking, likely for a very long time (in the case that + // user interaction is required). See g_permission_acquire_async() for the + // non-blocking version. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + Acquire func(ctx context.Context) error + // AcquireFinish collects the result of attempting to acquire the permission + // represented by permission. + // + // This is the second half of the asynchronous version of + // g_permission_acquire(). + // + // The function takes the following parameters: + // + // - result given to the ReadyCallback. + AcquireFinish func(result AsyncResulter) error + // Release attempts to release the permission represented by permission. + // + // The precise method by which this happens depends on the permission and + // the underlying authentication mechanism. In most cases the permission + // will be dropped immediately without further action. + // + // You should check with g_permission_get_can_release() before calling this + // function. + // + // If the permission is released then TRUE is returned. Otherwise, FALSE is + // returned and error is set appropriately. + // + // This call is blocking, likely for a very long time (in the case that + // user interaction is required). See g_permission_release_async() for the + // non-blocking version. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + Release func(ctx context.Context) error + // ReleaseFinish collects the result of attempting to release the permission + // represented by permission. + // + // This is the second half of the asynchronous version of + // g_permission_release(). + // + // The function takes the following parameters: + // + // - result given to the ReadyCallback. + ReleaseFinish func(result AsyncResulter) error +} + +func defaultPermissionOverrides(v *Permission) PermissionOverrides { + return PermissionOverrides{ + Acquire: v.acquire, + AcquireFinish: v.acquireFinish, + Release: v.release, + ReleaseFinish: v.releaseFinish, + } +} + +// Permission: GPermission represents the status of the caller’s permission to +// perform a certain action. +// +// You can query if the action is currently allowed and if it is possible to +// acquire the permission so that the action will be allowed in the future. +// +// There is also an API to actually acquire the permission and one to release +// it. +// +// As an example, a GPermission might represent the ability for the user to +// write to a gio.Settings object. This GPermission object could then be used +// to decide if it is appropriate to show a “Click here to unlock” button in a +// dialog and to provide the mechanism to invoke when that button is clicked. +type Permission struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Permission)(nil) +) + +// Permissioner describes types inherited from class Permission. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Permissioner interface { + coreglib.Objector + basePermission() *Permission +} + +var _ Permissioner = (*Permission)(nil) + +func init() { + coreglib.RegisterClassInfo[*Permission, *PermissionClass, PermissionOverrides]( + GTypePermission, + initPermissionClass, + wrapPermission, + defaultPermissionOverrides, + ) +} + +func initPermissionClass(gclass unsafe.Pointer, overrides PermissionOverrides, classInitFunc func(*PermissionClass)) { + pclass := (*C.GPermissionClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypePermission)))) + + if overrides.Acquire != nil { + pclass.acquire = (*[0]byte)(C._gotk4_gio2_PermissionClass_acquire) + } + + if overrides.AcquireFinish != nil { + pclass.acquire_finish = (*[0]byte)(C._gotk4_gio2_PermissionClass_acquire_finish) + } + + if overrides.Release != nil { + pclass.release = (*[0]byte)(C._gotk4_gio2_PermissionClass_release) + } + + if overrides.ReleaseFinish != nil { + pclass.release_finish = (*[0]byte)(C._gotk4_gio2_PermissionClass_release_finish) + } + + if classInitFunc != nil { + class := (*PermissionClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapPermission(obj *coreglib.Object) *Permission { + return &Permission{ + Object: obj, + } +} + +func marshalPermission(p uintptr) (interface{}, error) { + return wrapPermission(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (permission *Permission) basePermission() *Permission { + return permission +} + +// BasePermission returns the underlying base object. +func BasePermission(obj Permissioner) *Permission { + return obj.basePermission() +} + +// Acquire attempts to acquire the permission represented by permission. +// +// The precise method by which this happens depends on the permission and the +// underlying authentication mechanism. A simple example is that a dialog may +// appear asking the user to enter their password. +// +// You should check with g_permission_get_can_acquire() before calling this +// function. +// +// If the permission is acquired then TRUE is returned. Otherwise, FALSE is +// returned and error is set appropriately. +// +// This call is blocking, likely for a very long time (in the case that +// user interaction is required). See g_permission_acquire_async() for the +// non-blocking version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (permission *Permission) Acquire(ctx context.Context) error { + var _arg0 *C.GPermission // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_permission_acquire(_arg0, _arg1, &_cerr) + runtime.KeepAlive(permission) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// AcquireAsync attempts to acquire the permission represented by permission. +// +// This is the first half of the asynchronous version of g_permission_acquire(). +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - callback (optional) to call when done. +func (permission *Permission) AcquireAsync(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GPermission // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_permission_acquire_async(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(permission) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// AcquireFinish collects the result of attempting to acquire the permission +// represented by permission. +// +// This is the second half of the asynchronous version of +// g_permission_acquire(). +// +// The function takes the following parameters: +// +// - result given to the ReadyCallback. +func (permission *Permission) AcquireFinish(result AsyncResulter) error { + var _arg0 *C.GPermission // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_permission_acquire_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(permission) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Allowed gets the value of the 'allowed' property. This property is TRUE if +// the caller currently has permission to perform the action that permission +// represents the permission to perform. +// +// The function returns the following values: +// +// - ok: value of the 'allowed' property. +func (permission *Permission) Allowed() bool { + var _arg0 *C.GPermission // out + var _cret C.gboolean // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + + _cret = C.g_permission_get_allowed(_arg0) + runtime.KeepAlive(permission) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanAcquire gets the value of the 'can-acquire' property. This property +// is TRUE if it is generally possible to acquire the permission by calling +// g_permission_acquire(). +// +// The function returns the following values: +// +// - ok: value of the 'can-acquire' property. +func (permission *Permission) CanAcquire() bool { + var _arg0 *C.GPermission // out + var _cret C.gboolean // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + + _cret = C.g_permission_get_can_acquire(_arg0) + runtime.KeepAlive(permission) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CanRelease gets the value of the 'can-release' property. This property +// is TRUE if it is generally possible to release the permission by calling +// g_permission_release(). +// +// The function returns the following values: +// +// - ok: value of the 'can-release' property. +func (permission *Permission) CanRelease() bool { + var _arg0 *C.GPermission // out + var _cret C.gboolean // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + + _cret = C.g_permission_get_can_release(_arg0) + runtime.KeepAlive(permission) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ImplUpdate: this function is called by the #GPermission implementation to +// update the properties of the permission. You should never call this function +// except from a #GPermission implementation. +// +// GObject notify signals are generated, as appropriate. +// +// The function takes the following parameters: +// +// - allowed: new value for the 'allowed' property. +// - canAcquire: new value for the 'can-acquire' property. +// - canRelease: new value for the 'can-release' property. +func (permission *Permission) ImplUpdate(allowed, canAcquire, canRelease bool) { + var _arg0 *C.GPermission // out + var _arg1 C.gboolean // out + var _arg2 C.gboolean // out + var _arg3 C.gboolean // out + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + if allowed { + _arg1 = C.TRUE + } + if canAcquire { + _arg2 = C.TRUE + } + if canRelease { + _arg3 = C.TRUE + } + + C.g_permission_impl_update(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(permission) + runtime.KeepAlive(allowed) + runtime.KeepAlive(canAcquire) + runtime.KeepAlive(canRelease) +} + +// Release attempts to release the permission represented by permission. +// +// The precise method by which this happens depends on the permission and the +// underlying authentication mechanism. In most cases the permission will be +// dropped immediately without further action. +// +// You should check with g_permission_get_can_release() before calling this +// function. +// +// If the permission is released then TRUE is returned. Otherwise, FALSE is +// returned and error is set appropriately. +// +// This call is blocking, likely for a very long time (in the case that +// user interaction is required). See g_permission_release_async() for the +// non-blocking version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (permission *Permission) Release(ctx context.Context) error { + var _arg0 *C.GPermission // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_permission_release(_arg0, _arg1, &_cerr) + runtime.KeepAlive(permission) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ReleaseAsync attempts to release the permission represented by permission. +// +// This is the first half of the asynchronous version of g_permission_release(). +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - callback (optional) to call when done. +func (permission *Permission) ReleaseAsync(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GPermission // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_permission_release_async(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(permission) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// ReleaseFinish collects the result of attempting to release the permission +// represented by permission. +// +// This is the second half of the asynchronous version of +// g_permission_release(). +// +// The function takes the following parameters: +// +// - result given to the ReadyCallback. +func (permission *Permission) ReleaseFinish(result AsyncResulter) error { + var _arg0 *C.GPermission // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_permission_release_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(permission) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Acquire attempts to acquire the permission represented by permission. +// +// The precise method by which this happens depends on the permission and the +// underlying authentication mechanism. A simple example is that a dialog may +// appear asking the user to enter their password. +// +// You should check with g_permission_get_can_acquire() before calling this +// function. +// +// If the permission is acquired then TRUE is returned. Otherwise, FALSE is +// returned and error is set appropriately. +// +// This call is blocking, likely for a very long time (in the case that +// user interaction is required). See g_permission_acquire_async() for the +// non-blocking version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (permission *Permission) acquire(ctx context.Context) error { + gclass := (*C.GPermissionClass)(coreglib.PeekParentClass(permission)) + fnarg := gclass.acquire + + var _arg0 *C.GPermission // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_Permission_virtual_acquire(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(permission) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// acquireAsync attempts to acquire the permission represented by permission. +// +// This is the first half of the asynchronous version of g_permission_acquire(). +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - callback (optional) to call when done. +func (permission *Permission) acquireAsync(ctx context.Context, callback AsyncReadyCallback) { + gclass := (*C.GPermissionClass)(coreglib.PeekParentClass(permission)) + fnarg := gclass.acquire_async + + var _arg0 *C.GPermission // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Permission_virtual_acquire_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(permission) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// acquireFinish collects the result of attempting to acquire the permission +// represented by permission. +// +// This is the second half of the asynchronous version of +// g_permission_acquire(). +// +// The function takes the following parameters: +// +// - result given to the ReadyCallback. +func (permission *Permission) acquireFinish(result AsyncResulter) error { + gclass := (*C.GPermissionClass)(coreglib.PeekParentClass(permission)) + fnarg := gclass.acquire_finish + + var _arg0 *C.GPermission // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Permission_virtual_acquire_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(permission) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Release attempts to release the permission represented by permission. +// +// The precise method by which this happens depends on the permission and the +// underlying authentication mechanism. In most cases the permission will be +// dropped immediately without further action. +// +// You should check with g_permission_get_can_release() before calling this +// function. +// +// If the permission is released then TRUE is returned. Otherwise, FALSE is +// returned and error is set appropriately. +// +// This call is blocking, likely for a very long time (in the case that +// user interaction is required). See g_permission_release_async() for the +// non-blocking version. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (permission *Permission) release(ctx context.Context) error { + gclass := (*C.GPermissionClass)(coreglib.PeekParentClass(permission)) + fnarg := gclass.release + + var _arg0 *C.GPermission // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_Permission_virtual_release(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(permission) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// releaseAsync attempts to release the permission represented by permission. +// +// This is the first half of the asynchronous version of g_permission_release(). +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - callback (optional) to call when done. +func (permission *Permission) releaseAsync(ctx context.Context, callback AsyncReadyCallback) { + gclass := (*C.GPermissionClass)(coreglib.PeekParentClass(permission)) + fnarg := gclass.release_async + + var _arg0 *C.GPermission // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Permission_virtual_release_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(permission) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// releaseFinish collects the result of attempting to release the permission +// represented by permission. +// +// This is the second half of the asynchronous version of +// g_permission_release(). +// +// The function takes the following parameters: +// +// - result given to the ReadyCallback. +func (permission *Permission) releaseFinish(result AsyncResulter) error { + gclass := (*C.GPermissionClass)(coreglib.PeekParentClass(permission)) + fnarg := gclass.release_finish + + var _arg0 *C.GPermission // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GPermission)(unsafe.Pointer(coreglib.InternObject(permission).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_Permission_virtual_release_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(permission) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PropertyAction: GPropertyAction is a way to get a gio.Action with a state +// value reflecting and controlling the value of a gobject.Object property. +// +// The state of the action will correspond to the value of the property. +// Changing it will change the property (assuming the requested value matches +// the requirements as specified in the gobject.ParamSpec). +// +// Only the most common types are presently supported. Booleans are mapped to +// booleans, strings to strings, signed/unsigned integers to int32/uint32 and +// floats and doubles to doubles. +// +// If the property is an enum then the state will be string-typed and conversion +// will automatically be performed between the enum value and ‘nick’ string as +// per the gobject.EnumValue table. +// +// Flags types are not currently supported. +// +// Properties of object types, boxed types and pointer types are not supported +// and probably never will be. +// +// Properties of glib.Variant types are not currently supported. +// +// If the property is boolean-valued then the action will have a NULL parameter +// type, and activating the action (with no parameter) will toggle the value of +// the property. +// +// In all other cases, the parameter type will correspond to the type of the +// property. +// +// The general idea here is to reduce the number of locations where a particular +// piece of state is kept (and therefore has to be synchronised between). +// GPropertyAction does not have a separate state that is kept in sync with the +// property value — its state is the property value. +// +// For example, it might be useful to create a gio.Action +// corresponding to the visible-child-name property of a GtkStack +// (https://docs.gtk.org/gtk4/class.Stack.html) so that the current page can +// be switched from a menu. The active radio indication in the menu is then +// directly determined from the active page of the GtkStack. +// +// An anti-example would be binding the active-id property on a GtkComboBox +// (https://docs.gtk.org/gtk4/class.ComboBox.html). This is because the state of +// the combo box itself is probably uninteresting and is actually being used to +// control something else. +// +// Another anti-example would be to bind to the visible-child-name property +// of a GtkStack (https://docs.gtk.org/gtk4/class.Stack.html) if this value is +// actually stored in gio.Settings. In that case, the real source of the value +// is* gio.Settings. If you want a gio.Action to control a setting stored in +// gio.Settings, see gio.Settings.CreateAction() instead, and possibly combine +// its use with gio.Settings.Bind(). +type PropertyAction struct { + _ [0]func() // equal guard + *coreglib.Object + + Action +} + +var ( + _ coreglib.Objector = (*PropertyAction)(nil) +) + +func wrapPropertyAction(obj *coreglib.Object) *PropertyAction { + return &PropertyAction{ + Object: obj, + Action: Action{ + Object: obj, + }, + } +} + +func marshalPropertyAction(p uintptr) (interface{}, error) { + return wrapPropertyAction(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewPropertyAction creates a #GAction corresponding to the value of property +// property_name on object. +// +// The property must be existent and readable and writable (and not +// construct-only). +// +// This function takes a reference on object and doesn't release it until the +// action is destroyed. +// +// The function takes the following parameters: +// +// - name of the action to create. +// - object that has the property to wrap. +// - propertyName: name of the property. +// +// The function returns the following values: +// +// - propertyAction: new Action. +func NewPropertyAction(name string, object *coreglib.Object, propertyName string) *PropertyAction { + var _arg1 *C.gchar // out + var _arg2 C.gpointer // out + var _arg3 *C.gchar // out + var _cret *C.GPropertyAction // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gpointer(unsafe.Pointer(object.Native())) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(propertyName))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.g_property_action_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(name) + runtime.KeepAlive(object) + runtime.KeepAlive(propertyName) + + var _propertyAction *PropertyAction // out + + _propertyAction = wrapPropertyAction(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _propertyAction +} + +// ProxyAddressOverrides contains methods that are overridable. +type ProxyAddressOverrides struct { +} + +func defaultProxyAddressOverrides(v *ProxyAddress) ProxyAddressOverrides { + return ProxyAddressOverrides{} +} + +// ProxyAddress: gio.InetSocketAddress representing a connection via a proxy +// server. +type ProxyAddress struct { + _ [0]func() // equal guard + InetSocketAddress +} + +var ( + _ SocketAddresser = (*ProxyAddress)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ProxyAddress, *ProxyAddressClass, ProxyAddressOverrides]( + GTypeProxyAddress, + initProxyAddressClass, + wrapProxyAddress, + defaultProxyAddressOverrides, + ) +} + +func initProxyAddressClass(gclass unsafe.Pointer, overrides ProxyAddressOverrides, classInitFunc func(*ProxyAddressClass)) { + if classInitFunc != nil { + class := (*ProxyAddressClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapProxyAddress(obj *coreglib.Object) *ProxyAddress { + return &ProxyAddress{ + InetSocketAddress: InetSocketAddress{ + SocketAddress: SocketAddress{ + Object: obj, + SocketConnectable: SocketConnectable{ + Object: obj, + }, + }, + }, + } +} + +func marshalProxyAddress(p uintptr) (interface{}, error) { + return wrapProxyAddress(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewProxyAddress creates a new Address for inetaddr with protocol that should +// tunnel through dest_hostname and dest_port. +// +// (Note that this method doesn't set the Address:uri or +// Address:destination-protocol fields; use g_object_new() directly if you want +// to set those.). +// +// The function takes the following parameters: +// +// - inetaddr: proxy server Address. +// - port: proxy server port. +// - protocol: proxy protocol to support, in lower case (e.g. socks, http). +// - destHostname: destination hostname the proxy should tunnel to. +// - destPort: destination port to tunnel to. +// - username (optional) to authenticate to the proxy server (or NULL). +// - password (optional) to authenticate to the proxy server (or NULL). +// +// The function returns the following values: +// +// - proxyAddress: new Address. +func NewProxyAddress(inetaddr *InetAddress, port uint16, protocol, destHostname string, destPort uint16, username, password string) *ProxyAddress { + var _arg1 *C.GInetAddress // out + var _arg2 C.guint16 // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 C.guint16 // out + var _arg6 *C.gchar // out + var _arg7 *C.gchar // out + var _cret *C.GSocketAddress // in + + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(inetaddr).Native())) + _arg2 = C.guint16(port) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(protocol))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(destHostname))) + defer C.free(unsafe.Pointer(_arg4)) + _arg5 = C.guint16(destPort) + if username != "" { + _arg6 = (*C.gchar)(unsafe.Pointer(C.CString(username))) + defer C.free(unsafe.Pointer(_arg6)) + } + if password != "" { + _arg7 = (*C.gchar)(unsafe.Pointer(C.CString(password))) + defer C.free(unsafe.Pointer(_arg7)) + } + + _cret = C.g_proxy_address_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(inetaddr) + runtime.KeepAlive(port) + runtime.KeepAlive(protocol) + runtime.KeepAlive(destHostname) + runtime.KeepAlive(destPort) + runtime.KeepAlive(username) + runtime.KeepAlive(password) + + var _proxyAddress *ProxyAddress // out + + _proxyAddress = wrapProxyAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _proxyAddress +} + +// DestinationHostname gets proxy's destination hostname; that is, the name of +// the host that will be connected to via the proxy, not the name of the proxy +// itself. +// +// The function returns the following values: +// +// - utf8 proxy's destination hostname. +func (proxy *ProxyAddress) DestinationHostname() string { + var _arg0 *C.GProxyAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_proxy_address_get_destination_hostname(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// DestinationPort gets proxy's destination port; that is, the port on the +// destination host that will be connected to via the proxy, not the port number +// of the proxy itself. +// +// The function returns the following values: +// +// - guint16 proxy's destination port. +func (proxy *ProxyAddress) DestinationPort() uint16 { + var _arg0 *C.GProxyAddress // out + var _cret C.guint16 // in + + _arg0 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_proxy_address_get_destination_port(_arg0) + runtime.KeepAlive(proxy) + + var _guint16 uint16 // out + + _guint16 = uint16(_cret) + + return _guint16 +} + +// DestinationProtocol gets the protocol that is being spoken to the destination +// server; eg, "http" or "ftp". +// +// The function returns the following values: +// +// - utf8 proxy's destination protocol. +func (proxy *ProxyAddress) DestinationProtocol() string { + var _arg0 *C.GProxyAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_proxy_address_get_destination_protocol(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Password gets proxy's password. +// +// The function returns the following values: +// +// - utf8 (optional) proxy's password. +func (proxy *ProxyAddress) Password() string { + var _arg0 *C.GProxyAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_proxy_address_get_password(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Protocol gets proxy's protocol. eg, "socks" or "http". +// +// The function returns the following values: +// +// - utf8 proxy's protocol. +func (proxy *ProxyAddress) Protocol() string { + var _arg0 *C.GProxyAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_proxy_address_get_protocol(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// URI gets the proxy URI that proxy was constructed from. +// +// The function returns the following values: +// +// - utf8 (optional) proxy's URI, or NULL if unknown. +func (proxy *ProxyAddress) URI() string { + var _arg0 *C.GProxyAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_proxy_address_get_uri(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Username gets proxy's username. +// +// The function returns the following values: +// +// - utf8 (optional) proxy's username. +func (proxy *ProxyAddress) Username() string { + var _arg0 *C.GProxyAddress // out + var _cret *C.gchar // in + + _arg0 = (*C.GProxyAddress)(unsafe.Pointer(coreglib.InternObject(proxy).Native())) + + _cret = C.g_proxy_address_get_username(_arg0) + runtime.KeepAlive(proxy) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ProxyAddressEnumeratorOverrides contains methods that are overridable. +type ProxyAddressEnumeratorOverrides struct { +} + +func defaultProxyAddressEnumeratorOverrides(v *ProxyAddressEnumerator) ProxyAddressEnumeratorOverrides { + return ProxyAddressEnumeratorOverrides{} +} + +// ProxyAddressEnumerator: GProxyAddressEnumerator is a wrapper around +// gio.SocketAddressEnumerator which takes the gio.SocketAddress +// instances returned by the gio.SocketAddressEnumerator and +// wraps them in gio.ProxyAddress instances, using the given +// gio.ProxyAddressEnumerator:proxy-resolver. +// +// This enumerator will be returned (for example, by +// gio.SocketConnectable.Enumerate()) as appropriate when a proxy is configured; +// there should be no need to manually wrap a gio.SocketAddressEnumerator +// instance with one. +type ProxyAddressEnumerator struct { + _ [0]func() // equal guard + SocketAddressEnumerator +} + +var ( + _ SocketAddressEnumeratorrer = (*ProxyAddressEnumerator)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ProxyAddressEnumerator, *ProxyAddressEnumeratorClass, ProxyAddressEnumeratorOverrides]( + GTypeProxyAddressEnumerator, + initProxyAddressEnumeratorClass, + wrapProxyAddressEnumerator, + defaultProxyAddressEnumeratorOverrides, + ) +} + +func initProxyAddressEnumeratorClass(gclass unsafe.Pointer, overrides ProxyAddressEnumeratorOverrides, classInitFunc func(*ProxyAddressEnumeratorClass)) { + if classInitFunc != nil { + class := (*ProxyAddressEnumeratorClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapProxyAddressEnumerator(obj *coreglib.Object) *ProxyAddressEnumerator { + return &ProxyAddressEnumerator{ + SocketAddressEnumerator: SocketAddressEnumerator{ + Object: obj, + }, + } +} + +func marshalProxyAddressEnumerator(p uintptr) (interface{}, error) { + return wrapProxyAddressEnumerator(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ResolverOverrides contains methods that are overridable. +type ResolverOverrides struct { + // LookupByAddress: synchronously reverse-resolves address to determine its + // associated hostname. + // + // If the DNS resolution fails, error (if non-NULL) will be set to a value + // from Error. + // + // If cancellable is non-NULL, it can be used to cancel the operation, + // in which case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + // - address to reverse-resolve. + // + // The function returns the following values: + // + // - utf8: hostname (either ASCII-only, or in ASCII-encoded form), or NULL + // on error. + LookupByAddress func(ctx context.Context, address *InetAddress) (string, error) + // LookupByAddressFinish retrieves the result of a previous call to + // g_resolver_lookup_by_address_async(). + // + // If the DNS resolution failed, error (if non-NULL) will be set to a + // value from Error. If the operation was cancelled, error will be set to + // G_IO_ERROR_CANCELLED. + // + // The function takes the following parameters: + // + // - result passed to your ReadyCallback. + // + // The function returns the following values: + // + // - utf8: hostname (either ASCII-only, or in ASCII-encoded form), or NULL + // on error. + LookupByAddressFinish func(result AsyncResulter) (string, error) + // LookupByName: synchronously resolves hostname to determine its associated + // IP address(es). hostname may be an ASCII-only or UTF-8 hostname, or the + // textual form of an IP address (in which case this just becomes a wrapper + // around g_inet_address_new_from_string()). + // + // On success, g_resolver_lookup_by_name() will return a non-empty + // #GList of Address, sorted in order of preference and guaranteed to + // not contain duplicates. That is, if using the result to connect to + // hostname, you should attempt to connect to the first address first, + // then the second if the first fails, etc. If you are using the result + // to listen on a socket, it is appropriate to add each result using e.g. + // g_socket_listener_add_address(). + // + // If the DNS resolution fails, error (if non-NULL) will be set to a value + // from Error and NULL will be returned. + // + // If cancellable is non-NULL, it can be used to cancel the operation, + // in which case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. + // + // If you are planning to connect to a socket on the resolved IP address, + // it may be easier to create a Address and use its Connectable interface. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + // - hostname to look up. + // + // The function returns the following values: + // + // - list: non-empty #GList of Address, or NULL on error. You must unref + // each of the addresses and free the list when you are done with it. + // (You can use g_resolver_free_addresses() to do this.). + LookupByName func(ctx context.Context, hostname string) ([]*InetAddress, error) + // LookupByNameFinish retrieves the result of a call to + // g_resolver_lookup_by_name_async(). + // + // If the DNS resolution failed, error (if non-NULL) will be set to a + // value from Error. If the operation was cancelled, error will be set to + // G_IO_ERROR_CANCELLED. + // + // The function takes the following parameters: + // + // - result passed to your ReadyCallback. + // + // The function returns the following values: + // + // - list Address, or NULL on error. See g_resolver_lookup_by_name() for + // more details. + LookupByNameFinish func(result AsyncResulter) ([]*InetAddress, error) + // LookupByNameWithFlags: this differs from g_resolver_lookup_by_name() in + // that you can modify the lookup behavior with flags. For example this can + // be used to limit results with G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + // - hostname to look up. + // - flags: extra NameLookupFlags for the lookup. + // + // The function returns the following values: + // + // - list: non-empty #GList of Address, or NULL on error. You must unref + // each of the addresses and free the list when you are done with it. + // (You can use g_resolver_free_addresses() to do this.). + LookupByNameWithFlags func(ctx context.Context, hostname string, flags ResolverNameLookupFlags) ([]*InetAddress, error) + // LookupByNameWithFlagsFinish retrieves the result of a call to + // g_resolver_lookup_by_name_with_flags_async(). + // + // If the DNS resolution failed, error (if non-NULL) will be set to a + // value from Error. If the operation was cancelled, error will be set to + // G_IO_ERROR_CANCELLED. + // + // The function takes the following parameters: + // + // - result passed to your ReadyCallback. + // + // The function returns the following values: + // + // - list Address, or NULL on error. See g_resolver_lookup_by_name() for + // more details. + LookupByNameWithFlagsFinish func(result AsyncResulter) ([]*InetAddress, error) + // LookupRecords: synchronously performs a DNS record lookup for the given + // rrname and returns a list of records as #GVariant tuples. See RecordType + // for information on what the records contain for each record_type. + // + // If the DNS resolution fails, error (if non-NULL) will be set to a value + // from Error and NULL will be returned. + // + // If cancellable is non-NULL, it can be used to cancel the operation, + // in which case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + // - rrname: DNS name to look up the record for. + // - recordType: type of DNS record to look up. + // + // The function returns the following values: + // + // - list: non-empty #GList of #GVariant, or NULL on error. You must + // free each of the records and the list when you are done with it. + // (You can use g_list_free_full() with g_variant_unref() to do this.). + LookupRecords func(ctx context.Context, rrname string, recordType ResolverRecordType) ([]*glib.Variant, error) + // LookupRecordsFinish retrieves the result of a previous call to + // g_resolver_lookup_records_async(). Returns a non-empty list of records + // as #GVariant tuples. See RecordType for information on what the records + // contain. + // + // If the DNS resolution failed, error (if non-NULL) will be set to a + // value from Error. If the operation was cancelled, error will be set to + // G_IO_ERROR_CANCELLED. + // + // The function takes the following parameters: + // + // - result passed to your ReadyCallback. + // + // The function returns the following values: + // + // - list: non-empty #GList of #GVariant, or NULL on error. You must + // free each of the records and the list when you are done with it. + // (You can use g_list_free_full() with g_variant_unref() to do this.). + LookupRecordsFinish func(result AsyncResulter) ([]*glib.Variant, error) + // LookupServiceFinish retrieves the result of a previous call to + // g_resolver_lookup_service_async(). + // + // If the DNS resolution failed, error (if non-NULL) will be set to a + // value from Error. If the operation was cancelled, error will be set to + // G_IO_ERROR_CANCELLED. + // + // The function takes the following parameters: + // + // - result passed to your ReadyCallback. + // + // The function returns the following values: + // + // - list: non-empty #GList of Target, or NULL on error. See + // g_resolver_lookup_service() for more details. + LookupServiceFinish func(result AsyncResulter) ([]*SrvTarget, error) + Reload func() +} + +func defaultResolverOverrides(v *Resolver) ResolverOverrides { + return ResolverOverrides{ + LookupByAddress: v.lookupByAddress, + LookupByAddressFinish: v.lookupByAddressFinish, + LookupByName: v.lookupByName, + LookupByNameFinish: v.lookupByNameFinish, + LookupByNameWithFlags: v.lookupByNameWithFlags, + LookupByNameWithFlagsFinish: v.lookupByNameWithFlagsFinish, + LookupRecords: v.lookupRecords, + LookupRecordsFinish: v.lookupRecordsFinish, + LookupServiceFinish: v.lookupServiceFinish, + Reload: v.reload, + } +} + +// Resolver: object that handles DNS resolution. Use gio.Resolver().GetDefault +// to get the default resolver. +// +// GResolver provides cancellable synchronous and asynchronous +// DNS resolution, for hostnames (gio.Resolver.LookupByAddress(), +// gio.Resolver.LookupByName() and their async variants) and SRV (service) +// records (gio.Resolver.LookupService()). +// +// gio.NetworkAddress and gio.NetworkService provide wrappers around GResolver +// functionality that also implement gio.SocketConnectable, making it easy to +// connect to a remote host/service. +// +// The default resolver (see gio.Resolver().GetDefault) has a timeout of 30s +// set on it since GLib 2.78. Earlier versions of GLib did not support resolver +// timeouts. +// +// This is an abstract type; subclasses of it implement different resolvers for +// different platforms and situations. +type Resolver struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Resolver)(nil) +) + +// Resolverer describes types inherited from class Resolver. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Resolverer interface { + coreglib.Objector + baseResolver() *Resolver +} + +var _ Resolverer = (*Resolver)(nil) + +func init() { + coreglib.RegisterClassInfo[*Resolver, *ResolverClass, ResolverOverrides]( + GTypeResolver, + initResolverClass, + wrapResolver, + defaultResolverOverrides, + ) +} + +func initResolverClass(gclass unsafe.Pointer, overrides ResolverOverrides, classInitFunc func(*ResolverClass)) { + pclass := (*C.GResolverClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeResolver)))) + + if overrides.LookupByAddress != nil { + pclass.lookup_by_address = (*[0]byte)(C._gotk4_gio2_ResolverClass_lookup_by_address) + } + + if overrides.LookupByAddressFinish != nil { + pclass.lookup_by_address_finish = (*[0]byte)(C._gotk4_gio2_ResolverClass_lookup_by_address_finish) + } + + if overrides.LookupByName != nil { + pclass.lookup_by_name = (*[0]byte)(C._gotk4_gio2_ResolverClass_lookup_by_name) + } + + if overrides.LookupByNameFinish != nil { + pclass.lookup_by_name_finish = (*[0]byte)(C._gotk4_gio2_ResolverClass_lookup_by_name_finish) + } + + if overrides.LookupByNameWithFlags != nil { + pclass.lookup_by_name_with_flags = (*[0]byte)(C._gotk4_gio2_ResolverClass_lookup_by_name_with_flags) + } + + if overrides.LookupByNameWithFlagsFinish != nil { + pclass.lookup_by_name_with_flags_finish = (*[0]byte)(C._gotk4_gio2_ResolverClass_lookup_by_name_with_flags_finish) + } + + if overrides.LookupRecords != nil { + pclass.lookup_records = (*[0]byte)(C._gotk4_gio2_ResolverClass_lookup_records) + } + + if overrides.LookupRecordsFinish != nil { + pclass.lookup_records_finish = (*[0]byte)(C._gotk4_gio2_ResolverClass_lookup_records_finish) + } + + if overrides.LookupServiceFinish != nil { + pclass.lookup_service_finish = (*[0]byte)(C._gotk4_gio2_ResolverClass_lookup_service_finish) + } + + if overrides.Reload != nil { + pclass.reload = (*[0]byte)(C._gotk4_gio2_ResolverClass_reload) + } + + if classInitFunc != nil { + class := (*ResolverClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapResolver(obj *coreglib.Object) *Resolver { + return &Resolver{ + Object: obj, + } +} + +func marshalResolver(p uintptr) (interface{}, error) { + return wrapResolver(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (resolver *Resolver) baseResolver() *Resolver { + return resolver +} + +// BaseResolver returns the underlying base object. +func BaseResolver(obj Resolverer) *Resolver { + return obj.baseResolver() +} + +// ConnectReload is emitted when the resolver notices that the system resolver +// configuration has changed. +func (resolver *Resolver) ConnectReload(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(resolver, "reload", false, unsafe.Pointer(C._gotk4_gio2_Resolver_ConnectReload), f) +} + +// Timeout: get the timeout applied to all resolver lookups. See +// #GResolver:timeout. +// +// The function returns the following values: +// +// - guint: resolver timeout, in milliseconds, or 0 for no timeout. +func (resolver *Resolver) Timeout() uint { + var _arg0 *C.GResolver // out + var _cret C.unsigned // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + + _cret = C.g_resolver_get_timeout(_arg0) + runtime.KeepAlive(resolver) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// LookupByAddress: synchronously reverse-resolves address to determine its +// associated hostname. +// +// If the DNS resolution fails, error (if non-NULL) will be set to a value from +// Error. +// +// If cancellable is non-NULL, it can be used to cancel the operation, in which +// case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - address to reverse-resolve. +// +// The function returns the following values: +// +// - utf8: hostname (either ASCII-only, or in ASCII-encoded form), or NULL on +// error. +func (resolver *Resolver) LookupByAddress(ctx context.Context, address *InetAddress) (string, error) { + var _arg0 *C.GResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GInetAddress // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_resolver_lookup_by_address(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// LookupByAddressAsync begins asynchronously reverse-resolving address to +// determine its associated hostname, and eventually calls callback, which must +// call g_resolver_lookup_by_address_finish() to get the final result. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - address to reverse-resolve. +// - callback (optional) to call after resolution completes. +func (resolver *Resolver) LookupByAddressAsync(ctx context.Context, address *InetAddress, callback AsyncReadyCallback) { + var _arg0 *C.GResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GInetAddress // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_resolver_lookup_by_address_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(callback) +} + +// LookupByAddressFinish retrieves the result of a previous call to +// g_resolver_lookup_by_address_async(). +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - utf8: hostname (either ASCII-only, or in ASCII-encoded form), or NULL on +// error. +func (resolver *Resolver) LookupByAddressFinish(result AsyncResulter) (string, error) { + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_resolver_lookup_by_address_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// LookupByName: synchronously resolves hostname to determine its associated IP +// address(es). hostname may be an ASCII-only or UTF-8 hostname, or the textual +// form of an IP address (in which case this just becomes a wrapper around +// g_inet_address_new_from_string()). +// +// On success, g_resolver_lookup_by_name() will return a non-empty #GList +// of Address, sorted in order of preference and guaranteed to not contain +// duplicates. That is, if using the result to connect to hostname, you should +// attempt to connect to the first address first, then the second if the +// first fails, etc. If you are using the result to listen on a socket, it is +// appropriate to add each result using e.g. g_socket_listener_add_address(). +// +// If the DNS resolution fails, error (if non-NULL) will be set to a value from +// Error and NULL will be returned. +// +// If cancellable is non-NULL, it can be used to cancel the operation, in which +// case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. +// +// If you are planning to connect to a socket on the resolved IP address, +// it may be easier to create a Address and use its Connectable interface. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostname to look up. +// +// The function returns the following values: +// +// - list: non-empty #GList of Address, or NULL on error. You must unref each +// of the addresses and free the list when you are done with it. (You can +// use g_resolver_free_addresses() to do this.). +func (resolver *Resolver) LookupByName(ctx context.Context, hostname string) ([]*InetAddress, error) { + var _arg0 *C.GResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_resolver_lookup_by_name(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostname) + + var _list []*InetAddress // out + var _goerr error // out + + _list = make([]*InetAddress, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GInetAddress)(v) + var dst *InetAddress // out + dst = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// LookupByNameAsync begins asynchronously resolving hostname to determine +// its associated IP address(es), and eventually calls callback, +// which must call g_resolver_lookup_by_name_finish() to get the result. +// See g_resolver_lookup_by_name() for more details. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostname to look up the address of. +// - callback (optional) to call after resolution completes. +func (resolver *Resolver) LookupByNameAsync(ctx context.Context, hostname string, callback AsyncReadyCallback) { + var _arg0 *C.GResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_resolver_lookup_by_name_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostname) + runtime.KeepAlive(callback) +} + +// LookupByNameFinish retrieves the result of a call to +// g_resolver_lookup_by_name_async(). +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - list Address, or NULL on error. See g_resolver_lookup_by_name() for more +// details. +func (resolver *Resolver) LookupByNameFinish(result AsyncResulter) ([]*InetAddress, error) { + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_resolver_lookup_by_name_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _list []*InetAddress // out + var _goerr error // out + + _list = make([]*InetAddress, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GInetAddress)(v) + var dst *InetAddress // out + dst = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// LookupByNameWithFlags: this differs from g_resolver_lookup_by_name() in that +// you can modify the lookup behavior with flags. For example this can be used +// to limit results with G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostname to look up. +// - flags: extra NameLookupFlags for the lookup. +// +// The function returns the following values: +// +// - list: non-empty #GList of Address, or NULL on error. You must unref each +// of the addresses and free the list when you are done with it. (You can +// use g_resolver_free_addresses() to do this.). +func (resolver *Resolver) LookupByNameWithFlags(ctx context.Context, hostname string, flags ResolverNameLookupFlags) ([]*InetAddress, error) { + var _arg0 *C.GResolver // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GResolverNameLookupFlags // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResolverNameLookupFlags(flags) + + _cret = C.g_resolver_lookup_by_name_with_flags(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostname) + runtime.KeepAlive(flags) + + var _list []*InetAddress // out + var _goerr error // out + + _list = make([]*InetAddress, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GInetAddress)(v) + var dst *InetAddress // out + dst = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// LookupByNameWithFlagsAsync begins asynchronously resolving hostname to +// determine its associated IP address(es), and eventually calls callback, which +// must call g_resolver_lookup_by_name_with_flags_finish() to get the result. +// See g_resolver_lookup_by_name() for more details. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostname to look up the address of. +// - flags: extra NameLookupFlags for the lookup. +// - callback (optional) to call after resolution completes. +func (resolver *Resolver) LookupByNameWithFlagsAsync(ctx context.Context, hostname string, flags ResolverNameLookupFlags, callback AsyncReadyCallback) { + var _arg0 *C.GResolver // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GResolverNameLookupFlags // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResolverNameLookupFlags(flags) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_resolver_lookup_by_name_with_flags_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostname) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// LookupByNameWithFlagsFinish retrieves the result of a call to +// g_resolver_lookup_by_name_with_flags_async(). +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - list Address, or NULL on error. See g_resolver_lookup_by_name() for more +// details. +func (resolver *Resolver) LookupByNameWithFlagsFinish(result AsyncResulter) ([]*InetAddress, error) { + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_resolver_lookup_by_name_with_flags_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _list []*InetAddress // out + var _goerr error // out + + _list = make([]*InetAddress, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GInetAddress)(v) + var dst *InetAddress // out + dst = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// LookupRecords: synchronously performs a DNS record lookup for the given +// rrname and returns a list of records as #GVariant tuples. See RecordType for +// information on what the records contain for each record_type. +// +// If the DNS resolution fails, error (if non-NULL) will be set to a value from +// Error and NULL will be returned. +// +// If cancellable is non-NULL, it can be used to cancel the operation, in which +// case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - rrname: DNS name to look up the record for. +// - recordType: type of DNS record to look up. +// +// The function returns the following values: +// +// - list: non-empty #GList of #GVariant, or NULL on error. You must free +// each of the records and the list when you are done with it. (You can use +// g_list_free_full() with g_variant_unref() to do this.). +func (resolver *Resolver) LookupRecords(ctx context.Context, rrname string, recordType ResolverRecordType) ([]*glib.Variant, error) { + var _arg0 *C.GResolver // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GResolverRecordType // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(rrname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResolverRecordType(recordType) + + _cret = C.g_resolver_lookup_records(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(rrname) + runtime.KeepAlive(recordType) + + var _list []*glib.Variant // out + var _goerr error // out + + _list = make([]*glib.Variant, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GVariant)(v) + var dst *glib.Variant // out + dst = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(src))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(dst)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// LookupRecordsAsync begins asynchronously performing a DNS lookup +// for the given rrname, and eventually calls callback, which must +// call g_resolver_lookup_records_finish() to get the final result. See +// g_resolver_lookup_records() for more details. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - rrname: DNS name to look up the record for. +// - recordType: type of DNS record to look up. +// - callback (optional) to call after resolution completes. +func (resolver *Resolver) LookupRecordsAsync(ctx context.Context, rrname string, recordType ResolverRecordType, callback AsyncReadyCallback) { + var _arg0 *C.GResolver // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GResolverRecordType // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(rrname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResolverRecordType(recordType) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_resolver_lookup_records_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(rrname) + runtime.KeepAlive(recordType) + runtime.KeepAlive(callback) +} + +// LookupRecordsFinish retrieves the result of a previous call to +// g_resolver_lookup_records_async(). Returns a non-empty list of records as +// #GVariant tuples. See RecordType for information on what the records contain. +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - list: non-empty #GList of #GVariant, or NULL on error. You must free +// each of the records and the list when you are done with it. (You can use +// g_list_free_full() with g_variant_unref() to do this.). +func (resolver *Resolver) LookupRecordsFinish(result AsyncResulter) ([]*glib.Variant, error) { + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_resolver_lookup_records_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _list []*glib.Variant // out + var _goerr error // out + + _list = make([]*glib.Variant, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GVariant)(v) + var dst *glib.Variant // out + dst = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(src))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(dst)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// LookupService: synchronously performs a DNS SRV lookup for the given service +// and protocol in the given domain and returns an array of Target. domain may +// be an ASCII-only or UTF-8 hostname. Note also that the service and protocol +// arguments do not include the leading underscore that appears in the actual +// DNS entry. +// +// On success, g_resolver_lookup_service() will return a non-empty #GList +// of Target, sorted in order of preference. (That is, you should attempt to +// connect to the first target first, then the second if the first fails, etc.) +// +// If the DNS resolution fails, error (if non-NULL) will be set to a value from +// Error and NULL will be returned. +// +// If cancellable is non-NULL, it can be used to cancel the operation, in which +// case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. +// +// If you are planning to connect to the service, it is usually easier to create +// a Service and use its Connectable interface. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - service type to look up (eg, "ldap"). +// - protocol: networking protocol to use for service (eg, "tcp"). +// - domain: DNS domain to look up the service in. +// +// The function returns the following values: +// +// - list: non-empty #GList of Target, or NULL on error. You must free each +// of the targets and the list when you are done with it. (You can use +// g_resolver_free_targets() to do this.). +func (resolver *Resolver) LookupService(ctx context.Context, service, protocol, domain string) ([]*SrvTarget, error) { + var _arg0 *C.GResolver // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(service))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(protocol))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.g_resolver_lookup_service(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(service) + runtime.KeepAlive(protocol) + runtime.KeepAlive(domain) + + var _list []*SrvTarget // out + var _goerr error // out + + _list = make([]*SrvTarget, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GSrvTarget)(v) + var dst *SrvTarget // out + dst = (*SrvTarget)(gextras.NewStructNative(unsafe.Pointer(src))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(dst)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_srv_target_free((*C.GSrvTarget)(intern.C)) + }, + ) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// LookupServiceAsync begins asynchronously performing a DNS SRV lookup for +// the given service and protocol in the given domain, and eventually calls +// callback, which must call g_resolver_lookup_service_finish() to get the final +// result. See g_resolver_lookup_service() for more details. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - service type to look up (eg, "ldap"). +// - protocol: networking protocol to use for service (eg, "tcp"). +// - domain: DNS domain to look up the service in. +// - callback (optional) to call after resolution completes. +func (resolver *Resolver) LookupServiceAsync(ctx context.Context, service, protocol, domain string, callback AsyncReadyCallback) { + var _arg0 *C.GResolver // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(service))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(protocol))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg3)) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_resolver_lookup_service_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(service) + runtime.KeepAlive(protocol) + runtime.KeepAlive(domain) + runtime.KeepAlive(callback) +} + +// LookupServiceFinish retrieves the result of a previous call to +// g_resolver_lookup_service_async(). +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - list: non-empty #GList of Target, or NULL on error. See +// g_resolver_lookup_service() for more details. +func (resolver *Resolver) LookupServiceFinish(result AsyncResulter) ([]*SrvTarget, error) { + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_resolver_lookup_service_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _list []*SrvTarget // out + var _goerr error // out + + _list = make([]*SrvTarget, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GSrvTarget)(v) + var dst *SrvTarget // out + dst = (*SrvTarget)(gextras.NewStructNative(unsafe.Pointer(src))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(dst)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_srv_target_free((*C.GSrvTarget)(intern.C)) + }, + ) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// SetDefault sets resolver to be the application's default resolver (reffing +// resolver, and unreffing the previous default resolver, if any). Future calls +// to g_resolver_get_default() will return this resolver. +// +// This can be used if an application wants to perform any sort of DNS caching +// or "pinning"; it can implement its own #GResolver that calls the original +// default resolver for DNS operations, and implements its own cache policies on +// top of that, and then set itself as the default resolver for all later code +// to use. +func (resolver *Resolver) SetDefault() { + var _arg0 *C.GResolver // out + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + + C.g_resolver_set_default(_arg0) + runtime.KeepAlive(resolver) +} + +// SetTimeout: set the timeout applied to all resolver lookups. See +// #GResolver:timeout. +// +// The function takes the following parameters: +// +// - timeoutMs: timeout in milliseconds, or 0 for no timeouts. +func (resolver *Resolver) SetTimeout(timeoutMs uint) { + var _arg0 *C.GResolver // out + var _arg1 C.unsigned // out + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = C.unsigned(timeoutMs) + + C.g_resolver_set_timeout(_arg0, _arg1) + runtime.KeepAlive(resolver) + runtime.KeepAlive(timeoutMs) +} + +// lookupByAddress: synchronously reverse-resolves address to determine its +// associated hostname. +// +// If the DNS resolution fails, error (if non-NULL) will be set to a value from +// Error. +// +// If cancellable is non-NULL, it can be used to cancel the operation, in which +// case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - address to reverse-resolve. +// +// The function returns the following values: +// +// - utf8: hostname (either ASCII-only, or in ASCII-encoded form), or NULL on +// error. +func (resolver *Resolver) lookupByAddress(ctx context.Context, address *InetAddress) (string, error) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_by_address + + var _arg0 *C.GResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GInetAddress // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C._gotk4_gio2_Resolver_virtual_lookup_by_address(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// lookupByAddressAsync begins asynchronously reverse-resolving address to +// determine its associated hostname, and eventually calls callback, which must +// call g_resolver_lookup_by_address_finish() to get the final result. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - address to reverse-resolve. +// - callback (optional) to call after resolution completes. +func (resolver *Resolver) lookupByAddressAsync(ctx context.Context, address *InetAddress, callback AsyncReadyCallback) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_by_address_async + + var _arg0 *C.GResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GInetAddress // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Resolver_virtual_lookup_by_address_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(callback) +} + +// lookupByAddressFinish retrieves the result of a previous call to +// g_resolver_lookup_by_address_async(). +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - utf8: hostname (either ASCII-only, or in ASCII-encoded form), or NULL on +// error. +func (resolver *Resolver) lookupByAddressFinish(result AsyncResulter) (string, error) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_by_address_finish + + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_Resolver_virtual_lookup_by_address_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// lookupByName: synchronously resolves hostname to determine its associated IP +// address(es). hostname may be an ASCII-only or UTF-8 hostname, or the textual +// form of an IP address (in which case this just becomes a wrapper around +// g_inet_address_new_from_string()). +// +// On success, g_resolver_lookup_by_name() will return a non-empty #GList +// of Address, sorted in order of preference and guaranteed to not contain +// duplicates. That is, if using the result to connect to hostname, you should +// attempt to connect to the first address first, then the second if the +// first fails, etc. If you are using the result to listen on a socket, it is +// appropriate to add each result using e.g. g_socket_listener_add_address(). +// +// If the DNS resolution fails, error (if non-NULL) will be set to a value from +// Error and NULL will be returned. +// +// If cancellable is non-NULL, it can be used to cancel the operation, in which +// case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. +// +// If you are planning to connect to a socket on the resolved IP address, +// it may be easier to create a Address and use its Connectable interface. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostname to look up. +// +// The function returns the following values: +// +// - list: non-empty #GList of Address, or NULL on error. You must unref each +// of the addresses and free the list when you are done with it. (You can +// use g_resolver_free_addresses() to do this.). +func (resolver *Resolver) lookupByName(ctx context.Context, hostname string) ([]*InetAddress, error) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_by_name + + var _arg0 *C.GResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_Resolver_virtual_lookup_by_name(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostname) + + var _list []*InetAddress // out + var _goerr error // out + + _list = make([]*InetAddress, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GInetAddress)(v) + var dst *InetAddress // out + dst = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// lookupByNameAsync begins asynchronously resolving hostname to determine +// its associated IP address(es), and eventually calls callback, +// which must call g_resolver_lookup_by_name_finish() to get the result. +// See g_resolver_lookup_by_name() for more details. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostname to look up the address of. +// - callback (optional) to call after resolution completes. +func (resolver *Resolver) lookupByNameAsync(ctx context.Context, hostname string, callback AsyncReadyCallback) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_by_name_async + + var _arg0 *C.GResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Resolver_virtual_lookup_by_name_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostname) + runtime.KeepAlive(callback) +} + +// lookupByNameFinish retrieves the result of a call to +// g_resolver_lookup_by_name_async(). +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - list Address, or NULL on error. See g_resolver_lookup_by_name() for more +// details. +func (resolver *Resolver) lookupByNameFinish(result AsyncResulter) ([]*InetAddress, error) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_by_name_finish + + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_Resolver_virtual_lookup_by_name_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _list []*InetAddress // out + var _goerr error // out + + _list = make([]*InetAddress, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GInetAddress)(v) + var dst *InetAddress // out + dst = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// lookupByNameWithFlags: this differs from g_resolver_lookup_by_name() in that +// you can modify the lookup behavior with flags. For example this can be used +// to limit results with G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostname to look up. +// - flags: extra NameLookupFlags for the lookup. +// +// The function returns the following values: +// +// - list: non-empty #GList of Address, or NULL on error. You must unref each +// of the addresses and free the list when you are done with it. (You can +// use g_resolver_free_addresses() to do this.). +func (resolver *Resolver) lookupByNameWithFlags(ctx context.Context, hostname string, flags ResolverNameLookupFlags) ([]*InetAddress, error) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_by_name_with_flags + + var _arg0 *C.GResolver // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GResolverNameLookupFlags // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResolverNameLookupFlags(flags) + + _cret = C._gotk4_gio2_Resolver_virtual_lookup_by_name_with_flags(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostname) + runtime.KeepAlive(flags) + + var _list []*InetAddress // out + var _goerr error // out + + _list = make([]*InetAddress, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GInetAddress)(v) + var dst *InetAddress // out + dst = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// lookupByNameWithFlagsAsync begins asynchronously resolving hostname to +// determine its associated IP address(es), and eventually calls callback, which +// must call g_resolver_lookup_by_name_with_flags_finish() to get the result. +// See g_resolver_lookup_by_name() for more details. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostname to look up the address of. +// - flags: extra NameLookupFlags for the lookup. +// - callback (optional) to call after resolution completes. +func (resolver *Resolver) lookupByNameWithFlagsAsync(ctx context.Context, hostname string, flags ResolverNameLookupFlags, callback AsyncReadyCallback) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_by_name_with_flags_async + + var _arg0 *C.GResolver // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GResolverNameLookupFlags // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResolverNameLookupFlags(flags) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Resolver_virtual_lookup_by_name_with_flags_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostname) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// lookupByNameWithFlagsFinish retrieves the result of a call to +// g_resolver_lookup_by_name_with_flags_async(). +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - list Address, or NULL on error. See g_resolver_lookup_by_name() for more +// details. +func (resolver *Resolver) lookupByNameWithFlagsFinish(result AsyncResulter) ([]*InetAddress, error) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_by_name_with_flags_finish + + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_Resolver_virtual_lookup_by_name_with_flags_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _list []*InetAddress // out + var _goerr error // out + + _list = make([]*InetAddress, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GInetAddress)(v) + var dst *InetAddress // out + dst = wrapInetAddress(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// lookupRecords: synchronously performs a DNS record lookup for the given +// rrname and returns a list of records as #GVariant tuples. See RecordType for +// information on what the records contain for each record_type. +// +// If the DNS resolution fails, error (if non-NULL) will be set to a value from +// Error and NULL will be returned. +// +// If cancellable is non-NULL, it can be used to cancel the operation, in which +// case error (if non-NULL) will be set to G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - rrname: DNS name to look up the record for. +// - recordType: type of DNS record to look up. +// +// The function returns the following values: +// +// - list: non-empty #GList of #GVariant, or NULL on error. You must free +// each of the records and the list when you are done with it. (You can use +// g_list_free_full() with g_variant_unref() to do this.). +func (resolver *Resolver) lookupRecords(ctx context.Context, rrname string, recordType ResolverRecordType) ([]*glib.Variant, error) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_records + + var _arg0 *C.GResolver // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GResolverRecordType // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(rrname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResolverRecordType(recordType) + + _cret = C._gotk4_gio2_Resolver_virtual_lookup_records(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(rrname) + runtime.KeepAlive(recordType) + + var _list []*glib.Variant // out + var _goerr error // out + + _list = make([]*glib.Variant, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GVariant)(v) + var dst *glib.Variant // out + dst = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(src))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(dst)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// lookupRecordsAsync begins asynchronously performing a DNS lookup +// for the given rrname, and eventually calls callback, which must +// call g_resolver_lookup_records_finish() to get the final result. See +// g_resolver_lookup_records() for more details. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - rrname: DNS name to look up the record for. +// - recordType: type of DNS record to look up. +// - callback (optional) to call after resolution completes. +func (resolver *Resolver) lookupRecordsAsync(ctx context.Context, rrname string, recordType ResolverRecordType, callback AsyncReadyCallback) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_records_async + + var _arg0 *C.GResolver // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.GResolverRecordType // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(rrname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResolverRecordType(recordType) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Resolver_virtual_lookup_records_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(rrname) + runtime.KeepAlive(recordType) + runtime.KeepAlive(callback) +} + +// lookupRecordsFinish retrieves the result of a previous call to +// g_resolver_lookup_records_async(). Returns a non-empty list of records as +// #GVariant tuples. See RecordType for information on what the records contain. +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - list: non-empty #GList of #GVariant, or NULL on error. You must free +// each of the records and the list when you are done with it. (You can use +// g_list_free_full() with g_variant_unref() to do this.). +func (resolver *Resolver) lookupRecordsFinish(result AsyncResulter) ([]*glib.Variant, error) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_records_finish + + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_Resolver_virtual_lookup_records_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _list []*glib.Variant // out + var _goerr error // out + + _list = make([]*glib.Variant, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GVariant)(v) + var dst *glib.Variant // out + dst = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(src))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(dst)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// The function takes the following parameters: +// +// - ctx (optional) +// - rrname +// - callback (optional) +func (resolver *Resolver) lookupServiceAsync(ctx context.Context, rrname string, callback AsyncReadyCallback) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_service_async + + var _arg0 *C.GResolver // out + var _arg2 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(rrname))) + defer C.free(unsafe.Pointer(_arg1)) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_Resolver_virtual_lookup_service_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(resolver) + runtime.KeepAlive(ctx) + runtime.KeepAlive(rrname) + runtime.KeepAlive(callback) +} + +// lookupServiceFinish retrieves the result of a previous call to +// g_resolver_lookup_service_async(). +// +// If the DNS resolution failed, error (if non-NULL) will be set to a +// value from Error. If the operation was cancelled, error will be set to +// G_IO_ERROR_CANCELLED. +// +// The function takes the following parameters: +// +// - result passed to your ReadyCallback. +// +// The function returns the following values: +// +// - list: non-empty #GList of Target, or NULL on error. See +// g_resolver_lookup_service() for more details. +func (resolver *Resolver) lookupServiceFinish(result AsyncResulter) ([]*SrvTarget, error) { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.lookup_service_finish + + var _arg0 *C.GResolver // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_Resolver_virtual_lookup_service_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(resolver) + runtime.KeepAlive(result) + + var _list []*SrvTarget // out + var _goerr error // out + + _list = make([]*SrvTarget, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GSrvTarget)(v) + var dst *SrvTarget // out + dst = (*SrvTarget)(gextras.NewStructNative(unsafe.Pointer(src))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(dst)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_srv_target_free((*C.GSrvTarget)(intern.C)) + }, + ) + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +func (resolver *Resolver) reload() { + gclass := (*C.GResolverClass)(coreglib.PeekParentClass(resolver)) + fnarg := gclass.reload + + var _arg0 *C.GResolver // out + + _arg0 = (*C.GResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + + C._gotk4_gio2_Resolver_virtual_reload(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(resolver) +} + +// ResolverGetDefault gets the default #GResolver. You should unref it when you +// are done with it. #GResolver may use its reference count as a hint about how +// many threads it should allocate for concurrent DNS resolutions. +// +// The function returns the following values: +// +// - resolver: default #GResolver. +func ResolverGetDefault() Resolverer { + var _cret *C.GResolver // in + + _cret = C.g_resolver_get_default() + + var _resolver Resolverer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.Resolverer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Resolverer) + return ok + }) + rv, ok := casted.(Resolverer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Resolverer") + } + _resolver = rv + } + + return _resolver +} + +// SettingsOverrides contains methods that are overridable. +type SettingsOverrides struct { + // The function takes the following parameters: + // + // - keys + // - nKeys + ChangeEvent func(keys *glib.Quark, nKeys int) bool + Changed func(key string) + WritableChangeEvent func(key glib.Quark) bool + WritableChanged func(key string) +} + +func defaultSettingsOverrides(v *Settings) SettingsOverrides { + return SettingsOverrides{ + ChangeEvent: v.changeEvent, + Changed: v.changed, + WritableChangeEvent: v.writableChangeEvent, + WritableChanged: v.writableChanged, + } +} + +// Settings: GSettings class provides a convenient API for storing and +// retrieving application settings. +// +// Reads and writes can be considered to be non-blocking. Reading settings +// with GSettings is typically extremely fast: on approximately the same order +// of magnitude (but slower than) a glib.HashTable lookup. Writing settings +// is also extremely fast in terms of time to return to your application, +// but can be extremely expensive for other threads and other processes. +// Many settings backends (including dconf) have lazy initialisation which means +// in the common case of the user using their computer without modifying any +// settings a lot of work can be avoided. For dconf, the D-Bus service doesn’t +// even need to be started in this case. For this reason, you should only ever +// modify GSettings keys in response to explicit user action. Particular care +// should be paid to ensure that modifications are not made during startup +// — for example, when setting the initial value of preferences widgets. The +// built-in gio.Settings.Bind() functionality is careful not to write settings +// in response to notify signals as a result of modifications that it makes to +// widgets. +// +// When creating a GSettings instance, you have to specify a schema that +// describes the keys in your settings and their types and default values, +// as well as some other information. +// +// Normally, a schema has a fixed path that determines where the settings are +// stored in the conceptual global tree of settings. However, schemas can also +// be ‘relocatable (#relocatable-schemas)’, i.e. not equipped with a fixed path. +// This is useful e.g. when the schema describes an ‘account’, and you want to +// be able to store a arbitrary number of accounts. +// +// Paths must start with and end with a forward slash character (/) and must +// not contain two sequential slash characters. Paths should be chosen based +// on a domain name associated with the program or library to which the +// settings belong. Examples of paths are /org/gtk/settings/file-chooser/ and +// /ca/desrt/dconf-editor/. Paths should not start with /apps/, /desktop/ or +// /system/ as they often did in GConf. +// +// Unlike other configuration systems (like GConf), GSettings does not restrict +// keys to basic types like strings and numbers. GSettings stores values as +// glib.Variant, and allows any glib.VariantType for keys. Key names are +// restricted to lowercase characters, numbers and -. Furthermore, the names +// must begin with a lowercase character, must not end with a -, and must not +// contain consecutive dashes. +// +// Similar to GConf, the default values in GSettings schemas can be localized, +// but the localized values are stored in gettext catalogs and looked up +// with the domain that is specified in the gettext-domain attribute of the +// or elements and the category that is specified in the +// l10n attribute of the element. The string which is translated +// includes all text in the element, including any surrounding +// quotation marks. +// +// The l10n attribute must be set to messages +// or time, and sets the [locale category for +// translation](https://www.gnu.org/software/gettext/manual/html_node/Aspects.html#index-locale-categories-1). +// The messages category should be used by default; use time for translatable +// date or time formats. A translation comment can be added as an XML comment +// immediately above the element — it is recommended to add these +// comments to aid translators understand the meaning and implications of the +// default value. An optional translation context attribute can be set on the +// element to disambiguate multiple defaults which use the same +// string. +// +// For example: +// +// +// ['bad', 'words'] +// +// Translations of default values must remain syntactically valid serialized +// glib.Variants (e.g. retaining any surrounding quotation marks) or runtime +// errors will occur. +// +// GSettings uses schemas in a compact binary form that is created by the +// glib-compile-schemas (glib-compile-schemas.html) utility. The input is a +// schema description in an XML format. +// +// A DTD for the gschema XML format can be found here: gschema.dtd +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/gschema.dtd) +// +// The glib-compile-schemas (glib-compile-schemas.html) tool expects schema +// files to have the extension .gschema.xml. +// +// At runtime, schemas are identified by their ID (as specified in the +// id attribute of the element). The convention for schema IDs +// is to use a dotted name, similar in style to a D-Bus bus name, e.g. +// org.gnome.SessionManager. In particular, if the settings are for a specific +// service that owns a D-Bus bus name, the D-Bus bus name and schema ID should +// match. For schemas which deal with settings not associated with one named +// application, the ID should not use StudlyCaps, e.g. org.gnome.font-rendering. +// +// In addition to glib.Variant types, keys can have types that have enumerated +// types. These can be described by a , or element, +// as seen in the second example below. The underlying type of such a key is +// string, but you can use gio.Settings.GetEnum(), gio.Settings.SetEnum(), +// gio.Settings.GetFlags(), gio.Settings.SetFlags() access the numeric values +// corresponding to the string value of enum and flags keys. +// +// An example for default value: +// +// +// +// +// +// "Hello, earthlings" +// A greeting +// +// Greeting of the invading martians +// +// +// +// +// (20,30) +// +// +// +// "" +// Empty strings have to be provided in GVariant form +// +// +// +// +// +// An example for ranges, choices and enumerated types: +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// 10 +// +// +// +// +// +// +// +// +// +// +// +// +// 'Joe' +// +// +// +// 'first' +// +// +// +// ["flag1","flag2"] +// +// +// +// +// # Vendor overrides +// +// Default values are defined in the schemas that get installed by an +// application. Sometimes, it is necessary for a vendor or distributor to adjust +// these defaults. Since patching the XML source for the schema is inconvenient +// and error-prone, glib-compile-schemas (glib-compile-schemas.html) reads +// so-called ‘vendor override’ files. These are keyfiles in the same directory +// as the XML schema sources which can override default values. The schema ID +// serves as the group name in the key file, and the values are expected in +// serialized glib.Variant form, as in the following example: +// +// [org.gtk.Example] +// key1='string' +// key2=1.5 +// +// glib-compile-schemas expects schema files to have the extension +// .gschema.override. +// +// # Binding +// +// A very convenient feature of GSettings lets you bind gobject.Object +// properties directly to settings, using gio.Settings.Bind(). Once a +// gobject.Object property has been bound to a setting, changes on either side +// are automatically propagated to the other side. GSettings handles details +// like mapping between gobject.Object and glib.Variant types, and preventing +// infinite cycles. +// +// This makes it very easy to hook up a preferences dialog to the underlying +// settings. To make this even more convenient, GSettings looks for a boolean +// property with the name sensitivity and automatically binds it to the +// writability of the bound setting. If this ‘magic’ gets in the way, it can be +// suppressed with the G_SETTINGS_BIND_NO_SENSITIVITY flag. +// +// # Relocatable schemas +// +// A relocatable schema is one with no path attribute specified on its +// element. By using gio.Settings.NewWithPath, a GSettings object can be +// instantiated for a relocatable schema, assigning a path to the instance. +// Paths passed to gio.Settings.NewWithPath will typically be constructed +// dynamically from a constant prefix plus some form of instance identifier; but +// they must still be valid GSettings paths. Paths could also be constant and +// used with a globally installed schema originating from a dependency library. +// +// For example, a relocatable schema could be used to store geometry +// information for different windows in an application. If the schema +// ID was org.foo.MyApp.Window, it could be instantiated for paths +// /org/foo/MyApp/main/, /org/foo/MyApp/document-1/, /org/foo/MyApp/document-2/, +// etc. If any of the paths are well-known they can be specified as +// elements in the parent schema, e.g.: +// +// +// +// +// +// # Build system integration +// +// GSettings comes with autotools integration to simplify compiling and +// installing schemas. To add GSettings support to an application, add the +// following to your configure.ac: +// +// GLIB_GSETTINGS +// +// In the appropriate Makefile.am, use the following snippet to compile and +// install the named schema: +// +// gsettings_SCHEMAS = org.foo.MyApp.gschema.xml +// EXTRA_DIST = $(gsettings_SCHEMAS) +// +// GSETTINGS_RULES@ +// +// No changes are needed to the build system to mark a schema XML file for +// translation. Assuming it sets the gettext-domain attribute, a schema may be +// marked for translation by adding it to POTFILES.in, assuming gettext 0.19 is +// in use (the preferred method for translation): +// +// data/org.foo.MyApp.gschema.xml +// +// Alternatively, if intltool 0.50.1 is in use: +// +// [type: gettext/gsettings]data/org.foo.MyApp.gschema.xml +// +// GSettings will use gettext to look up translations for the and +// elements, and also any elements which have a l10n +// attribute set. Translations must not be included in the .gschema.xml +// file by the build system, for example by using intltool XML rules with a +// .gschema.xml.in template. +// +// If an enumerated type defined in a C header file is to be used in a +// GSettings schema, it can either be defined manually using an element +// in the schema XML, or it can be extracted automatically from the C header. +// This approach is preferred, as it ensures the two representations are always +// synchronised. To do so, add the following to the relevant Makefile.am: +// +// gsettings_ENUM_NAMESPACE = org.foo.MyApp +// gsettings_ENUM_FILES = my-app-enums.h my-app-misc.h +// +// gsettings_ENUM_NAMESPACE specifies the schema namespace for the enum files, +// which are specified in gsettings_ENUM_FILES. This will generate a +// org.foo.MyApp.enums.xml file containing the extracted enums, which will be +// automatically included in the schema compilation, install and uninstall +// rules. It should not be committed to version control or included in +// EXTRA_DIST. +type Settings struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Settings)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*Settings, *SettingsClass, SettingsOverrides]( + GTypeSettings, + initSettingsClass, + wrapSettings, + defaultSettingsOverrides, + ) +} + +func initSettingsClass(gclass unsafe.Pointer, overrides SettingsOverrides, classInitFunc func(*SettingsClass)) { + pclass := (*C.GSettingsClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeSettings)))) + + if overrides.ChangeEvent != nil { + pclass.change_event = (*[0]byte)(C._gotk4_gio2_SettingsClass_change_event) + } + + if overrides.Changed != nil { + pclass.changed = (*[0]byte)(C._gotk4_gio2_SettingsClass_changed) + } + + if overrides.WritableChangeEvent != nil { + pclass.writable_change_event = (*[0]byte)(C._gotk4_gio2_SettingsClass_writable_change_event) + } + + if overrides.WritableChanged != nil { + pclass.writable_changed = (*[0]byte)(C._gotk4_gio2_SettingsClass_writable_changed) + } + + if classInitFunc != nil { + class := (*SettingsClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSettings(obj *coreglib.Object) *Settings { + return &Settings{ + Object: obj, + } +} + +func marshalSettings(p uintptr) (interface{}, error) { + return wrapSettings(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectChangeEvent: "change-event" signal is emitted once per change event +// that affects this settings object. You should connect to this signal only +// if you are interested in viewing groups of changes before they are split out +// into multiple emissions of the "changed" signal. For most use cases it is +// more appropriate to use the "changed" signal. +// +// In the event that the change event applies to one or more specified keys, +// keys will be an array of #GQuark of length n_keys. In the event that the +// change event applies to the #GSettings object as a whole (ie: potentially +// every key has been changed) then keys will be NULL and n_keys will be 0. +// +// The default handler for this signal invokes the "changed" signal for each +// affected key. If any other connected handler returns TRUE then this default +// functionality will be suppressed. +func (settings *Settings) ConnectChangeEvent(f func(keys []glib.Quark) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(settings, "change-event", false, unsafe.Pointer(C._gotk4_gio2_Settings_ConnectChangeEvent), f) +} + +// ConnectChanged: "changed" signal is emitted when a key has potentially +// changed. You should call one of the g_settings_get() calls to check the new +// value. +// +// This signal supports detailed connections. You can connect to the detailed +// signal "changed::x" in order to only receive callbacks when key "x" changes. +// +// Note that settings only emits this signal if you have read key at least once +// while a signal handler was already connected for key. +func (settings *Settings) ConnectChanged(f func(key string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(settings, "changed", false, unsafe.Pointer(C._gotk4_gio2_Settings_ConnectChanged), f) +} + +// ConnectWritableChangeEvent: "writable-change-event" signal is emitted +// once per writability change event that affects this settings object. +// You should connect to this signal if you are interested in viewing groups +// of changes before they are split out into multiple emissions of the +// "writable-changed" signal. For most use cases it is more appropriate to use +// the "writable-changed" signal. +// +// In the event that the writability change applies only to a single key, key +// will be set to the #GQuark for that key. In the event that the writability +// change affects the entire settings object, key will be 0. +// +// The default handler for this signal invokes the "writable-changed" and +// "changed" signals for each affected key. This is done because changes +// in writability might also imply changes in value (if for example, a new +// mandatory setting is introduced). If any other connected handler returns TRUE +// then this default functionality will be suppressed. +func (settings *Settings) ConnectWritableChangeEvent(f func(key uint) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(settings, "writable-change-event", false, unsafe.Pointer(C._gotk4_gio2_Settings_ConnectWritableChangeEvent), f) +} + +// ConnectWritableChanged: "writable-changed" signal is emitted when +// the writability of a key has potentially changed. You should call +// g_settings_is_writable() in order to determine the new status. +// +// This signal supports detailed connections. You can connect to the detailed +// signal "writable-changed::x" in order to only receive callbacks when the +// writability of "x" changes. +func (settings *Settings) ConnectWritableChanged(f func(key string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(settings, "writable-changed", false, unsafe.Pointer(C._gotk4_gio2_Settings_ConnectWritableChanged), f) +} + +// NewSettings creates a new #GSettings object with the schema specified by +// schema_id. +// +// It is an error for the schema to not exist: schemas are an essential part +// of a program, as they provide type information. If schemas need to be +// dynamically loaded (for example, from an optional runtime dependency), +// g_settings_schema_source_lookup() can be used to test for their existence +// before loading them. +// +// Signals on the newly created #GSettings object will be dispatched +// via the thread-default Context in effect at the time of the call to +// g_settings_new(). The new #GSettings will hold a reference on the context. +// See g_main_context_push_thread_default(). +// +// The function takes the following parameters: +// +// - schemaId: id of the schema. +// +// The function returns the following values: +// +// - settings: new #GSettings object. +func NewSettings(schemaId string) *Settings { + var _arg1 *C.gchar // out + var _cret *C.GSettings // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(schemaId))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_new(_arg1) + runtime.KeepAlive(schemaId) + + var _settings *Settings // out + + _settings = wrapSettings(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _settings +} + +// NewSettingsWithPath creates a new #GSettings object with the relocatable +// schema specified by schema_id and a given path. +// +// You only need to do this if you want to directly create a settings object +// with a schema that doesn't have a specified path of its own. That's quite +// rare. +// +// It is a programmer error to call this function for a schema that has an +// explicitly specified path. +// +// It is a programmer error if path is not a valid path. A valid path begins and +// ends with '/' and does not contain two consecutive '/' characters. +// +// The function takes the following parameters: +// +// - schemaId: id of the schema. +// - path to use. +// +// The function returns the following values: +// +// - settings: new #GSettings object. +func NewSettingsWithPath(schemaId, path string) *Settings { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GSettings // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(schemaId))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_settings_new_with_path(_arg1, _arg2) + runtime.KeepAlive(schemaId) + runtime.KeepAlive(path) + + var _settings *Settings // out + + _settings = wrapSettings(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _settings +} + +// Apply applies any changes that have been made to the settings. +// This function does nothing unless settings is in 'delay-apply' mode; +// see g_settings_delay(). In the normal case settings are always applied +// immediately. +func (settings *Settings) Apply() { + var _arg0 *C.GSettings // out + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + + C.g_settings_apply(_arg0) + runtime.KeepAlive(settings) +} + +// Bind: create a binding between the key in the settings object and the +// property property of object. +// +// The binding uses the default GIO mapping functions to map between the +// settings and property values. These functions handle booleans, numeric types +// and string types in a straightforward way. Use g_settings_bind_with_mapping() +// if you need a custom mapping, or map between types that are not supported by +// the default mapping functions. +// +// Unless the flags include G_SETTINGS_BIND_NO_SENSITIVITY, this function also +// establishes a binding between the writability of key and the "sensitive" +// property of object (if object has a boolean property by that name). See +// g_settings_bind_writable() for more details about writable bindings. +// +// Note that the lifecycle of the binding is tied to object, and that you can +// have only one binding per object property. If you bind the same property +// twice on the same object, the second binding overrides the first one. +// +// The function takes the following parameters: +// +// - key to bind. +// - object: #GObject. +// - property: name of the property to bind. +// - flags for the binding. +func (settings *Settings) Bind(key string, object *coreglib.Object, property string, flags SettingsBindFlags) { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.gpointer // out + var _arg3 *C.gchar // out + var _arg4 C.GSettingsBindFlags // out + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gpointer(unsafe.Pointer(object.Native())) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(property))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = C.GSettingsBindFlags(flags) + + C.g_settings_bind(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(object) + runtime.KeepAlive(property) + runtime.KeepAlive(flags) +} + +// BindWritable: create a binding between the writability of key in the settings +// object and the property property of object. The property must be boolean; +// "sensitive" or "visible" properties of widgets are the most likely +// candidates. +// +// Writable bindings are always uni-directional; changes of the writability of +// the setting will be propagated to the object property, not the other way. +// +// When the inverted argument is TRUE, the binding inverts the value as it +// passes from the setting to the object, i.e. property will be set to TRUE if +// the key is not writable. +// +// Note that the lifecycle of the binding is tied to object, and that you can +// have only one binding per object property. If you bind the same property +// twice on the same object, the second binding overrides the first one. +// +// The function takes the following parameters: +// +// - key to bind. +// - object: #GObject. +// - property: name of a boolean property to bind. +// - inverted: whether to 'invert' the value. +func (settings *Settings) BindWritable(key string, object *coreglib.Object, property string, inverted bool) { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.gpointer // out + var _arg3 *C.gchar // out + var _arg4 C.gboolean // out + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gpointer(unsafe.Pointer(object.Native())) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(property))) + defer C.free(unsafe.Pointer(_arg3)) + if inverted { + _arg4 = C.TRUE + } + + C.g_settings_bind_writable(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(object) + runtime.KeepAlive(property) + runtime.KeepAlive(inverted) +} + +// CreateAction creates a #GAction corresponding to a given #GSettings key. +// +// The action has the same name as the key. +// +// The value of the key becomes the state of the action and the action is +// enabled when the key is writable. Changing the state of the action results +// in the key being written to. Changes to the value or writability of the key +// cause appropriate change notifications to be emitted for the action. +// +// For boolean-valued keys, action activations take no parameter and result +// in the toggling of the value. For all other types, activations take the new +// value for the key (which must have the correct type). +// +// The function takes the following parameters: +// +// - key: name of a key in settings. +// +// The function returns the following values: +// +// - action: new #GAction. +func (settings *Settings) CreateAction(key string) *Action { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret *C.GAction // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_create_action(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _action *Action // out + + _action = wrapAction(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _action +} + +// Delay changes the #GSettings object into 'delay-apply' mode. In this mode, +// changes to settings are not immediately propagated to the backend, but kept +// locally until g_settings_apply() is called. +func (settings *Settings) Delay() { + var _arg0 *C.GSettings // out + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + + C.g_settings_delay(_arg0) + runtime.KeepAlive(settings) +} + +// Boolean gets the value that is stored at key in settings. +// +// A convenience variant of g_settings_get() for booleans. +// +// It is a programmer error to give a key that isn't specified as having a +// boolean type in the schema for settings. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - ok: boolean. +func (settings *Settings) Boolean(key string) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_boolean(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Child creates a child settings object which has a base path of +// base-path/name, where base-path is the base path of settings. +// +// The schema for the child settings object must have been declared in the +// schema of settings using a element. +// +// The created child settings object will inherit the #GSettings:delay-apply +// mode from settings. +// +// The function takes the following parameters: +// +// - name of the child schema. +// +// The function returns the following values: +// +// - ret: 'child' settings object. +func (settings *Settings) Child(name string) *Settings { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret *C.GSettings // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_child(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(name) + + var _ret *Settings // out + + _ret = wrapSettings(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _ret +} + +// DefaultValue gets the "default value" of a key. +// +// This is the value that would be read if g_settings_reset() were to be called +// on the key. +// +// Note that this may be a different value than returned by +// g_settings_schema_key_get_default_value() if the system administrator has +// provided a default value. +// +// Comparing the return values of g_settings_get_default_value() and +// g_settings_get_value() is not sufficient for determining if a value has +// been set because the user may have explicitly set the value to something +// that happens to be equal to the default. The difference here is that if the +// default changes in the future, the user's key will still be set. +// +// This function may be useful for adding an indication to a UI of what the +// default value was before the user set it. +// +// It is a programmer error to give a key that isn't contained in the schema for +// settings. +// +// The function takes the following parameters: +// +// - key to get the default value for. +// +// The function returns the following values: +// +// - variant (optional): default value. +func (settings *Settings) DefaultValue(key string) *glib.Variant { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_default_value(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// Double gets the value that is stored at key in settings. +// +// A convenience variant of g_settings_get() for doubles. +// +// It is a programmer error to give a key that isn't specified as having a +// 'double' type in the schema for settings. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - gdouble: double. +func (settings *Settings) Double(key string) float64 { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret C.gdouble // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_double(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// Enum gets the value that is stored in settings for key and converts it to the +// enum value that it represents. +// +// In order to use this function the type of the value must be a string and it +// must be marked in the schema file as an enumerated type. +// +// It is a programmer error to give a key that isn't contained in the schema for +// settings or is not marked as an enumerated type. +// +// If the value stored in the configuration database is not a valid value for +// the enumerated type then this function will return the default value. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - gint: enum value. +func (settings *Settings) Enum(key string) int { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret C.gint // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_enum(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Flags gets the value that is stored in settings for key and converts it to +// the flags value that it represents. +// +// In order to use this function the type of the value must be an array of +// strings and it must be marked in the schema file as a flags type. +// +// It is a programmer error to give a key that isn't contained in the schema for +// settings or is not marked as a flags type. +// +// If the value stored in the configuration database is not a valid value for +// the flags type then this function will return the default value. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - guint flags value. +func (settings *Settings) Flags(key string) uint { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret C.guint // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_flags(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// HasUnapplied returns whether the #GSettings object has any unapplied changes. +// This can only be the case if it is in 'delayed-apply' mode. +// +// The function returns the following values: +// +// - ok: TRUE if settings has unapplied changes. +func (settings *Settings) HasUnapplied() bool { + var _arg0 *C.GSettings // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + + _cret = C.g_settings_get_has_unapplied(_arg0) + runtime.KeepAlive(settings) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Int gets the value that is stored at key in settings. +// +// A convenience variant of g_settings_get() for 32-bit integers. +// +// It is a programmer error to give a key that isn't specified as having a int32 +// type in the schema for settings. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - gint: integer. +func (settings *Settings) Int(key string) int { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret C.gint // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_int(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Int64 gets the value that is stored at key in settings. +// +// A convenience variant of g_settings_get() for 64-bit integers. +// +// It is a programmer error to give a key that isn't specified as having a int64 +// type in the schema for settings. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - gint64: 64-bit integer. +func (settings *Settings) Int64(key string) int64 { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret C.gint64 // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_int64(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// Mapped gets the value that is stored at key in settings, subject to +// application-level validation/mapping. +// +// You should use this function when the application needs to perform some +// processing on the value of the key (for example, parsing). The mapping +// function performs that processing. If the function indicates that the +// processing was unsuccessful (due to a parse error, for example) then the +// mapping is tried again with another value. +// +// This allows a robust 'fall back to defaults' behaviour to be implemented +// somewhat automatically. +// +// The first value that is tried is the user's setting for the key. If the +// mapping function fails to map this value, other values may be tried in an +// unspecified order (system or site defaults, translated schema default values, +// untranslated schema default values, etc). +// +// If the mapping function fails for all possible values, one additional attempt +// is made: the mapping function is called with a NULL value. If the mapping +// function still indicates failure at this point then the application will be +// aborted. +// +// The result parameter for the mapping function is pointed to a #gpointer +// which is initially set to NULL. The same pointer is given to each invocation +// of mapping. The final value of that #gpointer is what is returned by this +// function. NULL is valid; it is returned just as any other value would be. +// +// The function takes the following parameters: +// +// - key to get the value for. +// - mapping: function to map the value in the settings database to the value +// used by the application. +// +// The function returns the following values: +// +// - gpointer (optional): result, which may be NULL. +func (settings *Settings) Mapped(key string, mapping SettingsGetMapping) unsafe.Pointer { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.GSettingsGetMapping // out + var _arg3 C.gpointer + var _cret C.gpointer // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*[0]byte)(C._gotk4_gio2_SettingsGetMapping) + _arg3 = C.gpointer(gbox.Assign(mapping)) + defer gbox.Delete(uintptr(_arg3)) + + _cret = C.g_settings_get_mapped(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(mapping) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// Range queries the range of a key. +// +// Deprecated: Use g_settings_schema_key_get_range() instead. +// +// The function takes the following parameters: +// +// - key to query the range of. +func (settings *Settings) Range(key string) *glib.Variant { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_range(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _variant *glib.Variant // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// String gets the value that is stored at key in settings. +// +// A convenience variant of g_settings_get() for strings. +// +// It is a programmer error to give a key that isn't specified as having a +// string type in the schema for settings. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - utf8: newly-allocated string. +func (settings *Settings) String(key string) string { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_string(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Strv: convenience variant of g_settings_get() for string arrays. +// +// It is a programmer error to give a key that isn't specified as having an +// array of strings type in the schema for settings. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - utf8s: a newly-allocated, NULL-terminated array of strings, the value +// that is stored at key in settings. +func (settings *Settings) Strv(key string) []string { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret **C.gchar // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_strv(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// Uint gets the value that is stored at key in settings. +// +// A convenience variant of g_settings_get() for 32-bit unsigned integers. +// +// It is a programmer error to give a key that isn't specified as having a +// uint32 type in the schema for settings. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - guint: unsigned integer. +func (settings *Settings) Uint(key string) uint { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret C.guint // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_uint(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Uint64 gets the value that is stored at key in settings. +// +// A convenience variant of g_settings_get() for 64-bit unsigned integers. +// +// It is a programmer error to give a key that isn't specified as having a +// uint64 type in the schema for settings. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - guint64: 64-bit unsigned integer. +func (settings *Settings) Uint64(key string) uint64 { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret C.guint64 // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_uint64(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _guint64 uint64 // out + + _guint64 = uint64(_cret) + + return _guint64 +} + +// UserValue checks the "user value" of a key, if there is one. +// +// The user value of a key is the last value that was set by the user. +// +// After calling g_settings_reset() this function should always return NULL +// (assuming something is not wrong with the system configuration). +// +// It is possible that g_settings_get_value() will return a different value than +// this function. This can happen in the case that the user set a value for a +// key that was subsequently locked down by the system administrator -- this +// function will return the user's old value. +// +// This function may be useful for adding a "reset" option to a UI or for +// providing indication that a particular value has been changed. +// +// It is a programmer error to give a key that isn't contained in the schema for +// settings. +// +// The function takes the following parameters: +// +// - key to get the user value for. +// +// The function returns the following values: +// +// - variant (optional) user's value, if set. +func (settings *Settings) UserValue(key string) *glib.Variant { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_user_value(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// Value gets the value that is stored in settings for key. +// +// It is a programmer error to give a key that isn't contained in the schema for +// settings. +// +// The function takes the following parameters: +// +// - key to get the value for. +// +// The function returns the following values: +// +// - variant: new #GVariant. +func (settings *Settings) Value(key string) *glib.Variant { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_get_value(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _variant *glib.Variant // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// IsWritable finds out if a key can be written or not. +// +// The function takes the following parameters: +// +// - name of a key. +// +// The function returns the following values: +// +// - ok: TRUE if the key name is writable. +func (settings *Settings) IsWritable(name string) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_is_writable(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(name) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ListChildren gets the list of children on settings. +// +// The list is exactly the list of strings for which it is not an error to call +// g_settings_get_child(). +// +// There is little reason to call this function from "normal" code, since you +// should already know what children are in your schema. This function may still +// be useful there for introspection reasons, however. +// +// You should free the return value with g_strfreev() when you are done with it. +// +// The function returns the following values: +// +// - utf8s: list of the children on settings, in no defined order. +func (settings *Settings) ListChildren() []string { + var _arg0 *C.GSettings // out + var _cret **C.gchar // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + + _cret = C.g_settings_list_children(_arg0) + runtime.KeepAlive(settings) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// ListKeys introspects the list of keys on settings. +// +// You should probably not be calling this function from "normal" code (since +// you should already know what keys are in your schema). This function is +// intended for introspection reasons. +// +// You should free the return value with g_strfreev() when you are done with it. +// +// Deprecated: Use g_settings_schema_list_keys() instead. +// +// The function returns the following values: +// +// - utf8s: list of the keys on settings, in no defined order. +func (settings *Settings) ListKeys() []string { + var _arg0 *C.GSettings // out + var _cret **C.gchar // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + + _cret = C.g_settings_list_keys(_arg0) + runtime.KeepAlive(settings) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// RangeCheck checks if the given value is of the correct type and within the +// permitted range for key. +// +// Deprecated: Use g_settings_schema_key_range_check() instead. +// +// The function takes the following parameters: +// +// - key to check. +// - value to check. +// +// The function returns the following values: +// +// - ok: TRUE if value is valid for key. +func (settings *Settings) RangeCheck(key string, value *glib.Variant) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_settings_range_check(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Reset resets key to its default value. +// +// This call resets the key, as much as possible, to its default value. +// That might be the value specified in the schema or the one set by the +// administrator. +// +// The function takes the following parameters: +// +// - key: name of a key. +func (settings *Settings) Reset(key string) { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_settings_reset(_arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) +} + +// Revert reverts all non-applied changes to the settings. This function does +// nothing unless settings is in 'delay-apply' mode; see g_settings_delay(). +// In the normal case settings are always applied immediately. +// +// Change notifications will be emitted for affected keys. +func (settings *Settings) Revert() { + var _arg0 *C.GSettings // out + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + + C.g_settings_revert(_arg0) + runtime.KeepAlive(settings) +} + +// SetBoolean sets key in settings to value. +// +// A convenience variant of g_settings_set() for booleans. +// +// It is a programmer error to give a key that isn't specified as having a +// boolean type in the schema for settings. +// +// The function takes the following parameters: +// +// - key: name of the key to set. +// - value to set it to. +// +// The function returns the following values: +// +// - ok: TRUE if setting the key succeeded, FALSE if the key was not writable. +func (settings *Settings) SetBoolean(key string, value bool) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.gboolean // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + if value { + _arg2 = C.TRUE + } + + _cret = C.g_settings_set_boolean(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetDouble sets key in settings to value. +// +// A convenience variant of g_settings_set() for doubles. +// +// It is a programmer error to give a key that isn't specified as having a +// 'double' type in the schema for settings. +// +// The function takes the following parameters: +// +// - key: name of the key to set. +// - value to set it to. +// +// The function returns the following values: +// +// - ok: TRUE if setting the key succeeded, FALSE if the key was not writable. +func (settings *Settings) SetDouble(key string, value float64) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.gdouble // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gdouble(value) + + _cret = C.g_settings_set_double(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetEnum looks up the enumerated type nick for value and writes it to key, +// within settings. +// +// It is a programmer error to give a key that isn't contained in the schema +// for settings or is not marked as an enumerated type, or for value not to be a +// valid value for the named type. +// +// After performing the write, accessing key directly with +// g_settings_get_string() will return the 'nick' associated with value. +// +// The function takes the following parameters: +// +// - key: key, within settings. +// - value: enumerated value. +// +// The function returns the following values: +// +// - ok: TRUE, if the set succeeds. +func (settings *Settings) SetEnum(key string, value int) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.gint // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint(value) + + _cret = C.g_settings_set_enum(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetFlags looks up the flags type nicks for the bits specified by value, puts +// them in an array of strings and writes the array to key, within settings. +// +// It is a programmer error to give a key that isn't contained in the schema for +// settings or is not marked as a flags type, or for value to contain any bits +// that are not value for the named type. +// +// After performing the write, accessing key directly with g_settings_get_strv() +// will return an array of 'nicks'; one for each bit in value. +// +// The function takes the following parameters: +// +// - key: key, within settings. +// - value flags value. +// +// The function returns the following values: +// +// - ok: TRUE, if the set succeeds. +func (settings *Settings) SetFlags(key string, value uint) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint(value) + + _cret = C.g_settings_set_flags(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetInt sets key in settings to value. +// +// A convenience variant of g_settings_set() for 32-bit integers. +// +// It is a programmer error to give a key that isn't specified as having a int32 +// type in the schema for settings. +// +// The function takes the following parameters: +// +// - key: name of the key to set. +// - value to set it to. +// +// The function returns the following values: +// +// - ok: TRUE if setting the key succeeded, FALSE if the key was not writable. +func (settings *Settings) SetInt(key string, value int) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.gint // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint(value) + + _cret = C.g_settings_set_int(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetInt64 sets key in settings to value. +// +// A convenience variant of g_settings_set() for 64-bit integers. +// +// It is a programmer error to give a key that isn't specified as having a int64 +// type in the schema for settings. +// +// The function takes the following parameters: +// +// - key: name of the key to set. +// - value to set it to. +// +// The function returns the following values: +// +// - ok: TRUE if setting the key succeeded, FALSE if the key was not writable. +func (settings *Settings) SetInt64(key string, value int64) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.gint64 // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint64(value) + + _cret = C.g_settings_set_int64(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetString sets key in settings to value. +// +// A convenience variant of g_settings_set() for strings. +// +// It is a programmer error to give a key that isn't specified as having a +// string type in the schema for settings. +// +// The function takes the following parameters: +// +// - key: name of the key to set. +// - value to set it to. +// +// The function returns the following values: +// +// - ok: TRUE if setting the key succeeded, FALSE if the key was not writable. +func (settings *Settings) SetString(key, value string) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_settings_set_string(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetStrv sets key in settings to value. +// +// A convenience variant of g_settings_set() for string arrays. If value is +// NULL, then key is set to be the empty array. +// +// It is a programmer error to give a key that isn't specified as having an +// array of strings type in the schema for settings. +// +// The function takes the following parameters: +// +// - key: name of the key to set. +// - value (optional) to set it to, or NULL. +// +// The function returns the following values: +// +// - ok: TRUE if setting the key succeeded, FALSE if the key was not writable. +func (settings *Settings) SetStrv(key string, value []string) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 **C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + { + _arg2 = (**C.gchar)(C.calloc(C.size_t((len(value) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice(_arg2, len(value)+1) + var zero *C.gchar + out[len(value)] = zero + for i := range value { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(value[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + _cret = C.g_settings_set_strv(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetUint sets key in settings to value. +// +// A convenience variant of g_settings_set() for 32-bit unsigned integers. +// +// It is a programmer error to give a key that isn't specified as having a +// uint32 type in the schema for settings. +// +// The function takes the following parameters: +// +// - key: name of the key to set. +// - value to set it to. +// +// The function returns the following values: +// +// - ok: TRUE if setting the key succeeded, FALSE if the key was not writable. +func (settings *Settings) SetUint(key string, value uint) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint(value) + + _cret = C.g_settings_set_uint(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetUint64 sets key in settings to value. +// +// A convenience variant of g_settings_set() for 64-bit unsigned integers. +// +// It is a programmer error to give a key that isn't specified as having a +// uint64 type in the schema for settings. +// +// The function takes the following parameters: +// +// - key: name of the key to set. +// - value to set it to. +// +// The function returns the following values: +// +// - ok: TRUE if setting the key succeeded, FALSE if the key was not writable. +func (settings *Settings) SetUint64(key string, value uint64) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 C.guint64 // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint64(value) + + _cret = C.g_settings_set_uint64(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetValue sets key in settings to value. +// +// It is a programmer error to give a key that isn't contained in the schema for +// settings or for value to have the incorrect type, per the schema. +// +// If value is floating then this function consumes the reference. +// +// The function takes the following parameters: +// +// - key: name of the key to set. +// - value of the correct type. +// +// The function returns the following values: +// +// - ok: TRUE if setting the key succeeded, FALSE if the key was not writable. +func (settings *Settings) SetValue(key string, value *glib.Variant) bool { + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_settings_set_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// The function takes the following parameters: +// +// - keys +// - nKeys +func (settings *Settings) changeEvent(keys *glib.Quark, nKeys int) bool { + gclass := (*C.GSettingsClass)(coreglib.PeekParentClass(settings)) + fnarg := gclass.change_event + + var _arg0 *C.GSettings // out + var _arg1 *C.GQuark // out + var _arg2 C.gint // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.GQuark)(unsafe.Pointer(keys)) + _arg2 = C.gint(nKeys) + + _cret = C._gotk4_gio2_Settings_virtual_change_event(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(settings) + runtime.KeepAlive(keys) + runtime.KeepAlive(nKeys) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +func (settings *Settings) changed(key string) { + gclass := (*C.GSettingsClass)(coreglib.PeekParentClass(settings)) + fnarg := gclass.changed + + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_Settings_virtual_changed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) +} + +func (settings *Settings) writableChangeEvent(key glib.Quark) bool { + gclass := (*C.GSettingsClass)(coreglib.PeekParentClass(settings)) + fnarg := gclass.writable_change_event + + var _arg0 *C.GSettings // out + var _arg1 C.GQuark // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = C.GQuark(key) + + _cret = C._gotk4_gio2_Settings_virtual_writable_change_event(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +func (settings *Settings) writableChanged(key string) { + gclass := (*C.GSettingsClass)(coreglib.PeekParentClass(settings)) + fnarg := gclass.writable_changed + + var _arg0 *C.GSettings // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_Settings_virtual_writable_changed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(settings) + runtime.KeepAlive(key) +} + +// SettingsListRelocatableSchemas: deprecated. +// +// Deprecated: Use g_settings_schema_source_list_schemas() instead. +// +// The function returns the following values: +// +// - utf8s: list of relocatable #GSettings schemas that are available, +// in no defined order. The list must not be modified or freed. +func SettingsListRelocatableSchemas() []string { + var _cret **C.gchar // in + + _cret = C.g_settings_list_relocatable_schemas() + + var _utf8s []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// SettingsListSchemas: deprecated. +// +// Deprecated: Use g_settings_schema_source_list_schemas() instead. If you used +// g_settings_list_schemas() to check for the presence of a particular schema, +// use g_settings_schema_source_lookup() instead of your whole loop. +// +// The function returns the following values: +// +// - utf8s: list of #GSettings schemas that are available, in no defined +// order. The list must not be modified or freed. +func SettingsListSchemas() []string { + var _cret **C.gchar // in + + _cret = C.g_settings_list_schemas() + + var _utf8s []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// SettingsSync ensures that all pending operations are complete for the default +// backend. +// +// Writes made to a #GSettings are handled asynchronously. For this reason, +// it is very unlikely that the changes have it to disk by the time +// g_settings_set() returns. +// +// This call will block until all of the writes have made it to the backend. +// Since the mainloop is not running, no change notifications will be dispatched +// during this call (but some may be queued by the time the call is done). +func SettingsSync() { + C.g_settings_sync() +} + +// SettingsUnbind removes an existing binding for property on object. +// +// Note that bindings are automatically removed when the object is finalized, +// so it is rarely necessary to call this function. +// +// The function takes the following parameters: +// +// - object: object. +// - property whose binding is removed. +func SettingsUnbind(object *coreglib.Object, property string) { + var _arg1 C.gpointer // out + var _arg2 *C.gchar // out + + _arg1 = C.gpointer(unsafe.Pointer(object.Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(property))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_settings_unbind(_arg1, _arg2) + runtime.KeepAlive(object) + runtime.KeepAlive(property) +} + +// SimpleAction: GSimpleAction is the obvious simple implementation of the +// gio.Action interface. This is the easiest way to create an action for +// purposes of adding it to a gio.SimpleActionGroup. +type SimpleAction struct { + _ [0]func() // equal guard + *coreglib.Object + + Action +} + +var ( + _ coreglib.Objector = (*SimpleAction)(nil) +) + +func wrapSimpleAction(obj *coreglib.Object) *SimpleAction { + return &SimpleAction{ + Object: obj, + Action: Action{ + Object: obj, + }, + } +} + +func marshalSimpleAction(p uintptr) (interface{}, error) { + return wrapSimpleAction(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectActivate indicates that the action was just activated. +// +// parameter will always be of the expected type, i.e. the parameter type +// specified when the action was created. If an incorrect type is given when +// activating the action, this signal is not emitted. +// +// Since GLib 2.40, if no handler is connected to this signal then the default +// behaviour for boolean-stated actions with a NULL parameter type is to toggle +// them via the Action::change-state signal. For stateful actions where the +// state type is equal to the parameter type, the default is to forward them +// directly to Action::change-state. This should allow almost all users of +// Action to connect only one handler or the other. +func (simple *SimpleAction) ConnectActivate(f func(parameter *glib.Variant)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(simple, "activate", false, unsafe.Pointer(C._gotk4_gio2_SimpleAction_ConnectActivate), f) +} + +// ConnectChangeState indicates that the action just received a request to +// change its state. +// +// value will always be of the correct state type, i.e. the type of the initial +// state passed to g_simple_action_new_stateful(). If an incorrect type is given +// when requesting to change the state, this signal is not emitted. +// +// If no handler is connected to this signal then the default behaviour is to +// call g_simple_action_set_state() to set the state to the requested value. +// If you connect a signal handler then no default action is taken. If the +// state should change then you must call g_simple_action_set_state() from the +// handler. +// +// An example of a 'change-state' handler: +// +// static void +// change_volume_state (GSimpleAction *action, +// GVariant *value, +// gpointer user_data) +// { +// gint requested; +// +// requested = g_variant_get_int32 (value); +// +// // Volume only goes from 0 to 10 +// if (0 <= requested && requested <= 10) +// g_simple_action_set_state (action, value); +// } +// +// The handler need not set the state to the requested value. It could set it to +// any value at all, or take some other action. +func (simple *SimpleAction) ConnectChangeState(f func(value *glib.Variant)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(simple, "change-state", false, unsafe.Pointer(C._gotk4_gio2_SimpleAction_ConnectChangeState), f) +} + +// NewSimpleAction creates a new action. +// +// The created action is stateless. See g_simple_action_new_stateful() to create +// an action that has state. +// +// The function takes the following parameters: +// +// - name of the action. +// - parameterType (optional): type of parameter that will be passed to +// handlers for the Action::activate signal, or NULL for no parameter. +// +// The function returns the following values: +// +// - simpleAction: new Action. +func NewSimpleAction(name string, parameterType *glib.VariantType) *SimpleAction { + var _arg1 *C.gchar // out + var _arg2 *C.GVariantType // out + var _cret *C.GSimpleAction // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + if parameterType != nil { + _arg2 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(parameterType))) + } + + _cret = C.g_simple_action_new(_arg1, _arg2) + runtime.KeepAlive(name) + runtime.KeepAlive(parameterType) + + var _simpleAction *SimpleAction // out + + _simpleAction = wrapSimpleAction(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _simpleAction +} + +// NewSimpleActionStateful creates a new stateful action. +// +// All future state values must have the same Type as the initial state. +// +// If the state #GVariant is floating, it is consumed. +// +// The function takes the following parameters: +// +// - name of the action. +// - parameterType (optional): type of the parameter that will be passed to +// handlers for the Action::activate signal, or NULL for no parameter. +// - state: initial state of the action. +// +// The function returns the following values: +// +// - simpleAction: new Action. +func NewSimpleActionStateful(name string, parameterType *glib.VariantType, state *glib.Variant) *SimpleAction { + var _arg1 *C.gchar // out + var _arg2 *C.GVariantType // out + var _arg3 *C.GVariant // out + var _cret *C.GSimpleAction // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + if parameterType != nil { + _arg2 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(parameterType))) + } + _arg3 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(state))) + + _cret = C.g_simple_action_new_stateful(_arg1, _arg2, _arg3) + runtime.KeepAlive(name) + runtime.KeepAlive(parameterType) + runtime.KeepAlive(state) + + var _simpleAction *SimpleAction // out + + _simpleAction = wrapSimpleAction(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _simpleAction +} + +// SetEnabled sets the action as enabled or not. +// +// An action must be enabled in order to be activated or in order to have its +// state changed from outside callers. +// +// This should only be called by the implementor of the action. Users of the +// action should not attempt to modify its enabled flag. +// +// The function takes the following parameters: +// +// - enabled: whether the action is enabled. +func (simple *SimpleAction) SetEnabled(enabled bool) { + var _arg0 *C.GSimpleAction // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSimpleAction)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + if enabled { + _arg1 = C.TRUE + } + + C.g_simple_action_set_enabled(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(enabled) +} + +// SetState sets the state of the action. +// +// This directly updates the 'state' property to the given value. +// +// This should only be called by the implementor of the action. Users of the +// action should not attempt to directly modify the 'state' property. Instead, +// they should call g_action_change_state() to request the change. +// +// If the value GVariant is floating, it is consumed. +// +// The function takes the following parameters: +// +// - value: new #GVariant for the state. +func (simple *SimpleAction) SetState(value *glib.Variant) { + var _arg0 *C.GSimpleAction // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GSimpleAction)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + C.g_simple_action_set_state(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(value) +} + +// SetStateHint sets the state hint for the action. +// +// See g_action_get_state_hint() for more information about action state hints. +// +// The function takes the following parameters: +// +// - stateHint (optional) representing the state hint. +func (simple *SimpleAction) SetStateHint(stateHint *glib.Variant) { + var _arg0 *C.GSimpleAction // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GSimpleAction)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + if stateHint != nil { + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(stateHint))) + } + + C.g_simple_action_set_state_hint(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(stateHint) +} + +// SimpleActionGroupOverrides contains methods that are overridable. +type SimpleActionGroupOverrides struct { +} + +func defaultSimpleActionGroupOverrides(v *SimpleActionGroup) SimpleActionGroupOverrides { + return SimpleActionGroupOverrides{} +} + +// SimpleActionGroup: GSimpleActionGroup is a hash table filled with gio.Action +// objects, implementing the gio.ActionGroup and gio.ActionMap interfaces. +type SimpleActionGroup struct { + _ [0]func() // equal guard + *coreglib.Object + + ActionGroup + ActionMap +} + +var ( + _ coreglib.Objector = (*SimpleActionGroup)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*SimpleActionGroup, *SimpleActionGroupClass, SimpleActionGroupOverrides]( + GTypeSimpleActionGroup, + initSimpleActionGroupClass, + wrapSimpleActionGroup, + defaultSimpleActionGroupOverrides, + ) +} + +func initSimpleActionGroupClass(gclass unsafe.Pointer, overrides SimpleActionGroupOverrides, classInitFunc func(*SimpleActionGroupClass)) { + if classInitFunc != nil { + class := (*SimpleActionGroupClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSimpleActionGroup(obj *coreglib.Object) *SimpleActionGroup { + return &SimpleActionGroup{ + Object: obj, + ActionGroup: ActionGroup{ + Object: obj, + }, + ActionMap: ActionMap{ + Object: obj, + }, + } +} + +func marshalSimpleActionGroup(p uintptr) (interface{}, error) { + return wrapSimpleActionGroup(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewSimpleActionGroup creates a new, empty, ActionGroup. +// +// The function returns the following values: +// +// - simpleActionGroup: new ActionGroup. +func NewSimpleActionGroup() *SimpleActionGroup { + var _cret *C.GSimpleActionGroup // in + + _cret = C.g_simple_action_group_new() + + var _simpleActionGroup *SimpleActionGroup // out + + _simpleActionGroup = wrapSimpleActionGroup(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _simpleActionGroup +} + +// AddEntries: convenience function for creating multiple Action instances and +// adding them to the action group. +// +// Deprecated: Use g_action_map_add_action_entries(). +// +// The function takes the following parameters: +// +// - entries: pointer to the first item in an array of Entry structs. +// - userData (optional): user data for signal connections. +func (simple *SimpleActionGroup) AddEntries(entries []ActionEntry, userData unsafe.Pointer) { + var _arg0 *C.GSimpleActionGroup // out + var _arg1 *C.GActionEntry // out + var _arg2 C.gint + var _arg3 C.gpointer // out + + _arg0 = (*C.GSimpleActionGroup)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + _arg2 = (C.gint)(len(entries)) + _arg1 = (*C.GActionEntry)(C.calloc(C.size_t(len(entries)), C.size_t(C.sizeof_GActionEntry))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GActionEntry)(_arg1), len(entries)) + for i := range entries { + out[i] = *(*C.GActionEntry)(gextras.StructNative(unsafe.Pointer((&entries[i])))) + } + } + _arg3 = (C.gpointer)(unsafe.Pointer(userData)) + + C.g_simple_action_group_add_entries(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(simple) + runtime.KeepAlive(entries) + runtime.KeepAlive(userData) +} + +// Insert adds an action to the action group. +// +// If the action group already contains an action with the same name as action +// then the old action is dropped from the group. +// +// The action group takes its own reference on action. +// +// Deprecated: Use g_action_map_add_action(). +// +// The function takes the following parameters: +// +// - action: #GAction. +func (simple *SimpleActionGroup) Insert(action Actioner) { + var _arg0 *C.GSimpleActionGroup // out + var _arg1 *C.GAction // out + + _arg0 = (*C.GSimpleActionGroup)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + _arg1 = (*C.GAction)(unsafe.Pointer(coreglib.InternObject(action).Native())) + + C.g_simple_action_group_insert(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(action) +} + +// Lookup looks up the action with the name action_name in the group. +// +// If no such action exists, returns NULL. +// +// Deprecated: Use g_action_map_lookup_action(). +// +// The function takes the following parameters: +// +// - actionName: name of an action. +// +// The function returns the following values: +// +// - action or NULL. +func (simple *SimpleActionGroup) Lookup(actionName string) *Action { + var _arg0 *C.GSimpleActionGroup // out + var _arg1 *C.gchar // out + var _cret *C.GAction // in + + _arg0 = (*C.GSimpleActionGroup)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_simple_action_group_lookup(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(actionName) + + var _action *Action // out + + _action = wrapAction(coreglib.Take(unsafe.Pointer(_cret))) + + return _action +} + +// Remove removes the named action from the action group. +// +// If no action of this name is in the group then nothing happens. +// +// Deprecated: Use g_action_map_remove_action(). +// +// The function takes the following parameters: +// +// - actionName: name of the action. +func (simple *SimpleActionGroup) Remove(actionName string) { + var _arg0 *C.GSimpleActionGroup // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GSimpleActionGroup)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_simple_action_group_remove(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(actionName) +} + +// SimpleAsyncResult as of GLib 2.46, GSimpleAsyncResult is deprecated in favor +// of gio.Task, which provides a simpler API. +// +// GSimpleAsyncResult implements gio.AsyncResult. +// +// GSimpleAsyncResult handles gio.AsyncReadyCallbacks, error reporting, +// operation cancellation and the final state of an operation, completely +// transparent to the application. Results can be returned as a pointer e.g. +// for functions that return data that is collected asynchronously, a boolean +// value for checking the success or failure of an operation, or a gssize for +// operations which return the number of bytes modified by the operation; +// all of the simple return cases are covered. +// +// Most of the time, an application will not need to know of the details of this +// API; it is handled transparently, and any necessary operations are handled +// by gio.AsyncResult’s interface. However, if implementing a new GIO module, +// for writing language bindings, or for complex applications that need better +// control of how asynchronous operations are completed, it is important to +// understand this functionality. +// +// GSimpleAsyncResults are tagged with the calling function to ensure that +// asynchronous functions and their finishing functions are used together +// correctly. +// +// To create a new GSimpleAsyncResult, call gio.SimpleAsyncResult.New. +// If the result needs to be created for a GError, use +// gio.SimpleAsyncResult.NewFromError or gio.SimpleAsyncResult.NewTakeError. +// If a GError is not available (e.g. the asynchronous operation doesn’t +// take a GError argument), but the result still needs to be created +// for an error condition, use gio.SimpleAsyncResult.NewError (or +// gio.SimpleAsyncResult.SetErrorVa() if your application or binding requires +// passing a variable argument list directly), and the error can then be +// propagated through the use of gio.SimpleAsyncResult.PropagateError(). +// +// An asynchronous operation can be made to ignore a cancellation event +// by calling gio.SimpleAsyncResult.SetHandleCancellation() with a +// GSimpleAsyncResult for the operation and FALSE. This is useful for operations +// that are dangerous to cancel, such as close (which would cause a leak if +// cancelled before being run). +// +// GSimpleAsyncResult can integrate into GLib’s event loop, glib.MainLoop, +// or it can use glib.Threads. gio.SimpleAsyncResult.Complete() will +// finish an I/O task directly from the point where it is called. +// gio.SimpleAsyncResult.CompleteInIdle() will finish it from an idle handler in +// the thread-default main context (see glib.MainContext.PushThreadDefault()) +// where the GSimpleAsyncResult was created. gio.SimpleAsyncResult.RunInThread() +// will run the job in a separate thread and then use +// gio.SimpleAsyncResult.CompleteInIdle() to deliver the result. +// +// To set the results of an asynchronous function, +// gio.SimpleAsyncResult.SetOpResGpointer(), +// gio.SimpleAsyncResult.SetOpResGboolean(), and +// gio.SimpleAsyncResult.SetOpResGssize() are provided, setting the operation's +// result to a gpointer, gboolean, or gssize, respectively. +// +// Likewise, to get the result of an asynchronous +// function, gio.SimpleAsyncResult.GetOpResGpointer(), +// gio.SimpleAsyncResult.GetOpResGboolean(), and +// gio.SimpleAsyncResult.GetOpResGssize() are provided, getting the operation’s +// result as a gpointer, gboolean, and gssize, respectively. +// +// For the details of the requirements implementations must respect, see +// gio.AsyncResult. A typical implementation of an asynchronous operation using +// GSimpleAsyncResult looks something like this: +// +// static void +// baked_cb (Cake *cake, +// gpointer user_data) +// { +// // In this example, this callback is not given a reference to the cake, +// // so the GSimpleAsyncResult has to take a reference to it. +// GSimpleAsyncResult *result = user_data; +// +// if (cake == NULL) +// g_simple_async_result_set_error (result, +// BAKER_ERRORS, +// BAKER_ERROR_NO_FLOUR, +// "Go to the supermarket"); +// else +// g_simple_async_result_set_op_res_gpointer (result, +// g_object_ref (cake), +// g_object_unref); +// +// +// // In this example, we assume that baked_cb is called as a callback from +// // the mainloop, so it's safe to complete the operation synchronously here. +// // If, however, _baker_prepare_cake () might call its callback without +// // first returning to the mainloop — inadvisable, but some APIs do so — +// // we would need to use g_simple_async_result_complete_in_idle(). +// g_simple_async_result_complete (result); +// g_object_unref (result); +// } +// +// void +// baker_bake_cake_async (Baker *self, +// guint radius, +// GAsyncReadyCallback callback, +// gpointer user_data) +// { +// GSimpleAsyncResult *simple; +// Cake *cake; +// +// if (radius < 3) +// { +// g_simple_async_report_error_in_idle (G_OBJECT (self), +// callback, +// user_data, +// BAKER_ERRORS, +// BAKER_ERROR_TOO_SMALL, +// "ucm radius cakes are silly", +// radius); +// return; +// } +// +// simple = g_simple_async_result_new (G_OBJECT (self), +// callback, +// user_data, +// baker_bake_cake_async); +// cake = _baker_get_cached_cake (self, radius); +// +// if (cake != NULL) +// { +// g_simple_async_result_set_op_res_gpointer (simple, +// g_object_ref (cake), +// g_object_unref); +// g_simple_async_result_complete_in_idle (simple); +// g_object_unref (simple); +// // Drop the reference returned by _baker_get_cached_cake(); +// // the GSimpleAsyncResult has taken its own reference. +// g_object_unref (cake); +// return; +// } +// +// _baker_prepare_cake (self, radius, baked_cb, simple); +// } +// +// Cake * +// baker_bake_cake_finish (Baker *self, +// GAsyncResult *result, +// GError **error) +// { +// GSimpleAsyncResult *simple; +// Cake *cake; +// +// g_return_val_if_fail (g_simple_async_result_is_valid (result, +// G_OBJECT (self), +// baker_bake_cake_async), +// NULL); +// +// simple = (GSimpleAsyncResult *) result; +// +// if (g_simple_async_result_propagate_error (simple, error)) +// return NULL; +// +// cake = CAKE (g_simple_async_result_get_op_res_gpointer (simple)); +// return g_object_ref (cake); +// }. +type SimpleAsyncResult struct { + _ [0]func() // equal guard + *coreglib.Object + + AsyncResult +} + +var ( + _ coreglib.Objector = (*SimpleAsyncResult)(nil) +) + +func wrapSimpleAsyncResult(obj *coreglib.Object) *SimpleAsyncResult { + return &SimpleAsyncResult{ + Object: obj, + AsyncResult: AsyncResult{ + Object: obj, + }, + } +} + +func marshalSimpleAsyncResult(p uintptr) (interface{}, error) { + return wrapSimpleAsyncResult(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewSimpleAsyncResult creates a AsyncResult. +// +// The common convention is to create the AsyncResult in the function that +// starts the asynchronous operation and use that same function as the +// source_tag. +// +// If your operation supports cancellation with #GCancellable (which it +// probably should) then you should provide the user's cancellable to +// g_simple_async_result_set_check_cancellable() immediately after this function +// returns. +// +// Deprecated: Use g_task_new() instead. +// +// The function takes the following parameters: +// +// - sourceObject (optional) or NULL. +// - callback (optional): ReadyCallback. +// - sourceTag (optional) asynchronous function. +// +// The function returns the following values: +// +// - simpleAsyncResult: AsyncResult. +func NewSimpleAsyncResult(sourceObject *coreglib.Object, callback AsyncReadyCallback, sourceTag unsafe.Pointer) *SimpleAsyncResult { + var _arg1 *C.GObject // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + var _arg4 C.gpointer // out + var _cret *C.GSimpleAsyncResult // in + + if sourceObject != nil { + _arg1 = (*C.GObject)(unsafe.Pointer(sourceObject.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + _arg4 = (C.gpointer)(unsafe.Pointer(sourceTag)) + + _cret = C.g_simple_async_result_new(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(sourceObject) + runtime.KeepAlive(callback) + runtime.KeepAlive(sourceTag) + + var _simpleAsyncResult *SimpleAsyncResult // out + + _simpleAsyncResult = wrapSimpleAsyncResult(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _simpleAsyncResult +} + +// NewSimpleAsyncResultFromError creates a AsyncResult from an error condition. +// +// Deprecated: Use g_task_new() and g_task_return_error() instead. +// +// The function takes the following parameters: +// +// - sourceObject (optional) or NULL. +// - callback (optional): ReadyCallback. +// - err: #GError. +// +// The function returns the following values: +// +// - simpleAsyncResult: AsyncResult. +func NewSimpleAsyncResultFromError(sourceObject *coreglib.Object, callback AsyncReadyCallback, err error) *SimpleAsyncResult { + var _arg1 *C.GObject // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + var _arg4 *C.GError // out + var _cret *C.GSimpleAsyncResult // in + + if sourceObject != nil { + _arg1 = (*C.GObject)(unsafe.Pointer(sourceObject.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + if err != nil { + _arg4 = (*C.GError)(gerror.New(err)) + } + + _cret = C.g_simple_async_result_new_from_error(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(sourceObject) + runtime.KeepAlive(callback) + runtime.KeepAlive(err) + + var _simpleAsyncResult *SimpleAsyncResult // out + + _simpleAsyncResult = wrapSimpleAsyncResult(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _simpleAsyncResult +} + +// Complete completes an asynchronous I/O job immediately. Must be called +// in the thread where the asynchronous result was to be delivered, +// as it invokes the callback directly. If you are in a different thread use +// g_simple_async_result_complete_in_idle(). +// +// Calling this function takes a reference to simple for as long as is needed to +// complete the call. +// +// Deprecated: Use #GTask instead. +func (simple *SimpleAsyncResult) Complete() { + var _arg0 *C.GSimpleAsyncResult // out + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + + C.g_simple_async_result_complete(_arg0) + runtime.KeepAlive(simple) +} + +// CompleteInIdle completes an asynchronous function in an idle handler in the +// [thread-default main context][g-main-context-push-thread-default] of the +// thread that simple was initially created in (and re-pushes that context +// around the invocation of the callback). +// +// Calling this function takes a reference to simple for as long as is needed to +// complete the call. +// +// Deprecated: Use #GTask instead. +func (simple *SimpleAsyncResult) CompleteInIdle() { + var _arg0 *C.GSimpleAsyncResult // out + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + + C.g_simple_async_result_complete_in_idle(_arg0) + runtime.KeepAlive(simple) +} + +// OpResGboolean gets the operation result boolean from within the asynchronous +// result. +// +// Deprecated: Use #GTask and g_task_propagate_boolean() instead. +// +// The function returns the following values: +// +// - ok: TRUE if the operation's result was TRUE, FALSE if the operation's +// result was FALSE. +func (simple *SimpleAsyncResult) OpResGboolean() bool { + var _arg0 *C.GSimpleAsyncResult // out + var _cret C.gboolean // in + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + + _cret = C.g_simple_async_result_get_op_res_gboolean(_arg0) + runtime.KeepAlive(simple) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// OpResGssize gets a gssize from the asynchronous result. +// +// Deprecated: Use #GTask and g_task_propagate_int() instead. +// +// The function returns the following values: +// +// - gssize returned from the asynchronous function. +func (simple *SimpleAsyncResult) OpResGssize() int { + var _arg0 *C.GSimpleAsyncResult // out + var _cret C.gssize // in + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + + _cret = C.g_simple_async_result_get_op_res_gssize(_arg0) + runtime.KeepAlive(simple) + + var _gssize int // out + + _gssize = int(_cret) + + return _gssize +} + +// PropagateError propagates an error from within the simple asynchronous result +// to a given destination. +// +// If the #GCancellable given to a prior call to +// g_simple_async_result_set_check_cancellable() is cancelled then this function +// will return TRUE with dest set appropriately. +// +// Deprecated: Use #GTask instead. +func (simple *SimpleAsyncResult) PropagateError() error { + var _arg0 *C.GSimpleAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + + C.g_simple_async_result_propagate_error(_arg0, &_cerr) + runtime.KeepAlive(simple) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetCheckCancellable sets a #GCancellable to check before dispatching results. +// +// This function has one very specific purpose: the provided cancellable is +// checked at the time of g_simple_async_result_propagate_error() If it is +// cancelled, these functions will return an "Operation was cancelled" error +// (G_IO_ERROR_CANCELLED). +// +// Implementors of cancellable asynchronous functions should use this in order +// to provide a guarantee to their callers that cancelling an async operation +// will reliably result in an error being returned for that operation (even if +// a positive result for the operation has already been sent as an idle to the +// main context to be dispatched). +// +// The checking described above is done regardless of any call to the unrelated +// g_simple_async_result_set_handle_cancellation() function. +// +// Deprecated: Use #GTask instead. +// +// The function takes the following parameters: +// +// - ctx (optional) to check, or NULL to unset. +func (simple *SimpleAsyncResult) SetCheckCancellable(ctx context.Context) { + var _arg0 *C.GSimpleAsyncResult // out + var _arg1 *C.GCancellable // out + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_simple_async_result_set_check_cancellable(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(ctx) +} + +// SetFromError sets the result from a #GError. +// +// Deprecated: Use #GTask and g_task_return_error() instead. +// +// The function takes the following parameters: +// +// - err: #GError. +func (simple *SimpleAsyncResult) SetFromError(err error) { + var _arg0 *C.GSimpleAsyncResult // out + var _arg1 *C.GError // out + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + + C.g_simple_async_result_set_from_error(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(err) +} + +// SetHandleCancellation sets whether to handle cancellation within the +// asynchronous operation. +// +// This function has nothing to do with +// g_simple_async_result_set_check_cancellable(). It only refers to the +// #GCancellable passed to g_simple_async_result_run_in_thread(). +// +// Deprecated: since version 2.46. +// +// The function takes the following parameters: +// +// - handleCancellation: #gboolean. +func (simple *SimpleAsyncResult) SetHandleCancellation(handleCancellation bool) { + var _arg0 *C.GSimpleAsyncResult // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + if handleCancellation { + _arg1 = C.TRUE + } + + C.g_simple_async_result_set_handle_cancellation(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(handleCancellation) +} + +// SetOpResGboolean sets the operation result to a boolean within the +// asynchronous result. +// +// Deprecated: Use #GTask and g_task_return_boolean() instead. +// +// The function takes the following parameters: +// +// - opRes: #gboolean. +func (simple *SimpleAsyncResult) SetOpResGboolean(opRes bool) { + var _arg0 *C.GSimpleAsyncResult // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + if opRes { + _arg1 = C.TRUE + } + + C.g_simple_async_result_set_op_res_gboolean(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(opRes) +} + +// SetOpResGssize sets the operation result within the asynchronous result to +// the given op_res. +// +// Deprecated: Use #GTask and g_task_return_int() instead. +// +// The function takes the following parameters: +// +// - opRes: #gssize. +func (simple *SimpleAsyncResult) SetOpResGssize(opRes int) { + var _arg0 *C.GSimpleAsyncResult // out + var _arg1 C.gssize // out + + _arg0 = (*C.GSimpleAsyncResult)(unsafe.Pointer(coreglib.InternObject(simple).Native())) + _arg1 = C.gssize(opRes) + + C.g_simple_async_result_set_op_res_gssize(_arg0, _arg1) + runtime.KeepAlive(simple) + runtime.KeepAlive(opRes) +} + +// SimpleAsyncResultIsValid ensures that the data passed to the _finish function +// of an async operation is consistent. Three checks are performed. +// +// First, result is checked to ensure that it is really a AsyncResult. Second, +// source is checked to ensure that it matches the source object of result. +// Third, source_tag is checked to ensure that it is equal to the source_tag +// argument given to g_simple_async_result_new() (which, by convention, +// is a pointer to the _async function corresponding to the _finish function +// from which this function is called). (Alternatively, if either source_tag or +// result's source tag is NULL, then the source tag check is skipped.) +// +// Deprecated: Use #GTask and g_task_is_valid() instead. +// +// The function takes the following parameters: +// +// - result passed to the _finish function. +// - source (optional) passed to the _finish function. +// - sourceTag (optional) asynchronous function. +// +// The function returns the following values: +// +// - ok if all checks passed or LSE if any failed. +func SimpleAsyncResultIsValid(result AsyncResulter, source *coreglib.Object, sourceTag unsafe.Pointer) bool { + var _arg1 *C.GAsyncResult // out + var _arg2 *C.GObject // out + var _arg3 C.gpointer // out + var _cret C.gboolean // in + + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + if source != nil { + _arg2 = (*C.GObject)(unsafe.Pointer(source.Native())) + } + _arg3 = (C.gpointer)(unsafe.Pointer(sourceTag)) + + _cret = C.g_simple_async_result_is_valid(_arg1, _arg2, _arg3) + runtime.KeepAlive(result) + runtime.KeepAlive(source) + runtime.KeepAlive(sourceTag) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SimpleIOStream: GSimpleIOStream creates a gio.IOStream from an arbitrary +// gio.InputStream and gio.OutputStream. This allows any pair of input and +// output streams to be used with gio.IOStream methods. +// +// This is useful when you obtained a gio.InputStream and a gio.OutputStream +// by other means, for instance creating them with platform specific methods as +// g_unix_input_stream_new() (../gio-unix/ctor.UnixInputStream.new.html) (from +// gio-unix-2.0.pc / GioUnix-2.0), and you want to take advantage of the methods +// provided by gio.IOStream. +type SimpleIOStream struct { + _ [0]func() // equal guard + IOStream +} + +var ( + _ IOStreamer = (*SimpleIOStream)(nil) +) + +func wrapSimpleIOStream(obj *coreglib.Object) *SimpleIOStream { + return &SimpleIOStream{ + IOStream: IOStream{ + Object: obj, + }, + } +} + +func marshalSimpleIOStream(p uintptr) (interface{}, error) { + return wrapSimpleIOStream(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewSimpleIOStream creates a new IOStream wrapping input_stream and +// output_stream. See also OStream. +// +// The function takes the following parameters: +// +// - inputStream: Stream. +// - outputStream: Stream. +// +// The function returns the following values: +// +// - simpleIOStream: new IOStream instance. +func NewSimpleIOStream(inputStream InputStreamer, outputStream OutputStreamer) *SimpleIOStream { + var _arg1 *C.GInputStream // out + var _arg2 *C.GOutputStream // out + var _cret *C.GIOStream // in + + _arg1 = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(inputStream).Native())) + _arg2 = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(outputStream).Native())) + + _cret = C.g_simple_io_stream_new(_arg1, _arg2) + runtime.KeepAlive(inputStream) + runtime.KeepAlive(outputStream) + + var _simpleIOStream *SimpleIOStream // out + + _simpleIOStream = wrapSimpleIOStream(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _simpleIOStream +} + +// SimplePermission: GSimplePermission is a trivial implementation of +// gio.Permission that represents a permission that is either always or never +// allowed. The value is given at construction and doesn’t change. +// +// Calling gio.Permission.Acquire() or gio.Permission.Release() on a +// GSimplePermission will result in errors. +type SimplePermission struct { + _ [0]func() // equal guard + Permission +} + +var ( + _ Permissioner = (*SimplePermission)(nil) +) + +func wrapSimplePermission(obj *coreglib.Object) *SimplePermission { + return &SimplePermission{ + Permission: Permission{ + Object: obj, + }, + } +} + +func marshalSimplePermission(p uintptr) (interface{}, error) { + return wrapSimplePermission(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewSimplePermission creates a new #GPermission instance that represents an +// action that is either always or never allowed. +// +// The function takes the following parameters: +// +// - allowed: TRUE if the action is allowed. +// +// The function returns the following values: +// +// - simplePermission as a #GPermission. +func NewSimplePermission(allowed bool) *SimplePermission { + var _arg1 C.gboolean // out + var _cret *C.GPermission // in + + if allowed { + _arg1 = C.TRUE + } + + _cret = C.g_simple_permission_new(_arg1) + runtime.KeepAlive(allowed) + + var _simplePermission *SimplePermission // out + + _simplePermission = wrapSimplePermission(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _simplePermission +} + +// SimpleProxyResolverOverrides contains methods that are overridable. +type SimpleProxyResolverOverrides struct { +} + +func defaultSimpleProxyResolverOverrides(v *SimpleProxyResolver) SimpleProxyResolverOverrides { + return SimpleProxyResolverOverrides{} +} + +// SimpleProxyResolver: GSimpleProxyResolver is a simple gio.ProxyResolver +// implementation that handles a single default proxy, multiple +// URI-scheme-specific proxies, and a list of hosts that proxies should not be +// used for. +// +// GSimpleProxyResolver is never the default proxy resolver, but it can be used +// as the base class for another proxy resolver implementation, or it can be +// created and used manually, such as with gio.SocketClient.SetProxyResolver(). +type SimpleProxyResolver struct { + _ [0]func() // equal guard + *coreglib.Object + + ProxyResolver +} + +var ( + _ coreglib.Objector = (*SimpleProxyResolver)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*SimpleProxyResolver, *SimpleProxyResolverClass, SimpleProxyResolverOverrides]( + GTypeSimpleProxyResolver, + initSimpleProxyResolverClass, + wrapSimpleProxyResolver, + defaultSimpleProxyResolverOverrides, + ) +} + +func initSimpleProxyResolverClass(gclass unsafe.Pointer, overrides SimpleProxyResolverOverrides, classInitFunc func(*SimpleProxyResolverClass)) { + if classInitFunc != nil { + class := (*SimpleProxyResolverClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSimpleProxyResolver(obj *coreglib.Object) *SimpleProxyResolver { + return &SimpleProxyResolver{ + Object: obj, + ProxyResolver: ProxyResolver{ + Object: obj, + }, + } +} + +func marshalSimpleProxyResolver(p uintptr) (interface{}, error) { + return wrapSimpleProxyResolver(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// SetDefaultProxy sets the default proxy on resolver, to be used for any +// URIs that don't match ProxyResolver:ignore-hosts or a proxy set via +// g_simple_proxy_resolver_set_uri_proxy(). +// +// If default_proxy starts with "socks://", ProxyResolver will treat it as +// referring to all three of the socks5, socks4a, and socks4 proxy types. +// +// The function takes the following parameters: +// +// - defaultProxy (optional): default proxy to use. +func (resolver *SimpleProxyResolver) SetDefaultProxy(defaultProxy string) { + var _arg0 *C.GSimpleProxyResolver // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GSimpleProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + if defaultProxy != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(defaultProxy))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_simple_proxy_resolver_set_default_proxy(_arg0, _arg1) + runtime.KeepAlive(resolver) + runtime.KeepAlive(defaultProxy) +} + +// SetURIProxy adds a URI-scheme-specific proxy to resolver; URIs whose scheme +// matches uri_scheme (and which don't match ProxyResolver:ignore-hosts) will be +// proxied via proxy. +// +// As with ProxyResolver:default-proxy, if proxy starts with "socks://", +// ProxyResolver will treat it as referring to all three of the socks5, socks4a, +// and socks4 proxy types. +// +// The function takes the following parameters: +// +// - uriScheme: URI scheme to add a proxy for. +// - proxy to use for uri_scheme. +func (resolver *SimpleProxyResolver) SetURIProxy(uriScheme, proxy string) { + var _arg0 *C.GSimpleProxyResolver // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GSimpleProxyResolver)(unsafe.Pointer(coreglib.InternObject(resolver).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uriScheme))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(proxy))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_simple_proxy_resolver_set_uri_proxy(_arg0, _arg1, _arg2) + runtime.KeepAlive(resolver) + runtime.KeepAlive(uriScheme) + runtime.KeepAlive(proxy) +} + +// NewSimpleProxyResolver creates a new ProxyResolver. See +// ProxyResolver:default-proxy and ProxyResolver:ignore-hosts for more details +// on how the arguments are interpreted. +// +// The function takes the following parameters: +// +// - defaultProxy (optional): default proxy to use, eg "socks://192.168.1.1". +// - ignoreHosts (optional): optional list of hosts/IP addresses to not use a +// proxy for. +// +// The function returns the following values: +// +// - proxyResolver: new ProxyResolver. +func NewSimpleProxyResolver(defaultProxy string, ignoreHosts []string) *ProxyResolver { + var _arg1 *C.gchar // out + var _arg2 **C.gchar // out + var _cret *C.GProxyResolver // in + + if defaultProxy != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(defaultProxy))) + defer C.free(unsafe.Pointer(_arg1)) + } + { + _arg2 = (**C.gchar)(C.calloc(C.size_t((len(ignoreHosts) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice(_arg2, len(ignoreHosts)+1) + var zero *C.gchar + out[len(ignoreHosts)] = zero + for i := range ignoreHosts { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(ignoreHosts[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + _cret = C.g_simple_proxy_resolver_new(_arg1, _arg2) + runtime.KeepAlive(defaultProxy) + runtime.KeepAlive(ignoreHosts) + + var _proxyResolver *ProxyResolver // out + + _proxyResolver = wrapProxyResolver(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _proxyResolver +} + +// SocketOverrides contains methods that are overridable. +type SocketOverrides struct { +} + +func defaultSocketOverrides(v *Socket) SocketOverrides { + return SocketOverrides{} +} + +// Socket: GSocket is a low-level networking primitive. It is a more or less +// direct mapping of the BSD socket API in a portable GObject based API. +// It supports both the UNIX socket implementations and winsock2 on Windows. +// +// GSocket is the platform independent base upon which the higher level +// network primitives are based. Applications are not typically meant to use it +// directly, but rather through classes like gio.SocketClient, gio.SocketService +// and gio.SocketConnection. However there may be cases where direct use of +// GSocket is useful. +// +// GSocket implements the gio.Initable interface, so if it is manually +// constructed by e.g. gobject.Object.New you must call gio.Initable.Init() +// and check the results before using the object. This is done automatically in +// gio.Socket.New and gio.Socket.NewFromFd, so these functions can return NULL. +// +// Sockets operate in two general modes, blocking or non-blocking. +// When in blocking mode all operations (which don’t take an explicit +// blocking parameter) block until the requested operation is finished +// or there is an error. In non-blocking mode all calls that would block +// return immediately with a G_IO_ERROR_WOULD_BLOCK error. To know when a +// call would successfully run you can call gio.Socket.ConditionCheck(), +// or gio.Socket.ConditionWait(). You can also use gio.Socket.CreateSource() +// and attach it to a glib.MainContext to get callbacks when I/O is possible. +// Note that all sockets are always set to non blocking mode in the system, +// and blocking mode is emulated in GSocket. +// +// When working in non-blocking mode applications should always be able to +// handle getting a G_IO_ERROR_WOULD_BLOCK error even when some other function +// said that I/O was possible. This can easily happen in case of a race +// condition in the application, but it can also happen for other reasons. +// For instance, on Windows a socket is always seen as writable until a write +// returns G_IO_ERROR_WOULD_BLOCK. +// +// GSockets can be either connection oriented or datagram based. For connection +// oriented types you must first establish a connection by either connecting to +// an address or accepting a connection from another address. For connectionless +// socket types the target/source address is specified or received in each I/O +// operation. +// +// All socket file descriptors are set to be close-on-exec. +// +// Note that creating a GSocket causes the signal SIGPIPE to be ignored for the +// remainder of the program. If you are writing a command-line utility that uses +// GSocket, you may need to take into account the fact that your program will +// not automatically be killed if it tries to write to stdout after it has been +// closed. +// +// Like most other APIs in GLib, GSocket is not inherently thread safe. +// To use a GSocket concurrently from multiple threads, you must implement your +// own locking. +// +// # Nagle’s algorithm +// +// Since GLib 2.80, GSocket will automatically set the TCP_NODELAY option +// on all G_SOCKET_TYPE_STREAM sockets. This disables Nagle’s algorithm +// (https://en.wikipedia.org/wiki/Nagle27s_algorithm) as it typically does more +// harm than good on modern networks. +// +// If your application needs Nagle’s algorithm enabled, call +// gio.Socket.SetOption() after constructing a GSocket to enable it: +// +// socket = g_socket_new (…, G_SOCKET_TYPE_STREAM, …); +// if (socket != NULL) +// { +// g_socket_set_option (socket, IPPROTO_TCP, TCP_NODELAY, FALSE, &local_error); +// // handle error if needed +// }. +type Socket struct { + _ [0]func() // equal guard + *coreglib.Object + + DatagramBased + Initable +} + +var ( + _ coreglib.Objector = (*Socket)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*Socket, *SocketClass, SocketOverrides]( + GTypeSocket, + initSocketClass, + wrapSocket, + defaultSocketOverrides, + ) +} + +func initSocketClass(gclass unsafe.Pointer, overrides SocketOverrides, classInitFunc func(*SocketClass)) { + if classInitFunc != nil { + class := (*SocketClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSocket(obj *coreglib.Object) *Socket { + return &Socket{ + Object: obj, + DatagramBased: DatagramBased{ + Object: obj, + }, + Initable: Initable{ + Object: obj, + }, + } +} + +func marshalSocket(p uintptr) (interface{}, error) { + return wrapSocket(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewSocket creates a new #GSocket with the defined family, type and protocol. +// If protocol is 0 (G_SOCKET_PROTOCOL_DEFAULT) the default protocol type for +// the family and type is used. +// +// The protocol is a family and type specific int that specifies what kind +// of protocol to use. Protocol lists several common ones. Many families only +// support one protocol, and use 0 for this, others support several and using 0 +// means to use the default protocol for the family and type. +// +// The protocol id is passed directly to the operating system, so you can use +// protocols not listed in Protocol if you know the protocol number used for it. +// +// The function takes the following parameters: +// +// - family: socket family to use, e.g. G_SOCKET_FAMILY_IPV4. +// - typ: socket type to use. +// - protocol: id of the protocol to use, or 0 for default. +// +// The function returns the following values: +// +// - socket or NULL on error. Free the returned object with g_object_unref(). +func NewSocket(family SocketFamily, typ SocketType, protocol SocketProtocol) (*Socket, error) { + var _arg1 C.GSocketFamily // out + var _arg2 C.GSocketType // out + var _arg3 C.GSocketProtocol // out + var _cret *C.GSocket // in + var _cerr *C.GError // in + + _arg1 = C.GSocketFamily(family) + _arg2 = C.GSocketType(typ) + _arg3 = C.GSocketProtocol(protocol) + + _cret = C.g_socket_new(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(family) + runtime.KeepAlive(typ) + runtime.KeepAlive(protocol) + + var _socket *Socket // out + var _goerr error // out + + _socket = wrapSocket(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socket, _goerr +} + +// NewSocketFromFd creates a new #GSocket from a native file descriptor or +// winsock SOCKET handle. +// +// This reads all the settings from the file descriptor so that all properties +// should work. Note that the file descriptor will be set to non-blocking mode, +// independent on the blocking mode of the #GSocket. +// +// On success, the returned #GSocket takes ownership of fd. On failure, +// the caller must close fd themselves. +// +// Since GLib 2.46, it is no longer a fatal error to call this on a non-socket +// descriptor. Instead, a GError will be set with code G_IO_ERROR_FAILED. +// +// The function takes the following parameters: +// +// - fd: native socket file descriptor. +// +// The function returns the following values: +// +// - socket or NULL on error. Free the returned object with g_object_unref(). +func NewSocketFromFd(fd int) (*Socket, error) { + var _arg1 C.gint // out + var _cret *C.GSocket // in + var _cerr *C.GError // in + + _arg1 = C.gint(fd) + + _cret = C.g_socket_new_from_fd(_arg1, &_cerr) + runtime.KeepAlive(fd) + + var _socket *Socket // out + var _goerr error // out + + _socket = wrapSocket(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socket, _goerr +} + +// Accept incoming connections on a connection-based socket. This removes the +// first outstanding connection request from the listening socket and creates a +// #GSocket object for it. +// +// The socket must be bound to a local address with g_socket_bind() and must be +// listening for incoming connections (g_socket_listen()). +// +// If there are no outstanding connections then the operation will block or +// return G_IO_ERROR_WOULD_BLOCK if non-blocking I/O is enabled. To be notified +// of an incoming connection, wait for the G_IO_IN condition. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// +// The function returns the following values: +// +// - ret: new #GSocket, or NULL on error. Free the returned object with +// g_object_unref(). +func (socket *Socket) Accept(ctx context.Context) (*Socket, error) { + var _arg0 *C.GSocket // out + var _arg1 *C.GCancellable // out + var _cret *C.GSocket // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_socket_accept(_arg0, _arg1, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + + var _ret *Socket // out + var _goerr error // out + + _ret = wrapSocket(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// Bind: when a socket is created it is attached to an address family, but it +// doesn't have an address in this family. g_socket_bind() assigns the address +// (sometimes called name) of the socket. +// +// It is generally required to bind to a local address before you can receive +// connections. (See g_socket_listen() and g_socket_accept() ). In certain +// situations, you may also want to bind a socket that will be used to initiate +// connections, though this is not normally required. +// +// If socket is a TCP socket, then allow_reuse controls the setting of the +// SO_REUSEADDR socket option; normally it should be TRUE for server sockets +// (sockets that you will eventually call g_socket_accept() on), and FALSE +// for client sockets. (Failing to set this flag on a server socket may cause +// g_socket_bind() to return G_IO_ERROR_ADDRESS_IN_USE if the server program is +// stopped and then immediately restarted.) +// +// If socket is a UDP socket, then allow_reuse determines whether or not other +// UDP sockets can be bound to the same address at the same time. In particular, +// you can have several UDP sockets bound to the same address, and they will +// all receive all of the multicast and broadcast packets sent to that address. +// (The behavior of unicast UDP packets to an address with multiple listeners is +// not defined.). +// +// The function takes the following parameters: +// +// - address specifying the local address. +// - allowReuse: whether to allow reusing this address. +func (socket *Socket) Bind(address SocketAddresser, allowReuse bool) error { + var _arg0 *C.GSocket // out + var _arg1 *C.GSocketAddress // out + var _arg2 C.gboolean // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + if allowReuse { + _arg2 = C.TRUE + } + + C.g_socket_bind(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(address) + runtime.KeepAlive(allowReuse) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// CheckConnectResult checks and resets the pending connect error for the +// socket. This is used to check for errors when g_socket_connect() is used in +// non-blocking mode. +func (socket *Socket) CheckConnectResult() error { + var _arg0 *C.GSocket // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + C.g_socket_check_connect_result(_arg0, &_cerr) + runtime.KeepAlive(socket) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Close closes the socket, shutting down any active connection. +// +// Closing a socket does not wait for all outstanding I/O operations to finish, +// so the caller should not rely on them to be guaranteed to complete even if +// the close returns with no error. +// +// Once the socket is closed, all other operations will return +// G_IO_ERROR_CLOSED. Closing a socket multiple times will not return an error. +// +// Sockets will be automatically closed when the last reference is dropped, +// but you might want to call this function to make sure resources are released +// as early as possible. +// +// Beware that due to the way that TCP works, it is possible for recently-sent +// data to be lost if either you close a socket while the G_IO_IN condition is +// set, or else if the remote connection tries to send something to you after +// you close the socket but before it has finished reading all of the data you +// sent. There is no easy generic way to avoid this problem; the easiest fix is +// to design the network protocol such that the client will never send data "out +// of turn". Another solution is for the server to half-close the connection by +// calling g_socket_shutdown() with only the shutdown_write flag set, and then +// wait for the client to notice this and close its side of the connection, +// after which the server can safely call g_socket_close(). (This is what +// Connection does if you call g_tcp_connection_set_graceful_disconnect(). +// But of course, this only works if the client will close its connection after +// the server does.). +func (socket *Socket) Close() error { + var _arg0 *C.GSocket // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + C.g_socket_close(_arg0, &_cerr) + runtime.KeepAlive(socket) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ConditionCheck checks on the readiness of socket to perform operations. +// The operations specified in condition are checked for and masked against the +// currently-satisfied conditions on socket. The result is returned. +// +// Note that on Windows, it is possible for an operation to return +// G_IO_ERROR_WOULD_BLOCK even immediately after g_socket_condition_check() +// has claimed that the socket is ready for writing. Rather than calling +// g_socket_condition_check() and then writing to the socket if it succeeds, +// it is generally better to simply try writing to the socket right away, +// and try again later if the initial attempt returns G_IO_ERROR_WOULD_BLOCK. +// +// It is meaningless to specify G_IO_ERR or G_IO_HUP in condition; these +// conditions will always be set in the output if they are true. +// +// This call never blocks. +// +// The function takes the following parameters: +// +// - condition mask to check. +// +// The function returns the following values: +// +// - ioCondition: GIOCondition mask of the current state. +func (socket *Socket) ConditionCheck(condition glib.IOCondition) glib.IOCondition { + var _arg0 *C.GSocket // out + var _arg1 C.GIOCondition // out + var _cret C.GIOCondition // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = C.GIOCondition(condition) + + _cret = C.g_socket_condition_check(_arg0, _arg1) + runtime.KeepAlive(socket) + runtime.KeepAlive(condition) + + var _ioCondition glib.IOCondition // out + + _ioCondition = glib.IOCondition(_cret) + + return _ioCondition +} + +// ConditionTimedWait waits for up to timeout_us microseconds for condition to +// become true on socket. If the condition is met, TRUE is returned. +// +// If cancellable is cancelled before the condition is met, or if timeout_us +// (or the socket's #GSocket:timeout) is reached before the condition is met, +// then FALSE is returned and error, if non-NULL, is set to the appropriate +// value (G_IO_ERROR_CANCELLED or G_IO_ERROR_TIMED_OUT). +// +// If you don't want a timeout, use g_socket_condition_wait(). (Alternatively, +// you can pass -1 for timeout_us.) +// +// Note that although timeout_us is in microseconds for consistency with other +// GLib APIs, this function actually only has millisecond resolution, and the +// behavior is undefined if timeout_us is not an exact number of milliseconds. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - condition mask to wait for. +// - timeoutUs: maximum time (in microseconds) to wait, or -1. +func (socket *Socket) ConditionTimedWait(ctx context.Context, condition glib.IOCondition, timeoutUs int64) error { + var _arg0 *C.GSocket // out + var _arg3 *C.GCancellable // out + var _arg1 C.GIOCondition // out + var _arg2 C.gint64 // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GIOCondition(condition) + _arg2 = C.gint64(timeoutUs) + + C.g_socket_condition_timed_wait(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(condition) + runtime.KeepAlive(timeoutUs) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ConditionWait waits for condition to become true on socket. When the +// condition is met, TRUE is returned. +// +// If cancellable is cancelled before the condition is met, or if the socket +// has a timeout set and it is reached before the condition is met, then +// FALSE is returned and error, if non-NULL, is set to the appropriate value +// (G_IO_ERROR_CANCELLED or G_IO_ERROR_TIMED_OUT). +// +// See also g_socket_condition_timed_wait(). +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - condition mask to wait for. +func (socket *Socket) ConditionWait(ctx context.Context, condition glib.IOCondition) error { + var _arg0 *C.GSocket // out + var _arg2 *C.GCancellable // out + var _arg1 C.GIOCondition // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.GIOCondition(condition) + + C.g_socket_condition_wait(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(condition) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ConnectSocket: connect the socket to the specified remote address. +// +// For connection oriented socket this generally means we attempt to make a +// connection to the address. For a connection-less socket it sets the default +// address for g_socket_send() and discards all incoming datagrams from other +// sources. +// +// Generally connection oriented sockets can only connect once, but +// connection-less sockets can connect multiple times to change the default +// address. +// +// If the connect call needs to do network I/O it will block, unless +// non-blocking I/O is enabled. Then G_IO_ERROR_PENDING is returned and +// the user can be notified of the connection finishing by waiting for the +// G_IO_OUT condition. The result of the connection must then be checked with +// g_socket_check_connect_result(). +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - address specifying the remote address. +func (socket *Socket) ConnectSocket(ctx context.Context, address SocketAddresser) error { + var _arg0 *C.GSocket // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GSocketAddress // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + C.g_socket_connect(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ConnectionFactoryCreateConnection creates a Connection subclass of the right +// type for socket. +// +// The function returns the following values: +// +// - socketConnection: Connection. +func (socket *Socket) ConnectionFactoryCreateConnection() *SocketConnection { + var _arg0 *C.GSocket // out + var _cret *C.GSocketConnection // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_connection_factory_create_connection(_arg0) + runtime.KeepAlive(socket) + + var _socketConnection *SocketConnection // out + + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _socketConnection +} + +// AvailableBytes: get the amount of data pending in the OS input buffer, +// without blocking. +// +// If socket is a UDP or SCTP socket, this will return the size of just the next +// packet, even if additional packets are buffered after that one. +// +// Note that on Windows, this function is rather inefficient in the UDP case, +// and so if you know any plausible upper bound on the size of the incoming +// packet, it is better to just do a g_socket_receive() with a buffer of that +// size, rather than calling g_socket_get_available_bytes() first and then doing +// a receive of exactly the right size. +// +// The function returns the following values: +// +// - gssize: number of bytes that can be read from the socket without blocking +// or truncating, or -1 on error. +func (socket *Socket) AvailableBytes() int { + var _arg0 *C.GSocket // out + var _cret C.gssize // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_available_bytes(_arg0) + runtime.KeepAlive(socket) + + var _gssize int // out + + _gssize = int(_cret) + + return _gssize +} + +// Blocking gets the blocking mode of the socket. For details on blocking I/O, +// see g_socket_set_blocking(). +// +// The function returns the following values: +// +// - ok: TRUE if blocking I/O is used, FALSE otherwise. +func (socket *Socket) Blocking() bool { + var _arg0 *C.GSocket // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_blocking(_arg0) + runtime.KeepAlive(socket) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Broadcast gets the broadcast setting on socket; if TRUE, it is possible to +// send packets to broadcast addresses. +// +// The function returns the following values: +// +// - ok: broadcast setting on socket. +func (socket *Socket) Broadcast() bool { + var _arg0 *C.GSocket // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_broadcast(_arg0) + runtime.KeepAlive(socket) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Credentials returns the credentials of the foreign process connected to this +// socket, if any (e.g. it is only supported for G_SOCKET_FAMILY_UNIX sockets). +// +// If this operation isn't supported on the OS, the method fails with the +// G_IO_ERROR_NOT_SUPPORTED error. On Linux this is implemented by reading the +// SO_PEERCRED option on the underlying socket. +// +// This method can be expected to be available on the following platforms: +// +// - Linux since GLib 2.26 +// +// - OpenBSD since GLib 2.30 +// +// - Solaris, Illumos and OpenSolaris since GLib 2.40 +// +// - NetBSD since GLib 2.42 +// +// - macOS, tvOS, iOS since GLib 2.66 +// +// Other ways to obtain credentials from a foreign peer includes the +// CredentialsMessage type and g_unix_connection_send_credentials() / +// g_unix_connection_receive_credentials() functions. +// +// The function returns the following values: +// +// - credentials: NULL if error is set, otherwise a #GCredentials object that +// must be freed with g_object_unref(). +func (socket *Socket) Credentials() (*Credentials, error) { + var _arg0 *C.GSocket // out + var _cret *C.GCredentials // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_credentials(_arg0, &_cerr) + runtime.KeepAlive(socket) + + var _credentials *Credentials // out + var _goerr error // out + + _credentials = wrapCredentials(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _credentials, _goerr +} + +// Family gets the socket family of the socket. +// +// The function returns the following values: +// +// - socketFamily: Family. +func (socket *Socket) Family() SocketFamily { + var _arg0 *C.GSocket // out + var _cret C.GSocketFamily // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_family(_arg0) + runtime.KeepAlive(socket) + + var _socketFamily SocketFamily // out + + _socketFamily = SocketFamily(_cret) + + return _socketFamily +} + +// Fd returns the underlying OS socket object. On unix this is a socket file +// descriptor, and on Windows this is a Winsock2 SOCKET handle. This may be +// useful for doing platform specific or otherwise unusual operations on the +// socket. +// +// The function returns the following values: +// +// - gint: file descriptor of the socket. +func (socket *Socket) Fd() int { + var _arg0 *C.GSocket // out + var _cret C.int // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_fd(_arg0) + runtime.KeepAlive(socket) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Keepalive gets the keepalive mode of the socket. For details on this, +// see g_socket_set_keepalive(). +// +// The function returns the following values: +// +// - ok: TRUE if keepalive is active, FALSE otherwise. +func (socket *Socket) Keepalive() bool { + var _arg0 *C.GSocket // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_keepalive(_arg0) + runtime.KeepAlive(socket) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ListenBacklog gets the listen backlog setting of the socket. For details on +// this, see g_socket_set_listen_backlog(). +// +// The function returns the following values: +// +// - gint: maximum number of pending connections. +func (socket *Socket) ListenBacklog() int { + var _arg0 *C.GSocket // out + var _cret C.gint // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_listen_backlog(_arg0) + runtime.KeepAlive(socket) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// LocalAddress: try to get the local address of a bound socket. This is only +// useful if the socket has been bound to a local address, either explicitly or +// implicitly when connecting. +// +// The function returns the following values: +// +// - socketAddress or NULL on error. Free the returned object with +// g_object_unref(). +func (socket *Socket) LocalAddress() (SocketAddresser, error) { + var _arg0 *C.GSocket // out + var _cret *C.GSocketAddress // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_local_address(_arg0, &_cerr) + runtime.KeepAlive(socket) + + var _socketAddress SocketAddresser // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.SocketAddresser is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _socketAddress = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketAddress, _goerr +} + +// MulticastLoopback gets the multicast loopback setting on socket; if TRUE +// (the default), outgoing multicast packets will be looped back to multicast +// listeners on the same host. +// +// The function returns the following values: +// +// - ok: multicast loopback setting on socket. +func (socket *Socket) MulticastLoopback() bool { + var _arg0 *C.GSocket // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_multicast_loopback(_arg0) + runtime.KeepAlive(socket) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// MulticastTTL gets the multicast time-to-live setting on socket; see +// g_socket_set_multicast_ttl() for more details. +// +// The function returns the following values: +// +// - guint: multicast time-to-live setting on socket. +func (socket *Socket) MulticastTTL() uint { + var _arg0 *C.GSocket // out + var _cret C.guint // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_multicast_ttl(_arg0) + runtime.KeepAlive(socket) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Option gets the value of an integer-valued option on socket, as with +// getsockopt(). (If you need to fetch a non-integer-valued option, you will +// need to call getsockopt() directly.) +// +// The [][gio-gnetworking.h] header pulls in system headers +// that will define most of the standard/portable socket options. For unusual +// socket protocols or platform-dependent options, you may need to include +// additional headers. +// +// Note that even for socket options that are a single byte in size, value is +// still a pointer to a #gint variable, not a #guchar; g_socket_get_option() +// will handle the conversion internally. +// +// The function takes the following parameters: +// +// - level: "API level" of the option (eg, SOL_SOCKET). +// - optname: "name" of the option (eg, SO_BROADCAST). +// +// The function returns the following values: +// +// - value: return location for the option value. +func (socket *Socket) Option(level, optname int) (int, error) { + var _arg0 *C.GSocket // out + var _arg1 C.gint // out + var _arg2 C.gint // out + var _arg3 C.gint // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = C.gint(level) + _arg2 = C.gint(optname) + + C.g_socket_get_option(_arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(level) + runtime.KeepAlive(optname) + + var _value int // out + var _goerr error // out + + _value = int(_arg3) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _value, _goerr +} + +// Protocol gets the socket protocol id the socket was created with. In case the +// protocol is unknown, -1 is returned. +// +// The function returns the following values: +// +// - socketProtocol: protocol id, or -1 if unknown. +func (socket *Socket) Protocol() SocketProtocol { + var _arg0 *C.GSocket // out + var _cret C.GSocketProtocol // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_protocol(_arg0) + runtime.KeepAlive(socket) + + var _socketProtocol SocketProtocol // out + + _socketProtocol = SocketProtocol(_cret) + + return _socketProtocol +} + +// RemoteAddress: try to get the remote address of a connected socket. This is +// only useful for connection oriented sockets that have been connected. +// +// The function returns the following values: +// +// - socketAddress or NULL on error. Free the returned object with +// g_object_unref(). +func (socket *Socket) RemoteAddress() (SocketAddresser, error) { + var _arg0 *C.GSocket // out + var _cret *C.GSocketAddress // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_remote_address(_arg0, &_cerr) + runtime.KeepAlive(socket) + + var _socketAddress SocketAddresser // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.SocketAddresser is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _socketAddress = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketAddress, _goerr +} + +// SocketType gets the socket type of the socket. +// +// The function returns the following values: +// +// - socketType: Type. +func (socket *Socket) SocketType() SocketType { + var _arg0 *C.GSocket // out + var _cret C.GSocketType // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_socket_type(_arg0) + runtime.KeepAlive(socket) + + var _socketType SocketType // out + + _socketType = SocketType(_cret) + + return _socketType +} + +// Timeout gets the timeout setting of the socket. For details on this, +// see g_socket_set_timeout(). +// +// The function returns the following values: +// +// - guint: timeout in seconds. +func (socket *Socket) Timeout() uint { + var _arg0 *C.GSocket // out + var _cret C.guint // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_timeout(_arg0) + runtime.KeepAlive(socket) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// TTL gets the unicast time-to-live setting on socket; see g_socket_set_ttl() +// for more details. +// +// The function returns the following values: +// +// - guint: time-to-live setting on socket. +func (socket *Socket) TTL() uint { + var _arg0 *C.GSocket // out + var _cret C.guint // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_get_ttl(_arg0) + runtime.KeepAlive(socket) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// IsClosed checks whether a socket is closed. +// +// The function returns the following values: +// +// - ok: TRUE if socket is closed, FALSE otherwise. +func (socket *Socket) IsClosed() bool { + var _arg0 *C.GSocket // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_is_closed(_arg0) + runtime.KeepAlive(socket) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsConnected: check whether the socket is connected. This is only useful for +// connection-oriented sockets. +// +// If using g_socket_shutdown(), this function will return TRUE until the +// socket has been shut down for reading and writing. If you do a non-blocking +// connect, this function will not return TRUE until after you call +// g_socket_check_connect_result(). +// +// The function returns the following values: +// +// - ok: TRUE if socket is connected, FALSE otherwise. +func (socket *Socket) IsConnected() bool { + var _arg0 *C.GSocket // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_is_connected(_arg0) + runtime.KeepAlive(socket) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// JoinMulticastGroup registers socket to receive multicast messages sent to +// group. socket must be a G_SOCKET_TYPE_DATAGRAM socket, and must have been +// bound to an appropriate interface and port with g_socket_bind(). +// +// If iface is NULL, the system will automatically pick an interface to bind to +// based on group. +// +// If source_specific is TRUE, source-specific multicast as defined in +// RFC 4604 is used. Note that on older platforms this may fail with a +// G_IO_ERROR_NOT_SUPPORTED error. +// +// To bind to a given source-specific multicast address, use +// g_socket_join_multicast_group_ssm() instead. +// +// The function takes the following parameters: +// +// - group specifying the group address to join. +// - sourceSpecific: TRUE if source-specific multicast should be used. +// - iface (optional): name of the interface to use, or NULL. +func (socket *Socket) JoinMulticastGroup(group *InetAddress, sourceSpecific bool, iface string) error { + var _arg0 *C.GSocket // out + var _arg1 *C.GInetAddress // out + var _arg2 C.gboolean // out + var _arg3 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(group).Native())) + if sourceSpecific { + _arg2 = C.TRUE + } + if iface != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(iface))) + defer C.free(unsafe.Pointer(_arg3)) + } + + C.g_socket_join_multicast_group(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(group) + runtime.KeepAlive(sourceSpecific) + runtime.KeepAlive(iface) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// JoinMulticastGroupSSM registers socket to receive multicast messages sent +// to group. socket must be a G_SOCKET_TYPE_DATAGRAM socket, and must have been +// bound to an appropriate interface and port with g_socket_bind(). +// +// If iface is NULL, the system will automatically pick an interface to bind to +// based on group. +// +// If source_specific is not NULL, use source-specific multicast as +// defined in RFC 4604. Note that on older platforms this may fail with a +// G_IO_ERROR_NOT_SUPPORTED error. +// +// Note that this function can be called multiple times for the same group with +// different source_specific in order to receive multicast packets from more +// than one source. +// +// The function takes the following parameters: +// +// - group specifying the group address to join. +// - sourceSpecific (optional) specifying the source-specific multicast +// address or NULL to ignore. +// - iface (optional): name of the interface to use, or NULL. +func (socket *Socket) JoinMulticastGroupSSM(group, sourceSpecific *InetAddress, iface string) error { + var _arg0 *C.GSocket // out + var _arg1 *C.GInetAddress // out + var _arg2 *C.GInetAddress // out + var _arg3 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(group).Native())) + if sourceSpecific != nil { + _arg2 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(sourceSpecific).Native())) + } + if iface != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(iface))) + defer C.free(unsafe.Pointer(_arg3)) + } + + C.g_socket_join_multicast_group_ssm(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(group) + runtime.KeepAlive(sourceSpecific) + runtime.KeepAlive(iface) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// LeaveMulticastGroup removes socket from the multicast group defined by group, +// iface, and source_specific (which must all have the same values they had when +// you joined the group). +// +// socket remains bound to its address and port, and can still receive unicast +// messages after calling this. +// +// To unbind to a given source-specific multicast address, use +// g_socket_leave_multicast_group_ssm() instead. +// +// The function takes the following parameters: +// +// - group specifying the group address to leave. +// - sourceSpecific: TRUE if source-specific multicast was used. +// - iface (optional): interface used. +func (socket *Socket) LeaveMulticastGroup(group *InetAddress, sourceSpecific bool, iface string) error { + var _arg0 *C.GSocket // out + var _arg1 *C.GInetAddress // out + var _arg2 C.gboolean // out + var _arg3 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(group).Native())) + if sourceSpecific { + _arg2 = C.TRUE + } + if iface != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(iface))) + defer C.free(unsafe.Pointer(_arg3)) + } + + C.g_socket_leave_multicast_group(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(group) + runtime.KeepAlive(sourceSpecific) + runtime.KeepAlive(iface) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// LeaveMulticastGroupSSM removes socket from the multicast group defined by +// group, iface, and source_specific (which must all have the same values they +// had when you joined the group). +// +// socket remains bound to its address and port, and can still receive unicast +// messages after calling this. +// +// The function takes the following parameters: +// +// - group specifying the group address to leave. +// - sourceSpecific (optional) specifying the source-specific multicast +// address or NULL to ignore. +// - iface (optional): name of the interface to use, or NULL. +func (socket *Socket) LeaveMulticastGroupSSM(group, sourceSpecific *InetAddress, iface string) error { + var _arg0 *C.GSocket // out + var _arg1 *C.GInetAddress // out + var _arg2 *C.GInetAddress // out + var _arg3 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(group).Native())) + if sourceSpecific != nil { + _arg2 = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(sourceSpecific).Native())) + } + if iface != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(iface))) + defer C.free(unsafe.Pointer(_arg3)) + } + + C.g_socket_leave_multicast_group_ssm(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(group) + runtime.KeepAlive(sourceSpecific) + runtime.KeepAlive(iface) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Listen marks the socket as a server socket, i.e. a socket that is used to +// accept incoming requests using g_socket_accept(). +// +// Before calling this the socket must be bound to a local address using +// g_socket_bind(). +// +// To set the maximum amount of outstanding clients, use +// g_socket_set_listen_backlog(). +func (socket *Socket) Listen() error { + var _arg0 *C.GSocket // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + C.g_socket_listen(_arg0, &_cerr) + runtime.KeepAlive(socket) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Receive data (up to size bytes) from a socket. This is mainly used by +// connection-oriented sockets; it is identical to g_socket_receive_from() with +// address set to NULL. +// +// For G_SOCKET_TYPE_DATAGRAM and G_SOCKET_TYPE_SEQPACKET sockets, +// g_socket_receive() will always read either 0 or 1 complete messages from the +// socket. If the received message is too large to fit in buffer, then the data +// beyond size bytes will be discarded, without any explicit indication that +// this has occurred. +// +// For G_SOCKET_TYPE_STREAM sockets, g_socket_receive() can return any number of +// bytes, up to size. If more than size bytes have been received, the additional +// data will be returned in future calls to g_socket_receive(). +// +// If the socket is in blocking mode the call will block until there is +// some data to receive, the connection is closed, or there is an error. +// If there is no data available and the socket is in non-blocking mode, +// a G_IO_ERROR_WOULD_BLOCK error will be returned. To be notified when data is +// available, wait for the G_IO_IN condition. +// +// On error -1 is returned and error is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - buffer: a buffer to read data into (which should be at least size bytes +// long). +// +// The function returns the following values: +// +// - gssize: number of bytes read, or 0 if the connection was closed by the +// peer, or -1 on error. +func (socket *Socket) Receive(ctx context.Context, buffer []byte) (int, error) { + var _arg0 *C.GSocket // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + _arg1 = (*C.gchar)(C.CBytes(buffer)) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_socket_receive(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// ReceiveBytes receives data (up to size bytes) from a socket. +// +// This function is a variant of gio.Socket.Receive() which returns a glib.Bytes +// rather than a plain buffer. +// +// Pass -1 to timeout_us to block indefinitely until data is received (or the +// connection is closed, or there is an error). Pass 0 to use the default +// timeout from gio.Socket:timeout, or pass a positive number to wait for that +// many microseconds for data before returning G_IO_ERROR_TIMED_OUT. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable, or NULL. +// - size: number of bytes you want to read from the socket. +// - timeoutUs: timeout to wait for, in microseconds, or -1 to block +// indefinitely. +// +// The function returns the following values: +// +// - bytes buffer containing the received bytes, or NULL on error. +func (socket *Socket) ReceiveBytes(ctx context.Context, size uint, timeoutUs int64) (*glib.Bytes, error) { + var _arg0 *C.GSocket // out + var _arg3 *C.GCancellable // out + var _arg1 C.gsize // out + var _arg2 C.gint64 // out + var _cret *C.GBytes // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gsize(size) + _arg2 = C.gint64(timeoutUs) + + _cret = C.g_socket_receive_bytes(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(size) + runtime.KeepAlive(timeoutUs) + + var _bytes *glib.Bytes // out + var _goerr error // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytes, _goerr +} + +// ReceiveBytesFrom: receive data (up to size bytes) from a socket. +// +// This function is a variant of gio.Socket.ReceiveFrom() which returns a +// glib.Bytes rather than a plain buffer. +// +// If address is non-NULL then address will be set equal to the source address +// of the received packet. +// +// The address is owned by the caller. +// +// Pass -1 to timeout_us to block indefinitely until data is received (or the +// connection is closed, or there is an error). Pass 0 to use the default +// timeout from gio.Socket:timeout, or pass a positive number to wait for that +// many microseconds for data before returning G_IO_ERROR_TIMED_OUT. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - size: number of bytes you want to read from the socket. +// - timeoutUs: timeout to wait for, in microseconds, or -1 to block +// indefinitely. +// +// The function returns the following values: +// +// - address (optional): return location for a Address. +// - bytes buffer containing the received bytes, or NULL on error. +func (socket *Socket) ReceiveBytesFrom(ctx context.Context, size uint, timeoutUs int64) (SocketAddresser, *glib.Bytes, error) { + var _arg0 *C.GSocket // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GSocketAddress // in + var _arg2 C.gsize // out + var _arg3 C.gint64 // out + var _cret *C.GBytes // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = C.gsize(size) + _arg3 = C.gint64(timeoutUs) + + _cret = C.g_socket_receive_bytes_from(_arg0, &_arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(size) + runtime.KeepAlive(timeoutUs) + + var _address SocketAddresser // out + var _bytes *glib.Bytes // out + var _goerr error // out + + if _arg1 != nil { + { + objptr := unsafe.Pointer(_arg1) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _address = rv + } + } + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _address, _bytes, _goerr +} + +// ReceiveFrom: receive data (up to size bytes) from a socket. +// +// If address is non-NULL then address will be set equal to the source address +// of the received packet. address is owned by the caller. +// +// See g_socket_receive() for additional information. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - buffer: a buffer to read data into (which should be at least size bytes +// long). +// +// The function returns the following values: +// +// - address (optional): pointer to a Address pointer, or NULL. +// - gssize: number of bytes read, or 0 if the connection was closed by the +// peer, or -1 on error. +func (socket *Socket) ReceiveFrom(ctx context.Context, buffer []byte) (SocketAddresser, int, error) { + var _arg0 *C.GSocket // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GSocketAddress // in + var _arg2 *C.gchar // out + var _arg3 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg3 = (C.gsize)(len(buffer)) + _arg2 = (*C.gchar)(C.CBytes(buffer)) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_socket_receive_from(_arg0, &_arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _address SocketAddresser // out + var _gssize int // out + var _goerr error // out + + if _arg1 != nil { + { + objptr := unsafe.Pointer(_arg1) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _address = rv + } + } + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _address, _gssize, _goerr +} + +// ReceiveMessages: receive multiple data messages from socket in one go. +// This is the most complicated and fully-featured version of this call. +// For easier use, see g_socket_receive(), g_socket_receive_from(), and +// g_socket_receive_message(). +// +// messages must point to an array of Message structs and num_messages must +// be the length of this array. Each Message contains a pointer to an array of +// Vector structs describing the buffers that the data received in each message +// will be written to. Using multiple Vectors is more memory-efficient than +// manually copying data out of a single buffer to multiple sources, and more +// system-call-efficient than making multiple calls to g_socket_receive(), +// such as in scenarios where a lot of data packets need to be received (e.g. +// high-bandwidth video streaming over RTP/UDP). +// +// flags modify how all messages are received. The commonly available arguments +// for this are available in the MsgFlags enum, but the values there are the +// same as the system values, and the flags are passed in as-is, so you can +// pass in system-specific flags too. These flags affect the overall receive +// operation. Flags affecting individual messages are returned in Message.flags. +// +// The other members of Message are treated as described in its documentation. +// +// If #GSocket:blocking is TRUE the call will block until num_messages have been +// received, or the end of the stream is reached. +// +// If #GSocket:blocking is FALSE the call will return up to num_messages +// without blocking, or G_IO_ERROR_WOULD_BLOCK if no messages are queued in the +// operating system to be received. +// +// In blocking mode, if #GSocket:timeout is positive and is reached before +// any messages are received, G_IO_ERROR_TIMED_OUT is returned, otherwise up +// to num_messages are returned. (Note: This is effectively the behaviour of +// MSG_WAITFORONE with recvmmsg().) +// +// To be notified when messages are available, wait for the G_IO_IN condition. +// Note though that you may still receive G_IO_ERROR_WOULD_BLOCK from +// g_socket_receive_messages() even if you were previously notified of a G_IO_IN +// condition. +// +// If the remote peer closes the connection, any messages queued in +// the operating system will be returned, and subsequent calls to +// g_socket_receive_messages() will return 0 (with no error set). +// +// On error -1 is returned and error is set accordingly. An error will only be +// returned if zero messages could be received; otherwise the number of messages +// successfully received before the error will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - messages: array of Message structs. +// - flags: int containing MsgFlags flags for the overall operation, +// which may additionally contain other platform specific flags +// (http://man7.org/linux/man-pages/man2/recv.2.html). +// +// The function returns the following values: +// +// - gint: number of messages received, or -1 on error. Note that the number +// of messages received may be smaller than num_messages if in non-blocking +// mode, if the peer closed the connection, or if num_messages was larger +// than UIO_MAXIOV (1024), in which case the caller may re-try to receive +// the remaining messages. +func (socket *Socket) ReceiveMessages(ctx context.Context, messages []InputMessage, flags int) (int, error) { + var _arg0 *C.GSocket // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GInputMessage // out + var _arg2 C.guint + var _arg3 C.gint // out + var _cret C.gint // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.guint)(len(messages)) + _arg1 = (*C.GInputMessage)(C.calloc(C.size_t(len(messages)), C.size_t(C.sizeof_GInputMessage))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GInputMessage)(_arg1), len(messages)) + for i := range messages { + out[i] = *(*C.GInputMessage)(gextras.StructNative(unsafe.Pointer((&messages[i])))) + } + } + _arg3 = C.gint(flags) + + _cret = C.g_socket_receive_messages(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(messages) + runtime.KeepAlive(flags) + + var _gint int // out + var _goerr error // out + + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint, _goerr +} + +// ReceiveWithBlocking: this behaves exactly the same as g_socket_receive(), +// except that the choice of blocking or non-blocking behavior is determined by +// the blocking argument rather than by socket's properties. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - buffer: a buffer to read data into (which should be at least size bytes +// long). +// - blocking: whether to do blocking or non-blocking I/O. +// +// The function returns the following values: +// +// - gssize: number of bytes read, or 0 if the connection was closed by the +// peer, or -1 on error. +func (socket *Socket) ReceiveWithBlocking(ctx context.Context, buffer []byte, blocking bool) (int, error) { + var _arg0 *C.GSocket // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.gsize + var _arg3 C.gboolean // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + _arg1 = (*C.gchar)(C.CBytes(buffer)) + defer C.free(unsafe.Pointer(_arg1)) + if blocking { + _arg3 = C.TRUE + } + + _cret = C.g_socket_receive_with_blocking(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + runtime.KeepAlive(blocking) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// Send tries to send size bytes from buffer on the socket. This is mainly used +// by connection-oriented sockets; it is identical to g_socket_send_to() with +// address set to NULL. +// +// If the socket is in blocking mode the call will block until there is space +// for the data in the socket queue. If there is no space available and the +// socket is in non-blocking mode a G_IO_ERROR_WOULD_BLOCK error will be +// returned. To be notified when space is available, wait for the G_IO_OUT +// condition. Note though that you may still receive G_IO_ERROR_WOULD_BLOCK from +// g_socket_send() even if you were previously notified of a G_IO_OUT condition. +// (On Windows in particular, this is very common due to the way the underlying +// APIs work.) +// +// On error -1 is returned and error is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - buffer: buffer containing the data to send. +// +// The function returns the following values: +// +// - gssize: number of bytes written (which may be less than size), or -1 on +// error. +func (socket *Socket) Send(ctx context.Context, buffer string) (int, error) { + var _arg0 *C.GSocket // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(buffer) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(buffer)), buffer) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_socket_send(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// SendMessage: send data to address on socket. For sending multiple messages +// see g_socket_send_messages(); for easier use, see g_socket_send() and +// g_socket_send_to(). +// +// If address is NULL then the message is sent to the default receiver (set by +// g_socket_connect()). +// +// vectors must point to an array of Vector structs and num_vectors must be +// the length of this array. (If num_vectors is -1, then vectors is assumed to +// be terminated by a Vector with a NULL buffer pointer.) The Vector structs +// describe the buffers that the sent data will be gathered from. Using multiple +// Vectors is more memory-efficient than manually copying data from multiple +// sources into a single buffer, and more network-efficient than making multiple +// calls to g_socket_send(). +// +// messages, if non-NULL, is taken to point to an array of num_messages +// ControlMessage instances. These correspond to the control messages to be +// sent on the socket. If num_messages is -1 then messages is treated as a +// NULL-terminated array. +// +// flags modify how the message is sent. The commonly available arguments for +// this are available in the MsgFlags enum, but the values there are the same +// as the system values, and the flags are passed in as-is, so you can pass in +// system-specific flags too. +// +// If the socket is in blocking mode the call will block until there is space +// for the data in the socket queue. If there is no space available and the +// socket is in non-blocking mode a G_IO_ERROR_WOULD_BLOCK error will be +// returned. To be notified when space is available, wait for the G_IO_OUT +// condition. Note though that you may still receive G_IO_ERROR_WOULD_BLOCK from +// g_socket_send() even if you were previously notified of a G_IO_OUT condition. +// (On Windows in particular, this is very common due to the way the underlying +// APIs work.) +// +// The sum of the sizes of each Vector in vectors must not be greater than +// G_MAXSSIZE. If the message can be larger than this, then it is mandatory to +// use the g_socket_send_message_with_timeout() function. +// +// On error -1 is returned and error is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - address (optional) or NULL. +// - vectors: array of Vector structs. +// - messages (optional): pointer to an array of ControlMessages, or NULL. +// - flags: int containing MsgFlags flags, which may +// additionally contain other platform specific flags +// (http://man7.org/linux/man-pages/man2/recv.2.html). +// +// The function returns the following values: +// +// - gssize: number of bytes written (which may be less than size), or -1 on +// error. +func (socket *Socket) SendMessage(ctx context.Context, address SocketAddresser, vectors []OutputVector, messages []SocketControlMessager, flags int) (int, error) { + var _arg0 *C.GSocket // out + var _arg7 *C.GCancellable // out + var _arg1 *C.GSocketAddress // out + var _arg2 *C.GOutputVector // out + var _arg3 C.gint + var _arg4 **C.GSocketControlMessage // out + var _arg5 C.gint + var _arg6 C.gint // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg7 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if address != nil { + _arg1 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + } + _arg3 = (C.gint)(len(vectors)) + _arg2 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg2), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + if messages != nil { + _arg5 = (C.gint)(len(messages)) + _arg4 = (**C.GSocketControlMessage)(C.calloc(C.size_t(len(messages)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((**C.GSocketControlMessage)(_arg4), len(messages)) + for i := range messages { + out[i] = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(messages[i]).Native())) + } + } + } + _arg6 = C.gint(flags) + + _cret = C.g_socket_send_message(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(vectors) + runtime.KeepAlive(messages) + runtime.KeepAlive(flags) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// SendMessageWithTimeout: this behaves exactly the same as +// g_socket_send_message(), except that the choice of timeout behavior is +// determined by the timeout_us argument rather than by socket's properties. +// +// On error G_POLLABLE_RETURN_FAILED is returned and error is set accordingly, +// or if the socket is currently not writable G_POLLABLE_RETURN_WOULD_BLOCK is +// returned. bytes_written will contain 0 in both cases. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - address (optional) or NULL. +// - vectors: array of Vector structs. +// - messages (optional): pointer to an array of ControlMessages, or NULL. +// - flags: int containing MsgFlags flags, which may +// additionally contain other platform specific flags +// (http://man7.org/linux/man-pages/man2/recv.2.html). +// - timeoutUs: maximum time (in microseconds) to wait, or -1. +// +// The function returns the following values: +// +// - bytesWritten (optional): location to store the number of bytes that were +// written to the socket. +// - pollableReturn: G_POLLABLE_RETURN_OK if all data was successfully +// written, G_POLLABLE_RETURN_WOULD_BLOCK if the socket is currently not +// writable, or G_POLLABLE_RETURN_FAILED if an error happened and error is +// set. +func (socket *Socket) SendMessageWithTimeout(ctx context.Context, address SocketAddresser, vectors []OutputVector, messages []SocketControlMessager, flags int, timeoutUs int64) (uint, PollableReturn, error) { + var _arg0 *C.GSocket // out + var _arg9 *C.GCancellable // out + var _arg1 *C.GSocketAddress // out + var _arg2 *C.GOutputVector // out + var _arg3 C.gint + var _arg4 **C.GSocketControlMessage // out + var _arg5 C.gint + var _arg6 C.gint // out + var _arg7 C.gint64 // out + var _arg8 C.gsize // in + var _cret C.GPollableReturn // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg9 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if address != nil { + _arg1 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + } + _arg3 = (C.gint)(len(vectors)) + _arg2 = (*C.GOutputVector)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_GOutputVector))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GOutputVector)(_arg2), len(vectors)) + for i := range vectors { + out[i] = *(*C.GOutputVector)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + if messages != nil { + _arg5 = (C.gint)(len(messages)) + _arg4 = (**C.GSocketControlMessage)(C.calloc(C.size_t(len(messages)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((**C.GSocketControlMessage)(_arg4), len(messages)) + for i := range messages { + out[i] = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(messages[i]).Native())) + } + } + } + _arg6 = C.gint(flags) + _arg7 = C.gint64(timeoutUs) + + _cret = C.g_socket_send_message_with_timeout(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, &_arg8, _arg9, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(vectors) + runtime.KeepAlive(messages) + runtime.KeepAlive(flags) + runtime.KeepAlive(timeoutUs) + + var _bytesWritten uint // out + var _pollableReturn PollableReturn // out + var _goerr error // out + + _bytesWritten = uint(_arg8) + _pollableReturn = PollableReturn(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _pollableReturn, _goerr +} + +// SendMessages: send multiple data messages from socket in one go. This is the +// most complicated and fully-featured version of this call. For easier use, +// see g_socket_send(), g_socket_send_to(), and g_socket_send_message(). +// +// messages must point to an array of Message structs and num_messages must be +// the length of this array. Each Message contains an address to send the data +// to, and a pointer to an array of Vector structs to describe the buffers that +// the data to be sent for each message will be gathered from. Using multiple +// Vectors is more memory-efficient than manually copying data from multiple +// sources into a single buffer, and more network-efficient than making multiple +// calls to g_socket_send(). Sending multiple messages in one go avoids the +// overhead of making a lot of syscalls in scenarios where a lot of data packets +// need to be sent (e.g. high-bandwidth video streaming over RTP/UDP), or where +// the same data needs to be sent to multiple recipients. +// +// flags modify how the message is sent. The commonly available arguments for +// this are available in the MsgFlags enum, but the values there are the same +// as the system values, and the flags are passed in as-is, so you can pass in +// system-specific flags too. +// +// If the socket is in blocking mode the call will block until there is space +// for all the data in the socket queue. If there is no space available +// and the socket is in non-blocking mode a G_IO_ERROR_WOULD_BLOCK error +// will be returned if no data was written at all, otherwise the number of +// messages sent will be returned. To be notified when space is available, +// wait for the G_IO_OUT condition. Note though that you may still receive +// G_IO_ERROR_WOULD_BLOCK from g_socket_send() even if you were previously +// notified of a G_IO_OUT condition. (On Windows in particular, this is very +// common due to the way the underlying APIs work.) +// +// On error -1 is returned and error is set accordingly. An error will only be +// returned if zero messages could be sent; otherwise the number of messages +// successfully sent before the error will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - messages: array of Message structs. +// - flags: int containing MsgFlags flags, which may +// additionally contain other platform specific flags +// (http://man7.org/linux/man-pages/man2/recv.2.html). +// +// The function returns the following values: +// +// - gint: number of messages sent, or -1 on error. Note that the number +// of messages sent may be smaller than num_messages if the socket is +// non-blocking or if num_messages was larger than UIO_MAXIOV (1024), +// in which case the caller may re-try to send the remaining messages. +func (socket *Socket) SendMessages(ctx context.Context, messages []OutputMessage, flags int) (int, error) { + var _arg0 *C.GSocket // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GOutputMessage // out + var _arg2 C.guint + var _arg3 C.gint // out + var _cret C.gint // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.guint)(len(messages)) + _arg1 = (*C.GOutputMessage)(C.calloc(C.size_t(len(messages)), C.size_t(C.sizeof_GOutputMessage))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((*C.GOutputMessage)(_arg1), len(messages)) + for i := range messages { + out[i] = *(*C.GOutputMessage)(gextras.StructNative(unsafe.Pointer((&messages[i])))) + } + } + _arg3 = C.gint(flags) + + _cret = C.g_socket_send_messages(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(messages) + runtime.KeepAlive(flags) + + var _gint int // out + var _goerr error // out + + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint, _goerr +} + +// SendTo tries to send size bytes from buffer to address. If address is NULL +// then the message is sent to the default receiver (set by g_socket_connect()). +// +// See g_socket_send() for additional information. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - address (optional) or NULL. +// - buffer: buffer containing the data to send. +// +// The function returns the following values: +// +// - gssize: number of bytes written (which may be less than size), or -1 on +// error. +func (socket *Socket) SendTo(ctx context.Context, address SocketAddresser, buffer string) (int, error) { + var _arg0 *C.GSocket // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GSocketAddress // out + var _arg2 *C.gchar // out + var _arg3 C.gsize + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if address != nil { + _arg1 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + } + _arg3 = (C.gsize)(len(buffer)) + _arg2 = (*C.gchar)(C.calloc(C.size_t((len(buffer) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg2)), len(buffer)), buffer) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_socket_send_to(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(buffer) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// SendWithBlocking: this behaves exactly the same as g_socket_send(), except +// that the choice of blocking or non-blocking behavior is determined by the +// blocking argument rather than by socket's properties. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - buffer: buffer containing the data to send. +// - blocking: whether to do blocking or non-blocking I/O. +// +// The function returns the following values: +// +// - gssize: number of bytes written (which may be less than size), or -1 on +// error. +func (socket *Socket) SendWithBlocking(ctx context.Context, buffer string, blocking bool) (int, error) { + var _arg0 *C.GSocket // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.gsize + var _arg3 C.gboolean // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg2 = (C.gsize)(len(buffer)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(buffer) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(buffer)), buffer) + defer C.free(unsafe.Pointer(_arg1)) + if blocking { + _arg3 = C.TRUE + } + + _cret = C.g_socket_send_with_blocking(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(ctx) + runtime.KeepAlive(buffer) + runtime.KeepAlive(blocking) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// SetBlocking sets the blocking mode of the socket. In blocking mode all +// operations (which don’t take an explicit blocking parameter) block until +// they succeed or there is an error. In non-blocking mode all functions return +// results immediately or with a G_IO_ERROR_WOULD_BLOCK error. +// +// All sockets are created in blocking mode. However, note that the platform +// level socket is always non-blocking, and blocking mode is a GSocket level +// feature. +// +// The function takes the following parameters: +// +// - blocking: whether to use blocking I/O or not. +func (socket *Socket) SetBlocking(blocking bool) { + var _arg0 *C.GSocket // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + if blocking { + _arg1 = C.TRUE + } + + C.g_socket_set_blocking(_arg0, _arg1) + runtime.KeepAlive(socket) + runtime.KeepAlive(blocking) +} + +// SetBroadcast sets whether socket should allow sending to broadcast addresses. +// This is FALSE by default. +// +// The function takes the following parameters: +// +// - broadcast: whether socket should allow sending to broadcast addresses. +func (socket *Socket) SetBroadcast(broadcast bool) { + var _arg0 *C.GSocket // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + if broadcast { + _arg1 = C.TRUE + } + + C.g_socket_set_broadcast(_arg0, _arg1) + runtime.KeepAlive(socket) + runtime.KeepAlive(broadcast) +} + +// SetKeepalive sets or unsets the SO_KEEPALIVE flag on the underlying socket. +// When this flag is set on a socket, the system will attempt to verify that the +// remote socket endpoint is still present if a sufficiently long period of time +// passes with no data being exchanged. If the system is unable to verify the +// presence of the remote endpoint, it will automatically close the connection. +// +// This option is only functional on certain kinds of sockets. (Notably, +// G_SOCKET_PROTOCOL_TCP sockets.) +// +// The exact time between pings is system- and protocol-dependent, but will +// normally be at least two hours. Most commonly, you would set this flag +// on a server socket if you want to allow clients to remain idle for long +// periods of time, but also want to ensure that connections are eventually +// garbage-collected if clients crash or become unreachable. +// +// The function takes the following parameters: +// +// - keepalive: value for the keepalive flag. +func (socket *Socket) SetKeepalive(keepalive bool) { + var _arg0 *C.GSocket // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + if keepalive { + _arg1 = C.TRUE + } + + C.g_socket_set_keepalive(_arg0, _arg1) + runtime.KeepAlive(socket) + runtime.KeepAlive(keepalive) +} + +// SetListenBacklog sets the maximum number of outstanding connections allowed +// when listening on this socket. If more clients than this are connecting to +// the socket and the application is not handling them on time then the new +// connections will be refused. +// +// Note that this must be called before g_socket_listen() and has no effect if +// called after that. +// +// The function takes the following parameters: +// +// - backlog: maximum number of pending connections. +func (socket *Socket) SetListenBacklog(backlog int) { + var _arg0 *C.GSocket // out + var _arg1 C.gint // out + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = C.gint(backlog) + + C.g_socket_set_listen_backlog(_arg0, _arg1) + runtime.KeepAlive(socket) + runtime.KeepAlive(backlog) +} + +// SetMulticastLoopback sets whether outgoing multicast packets will be received +// by sockets listening on that multicast address on the same host. This is TRUE +// by default. +// +// The function takes the following parameters: +// +// - loopback: whether socket should receive messages sent to its multicast +// groups from the local host. +func (socket *Socket) SetMulticastLoopback(loopback bool) { + var _arg0 *C.GSocket // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + if loopback { + _arg1 = C.TRUE + } + + C.g_socket_set_multicast_loopback(_arg0, _arg1) + runtime.KeepAlive(socket) + runtime.KeepAlive(loopback) +} + +// SetMulticastTTL sets the time-to-live for outgoing multicast datagrams on +// socket. By default, this is 1, meaning that multicast packets will not leave +// the local network. +// +// The function takes the following parameters: +// +// - ttl: time-to-live value for all multicast datagrams on socket. +func (socket *Socket) SetMulticastTTL(ttl uint) { + var _arg0 *C.GSocket // out + var _arg1 C.guint // out + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = C.guint(ttl) + + C.g_socket_set_multicast_ttl(_arg0, _arg1) + runtime.KeepAlive(socket) + runtime.KeepAlive(ttl) +} + +// SetOption sets the value of an integer-valued option on socket, as with +// setsockopt(). (If you need to set a non-integer-valued option, you will need +// to call setsockopt() directly.) +// +// The [][gio-gnetworking.h] header pulls in system headers +// that will define most of the standard/portable socket options. For unusual +// socket protocols or platform-dependent options, you may need to include +// additional headers. +// +// The function takes the following parameters: +// +// - level: "API level" of the option (eg, SOL_SOCKET). +// - optname: "name" of the option (eg, SO_BROADCAST). +// - value to set the option to. +func (socket *Socket) SetOption(level, optname, value int) error { + var _arg0 *C.GSocket // out + var _arg1 C.gint // out + var _arg2 C.gint // out + var _arg3 C.gint // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = C.gint(level) + _arg2 = C.gint(optname) + _arg3 = C.gint(value) + + C.g_socket_set_option(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(level) + runtime.KeepAlive(optname) + runtime.KeepAlive(value) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetTimeout sets the time in seconds after which I/O operations on socket will +// time out if they have not yet completed. +// +// On a blocking socket, this means that any blocking #GSocket operation will +// time out after timeout seconds of inactivity, returning G_IO_ERROR_TIMED_OUT. +// +// On a non-blocking socket, calls to g_socket_condition_wait() will also +// fail with G_IO_ERROR_TIMED_OUT after the given time. Sources created with +// g_socket_create_source() will trigger after timeout seconds of inactivity, +// with the requested condition set, at which point calling g_socket_receive(), +// g_socket_send(), g_socket_check_connect_result(), etc, will fail with +// G_IO_ERROR_TIMED_OUT. +// +// If timeout is 0 (the default), operations will never time out on their own. +// +// Note that if an I/O operation is interrupted by a signal, this may cause the +// timeout to be reset. +// +// The function takes the following parameters: +// +// - timeout for socket, in seconds, or 0 for none. +func (socket *Socket) SetTimeout(timeout uint) { + var _arg0 *C.GSocket // out + var _arg1 C.guint // out + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = C.guint(timeout) + + C.g_socket_set_timeout(_arg0, _arg1) + runtime.KeepAlive(socket) + runtime.KeepAlive(timeout) +} + +// SetTTL sets the time-to-live for outgoing unicast packets on socket. +// By default the platform-specific default value is used. +// +// The function takes the following parameters: +// +// - ttl: time-to-live value for all unicast packets on socket. +func (socket *Socket) SetTTL(ttl uint) { + var _arg0 *C.GSocket // out + var _arg1 C.guint // out + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + _arg1 = C.guint(ttl) + + C.g_socket_set_ttl(_arg0, _arg1) + runtime.KeepAlive(socket) + runtime.KeepAlive(ttl) +} + +// Shutdown: shut down part or all of a full-duplex connection. +// +// If shutdown_read is TRUE then the receiving side of the connection is shut +// down, and further reading is disallowed. +// +// If shutdown_write is TRUE then the sending side of the connection is shut +// down, and further writing is disallowed. +// +// It is allowed for both shutdown_read and shutdown_write to be TRUE. +// +// One example where it is useful to shut down only one side of a connection +// is graceful disconnect for TCP connections where you close the sending side, +// then wait for the other side to close the connection, thus ensuring that the +// other side saw all sent data. +// +// The function takes the following parameters: +// +// - shutdownRead: whether to shut down the read side. +// - shutdownWrite: whether to shut down the write side. +func (socket *Socket) Shutdown(shutdownRead, shutdownWrite bool) error { + var _arg0 *C.GSocket // out + var _arg1 C.gboolean // out + var _arg2 C.gboolean // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + if shutdownRead { + _arg1 = C.TRUE + } + if shutdownWrite { + _arg2 = C.TRUE + } + + C.g_socket_shutdown(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(socket) + runtime.KeepAlive(shutdownRead) + runtime.KeepAlive(shutdownWrite) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SpeaksIPv4 checks if a socket is capable of speaking IPv4. +// +// IPv4 sockets are capable of speaking IPv4. On some operating systems and +// under some combinations of circumstances IPv6 sockets are also capable of +// speaking IPv4. See RFC 3493 section 3.7 for more information. +// +// No other types of sockets are currently considered as being capable of +// speaking IPv4. +// +// The function returns the following values: +// +// - ok: TRUE if this socket can be used with IPv4. +func (socket *Socket) SpeaksIPv4() bool { + var _arg0 *C.GSocket // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_socket_speaks_ipv4(_arg0) + runtime.KeepAlive(socket) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SocketAddressOverrides contains methods that are overridable. +type SocketAddressOverrides struct { + // Family gets the socket family type of address. + // + // The function returns the following values: + // + // - socketFamily: socket family type of address. + Family func() SocketFamily + // NativeSize gets the size of address's native struct sockaddr. You can use + // this to allocate memory to pass to g_socket_address_to_native(). + // + // The function returns the following values: + // + // - gssize: size of the native struct sockaddr that address represents. + NativeSize func() int + // ToNative converts a Address to a native struct sockaddr, which can be + // passed to low-level functions like connect() or bind(). + // + // If not enough space is available, a G_IO_ERROR_NO_SPACE error is + // returned. If the address type is not known on the system then a + // G_IO_ERROR_NOT_SUPPORTED error is returned. + // + // The function takes the following parameters: + // + // - dest (optional): pointer to a memory location that will contain the + // native struct sockaddr. + // - destlen: size of dest. Must be at least as large as + // g_socket_address_get_native_size(). + ToNative func(dest unsafe.Pointer, destlen uint) error +} + +func defaultSocketAddressOverrides(v *SocketAddress) SocketAddressOverrides { + return SocketAddressOverrides{ + Family: v.family, + NativeSize: v.nativeSize, + ToNative: v.toNative, + } +} + +// SocketAddress: GSocketAddress is the equivalent of struct sockaddr +// (man:sockaddr(3type)) and its subtypes in the BSD sockets API. This +// is an abstract class; use gio.InetSocketAddress for internet sockets, +// or gio.UnixSocketAddress for UNIX domain sockets. +type SocketAddress struct { + _ [0]func() // equal guard + *coreglib.Object + + SocketConnectable +} + +var ( + _ coreglib.Objector = (*SocketAddress)(nil) +) + +// SocketAddresser describes types inherited from class SocketAddress. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type SocketAddresser interface { + coreglib.Objector + baseSocketAddress() *SocketAddress +} + +var _ SocketAddresser = (*SocketAddress)(nil) + +func init() { + coreglib.RegisterClassInfo[*SocketAddress, *SocketAddressClass, SocketAddressOverrides]( + GTypeSocketAddress, + initSocketAddressClass, + wrapSocketAddress, + defaultSocketAddressOverrides, + ) +} + +func initSocketAddressClass(gclass unsafe.Pointer, overrides SocketAddressOverrides, classInitFunc func(*SocketAddressClass)) { + pclass := (*C.GSocketAddressClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeSocketAddress)))) + + if overrides.Family != nil { + pclass.get_family = (*[0]byte)(C._gotk4_gio2_SocketAddressClass_get_family) + } + + if overrides.NativeSize != nil { + pclass.get_native_size = (*[0]byte)(C._gotk4_gio2_SocketAddressClass_get_native_size) + } + + if overrides.ToNative != nil { + pclass.to_native = (*[0]byte)(C._gotk4_gio2_SocketAddressClass_to_native) + } + + if classInitFunc != nil { + class := (*SocketAddressClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSocketAddress(obj *coreglib.Object) *SocketAddress { + return &SocketAddress{ + Object: obj, + SocketConnectable: SocketConnectable{ + Object: obj, + }, + } +} + +func marshalSocketAddress(p uintptr) (interface{}, error) { + return wrapSocketAddress(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (address *SocketAddress) baseSocketAddress() *SocketAddress { + return address +} + +// BaseSocketAddress returns the underlying base object. +func BaseSocketAddress(obj SocketAddresser) *SocketAddress { + return obj.baseSocketAddress() +} + +// NewSocketAddressFromNative creates a Address subclass corresponding to the +// native struct sockaddr native. +// +// The function takes the following parameters: +// +// - native: pointer to a struct sockaddr. +// - len: size of the memory location pointed to by native. +// +// The function returns the following values: +// +// - socketAddress: new Address if native could successfully be converted, +// otherwise NULL. +func NewSocketAddressFromNative(native unsafe.Pointer, len uint) *SocketAddress { + var _arg1 C.gpointer // out + var _arg2 C.gsize // out + var _cret *C.GSocketAddress // in + + _arg1 = (C.gpointer)(unsafe.Pointer(native)) + _arg2 = C.gsize(len) + + _cret = C.g_socket_address_new_from_native(_arg1, _arg2) + runtime.KeepAlive(native) + runtime.KeepAlive(len) + + var _socketAddress *SocketAddress // out + + _socketAddress = wrapSocketAddress(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _socketAddress +} + +// Family gets the socket family type of address. +// +// The function returns the following values: +// +// - socketFamily: socket family type of address. +func (address *SocketAddress) Family() SocketFamily { + var _arg0 *C.GSocketAddress // out + var _cret C.GSocketFamily // in + + _arg0 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_socket_address_get_family(_arg0) + runtime.KeepAlive(address) + + var _socketFamily SocketFamily // out + + _socketFamily = SocketFamily(_cret) + + return _socketFamily +} + +// NativeSize gets the size of address's native struct sockaddr. You can use +// this to allocate memory to pass to g_socket_address_to_native(). +// +// The function returns the following values: +// +// - gssize: size of the native struct sockaddr that address represents. +func (address *SocketAddress) NativeSize() int { + var _arg0 *C.GSocketAddress // out + var _cret C.gssize // in + + _arg0 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C.g_socket_address_get_native_size(_arg0) + runtime.KeepAlive(address) + + var _gssize int // out + + _gssize = int(_cret) + + return _gssize +} + +// ToNative converts a Address to a native struct sockaddr, which can be passed +// to low-level functions like connect() or bind(). +// +// If not enough space is available, a G_IO_ERROR_NO_SPACE error is returned. If +// the address type is not known on the system then a G_IO_ERROR_NOT_SUPPORTED +// error is returned. +// +// The function takes the following parameters: +// +// - dest (optional): pointer to a memory location that will contain the +// native struct sockaddr. +// - destlen: size of dest. Must be at least as large as +// g_socket_address_get_native_size(). +func (address *SocketAddress) ToNative(dest unsafe.Pointer, destlen uint) error { + var _arg0 *C.GSocketAddress // out + var _arg1 C.gpointer // out + var _arg2 C.gsize // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + _arg1 = (C.gpointer)(unsafe.Pointer(dest)) + _arg2 = C.gsize(destlen) + + C.g_socket_address_to_native(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(address) + runtime.KeepAlive(dest) + runtime.KeepAlive(destlen) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Family gets the socket family type of address. +// +// The function returns the following values: +// +// - socketFamily: socket family type of address. +func (address *SocketAddress) family() SocketFamily { + gclass := (*C.GSocketAddressClass)(coreglib.PeekParentClass(address)) + fnarg := gclass.get_family + + var _arg0 *C.GSocketAddress // out + var _cret C.GSocketFamily // in + + _arg0 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C._gotk4_gio2_SocketAddress_virtual_get_family(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(address) + + var _socketFamily SocketFamily // out + + _socketFamily = SocketFamily(_cret) + + return _socketFamily +} + +// nativeSize gets the size of address's native struct sockaddr. You can use +// this to allocate memory to pass to g_socket_address_to_native(). +// +// The function returns the following values: +// +// - gssize: size of the native struct sockaddr that address represents. +func (address *SocketAddress) nativeSize() int { + gclass := (*C.GSocketAddressClass)(coreglib.PeekParentClass(address)) + fnarg := gclass.get_native_size + + var _arg0 *C.GSocketAddress // out + var _cret C.gssize // in + + _arg0 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + _cret = C._gotk4_gio2_SocketAddress_virtual_get_native_size(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(address) + + var _gssize int // out + + _gssize = int(_cret) + + return _gssize +} + +// toNative converts a Address to a native struct sockaddr, which can be passed +// to low-level functions like connect() or bind(). +// +// If not enough space is available, a G_IO_ERROR_NO_SPACE error is returned. If +// the address type is not known on the system then a G_IO_ERROR_NOT_SUPPORTED +// error is returned. +// +// The function takes the following parameters: +// +// - dest (optional): pointer to a memory location that will contain the +// native struct sockaddr. +// - destlen: size of dest. Must be at least as large as +// g_socket_address_get_native_size(). +func (address *SocketAddress) toNative(dest unsafe.Pointer, destlen uint) error { + gclass := (*C.GSocketAddressClass)(coreglib.PeekParentClass(address)) + fnarg := gclass.to_native + + var _arg0 *C.GSocketAddress // out + var _arg1 C.gpointer // out + var _arg2 C.gsize // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + _arg1 = (C.gpointer)(unsafe.Pointer(dest)) + _arg2 = C.gsize(destlen) + + C._gotk4_gio2_SocketAddress_virtual_to_native(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(address) + runtime.KeepAlive(dest) + runtime.KeepAlive(destlen) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SocketAddressEnumeratorOverrides contains methods that are overridable. +type SocketAddressEnumeratorOverrides struct { + // Next retrieves the next Address from enumerator. Note that + // this may block for some amount of time. (Eg, a Address may + // need to do a DNS lookup before it can return an address.) Use + // g_socket_address_enumerator_next_async() if you need to avoid blocking. + // + // If enumerator is expected to yield addresses, but for some reason + // is unable to (eg, because of a DNS error), then the first call to + // g_socket_address_enumerator_next() will return an appropriate error in + // *error. However, if the first call to g_socket_address_enumerator_next() + // succeeds, then any further internal errors (other than cancellable being + // triggered) will be ignored. + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable object, NULL to ignore. + // + // The function returns the following values: + // + // - socketAddress (optional) (owned by the caller), or NULL on error (in + // which case *error will be set) or if there are no more addresses. + Next func(ctx context.Context) (SocketAddresser, error) + // NextFinish retrieves the result of a completed call + // to g_socket_address_enumerator_next_async(). See + // g_socket_address_enumerator_next() for more information about error + // handling. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - socketAddress (optional) (owned by the caller), or NULL on error (in + // which case *error will be set) or if there are no more addresses. + NextFinish func(result AsyncResulter) (SocketAddresser, error) +} + +func defaultSocketAddressEnumeratorOverrides(v *SocketAddressEnumerator) SocketAddressEnumeratorOverrides { + return SocketAddressEnumeratorOverrides{ + Next: v.next, + NextFinish: v.nextFinish, + } +} + +// SocketAddressEnumerator: GSocketAddressEnumerator is an enumerator type for +// gio.SocketAddress instances. It is returned by enumeration functions such as +// gio.SocketConnectable.Enumerate(), which returns a GSocketAddressEnumerator +// to list each gio.SocketAddress which could be used to connect to that +// gio.SocketConnectable. +// +// Enumeration is typically a blocking operation, so the +// asynchronous methods gio.SocketAddressEnumerator.NextAsync() and +// gio.SocketAddressEnumerator.NextFinish() should be used where possible. +// +// Each GSocketAddressEnumerator can only be enumerated once. Once +// gio.SocketAddressEnumerator.Next() has returned NULL, further enumeration +// with that GSocketAddressEnumerator is not possible, and it can be unreffed. +type SocketAddressEnumerator struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*SocketAddressEnumerator)(nil) +) + +// SocketAddressEnumeratorrer describes types inherited from class SocketAddressEnumerator. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type SocketAddressEnumeratorrer interface { + coreglib.Objector + baseSocketAddressEnumerator() *SocketAddressEnumerator +} + +var _ SocketAddressEnumeratorrer = (*SocketAddressEnumerator)(nil) + +func init() { + coreglib.RegisterClassInfo[*SocketAddressEnumerator, *SocketAddressEnumeratorClass, SocketAddressEnumeratorOverrides]( + GTypeSocketAddressEnumerator, + initSocketAddressEnumeratorClass, + wrapSocketAddressEnumerator, + defaultSocketAddressEnumeratorOverrides, + ) +} + +func initSocketAddressEnumeratorClass(gclass unsafe.Pointer, overrides SocketAddressEnumeratorOverrides, classInitFunc func(*SocketAddressEnumeratorClass)) { + pclass := (*C.GSocketAddressEnumeratorClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeSocketAddressEnumerator)))) + + if overrides.Next != nil { + pclass.next = (*[0]byte)(C._gotk4_gio2_SocketAddressEnumeratorClass_next) + } + + if overrides.NextFinish != nil { + pclass.next_finish = (*[0]byte)(C._gotk4_gio2_SocketAddressEnumeratorClass_next_finish) + } + + if classInitFunc != nil { + class := (*SocketAddressEnumeratorClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSocketAddressEnumerator(obj *coreglib.Object) *SocketAddressEnumerator { + return &SocketAddressEnumerator{ + Object: obj, + } +} + +func marshalSocketAddressEnumerator(p uintptr) (interface{}, error) { + return wrapSocketAddressEnumerator(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (enumerator *SocketAddressEnumerator) baseSocketAddressEnumerator() *SocketAddressEnumerator { + return enumerator +} + +// BaseSocketAddressEnumerator returns the underlying base object. +func BaseSocketAddressEnumerator(obj SocketAddressEnumeratorrer) *SocketAddressEnumerator { + return obj.baseSocketAddressEnumerator() +} + +// Next retrieves the next Address from enumerator. Note that this may block for +// some amount of time. (Eg, a Address may need to do a DNS lookup before it can +// return an address.) Use g_socket_address_enumerator_next_async() if you need +// to avoid blocking. +// +// If enumerator is expected to yield addresses, but for some reason +// is unable to (eg, because of a DNS error), then the first call to +// g_socket_address_enumerator_next() will return an appropriate error in +// *error. However, if the first call to g_socket_address_enumerator_next() +// succeeds, then any further internal errors (other than cancellable being +// triggered) will be ignored. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - socketAddress (optional) (owned by the caller), or NULL on error (in +// which case *error will be set) or if there are no more addresses. +func (enumerator *SocketAddressEnumerator) Next(ctx context.Context) (SocketAddresser, error) { + var _arg0 *C.GSocketAddressEnumerator // out + var _arg1 *C.GCancellable // out + var _cret *C.GSocketAddress // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketAddressEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_socket_address_enumerator_next(_arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + + var _socketAddress SocketAddresser // out + var _goerr error // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _socketAddress = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketAddress, _goerr +} + +// NextAsync: asynchronously retrieves the next Address from enumerator and then +// calls callback, which must call g_socket_address_enumerator_next_finish() to +// get the result. +// +// It is an error to call this multiple times before the previous callback has +// finished. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - callback (optional) to call when the request is satisfied. +func (enumerator *SocketAddressEnumerator) NextAsync(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GSocketAddressEnumerator // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GSocketAddressEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_socket_address_enumerator_next_async(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// NextFinish retrieves the result of a completed call +// to g_socket_address_enumerator_next_async(). See +// g_socket_address_enumerator_next() for more information about error handling. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - socketAddress (optional) (owned by the caller), or NULL on error (in +// which case *error will be set) or if there are no more addresses. +func (enumerator *SocketAddressEnumerator) NextFinish(result AsyncResulter) (SocketAddresser, error) { + var _arg0 *C.GSocketAddressEnumerator // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GSocketAddress // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketAddressEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_socket_address_enumerator_next_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(result) + + var _socketAddress SocketAddresser // out + var _goerr error // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _socketAddress = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketAddress, _goerr +} + +// Next retrieves the next Address from enumerator. Note that this may block for +// some amount of time. (Eg, a Address may need to do a DNS lookup before it can +// return an address.) Use g_socket_address_enumerator_next_async() if you need +// to avoid blocking. +// +// If enumerator is expected to yield addresses, but for some reason +// is unable to (eg, because of a DNS error), then the first call to +// g_socket_address_enumerator_next() will return an appropriate error in +// *error. However, if the first call to g_socket_address_enumerator_next() +// succeeds, then any further internal errors (other than cancellable being +// triggered) will be ignored. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - socketAddress (optional) (owned by the caller), or NULL on error (in +// which case *error will be set) or if there are no more addresses. +func (enumerator *SocketAddressEnumerator) next(ctx context.Context) (SocketAddresser, error) { + gclass := (*C.GSocketAddressEnumeratorClass)(coreglib.PeekParentClass(enumerator)) + fnarg := gclass.next + + var _arg0 *C.GSocketAddressEnumerator // out + var _arg1 *C.GCancellable // out + var _cret *C.GSocketAddress // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketAddressEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C._gotk4_gio2_SocketAddressEnumerator_virtual_next(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + + var _socketAddress SocketAddresser // out + var _goerr error // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _socketAddress = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketAddress, _goerr +} + +// nextAsync: asynchronously retrieves the next Address from enumerator and then +// calls callback, which must call g_socket_address_enumerator_next_finish() to +// get the result. +// +// It is an error to call this multiple times before the previous callback has +// finished. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - callback (optional) to call when the request is satisfied. +func (enumerator *SocketAddressEnumerator) nextAsync(ctx context.Context, callback AsyncReadyCallback) { + gclass := (*C.GSocketAddressEnumeratorClass)(coreglib.PeekParentClass(enumerator)) + fnarg := gclass.next_async + + var _arg0 *C.GSocketAddressEnumerator // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GSocketAddressEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_SocketAddressEnumerator_virtual_next_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// nextFinish retrieves the result of a completed call +// to g_socket_address_enumerator_next_async(). See +// g_socket_address_enumerator_next() for more information about error handling. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - socketAddress (optional) (owned by the caller), or NULL on error (in +// which case *error will be set) or if there are no more addresses. +func (enumerator *SocketAddressEnumerator) nextFinish(result AsyncResulter) (SocketAddresser, error) { + gclass := (*C.GSocketAddressEnumeratorClass)(coreglib.PeekParentClass(enumerator)) + fnarg := gclass.next_finish + + var _arg0 *C.GSocketAddressEnumerator // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GSocketAddress // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketAddressEnumerator)(unsafe.Pointer(coreglib.InternObject(enumerator).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_SocketAddressEnumerator_virtual_next_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(enumerator) + runtime.KeepAlive(result) + + var _socketAddress SocketAddresser // out + var _goerr error // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _socketAddress = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketAddress, _goerr +} + +// SocketClientOverrides contains methods that are overridable. +type SocketClientOverrides struct { + // The function takes the following parameters: + // + // - event + // - connectable + // - connection + Event func(event SocketClientEvent, connectable SocketConnectabler, connection IOStreamer) +} + +func defaultSocketClientOverrides(v *SocketClient) SocketClientOverrides { + return SocketClientOverrides{ + Event: v.event, + } +} + +// SocketClient: GSocketClient is a lightweight high-level utility class for +// connecting to a network host using a connection oriented socket type. +// +// You create a GSocketClient object, set any options you want, and then call +// a sync or async connect operation, which returns a gio.SocketConnection +// subclass on success. +// +// The type of the gio.SocketConnection object returned depends on the type of +// the underlying socket that is in use. For instance, for a TCP/IP connection +// it will be a gio.TCPConnection. +// +// As GSocketClient is a lightweight object, you don't need to cache it. You can +// just create a new one any time you need one. +type SocketClient struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*SocketClient)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*SocketClient, *SocketClientClass, SocketClientOverrides]( + GTypeSocketClient, + initSocketClientClass, + wrapSocketClient, + defaultSocketClientOverrides, + ) +} + +func initSocketClientClass(gclass unsafe.Pointer, overrides SocketClientOverrides, classInitFunc func(*SocketClientClass)) { + pclass := (*C.GSocketClientClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeSocketClient)))) + + if overrides.Event != nil { + pclass.event = (*[0]byte)(C._gotk4_gio2_SocketClientClass_event) + } + + if classInitFunc != nil { + class := (*SocketClientClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSocketClient(obj *coreglib.Object) *SocketClient { + return &SocketClient{ + Object: obj, + } +} + +func marshalSocketClient(p uintptr) (interface{}, error) { + return wrapSocketClient(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectEvent is emitted when client's activity on connectable changes state. +// Among other things, this can be used to provide progress information about a +// network connection in the UI. The meanings of the different event values are +// as follows: +// +// - G_SOCKET_CLIENT_RESOLVING: client is about to look up connectable in DNS. +// connection will be NULL. +// +// - G_SOCKET_CLIENT_RESOLVED: client has successfully resolved connectable in +// DNS. connection will be NULL. +// +// - G_SOCKET_CLIENT_CONNECTING: client is about to make a connection +// to a remote host; either a proxy server or the destination server +// itself. connection is the Connection, which is not yet connected. +// Since GLib 2.40, you can access the remote address via +// g_socket_connection_get_remote_address(). +// +// - G_SOCKET_CLIENT_CONNECTED: client has successfully connected to a remote +// host. connection is the connected Connection. +// +// - G_SOCKET_CLIENT_PROXY_NEGOTIATING: client is about to negotiate with a +// proxy to get it to connect to connectable. connection is the Connection to +// the proxy server. +// +// - G_SOCKET_CLIENT_PROXY_NEGOTIATED: client has negotiated a connection to +// connectable through a proxy server. connection is the stream returned from +// g_proxy_connect(), which may or may not be a Connection. +// +// - G_SOCKET_CLIENT_TLS_HANDSHAKING: client is about to begin a TLS handshake. +// connection is a ClientConnection. +// +// - G_SOCKET_CLIENT_TLS_HANDSHAKED: client has successfully completed the TLS +// handshake. connection is a ClientConnection. +// +// - G_SOCKET_CLIENT_COMPLETE: client has either successfully connected to +// connectable (in which case connection is the Connection that it will be +// returning to the caller) or has failed (in which case connection is NULL and +// the client is about to return an error). +// +// Each event except G_SOCKET_CLIENT_COMPLETE may be emitted multiple times +// (or not at all) for a given connectable (in particular, if client ends up +// attempting to connect to more than one address). However, if client emits the +// Client::event signal at all for a given connectable, then it will always emit +// it with G_SOCKET_CLIENT_COMPLETE when it is done. +// +// Note that there may be additional ClientEvent values in the future; +// unrecognized event values should be ignored. +func (client *SocketClient) ConnectEvent(f func(event SocketClientEvent, connectable SocketConnectabler, connection IOStreamer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(client, "event", false, unsafe.Pointer(C._gotk4_gio2_SocketClient_ConnectEvent), f) +} + +// NewSocketClient creates a new Client with the default options. +// +// The function returns the following values: +// +// - socketClient: Client. Free the returned object with g_object_unref(). +func NewSocketClient() *SocketClient { + var _cret *C.GSocketClient // in + + _cret = C.g_socket_client_new() + + var _socketClient *SocketClient // out + + _socketClient = wrapSocketClient(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _socketClient +} + +// AddApplicationProxy: enable proxy protocols to be handled by the application. +// When the indicated proxy protocol is returned by the Resolver, Client will +// consider this protocol as supported but will not try to find a #GProxy +// instance to handle handshaking. The application must check for this case by +// calling g_socket_connection_get_remote_address() on the returned Connection, +// and seeing if it's a Address of the appropriate type, to determine whether or +// not it needs to handle the proxy handshaking itself. +// +// This should be used for proxy protocols that are dialects of another protocol +// such as HTTP proxy. It also allows cohabitation of proxy protocols that are +// reused between protocols. A good example is HTTP. It can be used to proxy +// HTTP, FTP and Gopher and can also be use as generic socket proxy through the +// HTTP CONNECT method. +// +// When the proxy is detected as being an application proxy, TLS handshake will +// be skipped. This is required to let the application do the proxy specific +// handshake. +// +// The function takes the following parameters: +// +// - protocol: proxy protocol. +func (client *SocketClient) AddApplicationProxy(protocol string) { + var _arg0 *C.GSocketClient // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(protocol))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_socket_client_add_application_proxy(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(protocol) +} + +// ConnectSocketClient tries to resolve the connectable and make a network +// connection to it. +// +// Upon a successful connection, a new Connection is constructed and returned. +// The caller owns this new object and must drop their reference to it when +// finished with it. +// +// The type of the Connection object returned depends on the type of the +// underlying socket that is used. For instance, for a TCP/IP connection it will +// be a Connection. +// +// The socket created will be the same family as the address +// that the connectable resolves to, unless family is set +// with g_socket_client_set_family() or indirectly via +// g_socket_client_set_local_address(). The socket type defaults to +// G_SOCKET_TYPE_STREAM but can be set with g_socket_client_set_socket_type(). +// +// If a local address is specified with g_socket_client_set_local_address() the +// socket will be bound to this address before connecting. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - connectable specifying the remote address. +// +// The function returns the following values: +// +// - socketConnection on success, NULL on error. +func (client *SocketClient) ConnectSocketClient(ctx context.Context, connectable SocketConnectabler) (*SocketConnection, error) { + var _arg0 *C.GSocketClient // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GSocketConnectable // out + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + + _cret = C.g_socket_client_connect(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(client) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connectable) + + var _socketConnection *SocketConnection // out + var _goerr error // out + + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketConnection, _goerr +} + +// ConnectAsync: this is the asynchronous version of g_socket_client_connect(). +// +// You may wish to prefer the asynchronous version even in synchronous +// command line programs because, since 2.60, it implements RFC 8305 +// (https://tools.ietf.org/html/rfc8305) "Happy Eyeballs" recommendations to +// work around long connection timeouts in networks where IPv6 is broken by +// performing an IPv4 connection simultaneously without waiting for IPv6 to +// time out, which is not supported by the synchronous call. (This is not an API +// guarantee, and may change in the future.) +// +// When the operation is finished callback will be called. You can then call +// g_socket_client_connect_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - connectable specifying the remote address. +// - callback (optional): ReadyCallback. +func (client *SocketClient) ConnectAsync(ctx context.Context, connectable SocketConnectabler, callback AsyncReadyCallback) { + var _arg0 *C.GSocketClient // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GSocketConnectable // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_socket_client_connect_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(client) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connectable) + runtime.KeepAlive(callback) +} + +// ConnectFinish finishes an async connect operation. See +// g_socket_client_connect_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - socketConnection on success, NULL on error. +func (client *SocketClient) ConnectFinish(result AsyncResulter) (*SocketConnection, error) { + var _arg0 *C.GSocketClient // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_socket_client_connect_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(client) + runtime.KeepAlive(result) + + var _socketConnection *SocketConnection // out + var _goerr error // out + + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketConnection, _goerr +} + +// ConnectToHost: this is a helper function for g_socket_client_connect(). +// +// Attempts to create a TCP connection to the named host. +// +// host_and_port may be in any of a number of recognized formats; an IPv6 +// address, an IPv4 address, or a domain name (in which case a DNS lookup +// is performed). Quoting with [] is supported for all address types. A port +// override may be specified in the usual way with a colon. Ports may be given +// as decimal numbers or symbolic names (in which case an /etc/services lookup +// is performed). +// +// If no port override is given in host_and_port then default_port will be used +// as the port number to connect to. +// +// In general, host_and_port is expected to be provided by the user (allowing +// them to give the hostname, and a port override if necessary) and default_port +// is expected to be provided by the application. +// +// In the case that an IP address is given, a single connection attempt is made. +// In the case that a name is given, multiple connection attempts may be made, +// in turn and according to the number of address records in DNS, until a +// connection succeeds. +// +// Upon a successful connection, a new Connection is constructed and returned. +// The caller owns this new object and must drop their reference to it when +// finished with it. +// +// In the event of any failure (DNS error, service not found, no hosts +// connectable) NULL is returned and error (if non-NULL) is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostAndPort: name and optionally port of the host to connect to. +// - defaultPort: default port to connect to. +// +// The function returns the following values: +// +// - socketConnection on success, NULL on error. +func (client *SocketClient) ConnectToHost(ctx context.Context, hostAndPort string, defaultPort uint16) (*SocketConnection, error) { + var _arg0 *C.GSocketClient // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.guint16 // out + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostAndPort))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint16(defaultPort) + + _cret = C.g_socket_client_connect_to_host(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(client) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostAndPort) + runtime.KeepAlive(defaultPort) + + var _socketConnection *SocketConnection // out + var _goerr error // out + + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketConnection, _goerr +} + +// ConnectToHostAsync: this is the asynchronous version of +// g_socket_client_connect_to_host(). +// +// When the operation is finished callback will be called. You can then call +// g_socket_client_connect_to_host_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - hostAndPort: name and optionally the port of the host to connect to. +// - defaultPort: default port to connect to. +// - callback (optional): ReadyCallback. +func (client *SocketClient) ConnectToHostAsync(ctx context.Context, hostAndPort string, defaultPort uint16, callback AsyncReadyCallback) { + var _arg0 *C.GSocketClient // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.guint16 // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostAndPort))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint16(defaultPort) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_socket_client_connect_to_host_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(client) + runtime.KeepAlive(ctx) + runtime.KeepAlive(hostAndPort) + runtime.KeepAlive(defaultPort) + runtime.KeepAlive(callback) +} + +// ConnectToHostFinish finishes an async connect operation. See +// g_socket_client_connect_to_host_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - socketConnection on success, NULL on error. +func (client *SocketClient) ConnectToHostFinish(result AsyncResulter) (*SocketConnection, error) { + var _arg0 *C.GSocketClient // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_socket_client_connect_to_host_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(client) + runtime.KeepAlive(result) + + var _socketConnection *SocketConnection // out + var _goerr error // out + + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketConnection, _goerr +} + +// ConnectToService attempts to create a TCP connection to a service. +// +// This call looks up the SRV record for service at domain for the "tcp" +// protocol. It then attempts to connect, in turn, to each of the hosts +// providing the service until either a connection succeeds or there are no +// hosts remaining. +// +// Upon a successful connection, a new Connection is constructed and returned. +// The caller owns this new object and must drop their reference to it when +// finished with it. +// +// In the event of any failure (DNS error, service not found, no hosts +// connectable) NULL is returned and error (if non-NULL) is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - domain name. +// - service: name of the service to connect to. +// +// The function returns the following values: +// +// - socketConnection if successful, or NULL on error. +func (client *SocketClient) ConnectToService(ctx context.Context, domain, service string) (*SocketConnection, error) { + var _arg0 *C.GSocketClient // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(service))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_socket_client_connect_to_service(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(client) + runtime.KeepAlive(ctx) + runtime.KeepAlive(domain) + runtime.KeepAlive(service) + + var _socketConnection *SocketConnection // out + var _goerr error // out + + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketConnection, _goerr +} + +// ConnectToServiceAsync: this is the asynchronous version of +// g_socket_client_connect_to_service(). +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - domain name. +// - service: name of the service to connect to. +// - callback (optional): ReadyCallback. +func (client *SocketClient) ConnectToServiceAsync(ctx context.Context, domain, service string, callback AsyncReadyCallback) { + var _arg0 *C.GSocketClient // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(service))) + defer C.free(unsafe.Pointer(_arg2)) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_socket_client_connect_to_service_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(client) + runtime.KeepAlive(ctx) + runtime.KeepAlive(domain) + runtime.KeepAlive(service) + runtime.KeepAlive(callback) +} + +// ConnectToServiceFinish finishes an async connect operation. See +// g_socket_client_connect_to_service_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - socketConnection on success, NULL on error. +func (client *SocketClient) ConnectToServiceFinish(result AsyncResulter) (*SocketConnection, error) { + var _arg0 *C.GSocketClient // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_socket_client_connect_to_service_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(client) + runtime.KeepAlive(result) + + var _socketConnection *SocketConnection // out + var _goerr error // out + + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketConnection, _goerr +} + +// ConnectToURI: this is a helper function for g_socket_client_connect(). +// +// Attempts to create a TCP connection with a network URI. +// +// uri may be any valid URI containing an "authority" (hostname/port) component. +// If a port is not specified in the URI, default_port will be used. TLS will +// be negotiated if Client:tls is TRUE. (Client does not know to automatically +// assume TLS for certain URI schemes.) +// +// Using this rather than g_socket_client_connect() or +// g_socket_client_connect_to_host() allows Client to determine when to use +// application-specific proxy protocols. +// +// Upon a successful connection, a new Connection is constructed and returned. +// The caller owns this new object and must drop their reference to it when +// finished with it. +// +// In the event of any failure (DNS error, service not found, no hosts +// connectable) NULL is returned and error (if non-NULL) is set accordingly. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - uri: network URI. +// - defaultPort: default port to connect to. +// +// The function returns the following values: +// +// - socketConnection on success, NULL on error. +func (client *SocketClient) ConnectToURI(ctx context.Context, uri string, defaultPort uint16) (*SocketConnection, error) { + var _arg0 *C.GSocketClient // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.guint16 // out + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint16(defaultPort) + + _cret = C.g_socket_client_connect_to_uri(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(client) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uri) + runtime.KeepAlive(defaultPort) + + var _socketConnection *SocketConnection // out + var _goerr error // out + + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketConnection, _goerr +} + +// ConnectToURIAsync: this is the asynchronous version of +// g_socket_client_connect_to_uri(). +// +// When the operation is finished callback will be called. You can then call +// g_socket_client_connect_to_uri_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - uri: network uri. +// - defaultPort: default port to connect to. +// - callback (optional): ReadyCallback. +func (client *SocketClient) ConnectToURIAsync(ctx context.Context, uri string, defaultPort uint16, callback AsyncReadyCallback) { + var _arg0 *C.GSocketClient // out + var _arg3 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 C.guint16 // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint16(defaultPort) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_socket_client_connect_to_uri_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(client) + runtime.KeepAlive(ctx) + runtime.KeepAlive(uri) + runtime.KeepAlive(defaultPort) + runtime.KeepAlive(callback) +} + +// ConnectToURIFinish finishes an async connect operation. See +// g_socket_client_connect_to_uri_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - socketConnection on success, NULL on error. +func (client *SocketClient) ConnectToURIFinish(result AsyncResulter) (*SocketConnection, error) { + var _arg0 *C.GSocketClient // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_socket_client_connect_to_uri_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(client) + runtime.KeepAlive(result) + + var _socketConnection *SocketConnection // out + var _goerr error // out + + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketConnection, _goerr +} + +// EnableProxy gets the proxy enable state; see +// g_socket_client_set_enable_proxy(). +// +// The function returns the following values: +// +// - ok: whether proxying is enabled. +func (client *SocketClient) EnableProxy() bool { + var _arg0 *C.GSocketClient // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + + _cret = C.g_socket_client_get_enable_proxy(_arg0) + runtime.KeepAlive(client) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Family gets the socket family of the socket client. +// +// See g_socket_client_set_family() for details. +// +// The function returns the following values: +// +// - socketFamily: Family. +func (client *SocketClient) Family() SocketFamily { + var _arg0 *C.GSocketClient // out + var _cret C.GSocketFamily // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + + _cret = C.g_socket_client_get_family(_arg0) + runtime.KeepAlive(client) + + var _socketFamily SocketFamily // out + + _socketFamily = SocketFamily(_cret) + + return _socketFamily +} + +// LocalAddress gets the local address of the socket client. +// +// See g_socket_client_set_local_address() for details. +// +// The function returns the following values: +// +// - socketAddress (optional) or NULL. Do not free. +func (client *SocketClient) LocalAddress() SocketAddresser { + var _arg0 *C.GSocketClient // out + var _cret *C.GSocketAddress // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + + _cret = C.g_socket_client_get_local_address(_arg0) + runtime.KeepAlive(client) + + var _socketAddress SocketAddresser // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _socketAddress = rv + } + } + + return _socketAddress +} + +// Protocol gets the protocol name type of the socket client. +// +// See g_socket_client_set_protocol() for details. +// +// The function returns the following values: +// +// - socketProtocol: Protocol. +func (client *SocketClient) Protocol() SocketProtocol { + var _arg0 *C.GSocketClient // out + var _cret C.GSocketProtocol // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + + _cret = C.g_socket_client_get_protocol(_arg0) + runtime.KeepAlive(client) + + var _socketProtocol SocketProtocol // out + + _socketProtocol = SocketProtocol(_cret) + + return _socketProtocol +} + +// ProxyResolver gets the Resolver being used by client. Normally, this will be +// the resolver returned by g_proxy_resolver_get_default(), but you can override +// it with g_socket_client_set_proxy_resolver(). +// +// The function returns the following values: +// +// - proxyResolver being used by client. +func (client *SocketClient) ProxyResolver() *ProxyResolver { + var _arg0 *C.GSocketClient // out + var _cret *C.GProxyResolver // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + + _cret = C.g_socket_client_get_proxy_resolver(_arg0) + runtime.KeepAlive(client) + + var _proxyResolver *ProxyResolver // out + + _proxyResolver = wrapProxyResolver(coreglib.Take(unsafe.Pointer(_cret))) + + return _proxyResolver +} + +// SocketType gets the socket type of the socket client. +// +// See g_socket_client_set_socket_type() for details. +// +// The function returns the following values: +// +// - socketType: Family. +func (client *SocketClient) SocketType() SocketType { + var _arg0 *C.GSocketClient // out + var _cret C.GSocketType // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + + _cret = C.g_socket_client_get_socket_type(_arg0) + runtime.KeepAlive(client) + + var _socketType SocketType // out + + _socketType = SocketType(_cret) + + return _socketType +} + +// Timeout gets the I/O timeout time for sockets created by client. +// +// See g_socket_client_set_timeout() for details. +// +// The function returns the following values: +// +// - guint: timeout in seconds. +func (client *SocketClient) Timeout() uint { + var _arg0 *C.GSocketClient // out + var _cret C.guint // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + + _cret = C.g_socket_client_get_timeout(_arg0) + runtime.KeepAlive(client) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// TLS gets whether client creates TLS connections. See +// g_socket_client_set_tls() for details. +// +// The function returns the following values: +// +// - ok: whether client uses TLS. +func (client *SocketClient) TLS() bool { + var _arg0 *C.GSocketClient // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + + _cret = C.g_socket_client_get_tls(_arg0) + runtime.KeepAlive(client) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TLSValidationFlags gets the TLS validation flags used creating TLS +// connections via client. +// +// This function does not work as originally designed and is impossible to use +// correctly. See Client:tls-validation-flags for more information. +// +// Deprecated: Do not attempt to ignore validation errors. +// +// The function returns the following values: +// +// - tlsCertificateFlags: TLS validation flags. +func (client *SocketClient) TLSValidationFlags() TLSCertificateFlags { + var _arg0 *C.GSocketClient // out + var _cret C.GTlsCertificateFlags // in + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + + _cret = C.g_socket_client_get_tls_validation_flags(_arg0) + runtime.KeepAlive(client) + + var _tlsCertificateFlags TLSCertificateFlags // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + + return _tlsCertificateFlags +} + +// SetEnableProxy sets whether or not client attempts to make connections via +// a proxy server. When enabled (the default), Client will use a Resolver to +// determine if a proxy protocol such as SOCKS is needed, and automatically do +// the necessary proxy negotiation. +// +// See also g_socket_client_set_proxy_resolver(). +// +// The function takes the following parameters: +// +// - enable: whether to enable proxies. +func (client *SocketClient) SetEnableProxy(enable bool) { + var _arg0 *C.GSocketClient // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + if enable { + _arg1 = C.TRUE + } + + C.g_socket_client_set_enable_proxy(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(enable) +} + +// SetFamily sets the socket family of the socket client. If this is set to +// something other than G_SOCKET_FAMILY_INVALID then the sockets created by this +// object will be of the specified family. +// +// This might be useful for instance if you want to force the local connection +// to be an ipv4 socket, even though the address might be an ipv6 mapped to ipv4 +// address. +// +// The function takes the following parameters: +// +// - family: Family. +func (client *SocketClient) SetFamily(family SocketFamily) { + var _arg0 *C.GSocketClient // out + var _arg1 C.GSocketFamily // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = C.GSocketFamily(family) + + C.g_socket_client_set_family(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(family) +} + +// SetLocalAddress sets the local address of the socket client. The sockets +// created by this object will bound to the specified address (if not NULL) +// before connecting. +// +// This is useful if you want to ensure that the local side of the connection is +// on a specific port, or on a specific interface. +// +// The function takes the following parameters: +// +// - address (optional) or NULL. +func (client *SocketClient) SetLocalAddress(address SocketAddresser) { + var _arg0 *C.GSocketClient // out + var _arg1 *C.GSocketAddress // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + if address != nil { + _arg1 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + } + + C.g_socket_client_set_local_address(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(address) +} + +// SetProtocol sets the protocol of the socket client. The sockets created by +// this object will use of the specified protocol. +// +// If protocol is G_SOCKET_PROTOCOL_DEFAULT that means to use the default +// protocol for the socket family and type. +// +// The function takes the following parameters: +// +// - protocol: Protocol. +func (client *SocketClient) SetProtocol(protocol SocketProtocol) { + var _arg0 *C.GSocketClient // out + var _arg1 C.GSocketProtocol // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = C.GSocketProtocol(protocol) + + C.g_socket_client_set_protocol(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(protocol) +} + +// SetProxyResolver overrides the Resolver used by client. You can call this if +// you want to use specific proxies, rather than using the system default proxy +// settings. +// +// Note that whether or not the proxy resolver is actually used depends on the +// setting of Client:enable-proxy, which is not changed by this function (but +// which is TRUE by default). +// +// The function takes the following parameters: +// +// - proxyResolver (optional) or NULL for the default. +func (client *SocketClient) SetProxyResolver(proxyResolver ProxyResolverer) { + var _arg0 *C.GSocketClient // out + var _arg1 *C.GProxyResolver // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + if proxyResolver != nil { + _arg1 = (*C.GProxyResolver)(unsafe.Pointer(coreglib.InternObject(proxyResolver).Native())) + } + + C.g_socket_client_set_proxy_resolver(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(proxyResolver) +} + +// SetSocketType sets the socket type of the socket client. The sockets created +// by this object will be of the specified type. +// +// It doesn't make sense to specify a type of G_SOCKET_TYPE_DATAGRAM, +// as GSocketClient is used for connection oriented services. +// +// The function takes the following parameters: +// +// - typ: Type. +func (client *SocketClient) SetSocketType(typ SocketType) { + var _arg0 *C.GSocketClient // out + var _arg1 C.GSocketType // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = C.GSocketType(typ) + + C.g_socket_client_set_socket_type(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(typ) +} + +// SetTimeout sets the I/O timeout for sockets created by client. timeout is a +// time in seconds, or 0 for no timeout (the default). +// +// The timeout value affects the initial connection attempt as well, so setting +// this may cause calls to g_socket_client_connect(), etc, to fail with +// G_IO_ERROR_TIMED_OUT. +// +// The function takes the following parameters: +// +// - timeout: timeout. +func (client *SocketClient) SetTimeout(timeout uint) { + var _arg0 *C.GSocketClient // out + var _arg1 C.guint // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = C.guint(timeout) + + C.g_socket_client_set_timeout(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(timeout) +} + +// SetTLS sets whether client creates TLS (aka SSL) connections. If tls is TRUE, +// client will wrap its connections in a ClientConnection and perform a TLS +// handshake when connecting. +// +// Note that since Client must return a Connection, but ClientConnection +// is not a Connection, this actually wraps the resulting +// ClientConnection in a WrapperConnection when returning it. You can use +// g_tcp_wrapper_connection_get_base_io_stream() on the return value to extract +// the ClientConnection. +// +// If you need to modify the behavior of the TLS handshake (eg, +// by setting a client-side certificate to use, or connecting to +// the Connection::accept-certificate signal), you can connect to +// client's Client::event signal and wait for it to be emitted with +// G_SOCKET_CLIENT_TLS_HANDSHAKING, which will give you a chance to see the +// ClientConnection before the handshake starts. +// +// The function takes the following parameters: +// +// - tls: whether to use TLS. +func (client *SocketClient) SetTLS(tls bool) { + var _arg0 *C.GSocketClient // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + if tls { + _arg1 = C.TRUE + } + + C.g_socket_client_set_tls(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(tls) +} + +// SetTLSValidationFlags sets the TLS validation flags used when creating TLS +// connections via client. The default value is G_TLS_CERTIFICATE_VALIDATE_ALL. +// +// This function does not work as originally designed and is impossible to use +// correctly. See Client:tls-validation-flags for more information. +// +// Deprecated: Do not attempt to ignore validation errors. +// +// The function takes the following parameters: +// +// - flags: validation flags. +func (client *SocketClient) SetTLSValidationFlags(flags TLSCertificateFlags) { + var _arg0 *C.GSocketClient // out + var _arg1 C.GTlsCertificateFlags // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = C.GTlsCertificateFlags(flags) + + C.g_socket_client_set_tls_validation_flags(_arg0, _arg1) + runtime.KeepAlive(client) + runtime.KeepAlive(flags) +} + +// The function takes the following parameters: +// +// - event +// - connectable +// - connection +func (client *SocketClient) event(event SocketClientEvent, connectable SocketConnectabler, connection IOStreamer) { + gclass := (*C.GSocketClientClass)(coreglib.PeekParentClass(client)) + fnarg := gclass.event + + var _arg0 *C.GSocketClient // out + var _arg1 C.GSocketClientEvent // out + var _arg2 *C.GSocketConnectable // out + var _arg3 *C.GIOStream // out + + _arg0 = (*C.GSocketClient)(unsafe.Pointer(coreglib.InternObject(client).Native())) + _arg1 = C.GSocketClientEvent(event) + _arg2 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(connectable).Native())) + _arg3 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + C._gotk4_gio2_SocketClient_virtual_event(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(client) + runtime.KeepAlive(event) + runtime.KeepAlive(connectable) + runtime.KeepAlive(connection) +} + +// SocketConnectionOverrides contains methods that are overridable. +type SocketConnectionOverrides struct { +} + +func defaultSocketConnectionOverrides(v *SocketConnection) SocketConnectionOverrides { + return SocketConnectionOverrides{} +} + +// SocketConnection: GSocketConnection is a gio.IOStream for a connected socket. +// They can be created either by gio.SocketClient when connecting to a host, +// or by gio.SocketListener when accepting a new client. +// +// The type of the GSocketConnection object returned from these calls depends on +// the type of the underlying socket that is in use. For instance, for a TCP/IP +// connection it will be a gio.TCPConnection. +// +// Choosing what type of object to construct is done with the socket connection +// factory, and it is possible for third parties to register custom socket +// connection types for specific combination of socket family/type/protocol +// using gio.SocketConnection().FactoryRegisterType. +// +// To close a GSocketConnection, use gio.IOStream.Close(). Closing both +// substreams of the gio.IOStream separately will not close the underlying +// gio.Socket. +type SocketConnection struct { + _ [0]func() // equal guard + IOStream +} + +var ( + _ IOStreamer = (*SocketConnection)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*SocketConnection, *SocketConnectionClass, SocketConnectionOverrides]( + GTypeSocketConnection, + initSocketConnectionClass, + wrapSocketConnection, + defaultSocketConnectionOverrides, + ) +} + +func initSocketConnectionClass(gclass unsafe.Pointer, overrides SocketConnectionOverrides, classInitFunc func(*SocketConnectionClass)) { + if classInitFunc != nil { + class := (*SocketConnectionClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSocketConnection(obj *coreglib.Object) *SocketConnection { + return &SocketConnection{ + IOStream: IOStream{ + Object: obj, + }, + } +} + +func marshalSocketConnection(p uintptr) (interface{}, error) { + return wrapSocketConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectSocketConnection: connect connection to the specified remote address. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - address specifying the remote address. +func (connection *SocketConnection) ConnectSocketConnection(ctx context.Context, address SocketAddresser) error { + var _arg0 *C.GSocketConnection // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GSocketAddress // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocketConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + + C.g_socket_connection_connect(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// ConnectAsync: asynchronously connect connection to the specified remote +// address. +// +// This clears the #GSocket:blocking flag on connection's underlying socket if +// it is currently set. +// +// If #GSocket:timeout is set, the operation will time out and return +// G_IO_ERROR_TIMED_OUT after that period. Otherwise, it will continue +// indefinitely until operating system timeouts (if any) are hit. +// +// Use g_socket_connection_connect_finish() to retrieve the result. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable or NULL. +// - address specifying the remote address. +// - callback (optional): ReadyCallback. +func (connection *SocketConnection) ConnectAsync(ctx context.Context, address SocketAddresser, callback AsyncReadyCallback) { + var _arg0 *C.GSocketConnection // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GSocketAddress // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GSocketConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_socket_connection_connect_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(connection) + runtime.KeepAlive(ctx) + runtime.KeepAlive(address) + runtime.KeepAlive(callback) +} + +// ConnectFinish gets the result of a g_socket_connection_connect_async() call. +// +// The function takes the following parameters: +// +// - result: Result. +func (connection *SocketConnection) ConnectFinish(result AsyncResulter) error { + var _arg0 *C.GSocketConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocketConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_socket_connection_connect_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(connection) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// LocalAddress: try to get the local address of a socket connection. +// +// The function returns the following values: +// +// - socketAddress or NULL on error. Free the returned object with +// g_object_unref(). +func (connection *SocketConnection) LocalAddress() (SocketAddresser, error) { + var _arg0 *C.GSocketConnection // out + var _cret *C.GSocketAddress // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_socket_connection_get_local_address(_arg0, &_cerr) + runtime.KeepAlive(connection) + + var _socketAddress SocketAddresser // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.SocketAddresser is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _socketAddress = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketAddress, _goerr +} + +// RemoteAddress: try to get the remote address of a socket connection. +// +// Since GLib 2.40, when used with g_socket_client_connect() +// or g_socket_client_connect_async(), during emission of +// G_SOCKET_CLIENT_CONNECTING, this function will return the remote address +// that will be used for the connection. This allows applications to print e.g. +// "Connecting to example.com (10.42.77.3)...". +// +// The function returns the following values: +// +// - socketAddress or NULL on error. Free the returned object with +// g_object_unref(). +func (connection *SocketConnection) RemoteAddress() (SocketAddresser, error) { + var _arg0 *C.GSocketConnection // out + var _cret *C.GSocketAddress // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_socket_connection_get_remote_address(_arg0, &_cerr) + runtime.KeepAlive(connection) + + var _socketAddress SocketAddresser // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.SocketAddresser is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _socketAddress = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _socketAddress, _goerr +} + +// Socket gets the underlying #GSocket object of the connection. This can +// be useful if you want to do something unusual on it not supported by the +// Connection APIs. +// +// The function returns the following values: +// +// - socket or NULL on error. +func (connection *SocketConnection) Socket() *Socket { + var _arg0 *C.GSocketConnection // out + var _cret *C.GSocket // in + + _arg0 = (*C.GSocketConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_socket_connection_get_socket(_arg0) + runtime.KeepAlive(connection) + + var _socket *Socket // out + + _socket = wrapSocket(coreglib.Take(unsafe.Pointer(_cret))) + + return _socket +} + +// IsConnected checks if connection is connected. This is equivalent to calling +// g_socket_is_connected() on connection's underlying #GSocket. +// +// The function returns the following values: +// +// - ok: whether connection is connected. +func (connection *SocketConnection) IsConnected() bool { + var _arg0 *C.GSocketConnection // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocketConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_socket_connection_is_connected(_arg0) + runtime.KeepAlive(connection) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SocketConnectionFactoryLookupType looks up the #GType to be used when +// creating socket connections on sockets with the specified family, type and +// protocol_id. +// +// If no type is registered, the Connection base type is returned. +// +// The function takes the following parameters: +// +// - family: Family. +// - typ: Type. +// - protocolId: protocol id. +// +// The function returns the following values: +// +// - gType: #GType. +func SocketConnectionFactoryLookupType(family SocketFamily, typ SocketType, protocolId int) coreglib.Type { + var _arg1 C.GSocketFamily // out + var _arg2 C.GSocketType // out + var _arg3 C.gint // out + var _cret C.GType // in + + _arg1 = C.GSocketFamily(family) + _arg2 = C.GSocketType(typ) + _arg3 = C.gint(protocolId) + + _cret = C.g_socket_connection_factory_lookup_type(_arg1, _arg2, _arg3) + runtime.KeepAlive(family) + runtime.KeepAlive(typ) + runtime.KeepAlive(protocolId) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// SocketConnectionFactoryRegisterType looks up the #GType to be used when +// creating socket connections on sockets with the specified family, type and +// protocol. +// +// If no type is registered, the Connection base type is returned. +// +// The function takes the following parameters: +// +// - gType inheriting from G_TYPE_SOCKET_CONNECTION. +// - family: Family. +// - typ: Type. +// - protocol id. +func SocketConnectionFactoryRegisterType(gType coreglib.Type, family SocketFamily, typ SocketType, protocol int) { + var _arg1 C.GType // out + var _arg2 C.GSocketFamily // out + var _arg3 C.GSocketType // out + var _arg4 C.gint // out + + _arg1 = C.GType(gType) + _arg2 = C.GSocketFamily(family) + _arg3 = C.GSocketType(typ) + _arg4 = C.gint(protocol) + + C.g_socket_connection_factory_register_type(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(gType) + runtime.KeepAlive(family) + runtime.KeepAlive(typ) + runtime.KeepAlive(protocol) +} + +// SocketControlMessageOverrides contains methods that are overridable. +type SocketControlMessageOverrides struct { + // Level returns the "level" (i.e. the originating protocol) of the control + // message. This is often SOL_SOCKET. + // + // The function returns the following values: + // + // - gint: integer describing the level. + Level func() int + // Size returns the space required for the control message, not including + // headers or alignment. + // + // The function returns the following values: + // + // - gsize: number of bytes required. + Size func() uint + // Type gets the protocol specific type of the message. + Type func() int + // Serialize converts the data in the message to bytes placed in the + // message. + // + // data is guaranteed to have enough space to fit the size returned by + // g_socket_control_message_get_size() on this object. + // + // The function takes the following parameters: + // + // - data: buffer to write data to. + Serialize func(data unsafe.Pointer) +} + +func defaultSocketControlMessageOverrides(v *SocketControlMessage) SocketControlMessageOverrides { + return SocketControlMessageOverrides{ + Level: v.level, + Size: v.size, + Type: v.typ, + Serialize: v.serialize, + } +} + +// SocketControlMessage: GSocketControlMessage is a special-purpose utility +// message that can be sent to or received from a gio.Socket. These types of +// messages are often called ‘ancillary data’. +// +// The message can represent some sort of special instruction to or information +// from the socket or can represent a special kind of transfer to the peer (for +// example, sending a file descriptor over a UNIX socket). +// +// These messages are sent with gio.Socket.SendMessage() and received with +// gio.Socket.ReceiveMessage(). +// +// To extend the set of control message that can be sent, subclass this class +// and override the get_size, get_level, get_type and serialize methods. +// +// To extend the set of control messages that can be received, subclass +// this class and implement the deserialize method. Also, make sure your +// class is registered with the gobject.Type type system before calling +// gio.Socket.ReceiveMessage() to read such a message. +type SocketControlMessage struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*SocketControlMessage)(nil) +) + +// SocketControlMessager describes types inherited from class SocketControlMessage. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type SocketControlMessager interface { + coreglib.Objector + baseSocketControlMessage() *SocketControlMessage +} + +var _ SocketControlMessager = (*SocketControlMessage)(nil) + +func init() { + coreglib.RegisterClassInfo[*SocketControlMessage, *SocketControlMessageClass, SocketControlMessageOverrides]( + GTypeSocketControlMessage, + initSocketControlMessageClass, + wrapSocketControlMessage, + defaultSocketControlMessageOverrides, + ) +} + +func initSocketControlMessageClass(gclass unsafe.Pointer, overrides SocketControlMessageOverrides, classInitFunc func(*SocketControlMessageClass)) { + pclass := (*C.GSocketControlMessageClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeSocketControlMessage)))) + + if overrides.Level != nil { + pclass.get_level = (*[0]byte)(C._gotk4_gio2_SocketControlMessageClass_get_level) + } + + if overrides.Size != nil { + pclass.get_size = (*[0]byte)(C._gotk4_gio2_SocketControlMessageClass_get_size) + } + + if overrides.Type != nil { + pclass.get_type = (*[0]byte)(C._gotk4_gio2_SocketControlMessageClass_get_type) + } + + if overrides.Serialize != nil { + pclass.serialize = (*[0]byte)(C._gotk4_gio2_SocketControlMessageClass_serialize) + } + + if classInitFunc != nil { + class := (*SocketControlMessageClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSocketControlMessage(obj *coreglib.Object) *SocketControlMessage { + return &SocketControlMessage{ + Object: obj, + } +} + +func marshalSocketControlMessage(p uintptr) (interface{}, error) { + return wrapSocketControlMessage(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (message *SocketControlMessage) baseSocketControlMessage() *SocketControlMessage { + return message +} + +// BaseSocketControlMessage returns the underlying base object. +func BaseSocketControlMessage(obj SocketControlMessager) *SocketControlMessage { + return obj.baseSocketControlMessage() +} + +// Level returns the "level" (i.e. the originating protocol) of the control +// message. This is often SOL_SOCKET. +// +// The function returns the following values: +// +// - gint: integer describing the level. +func (message *SocketControlMessage) Level() int { + var _arg0 *C.GSocketControlMessage // out + var _cret C.int // in + + _arg0 = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_socket_control_message_get_level(_arg0) + runtime.KeepAlive(message) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// MsgType returns the protocol specific type of the control message. For +// instance, for UNIX fd passing this would be SCM_RIGHTS. +// +// The function returns the following values: +// +// - gint: integer describing the type of control message. +func (message *SocketControlMessage) MsgType() int { + var _arg0 *C.GSocketControlMessage // out + var _cret C.int // in + + _arg0 = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_socket_control_message_get_msg_type(_arg0) + runtime.KeepAlive(message) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Size returns the space required for the control message, not including +// headers or alignment. +// +// The function returns the following values: +// +// - gsize: number of bytes required. +func (message *SocketControlMessage) Size() uint { + var _arg0 *C.GSocketControlMessage // out + var _cret C.gsize // in + + _arg0 = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C.g_socket_control_message_get_size(_arg0) + runtime.KeepAlive(message) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Serialize converts the data in the message to bytes placed in the message. +// +// data is guaranteed to have enough space to fit the size returned by +// g_socket_control_message_get_size() on this object. +// +// The function takes the following parameters: +// +// - data: buffer to write data to. +func (message *SocketControlMessage) Serialize(data unsafe.Pointer) { + var _arg0 *C.GSocketControlMessage // out + var _arg1 C.gpointer // out + + _arg0 = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = (C.gpointer)(unsafe.Pointer(data)) + + C.g_socket_control_message_serialize(_arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(data) +} + +// Level returns the "level" (i.e. the originating protocol) of the control +// message. This is often SOL_SOCKET. +// +// The function returns the following values: +// +// - gint: integer describing the level. +func (message *SocketControlMessage) level() int { + gclass := (*C.GSocketControlMessageClass)(coreglib.PeekParentClass(message)) + fnarg := gclass.get_level + + var _arg0 *C.GSocketControlMessage // out + var _cret C.int // in + + _arg0 = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C._gotk4_gio2_SocketControlMessage_virtual_get_level(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(message) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Size returns the space required for the control message, not including +// headers or alignment. +// +// The function returns the following values: +// +// - gsize: number of bytes required. +func (message *SocketControlMessage) size() uint { + gclass := (*C.GSocketControlMessageClass)(coreglib.PeekParentClass(message)) + fnarg := gclass.get_size + + var _arg0 *C.GSocketControlMessage // out + var _cret C.gsize // in + + _arg0 = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C._gotk4_gio2_SocketControlMessage_virtual_get_size(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(message) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Typ gets the protocol specific type of the message. +func (message *SocketControlMessage) typ() int { + gclass := (*C.GSocketControlMessageClass)(coreglib.PeekParentClass(message)) + fnarg := gclass.get_type + + var _arg0 *C.GSocketControlMessage // out + var _cret C.int // in + + _arg0 = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + + _cret = C._gotk4_gio2_SocketControlMessage_virtual_get_type(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(message) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Serialize converts the data in the message to bytes placed in the message. +// +// data is guaranteed to have enough space to fit the size returned by +// g_socket_control_message_get_size() on this object. +// +// The function takes the following parameters: +// +// - data: buffer to write data to. +func (message *SocketControlMessage) serialize(data unsafe.Pointer) { + gclass := (*C.GSocketControlMessageClass)(coreglib.PeekParentClass(message)) + fnarg := gclass.serialize + + var _arg0 *C.GSocketControlMessage // out + var _arg1 C.gpointer // out + + _arg0 = (*C.GSocketControlMessage)(unsafe.Pointer(coreglib.InternObject(message).Native())) + _arg1 = (C.gpointer)(unsafe.Pointer(data)) + + C._gotk4_gio2_SocketControlMessage_virtual_serialize(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(message) + runtime.KeepAlive(data) +} + +// SocketControlMessageDeserialize tries to deserialize a socket control message +// of a given level and type. This will ask all known (to GType) subclasses +// of ControlMessage if they can understand this kind of message and if so +// deserialize it into a ControlMessage. +// +// If there is no implementation for this kind of control message, NULL will be +// returned. +// +// The function takes the following parameters: +// +// - level: socket level. +// - typ: socket control message type for the given level. +// - data: pointer to the message data. +// +// The function returns the following values: +// +// - socketControlMessage (optional): deserialized message or NULL. +func SocketControlMessageDeserialize(level, typ int, data []byte) SocketControlMessager { + var _arg1 C.int // out + var _arg2 C.int // out + var _arg4 C.gpointer // out + var _arg3 C.gsize + var _cret *C.GSocketControlMessage // in + + _arg1 = C.int(level) + _arg2 = C.int(typ) + _arg3 = (C.gsize)(len(data)) + if len(data) > 0 { + _arg4 = (C.gpointer)(unsafe.Pointer(&data[0])) + } + + _cret = C.g_socket_control_message_deserialize(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(level) + runtime.KeepAlive(typ) + runtime.KeepAlive(data) + + var _socketControlMessage SocketControlMessager // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketControlMessager) + return ok + }) + rv, ok := casted.(SocketControlMessager) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketControlMessager") + } + _socketControlMessage = rv + } + } + + return _socketControlMessage +} + +// SocketListenerOverrides contains methods that are overridable. +type SocketListenerOverrides struct { + // Changed: virtual method called when the set of socket listened to + // changes. + Changed func() + // The function takes the following parameters: + // + // - event + // - socket + Event func(event SocketListenerEvent, socket *Socket) +} + +func defaultSocketListenerOverrides(v *SocketListener) SocketListenerOverrides { + return SocketListenerOverrides{ + Changed: v.changed, + Event: v.event, + } +} + +// SocketListener: GSocketListener is an object that keeps track of a set of +// server sockets and helps you accept sockets from any of the socket, either +// sync or async. +// +// Add addresses and ports to listen on using gio.SocketListener.AddAddress() +// and gio.SocketListener.AddInetPort(). These will be listened on until +// gio.SocketListener.Close() is called. Dropping your final reference to the +// GSocketListener will not cause gio.SocketListener.Close() to be called +// implicitly, as some references to the GSocketListener may be held internally. +// +// If you want to implement a network server, also look at gio.SocketService and +// gio.ThreadedSocketService which are subclasses of GSocketListener that make +// this even easier. +type SocketListener struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*SocketListener)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*SocketListener, *SocketListenerClass, SocketListenerOverrides]( + GTypeSocketListener, + initSocketListenerClass, + wrapSocketListener, + defaultSocketListenerOverrides, + ) +} + +func initSocketListenerClass(gclass unsafe.Pointer, overrides SocketListenerOverrides, classInitFunc func(*SocketListenerClass)) { + pclass := (*C.GSocketListenerClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeSocketListener)))) + + if overrides.Changed != nil { + pclass.changed = (*[0]byte)(C._gotk4_gio2_SocketListenerClass_changed) + } + + if overrides.Event != nil { + pclass.event = (*[0]byte)(C._gotk4_gio2_SocketListenerClass_event) + } + + if classInitFunc != nil { + class := (*SocketListenerClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSocketListener(obj *coreglib.Object) *SocketListener { + return &SocketListener{ + Object: obj, + } +} + +func marshalSocketListener(p uintptr) (interface{}, error) { + return wrapSocketListener(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectEvent is emitted when listener's activity on socket changes state. +// Note that when listener is used to listen on both IPv4 and IPv6, a separate +// set of signals will be emitted for each, and the order they happen in is +// undefined. +func (listener *SocketListener) ConnectEvent(f func(event SocketListenerEvent, socket *Socket)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(listener, "event", false, unsafe.Pointer(C._gotk4_gio2_SocketListener_ConnectEvent), f) +} + +// NewSocketListener creates a new Listener with no sockets to listen for. +// New listeners can be added with e.g. g_socket_listener_add_address() or +// g_socket_listener_add_inet_port(). +// +// The function returns the following values: +// +// - socketListener: new Listener. +func NewSocketListener() *SocketListener { + var _cret *C.GSocketListener // in + + _cret = C.g_socket_listener_new() + + var _socketListener *SocketListener // out + + _socketListener = wrapSocketListener(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _socketListener +} + +// Accept blocks waiting for a client to connect to any of the sockets added to +// the listener. Returns a Connection for the socket that was accepted. +// +// If source_object is not NULL it will be filled out with the source object +// specified when the corresponding socket or address was added to the listener. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - sourceObject (optional): location where #GObject pointer will be stored, +// or NULL. +// - socketConnection on success, NULL on error. +func (listener *SocketListener) Accept(ctx context.Context) (*coreglib.Object, *SocketConnection, error) { + var _arg0 *C.GSocketListener // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GObject // in + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_socket_listener_accept(_arg0, &_arg1, _arg2, &_cerr) + runtime.KeepAlive(listener) + runtime.KeepAlive(ctx) + + var _sourceObject *coreglib.Object // out + var _socketConnection *SocketConnection // out + var _goerr error // out + + if _arg1 != nil { + _sourceObject = coreglib.Take(unsafe.Pointer(_arg1)) + } + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _sourceObject, _socketConnection, _goerr +} + +// AcceptAsync: this is the asynchronous version of g_socket_listener_accept(). +// +// When the operation is finished callback will be called. You can then call +// g_socket_listener_accept_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - callback (optional): ReadyCallback. +func (listener *SocketListener) AcceptAsync(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GSocketListener // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_socket_listener_accept_async(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(listener) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// AcceptFinish finishes an async accept operation. See +// g_socket_listener_accept_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - sourceObject (optional): optional #GObject identifying this source. +// - socketConnection on success, NULL on error. +func (listener *SocketListener) AcceptFinish(result AsyncResulter) (*coreglib.Object, *SocketConnection, error) { + var _arg0 *C.GSocketListener // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.GObject // in + var _cret *C.GSocketConnection // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_socket_listener_accept_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(listener) + runtime.KeepAlive(result) + + var _sourceObject *coreglib.Object // out + var _socketConnection *SocketConnection // out + var _goerr error // out + + if _arg2 != nil { + _sourceObject = coreglib.Take(unsafe.Pointer(_arg2)) + } + _socketConnection = wrapSocketConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _sourceObject, _socketConnection, _goerr +} + +// AcceptSocket blocks waiting for a client to connect to any of the sockets +// added to the listener. Returns the #GSocket that was accepted. +// +// If you want to accept the high-level Connection, not a #GSocket, which is +// often the case, then you should use g_socket_listener_accept() instead. +// +// If source_object is not NULL it will be filled out with the source object +// specified when the corresponding socket or address was added to the listener. +// +// If cancellable is not NULL, then the operation can be cancelled by triggering +// the cancellable object from another thread. If the operation was cancelled, +// the error G_IO_ERROR_CANCELLED will be returned. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// +// The function returns the following values: +// +// - sourceObject (optional): location where #GObject pointer will be stored, +// or NULL. +// - socket on success, NULL on error. +func (listener *SocketListener) AcceptSocket(ctx context.Context) (*coreglib.Object, *Socket, error) { + var _arg0 *C.GSocketListener // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GObject // in + var _cret *C.GSocket // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + _cret = C.g_socket_listener_accept_socket(_arg0, &_arg1, _arg2, &_cerr) + runtime.KeepAlive(listener) + runtime.KeepAlive(ctx) + + var _sourceObject *coreglib.Object // out + var _socket *Socket // out + var _goerr error // out + + if _arg1 != nil { + _sourceObject = coreglib.Take(unsafe.Pointer(_arg1)) + } + _socket = wrapSocket(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _sourceObject, _socket, _goerr +} + +// AcceptSocketAsync: this is the asynchronous version of +// g_socket_listener_accept_socket(). +// +// When the operation is finished callback will be called. You can then call +// g_socket_listener_accept_socket_finish() to get the result of the operation. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - callback (optional): ReadyCallback. +func (listener *SocketListener) AcceptSocketAsync(ctx context.Context, callback AsyncReadyCallback) { + var _arg0 *C.GSocketListener // out + var _arg1 *C.GCancellable // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_socket_listener_accept_socket_async(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(listener) + runtime.KeepAlive(ctx) + runtime.KeepAlive(callback) +} + +// AcceptSocketFinish finishes an async accept operation. See +// g_socket_listener_accept_socket_async(). +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - sourceObject (optional): optional #GObject identifying this source. +// - socket on success, NULL on error. +func (listener *SocketListener) AcceptSocketFinish(result AsyncResulter) (*coreglib.Object, *Socket, error) { + var _arg0 *C.GSocketListener // out + var _arg1 *C.GAsyncResult // out + var _arg2 *C.GObject // in + var _cret *C.GSocket // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_socket_listener_accept_socket_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(listener) + runtime.KeepAlive(result) + + var _sourceObject *coreglib.Object // out + var _socket *Socket // out + var _goerr error // out + + if _arg2 != nil { + _sourceObject = coreglib.Take(unsafe.Pointer(_arg2)) + } + _socket = wrapSocket(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _sourceObject, _socket, _goerr +} + +// AddAddress creates a socket of type type and protocol protocol, binds it to +// address and adds it to the set of sockets we're accepting sockets from. +// +// Note that adding an IPv6 address, depending on the platform, may or may +// not result in a listener that also accepts IPv4 connections. For more +// deterministic behavior, see g_socket_listener_add_inet_port(). +// +// source_object will be passed out in the various calls to accept to identify +// this particular source, which is useful if you're listening on multiple +// addresses and do different things depending on what address is connected to. +// +// If successful and effective_address is non-NULL then it will be set to +// the address that the binding actually occurred at. This is helpful for +// determining the port number that was used for when requesting a binding to +// port 0 (ie: "any port"). This address, if requested, belongs to the caller +// and must be freed. +// +// Call g_socket_listener_close() to stop listening on address; this will +// not be done automatically when you drop your final reference to listener, +// as references may be held internally. +// +// The function takes the following parameters: +// +// - address: Address. +// - typ: Type. +// - protocol: Protocol. +// - sourceObject (optional): optional #GObject identifying this source. +// +// The function returns the following values: +// +// - effectiveAddress (optional): location to store the address that was bound +// to, or NULL. +func (listener *SocketListener) AddAddress(address SocketAddresser, typ SocketType, protocol SocketProtocol, sourceObject *coreglib.Object) (SocketAddresser, error) { + var _arg0 *C.GSocketListener // out + var _arg1 *C.GSocketAddress // out + var _arg2 C.GSocketType // out + var _arg3 C.GSocketProtocol // out + var _arg4 *C.GObject // out + var _arg5 *C.GSocketAddress // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + _arg1 = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(address).Native())) + _arg2 = C.GSocketType(typ) + _arg3 = C.GSocketProtocol(protocol) + if sourceObject != nil { + _arg4 = (*C.GObject)(unsafe.Pointer(sourceObject.Native())) + } + + C.g_socket_listener_add_address(_arg0, _arg1, _arg2, _arg3, _arg4, &_arg5, &_cerr) + runtime.KeepAlive(listener) + runtime.KeepAlive(address) + runtime.KeepAlive(typ) + runtime.KeepAlive(protocol) + runtime.KeepAlive(sourceObject) + + var _effectiveAddress SocketAddresser // out + var _goerr error // out + + if _arg5 != nil { + { + objptr := unsafe.Pointer(_arg5) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketAddresser) + return ok + }) + rv, ok := casted.(SocketAddresser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketAddresser") + } + _effectiveAddress = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _effectiveAddress, _goerr +} + +// AddAnyInetPort listens for TCP connections on any available port number for +// both IPv6 and IPv4 (if each is available). +// +// This is useful if you need to have a socket for incoming connections but +// don't care about the specific port number. +// +// source_object will be passed out in the various calls to accept to identify +// this particular source, which is useful if you're listening on multiple +// addresses and do different things depending on what address is connected to. +// +// The function takes the following parameters: +// +// - sourceObject (optional): optional #GObject identifying this source. +// +// The function returns the following values: +// +// - guint16: port number, or 0 in case of failure. +func (listener *SocketListener) AddAnyInetPort(sourceObject *coreglib.Object) (uint16, error) { + var _arg0 *C.GSocketListener // out + var _arg1 *C.GObject // out + var _cret C.guint16 // in + var _cerr *C.GError // in + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + if sourceObject != nil { + _arg1 = (*C.GObject)(unsafe.Pointer(sourceObject.Native())) + } + + _cret = C.g_socket_listener_add_any_inet_port(_arg0, _arg1, &_cerr) + runtime.KeepAlive(listener) + runtime.KeepAlive(sourceObject) + + var _guint16 uint16 // out + var _goerr error // out + + _guint16 = uint16(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint16, _goerr +} + +// AddInetPort: helper function for g_socket_listener_add_address() that creates +// a TCP/IP socket listening on IPv4 and IPv6 (if supported) on the specified +// port on all interfaces. +// +// source_object will be passed out in the various calls to accept to identify +// this particular source, which is useful if you're listening on multiple +// addresses and do different things depending on what address is connected to. +// +// Call g_socket_listener_close() to stop listening on port; this will not +// be done automatically when you drop your final reference to listener, +// as references may be held internally. +// +// The function takes the following parameters: +// +// - port: IP port number (non-zero). +// - sourceObject (optional): optional #GObject identifying this source. +func (listener *SocketListener) AddInetPort(port uint16, sourceObject *coreglib.Object) error { + var _arg0 *C.GSocketListener // out + var _arg1 C.guint16 // out + var _arg2 *C.GObject // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + _arg1 = C.guint16(port) + if sourceObject != nil { + _arg2 = (*C.GObject)(unsafe.Pointer(sourceObject.Native())) + } + + C.g_socket_listener_add_inet_port(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(listener) + runtime.KeepAlive(port) + runtime.KeepAlive(sourceObject) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// AddSocket adds socket to the set of sockets that we try to accept new clients +// from. The socket must be bound to a local address and listened to. +// +// source_object will be passed out in the various calls to accept to identify +// this particular source, which is useful if you're listening on multiple +// addresses and do different things depending on what address is connected to. +// +// The socket will not be automatically closed when the listener is finalized +// unless the listener held the final reference to the socket. Before GLib 2.42, +// the socket was automatically closed on finalization of the listener, even if +// references to it were held elsewhere. +// +// The function takes the following parameters: +// +// - socket: listening #GSocket. +// - sourceObject (optional): optional #GObject identifying this source. +func (listener *SocketListener) AddSocket(socket *Socket, sourceObject *coreglib.Object) error { + var _arg0 *C.GSocketListener // out + var _arg1 *C.GSocket // out + var _arg2 *C.GObject // out + var _cerr *C.GError // in + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + _arg1 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + if sourceObject != nil { + _arg2 = (*C.GObject)(unsafe.Pointer(sourceObject.Native())) + } + + C.g_socket_listener_add_socket(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(listener) + runtime.KeepAlive(socket) + runtime.KeepAlive(sourceObject) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Close closes all the sockets in the listener. +func (listener *SocketListener) Close() { + var _arg0 *C.GSocketListener // out + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + + C.g_socket_listener_close(_arg0) + runtime.KeepAlive(listener) +} + +// SetBacklog sets the listen backlog on the sockets in the listener. This must +// be called before adding any sockets, addresses or ports to the Listener (for +// example, by calling g_socket_listener_add_inet_port()) to be effective. +// +// See g_socket_set_listen_backlog() for details. +// +// The function takes the following parameters: +// +// - listenBacklog: integer. +func (listener *SocketListener) SetBacklog(listenBacklog int) { + var _arg0 *C.GSocketListener // out + var _arg1 C.int // out + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + _arg1 = C.int(listenBacklog) + + C.g_socket_listener_set_backlog(_arg0, _arg1) + runtime.KeepAlive(listener) + runtime.KeepAlive(listenBacklog) +} + +// Changed: virtual method called when the set of socket listened to changes. +func (listener *SocketListener) changed() { + gclass := (*C.GSocketListenerClass)(coreglib.PeekParentClass(listener)) + fnarg := gclass.changed + + var _arg0 *C.GSocketListener // out + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + + C._gotk4_gio2_SocketListener_virtual_changed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(listener) +} + +// The function takes the following parameters: +// +// - event +// - socket +func (listener *SocketListener) event(event SocketListenerEvent, socket *Socket) { + gclass := (*C.GSocketListenerClass)(coreglib.PeekParentClass(listener)) + fnarg := gclass.event + + var _arg0 *C.GSocketListener // out + var _arg1 C.GSocketListenerEvent // out + var _arg2 *C.GSocket // out + + _arg0 = (*C.GSocketListener)(unsafe.Pointer(coreglib.InternObject(listener).Native())) + _arg1 = C.GSocketListenerEvent(event) + _arg2 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + C._gotk4_gio2_SocketListener_virtual_event(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(listener) + runtime.KeepAlive(event) + runtime.KeepAlive(socket) +} + +// SocketServiceOverrides contains methods that are overridable. +type SocketServiceOverrides struct { + // Incoming: signal emitted when new connections are accepted. + // + // The function takes the following parameters: + // + // - connection + // - sourceObject + Incoming func(connection *SocketConnection, sourceObject *coreglib.Object) bool +} + +func defaultSocketServiceOverrides(v *SocketService) SocketServiceOverrides { + return SocketServiceOverrides{ + Incoming: v.incoming, + } +} + +// SocketService: GSocketService is an object that represents a service that is +// provided to the network or over local sockets. When a new connection is made +// to the service the gio.SocketService::incoming signal is emitted. +// +// A GSocketService is a subclass of gio.SocketListener and you need to add the +// addresses you want to accept connections on with the gio.SocketListener APIs. +// +// There are two options for implementing a network service based +// on GSocketService. The first is to create the service using +// gio.SocketService.New and to connect to the gio.SocketService::incoming +// signal. The second is to subclass GSocketService and override the default +// signal handler implementation. +// +// In either case, the handler must immediately return, or else it will block +// additional incoming connections from being serviced. If you are interested +// in writing connection handlers that contain blocking code then see +// gio.ThreadedSocketService. +// +// The socket service runs on the main loop of the thread-default context (see +// glib.MainContext.PushThreadDefault()) of the thread it is created in, and is +// not threadsafe in general. However, the calls to start and stop the service +// are thread-safe so these can be used from threads that handle incoming +// clients. +type SocketService struct { + _ [0]func() // equal guard + SocketListener +} + +var ( + _ coreglib.Objector = (*SocketService)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*SocketService, *SocketServiceClass, SocketServiceOverrides]( + GTypeSocketService, + initSocketServiceClass, + wrapSocketService, + defaultSocketServiceOverrides, + ) +} + +func initSocketServiceClass(gclass unsafe.Pointer, overrides SocketServiceOverrides, classInitFunc func(*SocketServiceClass)) { + pclass := (*C.GSocketServiceClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeSocketService)))) + + if overrides.Incoming != nil { + pclass.incoming = (*[0]byte)(C._gotk4_gio2_SocketServiceClass_incoming) + } + + if classInitFunc != nil { + class := (*SocketServiceClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapSocketService(obj *coreglib.Object) *SocketService { + return &SocketService{ + SocketListener: SocketListener{ + Object: obj, + }, + } +} + +func marshalSocketService(p uintptr) (interface{}, error) { + return wrapSocketService(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectIncoming signal is emitted when a new incoming connection to service +// needs to be handled. The handler must initiate the handling of connection, +// but may not block; in essence, asynchronous operations must be used. +// +// connection will be unreffed once the signal handler returns, so you need to +// ref it yourself if you are planning to use it. +func (service *SocketService) ConnectIncoming(f func(connection *SocketConnection, sourceObject *coreglib.Object) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(service, "incoming", false, unsafe.Pointer(C._gotk4_gio2_SocketService_ConnectIncoming), f) +} + +// NewSocketService creates a new Service with no sockets to listen for. +// New listeners can be added with e.g. g_socket_listener_add_address() or +// g_socket_listener_add_inet_port(). +// +// New services are created active, there is no need to call +// g_socket_service_start(), unless g_socket_service_stop() has been called +// before. +// +// The function returns the following values: +// +// - socketService: new Service. +func NewSocketService() *SocketService { + var _cret *C.GSocketService // in + + _cret = C.g_socket_service_new() + + var _socketService *SocketService // out + + _socketService = wrapSocketService(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _socketService +} + +// IsActive: check whether the service is active or not. An active service +// will accept new clients that connect, while a non-active service will let +// connecting clients queue up until the service is started. +// +// The function returns the following values: +// +// - ok: TRUE if the service is active, FALSE otherwise. +func (service *SocketService) IsActive() bool { + var _arg0 *C.GSocketService // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocketService)(unsafe.Pointer(coreglib.InternObject(service).Native())) + + _cret = C.g_socket_service_is_active(_arg0) + runtime.KeepAlive(service) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Start restarts the service, i.e. start accepting connections from the added +// sockets when the mainloop runs. This only needs to be called after the +// service has been stopped from g_socket_service_stop(). +// +// This call is thread-safe, so it may be called from a thread handling an +// incoming client request. +func (service *SocketService) Start() { + var _arg0 *C.GSocketService // out + + _arg0 = (*C.GSocketService)(unsafe.Pointer(coreglib.InternObject(service).Native())) + + C.g_socket_service_start(_arg0) + runtime.KeepAlive(service) +} + +// Stop stops the service, i.e. stops accepting connections from the added +// sockets when the mainloop runs. +// +// This call is thread-safe, so it may be called from a thread handling an +// incoming client request. +// +// Note that this only stops accepting new connections; it does not close +// the listening sockets, and you can call g_socket_service_start() again +// later to begin listening again. To close the listening sockets, call +// g_socket_listener_close(). (This will happen automatically when the Service +// is finalized.) +// +// This must be called before calling g_socket_listener_close() as the socket +// service will start accepting connections immediately when a new socket is +// added. +func (service *SocketService) Stop() { + var _arg0 *C.GSocketService // out + + _arg0 = (*C.GSocketService)(unsafe.Pointer(coreglib.InternObject(service).Native())) + + C.g_socket_service_stop(_arg0) + runtime.KeepAlive(service) +} + +// Incoming: signal emitted when new connections are accepted. +// +// The function takes the following parameters: +// +// - connection +// - sourceObject +func (service *SocketService) incoming(connection *SocketConnection, sourceObject *coreglib.Object) bool { + gclass := (*C.GSocketServiceClass)(coreglib.PeekParentClass(service)) + fnarg := gclass.incoming + + var _arg0 *C.GSocketService // out + var _arg1 *C.GSocketConnection // out + var _arg2 *C.GObject // out + var _cret C.gboolean // in + + _arg0 = (*C.GSocketService)(unsafe.Pointer(coreglib.InternObject(service).Native())) + _arg1 = (*C.GSocketConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.GObject)(unsafe.Pointer(sourceObject.Native())) + + _cret = C._gotk4_gio2_SocketService_virtual_incoming(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(service) + runtime.KeepAlive(connection) + runtime.KeepAlive(sourceObject) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Task: GTask represents and manages a cancellable ‘task’. +// +// # Asynchronous operations +// +// The most common usage of GTask is as a gio.AsyncResult, to manage data during +// an asynchronous operation. You call gio.Task.New in the ‘start’ method, +// followed by gio.Task.SetTaskData() and the like if you need to keep some +// additional data associated with the task, and then pass the task object +// around through your asynchronous operation. Eventually, you will call a +// method such as gio.Task.ReturnPointer() or gio.Task.ReturnError(), which will +// save the value you give it and then invoke the task’s callback function in +// the thread-default main context (see glib.MainContext.PushThreadDefault()) +// where it was created (waiting until the next iteration of the main +// loop first, if necessary). The caller will pass the GTask back to the +// operation’s finish function (as a gio.AsyncResult), and you can use +// gio.Task.PropagatePointer() or the like to extract the return value. +// +// Using GTask requires the thread-default glib.MainContext from when the GTask +// was constructed to be running at least until the task has completed and its +// data has been freed. +// +// If a GTask has been constructed and its callback set, it is an error to not +// call g_task_return_*() on it. GLib will warn at runtime if this happens +// (since 2.76). +// +// Here is an example for using GTask as a gio.AsyncResult: +// +// typedef struct { +// CakeFrostingType frosting; +// char *message; +// } DecorationData; +// +// static void +// decoration_data_free (DecorationData *decoration) +// { +// g_free (decoration->message); +// g_slice_free (DecorationData, decoration); +// } +// +// static void +// baked_cb (Cake *cake, +// gpointer user_data) +// { +// GTask *task = user_data; +// DecorationData *decoration = g_task_get_task_data (task); +// GError *error = NULL; +// +// if (cake == NULL) +// { +// g_task_return_new_error (task, BAKER_ERROR, BAKER_ERROR_NO_FLOUR, +// "Go to the supermarket"); +// g_object_unref (task); +// return; +// } +// +// if (!cake_decorate (cake, decoration->frosting, decoration->message, &error)) +// { +// g_object_unref (cake); +// // g_task_return_error() takes ownership of error +// g_task_return_error (task, error); +// g_object_unref (task); +// return; +// } +// +// g_task_return_pointer (task, cake, g_object_unref); +// g_object_unref (task); +// } +// +// void +// baker_bake_cake_async (Baker *self, +// guint radius, +// CakeFlavor flavor, +// CakeFrostingType frosting, +// const char *message, +// GCancellable *cancellable, +// GAsyncReadyCallback callback, +// gpointer user_data) +// { +// GTask *task; +// DecorationData *decoration; +// Cake *cake; +// +// task = g_task_new (self, cancellable, callback, user_data); +// if (radius < 3) +// { +// g_task_return_new_error (task, BAKER_ERROR, BAKER_ERROR_TOO_SMALL, +// "ucm radius cakes are silly", +// radius); +// g_object_unref (task); +// return; +// } +// +// cake = _baker_get_cached_cake (self, radius, flavor, frosting, message); +// if (cake != NULL) +// { +// // _baker_get_cached_cake() returns a reffed cake +// g_task_return_pointer (task, cake, g_object_unref); +// g_object_unref (task); +// return; +// } +// +// decoration = g_slice_new (DecorationData); +// decoration->frosting = frosting; +// decoration->message = g_strdup (message); +// g_task_set_task_data (task, decoration, (GDestroyNotify) decoration_data_free); +// +// _baker_begin_cake (self, radius, flavor, cancellable, baked_cb, task); +// } +// +// Cake * +// baker_bake_cake_finish (Baker *self, +// GAsyncResult *result, +// GError **error) +// { +// g_return_val_if_fail (g_task_is_valid (result, self), NULL); +// +// return g_task_propagate_pointer (G_TASK (result), error); +// } +// +// # Chained asynchronous operations +// +// GTask also tries to simplify asynchronous operations that internally chain +// together several smaller asynchronous operations. gio.Task.GetCancellable(), +// gio.Task.GetContext(), and gio.Task.GetPriority() allow you to get +// back the task’s gio.Cancellable, glib.MainContext, and I/O priority +// (iface.AsyncResult.html#io-priority) when starting a new subtask, so you +// don’t have to keep track of them yourself. gio.Task.AttachSource() simplifies +// the case of waiting for a source to fire (automatically using the correct +// glib.MainContext and priority). +// +// Here is an example for chained asynchronous operations: +// +// typedef struct { +// Cake *cake; +// CakeFrostingType frosting; +// char *message; +// } BakingData; +// +// static void +// decoration_data_free (BakingData *bd) +// { +// if (bd->cake) +// g_object_unref (bd->cake); +// g_free (bd->message); +// g_slice_free (BakingData, bd); +// } +// +// static void +// decorated_cb (Cake *cake, +// GAsyncResult *result, +// gpointer user_data) +// { +// GTask *task = user_data; +// GError *error = NULL; +// +// if (!cake_decorate_finish (cake, result, &error)) +// { +// g_object_unref (cake); +// g_task_return_error (task, error); +// g_object_unref (task); +// return; +// } +// +// // baking_data_free() will drop its ref on the cake, so we have to +// // take another here to give to the caller. +// g_task_return_pointer (task, g_object_ref (cake), g_object_unref); +// g_object_unref (task); +// } +// +// static gboolean +// decorator_ready (gpointer user_data) +// { +// GTask *task = user_data; +// BakingData *bd = g_task_get_task_data (task); +// +// cake_decorate_async (bd->cake, bd->frosting, bd->message, +// g_task_get_cancellable (task), +// decorated_cb, task); +// +// return G_SOURCE_REMOVE; +// } +// +// static void +// baked_cb (Cake *cake, +// gpointer user_data) +// { +// GTask *task = user_data; +// BakingData *bd = g_task_get_task_data (task); +// GError *error = NULL; +// +// if (cake == NULL) +// { +// g_task_return_new_error (task, BAKER_ERROR, BAKER_ERROR_NO_FLOUR, +// "Go to the supermarket"); +// g_object_unref (task); +// return; +// } +// +// bd->cake = cake; +// +// // Bail out now if the user has already cancelled +// if (g_task_return_error_if_cancelled (task)) +// { +// g_object_unref (task); +// return; +// } +// +// if (cake_decorator_available (cake)) +// decorator_ready (task); +// else +// { +// GSource *source; +// +// source = cake_decorator_wait_source_new (cake); +// // Attach source to task’s GMainContext and have it call +// // decorator_ready() when it is ready. +// g_task_attach_source (task, source, decorator_ready); +// g_source_unref (source); +// } +// } +// +// void +// baker_bake_cake_async (Baker *self, +// guint radius, +// CakeFlavor flavor, +// CakeFrostingType frosting, +// const char *message, +// gint priority, +// GCancellable *cancellable, +// GAsyncReadyCallback callback, +// gpointer user_data) +// { +// GTask *task; +// BakingData *bd; +// +// task = g_task_new (self, cancellable, callback, user_data); +// g_task_set_priority (task, priority); +// +// bd = g_slice_new0 (BakingData); +// bd->frosting = frosting; +// bd->message = g_strdup (message); +// g_task_set_task_data (task, bd, (GDestroyNotify) baking_data_free); +// +// _baker_begin_cake (self, radius, flavor, cancellable, baked_cb, task); +// } +// +// Cake * +// baker_bake_cake_finish (Baker *self, +// GAsyncResult *result, +// GError **error) +// { +// g_return_val_if_fail (g_task_is_valid (result, self), NULL); +// +// return g_task_propagate_pointer (G_TASK (result), error); +// } +// +// # Asynchronous operations from synchronous ones +// +// You can use gio.Task.RunInThread() to turn a synchronous operation into +// an asynchronous one, by running it in a thread. When it completes, +// the result will be dispatched to the thread-default main context (see +// glib.MainContext.PushThreadDefault()) where the GTask was created. +// +// Running a task in a thread: +// +// typedef struct { +// guint radius; +// CakeFlavor flavor; +// CakeFrostingType frosting; +// char *message; +// } CakeData; +// +// static void +// cake_data_free (CakeData *cake_data) +// { +// g_free (cake_data->message); +// g_slice_free (CakeData, cake_data); +// } +// +// static void +// bake_cake_thread (GTask *task, +// gpointer source_object, +// gpointer task_data, +// GCancellable *cancellable) +// { +// Baker *self = source_object; +// CakeData *cake_data = task_data; +// Cake *cake; +// GError *error = NULL; +// +// cake = bake_cake (baker, cake_data->radius, cake_data->flavor, +// cake_data->frosting, cake_data->message, +// cancellable, &error); +// if (cake) +// g_task_return_pointer (task, cake, g_object_unref); +// else +// g_task_return_error (task, error); +// } +// +// void +// baker_bake_cake_async (Baker *self, +// guint radius, +// CakeFlavor flavor, +// CakeFrostingType frosting, +// const char *message, +// GCancellable *cancellable, +// GAsyncReadyCallback callback, +// gpointer user_data) +// { +// CakeData *cake_data; +// GTask *task; +// +// cake_data = g_slice_new (CakeData); +// cake_data->radius = radius; +// cake_data->flavor = flavor; +// cake_data->frosting = frosting; +// cake_data->message = g_strdup (message); +// task = g_task_new (self, cancellable, callback, user_data); +// g_task_set_task_data (task, cake_data, (GDestroyNotify) cake_data_free); +// g_task_run_in_thread (task, bake_cake_thread); +// g_object_unref (task); +// } +// +// Cake * +// baker_bake_cake_finish (Baker *self, +// GAsyncResult *result, +// GError **error) +// { +// g_return_val_if_fail (g_task_is_valid (result, self), NULL); +// +// return g_task_propagate_pointer (G_TASK (result), error); +// } +// +// # Adding cancellability to uncancellable tasks +// +// Finally, gio.Task.RunInThread() and gio.Task.RunInThreadSync() can +// be used to turn an uncancellable operation into a cancellable one. +// If you call gio.Task.SetReturnOnCancel(), passing TRUE, then if the task’s +// gio.Cancellable is cancelled, it will return control back to the caller +// immediately, while allowing the task thread to continue running in the +// background (and simply discarding its result when it finally does finish). +// Provided that the task thread is careful about how it uses locks and other +// externally-visible resources, this allows you to make ‘GLib-friendly’ +// asynchronous and cancellable synchronous variants of blocking APIs. +// +// Cancelling a task: +// +// static void +// bake_cake_thread (GTask *task, +// gpointer source_object, +// gpointer task_data, +// GCancellable *cancellable) +// { +// Baker *self = source_object; +// CakeData *cake_data = task_data; +// Cake *cake; +// GError *error = NULL; +// +// cake = bake_cake (baker, cake_data->radius, cake_data->flavor, +// cake_data->frosting, cake_data->message, +// &error); +// if (error) +// { +// g_task_return_error (task, error); +// return; +// } +// +// // If the task has already been cancelled, then we don’t want to add +// // the cake to the cake cache. Likewise, we don’t want to have the +// // task get cancelled in the middle of updating the cache. +// // g_task_set_return_on_cancel() will return TRUE here if it managed +// // to disable return-on-cancel, or FALSE if the task was cancelled +// // before it could. +// if (g_task_set_return_on_cancel (task, FALSE)) +// { +// // If the caller cancels at this point, their +// // GAsyncReadyCallback won’t be invoked until we return, +// // so we don’t have to worry that this code will run at +// // the same time as that code does. But if there were +// // other functions that might look at the cake cache, +// // then we’d probably need a GMutex here as well. +// baker_add_cake_to_cache (baker, cake); +// g_task_return_pointer (task, cake, g_object_unref); +// } +// } +// +// void +// baker_bake_cake_async (Baker *self, +// guint radius, +// CakeFlavor flavor, +// CakeFrostingType frosting, +// const char *message, +// GCancellable *cancellable, +// GAsyncReadyCallback callback, +// gpointer user_data) +// { +// CakeData *cake_data; +// GTask *task; +// +// cake_data = g_slice_new (CakeData); +// +// ... +// +// task = g_task_new (self, cancellable, callback, user_data); +// g_task_set_task_data (task, cake_data, (GDestroyNotify) cake_data_free); +// g_task_set_return_on_cancel (task, TRUE); +// g_task_run_in_thread (task, bake_cake_thread); +// } +// +// Cake * +// baker_bake_cake_sync (Baker *self, +// guint radius, +// CakeFlavor flavor, +// CakeFrostingType frosting, +// const char *message, +// GCancellable *cancellable, +// GError **error) +// { +// CakeData *cake_data; +// GTask *task; +// Cake *cake; +// +// cake_data = g_slice_new (CakeData); +// +// ... +// +// task = g_task_new (self, cancellable, NULL, NULL); +// g_task_set_task_data (task, cake_data, (GDestroyNotify) cake_data_free); +// g_task_set_return_on_cancel (task, TRUE); +// g_task_run_in_thread_sync (task, bake_cake_thread); +// +// cake = g_task_propagate_pointer (task, error); +// g_object_unref (task); +// return cake; +// } +// +// # Porting from gio.SimpleAsyncResult +// +// GTask’s API attempts to be simpler than gio.SimpleAsyncResult’s in several +// ways: +// +// - You can save task-specific data with gio.Task.SetTaskData(), and +// retrieve it later with gio.Task.GetTaskData(). This replaces the abuse +// of gio.SimpleAsyncResult.SetOpResGpointer() for the same purpose with +// gio.SimpleAsyncResult. +// +// - In addition to the task data, GTask also keeps track of the priority +// (iface.AsyncResult.html#io-priority), gio.Cancellable, and glib.MainContext +// associated with the task, so tasks that consist of a chain of simpler +// asynchronous operations will have easy access to those values when starting +// each sub-task. +// +// - gio.Task.ReturnErrorIfCancelled() provides simplified handling +// for cancellation. In addition, cancellation overrides any other +// GTask return value by default, like gio.SimpleAsyncResult does when +// gio.SimpleAsyncResult.SetCheckCancellable() is called. (You can use +// gio.Task.SetCheckCancellable() to turn off that behavior.) On the other hand, +// gio.Task.RunInThread() guarantees that it will always run your task_func, +// even if the task’s gio.Cancellable is already cancelled before the +// task gets a chance to run; you can start your task_func with a +// gio.Task.ReturnErrorIfCancelled() check if you need the old behavior. +// +// - The ‘return’ methods (eg, gio.Task.ReturnPointer()) automatically cause +// the task to be ‘completed’ as well, and there is no need to worry about the +// ‘complete’ vs ‘complete in idle’ distinction. (GTask automatically figures +// out whether the task’s callback can be invoked directly, or if it needs to be +// sent to another glib.MainContext, or delayed until the next iteration of the +// current glib.MainContext.) +// +// - The ‘finish’ functions for GTask based operations are generally +// much simpler than gio.SimpleAsyncResult ones, normally consisting of +// only a single call to gio.Task.PropagatePointer() or the like. Since +// gio.Task.PropagatePointer() ‘steals’ the return value from the GTask, it is +// not necessary to juggle pointers around to prevent it from being freed twice. +// +// - With gio.SimpleAsyncResult, it was common to call +// gio.SimpleAsyncResult.PropagateError() from the _finish() wrapper function, +// and have virtual method implementations only deal with successful returns. +// This behavior is deprecated, because it makes it difficult for a subclass +// to chain to a parent class’s async methods. Instead, the wrapper function +// should just be a simple wrapper, and the virtual method should call an +// appropriate g_task_propagate_ function. Note that wrapper methods can now use +// gio.AsyncResult.LegacyPropagateError() to do old-style gio.SimpleAsyncResult +// error-returning behavior, and gio.AsyncResult.IsTagged() to check +// if a result is tagged as having come from the _async() wrapper +// function (for ‘short-circuit’ results, such as when passing 0 to +// gio.InputStream.ReadAsync()). +// +// # Thread-safety considerations +// +// Due to some infelicities in the API design, there is a thread-safety concern +// that users of GTask have to be aware of: +// +// If the main thread drops its last reference to the source object or the task +// data before the task is finalized, then the finalizers of these objects may +// be called on the worker thread. +// +// This is a problem if the finalizers use non-threadsafe API, and can lead to +// hard-to-debug crashes. Possible workarounds include: +// +// - Clear task data in a signal handler for notify::completed +// +// - Keep iterating a main context in the main thread and defer dropping +// the reference to the source object to that main context when the task is +// finalized. +type Task struct { + _ [0]func() // equal guard + *coreglib.Object + + AsyncResult +} + +var ( + _ coreglib.Objector = (*Task)(nil) +) + +func wrapTask(obj *coreglib.Object) *Task { + return &Task{ + Object: obj, + AsyncResult: AsyncResult{ + Object: obj, + }, + } +} + +func marshalTask(p uintptr) (interface{}, error) { + return wrapTask(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewTask creates a #GTask acting on source_object, which will eventually +// be used to invoke callback in the current [thread-default main +// context][g-main-context-push-thread-default]. +// +// Call this in the "start" method of your asynchronous method, and pass +// the #GTask around throughout the asynchronous operation. You can use +// g_task_set_task_data() to attach task-specific data to the object, which you +// can retrieve later via g_task_get_task_data(). +// +// By default, if cancellable is cancelled, then the return value of the +// task will always be G_IO_ERROR_CANCELLED, even if the task had already +// completed before the cancellation. This allows for simplified handling in +// cases where cancellation may imply that other objects that the task depends +// on have been destroyed. If you do not want this behavior, you can use +// g_task_set_check_cancellable() to change it. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable object, NULL to ignore. +// - sourceObject (optional) that owns this task, or NULL. +// - callback (optional): ReadyCallback. +// +// The function returns the following values: +// +// - task: #GTask. +func NewTask(ctx context.Context, sourceObject *coreglib.Object, callback AsyncReadyCallback) *Task { + var _arg2 *C.GCancellable // out + var _arg1 C.gpointer // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + var _cret *C.GTask // in + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.gpointer(unsafe.Pointer(sourceObject.Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + _cret = C.g_task_new(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(ctx) + runtime.KeepAlive(sourceObject) + runtime.KeepAlive(callback) + + var _task *Task // out + + _task = wrapTask(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _task +} + +// Cancellable gets task's #GCancellable. +// +// The function returns the following values: +// +// - cancellable (optional) task's #GCancellable. +func (task *Task) Cancellable() *Cancellable { + var _arg0 *C.GTask // out + var _cret *C.GCancellable // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_cancellable(_arg0) + runtime.KeepAlive(task) + + var _cancellable *Cancellable // out + + if _cret != nil { + _cancellable = wrapCancellable(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _cancellable +} + +// CheckCancellable gets task's check-cancellable flag. See +// g_task_set_check_cancellable() for more details. +func (task *Task) CheckCancellable() bool { + var _arg0 *C.GTask // out + var _cret C.gboolean // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_check_cancellable(_arg0) + runtime.KeepAlive(task) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Completed gets the value of #GTask:completed. This changes from FALSE to TRUE +// after the task’s callback is invoked, and will return FALSE if called from +// inside the callback. +// +// The function returns the following values: +// +// - ok: TRUE if the task has completed, FALSE otherwise. +func (task *Task) Completed() bool { + var _arg0 *C.GTask // out + var _cret C.gboolean // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_completed(_arg0) + runtime.KeepAlive(task) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Context gets the Context that task will return its result +// in (that is, the context that was the [thread-default main +// context][g-main-context-push-thread-default] at the point when task was +// created). +// +// This will always return a non-NULL value, even if the task's context is the +// default Context. +// +// The function returns the following values: +// +// - mainContext task's Context. +func (task *Task) Context() *glib.MainContext { + var _arg0 *C.GTask // out + var _cret *C.GMainContext // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_context(_arg0) + runtime.KeepAlive(task) + + var _mainContext *glib.MainContext // out + + _mainContext = (*glib.MainContext)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_main_context_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mainContext)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_main_context_unref((*C.GMainContext)(intern.C)) + }, + ) + + return _mainContext +} + +// Name gets task’s name. See g_task_set_name(). +// +// The function returns the following values: +// +// - utf8 (optional) task’s name, or NULL. +func (task *Task) Name() string { + var _arg0 *C.GTask // out + var _cret *C.gchar // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_name(_arg0) + runtime.KeepAlive(task) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Priority gets task's priority. +// +// The function returns the following values: +// +// - gint task's priority. +func (task *Task) Priority() int { + var _arg0 *C.GTask // out + var _cret C.gint // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_priority(_arg0) + runtime.KeepAlive(task) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// ReturnOnCancel gets task's return-on-cancel flag. See +// g_task_set_return_on_cancel() for more details. +func (task *Task) ReturnOnCancel() bool { + var _arg0 *C.GTask // out + var _cret C.gboolean // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_return_on_cancel(_arg0) + runtime.KeepAlive(task) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SourceObject gets the source object from task. Like +// g_async_result_get_source_object(), but does not ref the object. +// +// The function returns the following values: +// +// - object (optional) task's source object, or NULL. +func (task *Task) SourceObject() *coreglib.Object { + var _arg0 *C.GTask // out + var _cret C.gpointer // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_source_object(_arg0) + runtime.KeepAlive(task) + + var _object *coreglib.Object // out + + _object = coreglib.Take(unsafe.Pointer(_cret)) + + return _object +} + +// SourceTag gets task's source tag. See g_task_set_source_tag(). +// +// The function returns the following values: +// +// - gpointer (optional) task's source tag. +func (task *Task) SourceTag() unsafe.Pointer { + var _arg0 *C.GTask // out + var _cret C.gpointer // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_source_tag(_arg0) + runtime.KeepAlive(task) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// TaskData gets task's task_data. +// +// The function returns the following values: +// +// - gpointer (optional) task's task_data. +func (task *Task) TaskData() unsafe.Pointer { + var _arg0 *C.GTask // out + var _cret C.gpointer // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_get_task_data(_arg0) + runtime.KeepAlive(task) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// HadError tests if task resulted in an error. +// +// The function returns the following values: +// +// - ok: TRUE if the task resulted in an error, FALSE otherwise. +func (task *Task) HadError() bool { + var _arg0 *C.GTask // out + var _cret C.gboolean // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_had_error(_arg0) + runtime.KeepAlive(task) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PropagateBoolean gets the result of task as a #gboolean. +// +// If the task resulted in an error, or was cancelled, then this will instead +// return FALSE and set error. +// +// Since this method transfers ownership of the return value (or error) to the +// caller, you may only call it once. +func (task *Task) PropagateBoolean() error { + var _arg0 *C.GTask // out + var _cerr *C.GError // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + C.g_task_propagate_boolean(_arg0, &_cerr) + runtime.KeepAlive(task) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// PropagateInt gets the result of task as an integer (#gssize). +// +// If the task resulted in an error, or was cancelled, then this will instead +// return -1 and set error. +// +// Since this method transfers ownership of the return value (or error) to the +// caller, you may only call it once. +// +// The function returns the following values: +// +// - gssize: task result, or -1 on error. +func (task *Task) PropagateInt() (int, error) { + var _arg0 *C.GTask // out + var _cret C.gssize // in + var _cerr *C.GError // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_propagate_int(_arg0, &_cerr) + runtime.KeepAlive(task) + + var _gssize int // out + var _goerr error // out + + _gssize = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gssize, _goerr +} + +// PropagatePointer gets the result of task as a pointer, and transfers +// ownership of that value to the caller. +// +// If the task resulted in an error, or was cancelled, then this will instead +// return NULL and set error. +// +// Since this method transfers ownership of the return value (or error) to the +// caller, you may only call it once. +// +// The function returns the following values: +// +// - gpointer (optional): task result, or NULL on error. +func (task *Task) PropagatePointer() (unsafe.Pointer, error) { + var _arg0 *C.GTask // out + var _cret C.gpointer // in + var _cerr *C.GError // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_propagate_pointer(_arg0, &_cerr) + runtime.KeepAlive(task) + + var _gpointer unsafe.Pointer // out + var _goerr error // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gpointer, _goerr +} + +// PropagateValue gets the result of task as a #GValue, and transfers ownership +// of that value to the caller. As with g_task_return_value(), this is a generic +// low-level method; g_task_propagate_pointer() and the like will usually be +// more useful for C code. +// +// If the task resulted in an error, or was cancelled, then this will instead +// set error and return FALSE. +// +// Since this method transfers ownership of the return value (or error) to the +// caller, you may only call it once. +// +// The function returns the following values: +// +// - value: return location for the #GValue. +func (task *Task) PropagateValue() (coreglib.Value, error) { + var _arg0 *C.GTask // out + var _arg1 C.GValue // in + var _cerr *C.GError // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + C.g_task_propagate_value(_arg0, &_arg1, &_cerr) + runtime.KeepAlive(task) + + var _value coreglib.Value // out + var _goerr error // out + + _value = *coreglib.ValueFromNative(unsafe.Pointer((&_arg1))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _value, _goerr +} + +// ReturnBoolean sets task's result to result and completes the task (see +// g_task_return_pointer() for more discussion of exactly what this means). +// +// The function takes the following parameters: +// +// - result result of a task function. +func (task *Task) ReturnBoolean(result bool) { + var _arg0 *C.GTask // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + if result { + _arg1 = C.TRUE + } + + C.g_task_return_boolean(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(result) +} + +// ReturnError sets task's result to error (which task assumes ownership of) +// and completes the task (see g_task_return_pointer() for more discussion of +// exactly what this means). +// +// Note that since the task takes ownership of error, and since the task may be +// completed before returning from g_task_return_error(), you cannot assume that +// error is still valid after calling this. Call g_error_copy() on the error if +// you need to keep a local copy as well. +// +// See also gio.Task.ReturnNewError(), gio.Task.ReturnNewErrorLiteral(). +// +// The function takes the following parameters: +// +// - err result of a task function. +func (task *Task) ReturnError(err error) { + var _arg0 *C.GTask // out + var _arg1 *C.GError // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + + C.g_task_return_error(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(err) +} + +// ReturnErrorIfCancelled checks if task's #GCancellable has been cancelled, +// and if so, sets task's error accordingly and completes the task (see +// g_task_return_pointer() for more discussion of exactly what this means). +// +// The function returns the following values: +// +// - ok: TRUE if task has been cancelled, FALSE if not. +func (task *Task) ReturnErrorIfCancelled() bool { + var _arg0 *C.GTask // out + var _cret C.gboolean // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + + _cret = C.g_task_return_error_if_cancelled(_arg0) + runtime.KeepAlive(task) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ReturnInt sets task's result to result and completes the task (see +// g_task_return_pointer() for more discussion of exactly what this means). +// +// The function takes the following parameters: +// +// - result: integer (#gssize) result of a task function. +func (task *Task) ReturnInt(result int) { + var _arg0 *C.GTask // out + var _arg1 C.gssize // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + _arg1 = C.gssize(result) + + C.g_task_return_int(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(result) +} + +// ReturnNewErrorLiteral sets task’s result to a new glib.Error created from +// domain, code, message and completes the task. +// +// See gio.Task.ReturnPointer() for more discussion of exactly what ‘completing +// the task’ means. +// +// See also gio.Task.ReturnNewError(). +// +// The function takes the following parameters: +// +// - domain: #GQuark. +// - code: error code. +// - message: error message. +func (task *Task) ReturnNewErrorLiteral(domain glib.Quark, code int, message string) { + var _arg0 *C.GTask // out + var _arg1 C.GQuark // out + var _arg2 C.gint // out + var _arg3 *C.char // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + _arg1 = C.GQuark(domain) + _arg2 = C.gint(code) + _arg3 = (*C.char)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg3)) + + C.g_task_return_new_error_literal(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(task) + runtime.KeepAlive(domain) + runtime.KeepAlive(code) + runtime.KeepAlive(message) +} + +// ReturnValue sets task's result to result (by copying it) and completes the +// task. +// +// If result is NULL then a #GValue of type G_TYPE_POINTER with a value of NULL +// will be used for the result. +// +// This is a very generic low-level method intended primarily for use by +// language bindings; for C code, g_task_return_pointer() and the like will +// normally be much easier to use. +// +// The function takes the following parameters: +// +// - result (optional) result of a task function. +func (task *Task) ReturnValue(result *coreglib.Value) { + var _arg0 *C.GTask // out + var _arg1 *C.GValue // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + if result != nil { + _arg1 = (*C.GValue)(unsafe.Pointer(result.Native())) + } + + C.g_task_return_value(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(result) +} + +// SetCheckCancellable sets or clears task's check-cancellable flag. +// If this is TRUE (the default), then g_task_propagate_pointer(), etc, +// and g_task_had_error() will check the task's #GCancellable first, and if +// it has been cancelled, then they will consider the task to have returned an +// "Operation was cancelled" error (G_IO_ERROR_CANCELLED), regardless of any +// other error or return value the task may have had. +// +// If check_cancellable is FALSE, then the #GTask will not check the +// cancellable itself, and it is up to task's owner to do this (eg, via +// g_task_return_error_if_cancelled()). +// +// If you are using g_task_set_return_on_cancel() as well, then you must leave +// check-cancellable set TRUE. +// +// The function takes the following parameters: +// +// - checkCancellable: whether #GTask will check the state of its +// #GCancellable for you. +func (task *Task) SetCheckCancellable(checkCancellable bool) { + var _arg0 *C.GTask // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + if checkCancellable { + _arg1 = C.TRUE + } + + C.g_task_set_check_cancellable(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(checkCancellable) +} + +// SetName sets task’s name, used in debugging and profiling. The name defaults +// to NULL. +// +// The task name should describe in a human readable way what the task does. +// For example, ‘Open file’ or ‘Connect to network host’. It is used to set the +// name of the #GSource used for idle completion of the task. +// +// This function may only be called before the task is first used in a thread +// other than the one it was constructed in. It is called automatically by +// g_task_set_source_tag() if not called already. +// +// The function takes the following parameters: +// +// - name (optional): human readable name for the task, or NULL to unset it. +func (task *Task) SetName(name string) { + var _arg0 *C.GTask // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + if name != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_task_set_name(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(name) +} + +// SetPriority sets task's priority. If you do not call this, it will default to +// G_PRIORITY_DEFAULT. +// +// This will affect the priority of #GSources created with +// g_task_attach_source() and the scheduling of tasks run in threads, and can +// also be explicitly retrieved later via g_task_get_priority(). +// +// The function takes the following parameters: +// +// - priority: priority (iface.AsyncResult.html#io-priority) of the request. +func (task *Task) SetPriority(priority int) { + var _arg0 *C.GTask // out + var _arg1 C.gint // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + _arg1 = C.gint(priority) + + C.g_task_set_priority(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(priority) +} + +// SetReturnOnCancel sets or clears task's return-on-cancel flag. +// This is only meaningful for tasks run via g_task_run_in_thread() or +// g_task_run_in_thread_sync(). +// +// If return_on_cancel is TRUE, then cancelling task's #GCancellable will +// immediately cause it to return, as though the task's ThreadFunc had called +// g_task_return_error_if_cancelled() and then returned. +// +// This allows you to create a cancellable wrapper around an uninterruptible +// function. The ThreadFunc just needs to be careful that it does not modify +// any externally-visible state after it has been cancelled. To do that, +// the thread should call g_task_set_return_on_cancel() again to (atomically) +// set return-on-cancel FALSE before making externally-visible changes; +// if the task gets cancelled before the return-on-cancel flag could be changed, +// g_task_set_return_on_cancel() will indicate this by returning FALSE. +// +// You can disable and re-enable this flag multiple times if you wish. +// If the task's #GCancellable is cancelled while return-on-cancel is FALSE, +// then calling g_task_set_return_on_cancel() to set it TRUE again will cause +// the task to be cancelled at that point. +// +// If the task's #GCancellable is already cancelled before you call +// g_task_run_in_thread()/g_task_run_in_thread_sync(), then the ThreadFunc will +// still be run (for consistency), but the task will also be completed right +// away. +// +// The function takes the following parameters: +// +// - returnOnCancel: whether the task returns automatically when it is +// cancelled. +// +// The function returns the following values: +// +// - ok: TRUE if task's return-on-cancel flag was changed to match +// return_on_cancel. FALSE if task has already been cancelled. +func (task *Task) SetReturnOnCancel(returnOnCancel bool) bool { + var _arg0 *C.GTask // out + var _arg1 C.gboolean // out + var _cret C.gboolean // in + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + if returnOnCancel { + _arg1 = C.TRUE + } + + _cret = C.g_task_set_return_on_cancel(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(returnOnCancel) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetSourceTag sets task's source tag. +// +// You can use this to tag a task return value with a particular pointer +// (usually a pointer to the function doing the tagging) and then later check it +// using g_task_get_source_tag() (or g_async_result_is_tagged()) in the task's +// "finish" function, to figure out if the response came from a particular +// place. +// +// A macro wrapper around this function will automatically set the task’s name +// to the string form of source_tag if it’s not already set, for convenience. +// +// The function takes the following parameters: +// +// - sourceTag (optional): opaque pointer indicating the source of this task. +func (task *Task) SetSourceTag(sourceTag unsafe.Pointer) { + var _arg0 *C.GTask // out + var _arg1 C.gpointer // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + _arg1 = (C.gpointer)(unsafe.Pointer(sourceTag)) + + C.g_task_set_source_tag(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(sourceTag) +} + +// SetStaticName sets task’s name, used in debugging and profiling. +// +// This is a variant of g_task_set_name() that avoids copying name. +// +// The function takes the following parameters: +// +// - name (optional): human readable name for the task. Must be a string +// literal. +func (task *Task) SetStaticName(name string) { + var _arg0 *C.GTask // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GTask)(unsafe.Pointer(coreglib.InternObject(task).Native())) + if name != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.g_task_set_static_name(_arg0, _arg1) + runtime.KeepAlive(task) + runtime.KeepAlive(name) +} + +// TaskIsValid checks that result is a #GTask, and that source_object is its +// source object (or that source_object is NULL and result has no source +// object). This can be used in g_return_if_fail() checks. +// +// The function takes the following parameters: +// +// - result: Result. +// - sourceObject (optional): source object expected to be associated with the +// task. +// +// The function returns the following values: +// +// - ok: TRUE if result and source_object are valid, FALSE if not. +func TaskIsValid(result AsyncResulter, sourceObject *coreglib.Object) bool { + var _arg1 C.gpointer // out + var _arg2 C.gpointer // out + var _cret C.gboolean // in + + _arg1 = *(*C.gpointer)(unsafe.Pointer(coreglib.InternObject(result).Native())) + _arg2 = C.gpointer(unsafe.Pointer(sourceObject.Native())) + + _cret = C.g_task_is_valid(_arg1, _arg2) + runtime.KeepAlive(result) + runtime.KeepAlive(sourceObject) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TaskReportError creates a #GTask and then immediately calls +// g_task_return_error() on it. Use this in the wrapper function of an +// asynchronous method when you want to avoid even calling the virtual method. +// You can then use g_async_result_is_tagged() in the finish method wrapper to +// check if the result there is tagged as having been created by the wrapper +// method, and deal with it appropriately if so. +// +// See also g_task_report_new_error(). +// +// The function takes the following parameters: +// +// - sourceObject (optional) that owns this task, or NULL. +// - callback (optional): ReadyCallback. +// - sourceTag (optional): opaque pointer indicating the source of this task. +// - err: error to report. +func TaskReportError(sourceObject *coreglib.Object, callback AsyncReadyCallback, sourceTag unsafe.Pointer, err error) { + var _arg1 C.gpointer // out + var _arg2 C.GAsyncReadyCallback // out + var _arg3 C.gpointer + var _arg4 C.gpointer // out + var _arg5 *C.GError // out + + _arg1 = C.gpointer(unsafe.Pointer(sourceObject.Native())) + if callback != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg3 = C.gpointer(gbox.AssignOnce(callback)) + } + _arg4 = (C.gpointer)(unsafe.Pointer(sourceTag)) + if err != nil { + _arg5 = (*C.GError)(gerror.New(err)) + } + + C.g_task_report_error(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(sourceObject) + runtime.KeepAlive(callback) + runtime.KeepAlive(sourceTag) + runtime.KeepAlive(err) +} + +// TCPConnectionOverrides contains methods that are overridable. +type TCPConnectionOverrides struct { +} + +func defaultTCPConnectionOverrides(v *TCPConnection) TCPConnectionOverrides { + return TCPConnectionOverrides{} +} + +// TCPConnection: this is the subclass of gio.SocketConnection that is created +// for TCP/IP sockets. +type TCPConnection struct { + _ [0]func() // equal guard + SocketConnection +} + +var ( + _ IOStreamer = (*TCPConnection)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*TCPConnection, *TCPConnectionClass, TCPConnectionOverrides]( + GTypeTCPConnection, + initTCPConnectionClass, + wrapTCPConnection, + defaultTCPConnectionOverrides, + ) +} + +func initTCPConnectionClass(gclass unsafe.Pointer, overrides TCPConnectionOverrides, classInitFunc func(*TCPConnectionClass)) { + if classInitFunc != nil { + class := (*TCPConnectionClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapTCPConnection(obj *coreglib.Object) *TCPConnection { + return &TCPConnection{ + SocketConnection: SocketConnection{ + IOStream: IOStream{ + Object: obj, + }, + }, + } +} + +func marshalTCPConnection(p uintptr) (interface{}, error) { + return wrapTCPConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// GracefulDisconnect checks if graceful disconnects are used. See +// g_tcp_connection_set_graceful_disconnect(). +// +// The function returns the following values: +// +// - ok: TRUE if graceful disconnect is used on close, FALSE otherwise. +func (connection *TCPConnection) GracefulDisconnect() bool { + var _arg0 *C.GTcpConnection // out + var _cret C.gboolean // in + + _arg0 = (*C.GTcpConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + + _cret = C.g_tcp_connection_get_graceful_disconnect(_arg0) + runtime.KeepAlive(connection) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetGracefulDisconnect: this enables graceful disconnects on close. A graceful +// disconnect means that we signal the receiving end that the connection +// is terminated and wait for it to close the connection before closing the +// connection. +// +// A graceful disconnect means that we can be sure that we successfully sent all +// the outstanding data to the other end, or get an error reported. However, +// it also means we have to wait for all the data to reach the other side and +// for it to acknowledge this by closing the socket, which may take a while. +// For this reason it is disabled by default. +// +// The function takes the following parameters: +// +// - gracefulDisconnect: whether to do graceful disconnects or not. +func (connection *TCPConnection) SetGracefulDisconnect(gracefulDisconnect bool) { + var _arg0 *C.GTcpConnection // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GTcpConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + if gracefulDisconnect { + _arg1 = C.TRUE + } + + C.g_tcp_connection_set_graceful_disconnect(_arg0, _arg1) + runtime.KeepAlive(connection) + runtime.KeepAlive(gracefulDisconnect) +} + +// TCPWrapperConnectionOverrides contains methods that are overridable. +type TCPWrapperConnectionOverrides struct { +} + +func defaultTCPWrapperConnectionOverrides(v *TCPWrapperConnection) TCPWrapperConnectionOverrides { + return TCPWrapperConnectionOverrides{} +} + +// TCPWrapperConnection: GTcpWrapperConnection can be used to wrap a +// gio.IOStream that is based on a gio.Socket, but which is not actually a +// gio.SocketConnection. This is used by gio.SocketClient so that it can always +// return a gio.SocketConnection, even when the connection it has actually +// created is not directly a gio.SocketConnection. +type TCPWrapperConnection struct { + _ [0]func() // equal guard + TCPConnection +} + +var ( + _ IOStreamer = (*TCPWrapperConnection)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*TCPWrapperConnection, *TCPWrapperConnectionClass, TCPWrapperConnectionOverrides]( + GTypeTCPWrapperConnection, + initTCPWrapperConnectionClass, + wrapTCPWrapperConnection, + defaultTCPWrapperConnectionOverrides, + ) +} + +func initTCPWrapperConnectionClass(gclass unsafe.Pointer, overrides TCPWrapperConnectionOverrides, classInitFunc func(*TCPWrapperConnectionClass)) { + if classInitFunc != nil { + class := (*TCPWrapperConnectionClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapTCPWrapperConnection(obj *coreglib.Object) *TCPWrapperConnection { + return &TCPWrapperConnection{ + TCPConnection: TCPConnection{ + SocketConnection: SocketConnection{ + IOStream: IOStream{ + Object: obj, + }, + }, + }, + } +} + +func marshalTCPWrapperConnection(p uintptr) (interface{}, error) { + return wrapTCPWrapperConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewTCPWrapperConnection wraps base_io_stream and socket together as a +// Connection. +// +// The function takes the following parameters: +// +// - baseIoStream to wrap. +// - socket associated with base_io_stream. +// +// The function returns the following values: +// +// - tcpWrapperConnection: new Connection. +func NewTCPWrapperConnection(baseIoStream IOStreamer, socket *Socket) *TCPWrapperConnection { + var _arg1 *C.GIOStream // out + var _arg2 *C.GSocket // out + var _cret *C.GSocketConnection // in + + _arg1 = (*C.GIOStream)(unsafe.Pointer(coreglib.InternObject(baseIoStream).Native())) + _arg2 = (*C.GSocket)(unsafe.Pointer(coreglib.InternObject(socket).Native())) + + _cret = C.g_tcp_wrapper_connection_new(_arg1, _arg2) + runtime.KeepAlive(baseIoStream) + runtime.KeepAlive(socket) + + var _tcpWrapperConnection *TCPWrapperConnection // out + + _tcpWrapperConnection = wrapTCPWrapperConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _tcpWrapperConnection +} + +// BaseIOStream gets conn's base OStream. +// +// The function returns the following values: +// +// - ioStream conn's base OStream. +func (conn *TCPWrapperConnection) BaseIOStream() IOStreamer { + var _arg0 *C.GTcpWrapperConnection // out + var _cret *C.GIOStream // in + + _arg0 = (*C.GTcpWrapperConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tcp_wrapper_connection_get_base_io_stream(_arg0) + runtime.KeepAlive(conn) + + var _ioStream IOStreamer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _ioStream = rv + } + + return _ioStream +} + +// TestDBus: helper class for testing code which uses D-Bus without touching the +// user’s session bus. +// +// Note that GTestDBus modifies the user’s environment, calling setenv() +// (man:setenv(3)). This is not thread-safe, so all GTestDBus calls should be +// completed before threads are spawned, or should have appropriate locking to +// ensure no access conflicts to environment variables shared between GTestDBus +// and other threads. +// +// # Creating unit tests using GTestDBus +// +// Testing of D-Bus services can be tricky because normally we only ever run +// D-Bus services over an existing instance of the D-Bus daemon thus we usually +// don’t activate D-Bus services that are not yet installed into the target +// system. The GTestDBus object makes this easier for us by taking care of +// the lower level tasks such as running a private D-Bus daemon and looking up +// uninstalled services in customizable locations, typically in your source code +// tree. +// +// The first thing you will need is a separate service description file for the +// D-Bus daemon. Typically a services subdirectory of your tests directory is a +// good place to put this file. +// +// The service file should list your service along with an absolute path to the +// uninstalled service executable in your source tree. Using autotools we would +// achieve this by adding a file such as my-server.service.in in the services +// directory and have it processed by configure. +// +// [D-BUS Service] +// Name=org.gtk.GDBus.Examples.ObjectManager +// Exec=abs_top_builddir@/gio/tests/gdbus-example-objectmanager-server +// +// You will also need to indicate this service directory in your test fixtures, +// so you will need to pass the path while compiling your test cases. Typically +// this is done with autotools with an added preprocessor flag specified to +// compile your tests such as: +// +// -DTEST_SERVICES=\""$(abs_top_builddir)/tests/services"\" +// +// Once you have a service definition file which is local to your source tree, +// you can proceed to set up a GTest fixture using the GTestDBus scaffolding. +// +// An example of a test fixture for D-Bus services +// can be found here: gdbus-test-fixture.c +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/tests/gdbus-test-fixture.c) +// +// Note that these examples only deal with isolating the D-Bus aspect of your +// service. To successfully run isolated unit tests on your service you may +// need some additional modifications to your test case fixture. For example; +// if your service uses gio.Settings and installs a schema then it is important +// that your test service not load the schema in the ordinary installed location +// (chances are that your service and schema files are not yet installed, +// or worse; there is an older version of the schema file sitting in the install +// location). +// +// Most of the time we can work around these obstacles using the environment. +// Since the environment is inherited by the D-Bus daemon created by GTestDBus +// and then in turn inherited by any services the D-Bus daemon activates, +// using the setup routine for your fixture is a practical place to help sandbox +// your runtime environment. For the rather typical GSettings case we can work +// around this by setting GSETTINGS_SCHEMA_DIR to the in tree directory holding +// your schemas in the above fixture_setup() routine. +// +// The GSettings schemas need to be locally pre-compiled for this to work. This +// can be achieved by compiling the schemas locally as a step before running +// test cases, an autotools setup might do the following in the directory +// holding schemas: +// +// all-am: +// $(GLIB_COMPILE_SCHEMAS) . +// +// CLEANFILES += gschemas.compiled. +type TestDBus struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*TestDBus)(nil) +) + +func wrapTestDBus(obj *coreglib.Object) *TestDBus { + return &TestDBus{ + Object: obj, + } +} + +func marshalTestDBus(p uintptr) (interface{}, error) { + return wrapTestDBus(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewTestDBus: create a new DBus object. +// +// The function takes the following parameters: +// +// - flags: DBusFlags. +// +// The function returns the following values: +// +// - testDBus: new DBus. +func NewTestDBus(flags TestDBusFlags) *TestDBus { + var _arg1 C.GTestDBusFlags // out + var _cret *C.GTestDBus // in + + _arg1 = C.GTestDBusFlags(flags) + + _cret = C.g_test_dbus_new(_arg1) + runtime.KeepAlive(flags) + + var _testDBus *TestDBus // out + + _testDBus = wrapTestDBus(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _testDBus +} + +// AddServiceDir: add a path where dbus-daemon will look up .service files. +// This can't be called after g_test_dbus_up(). +// +// The function takes the following parameters: +// +// - path to a directory containing .service files. +func (self *TestDBus) AddServiceDir(path string) { + var _arg0 *C.GTestDBus // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GTestDBus)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_test_dbus_add_service_dir(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(path) +} + +// Down: stop the session bus started by g_test_dbus_up(). +// +// This will wait for the singleton returned by g_bus_get() or g_bus_get_sync() +// to be destroyed. This is done to ensure that the next unit test won't get a +// leaked singleton from this test. +func (self *TestDBus) Down() { + var _arg0 *C.GTestDBus // out + + _arg0 = (*C.GTestDBus)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.g_test_dbus_down(_arg0) + runtime.KeepAlive(self) +} + +// BusAddress: get the address on which dbus-daemon is running. If +// g_test_dbus_up() has not been called yet, NULL is returned. This can be used +// with g_dbus_connection_new_for_address(). +// +// The function returns the following values: +// +// - utf8 (optional) address of the bus, or NULL. +func (self *TestDBus) BusAddress() string { + var _arg0 *C.GTestDBus // out + var _cret *C.gchar // in + + _arg0 = (*C.GTestDBus)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.g_test_dbus_get_bus_address(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Flags: get the flags of the DBus object. +// +// The function returns the following values: +// +// - testDBusFlags: value of DBus:flags property. +func (self *TestDBus) Flags() TestDBusFlags { + var _arg0 *C.GTestDBus // out + var _cret C.GTestDBusFlags // in + + _arg0 = (*C.GTestDBus)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.g_test_dbus_get_flags(_arg0) + runtime.KeepAlive(self) + + var _testDBusFlags TestDBusFlags // out + + _testDBusFlags = TestDBusFlags(_cret) + + return _testDBusFlags +} + +// Stop the session bus started by g_test_dbus_up(). +// +// Unlike g_test_dbus_down(), this won't verify the BusConnection singleton +// returned by g_bus_get() or g_bus_get_sync() is destroyed. Unit tests wanting +// to verify behaviour after the session bus has been stopped can use this +// function but should still call g_test_dbus_down() when done. +func (self *TestDBus) Stop() { + var _arg0 *C.GTestDBus // out + + _arg0 = (*C.GTestDBus)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.g_test_dbus_stop(_arg0) + runtime.KeepAlive(self) +} + +// Up: start a dbus-daemon instance and set DBUS_SESSION_BUS_ADDRESS. After this +// call, it is safe for unit tests to start sending messages on the session bus. +// +// If this function is called from setup callback of g_test_add(), +// g_test_dbus_down() must be called in its teardown callback. +// +// If this function is called from unit test's main(), then g_test_dbus_down() +// must be called after g_test_run(). +func (self *TestDBus) Up() { + var _arg0 *C.GTestDBus // out + + _arg0 = (*C.GTestDBus)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.g_test_dbus_up(_arg0) + runtime.KeepAlive(self) +} + +// TestDBusUnset: unset DISPLAY and DBUS_SESSION_BUS_ADDRESS env variables to +// ensure the test won't use user's session bus. +// +// This is useful for unit tests that want to verify behaviour when no session +// bus is running. It is not necessary to call this if unit test already calls +// g_test_dbus_up() before acquiring the session bus. +func TestDBusUnset() { + C.g_test_dbus_unset() +} + +// ThemedIcon: GThemedIcon is an implementation of gio.Icon that supports icon +// themes. +// +// GThemedIcon contains a list of all of the icons present in an icon theme, +// so that icons can be looked up quickly. GThemedIcon does not provide +// actual pixmaps for icons, just the icon names. Ideally something like +// gtk.IconTheme.ChooseIcon() should be used to resolve the list of names so +// that fallback icons work nicely with themes that inherit other themes. +type ThemedIcon struct { + _ [0]func() // equal guard + *coreglib.Object + + Icon +} + +var ( + _ coreglib.Objector = (*ThemedIcon)(nil) +) + +func wrapThemedIcon(obj *coreglib.Object) *ThemedIcon { + return &ThemedIcon{ + Object: obj, + Icon: Icon{ + Object: obj, + }, + } +} + +func marshalThemedIcon(p uintptr) (interface{}, error) { + return wrapThemedIcon(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewThemedIcon creates a new themed icon for iconname. +// +// The function takes the following parameters: +// +// - iconname: string containing an icon name. +// +// The function returns the following values: +// +// - themedIcon: new Icon. +func NewThemedIcon(iconname string) *ThemedIcon { + var _arg1 *C.char // out + var _cret *C.GIcon // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(iconname))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_themed_icon_new(_arg1) + runtime.KeepAlive(iconname) + + var _themedIcon *ThemedIcon // out + + _themedIcon = wrapThemedIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _themedIcon +} + +// NewThemedIconFromNames creates a new themed icon for iconnames. +// +// The function takes the following parameters: +// +// - iconnames: array of strings containing icon names. +// +// The function returns the following values: +// +// - themedIcon: new Icon. +func NewThemedIconFromNames(iconnames []string) *ThemedIcon { + var _arg1 **C.char // out + var _arg2 C.int + var _cret *C.GIcon // in + + _arg2 = (C.int)(len(iconnames)) + _arg1 = (**C.char)(C.calloc(C.size_t(len(iconnames)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.char)(_arg1), len(iconnames)) + for i := range iconnames { + out[i] = (*C.char)(unsafe.Pointer(C.CString(iconnames[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + + _cret = C.g_themed_icon_new_from_names(_arg1, _arg2) + runtime.KeepAlive(iconnames) + + var _themedIcon *ThemedIcon // out + + _themedIcon = wrapThemedIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _themedIcon +} + +// NewThemedIconWithDefaultFallbacks creates a new themed icon for iconname, and +// all the names that can be created by shortening iconname at '-' characters. +// +// In the following example, icon1 and icon2 are equivalent: +// +// const char *names[] = { +// "gnome-dev-cdrom-audio", +// "gnome-dev-cdrom", +// "gnome-dev", +// "gnome" +// }; +// +// icon1 = g_themed_icon_new_from_names (names, 4); +// icon2 = g_themed_icon_new_with_default_fallbacks ("gnome-dev-cdrom-audio");. +// +// The function takes the following parameters: +// +// - iconname: string containing an icon name. +// +// The function returns the following values: +// +// - themedIcon: new Icon. +func NewThemedIconWithDefaultFallbacks(iconname string) *ThemedIcon { + var _arg1 *C.char // out + var _cret *C.GIcon // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(iconname))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_themed_icon_new_with_default_fallbacks(_arg1) + runtime.KeepAlive(iconname) + + var _themedIcon *ThemedIcon // out + + _themedIcon = wrapThemedIcon(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _themedIcon +} + +// AppendName: append a name to the list of icons from within icon. +// +// Note that doing so invalidates the hash computed by prior calls to +// g_icon_hash(). +// +// The function takes the following parameters: +// +// - iconname: name of icon to append to list of icons from within icon. +func (icon *ThemedIcon) AppendName(iconname string) { + var _arg0 *C.GThemedIcon // out + var _arg1 *C.char // out + + _arg0 = (*C.GThemedIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(iconname))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_themed_icon_append_name(_arg0, _arg1) + runtime.KeepAlive(icon) + runtime.KeepAlive(iconname) +} + +// Names gets the names of icons from within icon. +// +// The function returns the following values: +// +// - utf8s: list of icon names. +func (icon *ThemedIcon) Names() []string { + var _arg0 *C.GThemedIcon // out + var _cret **C.gchar // in + + _arg0 = (*C.GThemedIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + _cret = C.g_themed_icon_get_names(_arg0) + runtime.KeepAlive(icon) + + var _utf8s []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// PrependName: prepend a name to the list of icons from within icon. +// +// Note that doing so invalidates the hash computed by prior calls to +// g_icon_hash(). +// +// The function takes the following parameters: +// +// - iconname: name of icon to prepend to list of icons from within icon. +func (icon *ThemedIcon) PrependName(iconname string) { + var _arg0 *C.GThemedIcon // out + var _arg1 *C.char // out + + _arg0 = (*C.GThemedIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(iconname))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_themed_icon_prepend_name(_arg0, _arg1) + runtime.KeepAlive(icon) + runtime.KeepAlive(iconname) +} + +// ThreadedResolver is an implementation of #GResolver which calls the libc +// lookup functions in threads to allow them to run asynchronously. +type ThreadedResolver struct { + _ [0]func() // equal guard + Resolver +} + +var ( + _ Resolverer = (*ThreadedResolver)(nil) +) + +func wrapThreadedResolver(obj *coreglib.Object) *ThreadedResolver { + return &ThreadedResolver{ + Resolver: Resolver{ + Object: obj, + }, + } +} + +// ThreadedSocketServiceOverrides contains methods that are overridable. +type ThreadedSocketServiceOverrides struct { + // The function takes the following parameters: + // + // - connection + // - sourceObject + Run func(connection *SocketConnection, sourceObject *coreglib.Object) bool +} + +func defaultThreadedSocketServiceOverrides(v *ThreadedSocketService) ThreadedSocketServiceOverrides { + return ThreadedSocketServiceOverrides{ + Run: v.run, + } +} + +// ThreadedSocketService: GThreadedSocketService is a simple subclass +// of gio.SocketService that handles incoming connections by creating +// a worker thread and dispatching the connection to it by emitting the +// gio.ThreadedSocketService::run signal in the new thread. +// +// The signal handler may perform blocking I/O and need not return until the +// connection is closed. +// +// The service is implemented using a thread pool, so there is a limited amount +// of threads available to serve incoming requests. The service automatically +// stops the gio.SocketService from accepting new connections when all threads +// are busy. +// +// As with gio.SocketService, you may connect to gio.ThreadedSocketService::run, +// or subclass and override the default handler. +type ThreadedSocketService struct { + _ [0]func() // equal guard + SocketService +} + +var ( + _ coreglib.Objector = (*ThreadedSocketService)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ThreadedSocketService, *ThreadedSocketServiceClass, ThreadedSocketServiceOverrides]( + GTypeThreadedSocketService, + initThreadedSocketServiceClass, + wrapThreadedSocketService, + defaultThreadedSocketServiceOverrides, + ) +} + +func initThreadedSocketServiceClass(gclass unsafe.Pointer, overrides ThreadedSocketServiceOverrides, classInitFunc func(*ThreadedSocketServiceClass)) { + pclass := (*C.GThreadedSocketServiceClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeThreadedSocketService)))) + + if overrides.Run != nil { + pclass.run = (*[0]byte)(C._gotk4_gio2_ThreadedSocketServiceClass_run) + } + + if classInitFunc != nil { + class := (*ThreadedSocketServiceClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapThreadedSocketService(obj *coreglib.Object) *ThreadedSocketService { + return &ThreadedSocketService{ + SocketService: SocketService{ + SocketListener: SocketListener{ + Object: obj, + }, + }, + } +} + +func marshalThreadedSocketService(p uintptr) (interface{}, error) { + return wrapThreadedSocketService(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectRun signal is emitted in a worker thread in response to an incoming +// connection. This thread is dedicated to handling connection and may perform +// blocking IO. The signal handler need not return until the connection is +// closed. +func (v *ThreadedSocketService) ConnectRun(f func(connection *SocketConnection, sourceObject *coreglib.Object) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(v, "run", false, unsafe.Pointer(C._gotk4_gio2_ThreadedSocketService_ConnectRun), f) +} + +// NewThreadedSocketService creates a new SocketService with no listeners. +// Listeners must be added with one of the Listener "add" methods. +// +// The function takes the following parameters: +// +// - maxThreads: maximal number of threads to execute concurrently handling +// incoming clients, -1 means no limit. +// +// The function returns the following values: +// +// - threadedSocketService: new Service. +func NewThreadedSocketService(maxThreads int) *ThreadedSocketService { + var _arg1 C.int // out + var _cret *C.GSocketService // in + + _arg1 = C.int(maxThreads) + + _cret = C.g_threaded_socket_service_new(_arg1) + runtime.KeepAlive(maxThreads) + + var _threadedSocketService *ThreadedSocketService // out + + _threadedSocketService = wrapThreadedSocketService(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _threadedSocketService +} + +// The function takes the following parameters: +// +// - connection +// - sourceObject +func (service *ThreadedSocketService) run(connection *SocketConnection, sourceObject *coreglib.Object) bool { + gclass := (*C.GThreadedSocketServiceClass)(coreglib.PeekParentClass(service)) + fnarg := gclass.run + + var _arg0 *C.GThreadedSocketService // out + var _arg1 *C.GSocketConnection // out + var _arg2 *C.GObject // out + var _cret C.gboolean // in + + _arg0 = (*C.GThreadedSocketService)(unsafe.Pointer(coreglib.InternObject(service).Native())) + _arg1 = (*C.GSocketConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = (*C.GObject)(unsafe.Pointer(sourceObject.Native())) + + _cret = C._gotk4_gio2_ThreadedSocketService_virtual_run(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(service) + runtime.KeepAlive(connection) + runtime.KeepAlive(sourceObject) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TLSCertificateOverrides contains methods that are overridable. +type TLSCertificateOverrides struct { + // Verify: this verifies cert and returns a set of CertificateFlags + // indicating any problems found with it. This can be used to verify a + // certificate outside the context of making a connection, or to check a + // certificate against a CA that is not part of the system CA database. + // + // If cert is valid, G_TLS_CERTIFICATE_NO_FLAGS is returned. + // + // If identity is not NULL, cert's name(s) will be compared against it, + // and G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return value if it + // does not match. If identity is NULL, that bit will never be set in the + // return value. + // + // If trusted_ca is not NULL, then cert (or one of the certificates in its + // chain) must be signed by it, or else G_TLS_CERTIFICATE_UNKNOWN_CA will + // be set in the return value. If trusted_ca is NULL, that bit will never be + // set in the return value. + // + // GLib guarantees that if certificate verification fails, at least one + // error will be set in the return value, but it does not guarantee that + // all possible errors will be set. Accordingly, you may not safely + // decide to ignore any particular type of error. For example, it would be + // incorrect to mask G_TLS_CERTIFICATE_EXPIRED if you want to allow expired + // certificates, because this could potentially be the only error flag set + // even if other problems exist with the certificate. + // + // Because TLS session context is not used, Certificate may not perform + // as many checks on the certificates as Connection would. For example, + // certificate constraints may not be honored, and revocation checks may + // not be performed. The best way to verify TLS certificates used by a TLS + // connection is to let Connection handle the verification. + // + // The function takes the following parameters: + // + // - identity (optional): expected peer identity. + // - trustedCa (optional): certificate of a trusted authority. + // + // The function returns the following values: + // + // - tlsCertificateFlags: appropriate CertificateFlags. + Verify func(identity SocketConnectabler, trustedCa TLSCertificater) TLSCertificateFlags +} + +func defaultTLSCertificateOverrides(v *TLSCertificate) TLSCertificateOverrides { + return TLSCertificateOverrides{ + Verify: v.verify, + } +} + +// TLSCertificate: certificate used for TLS authentication and encryption. +// This can represent either a certificate only (eg, the certificate received +// by a client from a server), or the combination of a certificate and a private +// key (which is needed when acting as a gio.TLSServerConnection). +type TLSCertificate struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*TLSCertificate)(nil) +) + +// TLSCertificater describes types inherited from class TLSCertificate. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type TLSCertificater interface { + coreglib.Objector + baseTLSCertificate() *TLSCertificate +} + +var _ TLSCertificater = (*TLSCertificate)(nil) + +func init() { + coreglib.RegisterClassInfo[*TLSCertificate, *TLSCertificateClass, TLSCertificateOverrides]( + GTypeTLSCertificate, + initTLSCertificateClass, + wrapTLSCertificate, + defaultTLSCertificateOverrides, + ) +} + +func initTLSCertificateClass(gclass unsafe.Pointer, overrides TLSCertificateOverrides, classInitFunc func(*TLSCertificateClass)) { + pclass := (*C.GTlsCertificateClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeTLSCertificate)))) + + if overrides.Verify != nil { + pclass.verify = (*[0]byte)(C._gotk4_gio2_TlsCertificateClass_verify) + } + + if classInitFunc != nil { + class := (*TLSCertificateClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapTLSCertificate(obj *coreglib.Object) *TLSCertificate { + return &TLSCertificate{ + Object: obj, + } +} + +func marshalTLSCertificate(p uintptr) (interface{}, error) { + return wrapTLSCertificate(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (cert *TLSCertificate) baseTLSCertificate() *TLSCertificate { + return cert +} + +// BaseTLSCertificate returns the underlying base object. +func BaseTLSCertificate(obj TLSCertificater) *TLSCertificate { + return obj.baseTLSCertificate() +} + +// NewTLSCertificateFromFile creates a Certificate from the data in file. +// +// As of 2.72, if the filename ends in .p12 or .pfx the data is loaded +// by g_tls_certificate_new_from_pkcs12() otherwise it is loaded by +// g_tls_certificate_new_from_pem(). See those functions for exact details. +// +// If file cannot be read or parsed, the function will return NULL and set +// error. +// +// The function takes the following parameters: +// +// - file containing a certificate to import. +// +// The function returns the following values: +// +// - tlsCertificate: new certificate, or NULL on error. +func NewTLSCertificateFromFile(file string) (*TLSCertificate, error) { + var _arg1 *C.gchar // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_tls_certificate_new_from_file(_arg1, &_cerr) + runtime.KeepAlive(file) + + var _tlsCertificate *TLSCertificate // out + var _goerr error // out + + _tlsCertificate = wrapTLSCertificate(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// NewTLSCertificateFromFileWithPassword creates a Certificate from the data in +// file. +// +// If file cannot be read or parsed, the function will return NULL and set +// error. +// +// Any unknown file types will error with G_IO_ERROR_NOT_SUPPORTED. +// Currently only .p12 and .pfx files are supported. See +// g_tls_certificate_new_from_pkcs12() for more details. +// +// The function takes the following parameters: +// +// - file containing a certificate to import. +// - password for PKCS #12 files. +// +// The function returns the following values: +// +// - tlsCertificate: new certificate, or NULL on error. +func NewTLSCertificateFromFileWithPassword(file, password string) (*TLSCertificate, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(password))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_tls_certificate_new_from_file_with_password(_arg1, _arg2, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(password) + + var _tlsCertificate *TLSCertificate // out + var _goerr error // out + + _tlsCertificate = wrapTLSCertificate(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// NewTLSCertificateFromFiles creates a Certificate from the PEM-encoded +// data in cert_file and key_file. The returned certificate will be the first +// certificate found in cert_file. As of GLib 2.44, if cert_file contains more +// certificates it will try to load a certificate chain. All certificates will +// be verified in the order found (top-level certificate should be the last one +// in the file) and the Certificate:issuer property of each certificate will be +// set accordingly if the verification succeeds. If any certificate in the chain +// cannot be verified, the first certificate in the file will still be returned. +// +// If either file cannot be read or parsed, the function will return NULL and +// set error. Otherwise, this behaves like g_tls_certificate_new_from_pem(). +// +// The function takes the following parameters: +// +// - certFile: file containing one or more PEM-encoded certificates to import. +// - keyFile: file containing a PEM-encoded private key to import. +// +// The function returns the following values: +// +// - tlsCertificate: new certificate, or NULL on error. +func NewTLSCertificateFromFiles(certFile, keyFile string) (*TLSCertificate, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(certFile))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(keyFile))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_tls_certificate_new_from_files(_arg1, _arg2, &_cerr) + runtime.KeepAlive(certFile) + runtime.KeepAlive(keyFile) + + var _tlsCertificate *TLSCertificate // out + var _goerr error // out + + _tlsCertificate = wrapTLSCertificate(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// NewTLSCertificateFromPem creates a Certificate from the PEM-encoded +// data in data. If data includes both a certificate and a private key, +// then the returned certificate will include the private key data as well. +// (See the Certificate:private-key-pem property for information about supported +// formats.) +// +// The returned certificate will be the first certificate found in data. +// As of GLib 2.44, if data contains more certificates it will try to load +// a certificate chain. All certificates will be verified in the order +// found (top-level certificate should be the last one in the file) and the +// Certificate:issuer property of each certificate will be set accordingly +// if the verification succeeds. If any certificate in the chain cannot be +// verified, the first certificate in the file will still be returned. +// +// The function takes the following parameters: +// +// - data: PEM-encoded certificate data. +// +// The function returns the following values: +// +// - tlsCertificate: new certificate, or NULL if data is invalid. +func NewTLSCertificateFromPem(data string) (*TLSCertificate, error) { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg2 = (C.gssize)(len(data)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(data) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(data)), data) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_tls_certificate_new_from_pem(_arg1, _arg2, &_cerr) + runtime.KeepAlive(data) + + var _tlsCertificate *TLSCertificate // out + var _goerr error // out + + _tlsCertificate = wrapTLSCertificate(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// NewTLSCertificateFromPKCS11URIs creates a Certificate from a PKCS \#11 +// (https://docs.oasis-open.org/pkcs11/pkcs11-base/v3.0/os/pkcs11-base-v3.0-os.html) +// URI. +// +// An example pkcs11_uri would be +// pkcs11:model=Model;manufacturer=Manufacture;serial=1;token=My20Client20Certificate;id=01 +// +// Where the token’s layout is: +// +// Object 0: +// URL: pkcs11:model=Model;manufacturer=Manufacture;serial=1;token=My20Client20Certificate;id=01;object=private20key;type=private +// Type: Private key (RSA-2048) +// ID: 01 +// +// Object 1: +// URL: pkcs11:model=Model;manufacturer=Manufacture;serial=1;token=My20Client20Certificate;id=01;object=Certificate20for20Authentication;type=cert +// Type: X.509 Certificate (RSA-2048) +// ID: 01 +// +// In this case the certificate and private key would both be detected and used +// as expected. pkcs_uri may also just reference an X.509 certificate object and +// then optionally private_key_pkcs11_uri allows using a private key exposed +// under a different URI. +// +// Note that the private key is not accessed until usage and may fail or require +// a PIN later. +// +// The function takes the following parameters: +// +// - pkcs11Uri: PKCS \#11 URI. +// - privateKeyPkcs11Uri (optional): PKCS \#11 URI. +// +// The function returns the following values: +// +// - tlsCertificate: new certificate, or NULL on error. +func NewTLSCertificateFromPKCS11URIs(pkcs11Uri, privateKeyPkcs11Uri string) (*TLSCertificate, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(pkcs11Uri))) + defer C.free(unsafe.Pointer(_arg1)) + if privateKeyPkcs11Uri != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(privateKeyPkcs11Uri))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.g_tls_certificate_new_from_pkcs11_uris(_arg1, _arg2, &_cerr) + runtime.KeepAlive(pkcs11Uri) + runtime.KeepAlive(privateKeyPkcs11Uri) + + var _tlsCertificate *TLSCertificate // out + var _goerr error // out + + _tlsCertificate = wrapTLSCertificate(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// NewTLSCertificateFromPKCS12 creates a Certificate from the data in data. +// It must contain a certificate and matching private key. +// +// If extra certificates are included they will be verified as a chain and the +// Certificate:issuer property will be set. All other data will be ignored. +// +// You can pass as single password for all of the data which will be used both +// for the PKCS #12 container as well as encrypted private keys. If decryption +// fails it will error with G_TLS_ERROR_BAD_CERTIFICATE_PASSWORD. +// +// This constructor requires support in the current Backend. If support is +// missing it will error with G_IO_ERROR_NOT_SUPPORTED. +// +// Other parsing failures will error with G_TLS_ERROR_BAD_CERTIFICATE. +// +// The function takes the following parameters: +// +// - data: DER-encoded PKCS #12 format certificate data. +// - password (optional): optional password for encrypted certificate data. +// +// The function returns the following values: +// +// - tlsCertificate: new certificate, or NULL if data is invalid. +func NewTLSCertificateFromPKCS12(data []byte, password string) (*TLSCertificate, error) { + var _arg1 *C.guint8 // out + var _arg2 C.gsize + var _arg3 *C.gchar // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg2 = (C.gsize)(len(data)) + if len(data) > 0 { + _arg1 = (*C.guint8)(unsafe.Pointer(&data[0])) + } + if password != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(password))) + defer C.free(unsafe.Pointer(_arg3)) + } + + _cret = C.g_tls_certificate_new_from_pkcs12(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(data) + runtime.KeepAlive(password) + + var _tlsCertificate *TLSCertificate // out + var _goerr error // out + + _tlsCertificate = wrapTLSCertificate(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// Issuer gets the Certificate representing cert's issuer, if known. +// +// The function returns the following values: +// +// - tlsCertificate (optional): certificate of cert's issuer, or NULL if cert +// is self-signed or signed with an unknown certificate. +func (cert *TLSCertificate) Issuer() TLSCertificater { + var _arg0 *C.GTlsCertificate // out + var _cret *C.GTlsCertificate // in + + _arg0 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(cert).Native())) + + _cret = C.g_tls_certificate_get_issuer(_arg0) + runtime.KeepAlive(cert) + + var _tlsCertificate TLSCertificater // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + } + + return _tlsCertificate +} + +// IssuerName returns the issuer name from the certificate. +// +// The function returns the following values: +// +// - utf8 (optional): issuer name, or NULL if it's not available. +func (cert *TLSCertificate) IssuerName() string { + var _arg0 *C.GTlsCertificate // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(cert).Native())) + + _cret = C.g_tls_certificate_get_issuer_name(_arg0) + runtime.KeepAlive(cert) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// NotValidAfter returns the time at which the certificate became or will become +// invalid. +// +// The function returns the following values: +// +// - dateTime (optional): not-valid-after date, or NULL if it's not available. +func (cert *TLSCertificate) NotValidAfter() *glib.DateTime { + var _arg0 *C.GTlsCertificate // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(cert).Native())) + + _cret = C.g_tls_certificate_get_not_valid_after(_arg0) + runtime.KeepAlive(cert) + + var _dateTime *glib.DateTime // out + + if _cret != nil { + _dateTime = (*glib.DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NotValidBefore returns the time at which the certificate became or will +// become valid. +// +// The function returns the following values: +// +// - dateTime (optional): not-valid-before date, or NULL if it's not +// available. +func (cert *TLSCertificate) NotValidBefore() *glib.DateTime { + var _arg0 *C.GTlsCertificate // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(cert).Native())) + + _cret = C.g_tls_certificate_get_not_valid_before(_arg0) + runtime.KeepAlive(cert) + + var _dateTime *glib.DateTime // out + + if _cret != nil { + _dateTime = (*glib.DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// SubjectName returns the subject name from the certificate. +// +// The function returns the following values: +// +// - utf8 (optional): subject name, or NULL if it's not available. +func (cert *TLSCertificate) SubjectName() string { + var _arg0 *C.GTlsCertificate // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(cert).Native())) + + _cret = C.g_tls_certificate_get_subject_name(_arg0) + runtime.KeepAlive(cert) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// IsSame: check if two Certificate objects represent the same certificate. +// The raw DER byte data of the two certificates are checked for equality. +// This has the effect that two certificates may compare equal even if their +// Certificate:issuer, Certificate:private-key, or Certificate:private-key-pem +// properties differ. +// +// The function takes the following parameters: +// +// - certTwo: second certificate to compare. +// +// The function returns the following values: +// +// - ok: whether the same or not. +func (certOne *TLSCertificate) IsSame(certTwo TLSCertificater) bool { + var _arg0 *C.GTlsCertificate // out + var _arg1 *C.GTlsCertificate // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certOne).Native())) + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certTwo).Native())) + + _cret = C.g_tls_certificate_is_same(_arg0, _arg1) + runtime.KeepAlive(certOne) + runtime.KeepAlive(certTwo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Verify: this verifies cert and returns a set of CertificateFlags indicating +// any problems found with it. This can be used to verify a certificate outside +// the context of making a connection, or to check a certificate against a CA +// that is not part of the system CA database. +// +// If cert is valid, G_TLS_CERTIFICATE_NO_FLAGS is returned. +// +// If identity is not NULL, cert's name(s) will be compared against it, and +// G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return value if it does not +// match. If identity is NULL, that bit will never be set in the return value. +// +// If trusted_ca is not NULL, then cert (or one of the certificates in its +// chain) must be signed by it, or else G_TLS_CERTIFICATE_UNKNOWN_CA will be set +// in the return value. If trusted_ca is NULL, that bit will never be set in the +// return value. +// +// GLib guarantees that if certificate verification fails, at least one error +// will be set in the return value, but it does not guarantee that all possible +// errors will be set. Accordingly, you may not safely decide to ignore any +// particular type of error. For example, it would be incorrect to mask +// G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates, because +// this could potentially be the only error flag set even if other problems +// exist with the certificate. +// +// Because TLS session context is not used, Certificate may not perform as many +// checks on the certificates as Connection would. For example, certificate +// constraints may not be honored, and revocation checks may not be performed. +// The best way to verify TLS certificates used by a TLS connection is to let +// Connection handle the verification. +// +// The function takes the following parameters: +// +// - identity (optional): expected peer identity. +// - trustedCa (optional): certificate of a trusted authority. +// +// The function returns the following values: +// +// - tlsCertificateFlags: appropriate CertificateFlags. +func (cert *TLSCertificate) Verify(identity SocketConnectabler, trustedCa TLSCertificater) TLSCertificateFlags { + var _arg0 *C.GTlsCertificate // out + var _arg1 *C.GSocketConnectable // out + var _arg2 *C.GTlsCertificate // out + var _cret C.GTlsCertificateFlags // in + + _arg0 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(cert).Native())) + if identity != nil { + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(identity).Native())) + } + if trustedCa != nil { + _arg2 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(trustedCa).Native())) + } + + _cret = C.g_tls_certificate_verify(_arg0, _arg1, _arg2) + runtime.KeepAlive(cert) + runtime.KeepAlive(identity) + runtime.KeepAlive(trustedCa) + + var _tlsCertificateFlags TLSCertificateFlags // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + + return _tlsCertificateFlags +} + +// Verify: this verifies cert and returns a set of CertificateFlags indicating +// any problems found with it. This can be used to verify a certificate outside +// the context of making a connection, or to check a certificate against a CA +// that is not part of the system CA database. +// +// If cert is valid, G_TLS_CERTIFICATE_NO_FLAGS is returned. +// +// If identity is not NULL, cert's name(s) will be compared against it, and +// G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return value if it does not +// match. If identity is NULL, that bit will never be set in the return value. +// +// If trusted_ca is not NULL, then cert (or one of the certificates in its +// chain) must be signed by it, or else G_TLS_CERTIFICATE_UNKNOWN_CA will be set +// in the return value. If trusted_ca is NULL, that bit will never be set in the +// return value. +// +// GLib guarantees that if certificate verification fails, at least one error +// will be set in the return value, but it does not guarantee that all possible +// errors will be set. Accordingly, you may not safely decide to ignore any +// particular type of error. For example, it would be incorrect to mask +// G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates, because +// this could potentially be the only error flag set even if other problems +// exist with the certificate. +// +// Because TLS session context is not used, Certificate may not perform as many +// checks on the certificates as Connection would. For example, certificate +// constraints may not be honored, and revocation checks may not be performed. +// The best way to verify TLS certificates used by a TLS connection is to let +// Connection handle the verification. +// +// The function takes the following parameters: +// +// - identity (optional): expected peer identity. +// - trustedCa (optional): certificate of a trusted authority. +// +// The function returns the following values: +// +// - tlsCertificateFlags: appropriate CertificateFlags. +func (cert *TLSCertificate) verify(identity SocketConnectabler, trustedCa TLSCertificater) TLSCertificateFlags { + gclass := (*C.GTlsCertificateClass)(coreglib.PeekParentClass(cert)) + fnarg := gclass.verify + + var _arg0 *C.GTlsCertificate // out + var _arg1 *C.GSocketConnectable // out + var _arg2 *C.GTlsCertificate // out + var _cret C.GTlsCertificateFlags // in + + _arg0 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(cert).Native())) + if identity != nil { + _arg1 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(identity).Native())) + } + if trustedCa != nil { + _arg2 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(trustedCa).Native())) + } + + _cret = C._gotk4_gio2_TLSCertificate_virtual_verify(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(cert) + runtime.KeepAlive(identity) + runtime.KeepAlive(trustedCa) + + var _tlsCertificateFlags TLSCertificateFlags // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + + return _tlsCertificateFlags +} + +// TLSCertificateListNewFromFile creates one or more Certificates from the +// PEM-encoded data in file. If file cannot be read or parsed, the function +// will return NULL and set error. If file does not contain any PEM-encoded +// certificates, this will return an empty list and not set error. +// +// The function takes the following parameters: +// +// - file containing PEM-encoded certificates to import. +// +// The function returns the following values: +// +// - list: a #GList containing Certificate objects. You must free the list and +// its contents when you are done with it. +func TLSCertificateListNewFromFile(file string) ([]TLSCertificater, error) { + var _arg1 *C.gchar // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_tls_certificate_list_new_from_file(_arg1, &_cerr) + runtime.KeepAlive(file) + + var _list []TLSCertificater // out + var _goerr error // out + + _list = make([]TLSCertificater, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GTlsCertificate)(v) + var dst TLSCertificater // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + dst = rv + } + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// TLSConnectionOverrides contains methods that are overridable. +type TLSConnectionOverrides struct { + // AcceptCertificate: check whether to accept a certificate. + // + // The function takes the following parameters: + // + // - peerCert + // - errors + AcceptCertificate func(peerCert TLSCertificater, errors TLSCertificateFlags) bool + // BindingData: retrieve TLS channel binding data (Since: 2.66). + // + // The function takes the following parameters: + // + // - typ + // - data + BindingData func(typ TLSChannelBindingType, data []byte) error + // NegotiatedProtocol gets the name of the application-layer protocol + // negotiated during the handshake. + // + // If the peer did not use the ALPN extension, or did not advertise + // a protocol that matched one of conn's protocols, or the TLS + // backend does not support ALPN, then this will be NULL. See + // g_tls_connection_set_advertised_protocols(). + // + // The function returns the following values: + // + // - utf8 (optional): negotiated protocol, or NULL. + NegotiatedProtocol func() string + // Handshake attempts a TLS handshake on conn. + // + // On the client side, it is never necessary to call this method; although + // the connection needs to perform a handshake after connecting (or after + // sending a "STARTTLS"-type command), Connection will handle this for you + // automatically when you try to send or receive data on the connection. + // You can call g_tls_connection_handshake() manually if you want to + // know whether the initial handshake succeeded or failed (as opposed to + // just immediately trying to use conn to read or write, in which case, + // if it fails, it may not be possible to tell if it failed before or + // after completing the handshake), but beware that servers may reject + // client authentication after the handshake has completed, so a successful + // handshake does not indicate the connection will be usable. + // + // Likewise, on the server side, although a handshake is necessary at the + // beginning of the communication, you do not need to call this function + // explicitly unless you want clearer error reporting. + // + // Previously, calling g_tls_connection_handshake() after the initial + // handshake would trigger a rehandshake; however, this usage was deprecated + // in GLib 2.60 because rehandshaking was removed from the TLS protocol + // in TLS 1.3. Since GLib 2.64, calling this function after the initial + // handshake will no longer do anything. + // + // When using a Connection created by Client, the Client performs the + // initial handshake, so calling this function manually is not recommended. + // + // Connection::accept_certificate may be emitted during the handshake. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + Handshake func(ctx context.Context) error + // HandshakeFinish: finish an asynchronous TLS handshake operation. + // See g_tls_connection_handshake() for more information. + // + // The function takes the following parameters: + // + // - result: Result. + HandshakeFinish func(result AsyncResulter) error +} + +func defaultTLSConnectionOverrides(v *TLSConnection) TLSConnectionOverrides { + return TLSConnectionOverrides{ + AcceptCertificate: v.acceptCertificate, + BindingData: v.bindingData, + NegotiatedProtocol: v.negotiatedProtocol, + Handshake: v.handshake, + HandshakeFinish: v.handshakeFinish, + } +} + +// TLSConnection: GTlsConnection is the base TLS connection class type, +// which wraps a gio.IOStream and provides TLS encryption on top of it. Its +// subclasses, gio.TLSClientConnection and gio.TLSServerConnection, implement +// client-side and server-side TLS, respectively. +// +// For DTLS (Datagram TLS) support, see gio.DTLSConnection. +type TLSConnection struct { + _ [0]func() // equal guard + IOStream +} + +var ( + _ IOStreamer = (*TLSConnection)(nil) +) + +// TLSConnectioner describes types inherited from class TLSConnection. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type TLSConnectioner interface { + coreglib.Objector + baseTLSConnection() *TLSConnection +} + +var _ TLSConnectioner = (*TLSConnection)(nil) + +func init() { + coreglib.RegisterClassInfo[*TLSConnection, *TLSConnectionClass, TLSConnectionOverrides]( + GTypeTLSConnection, + initTLSConnectionClass, + wrapTLSConnection, + defaultTLSConnectionOverrides, + ) +} + +func initTLSConnectionClass(gclass unsafe.Pointer, overrides TLSConnectionOverrides, classInitFunc func(*TLSConnectionClass)) { + pclass := (*C.GTlsConnectionClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeTLSConnection)))) + + if overrides.AcceptCertificate != nil { + pclass.accept_certificate = (*[0]byte)(C._gotk4_gio2_TlsConnectionClass_accept_certificate) + } + + if overrides.BindingData != nil { + pclass.get_binding_data = (*[0]byte)(C._gotk4_gio2_TlsConnectionClass_get_binding_data) + } + + if overrides.NegotiatedProtocol != nil { + pclass.get_negotiated_protocol = (*[0]byte)(C._gotk4_gio2_TlsConnectionClass_get_negotiated_protocol) + } + + if overrides.Handshake != nil { + pclass.handshake = (*[0]byte)(C._gotk4_gio2_TlsConnectionClass_handshake) + } + + if overrides.HandshakeFinish != nil { + pclass.handshake_finish = (*[0]byte)(C._gotk4_gio2_TlsConnectionClass_handshake_finish) + } + + if classInitFunc != nil { + class := (*TLSConnectionClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapTLSConnection(obj *coreglib.Object) *TLSConnection { + return &TLSConnection{ + IOStream: IOStream{ + Object: obj, + }, + } +} + +func marshalTLSConnection(p uintptr) (interface{}, error) { + return wrapTLSConnection(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (conn *TLSConnection) baseTLSConnection() *TLSConnection { + return conn +} + +// BaseTLSConnection returns the underlying base object. +func BaseTLSConnection(obj TLSConnectioner) *TLSConnection { + return obj.baseTLSConnection() +} + +// ConnectAcceptCertificate is emitted during the TLS handshake after the peer +// certificate has been received. You can examine peer_cert's certification path +// by calling g_tls_certificate_get_issuer() on it. +// +// For a client-side connection, peer_cert is the server's certificate, +// and the signal will only be emitted if the certificate was not acceptable +// according to conn's ClientConnection:validation_flags. If you would like +// the certificate to be accepted despite errors, return TRUE from the signal +// handler. Otherwise, if no handler accepts the certificate, the handshake will +// fail with G_TLS_ERROR_BAD_CERTIFICATE. +// +// GLib guarantees that if certificate verification fails, this signal will +// be emitted with at least one error will be set in errors, but it does not +// guarantee that all possible errors will be set. Accordingly, you may not +// safely decide to ignore any particular type of error. For example, it would +// be incorrect to ignore G_TLS_CERTIFICATE_EXPIRED if you want to allow expired +// certificates, because this could potentially be the only error flag set even +// if other problems exist with the certificate. +// +// For a server-side connection, peer_cert is the certificate +// presented by the client, if this was requested via the server's +// ServerConnection:authentication_mode. On the server side, the signal is +// always emitted when the client presents a certificate, and the certificate +// will only be accepted if a handler returns TRUE. +// +// Note that if this signal is emitted as part of asynchronous I/O in the +// main thread, then you should not attempt to interact with the user before +// returning from the signal handler. If you want to let the user decide whether +// or not to accept the certificate, you would have to return FALSE from the +// signal handler on the first attempt, and then after the connection attempt +// returns a G_TLS_ERROR_BAD_CERTIFICATE, you can interact with the user, +// and if the user decides to accept the certificate, remember that fact, create +// a new connection, and return TRUE from the signal handler the next time. +// +// If you are doing I/O in another thread, you do not need to worry about this, +// and can simply block in the signal handler until the UI thread returns an +// answer. +func (conn *TLSConnection) ConnectAcceptCertificate(f func(peerCert TLSCertificater, errors TLSCertificateFlags) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(conn, "accept-certificate", false, unsafe.Pointer(C._gotk4_gio2_TlsConnection_ConnectAcceptCertificate), f) +} + +// EmitAcceptCertificate: used by Connection implementations to emit the +// Connection::accept-certificate signal. +// +// The function takes the following parameters: +// +// - peerCert peer's Certificate. +// - errors problems with peer_cert. +// +// The function returns the following values: +// +// - ok: TRUE if one of the signal handlers has returned TRUE to accept +// peer_cert. +func (conn *TLSConnection) EmitAcceptCertificate(peerCert TLSCertificater, errors TLSCertificateFlags) bool { + var _arg0 *C.GTlsConnection // out + var _arg1 *C.GTlsCertificate // out + var _arg2 C.GTlsCertificateFlags // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(peerCert).Native())) + _arg2 = C.GTlsCertificateFlags(errors) + + _cret = C.g_tls_connection_emit_accept_certificate(_arg0, _arg1, _arg2) + runtime.KeepAlive(conn) + runtime.KeepAlive(peerCert) + runtime.KeepAlive(errors) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Certificate gets conn's certificate, as set by +// g_tls_connection_set_certificate(). +// +// The function returns the following values: +// +// - tlsCertificate (optional) conn's certificate, or NULL. +func (conn *TLSConnection) Certificate() TLSCertificater { + var _arg0 *C.GTlsConnection // out + var _cret *C.GTlsCertificate // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_certificate(_arg0) + runtime.KeepAlive(conn) + + var _tlsCertificate TLSCertificater // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + } + + return _tlsCertificate +} + +// ChannelBindingData: query the TLS backend for TLS channel binding data of +// type for conn. +// +// This call retrieves TLS channel binding data as specified +// in RFC 5056 (https://tools.ietf.org/html/rfc5056), RFC 5929 +// (https://tools.ietf.org/html/rfc5929), and related RFCs. The binding +// data is returned in data. The data is resized by the callee using +// Array buffer management and will be freed when the data is destroyed by +// g_byte_array_unref(). If data is NULL, it will only check whether TLS +// backend is able to fetch the data (e.g. whether type is supported by the +// TLS backend). It does not guarantee that the data will be available though. +// That could happen if TLS connection does not support type or the binding data +// is not available yet due to additional negotiation or input required. +// +// The function takes the following parameters: +// +// - typ type of data to fetch. +// +// The function returns the following values: +// +// - data (optional) is filled with the binding data, or NULL. +func (conn *TLSConnection) ChannelBindingData(typ TLSChannelBindingType) ([]byte, error) { + var _arg0 *C.GTlsConnection // out + var _arg1 C.GTlsChannelBindingType // out + var _arg2 C.GByteArray // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = C.GTlsChannelBindingType(typ) + + C.g_tls_connection_get_channel_binding_data(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(typ) + + var _data []byte // out + var _goerr error // out + + _data = make([]byte, _arg2.len) + copy(_data, unsafe.Slice((*byte)(_arg2.data), _arg2.len)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _data, _goerr +} + +// CiphersuiteName returns the name of the current TLS ciphersuite, or NULL if +// the connection has not handshaked or has been closed. Beware that the TLS +// backend may use any of multiple different naming conventions, because OpenSSL +// and GnuTLS have their own ciphersuite naming conventions that are different +// from each other and different from the standard, IANA- registered ciphersuite +// names. The ciphersuite name is intended to be displayed to the user for +// informative purposes only, and parsing it is not recommended. +// +// The function returns the following values: +// +// - utf8 (optional): name of the current TLS ciphersuite, or NULL. +func (conn *TLSConnection) CiphersuiteName() string { + var _arg0 *C.GTlsConnection // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_ciphersuite_name(_arg0) + runtime.KeepAlive(conn) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Database gets the certificate database that conn uses to verify peer +// certificates. See g_tls_connection_set_database(). +// +// The function returns the following values: +// +// - tlsDatabase (optional): certificate database that conn uses or NULL. +func (conn *TLSConnection) Database() TLSDatabaser { + var _arg0 *C.GTlsConnection // out + var _cret *C.GTlsDatabase // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_database(_arg0) + runtime.KeepAlive(conn) + + var _tlsDatabase TLSDatabaser // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSDatabaser) + return ok + }) + rv, ok := casted.(TLSDatabaser) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSDatabaser") + } + _tlsDatabase = rv + } + } + + return _tlsDatabase +} + +// Interaction: get the object that will be used to interact with the user. +// It will be used for things like prompting the user for passwords. If NULL is +// returned, then no user interaction will occur for this connection. +// +// The function returns the following values: +// +// - tlsInteraction (optional): interaction object. +func (conn *TLSConnection) Interaction() *TLSInteraction { + var _arg0 *C.GTlsConnection // out + var _cret *C.GTlsInteraction // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_interaction(_arg0) + runtime.KeepAlive(conn) + + var _tlsInteraction *TLSInteraction // out + + if _cret != nil { + _tlsInteraction = wrapTLSInteraction(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _tlsInteraction +} + +// NegotiatedProtocol gets the name of the application-layer protocol negotiated +// during the handshake. +// +// If the peer did not use the ALPN extension, or did not advertise +// a protocol that matched one of conn's protocols, or the TLS +// backend does not support ALPN, then this will be NULL. See +// g_tls_connection_set_advertised_protocols(). +// +// The function returns the following values: +// +// - utf8 (optional): negotiated protocol, or NULL. +func (conn *TLSConnection) NegotiatedProtocol() string { + var _arg0 *C.GTlsConnection // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_negotiated_protocol(_arg0) + runtime.KeepAlive(conn) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// PeerCertificate gets conn's peer's certificate after the handshake +// has completed or failed. (It is not set during the emission of +// Connection::accept-certificate.). +// +// The function returns the following values: +// +// - tlsCertificate (optional) conn's peer's certificate, or NULL. +func (conn *TLSConnection) PeerCertificate() TLSCertificater { + var _arg0 *C.GTlsConnection // out + var _cret *C.GTlsCertificate // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_peer_certificate(_arg0) + runtime.KeepAlive(conn) + + var _tlsCertificate TLSCertificater // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + } + + return _tlsCertificate +} + +// PeerCertificateErrors gets the errors associated with validating conn's +// peer's certificate, after the handshake has completed or failed. (It is not +// set during the emission of Connection::accept-certificate.) +// +// See Connection:peer-certificate-errors for more information. +// +// The function returns the following values: +// +// - tlsCertificateFlags conn's peer's certificate errors. +func (conn *TLSConnection) PeerCertificateErrors() TLSCertificateFlags { + var _arg0 *C.GTlsConnection // out + var _cret C.GTlsCertificateFlags // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_peer_certificate_errors(_arg0) + runtime.KeepAlive(conn) + + var _tlsCertificateFlags TLSCertificateFlags // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + + return _tlsCertificateFlags +} + +// ProtocolVersion returns the current TLS protocol version, which may be +// G_TLS_PROTOCOL_VERSION_UNKNOWN if the connection has not handshaked, or has +// been closed, or if the TLS backend has implemented a protocol version that is +// not a recognized ProtocolVersion. +// +// The function returns the following values: +// +// - tlsProtocolVersion: current TLS protocol version. +func (conn *TLSConnection) ProtocolVersion() TLSProtocolVersion { + var _arg0 *C.GTlsConnection // out + var _cret C.GTlsProtocolVersion // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_protocol_version(_arg0) + runtime.KeepAlive(conn) + + var _tlsProtocolVersion TLSProtocolVersion // out + + _tlsProtocolVersion = TLSProtocolVersion(_cret) + + return _tlsProtocolVersion +} + +// RehandshakeMode gets conn rehandshaking mode. See +// g_tls_connection_set_rehandshake_mode() for details. +// +// Deprecated: Changing the rehandshake mode is no longer required for +// compatibility. Also, rehandshaking has been removed from the TLS protocol in +// TLS 1.3. +// +// The function returns the following values: +// +// - tlsRehandshakeMode: G_TLS_REHANDSHAKE_SAFELY. +func (conn *TLSConnection) RehandshakeMode() TLSRehandshakeMode { + var _arg0 *C.GTlsConnection // out + var _cret C.GTlsRehandshakeMode // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_rehandshake_mode(_arg0) + runtime.KeepAlive(conn) + + var _tlsRehandshakeMode TLSRehandshakeMode // out + + _tlsRehandshakeMode = TLSRehandshakeMode(_cret) + + return _tlsRehandshakeMode +} + +// RequireCloseNotify tests whether or not conn expects a proper +// TLS close notification when the connection is closed. See +// g_tls_connection_set_require_close_notify() for details. +// +// The function returns the following values: +// +// - ok: TRUE if conn requires a proper TLS close notification. +func (conn *TLSConnection) RequireCloseNotify() bool { + var _arg0 *C.GTlsConnection // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_require_close_notify(_arg0) + runtime.KeepAlive(conn) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UseSystemCertDB gets whether conn uses the system certificate database to +// verify peer certificates. See g_tls_connection_set_use_system_certdb(). +// +// Deprecated: Use g_tls_connection_get_database() instead. +// +// The function returns the following values: +// +// - ok: whether conn uses the system certificate database. +func (conn *TLSConnection) UseSystemCertDB() bool { + var _arg0 *C.GTlsConnection // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C.g_tls_connection_get_use_system_certdb(_arg0) + runtime.KeepAlive(conn) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Handshake attempts a TLS handshake on conn. +// +// On the client side, it is never necessary to call this method; although the +// connection needs to perform a handshake after connecting (or after sending a +// "STARTTLS"-type command), Connection will handle this for you automatically +// when you try to send or receive data on the connection. You can call +// g_tls_connection_handshake() manually if you want to know whether the initial +// handshake succeeded or failed (as opposed to just immediately trying to use +// conn to read or write, in which case, if it fails, it may not be possible to +// tell if it failed before or after completing the handshake), but beware that +// servers may reject client authentication after the handshake has completed, +// so a successful handshake does not indicate the connection will be usable. +// +// Likewise, on the server side, although a handshake is necessary at the +// beginning of the communication, you do not need to call this function +// explicitly unless you want clearer error reporting. +// +// Previously, calling g_tls_connection_handshake() after the initial handshake +// would trigger a rehandshake; however, this usage was deprecated in GLib +// 2.60 because rehandshaking was removed from the TLS protocol in TLS 1.3. +// Since GLib 2.64, calling this function after the initial handshake will no +// longer do anything. +// +// When using a Connection created by Client, the Client performs the initial +// handshake, so calling this function manually is not recommended. +// +// Connection::accept_certificate may be emitted during the handshake. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (conn *TLSConnection) Handshake(ctx context.Context) error { + var _arg0 *C.GTlsConnection // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C.g_tls_connection_handshake(_arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// HandshakeAsync: asynchronously performs a TLS handshake on conn. See +// g_tls_connection_handshake() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the handshake is complete. +func (conn *TLSConnection) HandshakeAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + var _arg0 *C.GTlsConnection // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_tls_connection_handshake_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// HandshakeFinish: finish an asynchronous TLS handshake operation. See +// g_tls_connection_handshake() for more information. +// +// The function takes the following parameters: +// +// - result: Result. +func (conn *TLSConnection) HandshakeFinish(result AsyncResulter) error { + var _arg0 *C.GTlsConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.g_tls_connection_handshake_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAdvertisedProtocols sets the list of application-layer protocols +// to advertise that the caller is willing to speak on this connection. +// The Application-Layer Protocol Negotiation (ALPN) extension will +// be used to negotiate a compatible protocol with the peer; use +// g_tls_connection_get_negotiated_protocol() to find the negotiated protocol +// after the handshake. Specifying NULL for the the value of protocols will +// disable ALPN negotiation. +// +// See IANA TLS ALPN Protocol IDs +// (https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids) +// for a list of registered protocol IDs. +// +// The function takes the following parameters: +// +// - protocols (optional): NULL-terminated array of ALPN protocol names (eg, +// "http/1.1", "h2"), or NULL. +func (conn *TLSConnection) SetAdvertisedProtocols(protocols []string) { + var _arg0 *C.GTlsConnection // out + var _arg1 **C.gchar // out + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + _arg1 = (**C.gchar)(C.calloc(C.size_t((len(protocols) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(protocols)+1) + var zero *C.gchar + out[len(protocols)] = zero + for i := range protocols { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(protocols[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.g_tls_connection_set_advertised_protocols(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(protocols) +} + +// SetCertificate: this sets the certificate that conn will present to its peer +// during the TLS handshake. For a ServerConnection, it is mandatory to set +// this, and that will normally be done at construct time. +// +// For a ClientConnection, this is optional. If a handshake fails with +// G_TLS_ERROR_CERTIFICATE_REQUIRED, that means that the server requires a +// certificate, and if you try connecting again, you should call this method +// first. You can call g_tls_client_connection_get_accepted_cas() on the failed +// connection to get a list of Certificate Authorities that the server will +// accept certificates from. +// +// (It is also possible that a server will allow the connection with or +// without a certificate; in that case, if you don't provide a certificate, +// you can tell that the server requested one by the fact that +// g_tls_client_connection_get_accepted_cas() will return non-NULL.). +// +// The function takes the following parameters: +// +// - certificate to use for conn. +func (conn *TLSConnection) SetCertificate(certificate TLSCertificater) { + var _arg0 *C.GTlsConnection // out + var _arg1 *C.GTlsCertificate // out + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + + C.g_tls_connection_set_certificate(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(certificate) +} + +// SetDatabase sets the certificate database that is used to verify +// peer certificates. This is set to the default database by default. +// See g_tls_backend_get_default_database(). If set to NULL, then peer +// certificate validation will always set the G_TLS_CERTIFICATE_UNKNOWN_CA +// error (meaning Connection::accept-certificate will always be +// emitted on client-side connections, unless that bit is not set in +// ClientConnection:validation-flags). +// +// There are nonintuitive security implications when using a non-default +// database. See Connection:database for details. +// +// The function takes the following parameters: +// +// - database (optional): Database. +func (conn *TLSConnection) SetDatabase(database TLSDatabaser) { + var _arg0 *C.GTlsConnection // out + var _arg1 *C.GTlsDatabase // out + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + if database != nil { + _arg1 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(database).Native())) + } + + C.g_tls_connection_set_database(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(database) +} + +// SetInteraction: set the object that will be used to interact with the user. +// It will be used for things like prompting the user for passwords. +// +// The interaction argument will normally be a derived subclass of Interaction. +// NULL can also be provided if no user interaction should occur for this +// connection. +// +// The function takes the following parameters: +// +// - interaction (optional) object, or NULL. +func (conn *TLSConnection) SetInteraction(interaction *TLSInteraction) { + var _arg0 *C.GTlsConnection // out + var _arg1 *C.GTlsInteraction // out + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + if interaction != nil { + _arg1 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + + C.g_tls_connection_set_interaction(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(interaction) +} + +// SetRehandshakeMode: since GLib 2.64, changing the rehandshake mode is no +// longer supported and will have no effect. With TLS 1.3, rehandshaking has +// been removed from the TLS protocol, replaced by separate post-handshake +// authentication and rekey operations. +// +// Deprecated: Changing the rehandshake mode is no longer required for +// compatibility. Also, rehandshaking has been removed from the TLS protocol in +// TLS 1.3. +// +// The function takes the following parameters: +// +// - mode: rehandshaking mode. +func (conn *TLSConnection) SetRehandshakeMode(mode TLSRehandshakeMode) { + var _arg0 *C.GTlsConnection // out + var _arg1 C.GTlsRehandshakeMode // out + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = C.GTlsRehandshakeMode(mode) + + C.g_tls_connection_set_rehandshake_mode(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(mode) +} + +// SetRequireCloseNotify sets whether or not conn expects a proper TLS close +// notification before the connection is closed. If this is TRUE (the default), +// then conn will expect to receive a TLS close notification from its peer +// before the connection is closed, and will return a G_TLS_ERROR_EOF error if +// the connection is closed without proper notification (since this may indicate +// a network error, or man-in-the-middle attack). +// +// In some protocols, the application will know whether or not the +// connection was closed cleanly based on application-level data +// (because the application-level data includes a length field, +// or is somehow self-delimiting); in this case, the close notify is +// redundant and sometimes omitted. (TLS 1.1 explicitly allows this; +// in TLS 1.0 it is technically an error, but often done anyway.) You can +// use g_tls_connection_set_require_close_notify() to tell conn to allow an +// "unannounced" connection close, in which case the close will show up as a +// 0-length read, as in a non-TLS Connection, and it is up to the application to +// check that the data has been fully received. +// +// Note that this only affects the behavior when the peer closes the connection; +// when the application calls g_io_stream_close() itself on conn, this will +// send a close notification regardless of the setting of this property. +// If you explicitly want to do an unclean close, you can close conn's +// Connection:base-io-stream rather than closing conn itself, but note that this +// may only be done when no other operations are pending on conn or the base I/O +// stream. +// +// The function takes the following parameters: +// +// - requireCloseNotify: whether or not to require close notification. +func (conn *TLSConnection) SetRequireCloseNotify(requireCloseNotify bool) { + var _arg0 *C.GTlsConnection // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + if requireCloseNotify { + _arg1 = C.TRUE + } + + C.g_tls_connection_set_require_close_notify(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(requireCloseNotify) +} + +// SetUseSystemCertDB sets whether conn uses the system certificate +// database to verify peer certificates. This is TRUE by default. +// If set to FALSE, then peer certificate validation will always set the +// G_TLS_CERTIFICATE_UNKNOWN_CA error (meaning Connection::accept-certificate +// will always be emitted on client-side connections, unless that bit is not set +// in ClientConnection:validation-flags). +// +// Deprecated: Use g_tls_connection_set_database() instead. +// +// The function takes the following parameters: +// +// - useSystemCertdb: whether to use the system certificate database. +func (conn *TLSConnection) SetUseSystemCertDB(useSystemCertdb bool) { + var _arg0 *C.GTlsConnection // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + if useSystemCertdb { + _arg1 = C.TRUE + } + + C.g_tls_connection_set_use_system_certdb(_arg0, _arg1) + runtime.KeepAlive(conn) + runtime.KeepAlive(useSystemCertdb) +} + +// acceptCertificate: check whether to accept a certificate. +// +// The function takes the following parameters: +// +// - peerCert +// - errors +func (connection *TLSConnection) acceptCertificate(peerCert TLSCertificater, errors TLSCertificateFlags) bool { + gclass := (*C.GTlsConnectionClass)(coreglib.PeekParentClass(connection)) + fnarg := gclass.accept_certificate + + var _arg0 *C.GTlsConnection // out + var _arg1 *C.GTlsCertificate // out + var _arg2 C.GTlsCertificateFlags // out + var _cret C.gboolean // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(peerCert).Native())) + _arg2 = C.GTlsCertificateFlags(errors) + + _cret = C._gotk4_gio2_TLSConnection_virtual_accept_certificate(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(connection) + runtime.KeepAlive(peerCert) + runtime.KeepAlive(errors) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// bindingData: retrieve TLS channel binding data (Since: 2.66). +// +// The function takes the following parameters: +// +// - typ +// - data +func (conn *TLSConnection) bindingData(typ TLSChannelBindingType, data []byte) error { + gclass := (*C.GTlsConnectionClass)(coreglib.PeekParentClass(conn)) + fnarg := gclass.get_binding_data + + var _arg0 *C.GTlsConnection // out + var _arg1 C.GTlsChannelBindingType // out + var _arg2 *C.GByteArray // out + var _cerr *C.GError // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = C.GTlsChannelBindingType(typ) + _arg2 = C.g_byte_array_sized_new(C.guint(len(data))) + if len(data) > 0 { + _arg2 = C.g_byte_array_append(_arg2, (*C.guint8)(&data[0]), C.guint(len(data))) + } + defer C.g_byte_array_unref(_arg2) + + C._gotk4_gio2_TLSConnection_virtual_get_binding_data(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(typ) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// negotiatedProtocol gets the name of the application-layer protocol negotiated +// during the handshake. +// +// If the peer did not use the ALPN extension, or did not advertise +// a protocol that matched one of conn's protocols, or the TLS +// backend does not support ALPN, then this will be NULL. See +// g_tls_connection_set_advertised_protocols(). +// +// The function returns the following values: +// +// - utf8 (optional): negotiated protocol, or NULL. +func (conn *TLSConnection) negotiatedProtocol() string { + gclass := (*C.GTlsConnectionClass)(coreglib.PeekParentClass(conn)) + fnarg := gclass.get_negotiated_protocol + + var _arg0 *C.GTlsConnection // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + + _cret = C._gotk4_gio2_TLSConnection_virtual_get_negotiated_protocol(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(conn) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Handshake attempts a TLS handshake on conn. +// +// On the client side, it is never necessary to call this method; although the +// connection needs to perform a handshake after connecting (or after sending a +// "STARTTLS"-type command), Connection will handle this for you automatically +// when you try to send or receive data on the connection. You can call +// g_tls_connection_handshake() manually if you want to know whether the initial +// handshake succeeded or failed (as opposed to just immediately trying to use +// conn to read or write, in which case, if it fails, it may not be possible to +// tell if it failed before or after completing the handshake), but beware that +// servers may reject client authentication after the handshake has completed, +// so a successful handshake does not indicate the connection will be usable. +// +// Likewise, on the server side, although a handshake is necessary at the +// beginning of the communication, you do not need to call this function +// explicitly unless you want clearer error reporting. +// +// Previously, calling g_tls_connection_handshake() after the initial handshake +// would trigger a rehandshake; however, this usage was deprecated in GLib +// 2.60 because rehandshaking was removed from the TLS protocol in TLS 1.3. +// Since GLib 2.64, calling this function after the initial handshake will no +// longer do anything. +// +// When using a Connection created by Client, the Client performs the initial +// handshake, so calling this function manually is not recommended. +// +// Connection::accept_certificate may be emitted during the handshake. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +func (conn *TLSConnection) handshake(ctx context.Context) error { + gclass := (*C.GTlsConnectionClass)(coreglib.PeekParentClass(conn)) + fnarg := gclass.handshake + + var _arg0 *C.GTlsConnection // out + var _arg1 *C.GCancellable // out + var _cerr *C.GError // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg1 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + + C._gotk4_gio2_TLSConnection_virtual_handshake(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// handshakeAsync: asynchronously performs a TLS handshake on conn. See +// g_tls_connection_handshake() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - ioPriority: [I/O priority][io-priority] of the request. +// - callback (optional) to call when the handshake is complete. +func (conn *TLSConnection) handshakeAsync(ctx context.Context, ioPriority int, callback AsyncReadyCallback) { + gclass := (*C.GTlsConnectionClass)(coreglib.PeekParentClass(conn)) + fnarg := gclass.handshake_async + + var _arg0 *C.GTlsConnection // out + var _arg2 *C.GCancellable // out + var _arg1 C.int // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.int(ioPriority) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_TLSConnection_virtual_handshake_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(conn) + runtime.KeepAlive(ctx) + runtime.KeepAlive(ioPriority) + runtime.KeepAlive(callback) +} + +// handshakeFinish: finish an asynchronous TLS handshake operation. See +// g_tls_connection_handshake() for more information. +// +// The function takes the following parameters: +// +// - result: Result. +func (conn *TLSConnection) handshakeFinish(result AsyncResulter) error { + gclass := (*C.GTlsConnectionClass)(coreglib.PeekParentClass(conn)) + fnarg := gclass.handshake_finish + + var _arg0 *C.GTlsConnection // out + var _arg1 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg0 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(conn).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C._gotk4_gio2_TLSConnection_virtual_handshake_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(conn) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// TLSDatabaseOverrides contains methods that are overridable. +type TLSDatabaseOverrides struct { + // CreateCertificateHandle: create a handle string for the certificate. + // The database will only be able to create a handle for certificates that + // originate from the database. In cases where the database cannot create a + // handle for a certificate, NULL will be returned. + // + // This handle should be stable across various instances of the application, + // and between applications. If a certificate is modified in the database, + // then it is not guaranteed that this handle will continue to point to it. + // + // The function takes the following parameters: + // + // - certificate for which to create a handle. + // + // The function returns the following values: + // + // - utf8 (optional): newly allocated string containing the handle. + CreateCertificateHandle func(certificate TLSCertificater) string + // LookupCertificateForHandle: look up a certificate by its handle. + // + // The handle should have been created by calling + // g_tls_database_create_certificate_handle() on a Database object of + // the same TLS backend. The handle is designed to remain valid across + // instantiations of the database. + // + // If the handle is no longer valid, or does not point to a certificate in + // this database, then NULL will be returned. + // + // This function can block, use + // g_tls_database_lookup_certificate_for_handle_async() to perform the + // lookup operation asynchronously. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + // - handle: certificate handle. + // - interaction (optional): used to interact with the user if necessary. + // - flags flags which affect the lookup. + // + // The function returns the following values: + // + // - tlsCertificate (optional): newly allocated Certificate, or NULL. + // Use g_object_unref() to release the certificate. + LookupCertificateForHandle func(ctx context.Context, handle string, interaction *TLSInteraction, flags TLSDatabaseLookupFlags) (TLSCertificater, error) + // LookupCertificateForHandleFinish: finish an + // asynchronous lookup of a certificate by its handle. See + // g_tls_database_lookup_certificate_for_handle() for more information. + // + // If the handle is no longer valid, or does not point to a certificate in + // this database, then NULL will be returned. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - tlsCertificate: newly allocated Certificate object. Use + // g_object_unref() to release the certificate. + LookupCertificateForHandleFinish func(result AsyncResulter) (TLSCertificater, error) + // LookupCertificateIssuer: look up the issuer of certificate in the + // database. The Certificate:issuer property of certificate is not modified, + // and the two certificates are not hooked into a chain. + // + // This function can block. Use + // g_tls_database_lookup_certificate_issuer_async() to perform the lookup + // operation asynchronously. + // + // Beware this function cannot be used to build certification paths. + // The issuer certificate returned by this function may not be the + // same as the certificate that would actually be used to construct a + // valid certification path during certificate verification. RFC 4158 + // (https://datatracker.ietf.org/doc/html/rfc4158) explains why an issuer + // certificate cannot be naively assumed to be part of the the certification + // path (though GLib's TLS backends may not follow the path building + // strategies outlined in this RFC). Due to the complexity of certification + // path building, GLib does not provide any way to know which certification + // path will actually be used when verifying a TLS certificate. Accordingly, + // this function cannot be used to make security-related decisions. Only + // GLib itself should make security decisions about TLS certificates. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + // - certificate: Certificate. + // - interaction (optional): used to interact with the user if necessary. + // - flags which affect the lookup operation. + // + // The function returns the following values: + // + // - tlsCertificate: newly allocated issuer Certificate, or NULL. + // Use g_object_unref() to release the certificate. + LookupCertificateIssuer func(ctx context.Context, certificate TLSCertificater, interaction *TLSInteraction, flags TLSDatabaseLookupFlags) (TLSCertificater, error) + // LookupCertificateIssuerFinish: finish an asynchronous lookup issuer + // operation. See g_tls_database_lookup_certificate_issuer() for more + // information. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - tlsCertificate: newly allocated issuer Certificate, or NULL. + // Use g_object_unref() to release the certificate. + LookupCertificateIssuerFinish func(result AsyncResulter) (TLSCertificater, error) + // LookupCertificatesIssuedBy: look up certificates issued by this issuer in + // the database. + // + // This function can block, use + // g_tls_database_lookup_certificates_issued_by_async() to perform the + // lookup operation asynchronously. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + // - issuerRawDn which holds the DER encoded issuer DN. + // - interaction (optional): used to interact with the user if necessary. + // - flags flags which affect the lookup operation. + // + // The function returns the following values: + // + // - list: newly allocated list of Certificate objects. Use + // g_object_unref() on each certificate, and g_list_free() on the + // release the list. + LookupCertificatesIssuedBy func(ctx context.Context, issuerRawDn []byte, interaction *TLSInteraction, flags TLSDatabaseLookupFlags) ([]TLSCertificater, error) + // LookupCertificatesIssuedByFinish: finish an asynchronous lookup of + // certificates. See g_tls_database_lookup_certificates_issued_by() for more + // information. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - list: newly allocated list of Certificate objects. Use + // g_object_unref() on each certificate, and g_list_free() on the + // release the list. + LookupCertificatesIssuedByFinish func(result AsyncResulter) ([]TLSCertificater, error) + // VerifyChain determines the validity of a certificate chain, outside the + // context of a TLS session. + // + // chain is a chain of Certificate objects each pointing to the next + // certificate in the chain by its Certificate:issuer property. + // + // purpose describes the purpose (or usage) for which the + // certificate is being used. Typically purpose will be set to + // G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER which means that the + // certificate is being used to authenticate a server (and we are acting as + // the client). + // + // The identity is used to ensure the server certificate is valid for the + // expected peer identity. If the identity does not match the certificate, + // G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return value. + // If identity is NULL, that bit will never be set in the return value. The + // peer identity may also be used to check for pinned certificates (trust + // exceptions) in the database. These may override the normal verification + // process on a host-by-host basis. + // + // Currently there are no flags, and G_TLS_DATABASE_VERIFY_NONE should be + // used. + // + // If chain is found to be valid, then the return value will be 0. If chain + // is found to be invalid, then the return value will indicate at least one + // problem found. If the function is unable to determine whether chain is + // valid (for example, because cancellable is triggered before it completes) + // then the return value will be G_TLS_CERTIFICATE_GENERIC_ERROR and error + // will be set accordingly. error is not set when chain is successfully + // analyzed but found to be invalid. + // + // GLib guarantees that if certificate verification fails, at least one + // error will be set in the return value, but it does not guarantee that + // all possible errors will be set. Accordingly, you may not safely + // decide to ignore any particular type of error. For example, it would be + // incorrect to mask G_TLS_CERTIFICATE_EXPIRED if you want to allow expired + // certificates, because this could potentially be the only error flag set + // even if other problems exist with the certificate. + // + // Prior to GLib 2.48, GLib's default TLS backend modified chain to + // represent the certification path built by Database during certificate + // verification by adjusting the Certificate:issuer property of each + // certificate in chain. Since GLib 2.48, this no longer occurs, so you + // cannot rely on Certificate:issuer to represent the actual certification + // path used during certificate verification. + // + // Because TLS session context is not used, Database may not perform + // as many checks on the certificates as Connection would. For example, + // certificate constraints may not be honored, and revocation checks may + // not be performed. The best way to verify TLS certificates used by a TLS + // connection is to let Connection handle the verification. + // + // The TLS backend may attempt to look up and add missing certificates + // to the chain. This may involve HTTP requests to download missing + // certificates. + // + // This function can block. Use g_tls_database_verify_chain_async() to + // perform the verification operation asynchronously. + // + // The function takes the following parameters: + // + // - ctx (optional) or NULL. + // - chain: Certificate chain. + // - purpose that this certificate chain will be used for. + // - identity (optional): expected peer identity. + // - interaction (optional): used to interact with the user if necessary. + // - flags: additional verify flags. + // + // The function returns the following values: + // + // - tlsCertificateFlags: appropriate CertificateFlags which represents + // the result of verification. + VerifyChain func(ctx context.Context, chain TLSCertificater, purpose string, identity SocketConnectabler, interaction *TLSInteraction, flags TLSDatabaseVerifyFlags) (TLSCertificateFlags, error) + // VerifyChainFinish: finish an asynchronous verify chain operation. + // See g_tls_database_verify_chain() for more information. + // + // If chain is found to be valid, then the return value will be 0. If chain + // is found to be invalid, then the return value will indicate the problems + // found. If the function is unable to determine whether chain is valid or + // not (eg, because cancellable is triggered before it completes) then the + // return value will be G_TLS_CERTIFICATE_GENERIC_ERROR and error will be + // set accordingly. error is not set when chain is successfully analyzed but + // found to be invalid. + // + // The function takes the following parameters: + // + // - result: Result. + // + // The function returns the following values: + // + // - tlsCertificateFlags: appropriate CertificateFlags which represents + // the result of verification. + VerifyChainFinish func(result AsyncResulter) (TLSCertificateFlags, error) +} + +func defaultTLSDatabaseOverrides(v *TLSDatabase) TLSDatabaseOverrides { + return TLSDatabaseOverrides{ + CreateCertificateHandle: v.createCertificateHandle, + LookupCertificateForHandle: v.lookupCertificateForHandle, + LookupCertificateForHandleFinish: v.lookupCertificateForHandleFinish, + LookupCertificateIssuer: v.lookupCertificateIssuer, + LookupCertificateIssuerFinish: v.lookupCertificateIssuerFinish, + LookupCertificatesIssuedBy: v.lookupCertificatesIssuedBy, + LookupCertificatesIssuedByFinish: v.lookupCertificatesIssuedByFinish, + VerifyChain: v.verifyChain, + VerifyChainFinish: v.verifyChainFinish, + } +} + +// TLSDatabase: GTlsDatabase is used to look up certificates and other +// information from a certificate or key store. It is an abstract base class +// which TLS library specific subtypes override. +// +// A GTlsDatabase may be accessed from multiple threads by the TLS backend. +// All implementations are required to be fully thread-safe. +// +// Most common client applications will not directly interact with GTlsDatabase. +// It is used internally by gio.TLSConnection. +type TLSDatabase struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*TLSDatabase)(nil) +) + +// TLSDatabaser describes types inherited from class TLSDatabase. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type TLSDatabaser interface { + coreglib.Objector + baseTLSDatabase() *TLSDatabase +} + +var _ TLSDatabaser = (*TLSDatabase)(nil) + +func init() { + coreglib.RegisterClassInfo[*TLSDatabase, *TLSDatabaseClass, TLSDatabaseOverrides]( + GTypeTLSDatabase, + initTLSDatabaseClass, + wrapTLSDatabase, + defaultTLSDatabaseOverrides, + ) +} + +func initTLSDatabaseClass(gclass unsafe.Pointer, overrides TLSDatabaseOverrides, classInitFunc func(*TLSDatabaseClass)) { + pclass := (*C.GTlsDatabaseClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeTLSDatabase)))) + + if overrides.CreateCertificateHandle != nil { + pclass.create_certificate_handle = (*[0]byte)(C._gotk4_gio2_TlsDatabaseClass_create_certificate_handle) + } + + if overrides.LookupCertificateForHandle != nil { + pclass.lookup_certificate_for_handle = (*[0]byte)(C._gotk4_gio2_TlsDatabaseClass_lookup_certificate_for_handle) + } + + if overrides.LookupCertificateForHandleFinish != nil { + pclass.lookup_certificate_for_handle_finish = (*[0]byte)(C._gotk4_gio2_TlsDatabaseClass_lookup_certificate_for_handle_finish) + } + + if overrides.LookupCertificateIssuer != nil { + pclass.lookup_certificate_issuer = (*[0]byte)(C._gotk4_gio2_TlsDatabaseClass_lookup_certificate_issuer) + } + + if overrides.LookupCertificateIssuerFinish != nil { + pclass.lookup_certificate_issuer_finish = (*[0]byte)(C._gotk4_gio2_TlsDatabaseClass_lookup_certificate_issuer_finish) + } + + if overrides.LookupCertificatesIssuedBy != nil { + pclass.lookup_certificates_issued_by = (*[0]byte)(C._gotk4_gio2_TlsDatabaseClass_lookup_certificates_issued_by) + } + + if overrides.LookupCertificatesIssuedByFinish != nil { + pclass.lookup_certificates_issued_by_finish = (*[0]byte)(C._gotk4_gio2_TlsDatabaseClass_lookup_certificates_issued_by_finish) + } + + if overrides.VerifyChain != nil { + pclass.verify_chain = (*[0]byte)(C._gotk4_gio2_TlsDatabaseClass_verify_chain) + } + + if overrides.VerifyChainFinish != nil { + pclass.verify_chain_finish = (*[0]byte)(C._gotk4_gio2_TlsDatabaseClass_verify_chain_finish) + } + + if classInitFunc != nil { + class := (*TLSDatabaseClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapTLSDatabase(obj *coreglib.Object) *TLSDatabase { + return &TLSDatabase{ + Object: obj, + } +} + +func marshalTLSDatabase(p uintptr) (interface{}, error) { + return wrapTLSDatabase(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (self *TLSDatabase) baseTLSDatabase() *TLSDatabase { + return self +} + +// BaseTLSDatabase returns the underlying base object. +func BaseTLSDatabase(obj TLSDatabaser) *TLSDatabase { + return obj.baseTLSDatabase() +} + +// CreateCertificateHandle: create a handle string for the certificate. The +// database will only be able to create a handle for certificates that originate +// from the database. In cases where the database cannot create a handle for a +// certificate, NULL will be returned. +// +// This handle should be stable across various instances of the application, +// and between applications. If a certificate is modified in the database, +// then it is not guaranteed that this handle will continue to point to it. +// +// The function takes the following parameters: +// +// - certificate for which to create a handle. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string containing the handle. +func (self *TLSDatabase) CreateCertificateHandle(certificate TLSCertificater) string { + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GTlsCertificate // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + + _cret = C.g_tls_database_create_certificate_handle(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(certificate) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// LookupCertificateForHandle: look up a certificate by its handle. +// +// The handle should have been created by calling +// g_tls_database_create_certificate_handle() on a Database object of the same +// TLS backend. The handle is designed to remain valid across instantiations of +// the database. +// +// If the handle is no longer valid, or does not point to a certificate in this +// database, then NULL will be returned. +// +// This function can block, use +// g_tls_database_lookup_certificate_for_handle_async() to perform the lookup +// operation asynchronously. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - handle: certificate handle. +// - interaction (optional): used to interact with the user if necessary. +// - flags flags which affect the lookup. +// +// The function returns the following values: +// +// - tlsCertificate (optional): newly allocated Certificate, or NULL. +// Use g_object_unref() to release the certificate. +func (self *TLSDatabase) LookupCertificateForHandle(ctx context.Context, handle string, interaction *TLSInteraction, flags TLSDatabaseLookupFlags) (TLSCertificater, error) { + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(handle))) + defer C.free(unsafe.Pointer(_arg1)) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + + _cret = C.g_tls_database_lookup_certificate_for_handle(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(handle) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + + var _tlsCertificate TLSCertificater // out + var _goerr error // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// LookupCertificateForHandleAsync: asynchronously look up a certificate by its +// handle in the database. See g_tls_database_lookup_certificate_for_handle() +// for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - handle: certificate handle. +// - interaction (optional): used to interact with the user if necessary. +// - flags flags which affect the lookup. +// - callback (optional) to call when the operation completes. +func (self *TLSDatabase) LookupCertificateForHandleAsync(ctx context.Context, handle string, interaction *TLSInteraction, flags TLSDatabaseLookupFlags, callback AsyncReadyCallback) { + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(handle))) + defer C.free(unsafe.Pointer(_arg1)) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_tls_database_lookup_certificate_for_handle_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(handle) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// LookupCertificateForHandleFinish: finish an asynchronous lookup of a +// certificate by its handle. See g_tls_database_lookup_certificate_for_handle() +// for more information. +// +// If the handle is no longer valid, or does not point to a certificate in this +// database, then NULL will be returned. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - tlsCertificate: newly allocated Certificate object. Use g_object_unref() +// to release the certificate. +func (self *TLSDatabase) LookupCertificateForHandleFinish(result AsyncResulter) (TLSCertificater, error) { + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_tls_database_lookup_certificate_for_handle_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _tlsCertificate TLSCertificater // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// LookupCertificateIssuer: look up the issuer of certificate in the database. +// The Certificate:issuer property of certificate is not modified, and the two +// certificates are not hooked into a chain. +// +// This function can block. Use g_tls_database_lookup_certificate_issuer_async() +// to perform the lookup operation asynchronously. +// +// Beware this function cannot be used to build certification paths. +// The issuer certificate returned by this function may not be the +// same as the certificate that would actually be used to construct a +// valid certification path during certificate verification. RFC 4158 +// (https://datatracker.ietf.org/doc/html/rfc4158) explains why an issuer +// certificate cannot be naively assumed to be part of the the certification +// path (though GLib's TLS backends may not follow the path building strategies +// outlined in this RFC). Due to the complexity of certification path building, +// GLib does not provide any way to know which certification path will actually +// be used when verifying a TLS certificate. Accordingly, this function cannot +// be used to make security-related decisions. Only GLib itself should make +// security decisions about TLS certificates. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - certificate: Certificate. +// - interaction (optional): used to interact with the user if necessary. +// - flags which affect the lookup operation. +// +// The function returns the following values: +// +// - tlsCertificate: newly allocated issuer Certificate, or NULL. Use +// g_object_unref() to release the certificate. +func (self *TLSDatabase) LookupCertificateIssuer(ctx context.Context, certificate TLSCertificater, interaction *TLSInteraction, flags TLSDatabaseLookupFlags) (TLSCertificater, error) { + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GTlsCertificate // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + + _cret = C.g_tls_database_lookup_certificate_issuer(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(certificate) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + + var _tlsCertificate TLSCertificater // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// LookupCertificateIssuerAsync: asynchronously look up the issuer of +// certificate in the database. See g_tls_database_lookup_certificate_issuer() +// for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - certificate: Certificate. +// - interaction (optional): used to interact with the user if necessary. +// - flags which affect the lookup operation. +// - callback (optional) to call when the operation completes. +func (self *TLSDatabase) LookupCertificateIssuerAsync(ctx context.Context, certificate TLSCertificater, interaction *TLSInteraction, flags TLSDatabaseLookupFlags, callback AsyncReadyCallback) { + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GTlsCertificate // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_tls_database_lookup_certificate_issuer_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(certificate) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// LookupCertificateIssuerFinish: finish an asynchronous lookup issuer +// operation. See g_tls_database_lookup_certificate_issuer() for more +// information. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - tlsCertificate: newly allocated issuer Certificate, or NULL. Use +// g_object_unref() to release the certificate. +func (self *TLSDatabase) LookupCertificateIssuerFinish(result AsyncResulter) (TLSCertificater, error) { + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_tls_database_lookup_certificate_issuer_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _tlsCertificate TLSCertificater // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// LookupCertificatesIssuedBy: look up certificates issued by this issuer in the +// database. +// +// This function can block, use +// g_tls_database_lookup_certificates_issued_by_async() to perform the lookup +// operation asynchronously. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - issuerRawDn which holds the DER encoded issuer DN. +// - interaction (optional): used to interact with the user if necessary. +// - flags flags which affect the lookup operation. +// +// The function returns the following values: +// +// - list: newly allocated list of Certificate objects. Use g_object_unref() +// on each certificate, and g_list_free() on the release the list. +func (self *TLSDatabase) LookupCertificatesIssuedBy(ctx context.Context, issuerRawDn []byte, interaction *TLSInteraction, flags TLSDatabaseLookupFlags) ([]TLSCertificater, error) { + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GByteArray // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.g_byte_array_sized_new(C.guint(len(issuerRawDn))) + if len(issuerRawDn) > 0 { + _arg1 = C.g_byte_array_append(_arg1, (*C.guint8)(&issuerRawDn[0]), C.guint(len(issuerRawDn))) + } + defer C.g_byte_array_unref(_arg1) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + + _cret = C.g_tls_database_lookup_certificates_issued_by(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(issuerRawDn) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + + var _list []TLSCertificater // out + var _goerr error // out + + _list = make([]TLSCertificater, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GTlsCertificate)(v) + var dst TLSCertificater // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + dst = rv + } + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// LookupCertificatesIssuedByAsync: asynchronously look up +// certificates issued by this issuer in the database. See +// g_tls_database_lookup_certificates_issued_by() for more information. +// +// The database may choose to hold a reference to the issuer byte array for +// the duration of this asynchronous operation. The byte array should not be +// modified during this time. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - issuerRawDn which holds the DER encoded issuer DN. +// - interaction (optional): used to interact with the user if necessary. +// - flags flags which affect the lookup operation. +// - callback (optional) to call when the operation completes. +func (self *TLSDatabase) LookupCertificatesIssuedByAsync(ctx context.Context, issuerRawDn []byte, interaction *TLSInteraction, flags TLSDatabaseLookupFlags, callback AsyncReadyCallback) { + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GByteArray // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.g_byte_array_sized_new(C.guint(len(issuerRawDn))) + if len(issuerRawDn) > 0 { + _arg1 = C.g_byte_array_append(_arg1, (*C.guint8)(&issuerRawDn[0]), C.guint(len(issuerRawDn))) + } + defer C.g_byte_array_unref(_arg1) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_tls_database_lookup_certificates_issued_by_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(issuerRawDn) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// LookupCertificatesIssuedByFinish: finish an asynchronous lookup of +// certificates. See g_tls_database_lookup_certificates_issued_by() for more +// information. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - list: newly allocated list of Certificate objects. Use g_object_unref() +// on each certificate, and g_list_free() on the release the list. +func (self *TLSDatabase) LookupCertificatesIssuedByFinish(result AsyncResulter) ([]TLSCertificater, error) { + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_tls_database_lookup_certificates_issued_by_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _list []TLSCertificater // out + var _goerr error // out + + _list = make([]TLSCertificater, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GTlsCertificate)(v) + var dst TLSCertificater // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + dst = rv + } + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// VerifyChain determines the validity of a certificate chain, outside the +// context of a TLS session. +// +// chain is a chain of Certificate objects each pointing to the next certificate +// in the chain by its Certificate:issuer property. +// +// purpose describes the purpose (or usage) for which the +// certificate is being used. Typically purpose will be set to +// G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER which means that the certificate +// is being used to authenticate a server (and we are acting as the client). +// +// The identity is used to ensure the server certificate is valid for the +// expected peer identity. If the identity does not match the certificate, +// G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return value. If identity +// is NULL, that bit will never be set in the return value. The peer identity +// may also be used to check for pinned certificates (trust exceptions) in +// the database. These may override the normal verification process on a +// host-by-host basis. +// +// Currently there are no flags, and G_TLS_DATABASE_VERIFY_NONE should be used. +// +// If chain is found to be valid, then the return value will be 0. If chain +// is found to be invalid, then the return value will indicate at least one +// problem found. If the function is unable to determine whether chain is valid +// (for example, because cancellable is triggered before it completes) then the +// return value will be G_TLS_CERTIFICATE_GENERIC_ERROR and error will be set +// accordingly. error is not set when chain is successfully analyzed but found +// to be invalid. +// +// GLib guarantees that if certificate verification fails, at least one error +// will be set in the return value, but it does not guarantee that all possible +// errors will be set. Accordingly, you may not safely decide to ignore any +// particular type of error. For example, it would be incorrect to mask +// G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates, because +// this could potentially be the only error flag set even if other problems +// exist with the certificate. +// +// Prior to GLib 2.48, GLib's default TLS backend modified chain to represent +// the certification path built by Database during certificate verification by +// adjusting the Certificate:issuer property of each certificate in chain. Since +// GLib 2.48, this no longer occurs, so you cannot rely on Certificate:issuer to +// represent the actual certification path used during certificate verification. +// +// Because TLS session context is not used, Database may not perform as many +// checks on the certificates as Connection would. For example, certificate +// constraints may not be honored, and revocation checks may not be performed. +// The best way to verify TLS certificates used by a TLS connection is to let +// Connection handle the verification. +// +// The TLS backend may attempt to look up and add missing certificates to the +// chain. This may involve HTTP requests to download missing certificates. +// +// This function can block. Use g_tls_database_verify_chain_async() to perform +// the verification operation asynchronously. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - chain: Certificate chain. +// - purpose that this certificate chain will be used for. +// - identity (optional): expected peer identity. +// - interaction (optional): used to interact with the user if necessary. +// - flags: additional verify flags. +// +// The function returns the following values: +// +// - tlsCertificateFlags: appropriate CertificateFlags which represents the +// result of verification. +func (self *TLSDatabase) VerifyChain(ctx context.Context, chain TLSCertificater, purpose string, identity SocketConnectabler, interaction *TLSInteraction, flags TLSDatabaseVerifyFlags) (TLSCertificateFlags, error) { + var _arg0 *C.GTlsDatabase // out + var _arg6 *C.GCancellable // out + var _arg1 *C.GTlsCertificate // out + var _arg2 *C.gchar // out + var _arg3 *C.GSocketConnectable // out + var _arg4 *C.GTlsInteraction // out + var _arg5 C.GTlsDatabaseVerifyFlags // out + var _cret C.GTlsCertificateFlags // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg6 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(chain).Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(purpose))) + defer C.free(unsafe.Pointer(_arg2)) + if identity != nil { + _arg3 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(identity).Native())) + } + if interaction != nil { + _arg4 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg5 = C.GTlsDatabaseVerifyFlags(flags) + + _cret = C.g_tls_database_verify_chain(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(chain) + runtime.KeepAlive(purpose) + runtime.KeepAlive(identity) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + + var _tlsCertificateFlags TLSCertificateFlags // out + var _goerr error // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificateFlags, _goerr +} + +// VerifyChainAsync: asynchronously determines the validity of a certificate +// chain after looking up and adding any missing certificates to the chain. +// See g_tls_database_verify_chain() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - chain: Certificate chain. +// - purpose that this certificate chain will be used for. +// - identity (optional): expected peer identity. +// - interaction (optional): used to interact with the user if necessary. +// - flags: additional verify flags. +// - callback (optional) to call when the operation completes. +func (self *TLSDatabase) VerifyChainAsync(ctx context.Context, chain TLSCertificater, purpose string, identity SocketConnectabler, interaction *TLSInteraction, flags TLSDatabaseVerifyFlags, callback AsyncReadyCallback) { + var _arg0 *C.GTlsDatabase // out + var _arg6 *C.GCancellable // out + var _arg1 *C.GTlsCertificate // out + var _arg2 *C.gchar // out + var _arg3 *C.GSocketConnectable // out + var _arg4 *C.GTlsInteraction // out + var _arg5 C.GTlsDatabaseVerifyFlags // out + var _arg7 C.GAsyncReadyCallback // out + var _arg8 C.gpointer + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg6 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(chain).Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(purpose))) + defer C.free(unsafe.Pointer(_arg2)) + if identity != nil { + _arg3 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(identity).Native())) + } + if interaction != nil { + _arg4 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg5 = C.GTlsDatabaseVerifyFlags(flags) + if callback != nil { + _arg7 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg8 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_tls_database_verify_chain_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(chain) + runtime.KeepAlive(purpose) + runtime.KeepAlive(identity) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// VerifyChainFinish: finish an asynchronous verify chain operation. See +// g_tls_database_verify_chain() for more information. +// +// If chain is found to be valid, then the return value will be 0. If chain is +// found to be invalid, then the return value will indicate the problems found. +// If the function is unable to determine whether chain is valid or not (eg, +// because cancellable is triggered before it completes) then the return value +// will be G_TLS_CERTIFICATE_GENERIC_ERROR and error will be set accordingly. +// error is not set when chain is successfully analyzed but found to be invalid. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - tlsCertificateFlags: appropriate CertificateFlags which represents the +// result of verification. +func (self *TLSDatabase) VerifyChainFinish(result AsyncResulter) (TLSCertificateFlags, error) { + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GAsyncResult // out + var _cret C.GTlsCertificateFlags // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_tls_database_verify_chain_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _tlsCertificateFlags TLSCertificateFlags // out + var _goerr error // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificateFlags, _goerr +} + +// createCertificateHandle: create a handle string for the certificate. The +// database will only be able to create a handle for certificates that originate +// from the database. In cases where the database cannot create a handle for a +// certificate, NULL will be returned. +// +// This handle should be stable across various instances of the application, +// and between applications. If a certificate is modified in the database, +// then it is not guaranteed that this handle will continue to point to it. +// +// The function takes the following parameters: +// +// - certificate for which to create a handle. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string containing the handle. +func (self *TLSDatabase) createCertificateHandle(certificate TLSCertificater) string { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.create_certificate_handle + + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GTlsCertificate // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + + _cret = C._gotk4_gio2_TLSDatabase_virtual_create_certificate_handle(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(certificate) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// lookupCertificateForHandle: look up a certificate by its handle. +// +// The handle should have been created by calling +// g_tls_database_create_certificate_handle() on a Database object of the same +// TLS backend. The handle is designed to remain valid across instantiations of +// the database. +// +// If the handle is no longer valid, or does not point to a certificate in this +// database, then NULL will be returned. +// +// This function can block, use +// g_tls_database_lookup_certificate_for_handle_async() to perform the lookup +// operation asynchronously. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - handle: certificate handle. +// - interaction (optional): used to interact with the user if necessary. +// - flags flags which affect the lookup. +// +// The function returns the following values: +// +// - tlsCertificate (optional): newly allocated Certificate, or NULL. +// Use g_object_unref() to release the certificate. +func (self *TLSDatabase) lookupCertificateForHandle(ctx context.Context, handle string, interaction *TLSInteraction, flags TLSDatabaseLookupFlags) (TLSCertificater, error) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.lookup_certificate_for_handle + + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(handle))) + defer C.free(unsafe.Pointer(_arg1)) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + + _cret = C._gotk4_gio2_TLSDatabase_virtual_lookup_certificate_for_handle(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(handle) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + + var _tlsCertificate TLSCertificater // out + var _goerr error // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// lookupCertificateForHandleAsync: asynchronously look up a certificate by its +// handle in the database. See g_tls_database_lookup_certificate_for_handle() +// for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - handle: certificate handle. +// - interaction (optional): used to interact with the user if necessary. +// - flags flags which affect the lookup. +// - callback (optional) to call when the operation completes. +func (self *TLSDatabase) lookupCertificateForHandleAsync(ctx context.Context, handle string, interaction *TLSInteraction, flags TLSDatabaseLookupFlags, callback AsyncReadyCallback) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.lookup_certificate_for_handle_async + + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.gchar // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(handle))) + defer C.free(unsafe.Pointer(_arg1)) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_TLSDatabase_virtual_lookup_certificate_for_handle_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(handle) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// lookupCertificateForHandleFinish: finish an asynchronous lookup of a +// certificate by its handle. See g_tls_database_lookup_certificate_for_handle() +// for more information. +// +// If the handle is no longer valid, or does not point to a certificate in this +// database, then NULL will be returned. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - tlsCertificate: newly allocated Certificate object. Use g_object_unref() +// to release the certificate. +func (self *TLSDatabase) lookupCertificateForHandleFinish(result AsyncResulter) (TLSCertificater, error) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.lookup_certificate_for_handle_finish + + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_TLSDatabase_virtual_lookup_certificate_for_handle_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _tlsCertificate TLSCertificater // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// lookupCertificateIssuer: look up the issuer of certificate in the database. +// The Certificate:issuer property of certificate is not modified, and the two +// certificates are not hooked into a chain. +// +// This function can block. Use g_tls_database_lookup_certificate_issuer_async() +// to perform the lookup operation asynchronously. +// +// Beware this function cannot be used to build certification paths. +// The issuer certificate returned by this function may not be the +// same as the certificate that would actually be used to construct a +// valid certification path during certificate verification. RFC 4158 +// (https://datatracker.ietf.org/doc/html/rfc4158) explains why an issuer +// certificate cannot be naively assumed to be part of the the certification +// path (though GLib's TLS backends may not follow the path building strategies +// outlined in this RFC). Due to the complexity of certification path building, +// GLib does not provide any way to know which certification path will actually +// be used when verifying a TLS certificate. Accordingly, this function cannot +// be used to make security-related decisions. Only GLib itself should make +// security decisions about TLS certificates. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - certificate: Certificate. +// - interaction (optional): used to interact with the user if necessary. +// - flags which affect the lookup operation. +// +// The function returns the following values: +// +// - tlsCertificate: newly allocated issuer Certificate, or NULL. Use +// g_object_unref() to release the certificate. +func (self *TLSDatabase) lookupCertificateIssuer(ctx context.Context, certificate TLSCertificater, interaction *TLSInteraction, flags TLSDatabaseLookupFlags) (TLSCertificater, error) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.lookup_certificate_issuer + + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GTlsCertificate // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + + _cret = C._gotk4_gio2_TLSDatabase_virtual_lookup_certificate_issuer(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(certificate) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + + var _tlsCertificate TLSCertificater // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// lookupCertificateIssuerAsync: asynchronously look up the issuer of +// certificate in the database. See g_tls_database_lookup_certificate_issuer() +// for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - certificate: Certificate. +// - interaction (optional): used to interact with the user if necessary. +// - flags which affect the lookup operation. +// - callback (optional) to call when the operation completes. +func (self *TLSDatabase) lookupCertificateIssuerAsync(ctx context.Context, certificate TLSCertificater, interaction *TLSInteraction, flags TLSDatabaseLookupFlags, callback AsyncReadyCallback) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.lookup_certificate_issuer_async + + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GTlsCertificate // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(certificate).Native())) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_TLSDatabase_virtual_lookup_certificate_issuer_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(certificate) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// lookupCertificateIssuerFinish: finish an asynchronous lookup issuer +// operation. See g_tls_database_lookup_certificate_issuer() for more +// information. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - tlsCertificate: newly allocated issuer Certificate, or NULL. Use +// g_object_unref() to release the certificate. +func (self *TLSDatabase) lookupCertificateIssuerFinish(result AsyncResulter) (TLSCertificater, error) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.lookup_certificate_issuer_finish + + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GTlsCertificate // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_TLSDatabase_virtual_lookup_certificate_issuer_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _tlsCertificate TLSCertificater // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _tlsCertificate = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificate, _goerr +} + +// lookupCertificatesIssuedBy: look up certificates issued by this issuer in the +// database. +// +// This function can block, use +// g_tls_database_lookup_certificates_issued_by_async() to perform the lookup +// operation asynchronously. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - issuerRawDn which holds the DER encoded issuer DN. +// - interaction (optional): used to interact with the user if necessary. +// - flags flags which affect the lookup operation. +// +// The function returns the following values: +// +// - list: newly allocated list of Certificate objects. Use g_object_unref() +// on each certificate, and g_list_free() on the release the list. +func (self *TLSDatabase) lookupCertificatesIssuedBy(ctx context.Context, issuerRawDn []byte, interaction *TLSInteraction, flags TLSDatabaseLookupFlags) ([]TLSCertificater, error) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.lookup_certificates_issued_by + + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GByteArray // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.g_byte_array_sized_new(C.guint(len(issuerRawDn))) + if len(issuerRawDn) > 0 { + _arg1 = C.g_byte_array_append(_arg1, (*C.guint8)(&issuerRawDn[0]), C.guint(len(issuerRawDn))) + } + defer C.g_byte_array_unref(_arg1) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + + _cret = C._gotk4_gio2_TLSDatabase_virtual_lookup_certificates_issued_by(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(issuerRawDn) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + + var _list []TLSCertificater // out + var _goerr error // out + + _list = make([]TLSCertificater, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GTlsCertificate)(v) + var dst TLSCertificater // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + dst = rv + } + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// lookupCertificatesIssuedByAsync: asynchronously look up +// certificates issued by this issuer in the database. See +// g_tls_database_lookup_certificates_issued_by() for more information. +// +// The database may choose to hold a reference to the issuer byte array for +// the duration of this asynchronous operation. The byte array should not be +// modified during this time. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - issuerRawDn which holds the DER encoded issuer DN. +// - interaction (optional): used to interact with the user if necessary. +// - flags flags which affect the lookup operation. +// - callback (optional) to call when the operation completes. +func (self *TLSDatabase) lookupCertificatesIssuedByAsync(ctx context.Context, issuerRawDn []byte, interaction *TLSInteraction, flags TLSDatabaseLookupFlags, callback AsyncReadyCallback) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.lookup_certificates_issued_by_async + + var _arg0 *C.GTlsDatabase // out + var _arg4 *C.GCancellable // out + var _arg1 *C.GByteArray // out + var _arg2 *C.GTlsInteraction // out + var _arg3 C.GTlsDatabaseLookupFlags // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = C.g_byte_array_sized_new(C.guint(len(issuerRawDn))) + if len(issuerRawDn) > 0 { + _arg1 = C.g_byte_array_append(_arg1, (*C.guint8)(&issuerRawDn[0]), C.guint(len(issuerRawDn))) + } + defer C.g_byte_array_unref(_arg1) + if interaction != nil { + _arg2 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg3 = C.GTlsDatabaseLookupFlags(flags) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_TLSDatabase_virtual_lookup_certificates_issued_by_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(issuerRawDn) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// lookupCertificatesIssuedByFinish: finish an asynchronous lookup of +// certificates. See g_tls_database_lookup_certificates_issued_by() for more +// information. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - list: newly allocated list of Certificate objects. Use g_object_unref() +// on each certificate, and g_list_free() on the release the list. +func (self *TLSDatabase) lookupCertificatesIssuedByFinish(result AsyncResulter) ([]TLSCertificater, error) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.lookup_certificates_issued_by_finish + + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GAsyncResult // out + var _cret *C.GList // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_TLSDatabase_virtual_lookup_certificates_issued_by_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _list []TLSCertificater // out + var _goerr error // out + + _list = make([]TLSCertificater, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GTlsCertificate)(v) + var dst TLSCertificater // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + dst = rv + } + _list = append(_list, dst) + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _list, _goerr +} + +// verifyChain determines the validity of a certificate chain, outside the +// context of a TLS session. +// +// chain is a chain of Certificate objects each pointing to the next certificate +// in the chain by its Certificate:issuer property. +// +// purpose describes the purpose (or usage) for which the +// certificate is being used. Typically purpose will be set to +// G_TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER which means that the certificate +// is being used to authenticate a server (and we are acting as the client). +// +// The identity is used to ensure the server certificate is valid for the +// expected peer identity. If the identity does not match the certificate, +// G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return value. If identity +// is NULL, that bit will never be set in the return value. The peer identity +// may also be used to check for pinned certificates (trust exceptions) in +// the database. These may override the normal verification process on a +// host-by-host basis. +// +// Currently there are no flags, and G_TLS_DATABASE_VERIFY_NONE should be used. +// +// If chain is found to be valid, then the return value will be 0. If chain +// is found to be invalid, then the return value will indicate at least one +// problem found. If the function is unable to determine whether chain is valid +// (for example, because cancellable is triggered before it completes) then the +// return value will be G_TLS_CERTIFICATE_GENERIC_ERROR and error will be set +// accordingly. error is not set when chain is successfully analyzed but found +// to be invalid. +// +// GLib guarantees that if certificate verification fails, at least one error +// will be set in the return value, but it does not guarantee that all possible +// errors will be set. Accordingly, you may not safely decide to ignore any +// particular type of error. For example, it would be incorrect to mask +// G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates, because +// this could potentially be the only error flag set even if other problems +// exist with the certificate. +// +// Prior to GLib 2.48, GLib's default TLS backend modified chain to represent +// the certification path built by Database during certificate verification by +// adjusting the Certificate:issuer property of each certificate in chain. Since +// GLib 2.48, this no longer occurs, so you cannot rely on Certificate:issuer to +// represent the actual certification path used during certificate verification. +// +// Because TLS session context is not used, Database may not perform as many +// checks on the certificates as Connection would. For example, certificate +// constraints may not be honored, and revocation checks may not be performed. +// The best way to verify TLS certificates used by a TLS connection is to let +// Connection handle the verification. +// +// The TLS backend may attempt to look up and add missing certificates to the +// chain. This may involve HTTP requests to download missing certificates. +// +// This function can block. Use g_tls_database_verify_chain_async() to perform +// the verification operation asynchronously. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - chain: Certificate chain. +// - purpose that this certificate chain will be used for. +// - identity (optional): expected peer identity. +// - interaction (optional): used to interact with the user if necessary. +// - flags: additional verify flags. +// +// The function returns the following values: +// +// - tlsCertificateFlags: appropriate CertificateFlags which represents the +// result of verification. +func (self *TLSDatabase) verifyChain(ctx context.Context, chain TLSCertificater, purpose string, identity SocketConnectabler, interaction *TLSInteraction, flags TLSDatabaseVerifyFlags) (TLSCertificateFlags, error) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.verify_chain + + var _arg0 *C.GTlsDatabase // out + var _arg6 *C.GCancellable // out + var _arg1 *C.GTlsCertificate // out + var _arg2 *C.gchar // out + var _arg3 *C.GSocketConnectable // out + var _arg4 *C.GTlsInteraction // out + var _arg5 C.GTlsDatabaseVerifyFlags // out + var _cret C.GTlsCertificateFlags // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg6 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(chain).Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(purpose))) + defer C.free(unsafe.Pointer(_arg2)) + if identity != nil { + _arg3 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(identity).Native())) + } + if interaction != nil { + _arg4 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg5 = C.GTlsDatabaseVerifyFlags(flags) + + _cret = C._gotk4_gio2_TLSDatabase_virtual_verify_chain(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(chain) + runtime.KeepAlive(purpose) + runtime.KeepAlive(identity) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + + var _tlsCertificateFlags TLSCertificateFlags // out + var _goerr error // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificateFlags, _goerr +} + +// verifyChainAsync: asynchronously determines the validity of a certificate +// chain after looking up and adding any missing certificates to the chain. +// See g_tls_database_verify_chain() for more information. +// +// The function takes the following parameters: +// +// - ctx (optional) or NULL. +// - chain: Certificate chain. +// - purpose that this certificate chain will be used for. +// - identity (optional): expected peer identity. +// - interaction (optional): used to interact with the user if necessary. +// - flags: additional verify flags. +// - callback (optional) to call when the operation completes. +func (self *TLSDatabase) verifyChainAsync(ctx context.Context, chain TLSCertificater, purpose string, identity SocketConnectabler, interaction *TLSInteraction, flags TLSDatabaseVerifyFlags, callback AsyncReadyCallback) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.verify_chain_async + + var _arg0 *C.GTlsDatabase // out + var _arg6 *C.GCancellable // out + var _arg1 *C.GTlsCertificate // out + var _arg2 *C.gchar // out + var _arg3 *C.GSocketConnectable // out + var _arg4 *C.GTlsInteraction // out + var _arg5 C.GTlsDatabaseVerifyFlags // out + var _arg7 C.GAsyncReadyCallback // out + var _arg8 C.gpointer + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg6 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(chain).Native())) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(purpose))) + defer C.free(unsafe.Pointer(_arg2)) + if identity != nil { + _arg3 = (*C.GSocketConnectable)(unsafe.Pointer(coreglib.InternObject(identity).Native())) + } + if interaction != nil { + _arg4 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + } + _arg5 = C.GTlsDatabaseVerifyFlags(flags) + if callback != nil { + _arg7 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg8 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_TLSDatabase_virtual_verify_chain_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(chain) + runtime.KeepAlive(purpose) + runtime.KeepAlive(identity) + runtime.KeepAlive(interaction) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// verifyChainFinish: finish an asynchronous verify chain operation. See +// g_tls_database_verify_chain() for more information. +// +// If chain is found to be valid, then the return value will be 0. If chain is +// found to be invalid, then the return value will indicate the problems found. +// If the function is unable to determine whether chain is valid or not (eg, +// because cancellable is triggered before it completes) then the return value +// will be G_TLS_CERTIFICATE_GENERIC_ERROR and error will be set accordingly. +// error is not set when chain is successfully analyzed but found to be invalid. +// +// The function takes the following parameters: +// +// - result: Result. +// +// The function returns the following values: +// +// - tlsCertificateFlags: appropriate CertificateFlags which represents the +// result of verification. +func (self *TLSDatabase) verifyChainFinish(result AsyncResulter) (TLSCertificateFlags, error) { + gclass := (*C.GTlsDatabaseClass)(coreglib.PeekParentClass(self)) + fnarg := gclass.verify_chain_finish + + var _arg0 *C.GTlsDatabase // out + var _arg1 *C.GAsyncResult // out + var _cret C.GTlsCertificateFlags // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsDatabase)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_TLSDatabase_virtual_verify_chain_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _tlsCertificateFlags TLSCertificateFlags // out + var _goerr error // out + + _tlsCertificateFlags = TLSCertificateFlags(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsCertificateFlags, _goerr +} + +// TLSInteractionOverrides contains methods that are overridable. +type TLSInteractionOverrides struct { + // AskPassword: run synchronous interaction to ask the user for a password. + // In general, g_tls_interaction_invoke_ask_password() should be used + // instead of this function. + // + // Derived subclasses usually implement a password prompt, although they may + // also choose to provide a password from elsewhere. The password value will + // be filled in and then callback will be called. Alternatively the user may + // abort this password request, which will usually abort the TLS connection. + // + // If the interaction is cancelled by the cancellation object, or by the + // user then G_TLS_INTERACTION_FAILED will be returned with an error that + // contains a G_IO_ERROR_CANCELLED error code. Certain implementations may + // not support immediate cancellation. + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable cancellation object. + // - password: Password object. + // + // The function returns the following values: + // + // - tlsInteractionResult status of the ask password interaction. + AskPassword func(ctx context.Context, password *TLSPassword) (TLSInteractionResult, error) + // AskPasswordFinish: complete an ask password user interaction request. + // This should be once the g_tls_interaction_ask_password_async() completion + // callback is called. + // + // If G_TLS_INTERACTION_HANDLED is returned, then the Password passed to + // g_tls_interaction_ask_password() will have its password filled in. + // + // If the interaction is cancelled by the cancellation object, or by the + // user then G_TLS_INTERACTION_FAILED will be returned with an error that + // contains a G_IO_ERROR_CANCELLED error code. + // + // The function takes the following parameters: + // + // - result passed to the callback. + // + // The function returns the following values: + // + // - tlsInteractionResult status of the ask password interaction. + AskPasswordFinish func(result AsyncResulter) (TLSInteractionResult, error) + // RequestCertificate: run synchronous interaction to ask the user + // to choose a certificate to use with the connection. In general, + // g_tls_interaction_invoke_request_certificate() should be used instead of + // this function. + // + // Derived subclasses usually implement a certificate selector, + // although they may also choose to provide a certificate from elsewhere. + // Alternatively the user may abort this certificate request, which will + // usually abort the TLS connection. + // + // If G_TLS_INTERACTION_HANDLED is returned, then the Connection + // passed to g_tls_interaction_request_certificate() will have had its + // Connection:certificate filled in. + // + // If the interaction is cancelled by the cancellation object, or by the + // user then G_TLS_INTERACTION_FAILED will be returned with an error that + // contains a G_IO_ERROR_CANCELLED error code. Certain implementations may + // not support immediate cancellation. + // + // The function takes the following parameters: + // + // - ctx (optional): optional #GCancellable cancellation object. + // - connection: Connection object. + // - flags providing more information about the request. + // + // The function returns the following values: + // + // - tlsInteractionResult status of the request certificate interaction. + RequestCertificate func(ctx context.Context, connection TLSConnectioner, flags TLSCertificateRequestFlags) (TLSInteractionResult, error) + // RequestCertificateFinish: complete a request certificate + // user interaction request. This should be once the + // g_tls_interaction_request_certificate_async() completion callback is + // called. + // + // If G_TLS_INTERACTION_HANDLED is returned, then the Connection passed + // to g_tls_interaction_request_certificate_async() will have had its + // Connection:certificate filled in. + // + // If the interaction is cancelled by the cancellation object, or by the + // user then G_TLS_INTERACTION_FAILED will be returned with an error that + // contains a G_IO_ERROR_CANCELLED error code. + // + // The function takes the following parameters: + // + // - result passed to the callback. + // + // The function returns the following values: + // + // - tlsInteractionResult status of the request certificate interaction. + RequestCertificateFinish func(result AsyncResulter) (TLSInteractionResult, error) +} + +func defaultTLSInteractionOverrides(v *TLSInteraction) TLSInteractionOverrides { + return TLSInteractionOverrides{ + AskPassword: v.askPassword, + AskPasswordFinish: v.askPasswordFinish, + RequestCertificate: v.requestCertificate, + RequestCertificateFinish: v.requestCertificateFinish, + } +} + +// TLSInteraction: GTlsInteraction provides a mechanism for the TLS connection +// and database code to interact with the user. It can be used to ask the user +// for passwords. +// +// To use a GTlsInteraction with a TLS connection use +// gio.TLSConnection.SetInteraction(). +// +// Callers should instantiate a derived class that implements the various +// interaction methods to show the required dialogs. +// +// Callers should use the 'invoke' functions like +// gio.TLSInteraction.InvokeAskPassword() to run interaction methods. These +// functions make sure that the interaction is invoked in the main loop and not +// in the current thread, if the current thread is not running the main loop. +// +// Derived classes can choose to implement whichever interactions methods +// they’d like to support by overriding those virtual methods in their class +// initialization function. Any interactions not implemented will return +// G_TLS_INTERACTION_UNHANDLED. If a derived class implements an async method, +// it must also implement the corresponding finish method. +type TLSInteraction struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*TLSInteraction)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*TLSInteraction, *TLSInteractionClass, TLSInteractionOverrides]( + GTypeTLSInteraction, + initTLSInteractionClass, + wrapTLSInteraction, + defaultTLSInteractionOverrides, + ) +} + +func initTLSInteractionClass(gclass unsafe.Pointer, overrides TLSInteractionOverrides, classInitFunc func(*TLSInteractionClass)) { + pclass := (*C.GTlsInteractionClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeTLSInteraction)))) + + if overrides.AskPassword != nil { + pclass.ask_password = (*[0]byte)(C._gotk4_gio2_TlsInteractionClass_ask_password) + } + + if overrides.AskPasswordFinish != nil { + pclass.ask_password_finish = (*[0]byte)(C._gotk4_gio2_TlsInteractionClass_ask_password_finish) + } + + if overrides.RequestCertificate != nil { + pclass.request_certificate = (*[0]byte)(C._gotk4_gio2_TlsInteractionClass_request_certificate) + } + + if overrides.RequestCertificateFinish != nil { + pclass.request_certificate_finish = (*[0]byte)(C._gotk4_gio2_TlsInteractionClass_request_certificate_finish) + } + + if classInitFunc != nil { + class := (*TLSInteractionClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapTLSInteraction(obj *coreglib.Object) *TLSInteraction { + return &TLSInteraction{ + Object: obj, + } +} + +func marshalTLSInteraction(p uintptr) (interface{}, error) { + return wrapTLSInteraction(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// AskPassword: run synchronous interaction to ask the user for a password. +// In general, g_tls_interaction_invoke_ask_password() should be used instead of +// this function. +// +// Derived subclasses usually implement a password prompt, although they may +// also choose to provide a password from elsewhere. The password value will be +// filled in and then callback will be called. Alternatively the user may abort +// this password request, which will usually abort the TLS connection. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains +// a G_IO_ERROR_CANCELLED error code. Certain implementations may not support +// immediate cancellation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - password: Password object. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the ask password interaction. +func (interaction *TLSInteraction) AskPassword(ctx context.Context, password *TLSPassword) (TLSInteractionResult, error) { + var _arg0 *C.GTlsInteraction // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GTlsPassword // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + + _cret = C.g_tls_interaction_ask_password(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(password) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// AskPasswordAsync: run asynchronous interaction to ask the user for a +// password. In general, g_tls_interaction_invoke_ask_password() should be used +// instead of this function. +// +// Derived subclasses usually implement a password prompt, although they may +// also choose to provide a password from elsewhere. The password value will be +// filled in and then callback will be called. Alternatively the user may abort +// this password request, which will usually abort the TLS connection. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains +// a G_IO_ERROR_CANCELLED error code. Certain implementations may not support +// immediate cancellation. +// +// Certain implementations may not support immediate cancellation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - password: Password object. +// - callback (optional) will be called when the interaction completes. +func (interaction *TLSInteraction) AskPasswordAsync(ctx context.Context, password *TLSPassword, callback AsyncReadyCallback) { + var _arg0 *C.GTlsInteraction // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GTlsPassword // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_tls_interaction_ask_password_async(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(password) + runtime.KeepAlive(callback) +} + +// AskPasswordFinish: complete an ask password user interaction request. This +// should be once the g_tls_interaction_ask_password_async() completion callback +// is called. +// +// If G_TLS_INTERACTION_HANDLED is returned, then the Password passed to +// g_tls_interaction_ask_password() will have its password filled in. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains a +// G_IO_ERROR_CANCELLED error code. +// +// The function takes the following parameters: +// +// - result passed to the callback. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the ask password interaction. +func (interaction *TLSInteraction) AskPasswordFinish(result AsyncResulter) (TLSInteractionResult, error) { + var _arg0 *C.GTlsInteraction // out + var _arg1 *C.GAsyncResult // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_tls_interaction_ask_password_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(result) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// InvokeAskPassword: invoke the interaction to ask the user for a password. It +// invokes this interaction in the main loop, specifically the Context returned +// by g_main_context_get_thread_default() when the interaction is created. This +// is called by called by Connection or Database to ask the user for a password. +// +// Derived subclasses usually implement a password prompt, although they may +// also choose to provide a password from elsewhere. The password value will be +// filled in and then callback will be called. Alternatively the user may abort +// this password request, which will usually abort the TLS connection. +// +// The implementation can either be a synchronous (eg: modal dialog) or an +// asynchronous one (eg: modeless dialog). This function will take care of +// calling which ever one correctly. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains +// a G_IO_ERROR_CANCELLED error code. Certain implementations may not support +// immediate cancellation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - password: Password object. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the ask password interaction. +func (interaction *TLSInteraction) InvokeAskPassword(ctx context.Context, password *TLSPassword) (TLSInteractionResult, error) { + var _arg0 *C.GTlsInteraction // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GTlsPassword // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + + _cret = C.g_tls_interaction_invoke_ask_password(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(password) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// InvokeRequestCertificate: invoke the interaction to ask the user +// to choose a certificate to use with the connection. It invokes this +// interaction in the main loop, specifically the Context returned by +// g_main_context_get_thread_default() when the interaction is created. This is +// called by called by Connection when the peer requests a certificate during +// the handshake. +// +// Derived subclasses usually implement a certificate selector, although they +// may also choose to provide a certificate from elsewhere. Alternatively the +// user may abort this certificate request, which may or may not abort the TLS +// connection. +// +// The implementation can either be a synchronous (eg: modal dialog) or an +// asynchronous one (eg: modeless dialog). This function will take care of +// calling which ever one correctly. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains +// a G_IO_ERROR_CANCELLED error code. Certain implementations may not support +// immediate cancellation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - connection: Connection object. +// - flags providing more information about the request. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the certificate request interaction. +func (interaction *TLSInteraction) InvokeRequestCertificate(ctx context.Context, connection TLSConnectioner, flags TLSCertificateRequestFlags) (TLSInteractionResult, error) { + var _arg0 *C.GTlsInteraction // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GTlsConnection // out + var _arg2 C.GTlsCertificateRequestFlags // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = C.GTlsCertificateRequestFlags(flags) + + _cret = C.g_tls_interaction_invoke_request_certificate(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(flags) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// RequestCertificate: run synchronous interaction to ask the user +// to choose a certificate to use with the connection. In general, +// g_tls_interaction_invoke_request_certificate() should be used instead of this +// function. +// +// Derived subclasses usually implement a certificate selector, although they +// may also choose to provide a certificate from elsewhere. Alternatively the +// user may abort this certificate request, which will usually abort the TLS +// connection. +// +// If G_TLS_INTERACTION_HANDLED is returned, then the Connection +// passed to g_tls_interaction_request_certificate() will have had its +// Connection:certificate filled in. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains +// a G_IO_ERROR_CANCELLED error code. Certain implementations may not support +// immediate cancellation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - connection: Connection object. +// - flags providing more information about the request. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the request certificate interaction. +func (interaction *TLSInteraction) RequestCertificate(ctx context.Context, connection TLSConnectioner, flags TLSCertificateRequestFlags) (TLSInteractionResult, error) { + var _arg0 *C.GTlsInteraction // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GTlsConnection // out + var _arg2 C.GTlsCertificateRequestFlags // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = C.GTlsCertificateRequestFlags(flags) + + _cret = C.g_tls_interaction_request_certificate(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(flags) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// RequestCertificateAsync: run asynchronous interaction to ask the +// user for a certificate to use with the connection. In general, +// g_tls_interaction_invoke_request_certificate() should be used instead of this +// function. +// +// Derived subclasses usually implement a certificate selector, although they +// may also choose to provide a certificate from elsewhere. callback will be +// called when the operation completes. Alternatively the user may abort this +// certificate request, which will usually abort the TLS connection. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - connection: Connection object. +// - flags providing more information about the request. +// - callback (optional) will be called when the interaction completes. +func (interaction *TLSInteraction) RequestCertificateAsync(ctx context.Context, connection TLSConnectioner, flags TLSCertificateRequestFlags, callback AsyncReadyCallback) { + var _arg0 *C.GTlsInteraction // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GTlsConnection // out + var _arg2 C.GTlsCertificateRequestFlags // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = C.GTlsCertificateRequestFlags(flags) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.g_tls_interaction_request_certificate_async(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// RequestCertificateFinish: complete a request certificate +// user interaction request. This should be once the +// g_tls_interaction_request_certificate_async() completion callback is called. +// +// If G_TLS_INTERACTION_HANDLED is returned, then the Connection passed +// to g_tls_interaction_request_certificate_async() will have had its +// Connection:certificate filled in. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains a +// G_IO_ERROR_CANCELLED error code. +// +// The function takes the following parameters: +// +// - result passed to the callback. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the request certificate interaction. +func (interaction *TLSInteraction) RequestCertificateFinish(result AsyncResulter) (TLSInteractionResult, error) { + var _arg0 *C.GTlsInteraction // out + var _arg1 *C.GAsyncResult // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.g_tls_interaction_request_certificate_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(result) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// askPassword: run synchronous interaction to ask the user for a password. +// In general, g_tls_interaction_invoke_ask_password() should be used instead of +// this function. +// +// Derived subclasses usually implement a password prompt, although they may +// also choose to provide a password from elsewhere. The password value will be +// filled in and then callback will be called. Alternatively the user may abort +// this password request, which will usually abort the TLS connection. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains +// a G_IO_ERROR_CANCELLED error code. Certain implementations may not support +// immediate cancellation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - password: Password object. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the ask password interaction. +func (interaction *TLSInteraction) askPassword(ctx context.Context, password *TLSPassword) (TLSInteractionResult, error) { + gclass := (*C.GTlsInteractionClass)(coreglib.PeekParentClass(interaction)) + fnarg := gclass.ask_password + + var _arg0 *C.GTlsInteraction // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GTlsPassword // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + + _cret = C._gotk4_gio2_TLSInteraction_virtual_ask_password(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(password) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// askPasswordAsync: run asynchronous interaction to ask the user for a +// password. In general, g_tls_interaction_invoke_ask_password() should be used +// instead of this function. +// +// Derived subclasses usually implement a password prompt, although they may +// also choose to provide a password from elsewhere. The password value will be +// filled in and then callback will be called. Alternatively the user may abort +// this password request, which will usually abort the TLS connection. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains +// a G_IO_ERROR_CANCELLED error code. Certain implementations may not support +// immediate cancellation. +// +// Certain implementations may not support immediate cancellation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - password: Password object. +// - callback (optional) will be called when the interaction completes. +func (interaction *TLSInteraction) askPasswordAsync(ctx context.Context, password *TLSPassword, callback AsyncReadyCallback) { + gclass := (*C.GTlsInteractionClass)(coreglib.PeekParentClass(interaction)) + fnarg := gclass.ask_password_async + + var _arg0 *C.GTlsInteraction // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GTlsPassword // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_TLSInteraction_virtual_ask_password_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(password) + runtime.KeepAlive(callback) +} + +// askPasswordFinish: complete an ask password user interaction request. This +// should be once the g_tls_interaction_ask_password_async() completion callback +// is called. +// +// If G_TLS_INTERACTION_HANDLED is returned, then the Password passed to +// g_tls_interaction_ask_password() will have its password filled in. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains a +// G_IO_ERROR_CANCELLED error code. +// +// The function takes the following parameters: +// +// - result passed to the callback. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the ask password interaction. +func (interaction *TLSInteraction) askPasswordFinish(result AsyncResulter) (TLSInteractionResult, error) { + gclass := (*C.GTlsInteractionClass)(coreglib.PeekParentClass(interaction)) + fnarg := gclass.ask_password_finish + + var _arg0 *C.GTlsInteraction // out + var _arg1 *C.GAsyncResult // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_TLSInteraction_virtual_ask_password_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(result) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// requestCertificate: run synchronous interaction to ask the user +// to choose a certificate to use with the connection. In general, +// g_tls_interaction_invoke_request_certificate() should be used instead of this +// function. +// +// Derived subclasses usually implement a certificate selector, although they +// may also choose to provide a certificate from elsewhere. Alternatively the +// user may abort this certificate request, which will usually abort the TLS +// connection. +// +// If G_TLS_INTERACTION_HANDLED is returned, then the Connection +// passed to g_tls_interaction_request_certificate() will have had its +// Connection:certificate filled in. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains +// a G_IO_ERROR_CANCELLED error code. Certain implementations may not support +// immediate cancellation. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - connection: Connection object. +// - flags providing more information about the request. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the request certificate interaction. +func (interaction *TLSInteraction) requestCertificate(ctx context.Context, connection TLSConnectioner, flags TLSCertificateRequestFlags) (TLSInteractionResult, error) { + gclass := (*C.GTlsInteractionClass)(coreglib.PeekParentClass(interaction)) + fnarg := gclass.request_certificate + + var _arg0 *C.GTlsInteraction // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GTlsConnection // out + var _arg2 C.GTlsCertificateRequestFlags // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = C.GTlsCertificateRequestFlags(flags) + + _cret = C._gotk4_gio2_TLSInteraction_virtual_request_certificate(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(flags) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// requestCertificateAsync: run asynchronous interaction to ask the +// user for a certificate to use with the connection. In general, +// g_tls_interaction_invoke_request_certificate() should be used instead of this +// function. +// +// Derived subclasses usually implement a certificate selector, although they +// may also choose to provide a certificate from elsewhere. callback will be +// called when the operation completes. Alternatively the user may abort this +// certificate request, which will usually abort the TLS connection. +// +// The function takes the following parameters: +// +// - ctx (optional): optional #GCancellable cancellation object. +// - connection: Connection object. +// - flags providing more information about the request. +// - callback (optional) will be called when the interaction completes. +func (interaction *TLSInteraction) requestCertificateAsync(ctx context.Context, connection TLSConnectioner, flags TLSCertificateRequestFlags, callback AsyncReadyCallback) { + gclass := (*C.GTlsInteractionClass)(coreglib.PeekParentClass(interaction)) + fnarg := gclass.request_certificate_async + + var _arg0 *C.GTlsInteraction // out + var _arg3 *C.GCancellable // out + var _arg1 *C.GTlsConnection // out + var _arg2 C.GTlsCertificateRequestFlags // out + var _arg4 C.GAsyncReadyCallback // out + var _arg5 C.gpointer + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg3 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.GTlsConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) + _arg2 = C.GTlsCertificateRequestFlags(flags) + if callback != nil { + _arg4 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg5 = C.gpointer(gbox.AssignOnce(callback)) + } + + C._gotk4_gio2_TLSInteraction_virtual_request_certificate_async(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(interaction) + runtime.KeepAlive(ctx) + runtime.KeepAlive(connection) + runtime.KeepAlive(flags) + runtime.KeepAlive(callback) +} + +// requestCertificateFinish: complete a request certificate +// user interaction request. This should be once the +// g_tls_interaction_request_certificate_async() completion callback is called. +// +// If G_TLS_INTERACTION_HANDLED is returned, then the Connection passed +// to g_tls_interaction_request_certificate_async() will have had its +// Connection:certificate filled in. +// +// If the interaction is cancelled by the cancellation object, or by the user +// then G_TLS_INTERACTION_FAILED will be returned with an error that contains a +// G_IO_ERROR_CANCELLED error code. +// +// The function takes the following parameters: +// +// - result passed to the callback. +// +// The function returns the following values: +// +// - tlsInteractionResult status of the request certificate interaction. +func (interaction *TLSInteraction) requestCertificateFinish(result AsyncResulter) (TLSInteractionResult, error) { + gclass := (*C.GTlsInteractionClass)(coreglib.PeekParentClass(interaction)) + fnarg := gclass.request_certificate_finish + + var _arg0 *C.GTlsInteraction // out + var _arg1 *C.GAsyncResult // out + var _cret C.GTlsInteractionResult // in + var _cerr *C.GError // in + + _arg0 = (*C.GTlsInteraction)(unsafe.Pointer(coreglib.InternObject(interaction).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C._gotk4_gio2_TLSInteraction_virtual_request_certificate_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(interaction) + runtime.KeepAlive(result) + + var _tlsInteractionResult TLSInteractionResult // out + var _goerr error // out + + _tlsInteractionResult = TLSInteractionResult(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _tlsInteractionResult, _goerr +} + +// TLSPasswordOverrides contains methods that are overridable. +type TLSPasswordOverrides struct { + // DefaultWarning: virtual method for g_tls_password_get_warning() if no + // value has been set using g_tls_password_set_warning(). + DefaultWarning func() string + // Value: get the password value. If length is not NULL then it will be + // filled in with the length of the password value. (Note that the password + // value is not nul-terminated, so you can only pass NULL for length in + // contexts where you know the password will have a certain fixed length.). + // + // The function returns the following values: + // + // - guint8s: password value (owned by the password object). + Value func() []byte +} + +func defaultTLSPasswordOverrides(v *TLSPassword) TLSPasswordOverrides { + return TLSPasswordOverrides{ + DefaultWarning: v.defaultWarning, + Value: v.value, + } +} + +// TLSPassword: abstract interface representing a password used in TLS. Often +// used in user interaction such as unlocking a key storage token. +type TLSPassword struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*TLSPassword)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*TLSPassword, *TLSPasswordClass, TLSPasswordOverrides]( + GTypeTLSPassword, + initTLSPasswordClass, + wrapTLSPassword, + defaultTLSPasswordOverrides, + ) +} + +func initTLSPasswordClass(gclass unsafe.Pointer, overrides TLSPasswordOverrides, classInitFunc func(*TLSPasswordClass)) { + pclass := (*C.GTlsPasswordClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeTLSPassword)))) + + if overrides.DefaultWarning != nil { + pclass.get_default_warning = (*[0]byte)(C._gotk4_gio2_TlsPasswordClass_get_default_warning) + } + + if overrides.Value != nil { + pclass.get_value = (*[0]byte)(C._gotk4_gio2_TlsPasswordClass_get_value) + } + + if classInitFunc != nil { + class := (*TLSPasswordClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapTLSPassword(obj *coreglib.Object) *TLSPassword { + return &TLSPassword{ + Object: obj, + } +} + +func marshalTLSPassword(p uintptr) (interface{}, error) { + return wrapTLSPassword(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewTLSPassword: create a new Password object. +// +// The function takes the following parameters: +// +// - flags: password flags. +// - description of what the password is for. +// +// The function returns the following values: +// +// - tlsPassword: newly allocated password object. +func NewTLSPassword(flags TLSPasswordFlags, description string) *TLSPassword { + var _arg1 C.GTlsPasswordFlags // out + var _arg2 *C.gchar // out + var _cret *C.GTlsPassword // in + + _arg1 = C.GTlsPasswordFlags(flags) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(description))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_tls_password_new(_arg1, _arg2) + runtime.KeepAlive(flags) + runtime.KeepAlive(description) + + var _tlsPassword *TLSPassword // out + + _tlsPassword = wrapTLSPassword(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _tlsPassword +} + +// Description: get a description string about what the password will be used +// for. +// +// The function returns the following values: +// +// - utf8: description of the password. +func (password *TLSPassword) Description() string { + var _arg0 *C.GTlsPassword // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + + _cret = C.g_tls_password_get_description(_arg0) + runtime.KeepAlive(password) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Flags: get flags about the password. +// +// The function returns the following values: +// +// - tlsPasswordFlags flags about the password. +func (password *TLSPassword) Flags() TLSPasswordFlags { + var _arg0 *C.GTlsPassword // out + var _cret C.GTlsPasswordFlags // in + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + + _cret = C.g_tls_password_get_flags(_arg0) + runtime.KeepAlive(password) + + var _tlsPasswordFlags TLSPasswordFlags // out + + _tlsPasswordFlags = TLSPasswordFlags(_cret) + + return _tlsPasswordFlags +} + +// Value: get the password value. If length is not NULL then it will be filled +// in with the length of the password value. (Note that the password value is +// not nul-terminated, so you can only pass NULL for length in contexts where +// you know the password will have a certain fixed length.). +// +// The function returns the following values: +// +// - guint8s: password value (owned by the password object). +func (password *TLSPassword) Value() []byte { + var _arg0 *C.GTlsPassword // out + var _cret *C.guchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + + _cret = C.g_tls_password_get_value(_arg0, &_arg1) + runtime.KeepAlive(password) + + var _guint8s []byte // out + + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) + + return _guint8s +} + +// Warning: get a user readable translated warning. Usually this +// warning is a representation of the password flags returned from +// g_tls_password_get_flags(). +// +// The function returns the following values: +// +// - utf8: warning. +func (password *TLSPassword) Warning() string { + var _arg0 *C.GTlsPassword // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + + _cret = C.g_tls_password_get_warning(_arg0) + runtime.KeepAlive(password) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// SetDescription: set a description string about what the password will be used +// for. +// +// The function takes the following parameters: +// +// - description of the password. +func (password *TLSPassword) SetDescription(description string) { + var _arg0 *C.GTlsPassword // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(description))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_tls_password_set_description(_arg0, _arg1) + runtime.KeepAlive(password) + runtime.KeepAlive(description) +} + +// SetFlags: set flags about the password. +// +// The function takes the following parameters: +// +// - flags about the password. +func (password *TLSPassword) SetFlags(flags TLSPasswordFlags) { + var _arg0 *C.GTlsPassword // out + var _arg1 C.GTlsPasswordFlags // out + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + _arg1 = C.GTlsPasswordFlags(flags) + + C.g_tls_password_set_flags(_arg0, _arg1) + runtime.KeepAlive(password) + runtime.KeepAlive(flags) +} + +// SetValue: set the value for this password. The value will be copied by the +// password object. +// +// Specify the length, for a non-nul-terminated password. Pass -1 as length if +// using a nul-terminated password, and length will be calculated automatically. +// (Note that the terminating nul is not considered part of the password in this +// case.). +// +// The function takes the following parameters: +// +// - value: new password value. +func (password *TLSPassword) SetValue(value []byte) { + var _arg0 *C.GTlsPassword // out + var _arg1 *C.guchar // out + var _arg2 C.gssize + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + _arg2 = (C.gssize)(len(value)) + if len(value) > 0 { + _arg1 = (*C.guchar)(unsafe.Pointer(&value[0])) + } + + C.g_tls_password_set_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(password) + runtime.KeepAlive(value) +} + +// SetWarning: set a user readable translated warning. Usually this +// warning is a representation of the password flags returned from +// g_tls_password_get_flags(). +// +// The function takes the following parameters: +// +// - warning: user readable warning. +func (password *TLSPassword) SetWarning(warning string) { + var _arg0 *C.GTlsPassword // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(warning))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_tls_password_set_warning(_arg0, _arg1) + runtime.KeepAlive(password) + runtime.KeepAlive(warning) +} + +// defaultWarning: virtual method for g_tls_password_get_warning() if no value +// has been set using g_tls_password_set_warning(). +func (password *TLSPassword) defaultWarning() string { + gclass := (*C.GTlsPasswordClass)(coreglib.PeekParentClass(password)) + fnarg := gclass.get_default_warning + + var _arg0 *C.GTlsPassword // out + var _cret *C.gchar // in + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + + _cret = C._gotk4_gio2_TLSPassword_virtual_get_default_warning(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(password) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Value: get the password value. If length is not NULL then it will be filled +// in with the length of the password value. (Note that the password value is +// not nul-terminated, so you can only pass NULL for length in contexts where +// you know the password will have a certain fixed length.). +// +// The function returns the following values: +// +// - guint8s: password value (owned by the password object). +func (password *TLSPassword) value() []byte { + gclass := (*C.GTlsPasswordClass)(coreglib.PeekParentClass(password)) + fnarg := gclass.get_value + + var _arg0 *C.GTlsPassword // out + var _cret *C.guchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) + + _cret = C._gotk4_gio2_TLSPassword_virtual_get_value(unsafe.Pointer(fnarg), _arg0, &_arg1) + runtime.KeepAlive(password) + + var _guint8s []byte // out + + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) + + return _guint8s +} + +// VFSOverrides contains methods that are overridable. +type VFSOverrides struct { + AddWritableNamespaces func(list *FileAttributeInfoList) + // FileForPath gets a #GFile for path. + // + // The function takes the following parameters: + // + // - path: string containing a VFS path. + // + // The function returns the following values: + // + // - file: #GFile. Free the returned object with g_object_unref(). + FileForPath func(path string) *File + // FileForURI gets a #GFile for uri. + // + // This operation never fails, but the returned object might not support + // any I/O operation if the URI is malformed or if the URI scheme is not + // supported. + // + // The function takes the following parameters: + // + // - uri: string containing a URI. + // + // The function returns the following values: + // + // - file: #GFile. Free the returned object with g_object_unref(). + FileForURI func(uri string) *File + // SupportedURISchemes gets a list of URI schemes supported by vfs. + // + // The function returns the following values: + // + // - utf8s: NULL-terminated array of strings. The returned array belongs + // to GIO and must not be freed or modified. + SupportedURISchemes func() []string + // IsActive checks if the VFS is active. + // + // The function returns the following values: + // + // - ok: TRUE if construction of the vfs was successful and it is now + // active. + IsActive func() bool + // The function takes the following parameters: + // + // - source + // - dest + LocalFileMoved func(source, dest string) + LocalFileRemoved func(filename string) + // The function takes the following parameters: + // + // - ctx (optional) + // - filename + // - info + // - flags + LocalFileSetAttributes func(ctx context.Context, filename string, info *FileInfo, flags FileQueryInfoFlags) error + // ParseName: this operation never fails, but the returned object might + // not support any I/O operations if the parse_name cannot be parsed by the + // #GVfs module. + // + // The function takes the following parameters: + // + // - parseName: string to be parsed by the VFS module. + // + // The function returns the following values: + // + // - file for the given parse_name. Free the returned object with + // g_object_unref(). + ParseName func(parseName string) *File +} + +func defaultVFSOverrides(v *VFS) VFSOverrides { + return VFSOverrides{ + AddWritableNamespaces: v.addWritableNamespaces, + FileForPath: v.fileForPath, + FileForURI: v.fileForURI, + SupportedURISchemes: v.supportedURISchemes, + IsActive: v.isActive, + LocalFileMoved: v.localFileMoved, + LocalFileRemoved: v.localFileRemoved, + LocalFileSetAttributes: v.localFileSetAttributes, + ParseName: v.parseName, + } +} + +// VFS: entry point for using GIO functionality. +type VFS struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*VFS)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*VFS, *VFSClass, VFSOverrides]( + GTypeVFS, + initVFSClass, + wrapVFS, + defaultVFSOverrides, + ) +} + +func initVFSClass(gclass unsafe.Pointer, overrides VFSOverrides, classInitFunc func(*VFSClass)) { + pclass := (*C.GVfsClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeVFS)))) + + if overrides.AddWritableNamespaces != nil { + pclass.add_writable_namespaces = (*[0]byte)(C._gotk4_gio2_VfsClass_add_writable_namespaces) + } + + if overrides.FileForPath != nil { + pclass.get_file_for_path = (*[0]byte)(C._gotk4_gio2_VfsClass_get_file_for_path) + } + + if overrides.FileForURI != nil { + pclass.get_file_for_uri = (*[0]byte)(C._gotk4_gio2_VfsClass_get_file_for_uri) + } + + if overrides.SupportedURISchemes != nil { + pclass.get_supported_uri_schemes = (*[0]byte)(C._gotk4_gio2_VfsClass_get_supported_uri_schemes) + } + + if overrides.IsActive != nil { + pclass.is_active = (*[0]byte)(C._gotk4_gio2_VfsClass_is_active) + } + + if overrides.LocalFileMoved != nil { + pclass.local_file_moved = (*[0]byte)(C._gotk4_gio2_VfsClass_local_file_moved) + } + + if overrides.LocalFileRemoved != nil { + pclass.local_file_removed = (*[0]byte)(C._gotk4_gio2_VfsClass_local_file_removed) + } + + if overrides.LocalFileSetAttributes != nil { + pclass.local_file_set_attributes = (*[0]byte)(C._gotk4_gio2_VfsClass_local_file_set_attributes) + } + + if overrides.ParseName != nil { + pclass.parse_name = (*[0]byte)(C._gotk4_gio2_VfsClass_parse_name) + } + + if classInitFunc != nil { + class := (*VFSClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapVFS(obj *coreglib.Object) *VFS { + return &VFS{ + Object: obj, + } +} + +func marshalVFS(p uintptr) (interface{}, error) { + return wrapVFS(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// FileForPath gets a #GFile for path. +// +// The function takes the following parameters: +// +// - path: string containing a VFS path. +// +// The function returns the following values: +// +// - file: #GFile. Free the returned object with g_object_unref(). +func (vfs *VFS) FileForPath(path string) *File { + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_vfs_get_file_for_path(_arg0, _arg1) + runtime.KeepAlive(vfs) + runtime.KeepAlive(path) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// FileForURI gets a #GFile for uri. +// +// This operation never fails, but the returned object might not support any I/O +// operation if the URI is malformed or if the URI scheme is not supported. +// +// The function takes the following parameters: +// +// - uri: string containing a URI. +// +// The function returns the following values: +// +// - file: #GFile. Free the returned object with g_object_unref(). +func (vfs *VFS) FileForURI(uri string) *File { + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_vfs_get_file_for_uri(_arg0, _arg1) + runtime.KeepAlive(vfs) + runtime.KeepAlive(uri) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// SupportedURISchemes gets a list of URI schemes supported by vfs. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of strings. The returned array belongs to +// GIO and must not be freed or modified. +func (vfs *VFS) SupportedURISchemes() []string { + var _arg0 *C.GVfs // out + var _cret **C.gchar // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + + _cret = C.g_vfs_get_supported_uri_schemes(_arg0) + runtime.KeepAlive(vfs) + + var _utf8s []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// IsActive checks if the VFS is active. +// +// The function returns the following values: +// +// - ok: TRUE if construction of the vfs was successful and it is now active. +func (vfs *VFS) IsActive() bool { + var _arg0 *C.GVfs // out + var _cret C.gboolean // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + + _cret = C.g_vfs_is_active(_arg0) + runtime.KeepAlive(vfs) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ParseName: this operation never fails, but the returned object might not +// support any I/O operations if the parse_name cannot be parsed by the #GVfs +// module. +// +// The function takes the following parameters: +// +// - parseName: string to be parsed by the VFS module. +// +// The function returns the following values: +// +// - file for the given parse_name. Free the returned object with +// g_object_unref(). +func (vfs *VFS) ParseName(parseName string) *File { + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(parseName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_vfs_parse_name(_arg0, _arg1) + runtime.KeepAlive(vfs) + runtime.KeepAlive(parseName) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// RegisterURIScheme registers uri_func and parse_name_func as the #GFile URI +// and parse name lookup functions for URIs with a scheme matching scheme. Note +// that scheme is registered only within the running application, as opposed to +// desktop-wide as it happens with GVfs backends. +// +// When a #GFile is requested with an URI containing scheme (e.g. through +// g_file_new_for_uri()), uri_func will be called to allow a custom constructor. +// The implementation of uri_func should not be blocking, and must not call +// g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme(). +// +// When g_file_parse_name() is called with a parse name obtained from such file, +// parse_name_func will be called to allow the #GFile to be created again. +// In that case, it's responsibility of parse_name_func to make sure the +// parse name matches what the custom #GFile implementation returned when +// g_file_get_parse_name() was previously called. The implementation +// of parse_name_func should not be blocking, and must not call +// g_vfs_register_uri_scheme() or g_vfs_unregister_uri_scheme(). +// +// It's an error to call this function twice with the same scheme. To unregister +// a custom URI scheme, use g_vfs_unregister_uri_scheme(). +// +// The function takes the following parameters: +// +// - scheme: URI scheme, e.g. "http". +// - uriFunc (optional): FileLookupFunc. +// - parseNameFunc (optional): FileLookupFunc. +// +// The function returns the following values: +// +// - ok: TRUE if scheme was successfully registered, or FALSE if a handler for +// scheme already exists. +func (vfs *VFS) RegisterURIScheme(scheme string, uriFunc, parseNameFunc VFSFileLookupFunc) bool { + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + var _arg2 C.GVfsFileLookupFunc // out + var _arg3 C.gpointer + var _arg4 C.GDestroyNotify + var _arg5 C.GVfsFileLookupFunc // out + var _arg6 C.gpointer + var _arg7 C.GDestroyNotify + var _cret C.gboolean // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(scheme))) + defer C.free(unsafe.Pointer(_arg1)) + if uriFunc != nil { + _arg2 = (*[0]byte)(C._gotk4_gio2_VFSFileLookupFunc) + _arg3 = C.gpointer(gbox.Assign(uriFunc)) + _arg4 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + } + if parseNameFunc != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_VFSFileLookupFunc) + _arg6 = C.gpointer(gbox.Assign(parseNameFunc)) + _arg7 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + } + + _cret = C.g_vfs_register_uri_scheme(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(vfs) + runtime.KeepAlive(scheme) + runtime.KeepAlive(uriFunc) + runtime.KeepAlive(parseNameFunc) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnregisterURIScheme unregisters the URI handler for scheme previously +// registered with g_vfs_register_uri_scheme(). +// +// The function takes the following parameters: +// +// - scheme: URI scheme, e.g. "http". +// +// The function returns the following values: +// +// - ok: TRUE if scheme was successfully unregistered, or FALSE if a handler +// for scheme does not exist. +func (vfs *VFS) UnregisterURIScheme(scheme string) bool { + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(scheme))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_vfs_unregister_uri_scheme(_arg0, _arg1) + runtime.KeepAlive(vfs) + runtime.KeepAlive(scheme) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +func (vfs *VFS) addWritableNamespaces(list *FileAttributeInfoList) { + gclass := (*C.GVfsClass)(coreglib.PeekParentClass(vfs)) + fnarg := gclass.add_writable_namespaces + + var _arg0 *C.GVfs // out + var _arg1 *C.GFileAttributeInfoList // out + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.GFileAttributeInfoList)(gextras.StructNative(unsafe.Pointer(list))) + + C._gotk4_gio2_VFS_virtual_add_writable_namespaces(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(vfs) + runtime.KeepAlive(list) +} + +// fileForPath gets a #GFile for path. +// +// The function takes the following parameters: +// +// - path: string containing a VFS path. +// +// The function returns the following values: +// +// - file: #GFile. Free the returned object with g_object_unref(). +func (vfs *VFS) fileForPath(path string) *File { + gclass := (*C.GVfsClass)(coreglib.PeekParentClass(vfs)) + fnarg := gclass.get_file_for_path + + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_VFS_virtual_get_file_for_path(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(vfs) + runtime.KeepAlive(path) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// fileForURI gets a #GFile for uri. +// +// This operation never fails, but the returned object might not support any I/O +// operation if the URI is malformed or if the URI scheme is not supported. +// +// The function takes the following parameters: +// +// - uri: string containing a URI. +// +// The function returns the following values: +// +// - file: #GFile. Free the returned object with g_object_unref(). +func (vfs *VFS) fileForURI(uri string) *File { + gclass := (*C.GVfsClass)(coreglib.PeekParentClass(vfs)) + fnarg := gclass.get_file_for_uri + + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_VFS_virtual_get_file_for_uri(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(vfs) + runtime.KeepAlive(uri) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// supportedURISchemes gets a list of URI schemes supported by vfs. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of strings. The returned array belongs to +// GIO and must not be freed or modified. +func (vfs *VFS) supportedURISchemes() []string { + gclass := (*C.GVfsClass)(coreglib.PeekParentClass(vfs)) + fnarg := gclass.get_supported_uri_schemes + + var _arg0 *C.GVfs // out + var _cret **C.gchar // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + + _cret = C._gotk4_gio2_VFS_virtual_get_supported_uri_schemes(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(vfs) + + var _utf8s []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// isActive checks if the VFS is active. +// +// The function returns the following values: +// +// - ok: TRUE if construction of the vfs was successful and it is now active. +func (vfs *VFS) isActive() bool { + gclass := (*C.GVfsClass)(coreglib.PeekParentClass(vfs)) + fnarg := gclass.is_active + + var _arg0 *C.GVfs // out + var _cret C.gboolean // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + + _cret = C._gotk4_gio2_VFS_virtual_is_active(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(vfs) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// The function takes the following parameters: +// +// - source +// - dest +func (vfs *VFS) localFileMoved(source, dest string) { + gclass := (*C.GVfsClass)(coreglib.PeekParentClass(vfs)) + fnarg := gclass.local_file_moved + + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + var _arg2 *C.char // out + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(source))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(dest))) + defer C.free(unsafe.Pointer(_arg2)) + + C._gotk4_gio2_VFS_virtual_local_file_moved(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(vfs) + runtime.KeepAlive(source) + runtime.KeepAlive(dest) +} + +func (vfs *VFS) localFileRemoved(filename string) { + gclass := (*C.GVfsClass)(coreglib.PeekParentClass(vfs)) + fnarg := gclass.local_file_removed + + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gio2_VFS_virtual_local_file_removed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(vfs) + runtime.KeepAlive(filename) +} + +// The function takes the following parameters: +// +// - ctx (optional) +// - filename +// - info +// - flags +func (vfs *VFS) localFileSetAttributes(ctx context.Context, filename string, info *FileInfo, flags FileQueryInfoFlags) error { + gclass := (*C.GVfsClass)(coreglib.PeekParentClass(vfs)) + fnarg := gclass.local_file_set_attributes + + var _arg0 *C.GVfs // out + var _arg4 *C.GCancellable // out + var _arg1 *C.char // out + var _arg2 *C.GFileInfo // out + var _arg3 C.GFileQueryInfoFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(info).Native())) + _arg3 = C.GFileQueryInfoFlags(flags) + + C._gotk4_gio2_VFS_virtual_local_file_set_attributes(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(vfs) + runtime.KeepAlive(ctx) + runtime.KeepAlive(filename) + runtime.KeepAlive(info) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// parseName: this operation never fails, but the returned object might not +// support any I/O operations if the parse_name cannot be parsed by the #GVfs +// module. +// +// The function takes the following parameters: +// +// - parseName: string to be parsed by the VFS module. +// +// The function returns the following values: +// +// - file for the given parse_name. Free the returned object with +// g_object_unref(). +func (vfs *VFS) parseName(parseName string) *File { + gclass := (*C.GVfsClass)(coreglib.PeekParentClass(vfs)) + fnarg := gclass.parse_name + + var _arg0 *C.GVfs // out + var _arg1 *C.char // out + var _cret *C.GFile // in + + _arg0 = (*C.GVfs)(unsafe.Pointer(coreglib.InternObject(vfs).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(parseName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_VFS_virtual_parse_name(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(vfs) + runtime.KeepAlive(parseName) + + var _file *File // out + + _file = wrapFile(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _file +} + +// VFSGetDefault gets the default #GVfs for the system. +// +// The function returns the following values: +// +// - vfs which will be the local file system #GVfs if no other implementation +// is available. +func VFSGetDefault() *VFS { + var _cret *C.GVfs // in + + _cret = C.g_vfs_get_default() + + var _vfs *VFS // out + + _vfs = wrapVFS(coreglib.Take(unsafe.Pointer(_cret))) + + return _vfs +} + +// VFSGetLocal gets the local #GVfs for the system. +// +// The function returns the following values: +// +// - vfs: #GVfs. +func VFSGetLocal() *VFS { + var _cret *C.GVfs // in + + _cret = C.g_vfs_get_local() + + var _vfs *VFS // out + + _vfs = wrapVFS(coreglib.Take(unsafe.Pointer(_cret))) + + return _vfs +} + +// VolumeMonitorOverrides contains methods that are overridable. +type VolumeMonitorOverrides struct { + DriveChanged func(drive Driver) + DriveConnected func(drive Driver) + DriveDisconnected func(drive Driver) + DriveEjectButton func(drive Driver) + DriveStopButton func(drive Driver) + // ConnectedDrives gets a list of drives connected to the system. + // + // The returned list should be freed with g_list_free(), after its elements + // have been unreffed with g_object_unref(). + // + // The function returns the following values: + // + // - list of connected #GDrive objects. + ConnectedDrives func() []*Drive + // MountForUUID finds a #GMount object by its UUID (see g_mount_get_uuid()). + // + // The function takes the following parameters: + // + // - uuid: UUID to look for. + // + // The function returns the following values: + // + // - mount (optional) or NULL if no such mount is available. Free the + // returned object with g_object_unref(). + MountForUUID func(uuid string) *Mount + // Mounts gets a list of the mounts on the system. + // + // The returned list should be freed with g_list_free(), after its elements + // have been unreffed with g_object_unref(). + // + // The function returns the following values: + // + // - list of #GMount objects. + Mounts func() []*Mount + // VolumeForUUID finds a #GVolume object by its UUID (see + // g_volume_get_uuid()). + // + // The function takes the following parameters: + // + // - uuid: UUID to look for. + // + // The function returns the following values: + // + // - volume (optional) or NULL if no such volume is available. Free the + // returned object with g_object_unref(). + VolumeForUUID func(uuid string) *Volume + // Volumes gets a list of the volumes on the system. + // + // The returned list should be freed with g_list_free(), after its elements + // have been unreffed with g_object_unref(). + // + // The function returns the following values: + // + // - list of #GVolume objects. + Volumes func() []*Volume + MountAdded func(mount Mounter) + MountChanged func(mount Mounter) + MountPreUnmount func(mount Mounter) + MountRemoved func(mount Mounter) + VolumeAdded func(volume Volumer) + VolumeChanged func(volume Volumer) + VolumeRemoved func(volume Volumer) +} + +func defaultVolumeMonitorOverrides(v *VolumeMonitor) VolumeMonitorOverrides { + return VolumeMonitorOverrides{ + DriveChanged: v.driveChanged, + DriveConnected: v.driveConnected, + DriveDisconnected: v.driveDisconnected, + DriveEjectButton: v.driveEjectButton, + DriveStopButton: v.driveStopButton, + ConnectedDrives: v.connectedDrives, + MountForUUID: v.mountForUUID, + Mounts: v.mounts, + VolumeForUUID: v.volumeForUUID, + Volumes: v.volumes, + MountAdded: v.mountAdded, + MountChanged: v.mountChanged, + MountPreUnmount: v.mountPreUnmount, + MountRemoved: v.mountRemoved, + VolumeAdded: v.volumeAdded, + VolumeChanged: v.volumeChanged, + VolumeRemoved: v.volumeRemoved, + } +} + +// VolumeMonitor: GVolumeMonitor is for listing the user interesting devices and +// volumes on the computer. In other words, what a file selector or file manager +// would show in a sidebar. +// +// GVolumeMonitor is not thread-default-context aware (see +// glib.MainContext.PushThreadDefault()), and so should not be used other than +// from the main thread, with no thread-default-context active. +// +// In order to receive updates about volumes and mounts monitored through GVFS, +// a main loop must be running. +type VolumeMonitor struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*VolumeMonitor)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*VolumeMonitor, *VolumeMonitorClass, VolumeMonitorOverrides]( + GTypeVolumeMonitor, + initVolumeMonitorClass, + wrapVolumeMonitor, + defaultVolumeMonitorOverrides, + ) +} + +func initVolumeMonitorClass(gclass unsafe.Pointer, overrides VolumeMonitorOverrides, classInitFunc func(*VolumeMonitorClass)) { + pclass := (*C.GVolumeMonitorClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeVolumeMonitor)))) + + if overrides.DriveChanged != nil { + pclass.drive_changed = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_drive_changed) + } + + if overrides.DriveConnected != nil { + pclass.drive_connected = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_drive_connected) + } + + if overrides.DriveDisconnected != nil { + pclass.drive_disconnected = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_drive_disconnected) + } + + if overrides.DriveEjectButton != nil { + pclass.drive_eject_button = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_drive_eject_button) + } + + if overrides.DriveStopButton != nil { + pclass.drive_stop_button = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_drive_stop_button) + } + + if overrides.ConnectedDrives != nil { + pclass.get_connected_drives = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_get_connected_drives) + } + + if overrides.MountForUUID != nil { + pclass.get_mount_for_uuid = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_get_mount_for_uuid) + } + + if overrides.Mounts != nil { + pclass.get_mounts = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_get_mounts) + } + + if overrides.VolumeForUUID != nil { + pclass.get_volume_for_uuid = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_get_volume_for_uuid) + } + + if overrides.Volumes != nil { + pclass.get_volumes = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_get_volumes) + } + + if overrides.MountAdded != nil { + pclass.mount_added = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_mount_added) + } + + if overrides.MountChanged != nil { + pclass.mount_changed = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_mount_changed) + } + + if overrides.MountPreUnmount != nil { + pclass.mount_pre_unmount = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_mount_pre_unmount) + } + + if overrides.MountRemoved != nil { + pclass.mount_removed = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_mount_removed) + } + + if overrides.VolumeAdded != nil { + pclass.volume_added = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_volume_added) + } + + if overrides.VolumeChanged != nil { + pclass.volume_changed = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_volume_changed) + } + + if overrides.VolumeRemoved != nil { + pclass.volume_removed = (*[0]byte)(C._gotk4_gio2_VolumeMonitorClass_volume_removed) + } + + if classInitFunc != nil { + class := (*VolumeMonitorClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapVolumeMonitor(obj *coreglib.Object) *VolumeMonitor { + return &VolumeMonitor{ + Object: obj, + } +} + +func marshalVolumeMonitor(p uintptr) (interface{}, error) { + return wrapVolumeMonitor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectDriveChanged is emitted when a drive changes. +func (volumeMonitor *VolumeMonitor) ConnectDriveChanged(f func(drive Driver)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "drive-changed", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectDriveChanged), f) +} + +// ConnectDriveConnected is emitted when a drive is connected to the system. +func (volumeMonitor *VolumeMonitor) ConnectDriveConnected(f func(drive Driver)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "drive-connected", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectDriveConnected), f) +} + +// ConnectDriveDisconnected is emitted when a drive is disconnected from the +// system. +func (volumeMonitor *VolumeMonitor) ConnectDriveDisconnected(f func(drive Driver)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "drive-disconnected", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectDriveDisconnected), f) +} + +// ConnectDriveEjectButton is emitted when the eject button is pressed on drive. +func (volumeMonitor *VolumeMonitor) ConnectDriveEjectButton(f func(drive Driver)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "drive-eject-button", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectDriveEjectButton), f) +} + +// ConnectDriveStopButton is emitted when the stop button is pressed on drive. +func (volumeMonitor *VolumeMonitor) ConnectDriveStopButton(f func(drive Driver)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "drive-stop-button", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectDriveStopButton), f) +} + +// ConnectMountAdded is emitted when a mount is added. +func (volumeMonitor *VolumeMonitor) ConnectMountAdded(f func(mount Mounter)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "mount-added", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectMountAdded), f) +} + +// ConnectMountChanged is emitted when a mount changes. +func (volumeMonitor *VolumeMonitor) ConnectMountChanged(f func(mount Mounter)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "mount-changed", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectMountChanged), f) +} + +// ConnectMountPreUnmount: may be emitted when a mount is about to be removed. +// +// This signal depends on the backend and is only emitted if GIO was used to +// unmount. +func (volumeMonitor *VolumeMonitor) ConnectMountPreUnmount(f func(mount Mounter)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "mount-pre-unmount", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectMountPreUnmount), f) +} + +// ConnectMountRemoved is emitted when a mount is removed. +func (volumeMonitor *VolumeMonitor) ConnectMountRemoved(f func(mount Mounter)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "mount-removed", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectMountRemoved), f) +} + +// ConnectVolumeAdded is emitted when a mountable volume is added to the system. +func (volumeMonitor *VolumeMonitor) ConnectVolumeAdded(f func(volume Volumer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "volume-added", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectVolumeAdded), f) +} + +// ConnectVolumeChanged is emitted when mountable volume is changed. +func (volumeMonitor *VolumeMonitor) ConnectVolumeChanged(f func(volume Volumer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "volume-changed", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectVolumeChanged), f) +} + +// ConnectVolumeRemoved is emitted when a mountable volume is removed from the +// system. +func (volumeMonitor *VolumeMonitor) ConnectVolumeRemoved(f func(volume Volumer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(volumeMonitor, "volume-removed", false, unsafe.Pointer(C._gotk4_gio2_VolumeMonitor_ConnectVolumeRemoved), f) +} + +// ConnectedDrives gets a list of drives connected to the system. +// +// The returned list should be freed with g_list_free(), after its elements have +// been unreffed with g_object_unref(). +// +// The function returns the following values: +// +// - list of connected #GDrive objects. +func (volumeMonitor *VolumeMonitor) ConnectedDrives() []*Drive { + var _arg0 *C.GVolumeMonitor // out + var _cret *C.GList // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + + _cret = C.g_volume_monitor_get_connected_drives(_arg0) + runtime.KeepAlive(volumeMonitor) + + var _list []*Drive // out + + _list = make([]*Drive, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GDrive)(v) + var dst *Drive // out + dst = wrapDrive(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// MountForUUID finds a #GMount object by its UUID (see g_mount_get_uuid()). +// +// The function takes the following parameters: +// +// - uuid: UUID to look for. +// +// The function returns the following values: +// +// - mount (optional) or NULL if no such mount is available. Free the returned +// object with g_object_unref(). +func (volumeMonitor *VolumeMonitor) MountForUUID(uuid string) *Mount { + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.char // out + var _cret *C.GMount // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uuid))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_volume_monitor_get_mount_for_uuid(_arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(uuid) + + var _mount *Mount // out + + if _cret != nil { + _mount = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _mount +} + +// Mounts gets a list of the mounts on the system. +// +// The returned list should be freed with g_list_free(), after its elements have +// been unreffed with g_object_unref(). +// +// The function returns the following values: +// +// - list of #GMount objects. +func (volumeMonitor *VolumeMonitor) Mounts() []*Mount { + var _arg0 *C.GVolumeMonitor // out + var _cret *C.GList // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + + _cret = C.g_volume_monitor_get_mounts(_arg0) + runtime.KeepAlive(volumeMonitor) + + var _list []*Mount // out + + _list = make([]*Mount, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GMount)(v) + var dst *Mount // out + dst = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// VolumeForUUID finds a #GVolume object by its UUID (see g_volume_get_uuid()). +// +// The function takes the following parameters: +// +// - uuid: UUID to look for. +// +// The function returns the following values: +// +// - volume (optional) or NULL if no such volume is available. Free the +// returned object with g_object_unref(). +func (volumeMonitor *VolumeMonitor) VolumeForUUID(uuid string) *Volume { + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.char // out + var _cret *C.GVolume // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uuid))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_volume_monitor_get_volume_for_uuid(_arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(uuid) + + var _volume *Volume // out + + if _cret != nil { + _volume = wrapVolume(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _volume +} + +// Volumes gets a list of the volumes on the system. +// +// The returned list should be freed with g_list_free(), after its elements have +// been unreffed with g_object_unref(). +// +// The function returns the following values: +// +// - list of #GVolume objects. +func (volumeMonitor *VolumeMonitor) Volumes() []*Volume { + var _arg0 *C.GVolumeMonitor // out + var _cret *C.GList // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + + _cret = C.g_volume_monitor_get_volumes(_arg0) + runtime.KeepAlive(volumeMonitor) + + var _list []*Volume // out + + _list = make([]*Volume, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GVolume)(v) + var dst *Volume // out + dst = wrapVolume(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +func (volumeMonitor *VolumeMonitor) driveChanged(drive Driver) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.drive_changed + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GDrive // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_drive_changed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(drive) +} + +func (volumeMonitor *VolumeMonitor) driveConnected(drive Driver) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.drive_connected + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GDrive // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_drive_connected(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(drive) +} + +func (volumeMonitor *VolumeMonitor) driveDisconnected(drive Driver) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.drive_disconnected + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GDrive // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_drive_disconnected(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(drive) +} + +func (volumeMonitor *VolumeMonitor) driveEjectButton(drive Driver) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.drive_eject_button + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GDrive // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_drive_eject_button(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(drive) +} + +func (volumeMonitor *VolumeMonitor) driveStopButton(drive Driver) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.drive_stop_button + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GDrive // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(drive).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_drive_stop_button(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(drive) +} + +// connectedDrives gets a list of drives connected to the system. +// +// The returned list should be freed with g_list_free(), after its elements have +// been unreffed with g_object_unref(). +// +// The function returns the following values: +// +// - list of connected #GDrive objects. +func (volumeMonitor *VolumeMonitor) connectedDrives() []*Drive { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.get_connected_drives + + var _arg0 *C.GVolumeMonitor // out + var _cret *C.GList // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + + _cret = C._gotk4_gio2_VolumeMonitor_virtual_get_connected_drives(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volumeMonitor) + + var _list []*Drive // out + + _list = make([]*Drive, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GDrive)(v) + var dst *Drive // out + dst = wrapDrive(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// mountForUUID finds a #GMount object by its UUID (see g_mount_get_uuid()). +// +// The function takes the following parameters: +// +// - uuid: UUID to look for. +// +// The function returns the following values: +// +// - mount (optional) or NULL if no such mount is available. Free the returned +// object with g_object_unref(). +func (volumeMonitor *VolumeMonitor) mountForUUID(uuid string) *Mount { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.get_mount_for_uuid + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.char // out + var _cret *C.GMount // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uuid))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_VolumeMonitor_virtual_get_mount_for_uuid(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(uuid) + + var _mount *Mount // out + + if _cret != nil { + _mount = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _mount +} + +// Mounts gets a list of the mounts on the system. +// +// The returned list should be freed with g_list_free(), after its elements have +// been unreffed with g_object_unref(). +// +// The function returns the following values: +// +// - list of #GMount objects. +func (volumeMonitor *VolumeMonitor) mounts() []*Mount { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.get_mounts + + var _arg0 *C.GVolumeMonitor // out + var _cret *C.GList // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + + _cret = C._gotk4_gio2_VolumeMonitor_virtual_get_mounts(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volumeMonitor) + + var _list []*Mount // out + + _list = make([]*Mount, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GMount)(v) + var dst *Mount // out + dst = wrapMount(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// volumeForUUID finds a #GVolume object by its UUID (see g_volume_get_uuid()). +// +// The function takes the following parameters: +// +// - uuid: UUID to look for. +// +// The function returns the following values: +// +// - volume (optional) or NULL if no such volume is available. Free the +// returned object with g_object_unref(). +func (volumeMonitor *VolumeMonitor) volumeForUUID(uuid string) *Volume { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.get_volume_for_uuid + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.char // out + var _cret *C.GVolume // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uuid))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C._gotk4_gio2_VolumeMonitor_virtual_get_volume_for_uuid(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(uuid) + + var _volume *Volume // out + + if _cret != nil { + _volume = wrapVolume(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _volume +} + +// Volumes gets a list of the volumes on the system. +// +// The returned list should be freed with g_list_free(), after its elements have +// been unreffed with g_object_unref(). +// +// The function returns the following values: +// +// - list of #GVolume objects. +func (volumeMonitor *VolumeMonitor) volumes() []*Volume { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.get_volumes + + var _arg0 *C.GVolumeMonitor // out + var _cret *C.GList // in + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + + _cret = C._gotk4_gio2_VolumeMonitor_virtual_get_volumes(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(volumeMonitor) + + var _list []*Volume // out + + _list = make([]*Volume, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GVolume)(v) + var dst *Volume // out + dst = wrapVolume(coreglib.AssumeOwnership(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +func (volumeMonitor *VolumeMonitor) mountAdded(mount Mounter) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.mount_added + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GMount // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_mount_added(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(mount) +} + +func (volumeMonitor *VolumeMonitor) mountChanged(mount Mounter) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.mount_changed + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GMount // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_mount_changed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(mount) +} + +func (volumeMonitor *VolumeMonitor) mountPreUnmount(mount Mounter) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.mount_pre_unmount + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GMount // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_mount_pre_unmount(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(mount) +} + +func (volumeMonitor *VolumeMonitor) mountRemoved(mount Mounter) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.mount_removed + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GMount // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_mount_removed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(mount) +} + +func (volumeMonitor *VolumeMonitor) volumeAdded(volume Volumer) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.volume_added + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GVolume // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_volume_added(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(volume) +} + +func (volumeMonitor *VolumeMonitor) volumeChanged(volume Volumer) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.volume_changed + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GVolume // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_volume_changed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(volume) +} + +func (volumeMonitor *VolumeMonitor) volumeRemoved(volume Volumer) { + gclass := (*C.GVolumeMonitorClass)(coreglib.PeekParentClass(volumeMonitor)) + fnarg := gclass.volume_removed + + var _arg0 *C.GVolumeMonitor // out + var _arg1 *C.GVolume // out + + _arg0 = (*C.GVolumeMonitor)(unsafe.Pointer(coreglib.InternObject(volumeMonitor).Native())) + _arg1 = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + + C._gotk4_gio2_VolumeMonitor_virtual_volume_removed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(volumeMonitor) + runtime.KeepAlive(volume) +} + +// VolumeMonitorAdoptOrphanMount: this function should be called by any +// Monitor implementation when a new #GMount object is created that is not +// associated with a #GVolume object. It must be called just before emitting the +// mount_added signal. +// +// If the return value is not NULL, the caller must associate the returned +// #GVolume object with the #GMount. This involves returning it in its +// g_mount_get_volume() implementation. The caller must also listen for the +// "removed" signal on the returned object and give up its reference when +// handling that signal +// +// Similarly, if implementing g_volume_monitor_adopt_orphan_mount(), +// the implementor must take a reference to mount and return it in its +// g_volume_get_mount() implemented. Also, the implementor must listen for the +// "unmounted" signal on mount and give up its reference upon handling that +// signal. +// +// There are two main use cases for this function. +// +// One is when implementing a user space file system driver that reads blocks +// of a block device that is already represented by the native volume monitor +// (for example a CD Audio file system driver). Such a driver will generate its +// own #GMount object that needs to be associated with the #GVolume object that +// represents the volume. +// +// The other is for implementing a Monitor whose sole purpose is to return +// #GVolume objects representing entries in the users "favorite servers" list or +// similar. +// +// Deprecated: Instead of using this function, Monitor implementations should +// instead create shadow mounts with the URI of the mount they intend to adopt. +// See the proxy volume monitor in gvfs for an example of this. Also see +// g_mount_is_shadowed(), g_mount_shadow() and g_mount_unshadow() functions. +// +// The function takes the following parameters: +// +// - mount object to find a parent for. +// +// The function returns the following values: +// +// - volume object that is the parent for mount or NULL if no wants to adopt +// the #GMount. +func VolumeMonitorAdoptOrphanMount(mount Mounter) *Volume { + var _arg1 *C.GMount // out + var _cret *C.GVolume // in + + _arg1 = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + + _cret = C.g_volume_monitor_adopt_orphan_mount(_arg1) + runtime.KeepAlive(mount) + + var _volume *Volume // out + + _volume = wrapVolume(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _volume +} + +// VolumeMonitorGet gets the volume monitor used by gio. +// +// The function returns the following values: +// +// - volumeMonitor: reference to the Monitor used by gio. Call +// g_object_unref() when done with it. +func VolumeMonitorGet() *VolumeMonitor { + var _cret *C.GVolumeMonitor // in + + _cret = C.g_volume_monitor_get() + + var _volumeMonitor *VolumeMonitor // out + + _volumeMonitor = wrapVolumeMonitor(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _volumeMonitor +} + +// ZlibCompressorOverrides contains methods that are overridable. +type ZlibCompressorOverrides struct { +} + +func defaultZlibCompressorOverrides(v *ZlibCompressor) ZlibCompressorOverrides { + return ZlibCompressorOverrides{} +} + +// ZlibCompressor: GZlibCompressor is an implementation of gio.Converter that +// compresses data using zlib. +type ZlibCompressor struct { + _ [0]func() // equal guard + *coreglib.Object + + Converter +} + +var ( + _ coreglib.Objector = (*ZlibCompressor)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ZlibCompressor, *ZlibCompressorClass, ZlibCompressorOverrides]( + GTypeZlibCompressor, + initZlibCompressorClass, + wrapZlibCompressor, + defaultZlibCompressorOverrides, + ) +} + +func initZlibCompressorClass(gclass unsafe.Pointer, overrides ZlibCompressorOverrides, classInitFunc func(*ZlibCompressorClass)) { + if classInitFunc != nil { + class := (*ZlibCompressorClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapZlibCompressor(obj *coreglib.Object) *ZlibCompressor { + return &ZlibCompressor{ + Object: obj, + Converter: Converter{ + Object: obj, + }, + } +} + +func marshalZlibCompressor(p uintptr) (interface{}, error) { + return wrapZlibCompressor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewZlibCompressor creates a new Compressor. +// +// The function takes the following parameters: +// +// - format to use for the compressed data. +// - level: compression level (0-9), -1 for default. +// +// The function returns the following values: +// +// - zlibCompressor: new Compressor. +func NewZlibCompressor(format ZlibCompressorFormat, level int) *ZlibCompressor { + var _arg1 C.GZlibCompressorFormat // out + var _arg2 C.int // out + var _cret *C.GZlibCompressor // in + + _arg1 = C.GZlibCompressorFormat(format) + _arg2 = C.int(level) + + _cret = C.g_zlib_compressor_new(_arg1, _arg2) + runtime.KeepAlive(format) + runtime.KeepAlive(level) + + var _zlibCompressor *ZlibCompressor // out + + _zlibCompressor = wrapZlibCompressor(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _zlibCompressor +} + +// FileInfo returns the Compressor:file-info property. +// +// The function returns the following values: +// +// - fileInfo (optional) or NULL. +func (compressor *ZlibCompressor) FileInfo() *FileInfo { + var _arg0 *C.GZlibCompressor // out + var _cret *C.GFileInfo // in + + _arg0 = (*C.GZlibCompressor)(unsafe.Pointer(coreglib.InternObject(compressor).Native())) + + _cret = C.g_zlib_compressor_get_file_info(_arg0) + runtime.KeepAlive(compressor) + + var _fileInfo *FileInfo // out + + if _cret != nil { + _fileInfo = wrapFileInfo(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _fileInfo +} + +// SetFileInfo sets file_info in compressor. If non-NULL, and compressor's +// Compressor:format property is G_ZLIB_COMPRESSOR_FORMAT_GZIP, it will be +// used to set the file name and modification time in the GZIP header of the +// compressed data. +// +// Note: it is an error to call this function while a compression is in +// progress; it may only be called immediately after creation of compressor, +// or after resetting it with g_converter_reset(). +// +// The function takes the following parameters: +// +// - fileInfo (optional): Info. +func (compressor *ZlibCompressor) SetFileInfo(fileInfo *FileInfo) { + var _arg0 *C.GZlibCompressor // out + var _arg1 *C.GFileInfo // out + + _arg0 = (*C.GZlibCompressor)(unsafe.Pointer(coreglib.InternObject(compressor).Native())) + if fileInfo != nil { + _arg1 = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(fileInfo).Native())) + } + + C.g_zlib_compressor_set_file_info(_arg0, _arg1) + runtime.KeepAlive(compressor) + runtime.KeepAlive(fileInfo) +} + +// ZlibDecompressorOverrides contains methods that are overridable. +type ZlibDecompressorOverrides struct { +} + +func defaultZlibDecompressorOverrides(v *ZlibDecompressor) ZlibDecompressorOverrides { + return ZlibDecompressorOverrides{} +} + +// ZlibDecompressor: GZlibDecompressor is an implementation of gio.Converter +// that decompresses data compressed with zlib. +type ZlibDecompressor struct { + _ [0]func() // equal guard + *coreglib.Object + + Converter +} + +var ( + _ coreglib.Objector = (*ZlibDecompressor)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ZlibDecompressor, *ZlibDecompressorClass, ZlibDecompressorOverrides]( + GTypeZlibDecompressor, + initZlibDecompressorClass, + wrapZlibDecompressor, + defaultZlibDecompressorOverrides, + ) +} + +func initZlibDecompressorClass(gclass unsafe.Pointer, overrides ZlibDecompressorOverrides, classInitFunc func(*ZlibDecompressorClass)) { + if classInitFunc != nil { + class := (*ZlibDecompressorClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapZlibDecompressor(obj *coreglib.Object) *ZlibDecompressor { + return &ZlibDecompressor{ + Object: obj, + Converter: Converter{ + Object: obj, + }, + } +} + +func marshalZlibDecompressor(p uintptr) (interface{}, error) { + return wrapZlibDecompressor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewZlibDecompressor creates a new Decompressor. +// +// The function takes the following parameters: +// +// - format to use for the compressed data. +// +// The function returns the following values: +// +// - zlibDecompressor: new Decompressor. +func NewZlibDecompressor(format ZlibCompressorFormat) *ZlibDecompressor { + var _arg1 C.GZlibCompressorFormat // out + var _cret *C.GZlibDecompressor // in + + _arg1 = C.GZlibCompressorFormat(format) + + _cret = C.g_zlib_decompressor_new(_arg1) + runtime.KeepAlive(format) + + var _zlibDecompressor *ZlibDecompressor // out + + _zlibDecompressor = wrapZlibDecompressor(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _zlibDecompressor +} + +// FileInfo retrieves the Info constructed from the GZIP header data of +// compressed data processed by compressor, or NULL if decompressor's +// Decompressor:format property is not G_ZLIB_COMPRESSOR_FORMAT_GZIP, or the +// header data was not fully processed yet, or it not present in the data stream +// at all. +// +// The function returns the following values: +// +// - fileInfo (optional) or NULL. +func (decompressor *ZlibDecompressor) FileInfo() *FileInfo { + var _arg0 *C.GZlibDecompressor // out + var _cret *C.GFileInfo // in + + _arg0 = (*C.GZlibDecompressor)(unsafe.Pointer(coreglib.InternObject(decompressor).Native())) + + _cret = C.g_zlib_decompressor_get_file_info(_arg0) + runtime.KeepAlive(decompressor) + + var _fileInfo *FileInfo // out + + if _cret != nil { + _fileInfo = wrapFileInfo(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _fileInfo +} + +// ActionEntry: this struct defines a single action. It is for use with +// g_action_map_add_action_entries(). +// +// The order of the items in the structure are intended to reflect frequency +// of use. It is permissible to use an incomplete initialiser in order to +// leave some of the later values as NULL. All values after name are optional. +// Additional optional fields may be added in the future. +// +// See g_action_map_add_action_entries() for an example. +// +// An instance of this type is always passed by reference. +type ActionEntry struct { + *actionEntry +} + +// actionEntry is the struct that's finalized. +type actionEntry struct { + native *C.GActionEntry +} + +// Name: name of the action. +func (a *ActionEntry) Name() string { + valptr := &a.native.name + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// ParameterType: type of the parameter that must be passed to the activate +// function for this action, given as a single GVariant type string (or NULL for +// no parameter). +func (a *ActionEntry) ParameterType() string { + valptr := &a.native.parameter_type + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// State: initial state for this action, given in [GVariant text +// format][gvariant-text]. The state is parsed with no extra type information, +// so type tags must be added to the string if they are necessary. Stateless +// actions should give NULL here. +func (a *ActionEntry) State() string { + valptr := &a.native.state + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// ActionGroupInterface: virtual function table for Group. +// +// An instance of this type is always passed by reference. +type ActionGroupInterface struct { + *actionGroupInterface +} + +// actionGroupInterface is the struct that's finalized. +type actionGroupInterface struct { + native *C.GActionGroupInterface +} + +// ActionInterface: virtual function table for gio.Action. +// +// An instance of this type is always passed by reference. +type ActionInterface struct { + *actionInterface +} + +// actionInterface is the struct that's finalized. +type actionInterface struct { + native *C.GActionInterface +} + +// ActionMapInterface: virtual function table for Map. +// +// An instance of this type is always passed by reference. +type ActionMapInterface struct { + *actionMapInterface +} + +// actionMapInterface is the struct that's finalized. +type actionMapInterface struct { + native *C.GActionMapInterface +} + +// AppInfoIface: application Information interface, for operating system +// portability. +// +// An instance of this type is always passed by reference. +type AppInfoIface struct { + *appInfoIface +} + +// appInfoIface is the struct that's finalized. +type appInfoIface struct { + native *C.GAppInfoIface +} + +// AppLaunchContextClass: instance of this type is always passed by reference. +type AppLaunchContextClass struct { + *appLaunchContextClass +} + +// appLaunchContextClass is the struct that's finalized. +type appLaunchContextClass struct { + native *C.GAppLaunchContextClass +} + +// ApplicationClass: virtual function table for #GApplication. +// +// An instance of this type is always passed by reference. +type ApplicationClass struct { + *applicationClass +} + +// applicationClass is the struct that's finalized. +type applicationClass struct { + native *C.GApplicationClass +} + +// ApplicationCommandLineClass private data only. +// +// An instance of this type is always passed by reference. +type ApplicationCommandLineClass struct { + *applicationCommandLineClass +} + +// applicationCommandLineClass is the struct that's finalized. +type applicationCommandLineClass struct { + native *C.GApplicationCommandLineClass +} + +// AsyncInitableIface provides an interface for asynchronous initializing object +// such that initialization may fail. +// +// An instance of this type is always passed by reference. +type AsyncInitableIface struct { + *asyncInitableIface +} + +// asyncInitableIface is the struct that's finalized. +type asyncInitableIface struct { + native *C.GAsyncInitableIface +} + +// AsyncResultIface: interface definition for Result. +// +// An instance of this type is always passed by reference. +type AsyncResultIface struct { + *asyncResultIface +} + +// asyncResultIface is the struct that's finalized. +type asyncResultIface struct { + native *C.GAsyncResultIface +} + +// BufferedInputStreamClass: instance of this type is always passed by +// reference. +type BufferedInputStreamClass struct { + *bufferedInputStreamClass +} + +// bufferedInputStreamClass is the struct that's finalized. +type bufferedInputStreamClass struct { + native *C.GBufferedInputStreamClass +} + +func (b *BufferedInputStreamClass) ParentClass() *FilterInputStreamClass { + valptr := &b.native.parent_class + var _v *FilterInputStreamClass // out + _v = (*FilterInputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// BufferedOutputStreamClass: instance of this type is always passed by +// reference. +type BufferedOutputStreamClass struct { + *bufferedOutputStreamClass +} + +// bufferedOutputStreamClass is the struct that's finalized. +type bufferedOutputStreamClass struct { + native *C.GBufferedOutputStreamClass +} + +func (b *BufferedOutputStreamClass) ParentClass() *FilterOutputStreamClass { + valptr := &b.native.parent_class + var _v *FilterOutputStreamClass // out + _v = (*FilterOutputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// CancellableClass: instance of this type is always passed by reference. +type CancellableClass struct { + *cancellableClass +} + +// cancellableClass is the struct that's finalized. +type cancellableClass struct { + native *C.GCancellableClass +} + +// CharsetConverterClass: instance of this type is always passed by reference. +type CharsetConverterClass struct { + *charsetConverterClass +} + +// charsetConverterClass is the struct that's finalized. +type charsetConverterClass struct { + native *C.GCharsetConverterClass +} + +// ConverterIface provides an interface for converting data from one type to +// another type. The conversion can be stateful and may fail at any place. +// +// An instance of this type is always passed by reference. +type ConverterIface struct { + *converterIface +} + +// converterIface is the struct that's finalized. +type converterIface struct { + native *C.GConverterIface +} + +// ConverterInputStreamClass: instance of this type is always passed by +// reference. +type ConverterInputStreamClass struct { + *converterInputStreamClass +} + +// converterInputStreamClass is the struct that's finalized. +type converterInputStreamClass struct { + native *C.GConverterInputStreamClass +} + +func (c *ConverterInputStreamClass) ParentClass() *FilterInputStreamClass { + valptr := &c.native.parent_class + var _v *FilterInputStreamClass // out + _v = (*FilterInputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// ConverterOutputStreamClass: instance of this type is always passed by +// reference. +type ConverterOutputStreamClass struct { + *converterOutputStreamClass +} + +// converterOutputStreamClass is the struct that's finalized. +type converterOutputStreamClass struct { + native *C.GConverterOutputStreamClass +} + +func (c *ConverterOutputStreamClass) ParentClass() *FilterOutputStreamClass { + valptr := &c.native.parent_class + var _v *FilterOutputStreamClass // out + _v = (*FilterOutputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// DBusAnnotationInfo: information about an annotation. +// +// An instance of this type is always passed by reference. +type DBusAnnotationInfo struct { + *dBusAnnotationInfo +} + +// dBusAnnotationInfo is the struct that's finalized. +type dBusAnnotationInfo struct { + native *C.GDBusAnnotationInfo +} + +func marshalDBusAnnotationInfo(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DBusAnnotationInfo{&dBusAnnotationInfo{(*C.GDBusAnnotationInfo)(b)}}, nil +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusAnnotationInfo) RefCount() int { + valptr := &d.native.ref_count + var _v int // out + _v = int(*valptr) + return _v +} + +// Key: name of the annotation, e.g. "org.freedesktop.DBus.Deprecated". +func (d *DBusAnnotationInfo) Key() string { + valptr := &d.native.key + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Value: value of the annotation. +func (d *DBusAnnotationInfo) Value() string { + valptr := &d.native.value + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Annotations: pointer to a NULL-terminated array of pointers to +// BusAnnotationInfo structures or NULL if there are no annotations. +func (d *DBusAnnotationInfo) Annotations() []*DBusAnnotationInfo { + valptr := &d.native.annotations + var _v []*DBusAnnotationInfo // out + { + var i int + var z *C.GDBusAnnotationInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusAnnotationInfo, i) + for i := range src { + _v[i] = (*DBusAnnotationInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_annotation_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_annotation_info_unref((*C.GDBusAnnotationInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusAnnotationInfo) SetRefCount(refCount int) { + valptr := &d.native.ref_count + *valptr = C.gint(refCount) +} + +// DBusAnnotationInfoLookup looks up the value of an annotation. +// +// The cost of this function is O(n) in number of annotations. +// +// The function takes the following parameters: +// +// - annotations (optional): NULL-terminated array of annotations or NULL. +// - name of the annotation to look up. +// +// The function returns the following values: +// +// - utf8 (optional): value or NULL if not found. Do not free, it is owned by +// annotations. +func DBusAnnotationInfoLookup(annotations []*DBusAnnotationInfo, name string) string { + var _arg1 **C.GDBusAnnotationInfo // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + + if annotations != nil { + { + _arg1 = (**C.GDBusAnnotationInfo)(C.calloc(C.size_t((len(annotations) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(annotations)+1) + var zero *C.GDBusAnnotationInfo + out[len(annotations)] = zero + for i := range annotations { + out[i] = (*C.GDBusAnnotationInfo)(gextras.StructNative(unsafe.Pointer(annotations[i]))) + } + } + } + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_dbus_annotation_info_lookup(_arg1, _arg2) + runtime.KeepAlive(annotations) + runtime.KeepAlive(name) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// DBusArgInfo: information about an argument for a method or a signal. +// +// An instance of this type is always passed by reference. +type DBusArgInfo struct { + *dBusArgInfo +} + +// dBusArgInfo is the struct that's finalized. +type dBusArgInfo struct { + native *C.GDBusArgInfo +} + +func marshalDBusArgInfo(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DBusArgInfo{&dBusArgInfo{(*C.GDBusArgInfo)(b)}}, nil +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusArgInfo) RefCount() int { + valptr := &d.native.ref_count + var _v int // out + _v = int(*valptr) + return _v +} + +// Name of the argument, e.g. unix_user_id. +func (d *DBusArgInfo) Name() string { + valptr := &d.native.name + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Signature d-Bus signature of the argument (a single complete type). +func (d *DBusArgInfo) Signature() string { + valptr := &d.native.signature + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Annotations: pointer to a NULL-terminated array of pointers to +// BusAnnotationInfo structures or NULL if there are no annotations. +func (d *DBusArgInfo) Annotations() []*DBusAnnotationInfo { + valptr := &d.native.annotations + var _v []*DBusAnnotationInfo // out + { + var i int + var z *C.GDBusAnnotationInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusAnnotationInfo, i) + for i := range src { + _v[i] = (*DBusAnnotationInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_annotation_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_annotation_info_unref((*C.GDBusAnnotationInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusArgInfo) SetRefCount(refCount int) { + valptr := &d.native.ref_count + *valptr = C.gint(refCount) +} + +// DBusErrorEntry: struct used in g_dbus_error_register_error_domain(). +// +// An instance of this type is always passed by reference. +type DBusErrorEntry struct { + *dBusErrorEntry +} + +// dBusErrorEntry is the struct that's finalized. +type dBusErrorEntry struct { + native *C.GDBusErrorEntry +} + +// ErrorCode: error code. +func (d *DBusErrorEntry) ErrorCode() int { + valptr := &d.native.error_code + var _v int // out + _v = int(*valptr) + return _v +} + +// DBusErrorName d-Bus error name to associate with error_code. +func (d *DBusErrorEntry) DBusErrorName() string { + valptr := &d.native.dbus_error_name + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// ErrorCode: error code. +func (d *DBusErrorEntry) SetErrorCode(errorCode int) { + valptr := &d.native.error_code + *valptr = C.gint(errorCode) +} + +// DBusInterfaceIface: base type for D-Bus interfaces. +// +// An instance of this type is always passed by reference. +type DBusInterfaceIface struct { + *dBusInterfaceIface +} + +// dBusInterfaceIface is the struct that's finalized. +type dBusInterfaceIface struct { + native *C.GDBusInterfaceIface +} + +// DBusInterfaceInfo: information about a D-Bus interface. +// +// An instance of this type is always passed by reference. +type DBusInterfaceInfo struct { + *dBusInterfaceInfo +} + +// dBusInterfaceInfo is the struct that's finalized. +type dBusInterfaceInfo struct { + native *C.GDBusInterfaceInfo +} + +func marshalDBusInterfaceInfo(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DBusInterfaceInfo{&dBusInterfaceInfo{(*C.GDBusInterfaceInfo)(b)}}, nil +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusInterfaceInfo) RefCount() int { + valptr := &d.native.ref_count + var _v int // out + _v = int(*valptr) + return _v +} + +// Name: name of the D-Bus interface, e.g. "org.freedesktop.DBus.Properties". +func (d *DBusInterfaceInfo) Name() string { + valptr := &d.native.name + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Methods: pointer to a NULL-terminated array of pointers to BusMethodInfo +// structures or NULL if there are no methods. +func (d *DBusInterfaceInfo) Methods() []*DBusMethodInfo { + valptr := &d.native.methods + var _v []*DBusMethodInfo // out + { + var i int + var z *C.GDBusMethodInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusMethodInfo, i) + for i := range src { + _v[i] = (*DBusMethodInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_method_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_method_info_unref((*C.GDBusMethodInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// Signals: pointer to a NULL-terminated array of pointers to BusSignalInfo +// structures or NULL if there are no signals. +func (d *DBusInterfaceInfo) Signals() []*DBusSignalInfo { + valptr := &d.native.signals + var _v []*DBusSignalInfo // out + { + var i int + var z *C.GDBusSignalInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusSignalInfo, i) + for i := range src { + _v[i] = (*DBusSignalInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_signal_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_signal_info_unref((*C.GDBusSignalInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// Properties: pointer to a NULL-terminated array of pointers to BusPropertyInfo +// structures or NULL if there are no properties. +func (d *DBusInterfaceInfo) Properties() []*DBusPropertyInfo { + valptr := &d.native.properties + var _v []*DBusPropertyInfo // out + { + var i int + var z *C.GDBusPropertyInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusPropertyInfo, i) + for i := range src { + _v[i] = (*DBusPropertyInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_property_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_property_info_unref((*C.GDBusPropertyInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// Annotations: pointer to a NULL-terminated array of pointers to +// BusAnnotationInfo structures or NULL if there are no annotations. +func (d *DBusInterfaceInfo) Annotations() []*DBusAnnotationInfo { + valptr := &d.native.annotations + var _v []*DBusAnnotationInfo // out + { + var i int + var z *C.GDBusAnnotationInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusAnnotationInfo, i) + for i := range src { + _v[i] = (*DBusAnnotationInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_annotation_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_annotation_info_unref((*C.GDBusAnnotationInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusInterfaceInfo) SetRefCount(refCount int) { + valptr := &d.native.ref_count + *valptr = C.gint(refCount) +} + +// CacheBuild builds a lookup-cache to speed up +// g_dbus_interface_info_lookup_method(), g_dbus_interface_info_lookup_signal() +// and g_dbus_interface_info_lookup_property(). +// +// If this has already been called with info, the existing cache is used and its +// use count is increased. +// +// Note that info cannot be modified until g_dbus_interface_info_cache_release() +// is called. +func (info *DBusInterfaceInfo) CacheBuild() { + var _arg0 *C.GDBusInterfaceInfo // out + + _arg0 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + + C.g_dbus_interface_info_cache_build(_arg0) + runtime.KeepAlive(info) +} + +// CacheRelease decrements the usage count for the cache for info built by +// g_dbus_interface_info_cache_build() (if any) and frees the resources used by +// the cache if the usage count drops to zero. +func (info *DBusInterfaceInfo) CacheRelease() { + var _arg0 *C.GDBusInterfaceInfo // out + + _arg0 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + + C.g_dbus_interface_info_cache_release(_arg0) + runtime.KeepAlive(info) +} + +// LookupMethod looks up information about a method. +// +// The cost of this function is O(n) in number of methods unless +// g_dbus_interface_info_cache_build() has been used on info. +// +// The function takes the following parameters: +// +// - name d-Bus method name (typically in CamelCase). +// +// The function returns the following values: +// +// - dBusMethodInfo (optional) or NULL if not found. Do not free, it is owned +// by info. +func (info *DBusInterfaceInfo) LookupMethod(name string) *DBusMethodInfo { + var _arg0 *C.GDBusInterfaceInfo // out + var _arg1 *C.gchar // out + var _cret *C.GDBusMethodInfo // in + + _arg0 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_interface_info_lookup_method(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(name) + + var _dBusMethodInfo *DBusMethodInfo // out + + if _cret != nil { + _dBusMethodInfo = (*DBusMethodInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_method_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusMethodInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_method_info_unref((*C.GDBusMethodInfo)(intern.C)) + }, + ) + } + + return _dBusMethodInfo +} + +// LookupProperty looks up information about a property. +// +// The cost of this function is O(n) in number of properties unless +// g_dbus_interface_info_cache_build() has been used on info. +// +// The function takes the following parameters: +// +// - name d-Bus property name (typically in CamelCase). +// +// The function returns the following values: +// +// - dBusPropertyInfo (optional) or NULL if not found. Do not free, it is +// owned by info. +func (info *DBusInterfaceInfo) LookupProperty(name string) *DBusPropertyInfo { + var _arg0 *C.GDBusInterfaceInfo // out + var _arg1 *C.gchar // out + var _cret *C.GDBusPropertyInfo // in + + _arg0 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_interface_info_lookup_property(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(name) + + var _dBusPropertyInfo *DBusPropertyInfo // out + + if _cret != nil { + _dBusPropertyInfo = (*DBusPropertyInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_property_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusPropertyInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_property_info_unref((*C.GDBusPropertyInfo)(intern.C)) + }, + ) + } + + return _dBusPropertyInfo +} + +// LookupSignal looks up information about a signal. +// +// The cost of this function is O(n) in number of signals unless +// g_dbus_interface_info_cache_build() has been used on info. +// +// The function takes the following parameters: +// +// - name d-Bus signal name (typically in CamelCase). +// +// The function returns the following values: +// +// - dBusSignalInfo (optional) or NULL if not found. Do not free, it is owned +// by info. +func (info *DBusInterfaceInfo) LookupSignal(name string) *DBusSignalInfo { + var _arg0 *C.GDBusInterfaceInfo // out + var _arg1 *C.gchar // out + var _cret *C.GDBusSignalInfo // in + + _arg0 = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(info))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_interface_info_lookup_signal(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(name) + + var _dBusSignalInfo *DBusSignalInfo // out + + if _cret != nil { + _dBusSignalInfo = (*DBusSignalInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_signal_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusSignalInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_signal_info_unref((*C.GDBusSignalInfo)(intern.C)) + }, + ) + } + + return _dBusSignalInfo +} + +// DBusInterfaceSkeletonClass class structure for BusInterfaceSkeleton. +// +// An instance of this type is always passed by reference. +type DBusInterfaceSkeletonClass struct { + *dBusInterfaceSkeletonClass +} + +// dBusInterfaceSkeletonClass is the struct that's finalized. +type dBusInterfaceSkeletonClass struct { + native *C.GDBusInterfaceSkeletonClass +} + +// DBusInterfaceVTable: virtual table for handling properties and method calls +// for a D-Bus interface. +// +// Since 2.38, if you want to handle getting/setting D-Bus properties +// asynchronously, give NULL as your get_property() or set_property() function. +// The D-Bus call will be directed to your method_call function, with the +// provided interface_name set to "org.freedesktop.DBus.Properties". +// +// Ownership of the BusMethodInvocation object passed to the method_call() +// function is transferred to your handler; you must call one of the methods of +// BusMethodInvocation to return a reply (possibly empty), or an error. These +// functions also take ownership of the passed-in invocation object, so unless +// the invocation object has otherwise been referenced, it will be then be +// freed. Calling one of these functions may be done within your method_call() +// implementation but it also can be done at a later point to handle the method +// asynchronously. +// +// The usual checks on the validity of the calls is performed. For Get calls, +// an error is automatically returned if the property does not exist or the +// permissions do not allow access. The same checks are performed for Set calls, +// and the provided value is also checked for being the correct type. +// +// For both Get and Set calls, the BusMethodInvocation passed to the method_call +// handler can be queried with g_dbus_method_invocation_get_property_info() to +// get a pointer to the BusPropertyInfo of the property. +// +// If you have readable properties specified in your interface info, +// you must ensure that you either provide a non-NULL get_property() +// function or provide implementations of both the Get and GetAll methods on +// org.freedesktop.DBus.Properties interface in your method_call function. +// Note that the required return type of the Get call is (v), not the type of +// the property. GetAll expects a return value of type a{sv}. +// +// If you have writable properties specified in your interface info, you must +// ensure that you either provide a non-NULL set_property() function or provide +// an implementation of the Set call. If implementing the call, you must return +// the value of type G_VARIANT_TYPE_UNIT. +// +// An instance of this type is always passed by reference. +type DBusInterfaceVTable struct { + *dBusInterfaceVTable +} + +// dBusInterfaceVTable is the struct that's finalized. +type dBusInterfaceVTable struct { + native *C.GDBusInterfaceVTable +} + +// DBusMethodInfo: information about a method on an D-Bus interface. +// +// An instance of this type is always passed by reference. +type DBusMethodInfo struct { + *dBusMethodInfo +} + +// dBusMethodInfo is the struct that's finalized. +type dBusMethodInfo struct { + native *C.GDBusMethodInfo +} + +func marshalDBusMethodInfo(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DBusMethodInfo{&dBusMethodInfo{(*C.GDBusMethodInfo)(b)}}, nil +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusMethodInfo) RefCount() int { + valptr := &d.native.ref_count + var _v int // out + _v = int(*valptr) + return _v +} + +// Name: name of the D-Bus method, e.g. RequestName. +func (d *DBusMethodInfo) Name() string { + valptr := &d.native.name + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// InArgs: pointer to a NULL-terminated array of pointers to BusArgInfo +// structures or NULL if there are no in arguments. +func (d *DBusMethodInfo) InArgs() []*DBusArgInfo { + valptr := &d.native.in_args + var _v []*DBusArgInfo // out + { + var i int + var z *C.GDBusArgInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusArgInfo, i) + for i := range src { + _v[i] = (*DBusArgInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_arg_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_arg_info_unref((*C.GDBusArgInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// OutArgs: pointer to a NULL-terminated array of pointers to BusArgInfo +// structures or NULL if there are no out arguments. +func (d *DBusMethodInfo) OutArgs() []*DBusArgInfo { + valptr := &d.native.out_args + var _v []*DBusArgInfo // out + { + var i int + var z *C.GDBusArgInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusArgInfo, i) + for i := range src { + _v[i] = (*DBusArgInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_arg_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_arg_info_unref((*C.GDBusArgInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// Annotations: pointer to a NULL-terminated array of pointers to +// BusAnnotationInfo structures or NULL if there are no annotations. +func (d *DBusMethodInfo) Annotations() []*DBusAnnotationInfo { + valptr := &d.native.annotations + var _v []*DBusAnnotationInfo // out + { + var i int + var z *C.GDBusAnnotationInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusAnnotationInfo, i) + for i := range src { + _v[i] = (*DBusAnnotationInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_annotation_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_annotation_info_unref((*C.GDBusAnnotationInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusMethodInfo) SetRefCount(refCount int) { + valptr := &d.native.ref_count + *valptr = C.gint(refCount) +} + +// DBusNodeInfo: information about nodes in a remote object hierarchy. +// +// An instance of this type is always passed by reference. +type DBusNodeInfo struct { + *dBusNodeInfo +} + +// dBusNodeInfo is the struct that's finalized. +type dBusNodeInfo struct { + native *C.GDBusNodeInfo +} + +func marshalDBusNodeInfo(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DBusNodeInfo{&dBusNodeInfo{(*C.GDBusNodeInfo)(b)}}, nil +} + +// NewDBusNodeInfoForXML constructs a struct DBusNodeInfo. +func NewDBusNodeInfoForXML(xmlData string) (*DBusNodeInfo, error) { + var _arg1 *C.gchar // out + var _cret *C.GDBusNodeInfo // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(xmlData))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_node_info_new_for_xml(_arg1, &_cerr) + runtime.KeepAlive(xmlData) + + var _dBusNodeInfo *DBusNodeInfo // out + var _goerr error // out + + _dBusNodeInfo = (*DBusNodeInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusNodeInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_node_info_unref((*C.GDBusNodeInfo)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dBusNodeInfo, _goerr +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusNodeInfo) RefCount() int { + valptr := &d.native.ref_count + var _v int // out + _v = int(*valptr) + return _v +} + +// Path: path of the node or NULL if omitted. Note that this may be a relative +// path. See the D-Bus specification for more details. +func (d *DBusNodeInfo) Path() string { + valptr := &d.native.path + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Interfaces: pointer to a NULL-terminated array of pointers to +// BusInterfaceInfo structures or NULL if there are no interfaces. +func (d *DBusNodeInfo) Interfaces() []*DBusInterfaceInfo { + valptr := &d.native.interfaces + var _v []*DBusInterfaceInfo // out + { + var i int + var z *C.GDBusInterfaceInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusInterfaceInfo, i) + for i := range src { + _v[i] = (*DBusInterfaceInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_interface_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_interface_info_unref((*C.GDBusInterfaceInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// Nodes: pointer to a NULL-terminated array of pointers to BusNodeInfo +// structures or NULL if there are no nodes. +func (d *DBusNodeInfo) Nodes() []*DBusNodeInfo { + valptr := &d.native.nodes + var _v []*DBusNodeInfo // out + { + var i int + var z *C.GDBusNodeInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusNodeInfo, i) + for i := range src { + _v[i] = (*DBusNodeInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_node_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_node_info_unref((*C.GDBusNodeInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// Annotations: pointer to a NULL-terminated array of pointers to +// BusAnnotationInfo structures or NULL if there are no annotations. +func (d *DBusNodeInfo) Annotations() []*DBusAnnotationInfo { + valptr := &d.native.annotations + var _v []*DBusAnnotationInfo // out + { + var i int + var z *C.GDBusAnnotationInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusAnnotationInfo, i) + for i := range src { + _v[i] = (*DBusAnnotationInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_annotation_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_annotation_info_unref((*C.GDBusAnnotationInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusNodeInfo) SetRefCount(refCount int) { + valptr := &d.native.ref_count + *valptr = C.gint(refCount) +} + +// LookupInterface looks up information about an interface. +// +// The cost of this function is O(n) in number of interfaces. +// +// The function takes the following parameters: +// +// - name d-Bus interface name. +// +// The function returns the following values: +// +// - dBusInterfaceInfo (optional) or NULL if not found. Do not free, it is +// owned by info. +func (info *DBusNodeInfo) LookupInterface(name string) *DBusInterfaceInfo { + var _arg0 *C.GDBusNodeInfo // out + var _arg1 *C.gchar // out + var _cret *C.GDBusInterfaceInfo // in + + _arg0 = (*C.GDBusNodeInfo)(gextras.StructNative(unsafe.Pointer(info))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_dbus_node_info_lookup_interface(_arg0, _arg1) + runtime.KeepAlive(info) + runtime.KeepAlive(name) + + var _dBusInterfaceInfo *DBusInterfaceInfo // out + + if _cret != nil { + _dBusInterfaceInfo = (*DBusInterfaceInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_dbus_interface_info_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dBusInterfaceInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_interface_info_unref((*C.GDBusInterfaceInfo)(intern.C)) + }, + ) + } + + return _dBusInterfaceInfo +} + +// DBusObjectIface: base object type for D-Bus objects. +// +// An instance of this type is always passed by reference. +type DBusObjectIface struct { + *dBusObjectIface +} + +// dBusObjectIface is the struct that's finalized. +type dBusObjectIface struct { + native *C.GDBusObjectIface +} + +// DBusObjectManagerClientClass class structure for BusObjectManagerClient. +// +// An instance of this type is always passed by reference. +type DBusObjectManagerClientClass struct { + *dBusObjectManagerClientClass +} + +// dBusObjectManagerClientClass is the struct that's finalized. +type dBusObjectManagerClientClass struct { + native *C.GDBusObjectManagerClientClass +} + +// DBusObjectManagerIface: base type for D-Bus object managers. +// +// An instance of this type is always passed by reference. +type DBusObjectManagerIface struct { + *dBusObjectManagerIface +} + +// dBusObjectManagerIface is the struct that's finalized. +type dBusObjectManagerIface struct { + native *C.GDBusObjectManagerIface +} + +// DBusObjectManagerServerClass class structure for BusObjectManagerServer. +// +// An instance of this type is always passed by reference. +type DBusObjectManagerServerClass struct { + *dBusObjectManagerServerClass +} + +// dBusObjectManagerServerClass is the struct that's finalized. +type dBusObjectManagerServerClass struct { + native *C.GDBusObjectManagerServerClass +} + +// DBusObjectProxyClass class structure for BusObjectProxy. +// +// An instance of this type is always passed by reference. +type DBusObjectProxyClass struct { + *dBusObjectProxyClass +} + +// dBusObjectProxyClass is the struct that's finalized. +type dBusObjectProxyClass struct { + native *C.GDBusObjectProxyClass +} + +// DBusObjectSkeletonClass class structure for BusObjectSkeleton. +// +// An instance of this type is always passed by reference. +type DBusObjectSkeletonClass struct { + *dBusObjectSkeletonClass +} + +// dBusObjectSkeletonClass is the struct that's finalized. +type dBusObjectSkeletonClass struct { + native *C.GDBusObjectSkeletonClass +} + +// DBusPropertyInfo: information about a D-Bus property on a D-Bus interface. +// +// An instance of this type is always passed by reference. +type DBusPropertyInfo struct { + *dBusPropertyInfo +} + +// dBusPropertyInfo is the struct that's finalized. +type dBusPropertyInfo struct { + native *C.GDBusPropertyInfo +} + +func marshalDBusPropertyInfo(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DBusPropertyInfo{&dBusPropertyInfo{(*C.GDBusPropertyInfo)(b)}}, nil +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusPropertyInfo) RefCount() int { + valptr := &d.native.ref_count + var _v int // out + _v = int(*valptr) + return _v +} + +// Name: name of the D-Bus property, e.g. "SupportedFilesystems". +func (d *DBusPropertyInfo) Name() string { + valptr := &d.native.name + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Signature d-Bus signature of the property (a single complete type). +func (d *DBusPropertyInfo) Signature() string { + valptr := &d.native.signature + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Flags access control flags for the property. +func (d *DBusPropertyInfo) Flags() DBusPropertyInfoFlags { + valptr := &d.native.flags + var _v DBusPropertyInfoFlags // out + _v = DBusPropertyInfoFlags(*valptr) + return _v +} + +// Annotations: pointer to a NULL-terminated array of pointers to +// BusAnnotationInfo structures or NULL if there are no annotations. +func (d *DBusPropertyInfo) Annotations() []*DBusAnnotationInfo { + valptr := &d.native.annotations + var _v []*DBusAnnotationInfo // out + { + var i int + var z *C.GDBusAnnotationInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusAnnotationInfo, i) + for i := range src { + _v[i] = (*DBusAnnotationInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_annotation_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_annotation_info_unref((*C.GDBusAnnotationInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusPropertyInfo) SetRefCount(refCount int) { + valptr := &d.native.ref_count + *valptr = C.gint(refCount) +} + +// DBusProxyClass class structure for BusProxy. +// +// An instance of this type is always passed by reference. +type DBusProxyClass struct { + *dBusProxyClass +} + +// dBusProxyClass is the struct that's finalized. +type dBusProxyClass struct { + native *C.GDBusProxyClass +} + +// DBusSignalInfo: information about a signal on a D-Bus interface. +// +// An instance of this type is always passed by reference. +type DBusSignalInfo struct { + *dBusSignalInfo +} + +// dBusSignalInfo is the struct that's finalized. +type dBusSignalInfo struct { + native *C.GDBusSignalInfo +} + +func marshalDBusSignalInfo(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DBusSignalInfo{&dBusSignalInfo{(*C.GDBusSignalInfo)(b)}}, nil +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusSignalInfo) RefCount() int { + valptr := &d.native.ref_count + var _v int // out + _v = int(*valptr) + return _v +} + +// Name: name of the D-Bus signal, e.g. "NameOwnerChanged". +func (d *DBusSignalInfo) Name() string { + valptr := &d.native.name + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Args: pointer to a NULL-terminated array of pointers to BusArgInfo structures +// or NULL if there are no arguments. +func (d *DBusSignalInfo) Args() []*DBusArgInfo { + valptr := &d.native.args + var _v []*DBusArgInfo // out + { + var i int + var z *C.GDBusArgInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusArgInfo, i) + for i := range src { + _v[i] = (*DBusArgInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_arg_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_arg_info_unref((*C.GDBusArgInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// Annotations: pointer to a NULL-terminated array of pointers to +// BusAnnotationInfo structures or NULL if there are no annotations. +func (d *DBusSignalInfo) Annotations() []*DBusAnnotationInfo { + valptr := &d.native.annotations + var _v []*DBusAnnotationInfo // out + { + var i int + var z *C.GDBusAnnotationInfo + for p := *valptr; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(*valptr, i) + _v = make([]*DBusAnnotationInfo, i) + for i := range src { + _v[i] = (*DBusAnnotationInfo)(gextras.NewStructNative(unsafe.Pointer(src[i]))) + C.g_dbus_annotation_info_ref(src[i]) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_v[i])), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dbus_annotation_info_unref((*C.GDBusAnnotationInfo)(intern.C)) + }, + ) + } + } + return _v +} + +// RefCount: reference count or -1 if statically allocated. +func (d *DBusSignalInfo) SetRefCount(refCount int) { + valptr := &d.native.ref_count + *valptr = C.gint(refCount) +} + +// DBusSubtreeVTable: virtual table for handling subtrees registered with +// g_dbus_connection_register_subtree(). +// +// An instance of this type is always passed by reference. +type DBusSubtreeVTable struct { + *dBusSubtreeVTable +} + +// dBusSubtreeVTable is the struct that's finalized. +type dBusSubtreeVTable struct { + native *C.GDBusSubtreeVTable +} + +// DataInputStreamClass: instance of this type is always passed by reference. +type DataInputStreamClass struct { + *dataInputStreamClass +} + +// dataInputStreamClass is the struct that's finalized. +type dataInputStreamClass struct { + native *C.GDataInputStreamClass +} + +func (d *DataInputStreamClass) ParentClass() *BufferedInputStreamClass { + valptr := &d.native.parent_class + var _v *BufferedInputStreamClass // out + _v = (*BufferedInputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// DataOutputStreamClass: instance of this type is always passed by reference. +type DataOutputStreamClass struct { + *dataOutputStreamClass +} + +// dataOutputStreamClass is the struct that's finalized. +type dataOutputStreamClass struct { + native *C.GDataOutputStreamClass +} + +func (d *DataOutputStreamClass) ParentClass() *FilterOutputStreamClass { + valptr := &d.native.parent_class + var _v *FilterOutputStreamClass // out + _v = (*FilterOutputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// DatagramBasedInterface provides an interface for socket-like objects which +// have datagram semantics, following the Berkeley sockets API. The interface +// methods are thin wrappers around the corresponding virtual methods, and no +// pre-processing of inputs is implemented — so implementations of this API must +// handle all functionality documented in the interface methods. +// +// An instance of this type is always passed by reference. +type DatagramBasedInterface struct { + *datagramBasedInterface +} + +// datagramBasedInterface is the struct that's finalized. +type datagramBasedInterface struct { + native *C.GDatagramBasedInterface +} + +// DebugControllerDBusClass: virtual function table for ControllerDBus. +// +// An instance of this type is always passed by reference. +type DebugControllerDBusClass struct { + *debugControllerDBusClass +} + +// debugControllerDBusClass is the struct that's finalized. +type debugControllerDBusClass struct { + native *C.GDebugControllerDBusClass +} + +func (d *DebugControllerDBusClass) Padding() [12]unsafe.Pointer { + valptr := &d.native.padding + var _v [12]unsafe.Pointer // out + { + src := &*valptr + for i := 0; i < 12; i++ { + _v[i] = (unsafe.Pointer)(unsafe.Pointer(src[i])) + } + } + return _v +} + +// DebugControllerInterface: virtual function table for Controller. +// +// An instance of this type is always passed by reference. +type DebugControllerInterface struct { + *debugControllerInterface +} + +// debugControllerInterface is the struct that's finalized. +type debugControllerInterface struct { + native *C.GDebugControllerInterface +} + +// DriveIface: interface for creating #GDrive implementations. +// +// An instance of this type is always passed by reference. +type DriveIface struct { + *driveIface +} + +// driveIface is the struct that's finalized. +type driveIface struct { + native *C.GDriveIface +} + +// DTLSClientConnectionInterface: vtable for a ClientConnection implementation. +// +// An instance of this type is always passed by reference. +type DTLSClientConnectionInterface struct { + *dtlsClientConnectionInterface +} + +// dtlsClientConnectionInterface is the struct that's finalized. +type dtlsClientConnectionInterface struct { + native *C.GDtlsClientConnectionInterface +} + +// DTLSConnectionInterface: virtual method table for a Connection +// implementation. +// +// An instance of this type is always passed by reference. +type DTLSConnectionInterface struct { + *dtlsConnectionInterface +} + +// dtlsConnectionInterface is the struct that's finalized. +type dtlsConnectionInterface struct { + native *C.GDtlsConnectionInterface +} + +// DTLSServerConnectionInterface: vtable for a ServerConnection implementation. +// +// An instance of this type is always passed by reference. +type DTLSServerConnectionInterface struct { + *dtlsServerConnectionInterface +} + +// dtlsServerConnectionInterface is the struct that's finalized. +type dtlsServerConnectionInterface struct { + native *C.GDtlsServerConnectionInterface +} + +// EmblemedIconClass: instance of this type is always passed by reference. +type EmblemedIconClass struct { + *emblemedIconClass +} + +// emblemedIconClass is the struct that's finalized. +type emblemedIconClass struct { + native *C.GEmblemedIconClass +} + +// FileAttributeInfo: information about a specific attribute. +// +// An instance of this type is always passed by reference. +type FileAttributeInfo struct { + *fileAttributeInfo +} + +// fileAttributeInfo is the struct that's finalized. +type fileAttributeInfo struct { + native *C.GFileAttributeInfo +} + +// Name: name of the attribute. +func (f *FileAttributeInfo) Name() string { + valptr := &f.native.name + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Type type of the attribute. +func (f *FileAttributeInfo) Type() FileAttributeType { + valptr := &f.native._type + var _v FileAttributeType // out + _v = FileAttributeType(*valptr) + return _v +} + +// Flags: set of AttributeInfoFlags. +func (f *FileAttributeInfo) Flags() FileAttributeInfoFlags { + valptr := &f.native.flags + var _v FileAttributeInfoFlags // out + _v = FileAttributeInfoFlags(*valptr) + return _v +} + +// FileAttributeInfoList acts as a lightweight registry for possible valid file +// attributes. The registry stores Key-Value pair formats as AttributeInfos. +// +// An instance of this type is always passed by reference. +type FileAttributeInfoList struct { + *fileAttributeInfoList +} + +// fileAttributeInfoList is the struct that's finalized. +type fileAttributeInfoList struct { + native *C.GFileAttributeInfoList +} + +func marshalFileAttributeInfoList(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &FileAttributeInfoList{&fileAttributeInfoList{(*C.GFileAttributeInfoList)(b)}}, nil +} + +// NewFileAttributeInfoList constructs a struct FileAttributeInfoList. +func NewFileAttributeInfoList() *FileAttributeInfoList { + var _cret *C.GFileAttributeInfoList // in + + _cret = C.g_file_attribute_info_list_new() + + var _fileAttributeInfoList *FileAttributeInfoList // out + + _fileAttributeInfoList = (*FileAttributeInfoList)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileAttributeInfoList)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_file_attribute_info_list_unref((*C.GFileAttributeInfoList)(intern.C)) + }, + ) + + return _fileAttributeInfoList +} + +// Infos: array of AttributeInfos. +func (f *FileAttributeInfoList) Infos() *FileAttributeInfo { + valptr := &f.native.infos + var _v *FileAttributeInfo // out + _v = (*FileAttributeInfo)(gextras.NewStructNative(unsafe.Pointer(*valptr))) + return _v +} + +// NInfos: number of values in the array. +func (f *FileAttributeInfoList) NInfos() int { + valptr := &f.native.n_infos + var _v int // out + _v = int(*valptr) + return _v +} + +// NInfos: number of values in the array. +func (f *FileAttributeInfoList) SetNInfos(nInfos int) { + valptr := &f.native.n_infos + *valptr = C.int(nInfos) +} + +// Add adds a new attribute with name to the list, setting its type and flags. +// +// The function takes the following parameters: +// +// - name of the attribute to add. +// - typ for the attribute. +// - flags for the attribute. +func (list *FileAttributeInfoList) Add(name string, typ FileAttributeType, flags FileAttributeInfoFlags) { + var _arg0 *C.GFileAttributeInfoList // out + var _arg1 *C.char // out + var _arg2 C.GFileAttributeType // out + var _arg3 C.GFileAttributeInfoFlags // out + + _arg0 = (*C.GFileAttributeInfoList)(gextras.StructNative(unsafe.Pointer(list))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileAttributeType(typ) + _arg3 = C.GFileAttributeInfoFlags(flags) + + C.g_file_attribute_info_list_add(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(list) + runtime.KeepAlive(name) + runtime.KeepAlive(typ) + runtime.KeepAlive(flags) +} + +// Dup makes a duplicate of a file attribute info list. +// +// The function returns the following values: +// +// - fileAttributeInfoList: copy of the given list. +func (list *FileAttributeInfoList) Dup() *FileAttributeInfoList { + var _arg0 *C.GFileAttributeInfoList // out + var _cret *C.GFileAttributeInfoList // in + + _arg0 = (*C.GFileAttributeInfoList)(gextras.StructNative(unsafe.Pointer(list))) + + _cret = C.g_file_attribute_info_list_dup(_arg0) + runtime.KeepAlive(list) + + var _fileAttributeInfoList *FileAttributeInfoList // out + + _fileAttributeInfoList = (*FileAttributeInfoList)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileAttributeInfoList)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_file_attribute_info_list_unref((*C.GFileAttributeInfoList)(intern.C)) + }, + ) + + return _fileAttributeInfoList +} + +// Lookup gets the file attribute with the name name from list. +// +// The function takes the following parameters: +// +// - name of the attribute to look up. +// +// The function returns the following values: +// +// - fileAttributeInfo for the name, or NULL if an attribute isn't found. +func (list *FileAttributeInfoList) Lookup(name string) *FileAttributeInfo { + var _arg0 *C.GFileAttributeInfoList // out + var _arg1 *C.char // out + var _cret *C.GFileAttributeInfo // in + + _arg0 = (*C.GFileAttributeInfoList)(gextras.StructNative(unsafe.Pointer(list))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_attribute_info_list_lookup(_arg0, _arg1) + runtime.KeepAlive(list) + runtime.KeepAlive(name) + + var _fileAttributeInfo *FileAttributeInfo // out + + _fileAttributeInfo = (*FileAttributeInfo)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _fileAttributeInfo +} + +// FileAttributeMatcher determines if a string matches a file attribute. +// +// An instance of this type is always passed by reference. +type FileAttributeMatcher struct { + *fileAttributeMatcher +} + +// fileAttributeMatcher is the struct that's finalized. +type fileAttributeMatcher struct { + native *C.GFileAttributeMatcher +} + +func marshalFileAttributeMatcher(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &FileAttributeMatcher{&fileAttributeMatcher{(*C.GFileAttributeMatcher)(b)}}, nil +} + +// NewFileAttributeMatcher constructs a struct FileAttributeMatcher. +func NewFileAttributeMatcher(attributes string) *FileAttributeMatcher { + var _arg1 *C.char // out + var _cret *C.GFileAttributeMatcher // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_attribute_matcher_new(_arg1) + runtime.KeepAlive(attributes) + + var _fileAttributeMatcher *FileAttributeMatcher // out + + _fileAttributeMatcher = (*FileAttributeMatcher)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileAttributeMatcher)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_file_attribute_matcher_unref((*C.GFileAttributeMatcher)(intern.C)) + }, + ) + + return _fileAttributeMatcher +} + +// EnumerateNamespace checks if the matcher will match all of the keys in a +// given namespace. This will always return TRUE if a wildcard character is in +// use (e.g. if matcher was created with "standard::*" and ns is "standard", +// or if matcher was created using "*" and namespace is anything.) +// +// TODO: this is awkwardly worded. +// +// The function takes the following parameters: +// +// - ns: string containing a file attribute namespace. +// +// The function returns the following values: +// +// - ok: TRUE if the matcher matches all of the entries in the given ns, +// FALSE otherwise. +func (matcher *FileAttributeMatcher) EnumerateNamespace(ns string) bool { + var _arg0 *C.GFileAttributeMatcher // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileAttributeMatcher)(gextras.StructNative(unsafe.Pointer(matcher))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(ns))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_attribute_matcher_enumerate_namespace(_arg0, _arg1) + runtime.KeepAlive(matcher) + runtime.KeepAlive(ns) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// EnumerateNext gets the next matched attribute from a AttributeMatcher. +// +// The function returns the following values: +// +// - utf8 (optional): string containing the next attribute or, NULL if no more +// attribute exist. +func (matcher *FileAttributeMatcher) EnumerateNext() string { + var _arg0 *C.GFileAttributeMatcher // out + var _cret *C.char // in + + _arg0 = (*C.GFileAttributeMatcher)(gextras.StructNative(unsafe.Pointer(matcher))) + + _cret = C.g_file_attribute_matcher_enumerate_next(_arg0) + runtime.KeepAlive(matcher) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Matches checks if an attribute will be matched by an attribute matcher. +// If the matcher was created with the "*" matching string, this function will +// always return TRUE. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - ok: TRUE if attribute matches matcher. FALSE otherwise. +func (matcher *FileAttributeMatcher) Matches(attribute string) bool { + var _arg0 *C.GFileAttributeMatcher // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileAttributeMatcher)(gextras.StructNative(unsafe.Pointer(matcher))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_attribute_matcher_matches(_arg0, _arg1) + runtime.KeepAlive(matcher) + runtime.KeepAlive(attribute) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// MatchesOnly checks if an attribute matcher only matches a given attribute. +// Always returns FALSE if "*" was used when creating the matcher. +// +// The function takes the following parameters: +// +// - attribute: file attribute key. +// +// The function returns the following values: +// +// - ok: TRUE if the matcher only matches attribute. FALSE otherwise. +func (matcher *FileAttributeMatcher) MatchesOnly(attribute string) bool { + var _arg0 *C.GFileAttributeMatcher // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GFileAttributeMatcher)(gextras.StructNative(unsafe.Pointer(matcher))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_attribute_matcher_matches_only(_arg0, _arg1) + runtime.KeepAlive(matcher) + runtime.KeepAlive(attribute) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Subtract subtracts all attributes of subtract from matcher and returns a +// matcher that supports those attributes. +// +// Note that currently it is not possible to remove a single attribute when the +// matcher matches the whole namespace - or remove a namespace or attribute +// when the matcher matches everything. This is a limitation of the current +// implementation, but may be fixed in the future. +// +// The function takes the following parameters: +// +// - subtract (optional): matcher to subtract. +// +// The function returns the following values: +// +// - fileAttributeMatcher (optional): file attribute matcher matching all +// attributes of matcher that are not matched by subtract. +func (matcher *FileAttributeMatcher) Subtract(subtract *FileAttributeMatcher) *FileAttributeMatcher { + var _arg0 *C.GFileAttributeMatcher // out + var _arg1 *C.GFileAttributeMatcher // out + var _cret *C.GFileAttributeMatcher // in + + if matcher != nil { + _arg0 = (*C.GFileAttributeMatcher)(gextras.StructNative(unsafe.Pointer(matcher))) + } + if subtract != nil { + _arg1 = (*C.GFileAttributeMatcher)(gextras.StructNative(unsafe.Pointer(subtract))) + } + + _cret = C.g_file_attribute_matcher_subtract(_arg0, _arg1) + runtime.KeepAlive(matcher) + runtime.KeepAlive(subtract) + + var _fileAttributeMatcher *FileAttributeMatcher // out + + if _cret != nil { + _fileAttributeMatcher = (*FileAttributeMatcher)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fileAttributeMatcher)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_file_attribute_matcher_unref((*C.GFileAttributeMatcher)(intern.C)) + }, + ) + } + + return _fileAttributeMatcher +} + +// String prints what the matcher is matching against. The format will be equal +// to the format passed to g_file_attribute_matcher_new(). The output however, +// might not be identical, as the matcher may decide to use a different order or +// omit needless parts. +// +// The function returns the following values: +// +// - utf8: string describing the attributes the matcher matches against or +// NULL if matcher was NULL. +func (matcher *FileAttributeMatcher) String() string { + var _arg0 *C.GFileAttributeMatcher // out + var _cret *C.char // in + + if matcher != nil { + _arg0 = (*C.GFileAttributeMatcher)(gextras.StructNative(unsafe.Pointer(matcher))) + } + + _cret = C.g_file_attribute_matcher_to_string(_arg0) + runtime.KeepAlive(matcher) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// FileEnumeratorClass: instance of this type is always passed by reference. +type FileEnumeratorClass struct { + *fileEnumeratorClass +} + +// fileEnumeratorClass is the struct that's finalized. +type fileEnumeratorClass struct { + native *C.GFileEnumeratorClass +} + +// FileIOStreamClass: instance of this type is always passed by reference. +type FileIOStreamClass struct { + *fileIOStreamClass +} + +// fileIOStreamClass is the struct that's finalized. +type fileIOStreamClass struct { + native *C.GFileIOStreamClass +} + +func (f *FileIOStreamClass) ParentClass() *IOStreamClass { + valptr := &f.native.parent_class + var _v *IOStreamClass // out + _v = (*IOStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// FileIface: interface for writing VFS file handles. +// +// An instance of this type is always passed by reference. +type FileIface struct { + *fileIface +} + +// fileIface is the struct that's finalized. +type fileIface struct { + native *C.GFileIface +} + +// SupportsThreadContexts: boolean that indicates whether the #GFile +// implementation supports thread-default contexts. Since 2.22. +func (f *FileIface) SupportsThreadContexts() bool { + valptr := &f.native.supports_thread_contexts + var _v bool // out + if *valptr != 0 { + _v = true + } + return _v +} + +// FileInputStreamClass: instance of this type is always passed by reference. +type FileInputStreamClass struct { + *fileInputStreamClass +} + +// fileInputStreamClass is the struct that's finalized. +type fileInputStreamClass struct { + native *C.GFileInputStreamClass +} + +func (f *FileInputStreamClass) ParentClass() *InputStreamClass { + valptr := &f.native.parent_class + var _v *InputStreamClass // out + _v = (*InputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// FileMonitorClass: instance of this type is always passed by reference. +type FileMonitorClass struct { + *fileMonitorClass +} + +// fileMonitorClass is the struct that's finalized. +type fileMonitorClass struct { + native *C.GFileMonitorClass +} + +// FileOutputStreamClass: instance of this type is always passed by reference. +type FileOutputStreamClass struct { + *fileOutputStreamClass +} + +// fileOutputStreamClass is the struct that's finalized. +type fileOutputStreamClass struct { + native *C.GFileOutputStreamClass +} + +func (f *FileOutputStreamClass) ParentClass() *OutputStreamClass { + valptr := &f.native.parent_class + var _v *OutputStreamClass // out + _v = (*OutputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// FilenameCompleterClass: instance of this type is always passed by reference. +type FilenameCompleterClass struct { + *filenameCompleterClass +} + +// filenameCompleterClass is the struct that's finalized. +type filenameCompleterClass struct { + native *C.GFilenameCompleterClass +} + +// FilterInputStreamClass: instance of this type is always passed by reference. +type FilterInputStreamClass struct { + *filterInputStreamClass +} + +// filterInputStreamClass is the struct that's finalized. +type filterInputStreamClass struct { + native *C.GFilterInputStreamClass +} + +func (f *FilterInputStreamClass) ParentClass() *InputStreamClass { + valptr := &f.native.parent_class + var _v *InputStreamClass // out + _v = (*InputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// FilterOutputStreamClass: instance of this type is always passed by reference. +type FilterOutputStreamClass struct { + *filterOutputStreamClass +} + +// filterOutputStreamClass is the struct that's finalized. +type filterOutputStreamClass struct { + native *C.GFilterOutputStreamClass +} + +func (f *FilterOutputStreamClass) ParentClass() *OutputStreamClass { + valptr := &f.native.parent_class + var _v *OutputStreamClass // out + _v = (*OutputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// IOStreamClass: instance of this type is always passed by reference. +type IOStreamClass struct { + *ioStreamClass +} + +// ioStreamClass is the struct that's finalized. +type ioStreamClass struct { + native *C.GIOStreamClass +} + +// IconIface is used to implement GIcon types for various different systems. +// See Icon and Icon for examples of how to implement this interface. +// +// An instance of this type is always passed by reference. +type IconIface struct { + *iconIface +} + +// iconIface is the struct that's finalized. +type iconIface struct { + native *C.GIconIface +} + +// InetAddressClass: instance of this type is always passed by reference. +type InetAddressClass struct { + *inetAddressClass +} + +// inetAddressClass is the struct that's finalized. +type inetAddressClass struct { + native *C.GInetAddressClass +} + +// InetAddressMaskClass: instance of this type is always passed by reference. +type InetAddressMaskClass struct { + *inetAddressMaskClass +} + +// inetAddressMaskClass is the struct that's finalized. +type inetAddressMaskClass struct { + native *C.GInetAddressMaskClass +} + +// InetSocketAddressClass: instance of this type is always passed by reference. +type InetSocketAddressClass struct { + *inetSocketAddressClass +} + +// inetSocketAddressClass is the struct that's finalized. +type inetSocketAddressClass struct { + native *C.GInetSocketAddressClass +} + +func (i *InetSocketAddressClass) ParentClass() *SocketAddressClass { + valptr := &i.native.parent_class + var _v *SocketAddressClass // out + _v = (*SocketAddressClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// InitableIface provides an interface for initializing object such that +// initialization may fail. +// +// An instance of this type is always passed by reference. +type InitableIface struct { + *initableIface +} + +// initableIface is the struct that's finalized. +type initableIface struct { + native *C.GInitableIface +} + +// InputMessage: structure used for scatter/gather data input when receiving +// multiple messages or packets in one go. You generally pass in an array of +// empty Vectors and the operation will use all the buffers as if they were one +// buffer, and will set bytes_received to the total number of bytes received +// across all Vectors. +// +// This structure closely mirrors struct mmsghdr and struct msghdr from the +// POSIX sockets API (see man 2 recvmmsg). +// +// If address is non-NULL then it is set to the source address the message was +// received from, and the caller must free it afterwards. +// +// If control_messages is non-NULL then it is set to an array of control +// messages received with the message (if any), and the caller must free it +// afterwards. num_control_messages is set to the number of elements in this +// array, which may be zero. +// +// Flags relevant to this message will be returned in flags. For example, +// MSG_EOR or MSG_TRUNC. +// +// An instance of this type is always passed by reference. +type InputMessage struct { + *inputMessage +} + +// inputMessage is the struct that's finalized. +type inputMessage struct { + native *C.GInputMessage +} + +// InputStreamClass: instance of this type is always passed by reference. +type InputStreamClass struct { + *inputStreamClass +} + +// inputStreamClass is the struct that's finalized. +type inputStreamClass struct { + native *C.GInputStreamClass +} + +// InputVector: structure used for scatter/gather data input. You generally pass +// in an array of Vectors and the operation will store the read data starting in +// the first buffer, switching to the next as needed. +// +// An instance of this type is always passed by reference. +type InputVector struct { + *inputVector +} + +// inputVector is the struct that's finalized. +type inputVector struct { + native *C.GInputVector +} + +// Buffer: pointer to a buffer where data will be written. +func (i *InputVector) Buffer() unsafe.Pointer { + valptr := &i.native.buffer + var _v unsafe.Pointer // out + _v = (unsafe.Pointer)(unsafe.Pointer(*valptr)) + return _v +} + +// Size: available size in buffer. +func (i *InputVector) Size() uint { + valptr := &i.native.size + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Size: available size in buffer. +func (i *InputVector) SetSize(size uint) { + valptr := &i.native.size + *valptr = C.gsize(size) +} + +// ListModelInterface: virtual function table for Model. +// +// An instance of this type is always passed by reference. +type ListModelInterface struct { + *listModelInterface +} + +// listModelInterface is the struct that's finalized. +type listModelInterface struct { + native *C.GListModelInterface +} + +// ListStoreClass: instance of this type is always passed by reference. +type ListStoreClass struct { + *listStoreClass +} + +// listStoreClass is the struct that's finalized. +type listStoreClass struct { + native *C.GListStoreClass +} + +// LoadableIconIface: interface for icons that can be loaded as a stream. +// +// An instance of this type is always passed by reference. +type LoadableIconIface struct { + *loadableIconIface +} + +// loadableIconIface is the struct that's finalized. +type loadableIconIface struct { + native *C.GLoadableIconIface +} + +// MemoryInputStreamClass: instance of this type is always passed by reference. +type MemoryInputStreamClass struct { + *memoryInputStreamClass +} + +// memoryInputStreamClass is the struct that's finalized. +type memoryInputStreamClass struct { + native *C.GMemoryInputStreamClass +} + +func (m *MemoryInputStreamClass) ParentClass() *InputStreamClass { + valptr := &m.native.parent_class + var _v *InputStreamClass // out + _v = (*InputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// MemoryMonitorInterface: virtual function table for Monitor. +// +// An instance of this type is always passed by reference. +type MemoryMonitorInterface struct { + *memoryMonitorInterface +} + +// memoryMonitorInterface is the struct that's finalized. +type memoryMonitorInterface struct { + native *C.GMemoryMonitorInterface +} + +// MemoryOutputStreamClass: instance of this type is always passed by reference. +type MemoryOutputStreamClass struct { + *memoryOutputStreamClass +} + +// memoryOutputStreamClass is the struct that's finalized. +type memoryOutputStreamClass struct { + native *C.GMemoryOutputStreamClass +} + +func (m *MemoryOutputStreamClass) ParentClass() *OutputStreamClass { + valptr := &m.native.parent_class + var _v *OutputStreamClass // out + _v = (*OutputStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// MenuAttributeIterClass: instance of this type is always passed by reference. +type MenuAttributeIterClass struct { + *menuAttributeIterClass +} + +// menuAttributeIterClass is the struct that's finalized. +type menuAttributeIterClass struct { + native *C.GMenuAttributeIterClass +} + +// MenuLinkIterClass: instance of this type is always passed by reference. +type MenuLinkIterClass struct { + *menuLinkIterClass +} + +// menuLinkIterClass is the struct that's finalized. +type menuLinkIterClass struct { + native *C.GMenuLinkIterClass +} + +// MenuModelClass: instance of this type is always passed by reference. +type MenuModelClass struct { + *menuModelClass +} + +// menuModelClass is the struct that's finalized. +type menuModelClass struct { + native *C.GMenuModelClass +} + +// MountIface: interface for implementing operations for mounts. +// +// An instance of this type is always passed by reference. +type MountIface struct { + *mountIface +} + +// mountIface is the struct that's finalized. +type mountIface struct { + native *C.GMountIface +} + +// MountOperationClass: instance of this type is always passed by reference. +type MountOperationClass struct { + *mountOperationClass +} + +// mountOperationClass is the struct that's finalized. +type mountOperationClass struct { + native *C.GMountOperationClass +} + +// NativeSocketAddressClass: instance of this type is always passed by +// reference. +type NativeSocketAddressClass struct { + *nativeSocketAddressClass +} + +// nativeSocketAddressClass is the struct that's finalized. +type nativeSocketAddressClass struct { + native *C.GNativeSocketAddressClass +} + +func (n *NativeSocketAddressClass) ParentClass() *SocketAddressClass { + valptr := &n.native.parent_class + var _v *SocketAddressClass // out + _v = (*SocketAddressClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// NativeVolumeMonitorClass: instance of this type is always passed by +// reference. +type NativeVolumeMonitorClass struct { + *nativeVolumeMonitorClass +} + +// nativeVolumeMonitorClass is the struct that's finalized. +type nativeVolumeMonitorClass struct { + native *C.GNativeVolumeMonitorClass +} + +func (n *NativeVolumeMonitorClass) ParentClass() *VolumeMonitorClass { + valptr := &n.native.parent_class + var _v *VolumeMonitorClass // out + _v = (*VolumeMonitorClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// NetworkAddressClass: instance of this type is always passed by reference. +type NetworkAddressClass struct { + *networkAddressClass +} + +// networkAddressClass is the struct that's finalized. +type networkAddressClass struct { + native *C.GNetworkAddressClass +} + +// NetworkMonitorInterface: virtual function table for Monitor. +// +// An instance of this type is always passed by reference. +type NetworkMonitorInterface struct { + *networkMonitorInterface +} + +// networkMonitorInterface is the struct that's finalized. +type networkMonitorInterface struct { + native *C.GNetworkMonitorInterface +} + +// NetworkServiceClass: instance of this type is always passed by reference. +type NetworkServiceClass struct { + *networkServiceClass +} + +// networkServiceClass is the struct that's finalized. +type networkServiceClass struct { + native *C.GNetworkServiceClass +} + +// OutputMessage: structure used for scatter/gather data output when sending +// multiple messages or packets in one go. You generally pass in an array +// of Vectors and the operation will use all the buffers as if they were one +// buffer. +// +// If address is NULL then the message is sent to the default receiver (as +// previously set by g_socket_connect()). +// +// An instance of this type is always passed by reference. +type OutputMessage struct { + *outputMessage +} + +// outputMessage is the struct that's finalized. +type outputMessage struct { + native *C.GOutputMessage +} + +// OutputStreamClass: instance of this type is always passed by reference. +type OutputStreamClass struct { + *outputStreamClass +} + +// outputStreamClass is the struct that's finalized. +type outputStreamClass struct { + native *C.GOutputStreamClass +} + +// OutputVector: structure used for scatter/gather data output. You generally +// pass in an array of Vectors and the operation will use all the buffers as if +// they were one buffer. +// +// An instance of this type is always passed by reference. +type OutputVector struct { + *outputVector +} + +// outputVector is the struct that's finalized. +type outputVector struct { + native *C.GOutputVector +} + +// Buffer: pointer to a buffer of data to read. +func (o *OutputVector) Buffer() unsafe.Pointer { + valptr := &o.native.buffer + var _v unsafe.Pointer // out + _v = (unsafe.Pointer)(unsafe.Pointer(*valptr)) + return _v +} + +// Size: size of buffer. +func (o *OutputVector) Size() uint { + valptr := &o.native.size + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Size: size of buffer. +func (o *OutputVector) SetSize(size uint) { + valptr := &o.native.size + *valptr = C.gsize(size) +} + +// PermissionClass: instance of this type is always passed by reference. +type PermissionClass struct { + *permissionClass +} + +// permissionClass is the struct that's finalized. +type permissionClass struct { + native *C.GPermissionClass +} + +func (p *PermissionClass) Reserved() [16]unsafe.Pointer { + valptr := &p.native.reserved + var _v [16]unsafe.Pointer // out + { + src := &*valptr + for i := 0; i < 16; i++ { + _v[i] = (unsafe.Pointer)(unsafe.Pointer(src[i])) + } + } + return _v +} + +// PollableInputStreamInterface: interface for pollable input streams. +// +// The default implementation of can_poll always returns TRUE. +// +// The default implementation of read_nonblocking calls +// g_pollable_input_stream_is_readable(), and then calls g_input_stream_read() +// if it returns TRUE. This means you only need to override it if it is possible +// that your is_readable implementation may return TRUE when the stream is not +// actually readable. +// +// An instance of this type is always passed by reference. +type PollableInputStreamInterface struct { + *pollableInputStreamInterface +} + +// pollableInputStreamInterface is the struct that's finalized. +type pollableInputStreamInterface struct { + native *C.GPollableInputStreamInterface +} + +// PollableOutputStreamInterface: interface for pollable output streams. +// +// The default implementation of can_poll always returns TRUE. +// +// The default implementation of write_nonblocking calls +// g_pollable_output_stream_is_writable(), and then calls +// g_output_stream_write() if it returns TRUE. This means you only need to +// override it if it is possible that your is_writable implementation may return +// TRUE when the stream is not actually writable. +// +// The default implementation of writev_nonblocking calls +// g_pollable_output_stream_write_nonblocking() for each vector, and converts +// its return value and error (if set) to a Return. You should override +// this where possible to avoid having to allocate a #GError to return +// G_IO_ERROR_WOULD_BLOCK. +// +// An instance of this type is always passed by reference. +type PollableOutputStreamInterface struct { + *pollableOutputStreamInterface +} + +// pollableOutputStreamInterface is the struct that's finalized. +type pollableOutputStreamInterface struct { + native *C.GPollableOutputStreamInterface +} + +// PowerProfileMonitorInterface: virtual function table for ProfileMonitor. +// +// An instance of this type is always passed by reference. +type PowerProfileMonitorInterface struct { + *powerProfileMonitorInterface +} + +// powerProfileMonitorInterface is the struct that's finalized. +type powerProfileMonitorInterface struct { + native *C.GPowerProfileMonitorInterface +} + +// ProxyAddressClass class structure for Address. +// +// An instance of this type is always passed by reference. +type ProxyAddressClass struct { + *proxyAddressClass +} + +// proxyAddressClass is the struct that's finalized. +type proxyAddressClass struct { + native *C.GProxyAddressClass +} + +func (p *ProxyAddressClass) ParentClass() *InetSocketAddressClass { + valptr := &p.native.parent_class + var _v *InetSocketAddressClass // out + _v = (*InetSocketAddressClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// ProxyAddressEnumeratorClass class structure for AddressEnumerator. +// +// An instance of this type is always passed by reference. +type ProxyAddressEnumeratorClass struct { + *proxyAddressEnumeratorClass +} + +// proxyAddressEnumeratorClass is the struct that's finalized. +type proxyAddressEnumeratorClass struct { + native *C.GProxyAddressEnumeratorClass +} + +// ProxyInterface provides an interface for handling proxy connection and +// payload. +// +// An instance of this type is always passed by reference. +type ProxyInterface struct { + *proxyInterface +} + +// proxyInterface is the struct that's finalized. +type proxyInterface struct { + native *C.GProxyInterface +} + +// ProxyResolverInterface: virtual function table for Resolver. +// +// An instance of this type is always passed by reference. +type ProxyResolverInterface struct { + *proxyResolverInterface +} + +// proxyResolverInterface is the struct that's finalized. +type proxyResolverInterface struct { + native *C.GProxyResolverInterface +} + +// RemoteActionGroupInterface: virtual function table for ActionGroup. +// +// An instance of this type is always passed by reference. +type RemoteActionGroupInterface struct { + *remoteActionGroupInterface +} + +// remoteActionGroupInterface is the struct that's finalized. +type remoteActionGroupInterface struct { + native *C.GRemoteActionGroupInterface +} + +// ResolverClass: instance of this type is always passed by reference. +type ResolverClass struct { + *resolverClass +} + +// resolverClass is the struct that's finalized. +type resolverClass struct { + native *C.GResolverClass +} + +// Resource applications and libraries often contain binary or textual data +// that is really part of the application, rather than user data. For instance +// GtkBuilder (https://docs.gtk.org/gtk4/class.Builder.html) .ui files, +// splashscreen images, gio.Menu markup XML, CSS files, icons, etc. These are +// often shipped as files in $datadir/appname, or manually included as literal +// strings in the code. +// +// The GResource API and the glib-compile-resources +// (glib-compile-resources.html) program provide a convenient and efficient +// alternative to this which has some nice properties. You maintain the files as +// normal files, so it’s easy to edit them, but during the build the files are +// combined into a binary bundle that is linked into the executable. This means +// that loading the resource files are efficient (as they are already in memory, +// shared with other instances) and simple (no need to check for things like +// I/O errors or locate the files in the filesystem). It also makes it easier to +// create relocatable applications. +// +// Resource files can also be marked as compressed. Such files will be included +// in the resource bundle in a compressed form, but will be automatically +// uncompressed when the resource is used. This is very useful e.g. for larger +// text files that are parsed once (or rarely) and then thrown away. +// +// Resource files can also be marked to be preprocessed, by setting the value of +// the preprocess attribute to a comma-separated list of preprocessing options. +// The only options currently supported are: +// +// - xml-stripblanks which will use the xmllint (man:xmllint(1)) command +// to strip ignorable whitespace from the XML file. For this to work, the +// XMLLINT environment variable must be set to the full path to the xmllint +// executable, or xmllint must be in the PATH; otherwise the preprocessing +// step is skipped. +// +// - to-pixdata (deprecated since gdk-pixbuf 2.32) which will use the +// gdk-pixbuf-pixdata command to convert images to the GdkPixdata +// (https://docs.gtk.org/gdk-pixbuf/class.Pixdata.html) format, +// which allows you to create pixbufs directly using the data inside +// the resource file, rather than an (uncompressed) copy of it. +// For this, the gdk-pixbuf-pixdata program must be in the PATH, or the +// GDK_PIXBUF_PIXDATA environment variable must be set to the full path to +// the gdk-pixbuf-pixdata executable; otherwise the resource compiler will +// abort. to-pixdata has been deprecated since gdk-pixbuf 2.32, as GResource +// supports embedding modern image formats just as well. Instead of using +// it, embed a PNG or SVG file in your GResource. +// +// - json-stripblanks which will use the json-glib-format +// (man:json-glib-format(1)) command to strip ignorable whitespace from +// the JSON file. For this to work, the JSON_GLIB_FORMAT environment +// variable must be set to the full path to the json-glib-format executable, +// or it must be in the PATH; otherwise the preprocessing step is skipped. +// In addition, at least version 1.6 of json-glib-format is required. +// +// Resource files will be exported in the GResource namespace using the +// combination of the given prefix and the filename from the file element. +// The alias attribute can be used to alter the filename to expose them at a +// different location in the resource namespace. Typically, this is used to +// include files from a different source directory without exposing the source +// directory in the resource namespace, as in the example below. +// +// Resource bundles are created by the glib-compile-resources +// (glib-compile-resources.html) program which takes an XML file that describes +// the bundle, and a set of files that the XML references. These are combined +// into a binary resource bundle. +// +// An example resource description: +// +// +// +// +// data/splashscreen.png +// dialog.ui +// menumarkup.xml +// data/example.css +// +// +// +// This will create a resource bundle with the following files: +// +// /org/gtk/Example/data/splashscreen.png +// /org/gtk/Example/dialog.ui +// /org/gtk/Example/menumarkup.xml +// /org/gtk/Example/example.css +// +// Note that all resources in the process share the same namespace, so use +// Java-style path prefixes (like in the above example) to avoid conflicts. +// +// You can then use glib-compile-resources (glib-compile-resources.html) +// to compile the XML to a binary bundle that you can load with +// gio.Resource().Load. However, it’s more common to use the --generate-source +// and --generate-header arguments to create a source file and header to +// link directly into your application. This will generate get_resource(), +// register_resource() and unregister_resource() functions, +// prefixed by the --c-name argument passed to glib-compile-resources +// (glib-compile-resources.html). get_resource() returns the generated GResource +// object. The register and unregister functions register the resource so its +// files can be accessed using gio.ResourcesLookupData(). +// +// Once a GResource has been created and registered all the data in +// it can be accessed globally in the process by using API calls like +// gio.ResourcesOpenStream() to stream the data or gio.ResourcesLookupData() +// to get a direct pointer to the data. You can also use URIs like +// resource:///org/gtk/Example/data/splashscreen.png with gio.File to access the +// resource data. +// +// Some higher-level APIs, such as GtkApplication +// (https://docs.gtk.org/gtk4/class.Application.html), will automatically +// load resources from certain well-known paths in the resource namespace as a +// convenience. See the documentation for those APIs for details. +// +// There are two forms of the generated source, the default version uses the +// compiler support for constructor and destructor functions (where available) +// to automatically create and register the GResource on startup or library load +// time. If you pass --manual-register, two functions to register/unregister the +// resource are created instead. This requires an explicit initialization call +// in your application/library, but it works on all platforms, even on the minor +// ones where constructors are not supported. (Constructor support is available +// for at least Win32, Mac OS and Linux.) +// +// Note that resource data can point directly into the data segment of e.g. +// a library, so if you are unloading libraries during runtime you need to be +// very careful with keeping around pointers to data from a resource, as this +// goes away when the library is unloaded. However, in practice this is not +// generally a problem, since most resource accesses are for your own resources, +// and resource data is often used once, during parsing, and then released. +// +// # Overlays +// +// When debugging a program or testing a change to an installed version, +// it is often useful to be able to replace resources in the program or library, +// without recompiling, for debugging or quick hacking and testing purposes. +// Since GLib 2.50, it is possible to use the G_RESOURCE_OVERLAYS environment +// variable to selectively overlay resources with replacements from the +// filesystem. It is a G_SEARCHPATH_SEPARATOR-separated list of substitutions +// to perform during resource lookups. It is ignored when running in a setuid +// process. +// +// A substitution has the form +// +// /org/gtk/libgtk=/home/desrt/gtk-overlay +// +// The part before the = is the resource subpath for which the overlay applies. +// The part after is a filesystem path which contains files and subdirectories +// as you would like to be loaded as resources with the equivalent names. +// +// In the example above, if an application tried to load a resource with the +// resource path /org/gtk/libgtk/ui/gtkdialog.ui then GResource would check +// the filesystem path /home/desrt/gtk-overlay/ui/gtkdialog.ui. If a file was +// found there, it would be used instead. This is an overlay, not an outright +// replacement, which means that if a file is not found at that path, the +// built-in version will be used instead. Whiteouts are not currently supported. +// +// Substitutions must start with a slash, and must not contain a trailing slash +// before the =. The path after the slash should ideally be absolute, but this +// is not strictly required. It is possible to overlay the location of a single +// resource with an individual file. +// +// An instance of this type is always passed by reference. +type Resource struct { + *resource +} + +// resource is the struct that's finalized. +type resource struct { + native *C.GResource +} + +func marshalResource(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Resource{&resource{(*C.GResource)(b)}}, nil +} + +// NewResourceFromData constructs a struct Resource. +func NewResourceFromData(data *glib.Bytes) (*Resource, error) { + var _arg1 *C.GBytes // out + var _cret *C.GResource // in + var _cerr *C.GError // in + + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(data))) + + _cret = C.g_resource_new_from_data(_arg1, &_cerr) + runtime.KeepAlive(data) + + var _resource *Resource // out + var _goerr error // out + + _resource = (*Resource)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_resource)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_resource_unref((*C.GResource)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _resource, _goerr +} + +// EnumerateChildren returns all the names of children at the specified path in +// the resource. The return result is a NULL terminated list of strings which +// should be released with g_strfreev(). +// +// If path is invalid or does not exist in the #GResource, +// G_RESOURCE_ERROR_NOT_FOUND will be returned. +// +// lookup_flags controls the behaviour of the lookup. +// +// The function takes the following parameters: +// +// - path: pathname inside the resource. +// - lookupFlags: LookupFlags. +// +// The function returns the following values: +// +// - utf8s: array of constant strings. +func (resource *Resource) EnumerateChildren(path string, lookupFlags ResourceLookupFlags) ([]string, error) { + var _arg0 *C.GResource // out + var _arg1 *C.char // out + var _arg2 C.GResourceLookupFlags // out + var _cret **C.char // in + var _cerr *C.GError // in + + _arg0 = (*C.GResource)(gextras.StructNative(unsafe.Pointer(resource))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResourceLookupFlags(lookupFlags) + + _cret = C.g_resource_enumerate_children(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(resource) + runtime.KeepAlive(path) + runtime.KeepAlive(lookupFlags) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// Info looks for a file at the specified path in the resource and if found +// returns information about it. +// +// lookup_flags controls the behaviour of the lookup. +// +// The function takes the following parameters: +// +// - path: pathname inside the resource. +// - lookupFlags: LookupFlags. +// +// The function returns the following values: +// +// - size (optional): location to place the length of the contents of the +// file, or NULL if the length is not needed. +// - flags (optional): location to place the flags about the file, or NULL if +// the length is not needed. +func (resource *Resource) Info(path string, lookupFlags ResourceLookupFlags) (uint, uint32, error) { + var _arg0 *C.GResource // out + var _arg1 *C.char // out + var _arg2 C.GResourceLookupFlags // out + var _arg3 C.gsize // in + var _arg4 C.guint32 // in + var _cerr *C.GError // in + + _arg0 = (*C.GResource)(gextras.StructNative(unsafe.Pointer(resource))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResourceLookupFlags(lookupFlags) + + C.g_resource_get_info(_arg0, _arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(resource) + runtime.KeepAlive(path) + runtime.KeepAlive(lookupFlags) + + var _size uint // out + var _flags uint32 // out + var _goerr error // out + + _size = uint(_arg3) + _flags = uint32(_arg4) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _size, _flags, _goerr +} + +// LookupData looks for a file at the specified path in the resource and returns +// a #GBytes that lets you directly access the data in memory. +// +// The data is always followed by a zero byte, so you can safely use the data as +// a C string. However, that byte is not included in the size of the GBytes. +// +// For uncompressed resource files this is a pointer directly into the resource +// bundle, which is typically in some readonly data section in the program +// binary. For compressed files we allocate memory on the heap and automatically +// uncompress the data. +// +// lookup_flags controls the behaviour of the lookup. +// +// The function takes the following parameters: +// +// - path: pathname inside the resource. +// - lookupFlags: LookupFlags. +// +// The function returns the following values: +// +// - bytes or NULL on error. Free the returned object with g_bytes_unref(). +func (resource *Resource) LookupData(path string, lookupFlags ResourceLookupFlags) (*glib.Bytes, error) { + var _arg0 *C.GResource // out + var _arg1 *C.char // out + var _arg2 C.GResourceLookupFlags // out + var _cret *C.GBytes // in + var _cerr *C.GError // in + + _arg0 = (*C.GResource)(gextras.StructNative(unsafe.Pointer(resource))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResourceLookupFlags(lookupFlags) + + _cret = C.g_resource_lookup_data(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(resource) + runtime.KeepAlive(path) + runtime.KeepAlive(lookupFlags) + + var _bytes *glib.Bytes // out + var _goerr error // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytes, _goerr +} + +// OpenStream looks for a file at the specified path in the resource and returns +// a Stream that lets you read the data. +// +// lookup_flags controls the behaviour of the lookup. +// +// The function takes the following parameters: +// +// - path: pathname inside the resource. +// - lookupFlags: LookupFlags. +// +// The function returns the following values: +// +// - inputStream or NULL on error. Free the returned object with +// g_object_unref(). +func (resource *Resource) OpenStream(path string, lookupFlags ResourceLookupFlags) (InputStreamer, error) { + var _arg0 *C.GResource // out + var _arg1 *C.char // out + var _arg2 C.GResourceLookupFlags // out + var _cret *C.GInputStream // in + var _cerr *C.GError // in + + _arg0 = (*C.GResource)(gextras.StructNative(unsafe.Pointer(resource))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GResourceLookupFlags(lookupFlags) + + _cret = C.g_resource_open_stream(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(resource) + runtime.KeepAlive(path) + runtime.KeepAlive(lookupFlags) + + var _inputStream InputStreamer // out + var _goerr error // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _inputStream = rv + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _inputStream, _goerr +} + +// ResourceLoad loads a binary resource bundle and creates a #GResource +// representation of it, allowing you to query it for data. +// +// If you want to use this resource in the global resource namespace you need to +// register it with g_resources_register(). +// +// If filename is empty or the data in it is corrupt, G_RESOURCE_ERROR_INTERNAL +// will be returned. If filename doesn’t exist, or there is an error in reading +// it, an error from g_mapped_file_new() will be returned. +// +// The function takes the following parameters: +// +// - filename: path of a filename to load, in the GLib filename encoding. +// +// The function returns the following values: +// +// - resource: new #GResource, or NULL on error. +func ResourceLoad(filename string) (*Resource, error) { + var _arg1 *C.gchar // out + var _cret *C.GResource // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_resource_load(_arg1, &_cerr) + runtime.KeepAlive(filename) + + var _resource *Resource // out + var _goerr error // out + + _resource = (*Resource)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_resource)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_resource_unref((*C.GResource)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _resource, _goerr +} + +// SeekableIface provides an interface for implementing seekable functionality +// on I/O Streams. +// +// An instance of this type is always passed by reference. +type SeekableIface struct { + *seekableIface +} + +// seekableIface is the struct that's finalized. +type seekableIface struct { + native *C.GSeekableIface +} + +// SettingsClass: instance of this type is always passed by reference. +type SettingsClass struct { + *settingsClass +} + +// settingsClass is the struct that's finalized. +type settingsClass struct { + native *C.GSettingsClass +} + +func (s *SettingsClass) Padding() [20]unsafe.Pointer { + valptr := &s.native.padding + var _v [20]unsafe.Pointer // out + { + src := &*valptr + for i := 0; i < 20; i++ { + _v[i] = (unsafe.Pointer)(unsafe.Pointer(src[i])) + } + } + return _v +} + +// SettingsSchema: gio.SettingsSchemaSource and GSettingsSchema APIs provide a +// mechanism for advanced control over the loading of schemas and a mechanism +// for introspecting their content. +// +// Plugin loading systems that wish to provide plugins a way to access settings +// face the problem of how to make the schemas for these settings visible to +// GSettings. Typically, a plugin will want to ship the schema along with itself +// and it won't be installed into the standard system directories for schemas. +// +// gio.SettingsSchemaSource provides a mechanism for dealing with this by +// allowing the creation of a new ‘schema source’ from which schemas can be +// acquired. This schema source can then become part of the metadata associated +// with the plugin and queried whenever the plugin requires access to some +// settings. +// +// Consider the following example: +// +// typedef struct +// { +// … +// GSettingsSchemaSource *schema_source; +// … +// } Plugin; +// +// Plugin * +// initialise_plugin (const gchar *dir) +// { +// Plugin *plugin; +// +// … +// +// plugin->schema_source = +// g_settings_schema_source_new_from_directory (dir, +// g_settings_schema_source_get_default (), FALSE, NULL); +// +// … +// +// return plugin; +// } +// +// … +// +// GSettings * +// plugin_get_settings (Plugin *plugin, +// const gchar *schema_id) +// { +// GSettingsSchema *schema; +// +// if (schema_id == NULL) +// schema_id = plugin->identifier; +// +// schema = g_settings_schema_source_lookup (plugin->schema_source, +// schema_id, FALSE); +// +// if (schema == NULL) +// { +// … disable the plugin or abort, etc … +// } +// +// return g_settings_new_full (schema, NULL, NULL); +// } +// +// The code above shows how hooks should be added to the code that initialises +// (or enables) the plugin to create the schema source and how an API can be +// added to the plugin system to provide a convenient way for the plugin to +// access its settings, using the schemas that it ships. +// +// From the standpoint of the plugin, it would need to ensure that it ships a +// gschemas.compiled file as part of itself, and then simply do the following: +// +// { +// GSettings *settings; +// gint some_value; +// +// settings = plugin_get_settings (self, NULL); +// some_value = g_settings_get_int (settings, "some-value"); +// … +// } +// +// It's also possible that the plugin system expects the schema source files +// (ie: .gschema.xml files) instead of a gschemas.compiled file. In that case, +// the plugin loading system must compile the schemas for itself before +// attempting to create the settings source. +// +// An instance of this type is always passed by reference. +type SettingsSchema struct { + *settingsSchema +} + +// settingsSchema is the struct that's finalized. +type settingsSchema struct { + native *C.GSettingsSchema +} + +func marshalSettingsSchema(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &SettingsSchema{&settingsSchema{(*C.GSettingsSchema)(b)}}, nil +} + +// ID: get the ID of schema. +// +// The function returns the following values: +// +// - utf8: ID. +func (schema *SettingsSchema) ID() string { + var _arg0 *C.GSettingsSchema // out + var _cret *C.gchar // in + + _arg0 = (*C.GSettingsSchema)(gextras.StructNative(unsafe.Pointer(schema))) + + _cret = C.g_settings_schema_get_id(_arg0) + runtime.KeepAlive(schema) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Key gets the key named name from schema. +// +// It is a programmer error to request a key that does not exist. See +// g_settings_schema_list_keys(). +// +// The function takes the following parameters: +// +// - name of a key. +// +// The function returns the following values: +// +// - settingsSchemaKey for name. +func (schema *SettingsSchema) Key(name string) *SettingsSchemaKey { + var _arg0 *C.GSettingsSchema // out + var _arg1 *C.gchar // out + var _cret *C.GSettingsSchemaKey // in + + _arg0 = (*C.GSettingsSchema)(gextras.StructNative(unsafe.Pointer(schema))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_schema_get_key(_arg0, _arg1) + runtime.KeepAlive(schema) + runtime.KeepAlive(name) + + var _settingsSchemaKey *SettingsSchemaKey // out + + _settingsSchemaKey = (*SettingsSchemaKey)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_settingsSchemaKey)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_settings_schema_key_unref((*C.GSettingsSchemaKey)(intern.C)) + }, + ) + + return _settingsSchemaKey +} + +// Path gets the path associated with schema, or NULL. +// +// Schemas may be single-instance or relocatable. Single-instance schemas +// correspond to exactly one set of keys in the backend database: those located +// at the path returned by this function. +// +// Relocatable schemas can be referenced by other schemas and can therefore +// describe multiple sets of keys at different locations. For relocatable +// schemas, this function will return NULL. +// +// The function returns the following values: +// +// - utf8 (optional): path of the schema, or NULL. +func (schema *SettingsSchema) Path() string { + var _arg0 *C.GSettingsSchema // out + var _cret *C.gchar // in + + _arg0 = (*C.GSettingsSchema)(gextras.StructNative(unsafe.Pointer(schema))) + + _cret = C.g_settings_schema_get_path(_arg0) + runtime.KeepAlive(schema) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// HasKey checks if schema has a key named name. +// +// The function takes the following parameters: +// +// - name of a key. +// +// The function returns the following values: +// +// - ok: TRUE if such a key exists. +func (schema *SettingsSchema) HasKey(name string) bool { + var _arg0 *C.GSettingsSchema // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettingsSchema)(gextras.StructNative(unsafe.Pointer(schema))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_settings_schema_has_key(_arg0, _arg1) + runtime.KeepAlive(schema) + runtime.KeepAlive(name) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ListChildren gets the list of children in schema. +// +// You should free the return value with g_strfreev() when you are done with it. +// +// The function returns the following values: +// +// - utf8s: list of the children on settings, in no defined order. +func (schema *SettingsSchema) ListChildren() []string { + var _arg0 *C.GSettingsSchema // out + var _cret **C.gchar // in + + _arg0 = (*C.GSettingsSchema)(gextras.StructNative(unsafe.Pointer(schema))) + + _cret = C.g_settings_schema_list_children(_arg0) + runtime.KeepAlive(schema) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// ListKeys introspects the list of keys on schema. +// +// You should probably not be calling this function from "normal" code (since +// you should already know what keys are in your schema). This function is +// intended for introspection reasons. +// +// The function returns the following values: +// +// - utf8s: list of the keys on schema, in no defined order. +func (schema *SettingsSchema) ListKeys() []string { + var _arg0 *C.GSettingsSchema // out + var _cret **C.gchar // in + + _arg0 = (*C.GSettingsSchema)(gextras.StructNative(unsafe.Pointer(schema))) + + _cret = C.g_settings_schema_list_keys(_arg0) + runtime.KeepAlive(schema) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// SettingsSchemaKey is an opaque data structure and can only be accessed using +// the following functions. +// +// An instance of this type is always passed by reference. +type SettingsSchemaKey struct { + *settingsSchemaKey +} + +// settingsSchemaKey is the struct that's finalized. +type settingsSchemaKey struct { + native *C.GSettingsSchemaKey +} + +func marshalSettingsSchemaKey(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &SettingsSchemaKey{&settingsSchemaKey{(*C.GSettingsSchemaKey)(b)}}, nil +} + +// DefaultValue gets the default value for key. +// +// Note that this is the default value according to the schema. System +// administrator defaults and lockdown are not visible via this API. +// +// The function returns the following values: +// +// - variant: default value for the key. +func (key *SettingsSchemaKey) DefaultValue() *glib.Variant { + var _arg0 *C.GSettingsSchemaKey // out + var _cret *C.GVariant // in + + _arg0 = (*C.GSettingsSchemaKey)(gextras.StructNative(unsafe.Pointer(key))) + + _cret = C.g_settings_schema_key_get_default_value(_arg0) + runtime.KeepAlive(key) + + var _variant *glib.Variant // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// Description gets the description for key. +// +// If no description has been provided in the schema for key, returns NULL. +// +// The description can be one sentence to several paragraphs in length. +// Paragraphs are delimited with a double newline. Descriptions can be +// translated and the value returned from this function is is the current +// locale. +// +// This function is slow. The summary and description information for the +// schemas is not stored in the compiled schema database so this function has to +// parse all of the source XML files in the schema directory. +// +// The function returns the following values: +// +// - utf8 (optional): description for key, or NULL. +func (key *SettingsSchemaKey) Description() string { + var _arg0 *C.GSettingsSchemaKey // out + var _cret *C.gchar // in + + _arg0 = (*C.GSettingsSchemaKey)(gextras.StructNative(unsafe.Pointer(key))) + + _cret = C.g_settings_schema_key_get_description(_arg0) + runtime.KeepAlive(key) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Name gets the name of key. +// +// The function returns the following values: +// +// - utf8: name of key. +func (key *SettingsSchemaKey) Name() string { + var _arg0 *C.GSettingsSchemaKey // out + var _cret *C.gchar // in + + _arg0 = (*C.GSettingsSchemaKey)(gextras.StructNative(unsafe.Pointer(key))) + + _cret = C.g_settings_schema_key_get_name(_arg0) + runtime.KeepAlive(key) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Range queries the range of a key. +// +// This function will return a #GVariant that fully describes the range of +// values that are valid for key. +// +// The type of #GVariant returned is (sv). The string describes the type of +// range restriction in effect. The type and meaning of the value contained in +// the variant depends on the string. +// +// If the string is 'type' then the variant contains an empty array. The element +// type of that empty array is the expected type of value and all values of that +// type are valid. +// +// If the string is 'enum' then the variant contains an array enumerating the +// possible values. Each item in the array is a possible valid value and no +// other values are valid. +// +// If the string is 'flags' then the variant contains an array. Each item in the +// array is a value that may appear zero or one times in an array to be used as +// the value for this key. For example, if the variant contained the array ['x', +// 'y'] then the valid values for the key would be [], ['x'], ['y'], ['x', +// 'y'] and ['y', 'x']. +// +// Finally, if the string is 'range' then the variant contains a pair of +// like-typed values -- the minimum and maximum permissible values for this key. +// +// This information should not be used by normal programs. It is considered to +// be a hint for introspection purposes. Normal programs should already know +// what is permitted by their own schema. The format may change in any way in +// the future -- but particularly, new forms may be added to the possibilities +// described above. +// +// You should free the returned value with g_variant_unref() when it is no +// longer needed. +// +// The function returns the following values: +// +// - variant describing the range. +func (key *SettingsSchemaKey) Range() *glib.Variant { + var _arg0 *C.GSettingsSchemaKey // out + var _cret *C.GVariant // in + + _arg0 = (*C.GSettingsSchemaKey)(gextras.StructNative(unsafe.Pointer(key))) + + _cret = C.g_settings_schema_key_get_range(_arg0) + runtime.KeepAlive(key) + + var _variant *glib.Variant // out + + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// Summary gets the summary for key. +// +// If no summary has been provided in the schema for key, returns NULL. +// +// The summary is a short description of the purpose of the key; usually one +// short sentence. Summaries can be translated and the value returned from this +// function is is the current locale. +// +// This function is slow. The summary and description information for the +// schemas is not stored in the compiled schema database so this function has to +// parse all of the source XML files in the schema directory. +// +// The function returns the following values: +// +// - utf8 (optional): summary for key, or NULL. +func (key *SettingsSchemaKey) Summary() string { + var _arg0 *C.GSettingsSchemaKey // out + var _cret *C.gchar // in + + _arg0 = (*C.GSettingsSchemaKey)(gextras.StructNative(unsafe.Pointer(key))) + + _cret = C.g_settings_schema_key_get_summary(_arg0) + runtime.KeepAlive(key) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ValueType gets the Type of key. +// +// The function returns the following values: +// +// - variantType: type of key. +func (key *SettingsSchemaKey) ValueType() *glib.VariantType { + var _arg0 *C.GSettingsSchemaKey // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GSettingsSchemaKey)(gextras.StructNative(unsafe.Pointer(key))) + + _cret = C.g_settings_schema_key_get_value_type(_arg0) + runtime.KeepAlive(key) + + var _variantType *glib.VariantType // out + + _variantType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _variantType +} + +// RangeCheck checks if the given value is within the permitted range for key. +// +// It is a programmer error if value is not of the correct type — you must check +// for this first. +// +// The function takes the following parameters: +// +// - value to check. +// +// The function returns the following values: +// +// - ok: TRUE if value is valid for key. +func (key *SettingsSchemaKey) RangeCheck(value *glib.Variant) bool { + var _arg0 *C.GSettingsSchemaKey // out + var _arg1 *C.GVariant // out + var _cret C.gboolean // in + + _arg0 = (*C.GSettingsSchemaKey)(gextras.StructNative(unsafe.Pointer(key))) + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_settings_schema_key_range_check(_arg0, _arg1) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SettingsSchemaSource: this is an opaque structure type. You may not access it +// directly. +// +// An instance of this type is always passed by reference. +type SettingsSchemaSource struct { + *settingsSchemaSource +} + +// settingsSchemaSource is the struct that's finalized. +type settingsSchemaSource struct { + native *C.GSettingsSchemaSource +} + +func marshalSettingsSchemaSource(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &SettingsSchemaSource{&settingsSchemaSource{(*C.GSettingsSchemaSource)(b)}}, nil +} + +// NewSettingsSchemaSourceFromDirectory constructs a struct SettingsSchemaSource. +func NewSettingsSchemaSourceFromDirectory(directory string, parent *SettingsSchemaSource, trusted bool) (*SettingsSchemaSource, error) { + var _arg1 *C.gchar // out + var _arg2 *C.GSettingsSchemaSource // out + var _arg3 C.gboolean // out + var _cret *C.GSettingsSchemaSource // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(directory))) + defer C.free(unsafe.Pointer(_arg1)) + if parent != nil { + _arg2 = (*C.GSettingsSchemaSource)(gextras.StructNative(unsafe.Pointer(parent))) + } + if trusted { + _arg3 = C.TRUE + } + + _cret = C.g_settings_schema_source_new_from_directory(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(directory) + runtime.KeepAlive(parent) + runtime.KeepAlive(trusted) + + var _settingsSchemaSource *SettingsSchemaSource // out + var _goerr error // out + + _settingsSchemaSource = (*SettingsSchemaSource)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_settingsSchemaSource)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_settings_schema_source_unref((*C.GSettingsSchemaSource)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _settingsSchemaSource, _goerr +} + +// ListSchemas lists the schemas in a given source. +// +// If recursive is TRUE then include parent sources. If FALSE then only include +// the schemas from one source (ie: one directory). You probably want TRUE. +// +// Non-relocatable schemas are those for which you can call +// g_settings_new(). Relocatable schemas are those for which you must use +// g_settings_new_with_path(). +// +// Do not call this function from normal programs. This is designed for use by +// database editors, commandline tools, etc. +// +// The function takes the following parameters: +// +// - recursive: if we should recurse. +// +// The function returns the following values: +// +// - nonRelocatable: the list of non-relocatable schemas, in no defined order. +// - relocatable: list of relocatable schemas, in no defined order. +func (source *SettingsSchemaSource) ListSchemas(recursive bool) (nonRelocatable []string, relocatable []string) { + var _arg0 *C.GSettingsSchemaSource // out + var _arg1 C.gboolean // out + var _arg2 **C.gchar // in + var _arg3 **C.gchar // in + + _arg0 = (*C.GSettingsSchemaSource)(gextras.StructNative(unsafe.Pointer(source))) + if recursive { + _arg1 = C.TRUE + } + + C.g_settings_schema_source_list_schemas(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(source) + runtime.KeepAlive(recursive) + + var _nonRelocatable []string // out + var _relocatable []string // out + + defer C.free(unsafe.Pointer(_arg2)) + { + var i int + var z *C.gchar + for p := _arg2; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg2, i) + _nonRelocatable = make([]string, i) + for i := range src { + _nonRelocatable[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + defer C.free(unsafe.Pointer(_arg3)) + { + var i int + var z *C.gchar + for p := _arg3; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg3, i) + _relocatable = make([]string, i) + for i := range src { + _relocatable[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _nonRelocatable, _relocatable +} + +// Lookup looks up a schema with the identifier schema_id in source. +// +// This function is not required for normal uses of #GSettings but it may +// be useful to authors of plugin management systems or to those who want to +// introspect the content of schemas. +// +// If the schema isn't found directly in source and recursive is TRUE then the +// parent sources will also be checked. +// +// If the schema isn't found, NULL is returned. +// +// The function takes the following parameters: +// +// - schemaId: schema ID. +// - recursive: TRUE if the lookup should be recursive. +// +// The function returns the following values: +// +// - settingsSchema (optional): new Schema. +func (source *SettingsSchemaSource) Lookup(schemaId string, recursive bool) *SettingsSchema { + var _arg0 *C.GSettingsSchemaSource // out + var _arg1 *C.gchar // out + var _arg2 C.gboolean // out + var _cret *C.GSettingsSchema // in + + _arg0 = (*C.GSettingsSchemaSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(schemaId))) + defer C.free(unsafe.Pointer(_arg1)) + if recursive { + _arg2 = C.TRUE + } + + _cret = C.g_settings_schema_source_lookup(_arg0, _arg1, _arg2) + runtime.KeepAlive(source) + runtime.KeepAlive(schemaId) + runtime.KeepAlive(recursive) + + var _settingsSchema *SettingsSchema // out + + if _cret != nil { + _settingsSchema = (*SettingsSchema)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_settingsSchema)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_settings_schema_unref((*C.GSettingsSchema)(intern.C)) + }, + ) + } + + return _settingsSchema +} + +// SettingsSchemaSourceGetDefault gets the default system schema source. +// +// This function is not required for normal uses of #GSettings but it may +// be useful to authors of plugin management systems or to those who want to +// introspect the content of schemas. +// +// If no schemas are installed, NULL will be returned. +// +// The returned source may actually consist of multiple schema sources +// from different directories, depending on which directories were given +// in XDG_DATA_DIRS and GSETTINGS_SCHEMA_DIR. For this reason, all lookups +// performed against the default source should probably be done recursively. +// +// The function returns the following values: +// +// - settingsSchemaSource (optional): default schema source. +func SettingsSchemaSourceGetDefault() *SettingsSchemaSource { + var _cret *C.GSettingsSchemaSource // in + + _cret = C.g_settings_schema_source_get_default() + + var _settingsSchemaSource *SettingsSchemaSource // out + + if _cret != nil { + _settingsSchemaSource = (*SettingsSchemaSource)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_settings_schema_source_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_settingsSchemaSource)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_settings_schema_source_unref((*C.GSettingsSchemaSource)(intern.C)) + }, + ) + } + + return _settingsSchemaSource +} + +// SimpleActionGroupClass: instance of this type is always passed by reference. +type SimpleActionGroupClass struct { + *simpleActionGroupClass +} + +// simpleActionGroupClass is the struct that's finalized. +type simpleActionGroupClass struct { + native *C.GSimpleActionGroupClass +} + +// SimpleProxyResolverClass: instance of this type is always passed by +// reference. +type SimpleProxyResolverClass struct { + *simpleProxyResolverClass +} + +// simpleProxyResolverClass is the struct that's finalized. +type simpleProxyResolverClass struct { + native *C.GSimpleProxyResolverClass +} + +// SocketAddressClass: instance of this type is always passed by reference. +type SocketAddressClass struct { + *socketAddressClass +} + +// socketAddressClass is the struct that's finalized. +type socketAddressClass struct { + native *C.GSocketAddressClass +} + +// SocketAddressEnumeratorClass class structure for AddressEnumerator. +// +// An instance of this type is always passed by reference. +type SocketAddressEnumeratorClass struct { + *socketAddressEnumeratorClass +} + +// socketAddressEnumeratorClass is the struct that's finalized. +type socketAddressEnumeratorClass struct { + native *C.GSocketAddressEnumeratorClass +} + +// SocketClass: instance of this type is always passed by reference. +type SocketClass struct { + *socketClass +} + +// socketClass is the struct that's finalized. +type socketClass struct { + native *C.GSocketClass +} + +// SocketClientClass: instance of this type is always passed by reference. +type SocketClientClass struct { + *socketClientClass +} + +// socketClientClass is the struct that's finalized. +type socketClientClass struct { + native *C.GSocketClientClass +} + +// SocketConnectableIface provides an interface for returning a +// AddressEnumerator and AddressEnumerator +// +// An instance of this type is always passed by reference. +type SocketConnectableIface struct { + *socketConnectableIface +} + +// socketConnectableIface is the struct that's finalized. +type socketConnectableIface struct { + native *C.GSocketConnectableIface +} + +// SocketConnectionClass: instance of this type is always passed by reference. +type SocketConnectionClass struct { + *socketConnectionClass +} + +// socketConnectionClass is the struct that's finalized. +type socketConnectionClass struct { + native *C.GSocketConnectionClass +} + +func (s *SocketConnectionClass) ParentClass() *IOStreamClass { + valptr := &s.native.parent_class + var _v *IOStreamClass // out + _v = (*IOStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// SocketControlMessageClass class structure for ControlMessage. +// +// An instance of this type is always passed by reference. +type SocketControlMessageClass struct { + *socketControlMessageClass +} + +// socketControlMessageClass is the struct that's finalized. +type socketControlMessageClass struct { + native *C.GSocketControlMessageClass +} + +// SocketListenerClass class structure for Listener. +// +// An instance of this type is always passed by reference. +type SocketListenerClass struct { + *socketListenerClass +} + +// socketListenerClass is the struct that's finalized. +type socketListenerClass struct { + native *C.GSocketListenerClass +} + +// SocketServiceClass class structure for Service. +// +// An instance of this type is always passed by reference. +type SocketServiceClass struct { + *socketServiceClass +} + +// socketServiceClass is the struct that's finalized. +type socketServiceClass struct { + native *C.GSocketServiceClass +} + +func (s *SocketServiceClass) ParentClass() *SocketListenerClass { + valptr := &s.native.parent_class + var _v *SocketListenerClass // out + _v = (*SocketListenerClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// SrvTarget: single target host/port that a network service is running on. +// +// SRV (service) records are used by some network protocols to provide +// service-specific aliasing and load-balancing. For example, XMPP (Jabber) uses +// SRV records to locate the XMPP server for a domain; rather than connecting +// directly to ‘example.com’ or assuming a specific server hostname like +// ‘xmpp.example.com’, an XMPP client would look up the xmpp-client SRV record +// for ‘example.com’, and then connect to whatever host was pointed to by that +// record. +// +// You can use gio.Resolver.LookupService() or gio.Resolver.LookupServiceAsync() +// to find the GSrvTargets for a given service. However, if you are simply +// planning to connect to the remote service, you can use gio.NetworkService’s +// gio.SocketConnectable interface and not need to worry about GSrvTarget at +// all. +// +// An instance of this type is always passed by reference. +type SrvTarget struct { + *srvTarget +} + +// srvTarget is the struct that's finalized. +type srvTarget struct { + native *C.GSrvTarget +} + +func marshalSrvTarget(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &SrvTarget{&srvTarget{(*C.GSrvTarget)(b)}}, nil +} + +// NewSrvTarget constructs a struct SrvTarget. +func NewSrvTarget(hostname string, port uint16, priority uint16, weight uint16) *SrvTarget { + var _arg1 *C.gchar // out + var _arg2 C.guint16 // out + var _arg3 C.guint16 // out + var _arg4 C.guint16 // out + var _cret *C.GSrvTarget // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint16(port) + _arg3 = C.guint16(priority) + _arg4 = C.guint16(weight) + + _cret = C.g_srv_target_new(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(hostname) + runtime.KeepAlive(port) + runtime.KeepAlive(priority) + runtime.KeepAlive(weight) + + var _srvTarget *SrvTarget // out + + _srvTarget = (*SrvTarget)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_srvTarget)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_srv_target_free((*C.GSrvTarget)(intern.C)) + }, + ) + + return _srvTarget +} + +// Copy copies target. +// +// The function returns the following values: +// +// - srvTarget: copy of target. +func (target *SrvTarget) Copy() *SrvTarget { + var _arg0 *C.GSrvTarget // out + var _cret *C.GSrvTarget // in + + _arg0 = (*C.GSrvTarget)(gextras.StructNative(unsafe.Pointer(target))) + + _cret = C.g_srv_target_copy(_arg0) + runtime.KeepAlive(target) + + var _srvTarget *SrvTarget // out + + _srvTarget = (*SrvTarget)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_srvTarget)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_srv_target_free((*C.GSrvTarget)(intern.C)) + }, + ) + + return _srvTarget +} + +// Hostname gets target's hostname (in ASCII form; if you are going to present +// this to the user, you should use g_hostname_is_ascii_encoded() to check if it +// contains encoded Unicode segments, and use g_hostname_to_unicode() to convert +// it if it does.). +// +// The function returns the following values: +// +// - utf8 target's hostname. +func (target *SrvTarget) Hostname() string { + var _arg0 *C.GSrvTarget // out + var _cret *C.gchar // in + + _arg0 = (*C.GSrvTarget)(gextras.StructNative(unsafe.Pointer(target))) + + _cret = C.g_srv_target_get_hostname(_arg0) + runtime.KeepAlive(target) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Port gets target's port. +// +// The function returns the following values: +// +// - guint16 target's port. +func (target *SrvTarget) Port() uint16 { + var _arg0 *C.GSrvTarget // out + var _cret C.guint16 // in + + _arg0 = (*C.GSrvTarget)(gextras.StructNative(unsafe.Pointer(target))) + + _cret = C.g_srv_target_get_port(_arg0) + runtime.KeepAlive(target) + + var _guint16 uint16 // out + + _guint16 = uint16(_cret) + + return _guint16 +} + +// Priority gets target's priority. You should not need to look at this; +// #GResolver already sorts the targets according to the algorithm in RFC 2782. +// +// The function returns the following values: +// +// - guint16 target's priority. +func (target *SrvTarget) Priority() uint16 { + var _arg0 *C.GSrvTarget // out + var _cret C.guint16 // in + + _arg0 = (*C.GSrvTarget)(gextras.StructNative(unsafe.Pointer(target))) + + _cret = C.g_srv_target_get_priority(_arg0) + runtime.KeepAlive(target) + + var _guint16 uint16 // out + + _guint16 = uint16(_cret) + + return _guint16 +} + +// Weight gets target's weight. You should not need to look at this; #GResolver +// already sorts the targets according to the algorithm in RFC 2782. +// +// The function returns the following values: +// +// - guint16 target's weight. +func (target *SrvTarget) Weight() uint16 { + var _arg0 *C.GSrvTarget // out + var _cret C.guint16 // in + + _arg0 = (*C.GSrvTarget)(gextras.StructNative(unsafe.Pointer(target))) + + _cret = C.g_srv_target_get_weight(_arg0) + runtime.KeepAlive(target) + + var _guint16 uint16 // out + + _guint16 = uint16(_cret) + + return _guint16 +} + +// StaticResource is an opaque data structure and can only be accessed using the +// following functions. +// +// An instance of this type is always passed by reference. +type StaticResource struct { + *staticResource +} + +// staticResource is the struct that's finalized. +type staticResource struct { + native *C.GStaticResource +} + +// Fini: finalized a GResource initialized by g_static_resource_init(). +// +// This is normally used by code generated by +// [glib-compile-resources][glib-compile-resources] and is not typically used by +// other code. +func (staticResource *StaticResource) Fini() { + var _arg0 *C.GStaticResource // out + + _arg0 = (*C.GStaticResource)(gextras.StructNative(unsafe.Pointer(staticResource))) + + C.g_static_resource_fini(_arg0) + runtime.KeepAlive(staticResource) +} + +// Resource gets the GResource that was registered by a call to +// g_static_resource_init(). +// +// This is normally used by code generated by +// [glib-compile-resources][glib-compile-resources] and is not typically used by +// other code. +// +// The function returns the following values: +// +// - resource: #GResource. +func (staticResource *StaticResource) Resource() *Resource { + var _arg0 *C.GStaticResource // out + var _cret *C.GResource // in + + _arg0 = (*C.GStaticResource)(gextras.StructNative(unsafe.Pointer(staticResource))) + + _cret = C.g_static_resource_get_resource(_arg0) + runtime.KeepAlive(staticResource) + + var _resource *Resource // out + + _resource = (*Resource)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_resource_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_resource)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_resource_unref((*C.GResource)(intern.C)) + }, + ) + + return _resource +} + +// Init initializes a GResource from static data using a GStaticResource. +// +// This is normally used by code generated by +// [glib-compile-resources][glib-compile-resources] and is not typically used by +// other code. +func (staticResource *StaticResource) Init() { + var _arg0 *C.GStaticResource // out + + _arg0 = (*C.GStaticResource)(gextras.StructNative(unsafe.Pointer(staticResource))) + + C.g_static_resource_init(_arg0) + runtime.KeepAlive(staticResource) +} + +// TCPConnectionClass: instance of this type is always passed by reference. +type TCPConnectionClass struct { + *tcpConnectionClass +} + +// tcpConnectionClass is the struct that's finalized. +type tcpConnectionClass struct { + native *C.GTcpConnectionClass +} + +func (t *TCPConnectionClass) ParentClass() *SocketConnectionClass { + valptr := &t.native.parent_class + var _v *SocketConnectionClass // out + _v = (*SocketConnectionClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// TCPWrapperConnectionClass: instance of this type is always passed by +// reference. +type TCPWrapperConnectionClass struct { + *tcpWrapperConnectionClass +} + +// tcpWrapperConnectionClass is the struct that's finalized. +type tcpWrapperConnectionClass struct { + native *C.GTcpWrapperConnectionClass +} + +func (t *TCPWrapperConnectionClass) ParentClass() *TCPConnectionClass { + valptr := &t.native.parent_class + var _v *TCPConnectionClass // out + _v = (*TCPConnectionClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// ThreadedSocketServiceClass: instance of this type is always passed by +// reference. +type ThreadedSocketServiceClass struct { + *threadedSocketServiceClass +} + +// threadedSocketServiceClass is the struct that's finalized. +type threadedSocketServiceClass struct { + native *C.GThreadedSocketServiceClass +} + +func (t *ThreadedSocketServiceClass) ParentClass() *SocketServiceClass { + valptr := &t.native.parent_class + var _v *SocketServiceClass // out + _v = (*SocketServiceClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// TLSBackendInterface provides an interface for describing TLS-related types. +// +// An instance of this type is always passed by reference. +type TLSBackendInterface struct { + *tlsBackendInterface +} + +// tlsBackendInterface is the struct that's finalized. +type tlsBackendInterface struct { + native *C.GTlsBackendInterface +} + +// TLSCertificateClass: instance of this type is always passed by reference. +type TLSCertificateClass struct { + *tlsCertificateClass +} + +// tlsCertificateClass is the struct that's finalized. +type tlsCertificateClass struct { + native *C.GTlsCertificateClass +} + +// TLSClientConnectionInterface: vtable for a ClientConnection implementation. +// +// An instance of this type is always passed by reference. +type TLSClientConnectionInterface struct { + *tlsClientConnectionInterface +} + +// tlsClientConnectionInterface is the struct that's finalized. +type tlsClientConnectionInterface struct { + native *C.GTlsClientConnectionInterface +} + +// TLSConnectionClass class structure for the Connection type. +// +// An instance of this type is always passed by reference. +type TLSConnectionClass struct { + *tlsConnectionClass +} + +// tlsConnectionClass is the struct that's finalized. +type tlsConnectionClass struct { + native *C.GTlsConnectionClass +} + +// ParentClass: parent class. +func (t *TLSConnectionClass) ParentClass() *IOStreamClass { + valptr := &t.native.parent_class + var _v *IOStreamClass // out + _v = (*IOStreamClass)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// TLSDatabaseClass class for Database. Derived classes should implement +// the various virtual methods. _async and _finish methods have a default +// implementation that runs the corresponding sync method in a thread. +// +// An instance of this type is always passed by reference. +type TLSDatabaseClass struct { + *tlsDatabaseClass +} + +// tlsDatabaseClass is the struct that's finalized. +type tlsDatabaseClass struct { + native *C.GTlsDatabaseClass +} + +// TLSFileDatabaseInterface provides an interface for FileDatabase +// implementations. +// +// An instance of this type is always passed by reference. +type TLSFileDatabaseInterface struct { + *tlsFileDatabaseInterface +} + +// tlsFileDatabaseInterface is the struct that's finalized. +type tlsFileDatabaseInterface struct { + native *C.GTlsFileDatabaseInterface +} + +// TLSInteractionClass class for Interaction. Derived classes implement the +// various virtual interaction methods to handle TLS interactions. +// +// Derived classes can choose to implement whichever interactions methods +// they'd like to support by overriding those virtual methods in their class +// initialization function. If a derived class implements an async method, +// it must also implement the corresponding finish method. +// +// The synchronous interaction methods should implement to display modal +// dialogs, and the asynchronous methods to display modeless dialogs. +// +// If the user cancels an interaction, then the result should be +// G_TLS_INTERACTION_FAILED and the error should be set with a domain of +// G_IO_ERROR and code of G_IO_ERROR_CANCELLED. +// +// An instance of this type is always passed by reference. +type TLSInteractionClass struct { + *tlsInteractionClass +} + +// tlsInteractionClass is the struct that's finalized. +type tlsInteractionClass struct { + native *C.GTlsInteractionClass +} + +// TLSPasswordClass class structure for Password. +// +// An instance of this type is always passed by reference. +type TLSPasswordClass struct { + *tlsPasswordClass +} + +// tlsPasswordClass is the struct that's finalized. +type tlsPasswordClass struct { + native *C.GTlsPasswordClass +} + +// TLSServerConnectionInterface: vtable for a ServerConnection implementation. +// +// An instance of this type is always passed by reference. +type TLSServerConnectionInterface struct { + *tlsServerConnectionInterface +} + +// tlsServerConnectionInterface is the struct that's finalized. +type tlsServerConnectionInterface struct { + native *C.GTlsServerConnectionInterface +} + +// VFSClass: instance of this type is always passed by reference. +type VFSClass struct { + *vfsClass +} + +// vfsClass is the struct that's finalized. +type vfsClass struct { + native *C.GVfsClass +} + +// VolumeIface: interface for implementing operations for mountable volumes. +// +// An instance of this type is always passed by reference. +type VolumeIface struct { + *volumeIface +} + +// volumeIface is the struct that's finalized. +type volumeIface struct { + native *C.GVolumeIface +} + +// VolumeMonitorClass: instance of this type is always passed by reference. +type VolumeMonitorClass struct { + *volumeMonitorClass +} + +// volumeMonitorClass is the struct that's finalized. +type volumeMonitorClass struct { + native *C.GVolumeMonitorClass +} + +// ZlibCompressorClass: instance of this type is always passed by reference. +type ZlibCompressorClass struct { + *zlibCompressorClass +} + +// zlibCompressorClass is the struct that's finalized. +type zlibCompressorClass struct { + native *C.GZlibCompressorClass +} + +// ZlibDecompressorClass: instance of this type is always passed by reference. +type ZlibDecompressorClass struct { + *zlibDecompressorClass +} + +// zlibDecompressorClass is the struct that's finalized. +type zlibDecompressorClass struct { + native *C.GZlibDecompressorClass +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/gio/v2/gio_export.go b/vendor/github.com/diamondburned/gotk4/pkg/gio/v2/gio_export.go new file mode 100644 index 00000000..16c5bedf --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/gio/v2/gio_export.go @@ -0,0 +1,7842 @@ +// Code generated by girgen. DO NOT EDIT. + +package gio + +import ( + "context" + "runtime" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gcancel" + "github.com/diamondburned/gotk4/pkg/core/gerror" + "github.com/diamondburned/gotk4/pkg/core/gextras" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" + "github.com/diamondburned/gotk4/pkg/glib/v2" +) + +// #include +// #include +// #include +import "C" + +//export _gotk4_gio2_AsyncReadyCallback +func _gotk4_gio2_AsyncReadyCallback(arg1 *C.GObject, arg2 *C.GAsyncResult, arg3 C.gpointer) { + var fn AsyncReadyCallback + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(AsyncReadyCallback) + } + + var _res AsyncResulter // out + + { + objptr := unsafe.Pointer(arg2) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _res = rv + } + + fn(_res) +} + +//export _gotk4_gio2_BusAcquiredCallback +func _gotk4_gio2_BusAcquiredCallback(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 C.gpointer) { + var fn BusAcquiredCallback + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(BusAcquiredCallback) + } + + var _connection *DBusConnection // out + var _name string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _name = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + fn(_connection, _name) +} + +//export _gotk4_gio2_BusNameAcquiredCallback +func _gotk4_gio2_BusNameAcquiredCallback(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 C.gpointer) { + var fn BusNameAcquiredCallback + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(BusNameAcquiredCallback) + } + + var _connection *DBusConnection // out + var _name string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _name = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + fn(_connection, _name) +} + +//export _gotk4_gio2_BusNameAppearedCallback +func _gotk4_gio2_BusNameAppearedCallback(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 *C.gchar, arg4 C.gpointer) { + var fn BusNameAppearedCallback + { + v := gbox.Get(uintptr(arg4)) + if v == nil { + panic(`callback not found`) + } + fn = v.(BusNameAppearedCallback) + } + + var _connection *DBusConnection // out + var _name string // out + var _nameOwner string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _name = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _nameOwner = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + + fn(_connection, _name, _nameOwner) +} + +//export _gotk4_gio2_BusNameLostCallback +func _gotk4_gio2_BusNameLostCallback(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 C.gpointer) { + var fn BusNameLostCallback + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(BusNameLostCallback) + } + + var _connection *DBusConnection // out + var _name string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _name = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + fn(_connection, _name) +} + +//export _gotk4_gio2_BusNameVanishedCallback +func _gotk4_gio2_BusNameVanishedCallback(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 C.gpointer) { + var fn BusNameVanishedCallback + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(BusNameVanishedCallback) + } + + var _connection *DBusConnection // out + var _name string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _name = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + fn(_connection, _name) +} + +//export _gotk4_gio2_DBusInterfaceGetPropertyFunc +func _gotk4_gio2_DBusInterfaceGetPropertyFunc(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 *C.gchar, arg4 *C.gchar, arg5 *C.gchar, arg6 **C.GError, arg7 C.gpointer) (cret *C.GVariant) { + var fn DBusInterfaceGetPropertyFunc + { + v := gbox.Get(uintptr(arg7)) + if v == nil { + panic(`callback not found`) + } + fn = v.(DBusInterfaceGetPropertyFunc) + } + + var _connection *DBusConnection // out + var _sender string // out + var _objectPath string // out + var _interfaceName string // out + var _propertyName string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _sender = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _interfaceName = C.GoString((*C.gchar)(unsafe.Pointer(arg4))) + _propertyName = C.GoString((*C.gchar)(unsafe.Pointer(arg5))) + + err, variant := fn(_connection, _sender, _objectPath, _interfaceName, _propertyName) + + var _ error + var _ *glib.Variant + + if err != nil && arg6 != nil { + *arg6 = (*C.GError)(gerror.New(err)) + } + cret = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(variant))) + + return cret +} + +//export _gotk4_gio2_DBusInterfaceMethodCallFunc +func _gotk4_gio2_DBusInterfaceMethodCallFunc(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 *C.gchar, arg4 *C.gchar, arg5 *C.gchar, arg6 *C.GVariant, arg7 *C.GDBusMethodInvocation, arg8 C.gpointer) { + var fn DBusInterfaceMethodCallFunc + { + v := gbox.Get(uintptr(arg8)) + if v == nil { + panic(`callback not found`) + } + fn = v.(DBusInterfaceMethodCallFunc) + } + + var _connection *DBusConnection // out + var _sender string // out + var _objectPath string // out + var _interfaceName string // out + var _methodName string // out + var _parameters *glib.Variant // out + var _invocation *DBusMethodInvocation // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _sender = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _interfaceName = C.GoString((*C.gchar)(unsafe.Pointer(arg4))) + _methodName = C.GoString((*C.gchar)(unsafe.Pointer(arg5))) + _parameters = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg6))) + C.g_variant_ref(arg6) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_parameters)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + _invocation = wrapDBusMethodInvocation(coreglib.AssumeOwnership(unsafe.Pointer(arg7))) + + fn(_connection, _sender, _objectPath, _interfaceName, _methodName, _parameters, _invocation) +} + +//export _gotk4_gio2_DBusInterfaceSetPropertyFunc +func _gotk4_gio2_DBusInterfaceSetPropertyFunc(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 *C.gchar, arg4 *C.gchar, arg5 *C.gchar, arg6 *C.GVariant, arg7 **C.GError, arg8 C.gpointer) (cret C.gboolean) { + var fn DBusInterfaceSetPropertyFunc + { + v := gbox.Get(uintptr(arg8)) + if v == nil { + panic(`callback not found`) + } + fn = v.(DBusInterfaceSetPropertyFunc) + } + + var _connection *DBusConnection // out + var _sender string // out + var _objectPath string // out + var _interfaceName string // out + var _propertyName string // out + var _value *glib.Variant // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _sender = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _interfaceName = C.GoString((*C.gchar)(unsafe.Pointer(arg4))) + _propertyName = C.GoString((*C.gchar)(unsafe.Pointer(arg5))) + _value = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg6))) + C.g_variant_ref(arg6) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_value)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + err, ok := fn(_connection, _sender, _objectPath, _interfaceName, _propertyName, _value) + + var _ error + var _ bool + + if err != nil && arg7 != nil { + *arg7 = (*C.GError)(gerror.New(err)) + } + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_DBusMessageFilterFunction +func _gotk4_gio2_DBusMessageFilterFunction(arg1 *C.GDBusConnection, arg2 *C.GDBusMessage, arg3 C.gboolean, arg4 C.gpointer) (cret *C.GDBusMessage) { + var fn DBusMessageFilterFunction + { + v := gbox.Get(uintptr(arg4)) + if v == nil { + panic(`callback not found`) + } + fn = v.(DBusMessageFilterFunction) + } + + var _connection *DBusConnection // out + var _message *DBusMessage // out + var _incoming bool // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _message = wrapDBusMessage(coreglib.AssumeOwnership(unsafe.Pointer(arg2))) + if arg3 != 0 { + _incoming = true + } + + dBusMessage := fn(_connection, _message, _incoming) + + var _ *DBusMessage + + if dBusMessage != nil { + cret = (*C.GDBusMessage)(unsafe.Pointer(coreglib.InternObject(dBusMessage).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(dBusMessage).Native())) + } + + return cret +} + +//export _gotk4_gio2_DBusSignalCallback +func _gotk4_gio2_DBusSignalCallback(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 *C.gchar, arg4 *C.gchar, arg5 *C.gchar, arg6 *C.GVariant, arg7 C.gpointer) { + var fn DBusSignalCallback + { + v := gbox.Get(uintptr(arg7)) + if v == nil { + panic(`callback not found`) + } + fn = v.(DBusSignalCallback) + } + + var _connection *DBusConnection // out + var _senderName string // out + var _objectPath string // out + var _interfaceName string // out + var _signalName string // out + var _parameters *glib.Variant // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + if arg2 != nil { + _senderName = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + } + _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _interfaceName = C.GoString((*C.gchar)(unsafe.Pointer(arg4))) + _signalName = C.GoString((*C.gchar)(unsafe.Pointer(arg5))) + _parameters = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg6))) + C.g_variant_ref(arg6) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_parameters)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + fn(_connection, _senderName, _objectPath, _interfaceName, _signalName, _parameters) +} + +//export _gotk4_gio2_DBusSubtreeDispatchFunc +func _gotk4_gio2_DBusSubtreeDispatchFunc(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 *C.gchar, arg4 *C.gchar, arg5 *C.gchar, arg6 *C.gpointer, arg7 C.gpointer) (cret *C.GDBusInterfaceVTable) { + var fn DBusSubtreeDispatchFunc + { + v := gbox.Get(uintptr(arg7)) + if v == nil { + panic(`callback not found`) + } + fn = v.(DBusSubtreeDispatchFunc) + } + + var _connection *DBusConnection // out + var _sender string // out + var _objectPath string // out + var _interfaceName string // out + var _node string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _sender = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _interfaceName = C.GoString((*C.gchar)(unsafe.Pointer(arg4))) + _node = C.GoString((*C.gchar)(unsafe.Pointer(arg5))) + + outUserData, dBusInterfaceVTable := fn(_connection, _sender, _objectPath, _interfaceName, _node) + + var _ unsafe.Pointer + var _ *DBusInterfaceVTable + + *arg6 = (C.gpointer)(unsafe.Pointer(outUserData)) + if dBusInterfaceVTable != nil { + cret = (*C.GDBusInterfaceVTable)(gextras.StructNative(unsafe.Pointer(dBusInterfaceVTable))) + } + + return cret +} + +//export _gotk4_gio2_DBusSubtreeEnumerateFunc +func _gotk4_gio2_DBusSubtreeEnumerateFunc(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 *C.gchar, arg4 C.gpointer) (cret **C.gchar) { + var fn DBusSubtreeEnumerateFunc + { + v := gbox.Get(uintptr(arg4)) + if v == nil { + panic(`callback not found`) + } + fn = v.(DBusSubtreeEnumerateFunc) + } + + var _connection *DBusConnection // out + var _sender string // out + var _objectPath string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _sender = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + + utf8s := fn(_connection, _sender, _objectPath) + + var _ []string + + { + cret = (**C.gchar)(C.calloc(C.size_t((len(utf8s) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + { + out := unsafe.Slice(cret, len(utf8s)+1) + var zero *C.gchar + out[len(utf8s)] = zero + for i := range utf8s { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(utf8s[i]))) + } + } + } + + return cret +} + +//export _gotk4_gio2_DBusSubtreeIntrospectFunc +func _gotk4_gio2_DBusSubtreeIntrospectFunc(arg1 *C.GDBusConnection, arg2 *C.gchar, arg3 *C.gchar, arg4 *C.gchar, arg5 C.gpointer) (cret **C.GDBusInterfaceInfo) { + var fn DBusSubtreeIntrospectFunc + { + v := gbox.Get(uintptr(arg5)) + if v == nil { + panic(`callback not found`) + } + fn = v.(DBusSubtreeIntrospectFunc) + } + + var _connection *DBusConnection // out + var _sender string // out + var _objectPath string // out + var _node string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _sender = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _node = C.GoString((*C.gchar)(unsafe.Pointer(arg4))) + + dBusInterfaceInfos := fn(_connection, _sender, _objectPath, _node) + + var _ []*DBusInterfaceInfo + + if dBusInterfaceInfos != nil { + { + cret = (**C.GDBusInterfaceInfo)(C.calloc(C.size_t((len(dBusInterfaceInfos) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + { + out := unsafe.Slice(cret, len(dBusInterfaceInfos)+1) + var zero *C.GDBusInterfaceInfo + out[len(dBusInterfaceInfos)] = zero + for i := range dBusInterfaceInfos { + out[i] = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(dBusInterfaceInfos[i]))) + } + } + } + } + + return cret +} + +//export _gotk4_gio2_SettingsBindGetMapping +func _gotk4_gio2_SettingsBindGetMapping(arg1 *C.GValue, arg2 *C.GVariant, arg3 C.gpointer) (cret C.gboolean) { + var fn SettingsBindGetMapping + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(SettingsBindGetMapping) + } + + var _value *coreglib.Value // out + var _variant *glib.Variant // out + + _value = coreglib.ValueFromNative(unsafe.Pointer(arg1)) + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg2))) + C.g_variant_ref(arg2) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + ok := fn(_value, _variant) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_SettingsBindSetMapping +func _gotk4_gio2_SettingsBindSetMapping(arg1 *C.GValue, arg2 *C.GVariantType, arg3 C.gpointer) (cret *C.GVariant) { + var fn SettingsBindSetMapping + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(SettingsBindSetMapping) + } + + var _value *coreglib.Value // out + var _expectedType *glib.VariantType // out + + _value = coreglib.ValueFromNative(unsafe.Pointer(arg1)) + _expectedType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(arg2))) + + variant := fn(_value, _expectedType) + + var _ *glib.Variant + + cret = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(variant))) + + return cret +} + +//export _gotk4_gio2_SettingsGetMapping +func _gotk4_gio2_SettingsGetMapping(arg1 *C.GVariant, arg2 *C.gpointer, arg3 C.gpointer) (cret C.gboolean) { + var fn SettingsGetMapping + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(SettingsGetMapping) + } + + var _value *glib.Variant // out + + _value = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_variant_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_value)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + result, ok := fn(_value) + + var _ unsafe.Pointer + var _ bool + + *arg2 = (C.gpointer)(unsafe.Pointer(result)) + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_VFSFileLookupFunc +func _gotk4_gio2_VFSFileLookupFunc(arg1 *C.GVfs, arg2 *C.char, arg3 C.gpointer) (cret *C.GFile) { + var fn VFSFileLookupFunc + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(VFSFileLookupFunc) + } + + var _vfs *VFS // out + var _identifier string // out + + _vfs = wrapVFS(coreglib.Take(unsafe.Pointer(arg1))) + _identifier = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + file := fn(_vfs, _identifier) + + var _ *File + + cret = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(file).Native())) + + return cret +} + +//export _gotk4_gio2_ActionGroup_ConnectActionAdded +func _gotk4_gio2_ActionGroup_ConnectActionAdded(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) { + var f func(actionName string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(actionName string)) + } + + var _actionName string // out + + _actionName = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + f(_actionName) +} + +//export _gotk4_gio2_ActionGroup_ConnectActionEnabledChanged +func _gotk4_gio2_ActionGroup_ConnectActionEnabledChanged(arg0 C.gpointer, arg1 *C.gchar, arg2 C.gboolean, arg3 C.guintptr) { + var f func(actionName string, enabled bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(actionName string, enabled bool)) + } + + var _actionName string // out + var _enabled bool // out + + _actionName = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + if arg2 != 0 { + _enabled = true + } + + f(_actionName, _enabled) +} + +//export _gotk4_gio2_ActionGroup_ConnectActionRemoved +func _gotk4_gio2_ActionGroup_ConnectActionRemoved(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) { + var f func(actionName string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(actionName string)) + } + + var _actionName string // out + + _actionName = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + f(_actionName) +} + +//export _gotk4_gio2_ActionGroup_ConnectActionStateChanged +func _gotk4_gio2_ActionGroup_ConnectActionStateChanged(arg0 C.gpointer, arg1 *C.gchar, arg2 *C.GVariant, arg3 C.guintptr) { + var f func(actionName string, value *glib.Variant) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(actionName string, value *glib.Variant)) + } + + var _actionName string // out + var _value *glib.Variant // out + + _actionName = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _value = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg2))) + C.g_variant_ref(arg2) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_value)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + f(_actionName, _value) +} + +//export _gotk4_gio2_DBusObject_ConnectInterfaceAdded +func _gotk4_gio2_DBusObject_ConnectInterfaceAdded(arg0 C.gpointer, arg1 *C.GDBusInterface, arg2 C.guintptr) { + var f func(iface DBusInterfacer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(iface DBusInterfacer)) + } + + var _iface DBusInterfacer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.DBusInterfacer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusInterfacer) + return ok + }) + rv, ok := casted.(DBusInterfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusInterfacer") + } + _iface = rv + } + + f(_iface) +} + +//export _gotk4_gio2_DBusObject_ConnectInterfaceRemoved +func _gotk4_gio2_DBusObject_ConnectInterfaceRemoved(arg0 C.gpointer, arg1 *C.GDBusInterface, arg2 C.guintptr) { + var f func(iface DBusInterfacer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(iface DBusInterfacer)) + } + + var _iface DBusInterfacer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.DBusInterfacer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusInterfacer) + return ok + }) + rv, ok := casted.(DBusInterfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusInterfacer") + } + _iface = rv + } + + f(_iface) +} + +//export _gotk4_gio2_DBusObjectManager_ConnectInterfaceAdded +func _gotk4_gio2_DBusObjectManager_ConnectInterfaceAdded(arg0 C.gpointer, arg1 *C.GDBusObject, arg2 *C.GDBusInterface, arg3 C.guintptr) { + var f func(object DBusObjector, iface DBusInterfacer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(object DBusObjector, iface DBusInterfacer)) + } + + var _object DBusObjector // out + var _iface DBusInterfacer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.DBusObjector is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusObjector) + return ok + }) + rv, ok := casted.(DBusObjector) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusObjector") + } + _object = rv + } + { + objptr := unsafe.Pointer(arg2) + if objptr == nil { + panic("object of type gio.DBusInterfacer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusInterfacer) + return ok + }) + rv, ok := casted.(DBusInterfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusInterfacer") + } + _iface = rv + } + + f(_object, _iface) +} + +//export _gotk4_gio2_DBusObjectManager_ConnectInterfaceRemoved +func _gotk4_gio2_DBusObjectManager_ConnectInterfaceRemoved(arg0 C.gpointer, arg1 *C.GDBusObject, arg2 *C.GDBusInterface, arg3 C.guintptr) { + var f func(object DBusObjector, iface DBusInterfacer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(object DBusObjector, iface DBusInterfacer)) + } + + var _object DBusObjector // out + var _iface DBusInterfacer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.DBusObjector is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusObjector) + return ok + }) + rv, ok := casted.(DBusObjector) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusObjector") + } + _object = rv + } + { + objptr := unsafe.Pointer(arg2) + if objptr == nil { + panic("object of type gio.DBusInterfacer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusInterfacer) + return ok + }) + rv, ok := casted.(DBusInterfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusInterfacer") + } + _iface = rv + } + + f(_object, _iface) +} + +//export _gotk4_gio2_DBusObjectManager_ConnectObjectAdded +func _gotk4_gio2_DBusObjectManager_ConnectObjectAdded(arg0 C.gpointer, arg1 *C.GDBusObject, arg2 C.guintptr) { + var f func(object DBusObjector) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(object DBusObjector)) + } + + var _object DBusObjector // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.DBusObjector is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusObjector) + return ok + }) + rv, ok := casted.(DBusObjector) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusObjector") + } + _object = rv + } + + f(_object) +} + +//export _gotk4_gio2_DBusObjectManager_ConnectObjectRemoved +func _gotk4_gio2_DBusObjectManager_ConnectObjectRemoved(arg0 C.gpointer, arg1 *C.GDBusObject, arg2 C.guintptr) { + var f func(object DBusObjector) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(object DBusObjector)) + } + + var _object DBusObjector // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.DBusObjector is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusObjector) + return ok + }) + rv, ok := casted.(DBusObjector) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusObjector") + } + _object = rv + } + + f(_object) +} + +//export _gotk4_gio2_Drive_ConnectChanged +func _gotk4_gio2_Drive_ConnectChanged(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_Drive_ConnectDisconnected +func _gotk4_gio2_Drive_ConnectDisconnected(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_Drive_ConnectEjectButton +func _gotk4_gio2_Drive_ConnectEjectButton(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_Drive_ConnectStopButton +func _gotk4_gio2_Drive_ConnectStopButton(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_DtlsConnection_ConnectAcceptCertificate +func _gotk4_gio2_DtlsConnection_ConnectAcceptCertificate(arg0 C.gpointer, arg1 *C.GTlsCertificate, arg2 C.GTlsCertificateFlags, arg3 C.guintptr) (cret C.gboolean) { + var f func(peerCert TLSCertificater, errors TLSCertificateFlags) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(peerCert TLSCertificater, errors TLSCertificateFlags) (ok bool)) + } + + var _peerCert TLSCertificater // out + var _errors TLSCertificateFlags // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _peerCert = rv + } + _errors = TLSCertificateFlags(arg2) + + ok := f(_peerCert, _errors) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_ListModel_ConnectItemsChanged +func _gotk4_gio2_ListModel_ConnectItemsChanged(arg0 C.gpointer, arg1 C.guint, arg2 C.guint, arg3 C.guint, arg4 C.guintptr) { + var f func(position, removed, added uint) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg4)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(position, removed, added uint)) + } + + var _position uint // out + var _removed uint // out + var _added uint // out + + _position = uint(arg1) + _removed = uint(arg2) + _added = uint(arg3) + + f(_position, _removed, _added) +} + +//export _gotk4_gio2_MemoryMonitor_ConnectLowMemoryWarning +func _gotk4_gio2_MemoryMonitor_ConnectLowMemoryWarning(arg0 C.gpointer, arg1 C.GMemoryMonitorWarningLevel, arg2 C.guintptr) { + var f func(level MemoryMonitorWarningLevel) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(level MemoryMonitorWarningLevel)) + } + + var _level MemoryMonitorWarningLevel // out + + _level = MemoryMonitorWarningLevel(arg1) + + f(_level) +} + +//export _gotk4_gio2_Mount_ConnectChanged +func _gotk4_gio2_Mount_ConnectChanged(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_Mount_ConnectPreUnmount +func _gotk4_gio2_Mount_ConnectPreUnmount(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_Mount_ConnectUnmounted +func _gotk4_gio2_Mount_ConnectUnmounted(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_NetworkMonitor_ConnectNetworkChanged +func _gotk4_gio2_NetworkMonitor_ConnectNetworkChanged(arg0 C.gpointer, arg1 C.gboolean, arg2 C.guintptr) { + var f func(networkAvailable bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(networkAvailable bool)) + } + + var _networkAvailable bool // out + + if arg1 != 0 { + _networkAvailable = true + } + + f(_networkAvailable) +} + +//export _gotk4_gio2_Volume_ConnectChanged +func _gotk4_gio2_Volume_ConnectChanged(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_Volume_ConnectRemoved +func _gotk4_gio2_Volume_ConnectRemoved(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_AppInfoMonitor_ConnectChanged +func _gotk4_gio2_AppInfoMonitor_ConnectChanged(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_AppLaunchContextClass_get_display +func _gotk4_gio2_AppLaunchContextClass_get_display(arg0 *C.GAppLaunchContext, arg1 *C.GAppInfo, arg2 *C.GList) (cret *C.char) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[AppLaunchContextOverrides](instance0) + if overrides.Display == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected AppLaunchContextOverrides.Display, got none") + } + + var _info AppInfor // out + var _files []Filer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AppInfor is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AppInfor) + return ok + }) + rv, ok := casted.(AppInfor) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AppInfor") + } + _info = rv + } + _files = make([]Filer, 0, gextras.ListSize(unsafe.Pointer(arg2))) + gextras.MoveList(unsafe.Pointer(arg2), false, func(v unsafe.Pointer) { + src := (*C.GFile)(v) + var dst Filer // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gio.Filer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Filer) + return ok + }) + rv, ok := casted.(Filer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Filer") + } + dst = rv + } + _files = append(_files, dst) + }) + + utf8 := overrides.Display(_info, _files) + + var _ string + + if utf8 != "" { + cret = (*C.char)(unsafe.Pointer(C.CString(utf8))) + } + + return cret +} + +//export _gotk4_gio2_AppLaunchContextClass_get_startup_notify_id +func _gotk4_gio2_AppLaunchContextClass_get_startup_notify_id(arg0 *C.GAppLaunchContext, arg1 *C.GAppInfo, arg2 *C.GList) (cret *C.char) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[AppLaunchContextOverrides](instance0) + if overrides.StartupNotifyID == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected AppLaunchContextOverrides.StartupNotifyID, got none") + } + + var _info AppInfor // out + var _files []Filer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AppInfor is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AppInfor) + return ok + }) + rv, ok := casted.(AppInfor) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AppInfor") + } + _info = rv + } + _files = make([]Filer, 0, gextras.ListSize(unsafe.Pointer(arg2))) + gextras.MoveList(unsafe.Pointer(arg2), false, func(v unsafe.Pointer) { + src := (*C.GFile)(v) + var dst Filer // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gio.Filer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Filer) + return ok + }) + rv, ok := casted.(Filer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Filer") + } + dst = rv + } + _files = append(_files, dst) + }) + + utf8 := overrides.StartupNotifyID(_info, _files) + + var _ string + + if utf8 != "" { + cret = (*C.char)(unsafe.Pointer(C.CString(utf8))) + } + + return cret +} + +//export _gotk4_gio2_AppLaunchContextClass_launch_failed +func _gotk4_gio2_AppLaunchContextClass_launch_failed(arg0 *C.GAppLaunchContext, arg1 *C.char) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[AppLaunchContextOverrides](instance0) + if overrides.LaunchFailed == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected AppLaunchContextOverrides.LaunchFailed, got none") + } + + var _startupNotifyId string // out + + _startupNotifyId = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + overrides.LaunchFailed(_startupNotifyId) +} + +//export _gotk4_gio2_AppLaunchContextClass_launch_started +func _gotk4_gio2_AppLaunchContextClass_launch_started(arg0 *C.GAppLaunchContext, arg1 *C.GAppInfo, arg2 *C.GVariant) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[AppLaunchContextOverrides](instance0) + if overrides.LaunchStarted == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected AppLaunchContextOverrides.LaunchStarted, got none") + } + + var _info AppInfor // out + var _platformData *glib.Variant // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AppInfor is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AppInfor) + return ok + }) + rv, ok := casted.(AppInfor) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AppInfor") + } + _info = rv + } + _platformData = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg2))) + C.g_variant_ref(arg2) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_platformData)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + overrides.LaunchStarted(_info, _platformData) +} + +//export _gotk4_gio2_AppLaunchContextClass_launched +func _gotk4_gio2_AppLaunchContextClass_launched(arg0 *C.GAppLaunchContext, arg1 *C.GAppInfo, arg2 *C.GVariant) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[AppLaunchContextOverrides](instance0) + if overrides.Launched == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected AppLaunchContextOverrides.Launched, got none") + } + + var _info AppInfor // out + var _platformData *glib.Variant // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AppInfor is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AppInfor) + return ok + }) + rv, ok := casted.(AppInfor) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AppInfor") + } + _info = rv + } + _platformData = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg2))) + C.g_variant_ref(arg2) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_platformData)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + overrides.Launched(_info, _platformData) +} + +//export _gotk4_gio2_AppLaunchContext_ConnectLaunchFailed +func _gotk4_gio2_AppLaunchContext_ConnectLaunchFailed(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) { + var f func(startupNotifyId string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(startupNotifyId string)) + } + + var _startupNotifyId string // out + + _startupNotifyId = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + f(_startupNotifyId) +} + +//export _gotk4_gio2_AppLaunchContext_ConnectLaunchStarted +func _gotk4_gio2_AppLaunchContext_ConnectLaunchStarted(arg0 C.gpointer, arg1 *C.GAppInfo, arg2 *C.GVariant, arg3 C.guintptr) { + var f func(info AppInfor, platformData *glib.Variant) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(info AppInfor, platformData *glib.Variant)) + } + + var _info AppInfor // out + var _platformData *glib.Variant // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AppInfor is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AppInfor) + return ok + }) + rv, ok := casted.(AppInfor) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AppInfor") + } + _info = rv + } + if arg2 != nil { + _platformData = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg2))) + C.g_variant_ref(arg2) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_platformData)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + f(_info, _platformData) +} + +//export _gotk4_gio2_AppLaunchContext_ConnectLaunched +func _gotk4_gio2_AppLaunchContext_ConnectLaunched(arg0 C.gpointer, arg1 *C.GAppInfo, arg2 *C.GVariant, arg3 C.guintptr) { + var f func(info AppInfor, platformData *glib.Variant) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(info AppInfor, platformData *glib.Variant)) + } + + var _info AppInfor // out + var _platformData *glib.Variant // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AppInfor is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AppInfor) + return ok + }) + rv, ok := casted.(AppInfor) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AppInfor") + } + _info = rv + } + _platformData = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg2))) + C.g_variant_ref(arg2) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_platformData)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + f(_info, _platformData) +} + +//export _gotk4_gio2_ApplicationClass_activate +func _gotk4_gio2_ApplicationClass_activate(arg0 *C.GApplication) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.Activate == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.Activate, got none") + } + + overrides.Activate() +} + +//export _gotk4_gio2_ApplicationClass_add_platform_data +func _gotk4_gio2_ApplicationClass_add_platform_data(arg0 *C.GApplication, arg1 *C.GVariantBuilder) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.AddPlatformData == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.AddPlatformData, got none") + } + + var _builder *glib.VariantBuilder // out + + _builder = (*glib.VariantBuilder)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_variant_builder_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_builder)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_builder_unref((*C.GVariantBuilder)(intern.C)) + }, + ) + + overrides.AddPlatformData(_builder) +} + +//export _gotk4_gio2_ApplicationClass_after_emit +func _gotk4_gio2_ApplicationClass_after_emit(arg0 *C.GApplication, arg1 *C.GVariant) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.AfterEmit == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.AfterEmit, got none") + } + + var _platformData *glib.Variant // out + + _platformData = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_variant_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_platformData)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + overrides.AfterEmit(_platformData) +} + +//export _gotk4_gio2_ApplicationClass_before_emit +func _gotk4_gio2_ApplicationClass_before_emit(arg0 *C.GApplication, arg1 *C.GVariant) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.BeforeEmit == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.BeforeEmit, got none") + } + + var _platformData *glib.Variant // out + + _platformData = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_variant_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_platformData)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + overrides.BeforeEmit(_platformData) +} + +//export _gotk4_gio2_ApplicationClass_command_line +func _gotk4_gio2_ApplicationClass_command_line(arg0 *C.GApplication, arg1 *C.GApplicationCommandLine) (cret C.int) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.CommandLine == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.CommandLine, got none") + } + + var _commandLine *ApplicationCommandLine // out + + _commandLine = wrapApplicationCommandLine(coreglib.Take(unsafe.Pointer(arg1))) + + gint := overrides.CommandLine(_commandLine) + + var _ int + + cret = C.int(gint) + + return cret +} + +//export _gotk4_gio2_ApplicationClass_dbus_register +func _gotk4_gio2_ApplicationClass_dbus_register(arg0 *C.GApplication, arg1 *C.GDBusConnection, arg2 *C.gchar, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.DBusRegister == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.DBusRegister, got none") + } + + var _connection *DBusConnection // out + var _objectPath string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + _goerr := overrides.DBusRegister(_connection, _objectPath) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ApplicationClass_dbus_unregister +func _gotk4_gio2_ApplicationClass_dbus_unregister(arg0 *C.GApplication, arg1 *C.GDBusConnection, arg2 *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.DBusUnregister == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.DBusUnregister, got none") + } + + var _connection *DBusConnection // out + var _objectPath string // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + overrides.DBusUnregister(_connection, _objectPath) +} + +//export _gotk4_gio2_ApplicationClass_handle_local_options +func _gotk4_gio2_ApplicationClass_handle_local_options(arg0 *C.GApplication, arg1 *C.GVariantDict) (cret C.gint) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.HandleLocalOptions == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.HandleLocalOptions, got none") + } + + var _options *glib.VariantDict // out + + _options = (*glib.VariantDict)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_variant_dict_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_options)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_dict_unref((*C.GVariantDict)(intern.C)) + }, + ) + + gint := overrides.HandleLocalOptions(_options) + + var _ int + + cret = C.gint(gint) + + return cret +} + +//export _gotk4_gio2_ApplicationClass_name_lost +func _gotk4_gio2_ApplicationClass_name_lost(arg0 *C.GApplication) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.NameLost == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.NameLost, got none") + } + + ok := overrides.NameLost() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_ApplicationClass_open +func _gotk4_gio2_ApplicationClass_open(arg0 *C.GApplication, arg1 **C.GFile, arg2 C.gint, arg3 *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.Open == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.Open, got none") + } + + var _files []Filer // out + var _hint string // out + + { + src := unsafe.Slice((**C.GFile)(arg1), arg2) + _files = make([]Filer, arg2) + for i := 0; i < int(arg2); i++ { + { + objptr := unsafe.Pointer(src[i]) + if objptr == nil { + panic("object of type gio.Filer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Filer) + return ok + }) + rv, ok := casted.(Filer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Filer") + } + _files[i] = rv + } + } + } + _hint = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + + overrides.Open(_files, _hint) +} + +//export _gotk4_gio2_ApplicationClass_quit_mainloop +func _gotk4_gio2_ApplicationClass_quit_mainloop(arg0 *C.GApplication) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.QuitMainloop == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.QuitMainloop, got none") + } + + overrides.QuitMainloop() +} + +//export _gotk4_gio2_ApplicationClass_run_mainloop +func _gotk4_gio2_ApplicationClass_run_mainloop(arg0 *C.GApplication) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.RunMainloop == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.RunMainloop, got none") + } + + overrides.RunMainloop() +} + +//export _gotk4_gio2_ApplicationClass_shutdown +func _gotk4_gio2_ApplicationClass_shutdown(arg0 *C.GApplication) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.Shutdown == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.Shutdown, got none") + } + + overrides.Shutdown() +} + +//export _gotk4_gio2_ApplicationClass_startup +func _gotk4_gio2_ApplicationClass_startup(arg0 *C.GApplication) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationOverrides](instance0) + if overrides.Startup == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationOverrides.Startup, got none") + } + + overrides.Startup() +} + +//export _gotk4_gio2_Application_ConnectActivate +func _gotk4_gio2_Application_ConnectActivate(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_Application_ConnectCommandLine +func _gotk4_gio2_Application_ConnectCommandLine(arg0 C.gpointer, arg1 *C.GApplicationCommandLine, arg2 C.guintptr) (cret C.gint) { + var f func(commandLine *ApplicationCommandLine) (gint int) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(commandLine *ApplicationCommandLine) (gint int)) + } + + var _commandLine *ApplicationCommandLine // out + + _commandLine = wrapApplicationCommandLine(coreglib.Take(unsafe.Pointer(arg1))) + + gint := f(_commandLine) + + var _ int + + cret = C.gint(gint) + + return cret +} + +//export _gotk4_gio2_Application_ConnectHandleLocalOptions +func _gotk4_gio2_Application_ConnectHandleLocalOptions(arg0 C.gpointer, arg1 *C.GVariantDict, arg2 C.guintptr) (cret C.gint) { + var f func(options *glib.VariantDict) (gint int) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(options *glib.VariantDict) (gint int)) + } + + var _options *glib.VariantDict // out + + _options = (*glib.VariantDict)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_variant_dict_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_options)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_dict_unref((*C.GVariantDict)(intern.C)) + }, + ) + + gint := f(_options) + + var _ int + + cret = C.gint(gint) + + return cret +} + +//export _gotk4_gio2_Application_ConnectNameLost +func _gotk4_gio2_Application_ConnectNameLost(arg0 C.gpointer, arg1 C.guintptr) (cret C.gboolean) { + var f func() (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func() (ok bool)) + } + + ok := f() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_Application_ConnectOpen +func _gotk4_gio2_Application_ConnectOpen(arg0 C.gpointer, arg1 **C.GFile, arg2 C.gint, arg3 *C.gchar, arg4 C.guintptr) { + var f func(files []Filer, hint string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg4)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(files []Filer, hint string)) + } + + var _files []Filer // out + var _hint string // out + + { + src := unsafe.Slice((**C.GFile)(arg1), arg2) + _files = make([]Filer, arg2) + for i := 0; i < int(arg2); i++ { + { + objptr := unsafe.Pointer(src[i]) + if objptr == nil { + panic("object of type gio.Filer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Filer) + return ok + }) + rv, ok := casted.(Filer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Filer") + } + _files[i] = rv + } + } + } + _hint = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + + f(_files, _hint) +} + +//export _gotk4_gio2_Application_ConnectShutdown +func _gotk4_gio2_Application_ConnectShutdown(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_Application_ConnectStartup +func _gotk4_gio2_Application_ConnectStartup(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_ApplicationCommandLineClass_done +func _gotk4_gio2_ApplicationCommandLineClass_done(arg0 *C.GApplicationCommandLine) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationCommandLineOverrides](instance0) + if overrides.Done == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationCommandLineOverrides.Done, got none") + } + + overrides.Done() +} + +//export _gotk4_gio2_ApplicationCommandLineClass_get_stdin +func _gotk4_gio2_ApplicationCommandLineClass_get_stdin(arg0 *C.GApplicationCommandLine) (cret *C.GInputStream) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationCommandLineOverrides](instance0) + if overrides.Stdin == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationCommandLineOverrides.Stdin, got none") + } + + inputStream := overrides.Stdin() + + var _ InputStreamer + + if inputStream != nil { + cret = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(inputStream).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(inputStream).Native())) + } + + return cret +} + +//export _gotk4_gio2_ApplicationCommandLineClass_print_literal +func _gotk4_gio2_ApplicationCommandLineClass_print_literal(arg0 *C.GApplicationCommandLine, arg1 *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationCommandLineOverrides](instance0) + if overrides.PrintLiteral == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationCommandLineOverrides.PrintLiteral, got none") + } + + var _message string // out + + _message = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + overrides.PrintLiteral(_message) +} + +//export _gotk4_gio2_ApplicationCommandLineClass_printerr_literal +func _gotk4_gio2_ApplicationCommandLineClass_printerr_literal(arg0 *C.GApplicationCommandLine, arg1 *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ApplicationCommandLineOverrides](instance0) + if overrides.PrinterrLiteral == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ApplicationCommandLineOverrides.PrinterrLiteral, got none") + } + + var _message string // out + + _message = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + overrides.PrinterrLiteral(_message) +} + +//export _gotk4_gio2_BufferedInputStreamClass_fill +func _gotk4_gio2_BufferedInputStreamClass_fill(arg0 *C.GBufferedInputStream, arg1 C.gssize, arg2 *C.GCancellable, _cerr **C.GError) (cret C.gssize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[BufferedInputStreamOverrides](instance0) + if overrides.Fill == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected BufferedInputStreamOverrides.Fill, got none") + } + + var _cancellable context.Context // out + var _count int // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _count = int(arg1) + + gssize, _goerr := overrides.Fill(_cancellable, _count) + + var _ int + var _ error + + cret = C.gssize(gssize) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_BufferedInputStreamClass_fill_finish +func _gotk4_gio2_BufferedInputStreamClass_fill_finish(arg0 *C.GBufferedInputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gssize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[BufferedInputStreamOverrides](instance0) + if overrides.FillFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected BufferedInputStreamOverrides.FillFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + gssize, _goerr := overrides.FillFinish(_result) + + var _ int + var _ error + + cret = C.gssize(gssize) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_CancellableClass_cancelled +func _gotk4_gio2_CancellableClass_cancelled(arg0 *C.GCancellable) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[CancellableOverrides](instance0) + if overrides.Cancelled == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected CancellableOverrides.Cancelled, got none") + } + + overrides.Cancelled() +} + +//export _gotk4_gio2_Cancellable_ConnectCancelled +func _gotk4_gio2_Cancellable_ConnectCancelled(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_DBusAuthObserver_ConnectAllowMechanism +func _gotk4_gio2_DBusAuthObserver_ConnectAllowMechanism(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) (cret C.gboolean) { + var f func(mechanism string) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(mechanism string) (ok bool)) + } + + var _mechanism string // out + + _mechanism = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + ok := f(_mechanism) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_DBusAuthObserver_ConnectAuthorizeAuthenticatedPeer +func _gotk4_gio2_DBusAuthObserver_ConnectAuthorizeAuthenticatedPeer(arg0 C.gpointer, arg1 *C.GIOStream, arg2 *C.GCredentials, arg3 C.guintptr) (cret C.gboolean) { + var f func(stream IOStreamer, credentials *Credentials) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(stream IOStreamer, credentials *Credentials) (ok bool)) + } + + var _stream IOStreamer // out + var _credentials *Credentials // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _stream = rv + } + if arg2 != nil { + _credentials = wrapCredentials(coreglib.Take(unsafe.Pointer(arg2))) + } + + ok := f(_stream, _credentials) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_DBusConnection_ConnectClosed +func _gotk4_gio2_DBusConnection_ConnectClosed(arg0 C.gpointer, arg1 C.gboolean, arg2 *C.GError, arg3 C.guintptr) { + var f func(remotePeerVanished bool, err error) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(remotePeerVanished bool, err error)) + } + + var _remotePeerVanished bool // out + var _err error // out + + if arg1 != 0 { + _remotePeerVanished = true + } + if arg2 != nil { + _err = gerror.Take(unsafe.Pointer(arg2)) + } + + f(_remotePeerVanished, _err) +} + +//export _gotk4_gio2_DBusInterfaceSkeletonClass_flush +func _gotk4_gio2_DBusInterfaceSkeletonClass_flush(arg0 *C.GDBusInterfaceSkeleton) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[DBusInterfaceSkeletonOverrides](instance0) + if overrides.Flush == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected DBusInterfaceSkeletonOverrides.Flush, got none") + } + + overrides.Flush() +} + +//export _gotk4_gio2_DBusInterfaceSkeletonClass_g_authorize_method +func _gotk4_gio2_DBusInterfaceSkeletonClass_g_authorize_method(arg0 *C.GDBusInterfaceSkeleton, arg1 *C.GDBusMethodInvocation) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[DBusInterfaceSkeletonOverrides](instance0) + if overrides.GAuthorizeMethod == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected DBusInterfaceSkeletonOverrides.GAuthorizeMethod, got none") + } + + var _invocation *DBusMethodInvocation // out + + _invocation = wrapDBusMethodInvocation(coreglib.Take(unsafe.Pointer(arg1))) + + ok := overrides.GAuthorizeMethod(_invocation) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_DBusInterfaceSkeletonClass_get_info +func _gotk4_gio2_DBusInterfaceSkeletonClass_get_info(arg0 *C.GDBusInterfaceSkeleton) (cret *C.GDBusInterfaceInfo) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[DBusInterfaceSkeletonOverrides](instance0) + if overrides.Info == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected DBusInterfaceSkeletonOverrides.Info, got none") + } + + dBusInterfaceInfo := overrides.Info() + + var _ *DBusInterfaceInfo + + cret = (*C.GDBusInterfaceInfo)(gextras.StructNative(unsafe.Pointer(dBusInterfaceInfo))) + + return cret +} + +//export _gotk4_gio2_DBusInterfaceSkeletonClass_get_properties +func _gotk4_gio2_DBusInterfaceSkeletonClass_get_properties(arg0 *C.GDBusInterfaceSkeleton) (cret *C.GVariant) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[DBusInterfaceSkeletonOverrides](instance0) + if overrides.Properties == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected DBusInterfaceSkeletonOverrides.Properties, got none") + } + + variant := overrides.Properties() + + var _ *glib.Variant + + cret = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(variant))) + + return cret +} + +//export _gotk4_gio2_DBusInterfaceSkeletonClass_get_vtable +func _gotk4_gio2_DBusInterfaceSkeletonClass_get_vtable(arg0 *C.GDBusInterfaceSkeleton) (cret *C.GDBusInterfaceVTable) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[DBusInterfaceSkeletonOverrides](instance0) + if overrides.Vtable == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected DBusInterfaceSkeletonOverrides.Vtable, got none") + } + + dBusInterfaceVTable := overrides.Vtable() + + var _ *DBusInterfaceVTable + + cret = (*C.GDBusInterfaceVTable)(gextras.StructNative(unsafe.Pointer(dBusInterfaceVTable))) + + return cret +} + +//export _gotk4_gio2_DBusInterfaceSkeleton_ConnectGAuthorizeMethod +func _gotk4_gio2_DBusInterfaceSkeleton_ConnectGAuthorizeMethod(arg0 C.gpointer, arg1 *C.GDBusMethodInvocation, arg2 C.guintptr) (cret C.gboolean) { + var f func(invocation *DBusMethodInvocation) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(invocation *DBusMethodInvocation) (ok bool)) + } + + var _invocation *DBusMethodInvocation // out + + _invocation = wrapDBusMethodInvocation(coreglib.Take(unsafe.Pointer(arg1))) + + ok := f(_invocation) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_DBusObjectManagerClientClass_interface_proxy_signal +func _gotk4_gio2_DBusObjectManagerClientClass_interface_proxy_signal(arg0 *C.GDBusObjectManagerClient, arg1 *C.GDBusObjectProxy, arg2 *C.GDBusProxy, arg3 *C.gchar, arg4 *C.gchar, arg5 *C.GVariant) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[DBusObjectManagerClientOverrides](instance0) + if overrides.InterfaceProxySignal == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected DBusObjectManagerClientOverrides.InterfaceProxySignal, got none") + } + + var _objectProxy *DBusObjectProxy // out + var _interfaceProxy *DBusProxy // out + var _senderName string // out + var _signalName string // out + var _parameters *glib.Variant // out + + _objectProxy = wrapDBusObjectProxy(coreglib.Take(unsafe.Pointer(arg1))) + _interfaceProxy = wrapDBusProxy(coreglib.Take(unsafe.Pointer(arg2))) + _senderName = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _signalName = C.GoString((*C.gchar)(unsafe.Pointer(arg4))) + _parameters = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg5))) + C.g_variant_ref(arg5) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_parameters)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + overrides.InterfaceProxySignal(_objectProxy, _interfaceProxy, _senderName, _signalName, _parameters) +} + +//export _gotk4_gio2_DBusObjectManagerClient_ConnectInterfaceProxyPropertiesChanged +func _gotk4_gio2_DBusObjectManagerClient_ConnectInterfaceProxyPropertiesChanged(arg0 C.gpointer, arg1 *C.GDBusObjectProxy, arg2 *C.GDBusProxy, arg3 *C.GVariant, arg4 **C.gchar, arg5 C.guintptr) { + var f func(objectProxy *DBusObjectProxy, interfaceProxy *DBusProxy, changedProperties *glib.Variant, invalidatedProperties []string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg5)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(objectProxy *DBusObjectProxy, interfaceProxy *DBusProxy, changedProperties *glib.Variant, invalidatedProperties []string)) + } + + var _objectProxy *DBusObjectProxy // out + var _interfaceProxy *DBusProxy // out + var _changedProperties *glib.Variant // out + var _invalidatedProperties []string // out + + _objectProxy = wrapDBusObjectProxy(coreglib.Take(unsafe.Pointer(arg1))) + _interfaceProxy = wrapDBusProxy(coreglib.Take(unsafe.Pointer(arg2))) + _changedProperties = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg3))) + C.g_variant_ref(arg3) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_changedProperties)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + { + var i int + var z *C.gchar + for p := arg4; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(arg4, i) + _invalidatedProperties = make([]string, i) + for i := range src { + _invalidatedProperties[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + f(_objectProxy, _interfaceProxy, _changedProperties, _invalidatedProperties) +} + +//export _gotk4_gio2_DBusObjectManagerClient_ConnectInterfaceProxySignal +func _gotk4_gio2_DBusObjectManagerClient_ConnectInterfaceProxySignal(arg0 C.gpointer, arg1 *C.GDBusObjectProxy, arg2 *C.GDBusProxy, arg3 *C.gchar, arg4 *C.gchar, arg5 *C.GVariant, arg6 C.guintptr) { + var f func(objectProxy *DBusObjectProxy, interfaceProxy *DBusProxy, senderName, signalName string, parameters *glib.Variant) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg6)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(objectProxy *DBusObjectProxy, interfaceProxy *DBusProxy, senderName, signalName string, parameters *glib.Variant)) + } + + var _objectProxy *DBusObjectProxy // out + var _interfaceProxy *DBusProxy // out + var _senderName string // out + var _signalName string // out + var _parameters *glib.Variant // out + + _objectProxy = wrapDBusObjectProxy(coreglib.Take(unsafe.Pointer(arg1))) + _interfaceProxy = wrapDBusProxy(coreglib.Take(unsafe.Pointer(arg2))) + _senderName = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _signalName = C.GoString((*C.gchar)(unsafe.Pointer(arg4))) + _parameters = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg5))) + C.g_variant_ref(arg5) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_parameters)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + f(_objectProxy, _interfaceProxy, _senderName, _signalName, _parameters) +} + +//export _gotk4_gio2_DBusObjectSkeletonClass_authorize_method +func _gotk4_gio2_DBusObjectSkeletonClass_authorize_method(arg0 *C.GDBusObjectSkeleton, arg1 *C.GDBusInterfaceSkeleton, arg2 *C.GDBusMethodInvocation) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[DBusObjectSkeletonOverrides](instance0) + if overrides.AuthorizeMethod == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected DBusObjectSkeletonOverrides.AuthorizeMethod, got none") + } + + var _interface_ DBusInterfaceSkeletonner // out + var _invocation *DBusMethodInvocation // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.DBusInterfaceSkeletonner is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusInterfaceSkeletonner) + return ok + }) + rv, ok := casted.(DBusInterfaceSkeletonner) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusInterfaceSkeletonner") + } + _interface_ = rv + } + _invocation = wrapDBusMethodInvocation(coreglib.Take(unsafe.Pointer(arg2))) + + ok := overrides.AuthorizeMethod(_interface_, _invocation) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_DBusObjectSkeleton_ConnectAuthorizeMethod +func _gotk4_gio2_DBusObjectSkeleton_ConnectAuthorizeMethod(arg0 C.gpointer, arg1 *C.GDBusInterfaceSkeleton, arg2 *C.GDBusMethodInvocation, arg3 C.guintptr) (cret C.gboolean) { + var f func(iface DBusInterfaceSkeletonner, invocation *DBusMethodInvocation) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(iface DBusInterfaceSkeletonner, invocation *DBusMethodInvocation) (ok bool)) + } + + var _iface DBusInterfaceSkeletonner // out + var _invocation *DBusMethodInvocation // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.DBusInterfaceSkeletonner is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(DBusInterfaceSkeletonner) + return ok + }) + rv, ok := casted.(DBusInterfaceSkeletonner) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DBusInterfaceSkeletonner") + } + _iface = rv + } + _invocation = wrapDBusMethodInvocation(coreglib.Take(unsafe.Pointer(arg2))) + + ok := f(_iface, _invocation) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_DBusProxyClass_g_signal +func _gotk4_gio2_DBusProxyClass_g_signal(arg0 *C.GDBusProxy, arg1 *C.gchar, arg2 *C.gchar, arg3 *C.GVariant) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[DBusProxyOverrides](instance0) + if overrides.GSignal == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected DBusProxyOverrides.GSignal, got none") + } + + var _senderName string // out + var _signalName string // out + var _parameters *glib.Variant // out + + _senderName = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _signalName = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _parameters = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg3))) + C.g_variant_ref(arg3) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_parameters)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + overrides.GSignal(_senderName, _signalName, _parameters) +} + +//export _gotk4_gio2_DBusProxy_ConnectGPropertiesChanged +func _gotk4_gio2_DBusProxy_ConnectGPropertiesChanged(arg0 C.gpointer, arg1 *C.GVariant, arg2 **C.gchar, arg3 C.guintptr) { + var f func(changedProperties *glib.Variant, invalidatedProperties []string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(changedProperties *glib.Variant, invalidatedProperties []string)) + } + + var _changedProperties *glib.Variant // out + var _invalidatedProperties []string // out + + _changedProperties = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_variant_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_changedProperties)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + { + var i int + var z *C.gchar + for p := arg2; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(arg2, i) + _invalidatedProperties = make([]string, i) + for i := range src { + _invalidatedProperties[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + f(_changedProperties, _invalidatedProperties) +} + +//export _gotk4_gio2_DBusProxy_ConnectGSignal +func _gotk4_gio2_DBusProxy_ConnectGSignal(arg0 C.gpointer, arg1 *C.gchar, arg2 *C.gchar, arg3 *C.GVariant, arg4 C.guintptr) { + var f func(senderName, signalName string, parameters *glib.Variant) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg4)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(senderName, signalName string, parameters *glib.Variant)) + } + + var _senderName string // out + var _signalName string // out + var _parameters *glib.Variant // out + + if arg1 != nil { + _senderName = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + } + _signalName = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _parameters = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg3))) + C.g_variant_ref(arg3) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_parameters)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + f(_senderName, _signalName, _parameters) +} + +//export _gotk4_gio2_DBusServer_ConnectNewConnection +func _gotk4_gio2_DBusServer_ConnectNewConnection(arg0 C.gpointer, arg1 *C.GDBusConnection, arg2 C.guintptr) (cret C.gboolean) { + var f func(connection *DBusConnection) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(connection *DBusConnection) (ok bool)) + } + + var _connection *DBusConnection // out + + _connection = wrapDBusConnection(coreglib.Take(unsafe.Pointer(arg1))) + + ok := f(_connection) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_DebugControllerDBusClass_authorize +func _gotk4_gio2_DebugControllerDBusClass_authorize(arg0 *C.GDebugControllerDBus, arg1 *C.GDBusMethodInvocation) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[DebugControllerDBusOverrides](instance0) + if overrides.Authorize == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected DebugControllerDBusOverrides.Authorize, got none") + } + + var _invocation *DBusMethodInvocation // out + + _invocation = wrapDBusMethodInvocation(coreglib.Take(unsafe.Pointer(arg1))) + + ok := overrides.Authorize(_invocation) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_DebugControllerDBus_ConnectAuthorize +func _gotk4_gio2_DebugControllerDBus_ConnectAuthorize(arg0 C.gpointer, arg1 *C.GDBusMethodInvocation, arg2 C.guintptr) (cret C.gboolean) { + var f func(invocation *DBusMethodInvocation) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(invocation *DBusMethodInvocation) (ok bool)) + } + + var _invocation *DBusMethodInvocation // out + + _invocation = wrapDBusMethodInvocation(coreglib.Take(unsafe.Pointer(arg1))) + + ok := f(_invocation) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_FileEnumeratorClass_close_finish +func _gotk4_gio2_FileEnumeratorClass_close_finish(arg0 *C.GFileEnumerator, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileEnumeratorOverrides](instance0) + if overrides.CloseFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileEnumeratorOverrides.CloseFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + _goerr := overrides.CloseFinish(_result) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileEnumeratorClass_close_fn +func _gotk4_gio2_FileEnumeratorClass_close_fn(arg0 *C.GFileEnumerator, arg1 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileEnumeratorOverrides](instance0) + if overrides.CloseFn == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileEnumeratorOverrides.CloseFn, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + _goerr := overrides.CloseFn(_cancellable) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileEnumeratorClass_next_file +func _gotk4_gio2_FileEnumeratorClass_next_file(arg0 *C.GFileEnumerator, arg1 *C.GCancellable, _cerr **C.GError) (cret *C.GFileInfo) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileEnumeratorOverrides](instance0) + if overrides.NextFile == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileEnumeratorOverrides.NextFile, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + fileInfo, _goerr := overrides.NextFile(_cancellable) + + var _ *FileInfo + var _ error + + if fileInfo != nil { + cret = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(fileInfo).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(fileInfo).Native())) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileEnumeratorClass_next_files_finish +func _gotk4_gio2_FileEnumeratorClass_next_files_finish(arg0 *C.GFileEnumerator, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileEnumeratorOverrides](instance0) + if overrides.NextFilesFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileEnumeratorOverrides.NextFilesFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + list, _goerr := overrides.NextFilesFinish(_result) + + var _ []*FileInfo + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GFileInfo // out + dst = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileIOStreamClass_can_seek +func _gotk4_gio2_FileIOStreamClass_can_seek(arg0 *C.GFileIOStream) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileIOStreamOverrides](instance0) + if overrides.CanSeek == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileIOStreamOverrides.CanSeek, got none") + } + + ok := overrides.CanSeek() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_FileIOStreamClass_can_truncate +func _gotk4_gio2_FileIOStreamClass_can_truncate(arg0 *C.GFileIOStream) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileIOStreamOverrides](instance0) + if overrides.CanTruncate == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileIOStreamOverrides.CanTruncate, got none") + } + + ok := overrides.CanTruncate() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_FileIOStreamClass_get_etag +func _gotk4_gio2_FileIOStreamClass_get_etag(arg0 *C.GFileIOStream) (cret *C.char) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileIOStreamOverrides](instance0) + if overrides.ETag == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileIOStreamOverrides.ETag, got none") + } + + utf8 := overrides.ETag() + + var _ string + + if utf8 != "" { + cret = (*C.char)(unsafe.Pointer(C.CString(utf8))) + } + + return cret +} + +//export _gotk4_gio2_FileIOStreamClass_query_info +func _gotk4_gio2_FileIOStreamClass_query_info(arg0 *C.GFileIOStream, arg1 *C.char, arg2 *C.GCancellable, _cerr **C.GError) (cret *C.GFileInfo) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileIOStreamOverrides](instance0) + if overrides.QueryInfo == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileIOStreamOverrides.QueryInfo, got none") + } + + var _cancellable context.Context // out + var _attributes string // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _attributes = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + fileInfo, _goerr := overrides.QueryInfo(_cancellable, _attributes) + + var _ *FileInfo + var _ error + + cret = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(fileInfo).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(fileInfo).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileIOStreamClass_query_info_finish +func _gotk4_gio2_FileIOStreamClass_query_info_finish(arg0 *C.GFileIOStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GFileInfo) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileIOStreamOverrides](instance0) + if overrides.QueryInfoFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileIOStreamOverrides.QueryInfoFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + fileInfo, _goerr := overrides.QueryInfoFinish(_result) + + var _ *FileInfo + var _ error + + cret = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(fileInfo).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(fileInfo).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileIOStreamClass_seek +func _gotk4_gio2_FileIOStreamClass_seek(arg0 *C.GFileIOStream, arg1 C.goffset, arg2 C.GSeekType, arg3 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileIOStreamOverrides](instance0) + if overrides.Seek == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileIOStreamOverrides.Seek, got none") + } + + var _cancellable context.Context // out + var _offset int64 // out + var _typ glib.SeekType // out + + if arg3 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg3)) + } + _offset = int64(arg1) + _typ = glib.SeekType(arg2) + + _goerr := overrides.Seek(_cancellable, _offset, _typ) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileIOStreamClass_tell +func _gotk4_gio2_FileIOStreamClass_tell(arg0 *C.GFileIOStream) (cret C.goffset) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileIOStreamOverrides](instance0) + if overrides.Tell == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileIOStreamOverrides.Tell, got none") + } + + gint64 := overrides.Tell() + + var _ int64 + + cret = C.goffset(gint64) + + return cret +} + +//export _gotk4_gio2_FileIOStreamClass_truncate_fn +func _gotk4_gio2_FileIOStreamClass_truncate_fn(arg0 *C.GFileIOStream, arg1 C.goffset, arg2 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileIOStreamOverrides](instance0) + if overrides.TruncateFn == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileIOStreamOverrides.TruncateFn, got none") + } + + var _cancellable context.Context // out + var _size int64 // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _size = int64(arg1) + + _goerr := overrides.TruncateFn(_cancellable, _size) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileInputStreamClass_can_seek +func _gotk4_gio2_FileInputStreamClass_can_seek(arg0 *C.GFileInputStream) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileInputStreamOverrides](instance0) + if overrides.CanSeek == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileInputStreamOverrides.CanSeek, got none") + } + + ok := overrides.CanSeek() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_FileInputStreamClass_query_info +func _gotk4_gio2_FileInputStreamClass_query_info(arg0 *C.GFileInputStream, arg1 *C.char, arg2 *C.GCancellable, _cerr **C.GError) (cret *C.GFileInfo) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileInputStreamOverrides](instance0) + if overrides.QueryInfo == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileInputStreamOverrides.QueryInfo, got none") + } + + var _cancellable context.Context // out + var _attributes string // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _attributes = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + fileInfo, _goerr := overrides.QueryInfo(_cancellable, _attributes) + + var _ *FileInfo + var _ error + + cret = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(fileInfo).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(fileInfo).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileInputStreamClass_query_info_finish +func _gotk4_gio2_FileInputStreamClass_query_info_finish(arg0 *C.GFileInputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GFileInfo) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileInputStreamOverrides](instance0) + if overrides.QueryInfoFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileInputStreamOverrides.QueryInfoFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + fileInfo, _goerr := overrides.QueryInfoFinish(_result) + + var _ *FileInfo + var _ error + + cret = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(fileInfo).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(fileInfo).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileInputStreamClass_seek +func _gotk4_gio2_FileInputStreamClass_seek(arg0 *C.GFileInputStream, arg1 C.goffset, arg2 C.GSeekType, arg3 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileInputStreamOverrides](instance0) + if overrides.Seek == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileInputStreamOverrides.Seek, got none") + } + + var _cancellable context.Context // out + var _offset int64 // out + var _typ glib.SeekType // out + + if arg3 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg3)) + } + _offset = int64(arg1) + _typ = glib.SeekType(arg2) + + _goerr := overrides.Seek(_cancellable, _offset, _typ) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileInputStreamClass_tell +func _gotk4_gio2_FileInputStreamClass_tell(arg0 *C.GFileInputStream) (cret C.goffset) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileInputStreamOverrides](instance0) + if overrides.Tell == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileInputStreamOverrides.Tell, got none") + } + + gint64 := overrides.Tell() + + var _ int64 + + cret = C.goffset(gint64) + + return cret +} + +//export _gotk4_gio2_FileMonitorClass_cancel +func _gotk4_gio2_FileMonitorClass_cancel(arg0 *C.GFileMonitor) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileMonitorOverrides](instance0) + if overrides.Cancel == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileMonitorOverrides.Cancel, got none") + } + + ok := overrides.Cancel() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_FileMonitorClass_changed +func _gotk4_gio2_FileMonitorClass_changed(arg0 *C.GFileMonitor, arg1 *C.GFile, arg2 *C.GFile, arg3 C.GFileMonitorEvent) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileMonitorOverrides](instance0) + if overrides.Changed == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileMonitorOverrides.Changed, got none") + } + + var _file Filer // out + var _otherFile Filer // out + var _eventType FileMonitorEvent // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Filer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Filer) + return ok + }) + rv, ok := casted.(Filer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Filer") + } + _file = rv + } + { + objptr := unsafe.Pointer(arg2) + if objptr == nil { + panic("object of type gio.Filer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Filer) + return ok + }) + rv, ok := casted.(Filer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Filer") + } + _otherFile = rv + } + _eventType = FileMonitorEvent(arg3) + + overrides.Changed(_file, _otherFile, _eventType) +} + +//export _gotk4_gio2_FileMonitor_ConnectChanged +func _gotk4_gio2_FileMonitor_ConnectChanged(arg0 C.gpointer, arg1 *C.GFile, arg2 *C.GFile, arg3 C.GFileMonitorEvent, arg4 C.guintptr) { + var f func(file, otherFile Filer, eventType FileMonitorEvent) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg4)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(file, otherFile Filer, eventType FileMonitorEvent)) + } + + var _file Filer // out + var _otherFile Filer // out + var _eventType FileMonitorEvent // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Filer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Filer) + return ok + }) + rv, ok := casted.(Filer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Filer") + } + _file = rv + } + if arg2 != nil { + { + objptr := unsafe.Pointer(arg2) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Filer) + return ok + }) + rv, ok := casted.(Filer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Filer") + } + _otherFile = rv + } + } + _eventType = FileMonitorEvent(arg3) + + f(_file, _otherFile, _eventType) +} + +//export _gotk4_gio2_FileOutputStreamClass_can_seek +func _gotk4_gio2_FileOutputStreamClass_can_seek(arg0 *C.GFileOutputStream) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileOutputStreamOverrides](instance0) + if overrides.CanSeek == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileOutputStreamOverrides.CanSeek, got none") + } + + ok := overrides.CanSeek() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_FileOutputStreamClass_can_truncate +func _gotk4_gio2_FileOutputStreamClass_can_truncate(arg0 *C.GFileOutputStream) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileOutputStreamOverrides](instance0) + if overrides.CanTruncate == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileOutputStreamOverrides.CanTruncate, got none") + } + + ok := overrides.CanTruncate() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_FileOutputStreamClass_get_etag +func _gotk4_gio2_FileOutputStreamClass_get_etag(arg0 *C.GFileOutputStream) (cret *C.char) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileOutputStreamOverrides](instance0) + if overrides.ETag == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileOutputStreamOverrides.ETag, got none") + } + + utf8 := overrides.ETag() + + var _ string + + if utf8 != "" { + cret = (*C.char)(unsafe.Pointer(C.CString(utf8))) + } + + return cret +} + +//export _gotk4_gio2_FileOutputStreamClass_query_info +func _gotk4_gio2_FileOutputStreamClass_query_info(arg0 *C.GFileOutputStream, arg1 *C.char, arg2 *C.GCancellable, _cerr **C.GError) (cret *C.GFileInfo) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileOutputStreamOverrides](instance0) + if overrides.QueryInfo == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileOutputStreamOverrides.QueryInfo, got none") + } + + var _cancellable context.Context // out + var _attributes string // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _attributes = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + fileInfo, _goerr := overrides.QueryInfo(_cancellable, _attributes) + + var _ *FileInfo + var _ error + + cret = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(fileInfo).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(fileInfo).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileOutputStreamClass_query_info_finish +func _gotk4_gio2_FileOutputStreamClass_query_info_finish(arg0 *C.GFileOutputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GFileInfo) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileOutputStreamOverrides](instance0) + if overrides.QueryInfoFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileOutputStreamOverrides.QueryInfoFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + fileInfo, _goerr := overrides.QueryInfoFinish(_result) + + var _ *FileInfo + var _ error + + cret = (*C.GFileInfo)(unsafe.Pointer(coreglib.InternObject(fileInfo).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(fileInfo).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileOutputStreamClass_seek +func _gotk4_gio2_FileOutputStreamClass_seek(arg0 *C.GFileOutputStream, arg1 C.goffset, arg2 C.GSeekType, arg3 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileOutputStreamOverrides](instance0) + if overrides.Seek == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileOutputStreamOverrides.Seek, got none") + } + + var _cancellable context.Context // out + var _offset int64 // out + var _typ glib.SeekType // out + + if arg3 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg3)) + } + _offset = int64(arg1) + _typ = glib.SeekType(arg2) + + _goerr := overrides.Seek(_cancellable, _offset, _typ) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FileOutputStreamClass_tell +func _gotk4_gio2_FileOutputStreamClass_tell(arg0 *C.GFileOutputStream) (cret C.goffset) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileOutputStreamOverrides](instance0) + if overrides.Tell == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileOutputStreamOverrides.Tell, got none") + } + + gint64 := overrides.Tell() + + var _ int64 + + cret = C.goffset(gint64) + + return cret +} + +//export _gotk4_gio2_FileOutputStreamClass_truncate_fn +func _gotk4_gio2_FileOutputStreamClass_truncate_fn(arg0 *C.GFileOutputStream, arg1 C.goffset, arg2 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FileOutputStreamOverrides](instance0) + if overrides.TruncateFn == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FileOutputStreamOverrides.TruncateFn, got none") + } + + var _cancellable context.Context // out + var _size int64 // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _size = int64(arg1) + + _goerr := overrides.TruncateFn(_cancellable, _size) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_FilenameCompleterClass_got_completion_data +func _gotk4_gio2_FilenameCompleterClass_got_completion_data(arg0 *C.GFilenameCompleter) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[FilenameCompleterOverrides](instance0) + if overrides.GotCompletionData == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected FilenameCompleterOverrides.GotCompletionData, got none") + } + + overrides.GotCompletionData() +} + +//export _gotk4_gio2_FilenameCompleter_ConnectGotCompletionData +func _gotk4_gio2_FilenameCompleter_ConnectGotCompletionData(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_IOStreamClass_close_finish +func _gotk4_gio2_IOStreamClass_close_finish(arg0 *C.GIOStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[IOStreamOverrides](instance0) + if overrides.CloseFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected IOStreamOverrides.CloseFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + _goerr := overrides.CloseFinish(_result) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_IOStreamClass_close_fn +func _gotk4_gio2_IOStreamClass_close_fn(arg0 *C.GIOStream, arg1 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[IOStreamOverrides](instance0) + if overrides.CloseFn == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected IOStreamOverrides.CloseFn, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + _goerr := overrides.CloseFn(_cancellable) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_IOStreamClass_get_input_stream +func _gotk4_gio2_IOStreamClass_get_input_stream(arg0 *C.GIOStream) (cret *C.GInputStream) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[IOStreamOverrides](instance0) + if overrides.InputStream == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected IOStreamOverrides.InputStream, got none") + } + + inputStream := overrides.InputStream() + + var _ InputStreamer + + cret = (*C.GInputStream)(unsafe.Pointer(coreglib.InternObject(inputStream).Native())) + + return cret +} + +//export _gotk4_gio2_IOStreamClass_get_output_stream +func _gotk4_gio2_IOStreamClass_get_output_stream(arg0 *C.GIOStream) (cret *C.GOutputStream) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[IOStreamOverrides](instance0) + if overrides.OutputStream == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected IOStreamOverrides.OutputStream, got none") + } + + outputStream := overrides.OutputStream() + + var _ OutputStreamer + + cret = (*C.GOutputStream)(unsafe.Pointer(coreglib.InternObject(outputStream).Native())) + + return cret +} + +//export _gotk4_gio2_InetAddressClass_to_string +func _gotk4_gio2_InetAddressClass_to_string(arg0 *C.GInetAddress) (cret *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[InetAddressOverrides](instance0) + if overrides.String == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected InetAddressOverrides.String, got none") + } + + utf8 := overrides.String() + + var _ string + + cret = (*C.gchar)(unsafe.Pointer(C.CString(utf8))) + + return cret +} + +//export _gotk4_gio2_InputStreamClass_close_finish +func _gotk4_gio2_InputStreamClass_close_finish(arg0 *C.GInputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[InputStreamOverrides](instance0) + if overrides.CloseFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected InputStreamOverrides.CloseFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + _goerr := overrides.CloseFinish(_result) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_InputStreamClass_close_fn +func _gotk4_gio2_InputStreamClass_close_fn(arg0 *C.GInputStream, arg1 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[InputStreamOverrides](instance0) + if overrides.CloseFn == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected InputStreamOverrides.CloseFn, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + _goerr := overrides.CloseFn(_cancellable) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_InputStreamClass_read_finish +func _gotk4_gio2_InputStreamClass_read_finish(arg0 *C.GInputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gssize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[InputStreamOverrides](instance0) + if overrides.ReadFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected InputStreamOverrides.ReadFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + gssize, _goerr := overrides.ReadFinish(_result) + + var _ int + var _ error + + cret = C.gssize(gssize) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_InputStreamClass_skip +func _gotk4_gio2_InputStreamClass_skip(arg0 *C.GInputStream, arg1 C.gsize, arg2 *C.GCancellable, _cerr **C.GError) (cret C.gssize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[InputStreamOverrides](instance0) + if overrides.Skip == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected InputStreamOverrides.Skip, got none") + } + + var _cancellable context.Context // out + var _count uint // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _count = uint(arg1) + + gssize, _goerr := overrides.Skip(_cancellable, _count) + + var _ int + var _ error + + cret = C.gssize(gssize) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_InputStreamClass_skip_finish +func _gotk4_gio2_InputStreamClass_skip_finish(arg0 *C.GInputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gssize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[InputStreamOverrides](instance0) + if overrides.SkipFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected InputStreamOverrides.SkipFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + gssize, _goerr := overrides.SkipFinish(_result) + + var _ int + var _ error + + cret = C.gssize(gssize) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_MenuAttributeIterClass_get_next +func _gotk4_gio2_MenuAttributeIterClass_get_next(arg0 *C.GMenuAttributeIter, arg1 **C.gchar, arg2 **C.GVariant) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuAttributeIterOverrides](instance0) + if overrides.Next == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuAttributeIterOverrides.Next, got none") + } + + outName, value, ok := overrides.Next() + + var _ string + var _ *glib.Variant + var _ bool + + if outName != "" { + *arg1 = (*C.gchar)(unsafe.Pointer(C.CString(outName))) + defer C.free(unsafe.Pointer(*arg1)) + } + if value != nil { + if value != nil { + *arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + } + } + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_MenuLinkIterClass_get_next +func _gotk4_gio2_MenuLinkIterClass_get_next(arg0 *C.GMenuLinkIter, arg1 **C.gchar, arg2 **C.GMenuModel) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuLinkIterOverrides](instance0) + if overrides.Next == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuLinkIterOverrides.Next, got none") + } + + outLink, value, ok := overrides.Next() + + var _ string + var _ MenuModeller + var _ bool + + if outLink != "" { + *arg1 = (*C.gchar)(unsafe.Pointer(C.CString(outLink))) + defer C.free(unsafe.Pointer(*arg1)) + } + if value != nil { + if value != nil { + *arg2 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(value).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(value).Native())) + } + } + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_MenuModelClass_get_item_attribute_value +func _gotk4_gio2_MenuModelClass_get_item_attribute_value(arg0 *C.GMenuModel, arg1 C.gint, arg2 *C.gchar, arg3 *C.GVariantType) (cret *C.GVariant) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuModelOverrides](instance0) + if overrides.ItemAttributeValue == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuModelOverrides.ItemAttributeValue, got none") + } + + var _itemIndex int // out + var _attribute string // out + var _expectedType *glib.VariantType // out + + _itemIndex = int(arg1) + _attribute = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + if arg3 != nil { + _expectedType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(arg3))) + } + + variant := overrides.ItemAttributeValue(_itemIndex, _attribute, _expectedType) + + var _ *glib.Variant + + if variant != nil { + cret = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(variant))) + } + + return cret +} + +//export _gotk4_gio2_MenuModelClass_get_item_attributes +func _gotk4_gio2_MenuModelClass_get_item_attributes(arg0 *C.GMenuModel, arg1 C.gint, arg2 **C.GHashTable) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuModelOverrides](instance0) + if overrides.ItemAttributes == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuModelOverrides.ItemAttributes, got none") + } + + var _itemIndex int // out + + _itemIndex = int(arg1) + + attributes := overrides.ItemAttributes(_itemIndex) + + var _ map[string]*glib.Variant + + *arg2 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range attributes { + var kdst *C.gchar // out + var vdst *C.GVariant // out + kdst = (*C.gchar)(unsafe.Pointer(C.CString(ksrc))) + defer C.free(unsafe.Pointer(kdst)) + vdst = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(vsrc))) + C.g_hash_table_insert(*arg2, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } +} + +//export _gotk4_gio2_MenuModelClass_get_item_link +func _gotk4_gio2_MenuModelClass_get_item_link(arg0 *C.GMenuModel, arg1 C.gint, arg2 *C.gchar) (cret *C.GMenuModel) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuModelOverrides](instance0) + if overrides.ItemLink == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuModelOverrides.ItemLink, got none") + } + + var _itemIndex int // out + var _link string // out + + _itemIndex = int(arg1) + _link = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + menuModel := overrides.ItemLink(_itemIndex, _link) + + var _ MenuModeller + + if menuModel != nil { + cret = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(menuModel).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(menuModel).Native())) + } + + return cret +} + +//export _gotk4_gio2_MenuModelClass_get_item_links +func _gotk4_gio2_MenuModelClass_get_item_links(arg0 *C.GMenuModel, arg1 C.gint, arg2 **C.GHashTable) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuModelOverrides](instance0) + if overrides.ItemLinks == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuModelOverrides.ItemLinks, got none") + } + + var _itemIndex int // out + + _itemIndex = int(arg1) + + links := overrides.ItemLinks(_itemIndex) + + var _ map[string]MenuModeller + + *arg2 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range links { + var kdst *C.gchar // out + var vdst *C.GMenuModel // out + kdst = (*C.gchar)(unsafe.Pointer(C.CString(ksrc))) + defer C.free(unsafe.Pointer(kdst)) + vdst = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(vsrc).Native())) + C.g_hash_table_insert(*arg2, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } +} + +//export _gotk4_gio2_MenuModelClass_get_n_items +func _gotk4_gio2_MenuModelClass_get_n_items(arg0 *C.GMenuModel) (cret C.gint) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuModelOverrides](instance0) + if overrides.NItems == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuModelOverrides.NItems, got none") + } + + gint := overrides.NItems() + + var _ int + + cret = C.gint(gint) + + return cret +} + +//export _gotk4_gio2_MenuModelClass_is_mutable +func _gotk4_gio2_MenuModelClass_is_mutable(arg0 *C.GMenuModel) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuModelOverrides](instance0) + if overrides.IsMutable == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuModelOverrides.IsMutable, got none") + } + + ok := overrides.IsMutable() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_MenuModelClass_iterate_item_attributes +func _gotk4_gio2_MenuModelClass_iterate_item_attributes(arg0 *C.GMenuModel, arg1 C.gint) (cret *C.GMenuAttributeIter) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuModelOverrides](instance0) + if overrides.IterateItemAttributes == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuModelOverrides.IterateItemAttributes, got none") + } + + var _itemIndex int // out + + _itemIndex = int(arg1) + + menuAttributeIter := overrides.IterateItemAttributes(_itemIndex) + + var _ MenuAttributeIterer + + cret = (*C.GMenuAttributeIter)(unsafe.Pointer(coreglib.InternObject(menuAttributeIter).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(menuAttributeIter).Native())) + + return cret +} + +//export _gotk4_gio2_MenuModelClass_iterate_item_links +func _gotk4_gio2_MenuModelClass_iterate_item_links(arg0 *C.GMenuModel, arg1 C.gint) (cret *C.GMenuLinkIter) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MenuModelOverrides](instance0) + if overrides.IterateItemLinks == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MenuModelOverrides.IterateItemLinks, got none") + } + + var _itemIndex int // out + + _itemIndex = int(arg1) + + menuLinkIter := overrides.IterateItemLinks(_itemIndex) + + var _ MenuLinkIterer + + cret = (*C.GMenuLinkIter)(unsafe.Pointer(coreglib.InternObject(menuLinkIter).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(menuLinkIter).Native())) + + return cret +} + +//export _gotk4_gio2_MenuModel_ConnectItemsChanged +func _gotk4_gio2_MenuModel_ConnectItemsChanged(arg0 C.gpointer, arg1 C.gint, arg2 C.gint, arg3 C.gint, arg4 C.guintptr) { + var f func(position, removed, added int) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg4)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(position, removed, added int)) + } + + var _position int // out + var _removed int // out + var _added int // out + + _position = int(arg1) + _removed = int(arg2) + _added = int(arg3) + + f(_position, _removed, _added) +} + +//export _gotk4_gio2_MountOperationClass_aborted +func _gotk4_gio2_MountOperationClass_aborted(arg0 *C.GMountOperation) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MountOperationOverrides](instance0) + if overrides.Aborted == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MountOperationOverrides.Aborted, got none") + } + + overrides.Aborted() +} + +//export _gotk4_gio2_MountOperationClass_ask_password +func _gotk4_gio2_MountOperationClass_ask_password(arg0 *C.GMountOperation, arg1 *C.char, arg2 *C.char, arg3 *C.char, arg4 C.GAskPasswordFlags) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MountOperationOverrides](instance0) + if overrides.AskPassword == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MountOperationOverrides.AskPassword, got none") + } + + var _message string // out + var _defaultUser string // out + var _defaultDomain string // out + var _flags AskPasswordFlags // out + + _message = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _defaultUser = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _defaultDomain = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _flags = AskPasswordFlags(arg4) + + overrides.AskPassword(_message, _defaultUser, _defaultDomain, _flags) +} + +//export _gotk4_gio2_MountOperationClass_ask_question +func _gotk4_gio2_MountOperationClass_ask_question(arg0 *C.GMountOperation, arg1 *C.char, arg2 **C.char) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MountOperationOverrides](instance0) + if overrides.AskQuestion == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MountOperationOverrides.AskQuestion, got none") + } + + var _message string // out + var _choices []string // out + + _message = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + { + var i int + var z *C.char + for p := arg2; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(arg2, i) + _choices = make([]string, i) + for i := range src { + _choices[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + overrides.AskQuestion(_message, _choices) +} + +//export _gotk4_gio2_MountOperationClass_reply +func _gotk4_gio2_MountOperationClass_reply(arg0 *C.GMountOperation, arg1 C.GMountOperationResult) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MountOperationOverrides](instance0) + if overrides.Reply == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MountOperationOverrides.Reply, got none") + } + + var _result MountOperationResult // out + + _result = MountOperationResult(arg1) + + overrides.Reply(_result) +} + +//export _gotk4_gio2_MountOperationClass_show_unmount_progress +func _gotk4_gio2_MountOperationClass_show_unmount_progress(arg0 *C.GMountOperation, arg1 *C.gchar, arg2 C.gint64, arg3 C.gint64) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[MountOperationOverrides](instance0) + if overrides.ShowUnmountProgress == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected MountOperationOverrides.ShowUnmountProgress, got none") + } + + var _message string // out + var _timeLeft int64 // out + var _bytesLeft int64 // out + + _message = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _timeLeft = int64(arg2) + _bytesLeft = int64(arg3) + + overrides.ShowUnmountProgress(_message, _timeLeft, _bytesLeft) +} + +//export _gotk4_gio2_MountOperation_ConnectAborted +func _gotk4_gio2_MountOperation_ConnectAborted(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_MountOperation_ConnectAskPassword +func _gotk4_gio2_MountOperation_ConnectAskPassword(arg0 C.gpointer, arg1 *C.gchar, arg2 *C.gchar, arg3 *C.gchar, arg4 C.GAskPasswordFlags, arg5 C.guintptr) { + var f func(message, defaultUser, defaultDomain string, flags AskPasswordFlags) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg5)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(message, defaultUser, defaultDomain string, flags AskPasswordFlags)) + } + + var _message string // out + var _defaultUser string // out + var _defaultDomain string // out + var _flags AskPasswordFlags // out + + _message = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _defaultUser = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + _defaultDomain = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + _flags = AskPasswordFlags(arg4) + + f(_message, _defaultUser, _defaultDomain, _flags) +} + +//export _gotk4_gio2_MountOperation_ConnectAskQuestion +func _gotk4_gio2_MountOperation_ConnectAskQuestion(arg0 C.gpointer, arg1 *C.gchar, arg2 **C.gchar, arg3 C.guintptr) { + var f func(message string, choices []string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(message string, choices []string)) + } + + var _message string // out + var _choices []string // out + + _message = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + { + var i int + var z *C.gchar + for p := arg2; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(arg2, i) + _choices = make([]string, i) + for i := range src { + _choices[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + f(_message, _choices) +} + +//export _gotk4_gio2_MountOperation_ConnectReply +func _gotk4_gio2_MountOperation_ConnectReply(arg0 C.gpointer, arg1 C.GMountOperationResult, arg2 C.guintptr) { + var f func(result MountOperationResult) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(result MountOperationResult)) + } + + var _result MountOperationResult // out + + _result = MountOperationResult(arg1) + + f(_result) +} + +//export _gotk4_gio2_MountOperation_ConnectShowUnmountProgress +func _gotk4_gio2_MountOperation_ConnectShowUnmountProgress(arg0 C.gpointer, arg1 *C.gchar, arg2 C.gint64, arg3 C.gint64, arg4 C.guintptr) { + var f func(message string, timeLeft, bytesLeft int64) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg4)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(message string, timeLeft, bytesLeft int64)) + } + + var _message string // out + var _timeLeft int64 // out + var _bytesLeft int64 // out + + _message = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _timeLeft = int64(arg2) + _bytesLeft = int64(arg3) + + f(_message, _timeLeft, _bytesLeft) +} + +//export _gotk4_gio2_OutputStreamClass_close_finish +func _gotk4_gio2_OutputStreamClass_close_finish(arg0 *C.GOutputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[OutputStreamOverrides](instance0) + if overrides.CloseFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected OutputStreamOverrides.CloseFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + _goerr := overrides.CloseFinish(_result) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_OutputStreamClass_close_fn +func _gotk4_gio2_OutputStreamClass_close_fn(arg0 *C.GOutputStream, arg1 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[OutputStreamOverrides](instance0) + if overrides.CloseFn == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected OutputStreamOverrides.CloseFn, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + _goerr := overrides.CloseFn(_cancellable) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_OutputStreamClass_flush +func _gotk4_gio2_OutputStreamClass_flush(arg0 *C.GOutputStream, arg1 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[OutputStreamOverrides](instance0) + if overrides.Flush == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected OutputStreamOverrides.Flush, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + _goerr := overrides.Flush(_cancellable) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_OutputStreamClass_flush_finish +func _gotk4_gio2_OutputStreamClass_flush_finish(arg0 *C.GOutputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[OutputStreamOverrides](instance0) + if overrides.FlushFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected OutputStreamOverrides.FlushFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + _goerr := overrides.FlushFinish(_result) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_OutputStreamClass_splice +func _gotk4_gio2_OutputStreamClass_splice(arg0 *C.GOutputStream, arg1 *C.GInputStream, arg2 C.GOutputStreamSpliceFlags, arg3 *C.GCancellable, _cerr **C.GError) (cret C.gssize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[OutputStreamOverrides](instance0) + if overrides.Splice == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected OutputStreamOverrides.Splice, got none") + } + + var _cancellable context.Context // out + var _source InputStreamer // out + var _flags OutputStreamSpliceFlags // out + + if arg3 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg3)) + } + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.InputStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(InputStreamer) + return ok + }) + rv, ok := casted.(InputStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + } + _source = rv + } + _flags = OutputStreamSpliceFlags(arg2) + + gssize, _goerr := overrides.Splice(_cancellable, _source, _flags) + + var _ int + var _ error + + cret = C.gssize(gssize) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_OutputStreamClass_splice_finish +func _gotk4_gio2_OutputStreamClass_splice_finish(arg0 *C.GOutputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gssize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[OutputStreamOverrides](instance0) + if overrides.SpliceFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected OutputStreamOverrides.SpliceFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + gssize, _goerr := overrides.SpliceFinish(_result) + + var _ int + var _ error + + cret = C.gssize(gssize) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_OutputStreamClass_write_finish +func _gotk4_gio2_OutputStreamClass_write_finish(arg0 *C.GOutputStream, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gssize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[OutputStreamOverrides](instance0) + if overrides.WriteFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected OutputStreamOverrides.WriteFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + gssize, _goerr := overrides.WriteFinish(_result) + + var _ int + var _ error + + cret = C.gssize(gssize) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_OutputStreamClass_writev_finish +func _gotk4_gio2_OutputStreamClass_writev_finish(arg0 *C.GOutputStream, arg1 *C.GAsyncResult, arg2 *C.gsize, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[OutputStreamOverrides](instance0) + if overrides.WritevFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected OutputStreamOverrides.WritevFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + bytesWritten, _goerr := overrides.WritevFinish(_result) + + var _ uint + var _ error + + *arg2 = C.gsize(bytesWritten) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_PermissionClass_acquire +func _gotk4_gio2_PermissionClass_acquire(arg0 *C.GPermission, arg1 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[PermissionOverrides](instance0) + if overrides.Acquire == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected PermissionOverrides.Acquire, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + _goerr := overrides.Acquire(_cancellable) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_PermissionClass_acquire_finish +func _gotk4_gio2_PermissionClass_acquire_finish(arg0 *C.GPermission, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[PermissionOverrides](instance0) + if overrides.AcquireFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected PermissionOverrides.AcquireFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + _goerr := overrides.AcquireFinish(_result) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_PermissionClass_release +func _gotk4_gio2_PermissionClass_release(arg0 *C.GPermission, arg1 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[PermissionOverrides](instance0) + if overrides.Release == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected PermissionOverrides.Release, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + _goerr := overrides.Release(_cancellable) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_PermissionClass_release_finish +func _gotk4_gio2_PermissionClass_release_finish(arg0 *C.GPermission, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[PermissionOverrides](instance0) + if overrides.ReleaseFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected PermissionOverrides.ReleaseFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + _goerr := overrides.ReleaseFinish(_result) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_lookup_by_address +func _gotk4_gio2_ResolverClass_lookup_by_address(arg0 *C.GResolver, arg1 *C.GInetAddress, arg2 *C.GCancellable, _cerr **C.GError) (cret *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.LookupByAddress == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.LookupByAddress, got none") + } + + var _cancellable context.Context // out + var _address *InetAddress // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _address = wrapInetAddress(coreglib.Take(unsafe.Pointer(arg1))) + + utf8, _goerr := overrides.LookupByAddress(_cancellable, _address) + + var _ string + var _ error + + cret = (*C.gchar)(unsafe.Pointer(C.CString(utf8))) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_lookup_by_address_finish +func _gotk4_gio2_ResolverClass_lookup_by_address_finish(arg0 *C.GResolver, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.LookupByAddressFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.LookupByAddressFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + utf8, _goerr := overrides.LookupByAddressFinish(_result) + + var _ string + var _ error + + cret = (*C.gchar)(unsafe.Pointer(C.CString(utf8))) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_lookup_by_name +func _gotk4_gio2_ResolverClass_lookup_by_name(arg0 *C.GResolver, arg1 *C.gchar, arg2 *C.GCancellable, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.LookupByName == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.LookupByName, got none") + } + + var _cancellable context.Context // out + var _hostname string // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _hostname = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + list, _goerr := overrides.LookupByName(_cancellable, _hostname) + + var _ []*InetAddress + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GInetAddress // out + dst = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_lookup_by_name_finish +func _gotk4_gio2_ResolverClass_lookup_by_name_finish(arg0 *C.GResolver, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.LookupByNameFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.LookupByNameFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + list, _goerr := overrides.LookupByNameFinish(_result) + + var _ []*InetAddress + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GInetAddress // out + dst = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_lookup_by_name_with_flags +func _gotk4_gio2_ResolverClass_lookup_by_name_with_flags(arg0 *C.GResolver, arg1 *C.gchar, arg2 C.GResolverNameLookupFlags, arg3 *C.GCancellable, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.LookupByNameWithFlags == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.LookupByNameWithFlags, got none") + } + + var _cancellable context.Context // out + var _hostname string // out + var _flags ResolverNameLookupFlags // out + + if arg3 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg3)) + } + _hostname = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _flags = ResolverNameLookupFlags(arg2) + + list, _goerr := overrides.LookupByNameWithFlags(_cancellable, _hostname, _flags) + + var _ []*InetAddress + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GInetAddress // out + dst = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_lookup_by_name_with_flags_finish +func _gotk4_gio2_ResolverClass_lookup_by_name_with_flags_finish(arg0 *C.GResolver, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.LookupByNameWithFlagsFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.LookupByNameWithFlagsFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + list, _goerr := overrides.LookupByNameWithFlagsFinish(_result) + + var _ []*InetAddress + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GInetAddress // out + dst = (*C.GInetAddress)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_lookup_records +func _gotk4_gio2_ResolverClass_lookup_records(arg0 *C.GResolver, arg1 *C.gchar, arg2 C.GResolverRecordType, arg3 *C.GCancellable, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.LookupRecords == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.LookupRecords, got none") + } + + var _cancellable context.Context // out + var _rrname string // out + var _recordType ResolverRecordType // out + + if arg3 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg3)) + } + _rrname = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _recordType = ResolverRecordType(arg2) + + list, _goerr := overrides.LookupRecords(_cancellable, _rrname, _recordType) + + var _ []*glib.Variant + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GVariant // out + dst = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(src))) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_lookup_records_finish +func _gotk4_gio2_ResolverClass_lookup_records_finish(arg0 *C.GResolver, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.LookupRecordsFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.LookupRecordsFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + list, _goerr := overrides.LookupRecordsFinish(_result) + + var _ []*glib.Variant + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GVariant // out + dst = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(src))) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_lookup_service_finish +func _gotk4_gio2_ResolverClass_lookup_service_finish(arg0 *C.GResolver, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.LookupServiceFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.LookupServiceFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + list, _goerr := overrides.LookupServiceFinish(_result) + + var _ []*SrvTarget + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GSrvTarget // out + dst = (*C.GSrvTarget)(gextras.StructNative(unsafe.Pointer(src))) + runtime.SetFinalizer(gextras.StructIntern(unsafe.Pointer(src)), nil) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_ResolverClass_reload +func _gotk4_gio2_ResolverClass_reload(arg0 *C.GResolver) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ResolverOverrides](instance0) + if overrides.Reload == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ResolverOverrides.Reload, got none") + } + + overrides.Reload() +} + +//export _gotk4_gio2_Resolver_ConnectReload +func _gotk4_gio2_Resolver_ConnectReload(arg0 C.gpointer, arg1 C.guintptr) { + var f func() + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg1)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func()) + } + + f() +} + +//export _gotk4_gio2_SettingsClass_change_event +func _gotk4_gio2_SettingsClass_change_event(arg0 *C.GSettings, arg1 *C.GQuark, arg2 C.gint) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SettingsOverrides](instance0) + if overrides.ChangeEvent == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SettingsOverrides.ChangeEvent, got none") + } + + var _keys *glib.Quark // out + var _nKeys int // out + + _keys = (*glib.Quark)(unsafe.Pointer(arg1)) + _nKeys = int(arg2) + + ok := overrides.ChangeEvent(_keys, _nKeys) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_SettingsClass_changed +func _gotk4_gio2_SettingsClass_changed(arg0 *C.GSettings, arg1 *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SettingsOverrides](instance0) + if overrides.Changed == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SettingsOverrides.Changed, got none") + } + + var _key string // out + + _key = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + overrides.Changed(_key) +} + +//export _gotk4_gio2_SettingsClass_writable_change_event +func _gotk4_gio2_SettingsClass_writable_change_event(arg0 *C.GSettings, arg1 C.GQuark) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SettingsOverrides](instance0) + if overrides.WritableChangeEvent == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SettingsOverrides.WritableChangeEvent, got none") + } + + var _key glib.Quark // out + + _key = glib.Quark(arg1) + + ok := overrides.WritableChangeEvent(_key) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_SettingsClass_writable_changed +func _gotk4_gio2_SettingsClass_writable_changed(arg0 *C.GSettings, arg1 *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SettingsOverrides](instance0) + if overrides.WritableChanged == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SettingsOverrides.WritableChanged, got none") + } + + var _key string // out + + _key = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + overrides.WritableChanged(_key) +} + +//export _gotk4_gio2_Settings_ConnectChangeEvent +func _gotk4_gio2_Settings_ConnectChangeEvent(arg0 C.gpointer, arg1 C.gpointer, arg2 C.gint, arg3 C.guintptr) (cret C.gboolean) { + var f func(keys []glib.Quark) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(keys []glib.Quark) (ok bool)) + } + + var _keys []glib.Quark // out + + _keys = make([]glib.Quark, arg2) + copy(_keys, unsafe.Slice((*glib.Quark)(unsafe.Pointer(arg1)), arg2)) + + ok := f(_keys) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_Settings_ConnectChanged +func _gotk4_gio2_Settings_ConnectChanged(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) { + var f func(key string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(key string)) + } + + var _key string // out + + _key = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + f(_key) +} + +//export _gotk4_gio2_Settings_ConnectWritableChangeEvent +func _gotk4_gio2_Settings_ConnectWritableChangeEvent(arg0 C.gpointer, arg1 C.guint, arg2 C.guintptr) (cret C.gboolean) { + var f func(key uint) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(key uint) (ok bool)) + } + + var _key uint // out + + _key = uint(arg1) + + ok := f(_key) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_Settings_ConnectWritableChanged +func _gotk4_gio2_Settings_ConnectWritableChanged(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) { + var f func(key string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(key string)) + } + + var _key string // out + + _key = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + f(_key) +} + +//export _gotk4_gio2_SimpleAction_ConnectActivate +func _gotk4_gio2_SimpleAction_ConnectActivate(arg0 C.gpointer, arg1 *C.GVariant, arg2 C.guintptr) { + var f func(parameter *glib.Variant) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(parameter *glib.Variant)) + } + + var _parameter *glib.Variant // out + + if arg1 != nil { + _parameter = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_variant_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_parameter)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + f(_parameter) +} + +//export _gotk4_gio2_SimpleAction_ConnectChangeState +func _gotk4_gio2_SimpleAction_ConnectChangeState(arg0 C.gpointer, arg1 *C.GVariant, arg2 C.guintptr) { + var f func(value *glib.Variant) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(value *glib.Variant)) + } + + var _value *glib.Variant // out + + if arg1 != nil { + _value = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_variant_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_value)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + f(_value) +} + +//export _gotk4_gio2_SocketAddressClass_get_family +func _gotk4_gio2_SocketAddressClass_get_family(arg0 *C.GSocketAddress) (cret C.GSocketFamily) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketAddressOverrides](instance0) + if overrides.Family == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketAddressOverrides.Family, got none") + } + + socketFamily := overrides.Family() + + var _ SocketFamily + + cret = C.GSocketFamily(socketFamily) + + return cret +} + +//export _gotk4_gio2_SocketAddressClass_get_native_size +func _gotk4_gio2_SocketAddressClass_get_native_size(arg0 *C.GSocketAddress) (cret C.gssize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketAddressOverrides](instance0) + if overrides.NativeSize == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketAddressOverrides.NativeSize, got none") + } + + gssize := overrides.NativeSize() + + var _ int + + cret = C.gssize(gssize) + + return cret +} + +//export _gotk4_gio2_SocketAddressClass_to_native +func _gotk4_gio2_SocketAddressClass_to_native(arg0 *C.GSocketAddress, arg1 C.gpointer, arg2 C.gsize, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketAddressOverrides](instance0) + if overrides.ToNative == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketAddressOverrides.ToNative, got none") + } + + var _dest unsafe.Pointer // out + var _destlen uint // out + + _dest = (unsafe.Pointer)(unsafe.Pointer(arg1)) + _destlen = uint(arg2) + + _goerr := overrides.ToNative(_dest, _destlen) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_SocketAddressEnumeratorClass_next +func _gotk4_gio2_SocketAddressEnumeratorClass_next(arg0 *C.GSocketAddressEnumerator, arg1 *C.GCancellable, _cerr **C.GError) (cret *C.GSocketAddress) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketAddressEnumeratorOverrides](instance0) + if overrides.Next == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketAddressEnumeratorOverrides.Next, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + socketAddress, _goerr := overrides.Next(_cancellable) + + var _ SocketAddresser + var _ error + + if socketAddress != nil { + cret = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(socketAddress).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(socketAddress).Native())) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_SocketAddressEnumeratorClass_next_finish +func _gotk4_gio2_SocketAddressEnumeratorClass_next_finish(arg0 *C.GSocketAddressEnumerator, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GSocketAddress) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketAddressEnumeratorOverrides](instance0) + if overrides.NextFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketAddressEnumeratorOverrides.NextFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + socketAddress, _goerr := overrides.NextFinish(_result) + + var _ SocketAddresser + var _ error + + if socketAddress != nil { + cret = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(socketAddress).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(socketAddress).Native())) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_SocketClientClass_event +func _gotk4_gio2_SocketClientClass_event(arg0 *C.GSocketClient, arg1 C.GSocketClientEvent, arg2 *C.GSocketConnectable, arg3 *C.GIOStream) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketClientOverrides](instance0) + if overrides.Event == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketClientOverrides.Event, got none") + } + + var _event SocketClientEvent // out + var _connectable SocketConnectabler // out + var _connection IOStreamer // out + + _event = SocketClientEvent(arg1) + { + objptr := unsafe.Pointer(arg2) + if objptr == nil { + panic("object of type gio.SocketConnectabler is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketConnectabler) + return ok + }) + rv, ok := casted.(SocketConnectabler) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketConnectabler") + } + _connectable = rv + } + { + objptr := unsafe.Pointer(arg3) + if objptr == nil { + panic("object of type gio.IOStreamer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _connection = rv + } + + overrides.Event(_event, _connectable, _connection) +} + +//export _gotk4_gio2_SocketClient_ConnectEvent +func _gotk4_gio2_SocketClient_ConnectEvent(arg0 C.gpointer, arg1 C.GSocketClientEvent, arg2 *C.GSocketConnectable, arg3 *C.GIOStream, arg4 C.guintptr) { + var f func(event SocketClientEvent, connectable SocketConnectabler, connection IOStreamer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg4)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(event SocketClientEvent, connectable SocketConnectabler, connection IOStreamer)) + } + + var _event SocketClientEvent // out + var _connectable SocketConnectabler // out + var _connection IOStreamer // out + + _event = SocketClientEvent(arg1) + { + objptr := unsafe.Pointer(arg2) + if objptr == nil { + panic("object of type gio.SocketConnectabler is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketConnectabler) + return ok + }) + rv, ok := casted.(SocketConnectabler) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketConnectabler") + } + _connectable = rv + } + if arg3 != nil { + { + objptr := unsafe.Pointer(arg3) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(IOStreamer) + return ok + }) + rv, ok := casted.(IOStreamer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.IOStreamer") + } + _connection = rv + } + } + + f(_event, _connectable, _connection) +} + +//export _gotk4_gio2_SocketControlMessageClass_get_level +func _gotk4_gio2_SocketControlMessageClass_get_level(arg0 *C.GSocketControlMessage) (cret C.int) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketControlMessageOverrides](instance0) + if overrides.Level == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketControlMessageOverrides.Level, got none") + } + + gint := overrides.Level() + + var _ int + + cret = C.int(gint) + + return cret +} + +//export _gotk4_gio2_SocketControlMessageClass_get_size +func _gotk4_gio2_SocketControlMessageClass_get_size(arg0 *C.GSocketControlMessage) (cret C.gsize) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketControlMessageOverrides](instance0) + if overrides.Size == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketControlMessageOverrides.Size, got none") + } + + gsize := overrides.Size() + + var _ uint + + cret = C.gsize(gsize) + + return cret +} + +//export _gotk4_gio2_SocketControlMessageClass_get_type +func _gotk4_gio2_SocketControlMessageClass_get_type(arg0 *C.GSocketControlMessage) (cret C.int) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketControlMessageOverrides](instance0) + if overrides.Type == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketControlMessageOverrides.Type, got none") + } + + gint := overrides.Type() + + var _ int + + cret = C.int(gint) + + return cret +} + +//export _gotk4_gio2_SocketControlMessageClass_serialize +func _gotk4_gio2_SocketControlMessageClass_serialize(arg0 *C.GSocketControlMessage, arg1 C.gpointer) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketControlMessageOverrides](instance0) + if overrides.Serialize == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketControlMessageOverrides.Serialize, got none") + } + + var _data unsafe.Pointer // out + + _data = (unsafe.Pointer)(unsafe.Pointer(arg1)) + + overrides.Serialize(_data) +} + +//export _gotk4_gio2_SocketListenerClass_changed +func _gotk4_gio2_SocketListenerClass_changed(arg0 *C.GSocketListener) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketListenerOverrides](instance0) + if overrides.Changed == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketListenerOverrides.Changed, got none") + } + + overrides.Changed() +} + +//export _gotk4_gio2_SocketListenerClass_event +func _gotk4_gio2_SocketListenerClass_event(arg0 *C.GSocketListener, arg1 C.GSocketListenerEvent, arg2 *C.GSocket) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketListenerOverrides](instance0) + if overrides.Event == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketListenerOverrides.Event, got none") + } + + var _event SocketListenerEvent // out + var _socket *Socket // out + + _event = SocketListenerEvent(arg1) + _socket = wrapSocket(coreglib.Take(unsafe.Pointer(arg2))) + + overrides.Event(_event, _socket) +} + +//export _gotk4_gio2_SocketListener_ConnectEvent +func _gotk4_gio2_SocketListener_ConnectEvent(arg0 C.gpointer, arg1 C.GSocketListenerEvent, arg2 *C.GSocket, arg3 C.guintptr) { + var f func(event SocketListenerEvent, socket *Socket) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(event SocketListenerEvent, socket *Socket)) + } + + var _event SocketListenerEvent // out + var _socket *Socket // out + + _event = SocketListenerEvent(arg1) + _socket = wrapSocket(coreglib.Take(unsafe.Pointer(arg2))) + + f(_event, _socket) +} + +//export _gotk4_gio2_SocketServiceClass_incoming +func _gotk4_gio2_SocketServiceClass_incoming(arg0 *C.GSocketService, arg1 *C.GSocketConnection, arg2 *C.GObject) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[SocketServiceOverrides](instance0) + if overrides.Incoming == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected SocketServiceOverrides.Incoming, got none") + } + + var _connection *SocketConnection // out + var _sourceObject *coreglib.Object // out + + _connection = wrapSocketConnection(coreglib.Take(unsafe.Pointer(arg1))) + _sourceObject = coreglib.Take(unsafe.Pointer(arg2)) + + ok := overrides.Incoming(_connection, _sourceObject) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_SocketService_ConnectIncoming +func _gotk4_gio2_SocketService_ConnectIncoming(arg0 C.gpointer, arg1 *C.GSocketConnection, arg2 *C.GObject, arg3 C.guintptr) (cret C.gboolean) { + var f func(connection *SocketConnection, sourceObject *coreglib.Object) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(connection *SocketConnection, sourceObject *coreglib.Object) (ok bool)) + } + + var _connection *SocketConnection // out + var _sourceObject *coreglib.Object // out + + _connection = wrapSocketConnection(coreglib.Take(unsafe.Pointer(arg1))) + if arg2 != nil { + _sourceObject = coreglib.Take(unsafe.Pointer(arg2)) + } + + ok := f(_connection, _sourceObject) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_ThreadedSocketServiceClass_run +func _gotk4_gio2_ThreadedSocketServiceClass_run(arg0 *C.GThreadedSocketService, arg1 *C.GSocketConnection, arg2 *C.GObject) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[ThreadedSocketServiceOverrides](instance0) + if overrides.Run == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ThreadedSocketServiceOverrides.Run, got none") + } + + var _connection *SocketConnection // out + var _sourceObject *coreglib.Object // out + + _connection = wrapSocketConnection(coreglib.Take(unsafe.Pointer(arg1))) + _sourceObject = coreglib.Take(unsafe.Pointer(arg2)) + + ok := overrides.Run(_connection, _sourceObject) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_ThreadedSocketService_ConnectRun +func _gotk4_gio2_ThreadedSocketService_ConnectRun(arg0 C.gpointer, arg1 *C.GSocketConnection, arg2 *C.GObject, arg3 C.guintptr) (cret C.gboolean) { + var f func(connection *SocketConnection, sourceObject *coreglib.Object) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(connection *SocketConnection, sourceObject *coreglib.Object) (ok bool)) + } + + var _connection *SocketConnection // out + var _sourceObject *coreglib.Object // out + + _connection = wrapSocketConnection(coreglib.Take(unsafe.Pointer(arg1))) + if arg2 != nil { + _sourceObject = coreglib.Take(unsafe.Pointer(arg2)) + } + + ok := f(_connection, _sourceObject) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_TlsCertificateClass_verify +func _gotk4_gio2_TlsCertificateClass_verify(arg0 *C.GTlsCertificate, arg1 *C.GSocketConnectable, arg2 *C.GTlsCertificate) (cret C.GTlsCertificateFlags) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSCertificateOverrides](instance0) + if overrides.Verify == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSCertificateOverrides.Verify, got none") + } + + var _identity SocketConnectabler // out + var _trustedCa TLSCertificater // out + + if arg1 != nil { + { + objptr := unsafe.Pointer(arg1) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketConnectabler) + return ok + }) + rv, ok := casted.(SocketConnectabler) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketConnectabler") + } + _identity = rv + } + } + if arg2 != nil { + { + objptr := unsafe.Pointer(arg2) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _trustedCa = rv + } + } + + tlsCertificateFlags := overrides.Verify(_identity, _trustedCa) + + var _ TLSCertificateFlags + + cret = C.GTlsCertificateFlags(tlsCertificateFlags) + + return cret +} + +//export _gotk4_gio2_TlsConnectionClass_accept_certificate +func _gotk4_gio2_TlsConnectionClass_accept_certificate(arg0 *C.GTlsConnection, arg1 *C.GTlsCertificate, arg2 C.GTlsCertificateFlags) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSConnectionOverrides](instance0) + if overrides.AcceptCertificate == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSConnectionOverrides.AcceptCertificate, got none") + } + + var _peerCert TLSCertificater // out + var _errors TLSCertificateFlags // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _peerCert = rv + } + _errors = TLSCertificateFlags(arg2) + + ok := overrides.AcceptCertificate(_peerCert, _errors) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_TlsConnectionClass_get_binding_data +func _gotk4_gio2_TlsConnectionClass_get_binding_data(arg0 *C.GTlsConnection, arg1 C.GTlsChannelBindingType, arg2 *C.GByteArray, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSConnectionOverrides](instance0) + if overrides.BindingData == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSConnectionOverrides.BindingData, got none") + } + + var _typ TLSChannelBindingType // out + var _data []byte // out + + _typ = TLSChannelBindingType(arg1) + _data = make([]byte, arg2.len) + copy(_data, unsafe.Slice((*byte)(arg2.data), arg2.len)) + + _goerr := overrides.BindingData(_typ, _data) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsConnectionClass_get_negotiated_protocol +func _gotk4_gio2_TlsConnectionClass_get_negotiated_protocol(arg0 *C.GTlsConnection) (cret *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSConnectionOverrides](instance0) + if overrides.NegotiatedProtocol == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSConnectionOverrides.NegotiatedProtocol, got none") + } + + utf8 := overrides.NegotiatedProtocol() + + var _ string + + if utf8 != "" { + cret = (*C.gchar)(unsafe.Pointer(C.CString(utf8))) + defer C.free(unsafe.Pointer(cret)) + } + + return cret +} + +//export _gotk4_gio2_TlsConnectionClass_handshake +func _gotk4_gio2_TlsConnectionClass_handshake(arg0 *C.GTlsConnection, arg1 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSConnectionOverrides](instance0) + if overrides.Handshake == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSConnectionOverrides.Handshake, got none") + } + + var _cancellable context.Context // out + + if arg1 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) + } + + _goerr := overrides.Handshake(_cancellable) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsConnectionClass_handshake_finish +func _gotk4_gio2_TlsConnectionClass_handshake_finish(arg0 *C.GTlsConnection, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSConnectionOverrides](instance0) + if overrides.HandshakeFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSConnectionOverrides.HandshakeFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + _goerr := overrides.HandshakeFinish(_result) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsConnection_ConnectAcceptCertificate +func _gotk4_gio2_TlsConnection_ConnectAcceptCertificate(arg0 C.gpointer, arg1 *C.GTlsCertificate, arg2 C.GTlsCertificateFlags, arg3 C.guintptr) (cret C.gboolean) { + var f func(peerCert TLSCertificater, errors TLSCertificateFlags) (ok bool) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(peerCert TLSCertificater, errors TLSCertificateFlags) (ok bool)) + } + + var _peerCert TLSCertificater // out + var _errors TLSCertificateFlags // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _peerCert = rv + } + _errors = TLSCertificateFlags(arg2) + + ok := f(_peerCert, _errors) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_TlsDatabaseClass_create_certificate_handle +func _gotk4_gio2_TlsDatabaseClass_create_certificate_handle(arg0 *C.GTlsDatabase, arg1 *C.GTlsCertificate) (cret *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSDatabaseOverrides](instance0) + if overrides.CreateCertificateHandle == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSDatabaseOverrides.CreateCertificateHandle, got none") + } + + var _certificate TLSCertificater // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _certificate = rv + } + + utf8 := overrides.CreateCertificateHandle(_certificate) + + var _ string + + if utf8 != "" { + cret = (*C.gchar)(unsafe.Pointer(C.CString(utf8))) + } + + return cret +} + +//export _gotk4_gio2_TlsDatabaseClass_lookup_certificate_for_handle +func _gotk4_gio2_TlsDatabaseClass_lookup_certificate_for_handle(arg0 *C.GTlsDatabase, arg1 *C.gchar, arg2 *C.GTlsInteraction, arg3 C.GTlsDatabaseLookupFlags, arg4 *C.GCancellable, _cerr **C.GError) (cret *C.GTlsCertificate) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSDatabaseOverrides](instance0) + if overrides.LookupCertificateForHandle == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSDatabaseOverrides.LookupCertificateForHandle, got none") + } + + var _cancellable context.Context // out + var _handle string // out + var _interaction *TLSInteraction // out + var _flags TLSDatabaseLookupFlags // out + + if arg4 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg4)) + } + _handle = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + if arg2 != nil { + _interaction = wrapTLSInteraction(coreglib.Take(unsafe.Pointer(arg2))) + } + _flags = TLSDatabaseLookupFlags(arg3) + + tlsCertificate, _goerr := overrides.LookupCertificateForHandle(_cancellable, _handle, _interaction, _flags) + + var _ TLSCertificater + var _ error + + if tlsCertificate != nil { + cret = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(tlsCertificate).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(tlsCertificate).Native())) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsDatabaseClass_lookup_certificate_for_handle_finish +func _gotk4_gio2_TlsDatabaseClass_lookup_certificate_for_handle_finish(arg0 *C.GTlsDatabase, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GTlsCertificate) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSDatabaseOverrides](instance0) + if overrides.LookupCertificateForHandleFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSDatabaseOverrides.LookupCertificateForHandleFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + tlsCertificate, _goerr := overrides.LookupCertificateForHandleFinish(_result) + + var _ TLSCertificater + var _ error + + cret = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(tlsCertificate).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(tlsCertificate).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsDatabaseClass_lookup_certificate_issuer +func _gotk4_gio2_TlsDatabaseClass_lookup_certificate_issuer(arg0 *C.GTlsDatabase, arg1 *C.GTlsCertificate, arg2 *C.GTlsInteraction, arg3 C.GTlsDatabaseLookupFlags, arg4 *C.GCancellable, _cerr **C.GError) (cret *C.GTlsCertificate) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSDatabaseOverrides](instance0) + if overrides.LookupCertificateIssuer == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSDatabaseOverrides.LookupCertificateIssuer, got none") + } + + var _cancellable context.Context // out + var _certificate TLSCertificater // out + var _interaction *TLSInteraction // out + var _flags TLSDatabaseLookupFlags // out + + if arg4 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg4)) + } + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _certificate = rv + } + if arg2 != nil { + _interaction = wrapTLSInteraction(coreglib.Take(unsafe.Pointer(arg2))) + } + _flags = TLSDatabaseLookupFlags(arg3) + + tlsCertificate, _goerr := overrides.LookupCertificateIssuer(_cancellable, _certificate, _interaction, _flags) + + var _ TLSCertificater + var _ error + + cret = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(tlsCertificate).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(tlsCertificate).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsDatabaseClass_lookup_certificate_issuer_finish +func _gotk4_gio2_TlsDatabaseClass_lookup_certificate_issuer_finish(arg0 *C.GTlsDatabase, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GTlsCertificate) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSDatabaseOverrides](instance0) + if overrides.LookupCertificateIssuerFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSDatabaseOverrides.LookupCertificateIssuerFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + tlsCertificate, _goerr := overrides.LookupCertificateIssuerFinish(_result) + + var _ TLSCertificater + var _ error + + cret = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(tlsCertificate).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(tlsCertificate).Native())) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsDatabaseClass_lookup_certificates_issued_by +func _gotk4_gio2_TlsDatabaseClass_lookup_certificates_issued_by(arg0 *C.GTlsDatabase, arg1 *C.GByteArray, arg2 *C.GTlsInteraction, arg3 C.GTlsDatabaseLookupFlags, arg4 *C.GCancellable, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSDatabaseOverrides](instance0) + if overrides.LookupCertificatesIssuedBy == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSDatabaseOverrides.LookupCertificatesIssuedBy, got none") + } + + var _cancellable context.Context // out + var _issuerRawDn []byte // out + var _interaction *TLSInteraction // out + var _flags TLSDatabaseLookupFlags // out + + if arg4 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg4)) + } + _issuerRawDn = make([]byte, arg1.len) + copy(_issuerRawDn, unsafe.Slice((*byte)(arg1.data), arg1.len)) + if arg2 != nil { + _interaction = wrapTLSInteraction(coreglib.Take(unsafe.Pointer(arg2))) + } + _flags = TLSDatabaseLookupFlags(arg3) + + list, _goerr := overrides.LookupCertificatesIssuedBy(_cancellable, _issuerRawDn, _interaction, _flags) + + var _ []TLSCertificater + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GTlsCertificate // out + dst = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsDatabaseClass_lookup_certificates_issued_by_finish +func _gotk4_gio2_TlsDatabaseClass_lookup_certificates_issued_by_finish(arg0 *C.GTlsDatabase, arg1 *C.GAsyncResult, _cerr **C.GError) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSDatabaseOverrides](instance0) + if overrides.LookupCertificatesIssuedByFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSDatabaseOverrides.LookupCertificatesIssuedByFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + list, _goerr := overrides.LookupCertificatesIssuedByFinish(_result) + + var _ []TLSCertificater + var _ error + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GTlsCertificate // out + dst = (*C.GTlsCertificate)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsDatabaseClass_verify_chain +func _gotk4_gio2_TlsDatabaseClass_verify_chain(arg0 *C.GTlsDatabase, arg1 *C.GTlsCertificate, arg2 *C.gchar, arg3 *C.GSocketConnectable, arg4 *C.GTlsInteraction, arg5 C.GTlsDatabaseVerifyFlags, arg6 *C.GCancellable, _cerr **C.GError) (cret C.GTlsCertificateFlags) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSDatabaseOverrides](instance0) + if overrides.VerifyChain == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSDatabaseOverrides.VerifyChain, got none") + } + + var _cancellable context.Context // out + var _chain TLSCertificater // out + var _purpose string // out + var _identity SocketConnectabler // out + var _interaction *TLSInteraction // out + var _flags TLSDatabaseVerifyFlags // out + + if arg6 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg6)) + } + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.TLSCertificater is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSCertificater) + return ok + }) + rv, ok := casted.(TLSCertificater) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSCertificater") + } + _chain = rv + } + _purpose = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + if arg3 != nil { + { + objptr := unsafe.Pointer(arg3) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(SocketConnectabler) + return ok + }) + rv, ok := casted.(SocketConnectabler) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.SocketConnectabler") + } + _identity = rv + } + } + if arg4 != nil { + _interaction = wrapTLSInteraction(coreglib.Take(unsafe.Pointer(arg4))) + } + _flags = TLSDatabaseVerifyFlags(arg5) + + tlsCertificateFlags, _goerr := overrides.VerifyChain(_cancellable, _chain, _purpose, _identity, _interaction, _flags) + + var _ TLSCertificateFlags + var _ error + + cret = C.GTlsCertificateFlags(tlsCertificateFlags) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsDatabaseClass_verify_chain_finish +func _gotk4_gio2_TlsDatabaseClass_verify_chain_finish(arg0 *C.GTlsDatabase, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.GTlsCertificateFlags) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSDatabaseOverrides](instance0) + if overrides.VerifyChainFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSDatabaseOverrides.VerifyChainFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + tlsCertificateFlags, _goerr := overrides.VerifyChainFinish(_result) + + var _ TLSCertificateFlags + var _ error + + cret = C.GTlsCertificateFlags(tlsCertificateFlags) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsInteractionClass_ask_password +func _gotk4_gio2_TlsInteractionClass_ask_password(arg0 *C.GTlsInteraction, arg1 *C.GTlsPassword, arg2 *C.GCancellable, _cerr **C.GError) (cret C.GTlsInteractionResult) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSInteractionOverrides](instance0) + if overrides.AskPassword == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSInteractionOverrides.AskPassword, got none") + } + + var _cancellable context.Context // out + var _password *TLSPassword // out + + if arg2 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg2)) + } + _password = wrapTLSPassword(coreglib.Take(unsafe.Pointer(arg1))) + + tlsInteractionResult, _goerr := overrides.AskPassword(_cancellable, _password) + + var _ TLSInteractionResult + var _ error + + cret = C.GTlsInteractionResult(tlsInteractionResult) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsInteractionClass_ask_password_finish +func _gotk4_gio2_TlsInteractionClass_ask_password_finish(arg0 *C.GTlsInteraction, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.GTlsInteractionResult) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSInteractionOverrides](instance0) + if overrides.AskPasswordFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSInteractionOverrides.AskPasswordFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + tlsInteractionResult, _goerr := overrides.AskPasswordFinish(_result) + + var _ TLSInteractionResult + var _ error + + cret = C.GTlsInteractionResult(tlsInteractionResult) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsInteractionClass_request_certificate +func _gotk4_gio2_TlsInteractionClass_request_certificate(arg0 *C.GTlsInteraction, arg1 *C.GTlsConnection, arg2 C.GTlsCertificateRequestFlags, arg3 *C.GCancellable, _cerr **C.GError) (cret C.GTlsInteractionResult) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSInteractionOverrides](instance0) + if overrides.RequestCertificate == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSInteractionOverrides.RequestCertificate, got none") + } + + var _cancellable context.Context // out + var _connection TLSConnectioner // out + var _flags TLSCertificateRequestFlags // out + + if arg3 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg3)) + } + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.TLSConnectioner is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(TLSConnectioner) + return ok + }) + rv, ok := casted.(TLSConnectioner) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.TLSConnectioner") + } + _connection = rv + } + _flags = TLSCertificateRequestFlags(arg2) + + tlsInteractionResult, _goerr := overrides.RequestCertificate(_cancellable, _connection, _flags) + + var _ TLSInteractionResult + var _ error + + cret = C.GTlsInteractionResult(tlsInteractionResult) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsInteractionClass_request_certificate_finish +func _gotk4_gio2_TlsInteractionClass_request_certificate_finish(arg0 *C.GTlsInteraction, arg1 *C.GAsyncResult, _cerr **C.GError) (cret C.GTlsInteractionResult) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSInteractionOverrides](instance0) + if overrides.RequestCertificateFinish == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSInteractionOverrides.RequestCertificateFinish, got none") + } + + var _result AsyncResulter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.AsyncResulter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(AsyncResulter) + return ok + }) + rv, ok := casted.(AsyncResulter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.AsyncResulter") + } + _result = rv + } + + tlsInteractionResult, _goerr := overrides.RequestCertificateFinish(_result) + + var _ TLSInteractionResult + var _ error + + cret = C.GTlsInteractionResult(tlsInteractionResult) + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_TlsPasswordClass_get_default_warning +func _gotk4_gio2_TlsPasswordClass_get_default_warning(arg0 *C.GTlsPassword) (cret *C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSPasswordOverrides](instance0) + if overrides.DefaultWarning == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSPasswordOverrides.DefaultWarning, got none") + } + + utf8 := overrides.DefaultWarning() + + var _ string + + cret = (*C.gchar)(unsafe.Pointer(C.CString(utf8))) + defer C.free(unsafe.Pointer(cret)) + + return cret +} + +//export _gotk4_gio2_TlsPasswordClass_get_value +func _gotk4_gio2_TlsPasswordClass_get_value(arg0 *C.GTlsPassword, arg1 *C.gsize) (cret *C.guchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[TLSPasswordOverrides](instance0) + if overrides.Value == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSPasswordOverrides.Value, got none") + } + + guint8s := overrides.Value() + + var _ []byte + + *arg1 = (C.gsize)(len(guint8s)) + if len(guint8s) > 0 { + cret = (*C.guchar)(unsafe.Pointer(&guint8s[0])) + } + + return cret +} + +//export _gotk4_gio2_VfsClass_add_writable_namespaces +func _gotk4_gio2_VfsClass_add_writable_namespaces(arg0 *C.GVfs, arg1 *C.GFileAttributeInfoList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VFSOverrides](instance0) + if overrides.AddWritableNamespaces == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VFSOverrides.AddWritableNamespaces, got none") + } + + var _list *FileAttributeInfoList // out + + _list = (*FileAttributeInfoList)(gextras.NewStructNative(unsafe.Pointer(arg1))) + C.g_file_attribute_info_list_ref(arg1) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_list)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_file_attribute_info_list_unref((*C.GFileAttributeInfoList)(intern.C)) + }, + ) + + overrides.AddWritableNamespaces(_list) +} + +//export _gotk4_gio2_VfsClass_get_file_for_path +func _gotk4_gio2_VfsClass_get_file_for_path(arg0 *C.GVfs, arg1 *C.char) (cret *C.GFile) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VFSOverrides](instance0) + if overrides.FileForPath == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VFSOverrides.FileForPath, got none") + } + + var _path string // out + + _path = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + file := overrides.FileForPath(_path) + + var _ *File + + cret = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(file).Native())) + + return cret +} + +//export _gotk4_gio2_VfsClass_get_file_for_uri +func _gotk4_gio2_VfsClass_get_file_for_uri(arg0 *C.GVfs, arg1 *C.char) (cret *C.GFile) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VFSOverrides](instance0) + if overrides.FileForURI == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VFSOverrides.FileForURI, got none") + } + + var _uri string // out + + _uri = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + file := overrides.FileForURI(_uri) + + var _ *File + + cret = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(file).Native())) + + return cret +} + +//export _gotk4_gio2_VfsClass_get_supported_uri_schemes +func _gotk4_gio2_VfsClass_get_supported_uri_schemes(arg0 *C.GVfs) (cret **C.gchar) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VFSOverrides](instance0) + if overrides.SupportedURISchemes == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VFSOverrides.SupportedURISchemes, got none") + } + + utf8s := overrides.SupportedURISchemes() + + var _ []string + + { + cret = (**C.gchar)(C.calloc(C.size_t((len(utf8s) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(cret)) + { + out := unsafe.Slice(cret, len(utf8s)+1) + var zero *C.gchar + out[len(utf8s)] = zero + for i := range utf8s { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(utf8s[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + return cret +} + +//export _gotk4_gio2_VfsClass_is_active +func _gotk4_gio2_VfsClass_is_active(arg0 *C.GVfs) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VFSOverrides](instance0) + if overrides.IsActive == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VFSOverrides.IsActive, got none") + } + + ok := overrides.IsActive() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_gio2_VfsClass_local_file_moved +func _gotk4_gio2_VfsClass_local_file_moved(arg0 *C.GVfs, arg1 *C.char, arg2 *C.char) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VFSOverrides](instance0) + if overrides.LocalFileMoved == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VFSOverrides.LocalFileMoved, got none") + } + + var _source string // out + var _dest string // out + + _source = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _dest = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + overrides.LocalFileMoved(_source, _dest) +} + +//export _gotk4_gio2_VfsClass_local_file_removed +func _gotk4_gio2_VfsClass_local_file_removed(arg0 *C.GVfs, arg1 *C.char) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VFSOverrides](instance0) + if overrides.LocalFileRemoved == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VFSOverrides.LocalFileRemoved, got none") + } + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + overrides.LocalFileRemoved(_filename) +} + +//export _gotk4_gio2_VfsClass_local_file_set_attributes +func _gotk4_gio2_VfsClass_local_file_set_attributes(arg0 *C.GVfs, arg1 *C.char, arg2 *C.GFileInfo, arg3 C.GFileQueryInfoFlags, arg4 *C.GCancellable, _cerr **C.GError) (cret C.gboolean) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VFSOverrides](instance0) + if overrides.LocalFileSetAttributes == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VFSOverrides.LocalFileSetAttributes, got none") + } + + var _cancellable context.Context // out + var _filename string // out + var _info *FileInfo // out + var _flags FileQueryInfoFlags // out + + if arg4 != nil { + _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg4)) + } + _filename = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _info = wrapFileInfo(coreglib.Take(unsafe.Pointer(arg2))) + _flags = FileQueryInfoFlags(arg3) + + _goerr := overrides.LocalFileSetAttributes(_cancellable, _filename, _info, _flags) + + var _ error + + if _goerr != nil && _cerr != nil { + *_cerr = (*C.GError)(gerror.New(_goerr)) + } + + return cret +} + +//export _gotk4_gio2_VfsClass_parse_name +func _gotk4_gio2_VfsClass_parse_name(arg0 *C.GVfs, arg1 *C.char) (cret *C.GFile) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VFSOverrides](instance0) + if overrides.ParseName == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VFSOverrides.ParseName, got none") + } + + var _parseName string // out + + _parseName = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + file := overrides.ParseName(_parseName) + + var _ *File + + cret = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(file).Native())) + + return cret +} + +//export _gotk4_gio2_VolumeMonitorClass_drive_changed +func _gotk4_gio2_VolumeMonitorClass_drive_changed(arg0 *C.GVolumeMonitor, arg1 *C.GDrive) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.DriveChanged == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.DriveChanged, got none") + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + overrides.DriveChanged(_drive) +} + +//export _gotk4_gio2_VolumeMonitorClass_drive_connected +func _gotk4_gio2_VolumeMonitorClass_drive_connected(arg0 *C.GVolumeMonitor, arg1 *C.GDrive) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.DriveConnected == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.DriveConnected, got none") + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + overrides.DriveConnected(_drive) +} + +//export _gotk4_gio2_VolumeMonitorClass_drive_disconnected +func _gotk4_gio2_VolumeMonitorClass_drive_disconnected(arg0 *C.GVolumeMonitor, arg1 *C.GDrive) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.DriveDisconnected == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.DriveDisconnected, got none") + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + overrides.DriveDisconnected(_drive) +} + +//export _gotk4_gio2_VolumeMonitorClass_drive_eject_button +func _gotk4_gio2_VolumeMonitorClass_drive_eject_button(arg0 *C.GVolumeMonitor, arg1 *C.GDrive) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.DriveEjectButton == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.DriveEjectButton, got none") + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + overrides.DriveEjectButton(_drive) +} + +//export _gotk4_gio2_VolumeMonitorClass_drive_stop_button +func _gotk4_gio2_VolumeMonitorClass_drive_stop_button(arg0 *C.GVolumeMonitor, arg1 *C.GDrive) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.DriveStopButton == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.DriveStopButton, got none") + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + overrides.DriveStopButton(_drive) +} + +//export _gotk4_gio2_VolumeMonitorClass_get_connected_drives +func _gotk4_gio2_VolumeMonitorClass_get_connected_drives(arg0 *C.GVolumeMonitor) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.ConnectedDrives == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.ConnectedDrives, got none") + } + + list := overrides.ConnectedDrives() + + var _ []*Drive + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GDrive // out + dst = (*C.GDrive)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + + return cret +} + +//export _gotk4_gio2_VolumeMonitorClass_get_mount_for_uuid +func _gotk4_gio2_VolumeMonitorClass_get_mount_for_uuid(arg0 *C.GVolumeMonitor, arg1 *C.char) (cret *C.GMount) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.MountForUUID == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.MountForUUID, got none") + } + + var _uuid string // out + + _uuid = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + mount := overrides.MountForUUID(_uuid) + + var _ *Mount + + if mount != nil { + cret = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(mount).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(mount).Native())) + } + + return cret +} + +//export _gotk4_gio2_VolumeMonitorClass_get_mounts +func _gotk4_gio2_VolumeMonitorClass_get_mounts(arg0 *C.GVolumeMonitor) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.Mounts == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.Mounts, got none") + } + + list := overrides.Mounts() + + var _ []*Mount + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GMount // out + dst = (*C.GMount)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + + return cret +} + +//export _gotk4_gio2_VolumeMonitorClass_get_volume_for_uuid +func _gotk4_gio2_VolumeMonitorClass_get_volume_for_uuid(arg0 *C.GVolumeMonitor, arg1 *C.char) (cret *C.GVolume) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.VolumeForUUID == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.VolumeForUUID, got none") + } + + var _uuid string // out + + _uuid = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + volume := overrides.VolumeForUUID(_uuid) + + var _ *Volume + + if volume != nil { + cret = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(volume).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(volume).Native())) + } + + return cret +} + +//export _gotk4_gio2_VolumeMonitorClass_get_volumes +func _gotk4_gio2_VolumeMonitorClass_get_volumes(arg0 *C.GVolumeMonitor) (cret *C.GList) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.Volumes == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.Volumes, got none") + } + + list := overrides.Volumes() + + var _ []*Volume + + for i := len(list) - 1; i >= 0; i-- { + src := list[i] + var dst *C.GVolume // out + dst = (*C.GVolume)(unsafe.Pointer(coreglib.InternObject(src).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(src).Native())) + cret = C.g_list_prepend(cret, C.gpointer(unsafe.Pointer(dst))) + } + + return cret +} + +//export _gotk4_gio2_VolumeMonitorClass_mount_added +func _gotk4_gio2_VolumeMonitorClass_mount_added(arg0 *C.GVolumeMonitor, arg1 *C.GMount) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.MountAdded == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.MountAdded, got none") + } + + var _mount Mounter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Mounter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Mounter) + return ok + }) + rv, ok := casted.(Mounter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Mounter") + } + _mount = rv + } + + overrides.MountAdded(_mount) +} + +//export _gotk4_gio2_VolumeMonitorClass_mount_changed +func _gotk4_gio2_VolumeMonitorClass_mount_changed(arg0 *C.GVolumeMonitor, arg1 *C.GMount) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.MountChanged == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.MountChanged, got none") + } + + var _mount Mounter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Mounter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Mounter) + return ok + }) + rv, ok := casted.(Mounter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Mounter") + } + _mount = rv + } + + overrides.MountChanged(_mount) +} + +//export _gotk4_gio2_VolumeMonitorClass_mount_pre_unmount +func _gotk4_gio2_VolumeMonitorClass_mount_pre_unmount(arg0 *C.GVolumeMonitor, arg1 *C.GMount) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.MountPreUnmount == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.MountPreUnmount, got none") + } + + var _mount Mounter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Mounter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Mounter) + return ok + }) + rv, ok := casted.(Mounter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Mounter") + } + _mount = rv + } + + overrides.MountPreUnmount(_mount) +} + +//export _gotk4_gio2_VolumeMonitorClass_mount_removed +func _gotk4_gio2_VolumeMonitorClass_mount_removed(arg0 *C.GVolumeMonitor, arg1 *C.GMount) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.MountRemoved == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.MountRemoved, got none") + } + + var _mount Mounter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Mounter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Mounter) + return ok + }) + rv, ok := casted.(Mounter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Mounter") + } + _mount = rv + } + + overrides.MountRemoved(_mount) +} + +//export _gotk4_gio2_VolumeMonitorClass_volume_added +func _gotk4_gio2_VolumeMonitorClass_volume_added(arg0 *C.GVolumeMonitor, arg1 *C.GVolume) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.VolumeAdded == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.VolumeAdded, got none") + } + + var _volume Volumer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Volumer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Volumer) + return ok + }) + rv, ok := casted.(Volumer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Volumer") + } + _volume = rv + } + + overrides.VolumeAdded(_volume) +} + +//export _gotk4_gio2_VolumeMonitorClass_volume_changed +func _gotk4_gio2_VolumeMonitorClass_volume_changed(arg0 *C.GVolumeMonitor, arg1 *C.GVolume) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.VolumeChanged == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.VolumeChanged, got none") + } + + var _volume Volumer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Volumer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Volumer) + return ok + }) + rv, ok := casted.(Volumer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Volumer") + } + _volume = rv + } + + overrides.VolumeChanged(_volume) +} + +//export _gotk4_gio2_VolumeMonitorClass_volume_removed +func _gotk4_gio2_VolumeMonitorClass_volume_removed(arg0 *C.GVolumeMonitor, arg1 *C.GVolume) { + instance0 := coreglib.Take(unsafe.Pointer(arg0)) + overrides := coreglib.OverridesFromObj[VolumeMonitorOverrides](instance0) + if overrides.VolumeRemoved == nil { + panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected VolumeMonitorOverrides.VolumeRemoved, got none") + } + + var _volume Volumer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Volumer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Volumer) + return ok + }) + rv, ok := casted.(Volumer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Volumer") + } + _volume = rv + } + + overrides.VolumeRemoved(_volume) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectDriveChanged +func _gotk4_gio2_VolumeMonitor_ConnectDriveChanged(arg0 C.gpointer, arg1 *C.GDrive, arg2 C.guintptr) { + var f func(drive Driver) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(drive Driver)) + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + f(_drive) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectDriveConnected +func _gotk4_gio2_VolumeMonitor_ConnectDriveConnected(arg0 C.gpointer, arg1 *C.GDrive, arg2 C.guintptr) { + var f func(drive Driver) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(drive Driver)) + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + f(_drive) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectDriveDisconnected +func _gotk4_gio2_VolumeMonitor_ConnectDriveDisconnected(arg0 C.gpointer, arg1 *C.GDrive, arg2 C.guintptr) { + var f func(drive Driver) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(drive Driver)) + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + f(_drive) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectDriveEjectButton +func _gotk4_gio2_VolumeMonitor_ConnectDriveEjectButton(arg0 C.gpointer, arg1 *C.GDrive, arg2 C.guintptr) { + var f func(drive Driver) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(drive Driver)) + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + f(_drive) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectDriveStopButton +func _gotk4_gio2_VolumeMonitor_ConnectDriveStopButton(arg0 C.gpointer, arg1 *C.GDrive, arg2 C.guintptr) { + var f func(drive Driver) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(drive Driver)) + } + + var _drive Driver // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Driver is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Driver) + return ok + }) + rv, ok := casted.(Driver) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Driver") + } + _drive = rv + } + + f(_drive) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectMountAdded +func _gotk4_gio2_VolumeMonitor_ConnectMountAdded(arg0 C.gpointer, arg1 *C.GMount, arg2 C.guintptr) { + var f func(mount Mounter) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(mount Mounter)) + } + + var _mount Mounter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Mounter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Mounter) + return ok + }) + rv, ok := casted.(Mounter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Mounter") + } + _mount = rv + } + + f(_mount) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectMountChanged +func _gotk4_gio2_VolumeMonitor_ConnectMountChanged(arg0 C.gpointer, arg1 *C.GMount, arg2 C.guintptr) { + var f func(mount Mounter) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(mount Mounter)) + } + + var _mount Mounter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Mounter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Mounter) + return ok + }) + rv, ok := casted.(Mounter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Mounter") + } + _mount = rv + } + + f(_mount) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectMountPreUnmount +func _gotk4_gio2_VolumeMonitor_ConnectMountPreUnmount(arg0 C.gpointer, arg1 *C.GMount, arg2 C.guintptr) { + var f func(mount Mounter) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(mount Mounter)) + } + + var _mount Mounter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Mounter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Mounter) + return ok + }) + rv, ok := casted.(Mounter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Mounter") + } + _mount = rv + } + + f(_mount) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectMountRemoved +func _gotk4_gio2_VolumeMonitor_ConnectMountRemoved(arg0 C.gpointer, arg1 *C.GMount, arg2 C.guintptr) { + var f func(mount Mounter) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(mount Mounter)) + } + + var _mount Mounter // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Mounter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Mounter) + return ok + }) + rv, ok := casted.(Mounter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Mounter") + } + _mount = rv + } + + f(_mount) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectVolumeAdded +func _gotk4_gio2_VolumeMonitor_ConnectVolumeAdded(arg0 C.gpointer, arg1 *C.GVolume, arg2 C.guintptr) { + var f func(volume Volumer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(volume Volumer)) + } + + var _volume Volumer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Volumer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Volumer) + return ok + }) + rv, ok := casted.(Volumer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Volumer") + } + _volume = rv + } + + f(_volume) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectVolumeChanged +func _gotk4_gio2_VolumeMonitor_ConnectVolumeChanged(arg0 C.gpointer, arg1 *C.GVolume, arg2 C.guintptr) { + var f func(volume Volumer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(volume Volumer)) + } + + var _volume Volumer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Volumer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Volumer) + return ok + }) + rv, ok := casted.(Volumer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Volumer") + } + _volume = rv + } + + f(_volume) +} + +//export _gotk4_gio2_VolumeMonitor_ConnectVolumeRemoved +func _gotk4_gio2_VolumeMonitor_ConnectVolumeRemoved(arg0 C.gpointer, arg1 *C.GVolume, arg2 C.guintptr) { + var f func(volume Volumer) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(volume Volumer)) + } + + var _volume Volumer // out + + { + objptr := unsafe.Pointer(arg1) + if objptr == nil { + panic("object of type gio.Volumer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Volumer) + return ok + }) + rv, ok := casted.(Volumer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.Volumer") + } + _volume = rv + } + + f(_volume) +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/glib/v2/glib.go b/vendor/github.com/diamondburned/gotk4/pkg/glib/v2/glib.go new file mode 100644 index 00000000..79f75489 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/glib/v2/glib.go @@ -0,0 +1,33931 @@ +// Code generated by girgen. DO NOT EDIT. + +package glib + +import ( + "context" + "fmt" + "log/slog" + "os" + "reflect" + "runtime" + _ "runtime/cgo" + "strings" + "time" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gerror" + "github.com/diamondburned/gotk4/pkg/core/gextras" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" +) + +// #cgo pkg-config: glib-2.0 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// #include +// #include +// extern void callbackDelete(gpointer); +// extern void _gotk4_glib2_LogFunc(gchar*, GLogLevelFlags, gchar*, gpointer); +// extern void _gotk4_glib2_HFunc(gpointer, gpointer, gpointer); +// extern void _gotk4_glib2_Func(gpointer, gpointer); +// extern gint _gotk4_glib2_CompareDataFunc(gconstpointer, gconstpointer, gpointer); +// extern gboolean _gotk4_glib2_SourceFunc(gpointer); +// extern gboolean _gotk4_glib2_HRFunc(gpointer, gpointer, gpointer); +// extern GLogWriterOutput _gotk4_glib2_LogWriterFunc(GLogLevelFlags, GLogField*, gsize, gpointer); +import "C" + +// GType values. +var ( + GTypeNormalizeMode = coreglib.Type(C.g_normalize_mode_get_type()) + GTypeUnicodeBreakType = coreglib.Type(C.g_unicode_break_type_get_type()) + GTypeUnicodeScript = coreglib.Type(C.g_unicode_script_get_type()) + GTypeUnicodeType = coreglib.Type(C.g_unicode_type_get_type()) + GTypeIOCondition = coreglib.Type(C.g_io_condition_get_type()) + GTypeBookmarkFile = coreglib.Type(C.g_bookmark_file_get_type()) + GTypeChecksum = coreglib.Type(C.g_checksum_get_type()) + GTypeDateTime = coreglib.Type(C.g_date_time_get_type()) + GTypeDir = coreglib.Type(C.g_dir_get_type()) + GTypeHashTable = coreglib.Type(C.g_hash_table_get_type()) + GTypeHMAC = coreglib.Type(C.g_hmac_get_type()) + GTypeIOChannel = coreglib.Type(C.g_io_channel_get_type()) + GTypeKeyFile = coreglib.Type(C.g_key_file_get_type()) + GTypeMainContext = coreglib.Type(C.g_main_context_get_type()) + GTypeMainLoop = coreglib.Type(C.g_main_loop_get_type()) + GTypeMappedFile = coreglib.Type(C.g_mapped_file_get_type()) + GTypeMarkupParseContext = coreglib.Type(C.g_markup_parse_context_get_type()) + GTypeMatchInfo = coreglib.Type(C.g_match_info_get_type()) + GTypeOptionGroup = coreglib.Type(C.g_option_group_get_type()) + GTypePatternSpec = coreglib.Type(C.g_pattern_spec_get_type()) + GTypeRand = coreglib.Type(C.g_rand_get_type()) + GTypeRegex = coreglib.Type(C.g_regex_get_type()) + GTypeSource = coreglib.Type(C.g_source_get_type()) + GTypeTimeZone = coreglib.Type(C.g_time_zone_get_type()) + GTypeTree = coreglib.Type(C.g_tree_get_type()) + GTypeURI = coreglib.Type(C.g_uri_get_type()) + GTypeVariantBuilder = coreglib.Type(C.g_variant_builder_get_type()) + GTypeVariantDict = coreglib.Type(C.g_variant_dict_get_type()) + GTypeVariantType = coreglib.Type(C.g_variant_type_get_gtype()) + GTypeVariant = coreglib.Type(coreglib.TypeVariant) +) + +func init() { + coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{ + coreglib.TypeMarshaler{T: GTypeNormalizeMode, F: marshalNormalizeMode}, + coreglib.TypeMarshaler{T: GTypeUnicodeBreakType, F: marshalUnicodeBreakType}, + coreglib.TypeMarshaler{T: GTypeUnicodeScript, F: marshalUnicodeScript}, + coreglib.TypeMarshaler{T: GTypeUnicodeType, F: marshalUnicodeType}, + coreglib.TypeMarshaler{T: GTypeIOCondition, F: marshalIOCondition}, + coreglib.TypeMarshaler{T: GTypeBookmarkFile, F: marshalBookmarkFile}, + coreglib.TypeMarshaler{T: GTypeChecksum, F: marshalChecksum}, + coreglib.TypeMarshaler{T: GTypeDateTime, F: marshalDateTime}, + coreglib.TypeMarshaler{T: GTypeDir, F: marshalDir}, + coreglib.TypeMarshaler{T: GTypeHashTable, F: marshalHashTable}, + coreglib.TypeMarshaler{T: GTypeHMAC, F: marshalHMAC}, + coreglib.TypeMarshaler{T: GTypeIOChannel, F: marshalIOChannel}, + coreglib.TypeMarshaler{T: GTypeKeyFile, F: marshalKeyFile}, + coreglib.TypeMarshaler{T: GTypeMainContext, F: marshalMainContext}, + coreglib.TypeMarshaler{T: GTypeMainLoop, F: marshalMainLoop}, + coreglib.TypeMarshaler{T: GTypeMappedFile, F: marshalMappedFile}, + coreglib.TypeMarshaler{T: GTypeMarkupParseContext, F: marshalMarkupParseContext}, + coreglib.TypeMarshaler{T: GTypeMatchInfo, F: marshalMatchInfo}, + coreglib.TypeMarshaler{T: GTypeOptionGroup, F: marshalOptionGroup}, + coreglib.TypeMarshaler{T: GTypePatternSpec, F: marshalPatternSpec}, + coreglib.TypeMarshaler{T: GTypeRand, F: marshalRand}, + coreglib.TypeMarshaler{T: GTypeRegex, F: marshalRegex}, + coreglib.TypeMarshaler{T: GTypeSource, F: marshalSource}, + coreglib.TypeMarshaler{T: GTypeTimeZone, F: marshalTimeZone}, + coreglib.TypeMarshaler{T: GTypeTree, F: marshalTree}, + coreglib.TypeMarshaler{T: GTypeURI, F: marshalURI}, + coreglib.TypeMarshaler{T: GTypeVariantBuilder, F: marshalVariantBuilder}, + coreglib.TypeMarshaler{T: GTypeVariantDict, F: marshalVariantDict}, + coreglib.TypeMarshaler{T: GTypeVariantType, F: marshalVariantType}, + coreglib.TypeMarshaler{T: GTypeVariant, F: marshalVariant}, + }) +} + +const ALLOCATOR_LIST = 1 +const ALLOCATOR_NODE = 3 +const ALLOCATOR_SLIST = 2 +const ALLOC_AND_FREE = 2 +const ALLOC_ONLY = 1 +const ANALYZER_ANALYZING = 1 + +// ASCII_DTOSTR_BUF_SIZE: good size for a buffer to be passed into +// glib.ASCIIDtostr(). It is guaranteed to be enough for all output of that +// function on systems with 64bit IEEE-compatible doubles. +// +// The typical usage would be something like: +// +// char buf[G_ASCII_DTOSTR_BUF_SIZE]; +// +// fprintf (out, "value=s\n", g_ascii_dtostr (buf, sizeof (buf), value));. +const ASCII_DTOSTR_BUF_SIZE = 39 + +// ATOMIC_REF_COUNT_INIT evaluates to the initial reference count for +// gatomicrefcount. +// +// This macro is useful for initializing gatomicrefcount fields inside +// structures, for instance: +// +// typedef struct { +// gatomicrefcount ref_count; +// char *name; +// char *address; +// } Person; +// +// static const Person default_person = { +// .ref_count = G_ATOMIC_REF_COUNT_INIT, +// .name = "Default name", +// .address = "Default address", +// };. +const ATOMIC_REF_COUNT_INIT = 1 +const BIG_ENDIAN = 4321 + +// CSET_A_2_Z: set of uppercase ASCII alphabet characters. Used for specifying +// valid identifier characters in Config. +const CSET_A_2_Z = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// CSET_DIGITS: set of ASCII digits. Used for specifying valid identifier +// characters in Config. +const CSET_DIGITS = "0123456789" + +// CSET_a_2_z: set of lowercase ASCII alphabet characters. Used for specifying +// valid identifier characters in Config. +const CSET_a_2_z = "abcdefghijklmnopqrstuvwxyz" +const C_STD_VERSION = 199000 + +// DATALIST_FLAGS_MASK: bitmask that restricts the possible flags +// passed to g_datalist_set_flags(). Passing a flags value where flags & +// ~G_DATALIST_FLAGS_MASK != 0 is an error. +const DATALIST_FLAGS_MASK = 3 + +// DATE_BAD_DAY represents an invalid Day. +const DATE_BAD_DAY = 0 + +// DATE_BAD_JULIAN represents an invalid Julian day number. +const DATE_BAD_JULIAN = 0 + +// DATE_BAD_YEAR represents an invalid year. +const DATE_BAD_YEAR = 0 +const DIR_SEPARATOR = 47 +const DIR_SEPARATOR_S = "/" +const E = 2.718282 +const GINT16_FORMAT = "hi" +const GINT16_MODIFIER = "h" +const GINT32_FORMAT = "i" +const GINT32_MODIFIER = "" +const GINT64_FORMAT = "li" +const GINT64_MODIFIER = "l" +const GINTPTR_FORMAT = "li" +const GINTPTR_MODIFIER = "l" + +// GNUC_FUNCTION expands to "" on all modern compilers, and to __FUNCTION__ on +// gcc version 2.x. Don't use it. +// +// Deprecated: Use G_STRFUNC() instead. +const GNUC_FUNCTION = "" + +// GNUC_PRETTY_FUNCTION expands to "" on all modern compilers, and to +// __PRETTY_FUNCTION__ on gcc version 2.x. Don't use it. +// +// Deprecated: Use G_STRFUNC() instead. +const GNUC_PRETTY_FUNCTION = "" +const GSIZE_FORMAT = "lu" +const GSIZE_MODIFIER = "l" +const GSSIZE_FORMAT = "li" +const GSSIZE_MODIFIER = "l" +const GUINT16_FORMAT = "hu" +const GUINT32_FORMAT = "u" +const GUINT64_FORMAT = "lu" +const GUINTPTR_FORMAT = "lu" +const HAVE_GINT64 = 1 +const HAVE_GNUC_VARARGS = 1 +const HAVE_GNUC_VISIBILITY = 1 +const HAVE_GROWING_STACK = 0 +const HAVE_ISO_VARARGS = 1 + +// HOOK_FLAG_USER_SHIFT: position of the first bit which is not reserved for +// internal use be the #GHook implementation, i.e. 1 << G_HOOK_FLAG_USER_SHIFT +// is the first bit which can be used for application-defined flags. +const HOOK_FLAG_USER_SHIFT = 4 +const IEEE754_DOUBLE_BIAS = 1023 +const IEEE754_FLOAT_BIAS = 127 + +// KEY_FILE_DESKTOP_GROUP: name of the main group of a desktop +// entry file, as defined in the Desktop Entry Specification +// (http://freedesktop.org/Standards/desktop-entry-spec). Consult the +// specification for more details about the meanings of the keys below. +const KEY_FILE_DESKTOP_GROUP = "Desktop Entry" + +// KEY_FILE_DESKTOP_KEY_ACTIONS: key under G_KEY_FILE_DESKTOP_GROUP, whose value +// is a string list giving the available application actions. +const KEY_FILE_DESKTOP_KEY_ACTIONS = "Actions" + +// KEY_FILE_DESKTOP_KEY_CATEGORIES: key under G_KEY_FILE_DESKTOP_GROUP, whose +// value is a list of strings giving the categories in which the desktop entry +// should be shown in a menu. +const KEY_FILE_DESKTOP_KEY_CATEGORIES = "Categories" + +// KEY_FILE_DESKTOP_KEY_COMMENT: key under G_KEY_FILE_DESKTOP_GROUP, whose value +// is a localized string giving the tooltip for the desktop entry. +const KEY_FILE_DESKTOP_KEY_COMMENT = "Comment" + +// KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE: key under G_KEY_FILE_DESKTOP_GROUP, +// whose value is a boolean set to true if the application is D-Bus activatable. +const KEY_FILE_DESKTOP_KEY_DBUS_ACTIVATABLE = "DBusActivatable" + +// KEY_FILE_DESKTOP_KEY_EXEC: key under G_KEY_FILE_DESKTOP_GROUP, whose value +// is a string giving the command line to execute. It is only valid for desktop +// entries with the Application type. +const KEY_FILE_DESKTOP_KEY_EXEC = "Exec" + +// KEY_FILE_DESKTOP_KEY_GENERIC_NAME: key under G_KEY_FILE_DESKTOP_GROUP, whose +// value is a localized string giving the generic name of the desktop entry. +const KEY_FILE_DESKTOP_KEY_GENERIC_NAME = "GenericName" + +// KEY_FILE_DESKTOP_KEY_HIDDEN: key under G_KEY_FILE_DESKTOP_GROUP, whose value +// is a boolean stating whether the desktop entry has been deleted by the user. +const KEY_FILE_DESKTOP_KEY_HIDDEN = "Hidden" + +// KEY_FILE_DESKTOP_KEY_ICON: key under G_KEY_FILE_DESKTOP_GROUP, whose value +// is a localized string giving the name of the icon to be displayed for the +// desktop entry. +const KEY_FILE_DESKTOP_KEY_ICON = "Icon" + +// KEY_FILE_DESKTOP_KEY_MIME_TYPE: key under G_KEY_FILE_DESKTOP_GROUP, whose +// value is a list of strings giving the MIME types supported by this desktop +// entry. +const KEY_FILE_DESKTOP_KEY_MIME_TYPE = "MimeType" + +// KEY_FILE_DESKTOP_KEY_NAME: key under G_KEY_FILE_DESKTOP_GROUP, whose value is +// a localized string giving the specific name of the desktop entry. +const KEY_FILE_DESKTOP_KEY_NAME = "Name" + +// KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN: key under G_KEY_FILE_DESKTOP_GROUP, +// whose value is a list of strings identifying the environments that should not +// display the desktop entry. +const KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN = "NotShowIn" + +// KEY_FILE_DESKTOP_KEY_NO_DISPLAY: key under G_KEY_FILE_DESKTOP_GROUP, +// whose value is a boolean stating whether the desktop entry should be shown in +// menus. +const KEY_FILE_DESKTOP_KEY_NO_DISPLAY = "NoDisplay" + +// KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN: key under G_KEY_FILE_DESKTOP_GROUP, +// whose value is a list of strings identifying the environments that should +// display the desktop entry. +const KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN = "OnlyShowIn" + +// KEY_FILE_DESKTOP_KEY_PATH: key under G_KEY_FILE_DESKTOP_GROUP, whose value is +// a string containing the working directory to run the program in. It is only +// valid for desktop entries with the Application type. +const KEY_FILE_DESKTOP_KEY_PATH = "Path" + +// KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY: key under G_KEY_FILE_DESKTOP_GROUP, +// whose value is a boolean stating whether the application +// supports the Startup Notification Protocol Specification +// (http://www.freedesktop.org/Standards/startup-notification-spec). +const KEY_FILE_DESKTOP_KEY_STARTUP_NOTIFY = "StartupNotify" + +// KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS: key under G_KEY_FILE_DESKTOP_GROUP, +// whose value is string identifying the WM class or name hint of a window +// that the application will create, which can be used to emulate Startup +// Notification with older applications. +const KEY_FILE_DESKTOP_KEY_STARTUP_WM_CLASS = "StartupWMClass" + +// KEY_FILE_DESKTOP_KEY_TERMINAL: key under G_KEY_FILE_DESKTOP_GROUP, whose +// value is a boolean stating whether the program should be run in a terminal +// window. +// +// It is only valid for desktop entries with the Application type. +const KEY_FILE_DESKTOP_KEY_TERMINAL = "Terminal" + +// KEY_FILE_DESKTOP_KEY_TRY_EXEC: key under G_KEY_FILE_DESKTOP_GROUP, whose +// value is a string giving the file name of a binary on disk used to determine +// if the program is actually installed. It is only valid for desktop entries +// with the Application type. +const KEY_FILE_DESKTOP_KEY_TRY_EXEC = "TryExec" + +// KEY_FILE_DESKTOP_KEY_TYPE: key under G_KEY_FILE_DESKTOP_GROUP, whose value is +// a string giving the type of the desktop entry. +// +// Usually G_KEY_FILE_DESKTOP_TYPE_APPLICATION, G_KEY_FILE_DESKTOP_TYPE_LINK, +// or G_KEY_FILE_DESKTOP_TYPE_DIRECTORY. +const KEY_FILE_DESKTOP_KEY_TYPE = "Type" + +// KEY_FILE_DESKTOP_KEY_URL: key under G_KEY_FILE_DESKTOP_GROUP, whose value is +// a string giving the URL to access. It is only valid for desktop entries with +// the Link type. +const KEY_FILE_DESKTOP_KEY_URL = "URL" + +// KEY_FILE_DESKTOP_KEY_VERSION: key under G_KEY_FILE_DESKTOP_GROUP, whose value +// is a string giving the version of the Desktop Entry Specification used for +// the desktop entry file. +const KEY_FILE_DESKTOP_KEY_VERSION = "Version" + +// KEY_FILE_DESKTOP_TYPE_APPLICATION: value of the G_KEY_FILE_DESKTOP_KEY_TYPE, +// key for desktop entries representing applications. +const KEY_FILE_DESKTOP_TYPE_APPLICATION = "Application" + +// KEY_FILE_DESKTOP_TYPE_DIRECTORY: value of the G_KEY_FILE_DESKTOP_KEY_TYPE, +// key for desktop entries representing directories. +const KEY_FILE_DESKTOP_TYPE_DIRECTORY = "Directory" + +// KEY_FILE_DESKTOP_TYPE_LINK: value of the G_KEY_FILE_DESKTOP_KEY_TYPE, +// key for desktop entries representing links to documents. +const KEY_FILE_DESKTOP_TYPE_LINK = "Link" +const LITTLE_ENDIAN = 1234 +const LN10 = 2.302585 +const LN2 = 0.693147 +const LOG_2_BASE_10 = 0.301030 + +// LOG_DOMAIN defines the log domain. See Log Domains (#log-domains). +// +// Libraries should define this so that any messages which they log can be +// differentiated from messages from other libraries and application code. +// But be careful not to define it in any public header files. +// +// Log domains must be unique, and it is recommended that they are the +// application or library name, optionally followed by a hyphen and a sub-domain +// name. For example, bloatpad or bloatpad-io. +// +// If undefined, it defaults to the default NULL (or "") log domain; this is +// not advisable, as it cannot be filtered against using the G_MESSAGES_DEBUG +// environment variable. +// +// For example, GTK uses this in its Makefile.am: +// +// AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Gtk\" +// +// Applications can choose to leave it as the default NULL (or "") domain. +// However, defining the domain offers the same advantages as above. +const LOG_DOMAIN = 0 + +// LOG_FATAL_MASK: GLib log levels that are considered fatal by default. +// +// This is not used if structured logging is enabled; see Using Structured +// Logging (logging.html#using-structured-logging). +const LOG_FATAL_MASK = 5 + +// LOG_LEVEL_USER_SHIFT: log levels below 1<message should + // explain. + SpawnErrorFailed SpawnError = 19 +) + +// String returns the name in string for SpawnError. +func (s SpawnError) String() string { + switch s { + case SpawnErrorFork: + return "Fork" + case SpawnErrorRead: + return "Read" + case SpawnErrorChdir: + return "Chdir" + case SpawnErrorAcces: + return "Acces" + case SpawnErrorPerm: + return "Perm" + case SpawnErrorTooBig: + return "TooBig" + case SpawnErrorNoexec: + return "Noexec" + case SpawnErrorNametoolong: + return "Nametoolong" + case SpawnErrorNoent: + return "Noent" + case SpawnErrorNOMEM: + return "NOMEM" + case SpawnErrorNotdir: + return "Notdir" + case SpawnErrorLoop: + return "Loop" + case SpawnErrorTxtbusy: + return "Txtbusy" + case SpawnErrorIO: + return "IO" + case SpawnErrorNfile: + return "Nfile" + case SpawnErrorMfile: + return "Mfile" + case SpawnErrorInval: + return "Inval" + case SpawnErrorIsdir: + return "Isdir" + case SpawnErrorLibbad: + return "Libbad" + case SpawnErrorFailed: + return "Failed" + default: + return fmt.Sprintf("SpawnError(%d)", s) + } +} + +// TimeType disambiguates a given time in two ways. +// +// First, specifies if the given time is in universal or local time. +// +// Second, if the time is in local time, specifies if it is local standard time +// or local daylight time. This is important for the case where the same local +// time occurs twice (during daylight savings time transitions, for example). +type TimeType C.gint + +const ( + // TimeTypeStandard: time is in local standard time. + TimeTypeStandard TimeType = iota + // TimeTypeDaylight: time is in local daylight time. + TimeTypeDaylight + // TimeTypeUniversal: time is in UTC. + TimeTypeUniversal +) + +// String returns the name in string for TimeType. +func (t TimeType) String() string { + switch t { + case TimeTypeStandard: + return "Standard" + case TimeTypeDaylight: + return "Daylight" + case TimeTypeUniversal: + return "Universal" + default: + return fmt.Sprintf("TimeType(%d)", t) + } +} + +// TokenType: possible types of token returned from each +// g_scanner_get_next_token() call. +type TokenType C.gint + +const ( + // TokenEOF: end of the file. + TokenEOF TokenType = 0 + // TokenLeftParen: '(' character. + TokenLeftParen TokenType = 40 + // TokenRightParen: ')' character. + TokenRightParen TokenType = 41 + // TokenLeftCurly: '{' character. + TokenLeftCurly TokenType = 123 + // TokenRightCurly: '}' character. + TokenRightCurly TokenType = 125 + // TokenLeftBrace: '[' character. + TokenLeftBrace TokenType = 91 + // TokenRightBrace: ']' character. + TokenRightBrace TokenType = 93 + // TokenEqualSign: '=' character. + TokenEqualSign TokenType = 61 + // TokenComma: ',' character. + TokenComma TokenType = 44 + // TokenNone: not a token. + TokenNone TokenType = 256 + // TokenError: error occurred. + TokenError TokenType = 257 + // TokenChar: character. + TokenChar TokenType = 258 + // TokenBinary: binary integer. + TokenBinary TokenType = 259 + // TokenOctal: octal integer. + TokenOctal TokenType = 260 + // TokenInt: integer. + TokenInt TokenType = 261 + // TokenHex: hex integer. + TokenHex TokenType = 262 + // TokenFloat: floating point number. + TokenFloat TokenType = 263 + // TokenString: string. + TokenString TokenType = 264 + // TokenSymbol: symbol. + TokenSymbol TokenType = 265 + // TokenIdentifier: identifier. + TokenIdentifier TokenType = 266 + // TokenIdentifierNull: null identifier. + TokenIdentifierNull TokenType = 267 + // TokenCommentSingle: one line comment. + TokenCommentSingle TokenType = 268 + // TokenCommentMulti: multi line comment. + TokenCommentMulti TokenType = 269 +) + +// String returns the name in string for TokenType. +func (t TokenType) String() string { + switch t { + case TokenEOF: + return "EOF" + case TokenLeftParen: + return "LeftParen" + case TokenRightParen: + return "RightParen" + case TokenLeftCurly: + return "LeftCurly" + case TokenRightCurly: + return "RightCurly" + case TokenLeftBrace: + return "LeftBrace" + case TokenRightBrace: + return "RightBrace" + case TokenEqualSign: + return "EqualSign" + case TokenComma: + return "Comma" + case TokenNone: + return "None" + case TokenError: + return "Error" + case TokenChar: + return "Char" + case TokenBinary: + return "Binary" + case TokenOctal: + return "Octal" + case TokenInt: + return "Int" + case TokenHex: + return "Hex" + case TokenFloat: + return "Float" + case TokenString: + return "String" + case TokenSymbol: + return "Symbol" + case TokenIdentifier: + return "Identifier" + case TokenIdentifierNull: + return "IdentifierNull" + case TokenCommentSingle: + return "CommentSingle" + case TokenCommentMulti: + return "CommentMulti" + default: + return fmt.Sprintf("TokenType(%d)", t) + } +} + +// TraverseType specifies the type of traversal performed by g_tree_traverse(), +// g_node_traverse() and g_node_find(). The different orders are illustrated +// here: +// +// - In order: A, B, C, D, E, F, G, H, I ! (Sorted_binary_tree_inorder.svg) +// +// - Pre order: F, B, A, D, C, E, G, I, H ! (Sorted_binary_tree_preorder.svg) +// +// - Post order: A, C, E, D, B, H, I, G, F ! (Sorted_binary_tree_postorder.svg) +// +// - Level order: F, B, G, A, D, I, C, E, H ! +// (Sorted_binary_tree_breadth-first_traversal.svg). +type TraverseType C.gint + +const ( + // InOrder vists a node's left child first, then the node itself, then + // its right child. This is the one to use if you want the output sorted + // according to the compare function. + InOrder TraverseType = iota + // PreOrder visits a node, then its children. + PreOrder + // PostOrder visits the node's children, then the node itself. + PostOrder + // LevelOrder is not implemented for [balanced binary + // trees][glib-Balanced-Binary-Trees]. For [n-ary trees][glib-N-ary-Trees], + // it vists the root node first, then its children, then its grandchildren, + // and so on. Note that this is less efficient than the other orders. + LevelOrder +) + +// String returns the name in string for TraverseType. +func (t TraverseType) String() string { + switch t { + case InOrder: + return "InOrder" + case PreOrder: + return "PreOrder" + case PostOrder: + return "PostOrder" + case LevelOrder: + return "LevelOrder" + default: + return fmt.Sprintf("TraverseType(%d)", t) + } +} + +// UnicodeBreakType: these are the possible line break classifications. +// +// Since new Unicode versions may add new types here, applications +// should be ready to handle unknown values. They may be regarded as +// G_UNICODE_BREAK_UNKNOWN. +// +// See Unicode Line Breaking Algorithm (https://www.unicode.org/reports/tr14/). +type UnicodeBreakType C.gint + +const ( + // UnicodeBreakMandatory: mandatory Break (BK). + UnicodeBreakMandatory UnicodeBreakType = 0 + // UnicodeBreakCarriageReturn: carriage Return (CR). + UnicodeBreakCarriageReturn UnicodeBreakType = 1 + // UnicodeBreakLineFeed: line Feed (LF). + UnicodeBreakLineFeed UnicodeBreakType = 2 + // UnicodeBreakCombiningMark: attached Characters and Combining Marks (CM). + UnicodeBreakCombiningMark UnicodeBreakType = 3 + // UnicodeBreakSurrogate surrogates (SG). + UnicodeBreakSurrogate UnicodeBreakType = 4 + // UnicodeBreakZeroWidthSpace: zero Width Space (ZW). + UnicodeBreakZeroWidthSpace UnicodeBreakType = 5 + // UnicodeBreakInseparable: inseparable (IN). + UnicodeBreakInseparable UnicodeBreakType = 6 + // UnicodeBreakNonBreakingGlue: non-breaking ("Glue") (GL). + UnicodeBreakNonBreakingGlue UnicodeBreakType = 7 + // UnicodeBreakContingent: contingent Break Opportunity (CB). + UnicodeBreakContingent UnicodeBreakType = 8 + // UnicodeBreakSpace: space (SP). + UnicodeBreakSpace UnicodeBreakType = 9 + // UnicodeBreakAfter: break Opportunity After (BA). + UnicodeBreakAfter UnicodeBreakType = 10 + // UnicodeBreakBefore: break Opportunity Before (BB). + UnicodeBreakBefore UnicodeBreakType = 11 + // UnicodeBreakBeforeAndAfter: break Opportunity Before and After (B2). + UnicodeBreakBeforeAndAfter UnicodeBreakType = 12 + // UnicodeBreakHyphen: hyphen (HY). + UnicodeBreakHyphen UnicodeBreakType = 13 + // UnicodeBreakNonStarter: nonstarter (NS). + UnicodeBreakNonStarter UnicodeBreakType = 14 + // UnicodeBreakOpenPunctuation: opening Punctuation (OP). + UnicodeBreakOpenPunctuation UnicodeBreakType = 15 + // UnicodeBreakClosePunctuation: closing Punctuation (CL). + UnicodeBreakClosePunctuation UnicodeBreakType = 16 + // UnicodeBreakQuotation ambiguous Quotation (QU). + UnicodeBreakQuotation UnicodeBreakType = 17 + // UnicodeBreakExclamation: exclamation/Interrogation (EX). + UnicodeBreakExclamation UnicodeBreakType = 18 + // UnicodeBreakIdeographic: ideographic (ID). + UnicodeBreakIdeographic UnicodeBreakType = 19 + // UnicodeBreakNumeric: numeric (NU). + UnicodeBreakNumeric UnicodeBreakType = 20 + // UnicodeBreakInfixSeparator: infix Separator (Numeric) (IS). + UnicodeBreakInfixSeparator UnicodeBreakType = 21 + // UnicodeBreakSymbol symbols Allowing Break After (SY). + UnicodeBreakSymbol UnicodeBreakType = 22 + // UnicodeBreakAlphabetic: ordinary Alphabetic and Symbol Characters (AL). + UnicodeBreakAlphabetic UnicodeBreakType = 23 + // UnicodeBreakPrefix: prefix (Numeric) (PR). + UnicodeBreakPrefix UnicodeBreakType = 24 + // UnicodeBreakPostfix: postfix (Numeric) (PO). + UnicodeBreakPostfix UnicodeBreakType = 25 + // UnicodeBreakComplexContext: complex Content Dependent (South East Asian) + // (SA). + UnicodeBreakComplexContext UnicodeBreakType = 26 + // UnicodeBreakAmbiguous ambiguous (Alphabetic or Ideographic) (AI). + UnicodeBreakAmbiguous UnicodeBreakType = 27 + // UnicodeBreakUnknown: unknown (XX). + UnicodeBreakUnknown UnicodeBreakType = 28 + // UnicodeBreakNextLine: next Line (NL). + UnicodeBreakNextLine UnicodeBreakType = 29 + // UnicodeBreakWordJoiner: word Joiner (WJ). + UnicodeBreakWordJoiner UnicodeBreakType = 30 + // UnicodeBreakHangulLJamo: hangul L Jamo (JL). + UnicodeBreakHangulLJamo UnicodeBreakType = 31 + // UnicodeBreakHangulVJamo: hangul V Jamo (JV). + UnicodeBreakHangulVJamo UnicodeBreakType = 32 + // UnicodeBreakHangulTJamo: hangul T Jamo (JT). + UnicodeBreakHangulTJamo UnicodeBreakType = 33 + // UnicodeBreakHangulLvSyllable: hangul LV Syllable (H2). + UnicodeBreakHangulLvSyllable UnicodeBreakType = 34 + // UnicodeBreakHangulLvtSyllable: hangul LVT Syllable (H3). + UnicodeBreakHangulLvtSyllable UnicodeBreakType = 35 + // UnicodeBreakCloseParanthesis: closing Parenthesis (CP). Since 2.28. + // Deprecated: 2.70: Use G_UNICODE_BREAK_CLOSE_PARENTHESIS instead. + UnicodeBreakCloseParanthesis UnicodeBreakType = 36 + // UnicodeBreakCloseParenthesis: closing Parenthesis (CP). Since 2.70. + UnicodeBreakCloseParenthesis UnicodeBreakType = 36 + // UnicodeBreakConditionalJapaneseStarter: conditional Japanese Starter + // (CJ). Since: 2.32. + UnicodeBreakConditionalJapaneseStarter UnicodeBreakType = 37 + // UnicodeBreakHebrewLetter: hebrew Letter (HL). Since: 2.32. + UnicodeBreakHebrewLetter UnicodeBreakType = 38 + // UnicodeBreakRegionalIndicator: regional Indicator (RI). Since: 2.36. + UnicodeBreakRegionalIndicator UnicodeBreakType = 39 + // UnicodeBreakEmojiBase: emoji Base (EB). Since: 2.50. + UnicodeBreakEmojiBase UnicodeBreakType = 40 + // UnicodeBreakEmojiModifier: emoji Modifier (EM). Since: 2.50. + UnicodeBreakEmojiModifier UnicodeBreakType = 41 + // UnicodeBreakZeroWidthJoiner: zero Width Joiner (ZWJ). Since: 2.50. + UnicodeBreakZeroWidthJoiner UnicodeBreakType = 42 + // UnicodeBreakAksara: aksara (AK). Since: + // 2.80 G_UNICODE_BREAK_AKSARA_PRE_BASE (AP). Since: + // 2.80 G_UNICODE_BREAK_AKSARA_START (AS). Since: 2.80 + // G_UNICODE_BREAK_VIRAMA_FINAL (VF). Since: 2.80 G_UNICODE_BREAK_VIRAMA + // (VI). Since: 2.80. + UnicodeBreakAksara UnicodeBreakType = 43 + UnicodeBreakAksaraPreBase UnicodeBreakType = 44 + UnicodeBreakAksaraStart UnicodeBreakType = 45 + UnicodeBreakViramaFinal UnicodeBreakType = 46 + UnicodeBreakVirama UnicodeBreakType = 47 +) + +func marshalUnicodeBreakType(p uintptr) (interface{}, error) { + return UnicodeBreakType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for UnicodeBreakType. +func (u UnicodeBreakType) String() string { + switch u { + case UnicodeBreakMandatory: + return "Mandatory" + case UnicodeBreakCarriageReturn: + return "CarriageReturn" + case UnicodeBreakLineFeed: + return "LineFeed" + case UnicodeBreakCombiningMark: + return "CombiningMark" + case UnicodeBreakSurrogate: + return "Surrogate" + case UnicodeBreakZeroWidthSpace: + return "ZeroWidthSpace" + case UnicodeBreakInseparable: + return "Inseparable" + case UnicodeBreakNonBreakingGlue: + return "NonBreakingGlue" + case UnicodeBreakContingent: + return "Contingent" + case UnicodeBreakSpace: + return "Space" + case UnicodeBreakAfter: + return "After" + case UnicodeBreakBefore: + return "Before" + case UnicodeBreakBeforeAndAfter: + return "BeforeAndAfter" + case UnicodeBreakHyphen: + return "Hyphen" + case UnicodeBreakNonStarter: + return "NonStarter" + case UnicodeBreakOpenPunctuation: + return "OpenPunctuation" + case UnicodeBreakClosePunctuation: + return "ClosePunctuation" + case UnicodeBreakQuotation: + return "Quotation" + case UnicodeBreakExclamation: + return "Exclamation" + case UnicodeBreakIdeographic: + return "Ideographic" + case UnicodeBreakNumeric: + return "Numeric" + case UnicodeBreakInfixSeparator: + return "InfixSeparator" + case UnicodeBreakSymbol: + return "Symbol" + case UnicodeBreakAlphabetic: + return "Alphabetic" + case UnicodeBreakPrefix: + return "Prefix" + case UnicodeBreakPostfix: + return "Postfix" + case UnicodeBreakComplexContext: + return "ComplexContext" + case UnicodeBreakAmbiguous: + return "Ambiguous" + case UnicodeBreakUnknown: + return "Unknown" + case UnicodeBreakNextLine: + return "NextLine" + case UnicodeBreakWordJoiner: + return "WordJoiner" + case UnicodeBreakHangulLJamo: + return "HangulLJamo" + case UnicodeBreakHangulVJamo: + return "HangulVJamo" + case UnicodeBreakHangulTJamo: + return "HangulTJamo" + case UnicodeBreakHangulLvSyllable: + return "HangulLvSyllable" + case UnicodeBreakHangulLvtSyllable: + return "HangulLvtSyllable" + case UnicodeBreakCloseParanthesis: + return "CloseParanthesis" + case UnicodeBreakConditionalJapaneseStarter: + return "ConditionalJapaneseStarter" + case UnicodeBreakHebrewLetter: + return "HebrewLetter" + case UnicodeBreakRegionalIndicator: + return "RegionalIndicator" + case UnicodeBreakEmojiBase: + return "EmojiBase" + case UnicodeBreakEmojiModifier: + return "EmojiModifier" + case UnicodeBreakZeroWidthJoiner: + return "ZeroWidthJoiner" + case UnicodeBreakAksara: + return "Aksara" + case UnicodeBreakAksaraPreBase: + return "AksaraPreBase" + case UnicodeBreakAksaraStart: + return "AksaraStart" + case UnicodeBreakViramaFinal: + return "ViramaFinal" + case UnicodeBreakVirama: + return "Virama" + default: + return fmt.Sprintf("UnicodeBreakType(%d)", u) + } +} + +// UnicodeScript enumeration identifies different writing systems. The values +// correspond to the names as defined in the Unicode standard. The enumeration +// has been added in GLib 2.14, and is interchangeable with Script. +// +// Note that new types may be added in the future. Applications should be +// ready to handle unknown values. See Unicode Standard Annex #24: Script names +// (http://www.unicode.org/reports/tr24/). +type UnicodeScript C.gint + +const ( + // UnicodeScriptInvalidCode: value never returned from + // g_unichar_get_script(). + UnicodeScriptInvalidCode UnicodeScript = -1 + // UnicodeScriptCommon: character used by multiple different scripts. + UnicodeScriptCommon UnicodeScript = 0 + // UnicodeScriptInherited: mark glyph that takes its script from the base + // glyph to which it is attached. + UnicodeScriptInherited UnicodeScript = 1 + // UnicodeScriptArabic: arabic. + UnicodeScriptArabic UnicodeScript = 2 + // UnicodeScriptArmenian: armenian. + UnicodeScriptArmenian UnicodeScript = 3 + // UnicodeScriptBengali: bengali. + UnicodeScriptBengali UnicodeScript = 4 + // UnicodeScriptBopomofo: bopomofo. + UnicodeScriptBopomofo UnicodeScript = 5 + // UnicodeScriptCherokee: cherokee. + UnicodeScriptCherokee UnicodeScript = 6 + // UnicodeScriptCoptic: coptic. + UnicodeScriptCoptic UnicodeScript = 7 + // UnicodeScriptCyrillic: cyrillic. + UnicodeScriptCyrillic UnicodeScript = 8 + // UnicodeScriptDeseret: deseret. + UnicodeScriptDeseret UnicodeScript = 9 + // UnicodeScriptDevanagari: devanagari. + UnicodeScriptDevanagari UnicodeScript = 10 + // UnicodeScriptEthiopic: ethiopic. + UnicodeScriptEthiopic UnicodeScript = 11 + // UnicodeScriptGeorgian: georgian. + UnicodeScriptGeorgian UnicodeScript = 12 + // UnicodeScriptGothic: gothic. + UnicodeScriptGothic UnicodeScript = 13 + // UnicodeScriptGreek: greek. + UnicodeScriptGreek UnicodeScript = 14 + // UnicodeScriptGujarati: gujarati. + UnicodeScriptGujarati UnicodeScript = 15 + // UnicodeScriptGurmukhi: gurmukhi. + UnicodeScriptGurmukhi UnicodeScript = 16 + // UnicodeScriptHan: han. + UnicodeScriptHan UnicodeScript = 17 + // UnicodeScriptHangul: hangul. + UnicodeScriptHangul UnicodeScript = 18 + // UnicodeScriptHebrew: hebrew. + UnicodeScriptHebrew UnicodeScript = 19 + // UnicodeScriptHiragana: hiragana. + UnicodeScriptHiragana UnicodeScript = 20 + // UnicodeScriptKannada: kannada. + UnicodeScriptKannada UnicodeScript = 21 + // UnicodeScriptKatakana: katakana. + UnicodeScriptKatakana UnicodeScript = 22 + // UnicodeScriptKhmer: khmer. + UnicodeScriptKhmer UnicodeScript = 23 + // UnicodeScriptLao: lao. + UnicodeScriptLao UnicodeScript = 24 + // UnicodeScriptLatin: latin. + UnicodeScriptLatin UnicodeScript = 25 + // UnicodeScriptMalayalam: malayalam. + UnicodeScriptMalayalam UnicodeScript = 26 + // UnicodeScriptMongolian: mongolian. + UnicodeScriptMongolian UnicodeScript = 27 + // UnicodeScriptMyanmar: myanmar. + UnicodeScriptMyanmar UnicodeScript = 28 + // UnicodeScriptOgham: ogham. + UnicodeScriptOgham UnicodeScript = 29 + // UnicodeScriptOldItalic: old Italic. + UnicodeScriptOldItalic UnicodeScript = 30 + // UnicodeScriptOriya: oriya. + UnicodeScriptOriya UnicodeScript = 31 + // UnicodeScriptRunic: runic. + UnicodeScriptRunic UnicodeScript = 32 + // UnicodeScriptSinhala: sinhala. + UnicodeScriptSinhala UnicodeScript = 33 + // UnicodeScriptSyriac: syriac. + UnicodeScriptSyriac UnicodeScript = 34 + // UnicodeScriptTamil: tamil. + UnicodeScriptTamil UnicodeScript = 35 + // UnicodeScriptTelugu: telugu. + UnicodeScriptTelugu UnicodeScript = 36 + // UnicodeScriptThaana: thaana. + UnicodeScriptThaana UnicodeScript = 37 + // UnicodeScriptThai: thai. + UnicodeScriptThai UnicodeScript = 38 + // UnicodeScriptTibetan: tibetan. + UnicodeScriptTibetan UnicodeScript = 39 + // UnicodeScriptCanadianAboriginal: canadian Aboriginal. + UnicodeScriptCanadianAboriginal UnicodeScript = 40 + // UnicodeScriptYi: yi. + UnicodeScriptYi UnicodeScript = 41 + // UnicodeScriptTagalog: tagalog. + UnicodeScriptTagalog UnicodeScript = 42 + // UnicodeScriptHanunoo: hanunoo. + UnicodeScriptHanunoo UnicodeScript = 43 + // UnicodeScriptBuhid: buhid. + UnicodeScriptBuhid UnicodeScript = 44 + // UnicodeScriptTagbanwa: tagbanwa. + UnicodeScriptTagbanwa UnicodeScript = 45 + // UnicodeScriptBraille: braille. + UnicodeScriptBraille UnicodeScript = 46 + // UnicodeScriptCypriot: cypriot. + UnicodeScriptCypriot UnicodeScript = 47 + // UnicodeScriptLimbu: limbu. + UnicodeScriptLimbu UnicodeScript = 48 + // UnicodeScriptOsmanya: osmanya. + UnicodeScriptOsmanya UnicodeScript = 49 + // UnicodeScriptShavian: shavian. + UnicodeScriptShavian UnicodeScript = 50 + // UnicodeScriptLinearB: linear B. + UnicodeScriptLinearB UnicodeScript = 51 + // UnicodeScriptTaiLe: tai Le. + UnicodeScriptTaiLe UnicodeScript = 52 + // UnicodeScriptUgaritic: ugaritic. + UnicodeScriptUgaritic UnicodeScript = 53 + // UnicodeScriptNewTaiLue: new Tai Lue. + UnicodeScriptNewTaiLue UnicodeScript = 54 + // UnicodeScriptBuginese: buginese. + UnicodeScriptBuginese UnicodeScript = 55 + // UnicodeScriptGlagolitic: glagolitic. + UnicodeScriptGlagolitic UnicodeScript = 56 + // UnicodeScriptTifinagh: tifinagh. + UnicodeScriptTifinagh UnicodeScript = 57 + // UnicodeScriptSylotiNagri: syloti Nagri. + UnicodeScriptSylotiNagri UnicodeScript = 58 + // UnicodeScriptOldPersian: old Persian. + UnicodeScriptOldPersian UnicodeScript = 59 + // UnicodeScriptKharoshthi: kharoshthi. + UnicodeScriptKharoshthi UnicodeScript = 60 + // UnicodeScriptUnknown: unassigned code point. + UnicodeScriptUnknown UnicodeScript = 61 + // UnicodeScriptBalinese: balinese. + UnicodeScriptBalinese UnicodeScript = 62 + // UnicodeScriptCuneiform: cuneiform. + UnicodeScriptCuneiform UnicodeScript = 63 + // UnicodeScriptPhoenician: phoenician. + UnicodeScriptPhoenician UnicodeScript = 64 + // UnicodeScriptPhagsPa: phags-pa. + UnicodeScriptPhagsPa UnicodeScript = 65 + // UnicodeScriptNko: n'Ko. + UnicodeScriptNko UnicodeScript = 66 + // UnicodeScriptKayahLi: kayah Li. Since 2.16.3. + UnicodeScriptKayahLi UnicodeScript = 67 + // UnicodeScriptLepcha: lepcha. Since 2.16.3. + UnicodeScriptLepcha UnicodeScript = 68 + // UnicodeScriptRejang: rejang. Since 2.16.3. + UnicodeScriptRejang UnicodeScript = 69 + // UnicodeScriptSundanese: sundanese. Since 2.16.3. + UnicodeScriptSundanese UnicodeScript = 70 + // UnicodeScriptSaurashtra: saurashtra. Since 2.16.3. + UnicodeScriptSaurashtra UnicodeScript = 71 + // UnicodeScriptCham: cham. Since 2.16.3. + UnicodeScriptCham UnicodeScript = 72 + // UnicodeScriptOlChiki: ol Chiki. Since 2.16.3. + UnicodeScriptOlChiki UnicodeScript = 73 + // UnicodeScriptVai: vai. Since 2.16.3. + UnicodeScriptVai UnicodeScript = 74 + // UnicodeScriptCarian: carian. Since 2.16.3. + UnicodeScriptCarian UnicodeScript = 75 + // UnicodeScriptLycian: lycian. Since 2.16.3. + UnicodeScriptLycian UnicodeScript = 76 + // UnicodeScriptLydian: lydian. Since 2.16.3. + UnicodeScriptLydian UnicodeScript = 77 + // UnicodeScriptAvestan: avestan. Since 2.26. + UnicodeScriptAvestan UnicodeScript = 78 + // UnicodeScriptBamum: bamum. Since 2.26. + UnicodeScriptBamum UnicodeScript = 79 + // UnicodeScriptEgyptianHieroglyphs: egyptian Hieroglpyhs. Since 2.26. + UnicodeScriptEgyptianHieroglyphs UnicodeScript = 80 + // UnicodeScriptImperialAramaic: imperial Aramaic. Since 2.26. + UnicodeScriptImperialAramaic UnicodeScript = 81 + // UnicodeScriptInscriptionalPahlavi: inscriptional Pahlavi. Since 2.26. + UnicodeScriptInscriptionalPahlavi UnicodeScript = 82 + // UnicodeScriptInscriptionalParthian: inscriptional Parthian. Since 2.26. + UnicodeScriptInscriptionalParthian UnicodeScript = 83 + // UnicodeScriptJavanese: javanese. Since 2.26. + UnicodeScriptJavanese UnicodeScript = 84 + // UnicodeScriptKaithi: kaithi. Since 2.26. + UnicodeScriptKaithi UnicodeScript = 85 + // UnicodeScriptLisu: lisu. Since 2.26. + UnicodeScriptLisu UnicodeScript = 86 + // UnicodeScriptMeeteiMayek: meetei Mayek. Since 2.26. + UnicodeScriptMeeteiMayek UnicodeScript = 87 + // UnicodeScriptOldSouthArabian: old South Arabian. Since 2.26. + UnicodeScriptOldSouthArabian UnicodeScript = 88 + // UnicodeScriptOldTurkic: old Turkic. Since 2.28. + UnicodeScriptOldTurkic UnicodeScript = 89 + // UnicodeScriptSamaritan: samaritan. Since 2.26. + UnicodeScriptSamaritan UnicodeScript = 90 + // UnicodeScriptTaiTham: tai Tham. Since 2.26. + UnicodeScriptTaiTham UnicodeScript = 91 + // UnicodeScriptTaiViet: tai Viet. Since 2.26. + UnicodeScriptTaiViet UnicodeScript = 92 + // UnicodeScriptBatak: batak. Since 2.28. + UnicodeScriptBatak UnicodeScript = 93 + // UnicodeScriptBrahmi: brahmi. Since 2.28. + UnicodeScriptBrahmi UnicodeScript = 94 + // UnicodeScriptMandaic: mandaic. Since 2.28. + UnicodeScriptMandaic UnicodeScript = 95 + // UnicodeScriptChakma: chakma. Since: 2.32. + UnicodeScriptChakma UnicodeScript = 96 + // UnicodeScriptMeroiticCursive: meroitic Cursive. Since: 2.32. + UnicodeScriptMeroiticCursive UnicodeScript = 97 + // UnicodeScriptMeroiticHieroglyphs: meroitic Hieroglyphs. Since: 2.32. + UnicodeScriptMeroiticHieroglyphs UnicodeScript = 98 + // UnicodeScriptMiao: miao. Since: 2.32. + UnicodeScriptMiao UnicodeScript = 99 + // UnicodeScriptSharada: sharada. Since: 2.32. + UnicodeScriptSharada UnicodeScript = 100 + // UnicodeScriptSoraSompeng: sora Sompeng. Since: 2.32. + UnicodeScriptSoraSompeng UnicodeScript = 101 + // UnicodeScriptTakri: takri. Since: 2.32. + UnicodeScriptTakri UnicodeScript = 102 + // UnicodeScriptBassaVah: bassa. Since: 2.42. + UnicodeScriptBassaVah UnicodeScript = 103 + // UnicodeScriptCaucasianAlbanian: caucasian Albanian. Since: 2.42. + UnicodeScriptCaucasianAlbanian UnicodeScript = 104 + // UnicodeScriptDuployan: duployan. Since: 2.42. + UnicodeScriptDuployan UnicodeScript = 105 + // UnicodeScriptElbasan: elbasan. Since: 2.42. + UnicodeScriptElbasan UnicodeScript = 106 + // UnicodeScriptGrantha: grantha. Since: 2.42. + UnicodeScriptGrantha UnicodeScript = 107 + // UnicodeScriptKhojki: kjohki. Since: 2.42. + UnicodeScriptKhojki UnicodeScript = 108 + // UnicodeScriptKhudawadi: khudawadi, Sindhi. Since: 2.42. + UnicodeScriptKhudawadi UnicodeScript = 109 + // UnicodeScriptLinearA: linear A. Since: 2.42. + UnicodeScriptLinearA UnicodeScript = 110 + // UnicodeScriptMahajani: mahajani. Since: 2.42. + UnicodeScriptMahajani UnicodeScript = 111 + // UnicodeScriptManichaean: manichaean. Since: 2.42. + UnicodeScriptManichaean UnicodeScript = 112 + // UnicodeScriptMendeKikakui: mende Kikakui. Since: 2.42. + UnicodeScriptMendeKikakui UnicodeScript = 113 + // UnicodeScriptModi: modi. Since: 2.42. + UnicodeScriptModi UnicodeScript = 114 + // UnicodeScriptMro: mro. Since: 2.42. + UnicodeScriptMro UnicodeScript = 115 + // UnicodeScriptNabataean: nabataean. Since: 2.42. + UnicodeScriptNabataean UnicodeScript = 116 + // UnicodeScriptOldNorthArabian: old North Arabian. Since: 2.42. + UnicodeScriptOldNorthArabian UnicodeScript = 117 + // UnicodeScriptOldPermic: old Permic. Since: 2.42. + UnicodeScriptOldPermic UnicodeScript = 118 + // UnicodeScriptPahawhHmong: pahawh Hmong. Since: 2.42. + UnicodeScriptPahawhHmong UnicodeScript = 119 + // UnicodeScriptPalmyrene: palmyrene. Since: 2.42. + UnicodeScriptPalmyrene UnicodeScript = 120 + // UnicodeScriptPauCinHau: pau Cin Hau. Since: 2.42. + UnicodeScriptPauCinHau UnicodeScript = 121 + // UnicodeScriptPsalterPahlavi: psalter Pahlavi. Since: 2.42. + UnicodeScriptPsalterPahlavi UnicodeScript = 122 + // UnicodeScriptSiddham: siddham. Since: 2.42. + UnicodeScriptSiddham UnicodeScript = 123 + // UnicodeScriptTirhuta: tirhuta. Since: 2.42. + UnicodeScriptTirhuta UnicodeScript = 124 + // UnicodeScriptWarangCiti: warang Citi. Since: 2.42. + UnicodeScriptWarangCiti UnicodeScript = 125 + // UnicodeScriptAhom: ahom. Since: 2.48. + UnicodeScriptAhom UnicodeScript = 126 + // UnicodeScriptAnatolianHieroglyphs: anatolian Hieroglyphs. Since: 2.48. + UnicodeScriptAnatolianHieroglyphs UnicodeScript = 127 + // UnicodeScriptHatran: hatran. Since: 2.48. + UnicodeScriptHatran UnicodeScript = 128 + // UnicodeScriptMultani: multani. Since: 2.48. + UnicodeScriptMultani UnicodeScript = 129 + // UnicodeScriptOldHungarian: old Hungarian. Since: 2.48. + UnicodeScriptOldHungarian UnicodeScript = 130 + // UnicodeScriptSignwriting: signwriting. Since: 2.48. + UnicodeScriptSignwriting UnicodeScript = 131 + // UnicodeScriptAdlam: adlam. Since: 2.50. + UnicodeScriptAdlam UnicodeScript = 132 + // UnicodeScriptBhaiksuki: bhaiksuki. Since: 2.50. + UnicodeScriptBhaiksuki UnicodeScript = 133 + // UnicodeScriptMarchen: marchen. Since: 2.50. + UnicodeScriptMarchen UnicodeScript = 134 + // UnicodeScriptNewa: newa. Since: 2.50. + UnicodeScriptNewa UnicodeScript = 135 + // UnicodeScriptOsage: osage. Since: 2.50. + UnicodeScriptOsage UnicodeScript = 136 + // UnicodeScriptTangut: tangut. Since: 2.50. + UnicodeScriptTangut UnicodeScript = 137 + // UnicodeScriptMasaramGondi: masaram Gondi. Since: 2.54. + UnicodeScriptMasaramGondi UnicodeScript = 138 + // UnicodeScriptNushu: nushu. Since: 2.54. + UnicodeScriptNushu UnicodeScript = 139 + // UnicodeScriptSoyombo: soyombo. Since: 2.54. + UnicodeScriptSoyombo UnicodeScript = 140 + // UnicodeScriptZanabazarSquare: zanabazar Square. Since: 2.54. + UnicodeScriptZanabazarSquare UnicodeScript = 141 + // UnicodeScriptDogra: dogra. Since: 2.58. + UnicodeScriptDogra UnicodeScript = 142 + // UnicodeScriptGunjalaGondi: gunjala Gondi. Since: 2.58. + UnicodeScriptGunjalaGondi UnicodeScript = 143 + // UnicodeScriptHanifiRohingya: hanifi Rohingya. Since: 2.58. + UnicodeScriptHanifiRohingya UnicodeScript = 144 + // UnicodeScriptMakasar: makasar. Since: 2.58. + UnicodeScriptMakasar UnicodeScript = 145 + // UnicodeScriptMedefaidrin: medefaidrin. Since: 2.58. + UnicodeScriptMedefaidrin UnicodeScript = 146 + // UnicodeScriptOldSogdian: old Sogdian. Since: 2.58. + UnicodeScriptOldSogdian UnicodeScript = 147 + // UnicodeScriptSogdian: sogdian. Since: 2.58. + UnicodeScriptSogdian UnicodeScript = 148 + // UnicodeScriptElymaic: elym. Since: 2.62. + UnicodeScriptElymaic UnicodeScript = 149 + // UnicodeScriptNandinagari: nand. Since: 2.62. + UnicodeScriptNandinagari UnicodeScript = 150 + // UnicodeScriptNyiakengPuachueHmong: rohg. Since: 2.62. + UnicodeScriptNyiakengPuachueHmong UnicodeScript = 151 + // UnicodeScriptWancho: wcho. Since: 2.62. + UnicodeScriptWancho UnicodeScript = 152 + // UnicodeScriptChorasmian: chorasmian. Since: 2.66. + UnicodeScriptChorasmian UnicodeScript = 153 + // UnicodeScriptDivesAkuru dives Akuru. Since: 2.66. + UnicodeScriptDivesAkuru UnicodeScript = 154 + // UnicodeScriptKhitanSmallScript: khitan small script. Since: 2.66. + UnicodeScriptKhitanSmallScript UnicodeScript = 155 + // UnicodeScriptYezidi: yezidi. Since: 2.66. + UnicodeScriptYezidi UnicodeScript = 156 + // UnicodeScriptCyproMinoan: cypro-Minoan. Since: 2.72. + UnicodeScriptCyproMinoan UnicodeScript = 157 + // UnicodeScriptOldUyghur: old Uyghur. Since: 2.72. + UnicodeScriptOldUyghur UnicodeScript = 158 + // UnicodeScriptTangsa: tangsa. Since: 2.72. + UnicodeScriptTangsa UnicodeScript = 159 + // UnicodeScriptToto: toto. Since: 2.72. + UnicodeScriptToto UnicodeScript = 160 + // UnicodeScriptVithkuqi: vithkuqi. Since: 2.72. + UnicodeScriptVithkuqi UnicodeScript = 161 + // UnicodeScriptMath: mathematical notation. Since: 2.72. + UnicodeScriptMath UnicodeScript = 162 + // UnicodeScriptKawi: kawi. Since 2.74. + UnicodeScriptKawi UnicodeScript = 163 + // UnicodeScriptNagMundari: nag Mundari. Since 2.74. + UnicodeScriptNagMundari UnicodeScript = 164 +) + +func marshalUnicodeScript(p uintptr) (interface{}, error) { + return UnicodeScript(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for UnicodeScript. +func (u UnicodeScript) String() string { + switch u { + case UnicodeScriptInvalidCode: + return "InvalidCode" + case UnicodeScriptCommon: + return "Common" + case UnicodeScriptInherited: + return "Inherited" + case UnicodeScriptArabic: + return "Arabic" + case UnicodeScriptArmenian: + return "Armenian" + case UnicodeScriptBengali: + return "Bengali" + case UnicodeScriptBopomofo: + return "Bopomofo" + case UnicodeScriptCherokee: + return "Cherokee" + case UnicodeScriptCoptic: + return "Coptic" + case UnicodeScriptCyrillic: + return "Cyrillic" + case UnicodeScriptDeseret: + return "Deseret" + case UnicodeScriptDevanagari: + return "Devanagari" + case UnicodeScriptEthiopic: + return "Ethiopic" + case UnicodeScriptGeorgian: + return "Georgian" + case UnicodeScriptGothic: + return "Gothic" + case UnicodeScriptGreek: + return "Greek" + case UnicodeScriptGujarati: + return "Gujarati" + case UnicodeScriptGurmukhi: + return "Gurmukhi" + case UnicodeScriptHan: + return "Han" + case UnicodeScriptHangul: + return "Hangul" + case UnicodeScriptHebrew: + return "Hebrew" + case UnicodeScriptHiragana: + return "Hiragana" + case UnicodeScriptKannada: + return "Kannada" + case UnicodeScriptKatakana: + return "Katakana" + case UnicodeScriptKhmer: + return "Khmer" + case UnicodeScriptLao: + return "Lao" + case UnicodeScriptLatin: + return "Latin" + case UnicodeScriptMalayalam: + return "Malayalam" + case UnicodeScriptMongolian: + return "Mongolian" + case UnicodeScriptMyanmar: + return "Myanmar" + case UnicodeScriptOgham: + return "Ogham" + case UnicodeScriptOldItalic: + return "OldItalic" + case UnicodeScriptOriya: + return "Oriya" + case UnicodeScriptRunic: + return "Runic" + case UnicodeScriptSinhala: + return "Sinhala" + case UnicodeScriptSyriac: + return "Syriac" + case UnicodeScriptTamil: + return "Tamil" + case UnicodeScriptTelugu: + return "Telugu" + case UnicodeScriptThaana: + return "Thaana" + case UnicodeScriptThai: + return "Thai" + case UnicodeScriptTibetan: + return "Tibetan" + case UnicodeScriptCanadianAboriginal: + return "CanadianAboriginal" + case UnicodeScriptYi: + return "Yi" + case UnicodeScriptTagalog: + return "Tagalog" + case UnicodeScriptHanunoo: + return "Hanunoo" + case UnicodeScriptBuhid: + return "Buhid" + case UnicodeScriptTagbanwa: + return "Tagbanwa" + case UnicodeScriptBraille: + return "Braille" + case UnicodeScriptCypriot: + return "Cypriot" + case UnicodeScriptLimbu: + return "Limbu" + case UnicodeScriptOsmanya: + return "Osmanya" + case UnicodeScriptShavian: + return "Shavian" + case UnicodeScriptLinearB: + return "LinearB" + case UnicodeScriptTaiLe: + return "TaiLe" + case UnicodeScriptUgaritic: + return "Ugaritic" + case UnicodeScriptNewTaiLue: + return "NewTaiLue" + case UnicodeScriptBuginese: + return "Buginese" + case UnicodeScriptGlagolitic: + return "Glagolitic" + case UnicodeScriptTifinagh: + return "Tifinagh" + case UnicodeScriptSylotiNagri: + return "SylotiNagri" + case UnicodeScriptOldPersian: + return "OldPersian" + case UnicodeScriptKharoshthi: + return "Kharoshthi" + case UnicodeScriptUnknown: + return "Unknown" + case UnicodeScriptBalinese: + return "Balinese" + case UnicodeScriptCuneiform: + return "Cuneiform" + case UnicodeScriptPhoenician: + return "Phoenician" + case UnicodeScriptPhagsPa: + return "PhagsPa" + case UnicodeScriptNko: + return "Nko" + case UnicodeScriptKayahLi: + return "KayahLi" + case UnicodeScriptLepcha: + return "Lepcha" + case UnicodeScriptRejang: + return "Rejang" + case UnicodeScriptSundanese: + return "Sundanese" + case UnicodeScriptSaurashtra: + return "Saurashtra" + case UnicodeScriptCham: + return "Cham" + case UnicodeScriptOlChiki: + return "OlChiki" + case UnicodeScriptVai: + return "Vai" + case UnicodeScriptCarian: + return "Carian" + case UnicodeScriptLycian: + return "Lycian" + case UnicodeScriptLydian: + return "Lydian" + case UnicodeScriptAvestan: + return "Avestan" + case UnicodeScriptBamum: + return "Bamum" + case UnicodeScriptEgyptianHieroglyphs: + return "EgyptianHieroglyphs" + case UnicodeScriptImperialAramaic: + return "ImperialAramaic" + case UnicodeScriptInscriptionalPahlavi: + return "InscriptionalPahlavi" + case UnicodeScriptInscriptionalParthian: + return "InscriptionalParthian" + case UnicodeScriptJavanese: + return "Javanese" + case UnicodeScriptKaithi: + return "Kaithi" + case UnicodeScriptLisu: + return "Lisu" + case UnicodeScriptMeeteiMayek: + return "MeeteiMayek" + case UnicodeScriptOldSouthArabian: + return "OldSouthArabian" + case UnicodeScriptOldTurkic: + return "OldTurkic" + case UnicodeScriptSamaritan: + return "Samaritan" + case UnicodeScriptTaiTham: + return "TaiTham" + case UnicodeScriptTaiViet: + return "TaiViet" + case UnicodeScriptBatak: + return "Batak" + case UnicodeScriptBrahmi: + return "Brahmi" + case UnicodeScriptMandaic: + return "Mandaic" + case UnicodeScriptChakma: + return "Chakma" + case UnicodeScriptMeroiticCursive: + return "MeroiticCursive" + case UnicodeScriptMeroiticHieroglyphs: + return "MeroiticHieroglyphs" + case UnicodeScriptMiao: + return "Miao" + case UnicodeScriptSharada: + return "Sharada" + case UnicodeScriptSoraSompeng: + return "SoraSompeng" + case UnicodeScriptTakri: + return "Takri" + case UnicodeScriptBassaVah: + return "BassaVah" + case UnicodeScriptCaucasianAlbanian: + return "CaucasianAlbanian" + case UnicodeScriptDuployan: + return "Duployan" + case UnicodeScriptElbasan: + return "Elbasan" + case UnicodeScriptGrantha: + return "Grantha" + case UnicodeScriptKhojki: + return "Khojki" + case UnicodeScriptKhudawadi: + return "Khudawadi" + case UnicodeScriptLinearA: + return "LinearA" + case UnicodeScriptMahajani: + return "Mahajani" + case UnicodeScriptManichaean: + return "Manichaean" + case UnicodeScriptMendeKikakui: + return "MendeKikakui" + case UnicodeScriptModi: + return "Modi" + case UnicodeScriptMro: + return "Mro" + case UnicodeScriptNabataean: + return "Nabataean" + case UnicodeScriptOldNorthArabian: + return "OldNorthArabian" + case UnicodeScriptOldPermic: + return "OldPermic" + case UnicodeScriptPahawhHmong: + return "PahawhHmong" + case UnicodeScriptPalmyrene: + return "Palmyrene" + case UnicodeScriptPauCinHau: + return "PauCinHau" + case UnicodeScriptPsalterPahlavi: + return "PsalterPahlavi" + case UnicodeScriptSiddham: + return "Siddham" + case UnicodeScriptTirhuta: + return "Tirhuta" + case UnicodeScriptWarangCiti: + return "WarangCiti" + case UnicodeScriptAhom: + return "Ahom" + case UnicodeScriptAnatolianHieroglyphs: + return "AnatolianHieroglyphs" + case UnicodeScriptHatran: + return "Hatran" + case UnicodeScriptMultani: + return "Multani" + case UnicodeScriptOldHungarian: + return "OldHungarian" + case UnicodeScriptSignwriting: + return "Signwriting" + case UnicodeScriptAdlam: + return "Adlam" + case UnicodeScriptBhaiksuki: + return "Bhaiksuki" + case UnicodeScriptMarchen: + return "Marchen" + case UnicodeScriptNewa: + return "Newa" + case UnicodeScriptOsage: + return "Osage" + case UnicodeScriptTangut: + return "Tangut" + case UnicodeScriptMasaramGondi: + return "MasaramGondi" + case UnicodeScriptNushu: + return "Nushu" + case UnicodeScriptSoyombo: + return "Soyombo" + case UnicodeScriptZanabazarSquare: + return "ZanabazarSquare" + case UnicodeScriptDogra: + return "Dogra" + case UnicodeScriptGunjalaGondi: + return "GunjalaGondi" + case UnicodeScriptHanifiRohingya: + return "HanifiRohingya" + case UnicodeScriptMakasar: + return "Makasar" + case UnicodeScriptMedefaidrin: + return "Medefaidrin" + case UnicodeScriptOldSogdian: + return "OldSogdian" + case UnicodeScriptSogdian: + return "Sogdian" + case UnicodeScriptElymaic: + return "Elymaic" + case UnicodeScriptNandinagari: + return "Nandinagari" + case UnicodeScriptNyiakengPuachueHmong: + return "NyiakengPuachueHmong" + case UnicodeScriptWancho: + return "Wancho" + case UnicodeScriptChorasmian: + return "Chorasmian" + case UnicodeScriptDivesAkuru: + return "DivesAkuru" + case UnicodeScriptKhitanSmallScript: + return "KhitanSmallScript" + case UnicodeScriptYezidi: + return "Yezidi" + case UnicodeScriptCyproMinoan: + return "CyproMinoan" + case UnicodeScriptOldUyghur: + return "OldUyghur" + case UnicodeScriptTangsa: + return "Tangsa" + case UnicodeScriptToto: + return "Toto" + case UnicodeScriptVithkuqi: + return "Vithkuqi" + case UnicodeScriptMath: + return "Math" + case UnicodeScriptKawi: + return "Kawi" + case UnicodeScriptNagMundari: + return "NagMundari" + default: + return fmt.Sprintf("UnicodeScript(%d)", u) + } +} + +// UnicodeScriptFromISO15924 looks up the Unicode script for iso15924. ISO 15924 +// assigns four-letter codes to scripts. For example, the code for Arabic is +// 'Arab'. This function accepts four letter codes encoded as a guint32 in a +// big-endian fashion. That is, the code expected for Arabic is 0x41726162 (0x41 +// is ASCII code for 'A', 0x72 is ASCII code for 'r', etc). +// +// See Codes for the representation of names of scripts +// (http://unicode.org/iso15924/codelists.html) for details. +// +// The function takes the following parameters: +// +// - iso15924: unicode script. +// +// The function returns the following values: +// +// - unicodeScript: unicode script for iso15924, or of +// G_UNICODE_SCRIPT_INVALID_CODE if iso15924 is zero and +// G_UNICODE_SCRIPT_UNKNOWN if iso15924 is unknown. +func UnicodeScriptFromISO15924(iso15924 uint32) UnicodeScript { + var _arg1 C.guint32 // out + var _cret C.GUnicodeScript // in + + _arg1 = C.guint32(iso15924) + + _cret = C.g_unicode_script_from_iso15924(_arg1) + runtime.KeepAlive(iso15924) + + var _unicodeScript UnicodeScript // out + + _unicodeScript = UnicodeScript(_cret) + + return _unicodeScript +} + +// UnicodeScriptToISO15924 looks up the ISO 15924 code for script. ISO 15924 +// assigns four-letter codes to scripts. For example, the code for Arabic is +// 'Arab'. The four letter codes are encoded as a guint32 by this function in a +// big-endian fashion. That is, the code returned for Arabic is 0x41726162 (0x41 +// is ASCII code for 'A', 0x72 is ASCII code for 'r', etc). +// +// See Codes for the representation of names of scripts +// (http://unicode.org/iso15924/codelists.html) for details. +// +// The function takes the following parameters: +// +// - script: unicode script. +// +// The function returns the following values: +// +// - guint32: ISO 15924 code for script, encoded as an integer, of zero if +// script is G_UNICODE_SCRIPT_INVALID_CODE or ISO 15924 code 'Zzzz' (script +// code for UNKNOWN) if script is not understood. +func UnicodeScriptToISO15924(script UnicodeScript) uint32 { + var _arg1 C.GUnicodeScript // out + var _cret C.guint32 // in + + _arg1 = C.GUnicodeScript(script) + + _cret = C.g_unicode_script_to_iso15924(_arg1) + runtime.KeepAlive(script) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// UnicodeType: these are the possible character classifications +// from the Unicode specification. See Unicode Character Database +// (http://www.unicode.org/reports/tr44/Category_Values). +type UnicodeType C.gint + +const ( + // UnicodeControl: general category "Other, Control" (Cc). + UnicodeControl UnicodeType = iota + // UnicodeFormat: general category "Other, Format" (Cf). + UnicodeFormat + // UnicodeUnassigned: general category "Other, Not Assigned" (Cn). + UnicodeUnassigned + // UnicodePrivateUse: general category "Other, Private Use" (Co). + UnicodePrivateUse + // UnicodeSurrogate: general category "Other, Surrogate" (Cs). + UnicodeSurrogate + // UnicodeLowercaseLetter: general category "Letter, Lowercase" (Ll). + UnicodeLowercaseLetter + // UnicodeModifierLetter: general category "Letter, Modifier" (Lm). + UnicodeModifierLetter + // UnicodeOtherLetter: general category "Letter, Other" (Lo). + UnicodeOtherLetter + // UnicodeTitlecaseLetter: general category "Letter, Titlecase" (Lt). + UnicodeTitlecaseLetter + // UnicodeUppercaseLetter: general category "Letter, Uppercase" (Lu). + UnicodeUppercaseLetter + // UnicodeSpacingMark: general category "Mark, Spacing" (Mc). + UnicodeSpacingMark + // UnicodeEnclosingMark: general category "Mark, Enclosing" (Me). + UnicodeEnclosingMark + // UnicodeNonSpacingMark: general category "Mark, Nonspacing" (Mn). + UnicodeNonSpacingMark + // UnicodeDecimalNumber: general category "Number, Decimal Digit" (Nd). + UnicodeDecimalNumber + // UnicodeLetterNumber: general category "Number, Letter" (Nl). + UnicodeLetterNumber + // UnicodeOtherNumber: general category "Number, Other" (No). + UnicodeOtherNumber + // UnicodeConnectPunctuation: general category "Punctuation, Connector" + // (Pc). + UnicodeConnectPunctuation + // UnicodeDashPunctuation: general category "Punctuation, Dash" (Pd). + UnicodeDashPunctuation + // UnicodeClosePunctuation: general category "Punctuation, Close" (Pe). + UnicodeClosePunctuation + // UnicodeFinalPunctuation: general category "Punctuation, Final quote" + // (Pf). + UnicodeFinalPunctuation + // UnicodeInitialPunctuation: general category "Punctuation, Initial quote" + // (Pi). + UnicodeInitialPunctuation + // UnicodeOtherPunctuation: general category "Punctuation, Other" (Po). + UnicodeOtherPunctuation + // UnicodeOpenPunctuation: general category "Punctuation, Open" (Ps). + UnicodeOpenPunctuation + // UnicodeCurrencySymbol: general category "Symbol, Currency" (Sc). + UnicodeCurrencySymbol + // UnicodeModifierSymbol: general category "Symbol, Modifier" (Sk). + UnicodeModifierSymbol + // UnicodeMathSymbol: general category "Symbol, Math" (Sm). + UnicodeMathSymbol + // UnicodeOtherSymbol: general category "Symbol, Other" (So). + UnicodeOtherSymbol + // UnicodeLineSeparator: general category "Separator, Line" (Zl). + UnicodeLineSeparator + // UnicodeParagraphSeparator: general category "Separator, Paragraph" (Zp). + UnicodeParagraphSeparator + // UnicodeSpaceSeparator: general category "Separator, Space" (Zs). + UnicodeSpaceSeparator +) + +func marshalUnicodeType(p uintptr) (interface{}, error) { + return UnicodeType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for UnicodeType. +func (u UnicodeType) String() string { + switch u { + case UnicodeControl: + return "Control" + case UnicodeFormat: + return "Format" + case UnicodeUnassigned: + return "Unassigned" + case UnicodePrivateUse: + return "PrivateUse" + case UnicodeSurrogate: + return "Surrogate" + case UnicodeLowercaseLetter: + return "LowercaseLetter" + case UnicodeModifierLetter: + return "ModifierLetter" + case UnicodeOtherLetter: + return "OtherLetter" + case UnicodeTitlecaseLetter: + return "TitlecaseLetter" + case UnicodeUppercaseLetter: + return "UppercaseLetter" + case UnicodeSpacingMark: + return "SpacingMark" + case UnicodeEnclosingMark: + return "EnclosingMark" + case UnicodeNonSpacingMark: + return "NonSpacingMark" + case UnicodeDecimalNumber: + return "DecimalNumber" + case UnicodeLetterNumber: + return "LetterNumber" + case UnicodeOtherNumber: + return "OtherNumber" + case UnicodeConnectPunctuation: + return "ConnectPunctuation" + case UnicodeDashPunctuation: + return "DashPunctuation" + case UnicodeClosePunctuation: + return "ClosePunctuation" + case UnicodeFinalPunctuation: + return "FinalPunctuation" + case UnicodeInitialPunctuation: + return "InitialPunctuation" + case UnicodeOtherPunctuation: + return "OtherPunctuation" + case UnicodeOpenPunctuation: + return "OpenPunctuation" + case UnicodeCurrencySymbol: + return "CurrencySymbol" + case UnicodeModifierSymbol: + return "ModifierSymbol" + case UnicodeMathSymbol: + return "MathSymbol" + case UnicodeOtherSymbol: + return "OtherSymbol" + case UnicodeLineSeparator: + return "LineSeparator" + case UnicodeParagraphSeparator: + return "ParagraphSeparator" + case UnicodeSpaceSeparator: + return "SpaceSeparator" + default: + return fmt.Sprintf("UnicodeType(%d)", u) + } +} + +// URIError: error codes returned by #GUri methods. +type URIError C.gint + +const ( + // URIErrorFailed: generic error if no more specific error is available. + // See the error message for details. + URIErrorFailed URIError = iota + // URIErrorBadScheme: scheme of a URI could not be parsed. + URIErrorBadScheme + // URIErrorBadUser: user/userinfo of a URI could not be parsed. + URIErrorBadUser + // URIErrorBadPassword: password of a URI could not be parsed. + URIErrorBadPassword + // URIErrorBadAuthParams: authentication parameters of a URI could not be + // parsed. + URIErrorBadAuthParams + // URIErrorBadHost: host of a URI could not be parsed. + URIErrorBadHost + // URIErrorBadPort: port of a URI could not be parsed. + URIErrorBadPort + // URIErrorBadPath: path of a URI could not be parsed. + URIErrorBadPath + // URIErrorBadQuery: query of a URI could not be parsed. + URIErrorBadQuery + // URIErrorBadFragment: fragment of a URI could not be parsed. + URIErrorBadFragment +) + +// String returns the name in string for URIError. +func (u URIError) String() string { + switch u { + case URIErrorFailed: + return "Failed" + case URIErrorBadScheme: + return "BadScheme" + case URIErrorBadUser: + return "BadUser" + case URIErrorBadPassword: + return "BadPassword" + case URIErrorBadAuthParams: + return "BadAuthParams" + case URIErrorBadHost: + return "BadHost" + case URIErrorBadPort: + return "BadPort" + case URIErrorBadPath: + return "BadPath" + case URIErrorBadQuery: + return "BadQuery" + case URIErrorBadFragment: + return "BadFragment" + default: + return fmt.Sprintf("URIError(%d)", u) + } +} + +// UserDirectory: these are logical ids for special directories +// which are defined depending on the platform used. You should use +// g_get_user_special_dir() to retrieve the full path associated to the logical +// id. +// +// The Directory enumeration can be extended at later date. Not every platform +// has a directory for every logical id in this enumeration. +type UserDirectory C.gint + +const ( + // UserDirectoryDesktop user's Desktop directory. + UserDirectoryDesktop UserDirectory = iota + // UserDirectoryDocuments user's Documents directory. + UserDirectoryDocuments + // UserDirectoryDownload user's Downloads directory. + UserDirectoryDownload + // UserDirectoryMusic user's Music directory. + UserDirectoryMusic + // UserDirectoryPictures user's Pictures directory. + UserDirectoryPictures + // UserDirectoryPublicShare user's shared directory. + UserDirectoryPublicShare + // UserDirectoryTemplates user's Templates directory. + UserDirectoryTemplates + // UserDirectoryVideos user's Movies directory. + UserDirectoryVideos + // UserNDirectories: number of enum values. + UserNDirectories +) + +// String returns the name in string for UserDirectory. +func (u UserDirectory) String() string { + switch u { + case UserDirectoryDesktop: + return "DirectoryDesktop" + case UserDirectoryDocuments: + return "DirectoryDocuments" + case UserDirectoryDownload: + return "DirectoryDownload" + case UserDirectoryMusic: + return "DirectoryMusic" + case UserDirectoryPictures: + return "DirectoryPictures" + case UserDirectoryPublicShare: + return "DirectoryPublicShare" + case UserDirectoryTemplates: + return "DirectoryTemplates" + case UserDirectoryVideos: + return "DirectoryVideos" + case UserNDirectories: + return "NDirectories" + default: + return fmt.Sprintf("UserDirectory(%d)", u) + } +} + +// VariantClass: range of possible top-level types of #GVariant instances. +type VariantClass C.gint + +const ( + // VariantClassBoolean is a boolean. + VariantClassBoolean VariantClass = 98 + // VariantClassByte is a byte. + VariantClassByte VariantClass = 121 + // VariantClassInt16 is a signed 16 bit integer. + VariantClassInt16 VariantClass = 110 + // VariantClassUint16 is an unsigned 16 bit integer. + VariantClassUint16 VariantClass = 113 + // VariantClassInt32 is a signed 32 bit integer. + VariantClassInt32 VariantClass = 105 + // VariantClassUint32 is an unsigned 32 bit integer. + VariantClassUint32 VariantClass = 117 + // VariantClassInt64 is a signed 64 bit integer. + VariantClassInt64 VariantClass = 120 + // VariantClassUint64 is an unsigned 64 bit integer. + VariantClassUint64 VariantClass = 116 + // VariantClassHandle is a file handle index. + VariantClassHandle VariantClass = 104 + // VariantClassDouble is a double precision floating point value. + VariantClassDouble VariantClass = 100 + // VariantClassString is a normal string. + VariantClassString VariantClass = 115 + // VariantClassObjectPath is a D-Bus object path string. + VariantClassObjectPath VariantClass = 111 + // VariantClassSignature is a D-Bus signature string. + VariantClassSignature VariantClass = 103 + // VariantClassVariant is a variant. + VariantClassVariant VariantClass = 118 + // VariantClassMaybe is a maybe-typed value. + VariantClassMaybe VariantClass = 109 + // VariantClassArray is an array. + VariantClassArray VariantClass = 97 + // VariantClassTuple is a tuple. + VariantClassTuple VariantClass = 40 + // VariantClassDictEntry is a dictionary entry. + VariantClassDictEntry VariantClass = 123 +) + +// String returns the name in string for VariantClass. +func (v VariantClass) String() string { + switch v { + case VariantClassBoolean: + return "Boolean" + case VariantClassByte: + return "Byte" + case VariantClassInt16: + return "Int16" + case VariantClassUint16: + return "Uint16" + case VariantClassInt32: + return "Int32" + case VariantClassUint32: + return "Uint32" + case VariantClassInt64: + return "Int64" + case VariantClassUint64: + return "Uint64" + case VariantClassHandle: + return "Handle" + case VariantClassDouble: + return "Double" + case VariantClassString: + return "String" + case VariantClassObjectPath: + return "ObjectPath" + case VariantClassSignature: + return "Signature" + case VariantClassVariant: + return "Variant" + case VariantClassMaybe: + return "Maybe" + case VariantClassArray: + return "Array" + case VariantClassTuple: + return "Tuple" + case VariantClassDictEntry: + return "DictEntry" + default: + return fmt.Sprintf("VariantClass(%d)", v) + } +} + +// VariantParseError: error codes returned by parsing text-format GVariants. +type VariantParseError C.gint + +const ( + // VariantParseErrorFailed: generic error (unused). + VariantParseErrorFailed VariantParseError = iota + // VariantParseErrorBasicTypeExpected: non-basic Type was given where a + // basic type was expected. + VariantParseErrorBasicTypeExpected + // VariantParseErrorCannotInferType: cannot infer the Type. + VariantParseErrorCannotInferType + // VariantParseErrorDefiniteTypeExpected: indefinite Type was given where a + // definite type was expected. + VariantParseErrorDefiniteTypeExpected + // VariantParseErrorInputNotAtEnd: extra data after parsing finished. + VariantParseErrorInputNotAtEnd + // VariantParseErrorInvalidCharacter: invalid character in number or unicode + // escape. + VariantParseErrorInvalidCharacter + // VariantParseErrorInvalidFormatString: not a valid #GVariant format + // string. + VariantParseErrorInvalidFormatString + // VariantParseErrorInvalidObjectPath: not a valid object path. + VariantParseErrorInvalidObjectPath + // VariantParseErrorInvalidSignature: not a valid type signature. + VariantParseErrorInvalidSignature + // VariantParseErrorInvalidTypeString: not a valid #GVariant type string. + VariantParseErrorInvalidTypeString + // VariantParseErrorNoCommonType: could not find a common type for array + // entries. + VariantParseErrorNoCommonType + // VariantParseErrorNumberOutOfRange: numerical value is out of range of the + // given type. + VariantParseErrorNumberOutOfRange + // VariantParseErrorNumberTooBig: numerical value is out of range for any + // type. + VariantParseErrorNumberTooBig + // VariantParseErrorTypeError: cannot parse as variant of the specified + // type. + VariantParseErrorTypeError + // VariantParseErrorUnexpectedToken: unexpected token was encountered. + VariantParseErrorUnexpectedToken + // VariantParseErrorUnknownKeyword: unknown keyword was encountered. + VariantParseErrorUnknownKeyword + // VariantParseErrorUnterminatedStringConstant: unterminated string + // constant. + VariantParseErrorUnterminatedStringConstant + // VariantParseErrorValueExpected: no value given. + VariantParseErrorValueExpected + // VariantParseErrorRecursion: variant was too deeply nested; #GVariant is + // only guaranteed to handle nesting up to 64 levels (Since: 2.64). + VariantParseErrorRecursion +) + +// String returns the name in string for VariantParseError. +func (v VariantParseError) String() string { + switch v { + case VariantParseErrorFailed: + return "Failed" + case VariantParseErrorBasicTypeExpected: + return "BasicTypeExpected" + case VariantParseErrorCannotInferType: + return "CannotInferType" + case VariantParseErrorDefiniteTypeExpected: + return "DefiniteTypeExpected" + case VariantParseErrorInputNotAtEnd: + return "InputNotAtEnd" + case VariantParseErrorInvalidCharacter: + return "InvalidCharacter" + case VariantParseErrorInvalidFormatString: + return "InvalidFormatString" + case VariantParseErrorInvalidObjectPath: + return "InvalidObjectPath" + case VariantParseErrorInvalidSignature: + return "InvalidSignature" + case VariantParseErrorInvalidTypeString: + return "InvalidTypeString" + case VariantParseErrorNoCommonType: + return "NoCommonType" + case VariantParseErrorNumberOutOfRange: + return "NumberOutOfRange" + case VariantParseErrorNumberTooBig: + return "NumberTooBig" + case VariantParseErrorTypeError: + return "TypeError" + case VariantParseErrorUnexpectedToken: + return "UnexpectedToken" + case VariantParseErrorUnknownKeyword: + return "UnknownKeyword" + case VariantParseErrorUnterminatedStringConstant: + return "UnterminatedStringConstant" + case VariantParseErrorValueExpected: + return "ValueExpected" + case VariantParseErrorRecursion: + return "Recursion" + default: + return fmt.Sprintf("VariantParseError(%d)", v) + } +} + +// FileSetContentsFlags flags to pass to g_file_set_contents_full() to affect +// its safety and performance. +type FileSetContentsFlags C.guint + +const ( + // FileSetContentsNone: no guarantees about file consistency or durability. + // The most dangerous setting, which is slightly faster than other settings. + FileSetContentsNone FileSetContentsFlags = 0b0 + // FileSetContentsConsistent: guarantee file consistency: after a crash, + // either the old version of the file or the new version of the file will be + // available, but not a mixture. On Unix systems this equates to an fsync() + // on the file and use of an atomic rename() of the new version of the file + // over the old. + FileSetContentsConsistent FileSetContentsFlags = 0b1 + // FileSetContentsDurable: guarantee file durability: after a crash, the + // new version of the file will be available. On Unix systems this equates + // to an fsync() on the file (if G_FILE_SET_CONTENTS_CONSISTENT is unset), + // or the effects of G_FILE_SET_CONTENTS_CONSISTENT plus an fsync() on the + // directory containing the file after calling rename(). + FileSetContentsDurable FileSetContentsFlags = 0b10 + // FileSetContentsOnlyExisting: only apply consistency and durability + // guarantees if the file already exists. This may speed up file operations + // if the file doesn’t currently exist, but may result in a corrupted + // version of the new file if the system crashes while writing it. + FileSetContentsOnlyExisting FileSetContentsFlags = 0b100 +) + +// String returns the names in string for FileSetContentsFlags. +func (f FileSetContentsFlags) String() string { + if f == 0 { + return "FileSetContentsFlags(0)" + } + + var builder strings.Builder + builder.Grow(96) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FileSetContentsNone: + builder.WriteString("None|") + case FileSetContentsConsistent: + builder.WriteString("Consistent|") + case FileSetContentsDurable: + builder.WriteString("Durable|") + case FileSetContentsOnlyExisting: + builder.WriteString("OnlyExisting|") + default: + builder.WriteString(fmt.Sprintf("FileSetContentsFlags(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FileSetContentsFlags) Has(other FileSetContentsFlags) bool { + return (f & other) == other +} + +// FileTest: test to perform on a file using g_file_test(). +type FileTest C.guint + +const ( + // FileTestIsRegular: TRUE if the file is a regular file (not a directory). + // Note that this test will also return TRUE if the tested file is a symlink + // to a regular file. + FileTestIsRegular FileTest = 0b1 + // FileTestIsSymlink: TRUE if the file is a symlink. + FileTestIsSymlink FileTest = 0b10 + // FileTestIsDir: TRUE if the file is a directory. + FileTestIsDir FileTest = 0b100 + // FileTestIsExecutable: TRUE if the file is executable. + FileTestIsExecutable FileTest = 0b1000 + // FileTestExists: TRUE if the file exists. It may or may not be a regular + // file. + FileTestExists FileTest = 0b10000 +) + +// String returns the names in string for FileTest. +func (f FileTest) String() string { + if f == 0 { + return "FileTest(0)" + } + + var builder strings.Builder + builder.Grow(85) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FileTestIsRegular: + builder.WriteString("IsRegular|") + case FileTestIsSymlink: + builder.WriteString("IsSymlink|") + case FileTestIsDir: + builder.WriteString("IsDir|") + case FileTestIsExecutable: + builder.WriteString("IsExecutable|") + case FileTestExists: + builder.WriteString("Exists|") + default: + builder.WriteString(fmt.Sprintf("FileTest(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FileTest) Has(other FileTest) bool { + return (f & other) == other +} + +// FormatSizeFlags flags to modify the format of the string returned by +// g_format_size_full(). +type FormatSizeFlags C.guint + +const ( + // FormatSizeDefault: behave the same as g_format_size(). + FormatSizeDefault FormatSizeFlags = 0b0 + // FormatSizeLongFormat: include the exact number of bytes as part of the + // returned string. For example, "45.6 kB (45,612 bytes)". + FormatSizeLongFormat FormatSizeFlags = 0b1 + // FormatSizeIecUnits: use IEC (base 1024) units with "KiB"-style suffixes. + // IEC units should only be used for reporting things with a strong "power + // of 2" basis, like RAM sizes or RAID stripe sizes. Network and storage + // sizes should be reported in the normal SI units. + FormatSizeIecUnits FormatSizeFlags = 0b10 + // FormatSizeBits: set the size as a quantity in bits, rather than bytes, + // and return units in bits. For example, ‘Mbit’ rather than ‘MB’. + FormatSizeBits FormatSizeFlags = 0b100 + // FormatSizeOnlyValue: return only value, without unit; this should not be + // used together with G_FORMAT_SIZE_LONG_FORMAT nor G_FORMAT_SIZE_ONLY_UNIT. + // Since: 2.74. + FormatSizeOnlyValue FormatSizeFlags = 0b1000 + // FormatSizeOnlyUnit: return only unit, without value; this + // should not be used together with G_FORMAT_SIZE_LONG_FORMAT nor + // G_FORMAT_SIZE_ONLY_VALUE. Since: 2.74. + FormatSizeOnlyUnit FormatSizeFlags = 0b10000 +) + +// String returns the names in string for FormatSizeFlags. +func (f FormatSizeFlags) String() string { + if f == 0 { + return "FormatSizeFlags(0)" + } + + var builder strings.Builder + builder.Grow(111) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FormatSizeDefault: + builder.WriteString("Default|") + case FormatSizeLongFormat: + builder.WriteString("LongFormat|") + case FormatSizeIecUnits: + builder.WriteString("IecUnits|") + case FormatSizeBits: + builder.WriteString("Bits|") + case FormatSizeOnlyValue: + builder.WriteString("OnlyValue|") + case FormatSizeOnlyUnit: + builder.WriteString("OnlyUnit|") + default: + builder.WriteString(fmt.Sprintf("FormatSizeFlags(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FormatSizeFlags) Has(other FormatSizeFlags) bool { + return (f & other) == other +} + +// IOCondition: bitwise combination representing a condition to watch for on an +// event source. +type IOCondition C.guint + +const ( + // IOIn: there is data to read. + IOIn IOCondition = 0b1 + // IOOut: data can be written (without blocking). + IOOut IOCondition = 0b100 + // IOPri: there is urgent data to read. + IOPri IOCondition = 0b10 + // IOErr: error condition. + IOErr IOCondition = 0b1000 + // IOHup: hung up (the connection has been broken, usually for pipes and + // sockets). + IOHup IOCondition = 0b10000 + // IONval: invalid request. The file descriptor is not open. + IONval IOCondition = 0b100000 +) + +func marshalIOCondition(p uintptr) (interface{}, error) { + return IOCondition(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for IOCondition. +func (i IOCondition) String() string { + if i == 0 { + return "IOCondition(0)" + } + + var builder strings.Builder + builder.Grow(35) + + for i != 0 { + next := i & (i - 1) + bit := i - next + + switch bit { + case IOIn: + builder.WriteString("In|") + case IOOut: + builder.WriteString("Out|") + case IOPri: + builder.WriteString("Pri|") + case IOErr: + builder.WriteString("Err|") + case IOHup: + builder.WriteString("Hup|") + case IONval: + builder.WriteString("Nval|") + default: + builder.WriteString(fmt.Sprintf("IOCondition(0b%b)|", bit)) + } + + i = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if i contains other. +func (i IOCondition) Has(other IOCondition) bool { + return (i & other) == other +} + +// IOFlags specifies properties of a OChannel. Some of the flags can +// only be read with g_io_channel_get_flags(), but not changed with +// g_io_channel_set_flags(). +type IOFlags C.guint + +const ( + // IOFlagNone: no special flags set. Since: 2.74. + IOFlagNone IOFlags = 0b0 + // IOFlagAppend turns on append mode, corresponds to O_APPEND (see the + // documentation of the UNIX open() syscall). + IOFlagAppend IOFlags = 0b1 + // IOFlagNonblock turns on nonblocking mode, corresponds to + // O_NONBLOCK/O_NDELAY (see the documentation of the UNIX open() syscall). + IOFlagNonblock IOFlags = 0b10 + // IOFlagIsReadable indicates that the io channel is readable. This flag + // cannot be changed. + IOFlagIsReadable IOFlags = 0b100 + // IOFlagIsWritable indicates that the io channel is writable. This flag + // cannot be changed. + IOFlagIsWritable IOFlags = 0b1000 + // IOFlagIsWriteable: misspelled version of G_IO_FLAG_IS_WRITABLE that + // existed before the spelling was fixed in GLib 2.30. It is kept here for + // compatibility reasons. Deprecated since 2.30. + IOFlagIsWriteable IOFlags = 0b1000 + // IOFlagIsSeekable indicates that the io channel is seekable, i.e. + // that g_io_channel_seek_position() can be used on it. This flag cannot be + // changed. + IOFlagIsSeekable IOFlags = 0b10000 + // IOFlagMask: mask that specifies all the valid flags. + IOFlagMask IOFlags = 0b11111 + // IOFlagGetMask: mask of the flags that are returned from + // g_io_channel_get_flags(). + IOFlagGetMask IOFlags = 0b11111 + // IOFlagSetMask: mask of the flags that the user can modify with + // g_io_channel_set_flags(). + IOFlagSetMask IOFlags = 0b11 +) + +// String returns the names in string for IOFlags. +func (i IOFlags) String() string { + if i == 0 { + return "IOFlags(0)" + } + + var builder strings.Builder + builder.Grow(146) + + for i != 0 { + next := i & (i - 1) + bit := i - next + + switch bit { + case IOFlagNone: + builder.WriteString("None|") + case IOFlagAppend: + builder.WriteString("Append|") + case IOFlagNonblock: + builder.WriteString("Nonblock|") + case IOFlagIsReadable: + builder.WriteString("IsReadable|") + case IOFlagIsWritable: + builder.WriteString("IsWritable|") + case IOFlagIsSeekable: + builder.WriteString("IsSeekable|") + case IOFlagMask: + builder.WriteString("Mask|") + case IOFlagSetMask: + builder.WriteString("SetMask|") + default: + builder.WriteString(fmt.Sprintf("IOFlags(0b%b)|", bit)) + } + + i = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if i contains other. +func (i IOFlags) Has(other IOFlags) bool { + return (i & other) == other +} + +// KeyFileFlags flags which influence the parsing. +type KeyFileFlags C.guint + +const ( + // KeyFileNone: no flags, default behaviour. + KeyFileNone KeyFileFlags = 0b0 + // KeyFileKeepComments: use this flag if you plan to write the (possibly + // modified) contents of the key file back to a file; otherwise all comments + // will be lost when the key file is written back. + KeyFileKeepComments KeyFileFlags = 0b1 + // KeyFileKeepTranslations: use this flag if you plan to write the (possibly + // modified) contents of the key file back to a file; otherwise only the + // translations for the current language will be written back. + KeyFileKeepTranslations KeyFileFlags = 0b10 +) + +// String returns the names in string for KeyFileFlags. +func (k KeyFileFlags) String() string { + if k == 0 { + return "KeyFileFlags(0)" + } + + var builder strings.Builder + builder.Grow(55) + + for k != 0 { + next := k & (k - 1) + bit := k - next + + switch bit { + case KeyFileNone: + builder.WriteString("None|") + case KeyFileKeepComments: + builder.WriteString("KeepComments|") + case KeyFileKeepTranslations: + builder.WriteString("KeepTranslations|") + default: + builder.WriteString(fmt.Sprintf("KeyFileFlags(0b%b)|", bit)) + } + + k = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if k contains other. +func (k KeyFileFlags) Has(other KeyFileFlags) bool { + return (k & other) == other +} + +// LogLevelFlags flags specifying the level of log messages. +// +// It is possible to change how GLib treats messages of the various levels using +// glib.LogSetHandler() and glib.LogSetFatalMask(). +type LogLevelFlags C.guint + +const ( + // LogFlagRecursion: internal flag. + LogFlagRecursion LogLevelFlags = 0b1 + // LogFlagFatal: internal flag. + LogFlagFatal LogLevelFlags = 0b10 + // LogLevelError: log level for errors, see glib.Error(). This level is also + // used for messages produced by glib.Assert(). + LogLevelError LogLevelFlags = 0b100 + // LogLevelCritical: log level for critical warning messages, + // see glib.Critical(). This level is also used for messages produced by + // glib.ReturnIfFail() and glib.ReturnValIfFail(). + LogLevelCritical LogLevelFlags = 0b1000 + // LogLevelWarning: log level for warnings, see glib.Warning(). + LogLevelWarning LogLevelFlags = 0b10000 + // LogLevelMessage: log level for messages, see glib.Message(). + LogLevelMessage LogLevelFlags = 0b100000 + // LogLevelInfo: log level for informational messages, see glib.Info(). + LogLevelInfo LogLevelFlags = 0b1000000 + // LogLevelDebug: log level for debug messages, see glib.Debug(). + LogLevelDebug LogLevelFlags = 0b10000000 +) + +// String returns the names in string for LogLevelFlags. +func (l LogLevelFlags) String() string { + if l == 0 { + return "LogLevelFlags(0)" + } + + var builder strings.Builder + builder.Grow(119) + + for l != 0 { + next := l & (l - 1) + bit := l - next + + switch bit { + case LogFlagRecursion: + builder.WriteString("FlagRecursion|") + case LogFlagFatal: + builder.WriteString("FlagFatal|") + case LogLevelError: + builder.WriteString("LevelError|") + case LogLevelCritical: + builder.WriteString("LevelCritical|") + case LogLevelWarning: + builder.WriteString("LevelWarning|") + case LogLevelMessage: + builder.WriteString("LevelMessage|") + case LogLevelInfo: + builder.WriteString("LevelInfo|") + case LogLevelDebug: + builder.WriteString("LevelDebug|") + default: + builder.WriteString(fmt.Sprintf("LogLevelFlags(0b%b)|", bit)) + } + + l = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if l contains other. +func (l LogLevelFlags) Has(other LogLevelFlags) bool { + return (l & other) == other +} + +// MainContextFlags flags to pass to g_main_context_new_with_flags() which +// affect the behaviour of a Context. +type MainContextFlags C.guint + +const ( + // MainContextFlagsNone: default behaviour. + MainContextFlagsNone MainContextFlags = 0b0 + // MainContextFlagsOwnerlessPolling: assume that polling for events will + // free the thread to process other jobs. That's useful if you're using + // g_main_context_{prepare,query,check,dispatch} to integrate GMainContext + // in other event loops. + MainContextFlagsOwnerlessPolling MainContextFlags = 0b1 +) + +// String returns the names in string for MainContextFlags. +func (m MainContextFlags) String() string { + if m == 0 { + return "MainContextFlags(0)" + } + + var builder strings.Builder + builder.Grow(53) + + for m != 0 { + next := m & (m - 1) + bit := m - next + + switch bit { + case MainContextFlagsNone: + builder.WriteString("None|") + case MainContextFlagsOwnerlessPolling: + builder.WriteString("OwnerlessPolling|") + default: + builder.WriteString(fmt.Sprintf("MainContextFlags(0b%b)|", bit)) + } + + m = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if m contains other. +func (m MainContextFlags) Has(other MainContextFlags) bool { + return (m & other) == other +} + +// MarkupCollectType: mixed enumerated type and flags field. You must specify +// one type (string, strdup, boolean, tristate). Additionally, you may +// optionally bitwise OR the type with the flag G_MARKUP_COLLECT_OPTIONAL. +// +// It is likely that this enum will be extended in the future to support other +// types. +type MarkupCollectType C.guint + +const ( + // MarkupCollectInvalid: used to terminate the list of attributes to + // collect. + MarkupCollectInvalid MarkupCollectType = 0b0 + // MarkupCollectString: collect the string pointer directly from the + // attribute_values[] array. Expects a parameter of type (const char **). + // If G_MARKUP_COLLECT_OPTIONAL is specified and the attribute isn't present + // then the pointer will be set to NULL. + MarkupCollectString MarkupCollectType = 0b1 + // MarkupCollectStrdup as with G_MARKUP_COLLECT_STRING, but expects a + // parameter of type (char **) and g_strdup()s the returned pointer. + // The pointer must be freed with g_free(). + MarkupCollectStrdup MarkupCollectType = 0b10 + // MarkupCollectBoolean expects a parameter of type (gboolean *) and parses + // the attribute value as a boolean. Sets FALSE if the attribute isn't + // present. Valid boolean values consist of (case-insensitive) "false", "f", + // "no", "n", "0" and "true", "t", "yes", "y", "1". + MarkupCollectBoolean MarkupCollectType = 0b11 + // MarkupCollectTristate as with G_MARKUP_COLLECT_BOOLEAN, but in the case + // of a missing attribute a value is set that compares equal to neither + // FALSE nor TRUE G_MARKUP_COLLECT_OPTIONAL is implied. + MarkupCollectTristate MarkupCollectType = 0b100 + // MarkupCollectOptional: can be bitwise ORed with the other fields. + // If present, allows the attribute not to appear. A default value is set + // depending on what value type is used. + MarkupCollectOptional MarkupCollectType = 0b10000000000000000 +) + +// String returns the names in string for MarkupCollectType. +func (m MarkupCollectType) String() string { + if m == 0 { + return "MarkupCollectType(0)" + } + + var builder strings.Builder + builder.Grow(125) + + for m != 0 { + next := m & (m - 1) + bit := m - next + + switch bit { + case MarkupCollectInvalid: + builder.WriteString("Invalid|") + case MarkupCollectString: + builder.WriteString("String|") + case MarkupCollectStrdup: + builder.WriteString("Strdup|") + case MarkupCollectBoolean: + builder.WriteString("Boolean|") + case MarkupCollectTristate: + builder.WriteString("Tristate|") + case MarkupCollectOptional: + builder.WriteString("Optional|") + default: + builder.WriteString(fmt.Sprintf("MarkupCollectType(0b%b)|", bit)) + } + + m = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if m contains other. +func (m MarkupCollectType) Has(other MarkupCollectType) bool { + return (m & other) == other +} + +// MarkupParseFlags flags that affect the behaviour of the parser. +type MarkupParseFlags C.guint + +const ( + // MarkupDefaultFlags: no special behaviour. Since: 2.74. + MarkupDefaultFlags MarkupParseFlags = 0b0 + // MarkupDoNotUseThisUnsupportedFlag: flag you should not use. + MarkupDoNotUseThisUnsupportedFlag MarkupParseFlags = 0b1 + // MarkupTreatCdataAsText: when this flag is set, CDATA marked sections are + // not passed literally to the passthrough function of the parser. Instead, + // the content of the section (without the ) is passed to + // the text function. This flag was added in GLib 2.12. + MarkupTreatCdataAsText MarkupParseFlags = 0b10 + // MarkupPrefixErrorPosition: normally errors caught by GMarkup itself + // have line/column information prefixed to them to let the caller know the + // location of the error. When this flag is set the location information is + // also prefixed to errors generated by the Parser implementation functions. + MarkupPrefixErrorPosition MarkupParseFlags = 0b100 + // MarkupIgnoreQualified: ignore (don't report) qualified attributes and + // tags, along with their contents. A qualified attribute or tag is one that + // contains ':' in its name (ie: is in another namespace). Since: 2.40. + MarkupIgnoreQualified MarkupParseFlags = 0b1000 +) + +// String returns the names in string for MarkupParseFlags. +func (m MarkupParseFlags) String() string { + if m == 0 { + return "MarkupParseFlags(0)" + } + + var builder strings.Builder + builder.Grow(123) + + for m != 0 { + next := m & (m - 1) + bit := m - next + + switch bit { + case MarkupDefaultFlags: + builder.WriteString("DefaultFlags|") + case MarkupDoNotUseThisUnsupportedFlag: + builder.WriteString("DoNotUseThisUnsupportedFlag|") + case MarkupTreatCdataAsText: + builder.WriteString("TreatCdataAsText|") + case MarkupPrefixErrorPosition: + builder.WriteString("PrefixErrorPosition|") + case MarkupIgnoreQualified: + builder.WriteString("IgnoreQualified|") + default: + builder.WriteString(fmt.Sprintf("MarkupParseFlags(0b%b)|", bit)) + } + + m = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if m contains other. +func (m MarkupParseFlags) Has(other MarkupParseFlags) bool { + return (m & other) == other +} + +// OptionFlags flags which modify individual options. +type OptionFlags C.guint + +const ( + // OptionFlagNone: no flags. Since: 2.42. + OptionFlagNone OptionFlags = 0b0 + // OptionFlagHidden: option doesn't appear in --help output. + OptionFlagHidden OptionFlags = 0b1 + // OptionFlagInMain: option appears in the main section of the --help + // output, even if it is defined in a group. + OptionFlagInMain OptionFlags = 0b10 + // OptionFlagReverse: for options of the G_OPTION_ARG_NONE kind, this flag + // indicates that the sense of the option is reversed. i.e. FALSE will be + // stored into the argument rather than TRUE. + OptionFlagReverse OptionFlags = 0b100 + // OptionFlagNoArg: for options of the G_OPTION_ARG_CALLBACK kind, + // this flag indicates that the callback does not take any argument (like a + // G_OPTION_ARG_NONE option). Since 2.8. + OptionFlagNoArg OptionFlags = 0b1000 + // OptionFlagFilename: for options of the G_OPTION_ARG_CALLBACK kind, + // this flag indicates that the argument should be passed to the callback in + // the GLib filename encoding rather than UTF-8. Since 2.8. + OptionFlagFilename OptionFlags = 0b10000 + // OptionFlagOptionalArg: for options of the G_OPTION_ARG_CALLBACK kind, + // this flag indicates that the argument supply is optional. If no argument + // is given then data of GOptionParseFunc will be set to NULL. Since 2.8. + OptionFlagOptionalArg OptionFlags = 0b100000 + // OptionFlagNoalias: this flag turns off the automatic conflict resolution + // which prefixes long option names with groupname- if there is a conflict. + // This option should only be used in situations where aliasing is necessary + // to model some legacy commandline interface. It is not safe to use + // this option, unless all option groups are under your direct control. + // Since 2.8. + OptionFlagNoalias OptionFlags = 0b1000000 +) + +// String returns the names in string for OptionFlags. +func (o OptionFlags) String() string { + if o == 0 { + return "OptionFlags(0)" + } + + var builder strings.Builder + builder.Grow(141) + + for o != 0 { + next := o & (o - 1) + bit := o - next + + switch bit { + case OptionFlagNone: + builder.WriteString("None|") + case OptionFlagHidden: + builder.WriteString("Hidden|") + case OptionFlagInMain: + builder.WriteString("InMain|") + case OptionFlagReverse: + builder.WriteString("Reverse|") + case OptionFlagNoArg: + builder.WriteString("NoArg|") + case OptionFlagFilename: + builder.WriteString("Filename|") + case OptionFlagOptionalArg: + builder.WriteString("OptionalArg|") + case OptionFlagNoalias: + builder.WriteString("Noalias|") + default: + builder.WriteString(fmt.Sprintf("OptionFlags(0b%b)|", bit)) + } + + o = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if o contains other. +func (o OptionFlags) Has(other OptionFlags) bool { + return (o & other) == other +} + +// RegexCompileFlags flags specifying compile-time options. +type RegexCompileFlags C.guint + +const ( + // RegexDefault: no special options set. Since: 2.74. + RegexDefault RegexCompileFlags = 0b0 + // RegexCaseless letters in the pattern match both upper- and lowercase + // letters. This option can be changed within a pattern by a "(?i)" option + // setting. + RegexCaseless RegexCompileFlags = 0b1 + // RegexMultiline: by default, GRegex treats the strings as consisting of + // a single line of characters (even if it actually contains newlines). + // The "start of line" metacharacter ("^") matches only at the start of + // the string, while the "end of line" metacharacter ("$") matches only + // at the end of the string, or before a terminating newline (unless + // G_REGEX_DOLLAR_ENDONLY is set). When G_REGEX_MULTILINE is set, the "start + // of line" and "end of line" constructs match immediately following or + // immediately before any newline in the string, respectively, as well as at + // the very start and end. This can be changed within a pattern by a "(?m)" + // option setting. + RegexMultiline RegexCompileFlags = 0b10 + // RegexDotall: dot metacharacter (".") in the pattern matches all + // characters, including newlines. Without it, newlines are excluded. + // This option can be changed within a pattern by a ("?s") option setting. + RegexDotall RegexCompileFlags = 0b100 + // RegexExtended: whitespace data characters in the pattern are totally + // ignored except when escaped or inside a character class. Whitespace + // does not include the VT character (code 11). In addition, characters + // between an unescaped "#" outside a character class and the next newline + // character, inclusive, are also ignored. This can be changed within a + // pattern by a "(?x)" option setting. + RegexExtended RegexCompileFlags = 0b1000 + // RegexAnchored: pattern is forced to be "anchored", that is, it is + // constrained to match only at the first matching point in the string + // that is being searched. This effect can also be achieved by appropriate + // constructs in the pattern itself such as the "^" metacharacter. + RegexAnchored RegexCompileFlags = 0b10000 + // RegexDollarEndonly: dollar metacharacter ("$") in the pattern matches + // only at the end of the string. Without this option, a dollar also matches + // immediately before the final character if it is a newline (but not before + // any other newlines). This option is ignored if G_REGEX_MULTILINE is set. + RegexDollarEndonly RegexCompileFlags = 0b100000 + // RegexUngreedy inverts the "greediness" of the quantifiers so that they + // are not greedy by default, but become greedy if followed by "?". It can + // also be set by a "(?U)" option setting within the pattern. + RegexUngreedy RegexCompileFlags = 0b1000000000 + // RegexRaw: usually strings must be valid UTF-8 strings, using this flag + // they are considered as a raw sequence of bytes. + RegexRaw RegexCompileFlags = 0b100000000000 + // RegexNoAutoCapture disables the use of numbered capturing parentheses in + // the pattern. Any opening parenthesis that is not followed by "?" behaves + // as if it were followed by "?:" but named parentheses can still be used + // for capturing (and they acquire numbers in the usual way). + RegexNoAutoCapture RegexCompileFlags = 0b1000000000000 + // RegexOptimize: since 2.74 and the port to pcre2, requests JIT + // compilation, which, if the just-in-time compiler is available, further + // processes a compiled pattern into machine code that executes much faster. + // However, it comes at the cost of extra processing before the match is + // performed, so it is most beneficial to use this when the same compiled + // pattern is used for matching many times. Before 2.74 this option used the + // built-in non-JIT optimizations in pcre1. + RegexOptimize RegexCompileFlags = 0b10000000000000 + // RegexFirstline limits an unanchored pattern to match before (or at) the + // first newline. Since: 2.34. + RegexFirstline RegexCompileFlags = 0b1000000000000000000 + // RegexDupnames names used to identify capturing subpatterns need not be + // unique. This can be helpful for certain types of pattern when it is known + // that only one instance of the named subpattern can ever be matched. + RegexDupnames RegexCompileFlags = 0b10000000000000000000 + // RegexNewlineCr: usually any newline character or character sequence is + // recognized. If this option is set, the only recognized newline character + // is '\r'. + RegexNewlineCr RegexCompileFlags = 0b100000000000000000000 + // RegexNewlineLf: usually any newline character or character sequence is + // recognized. If this option is set, the only recognized newline character + // is '\n'. + RegexNewlineLf RegexCompileFlags = 0b1000000000000000000000 + // RegexNewlineCrlf: usually any newline character or character sequence is + // recognized. If this option is set, the only recognized newline character + // sequence is '\r\n'. + RegexNewlineCrlf RegexCompileFlags = 0b1100000000000000000000 + // RegexNewlineAnycrlf: usually any newline character or character sequence + // is recognized. If this option is set, the only recognized newline + // character sequences are '\r', '\n', and '\r\n'. Since: 2.34. + RegexNewlineAnycrlf RegexCompileFlags = 0b10100000000000000000000 + // RegexBsrAnycrlf: usually any newline character or character sequence is + // recognised. If this option is set, then "\R" only recognizes the newline + // characters '\r', '\n' and '\r\n'. Since: 2.34. + RegexBsrAnycrlf RegexCompileFlags = 0b100000000000000000000000 + // RegexJavascriptCompat changes behaviour so that it is compatible with + // JavaScript rather than PCRE. Since GLib 2.74 this is no longer supported, + // as libpcre2 does not support it. Since: 2.34 Deprecated: 2.74. + RegexJavascriptCompat RegexCompileFlags = 0b10000000000000000000000000 +) + +// String returns the names in string for RegexCompileFlags. +func (r RegexCompileFlags) String() string { + if r == 0 { + return "RegexCompileFlags(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for r != 0 { + next := r & (r - 1) + bit := r - next + + switch bit { + case RegexDefault: + builder.WriteString("Default|") + case RegexCaseless: + builder.WriteString("Caseless|") + case RegexMultiline: + builder.WriteString("Multiline|") + case RegexDotall: + builder.WriteString("Dotall|") + case RegexExtended: + builder.WriteString("Extended|") + case RegexAnchored: + builder.WriteString("Anchored|") + case RegexDollarEndonly: + builder.WriteString("DollarEndonly|") + case RegexUngreedy: + builder.WriteString("Ungreedy|") + case RegexRaw: + builder.WriteString("Raw|") + case RegexNoAutoCapture: + builder.WriteString("NoAutoCapture|") + case RegexOptimize: + builder.WriteString("Optimize|") + case RegexFirstline: + builder.WriteString("Firstline|") + case RegexDupnames: + builder.WriteString("Dupnames|") + case RegexNewlineCr: + builder.WriteString("NewlineCr|") + case RegexNewlineLf: + builder.WriteString("NewlineLf|") + case RegexNewlineCrlf: + builder.WriteString("NewlineCrlf|") + case RegexNewlineAnycrlf: + builder.WriteString("NewlineAnycrlf|") + case RegexBsrAnycrlf: + builder.WriteString("BsrAnycrlf|") + case RegexJavascriptCompat: + builder.WriteString("JavascriptCompat|") + default: + builder.WriteString(fmt.Sprintf("RegexCompileFlags(0b%b)|", bit)) + } + + r = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if r contains other. +func (r RegexCompileFlags) Has(other RegexCompileFlags) bool { + return (r & other) == other +} + +// RegexMatchFlags flags specifying match-time options. +type RegexMatchFlags C.guint + +const ( + // RegexMatchDefault: no special options set. Since: 2.74. + RegexMatchDefault RegexMatchFlags = 0b0 + // RegexMatchAnchored: pattern is forced to be "anchored", that is, + // it is constrained to match only at the first matching point in the string + // that is being searched. This effect can also be achieved by appropriate + // constructs in the pattern itself such as the "^" metacharacter. + RegexMatchAnchored RegexMatchFlags = 0b10000 + // RegexMatchNotbol specifies that first character of the string is not the + // beginning of a line, so the circumflex metacharacter should not match + // before it. Setting this without G_REGEX_MULTILINE (at compile time) + // causes circumflex never to match. This option affects only the behaviour + // of the circumflex metacharacter, it does not affect "\A". + RegexMatchNotbol RegexMatchFlags = 0b10000000 + // RegexMatchNoteol specifies that the end of the subject string is not + // the end of a line, so the dollar metacharacter should not match it nor + // (except in multiline mode) a newline immediately before it. Setting this + // without G_REGEX_MULTILINE (at compile time) causes dollar never to match. + // This option affects only the behaviour of the dollar metacharacter, + // it does not affect "\Z" or "\z". + RegexMatchNoteol RegexMatchFlags = 0b100000000 + // RegexMatchNotempty: empty string is not considered to be a valid match + // if this option is set. If there are alternatives in the pattern, + // they are tried. If all the alternatives match the empty string, + // the entire match fails. For example, if the pattern "a?b?" is applied to + // a string not beginning with "a" or "b", it matches the empty string at + // the start of the string. With this flag set, this match is not valid, + // so GRegex searches further into the string for occurrences of "a" or "b". + RegexMatchNotempty RegexMatchFlags = 0b10000000000 + // RegexMatchPartial turns on the partial matching feature, for more + // documentation on partial matching see g_match_info_is_partial_match(). + RegexMatchPartial RegexMatchFlags = 0b1000000000000000 + // RegexMatchNewlineCr overrides the newline definition set when creating a + // new #GRegex, setting the '\r' character as line terminator. + RegexMatchNewlineCr RegexMatchFlags = 0b100000000000000000000 + // RegexMatchNewlineLf overrides the newline definition set when creating a + // new #GRegex, setting the '\n' character as line terminator. + RegexMatchNewlineLf RegexMatchFlags = 0b1000000000000000000000 + // RegexMatchNewlineCrlf overrides the newline definition set when creating + // a new #GRegex, setting the '\r\n' characters sequence as line terminator. + RegexMatchNewlineCrlf RegexMatchFlags = 0b1100000000000000000000 + // RegexMatchNewlineAny overrides the newline definition set when creating + // a new #GRegex, any Unicode newline sequence is recognised as a newline. + // These are '\r', '\n' and '\rn', and the single characters U+000B LINE + // TABULATION, U+000C FORM FEED (FF), U+0085 NEXT LINE (NEL), U+2028 LINE + // SEPARATOR and U+2029 PARAGRAPH SEPARATOR. + RegexMatchNewlineAny RegexMatchFlags = 0b10000000000000000000000 + // RegexMatchNewlineAnycrlf overrides the newline definition set when + // creating a new #GRegex; any '\r', '\n', or '\r\n' character sequence is + // recognized as a newline. Since: 2.34. + RegexMatchNewlineAnycrlf RegexMatchFlags = 0b10100000000000000000000 + // RegexMatchBsrAnycrlf overrides the newline definition for "\R" set when + // creating a new #GRegex; only '\r', '\n', or '\r\n' character sequences + // are recognized as a newline by "\R". Since: 2.34. + RegexMatchBsrAnycrlf RegexMatchFlags = 0b100000000000000000000000 + // RegexMatchBsrAny overrides the newline definition for "\R" set when + // creating a new #GRegex; any Unicode newline character or character + // sequence are recognized as a newline by "\R". These are '\r', '\n' and + // '\rn', and the single characters U+000B LINE TABULATION, U+000C FORM FEED + // (FF), U+0085 NEXT LINE (NEL), U+2028 LINE SEPARATOR and U+2029 PARAGRAPH + // SEPARATOR. Since: 2.34. + RegexMatchBsrAny RegexMatchFlags = 0b1000000000000000000000000 + // RegexMatchPartialSoft alias for G_REGEX_MATCH_PARTIAL. Since: 2.34. + RegexMatchPartialSoft RegexMatchFlags = 0b1000000000000000 + // RegexMatchPartialHard turns on the partial matching feature. In contrast + // to to G_REGEX_MATCH_PARTIAL_SOFT, this stops matching as soon as a + // partial match is found, without continuing to search for a possible + // complete match. See g_match_info_is_partial_match() for more information. + // Since: 2.34. + RegexMatchPartialHard RegexMatchFlags = 0b1000000000000000000000000000 + // RegexMatchNotemptyAtstart: like G_REGEX_MATCH_NOTEMPTY, but only applied + // to the start of the matched string. For anchored patterns this can only + // happen for pattern containing "\K". Since: 2.34. + RegexMatchNotemptyAtstart RegexMatchFlags = 0b10000000000000000000000000000 +) + +// String returns the names in string for RegexMatchFlags. +func (r RegexMatchFlags) String() string { + if r == 0 { + return "RegexMatchFlags(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for r != 0 { + next := r & (r - 1) + bit := r - next + + switch bit { + case RegexMatchDefault: + builder.WriteString("Default|") + case RegexMatchAnchored: + builder.WriteString("Anchored|") + case RegexMatchNotbol: + builder.WriteString("Notbol|") + case RegexMatchNoteol: + builder.WriteString("Noteol|") + case RegexMatchNotempty: + builder.WriteString("Notempty|") + case RegexMatchPartial: + builder.WriteString("Partial|") + case RegexMatchNewlineCr: + builder.WriteString("NewlineCr|") + case RegexMatchNewlineLf: + builder.WriteString("NewlineLf|") + case RegexMatchNewlineCrlf: + builder.WriteString("NewlineCrlf|") + case RegexMatchNewlineAny: + builder.WriteString("NewlineAny|") + case RegexMatchNewlineAnycrlf: + builder.WriteString("NewlineAnycrlf|") + case RegexMatchBsrAnycrlf: + builder.WriteString("BsrAnycrlf|") + case RegexMatchBsrAny: + builder.WriteString("BsrAny|") + case RegexMatchPartialHard: + builder.WriteString("PartialHard|") + case RegexMatchNotemptyAtstart: + builder.WriteString("NotemptyAtstart|") + default: + builder.WriteString(fmt.Sprintf("RegexMatchFlags(0b%b)|", bit)) + } + + r = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if r contains other. +func (r RegexMatchFlags) Has(other RegexMatchFlags) bool { + return (r & other) == other +} + +// SpawnFlags flags passed to g_spawn_sync(), g_spawn_async() and +// g_spawn_async_with_pipes(). +type SpawnFlags C.guint + +const ( + // SpawnDefault: no flags, default behaviour. + SpawnDefault SpawnFlags = 0b0 + // SpawnLeaveDescriptorsOpen parent's open file descriptors will be + // inherited by the child; otherwise all descriptors except stdin, stdout + // and stderr will be closed before calling exec() in the child. + SpawnLeaveDescriptorsOpen SpawnFlags = 0b1 + // SpawnDoNotReapChild: child will not be automatically reaped; you must + // use g_child_watch_add() yourself (or call waitpid() or handle SIGCHLD + // yourself), or the child will become a zombie. + SpawnDoNotReapChild SpawnFlags = 0b10 + // SpawnSearchPath: argv[0] need not be an absolute path, it will be looked + // for in the user's PATH. + SpawnSearchPath SpawnFlags = 0b100 + // SpawnStdoutToDevNull child's standard output will be discarded, instead + // of going to the same location as the parent's standard output. + SpawnStdoutToDevNull SpawnFlags = 0b1000 + // SpawnStderrToDevNull child's standard error will be discarded. + SpawnStderrToDevNull SpawnFlags = 0b10000 + // SpawnChildInheritsStdin: child will inherit the parent's standard input + // (by default, the child's standard input is attached to /dev/null). + SpawnChildInheritsStdin SpawnFlags = 0b100000 + // SpawnFileAndArgvZero: first element of argv is the file to execute, + // while the remaining elements are the actual argument vector to pass to + // the file. Normally g_spawn_async_with_pipes() uses argv[0] as the file to + // execute, and passes all of argv to the child. + SpawnFileAndArgvZero SpawnFlags = 0b1000000 + // SpawnSearchPathFromEnvp: if argv[0] is not an absolute path, it will be + // looked for in the PATH from the passed child environment. Since: 2.34. + SpawnSearchPathFromEnvp SpawnFlags = 0b10000000 + // SpawnCloexecPipes: create all pipes with the O_CLOEXEC flag set. Since: + // 2.40. + SpawnCloexecPipes SpawnFlags = 0b100000000 + // SpawnChildInheritsStdout: child will inherit the parent's standard + // output. + SpawnChildInheritsStdout SpawnFlags = 0b1000000000 + // SpawnChildInheritsStderr: child will inherit the parent's standard error. + SpawnChildInheritsStderr SpawnFlags = 0b10000000000 + // SpawnStdinFromDevNull child's standard input is attached to /dev/null. + SpawnStdinFromDevNull SpawnFlags = 0b100000000000 +) + +// String returns the names in string for SpawnFlags. +func (s SpawnFlags) String() string { + if s == 0 { + return "SpawnFlags(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for s != 0 { + next := s & (s - 1) + bit := s - next + + switch bit { + case SpawnDefault: + builder.WriteString("Default|") + case SpawnLeaveDescriptorsOpen: + builder.WriteString("LeaveDescriptorsOpen|") + case SpawnDoNotReapChild: + builder.WriteString("DoNotReapChild|") + case SpawnSearchPath: + builder.WriteString("SearchPath|") + case SpawnStdoutToDevNull: + builder.WriteString("StdoutToDevNull|") + case SpawnStderrToDevNull: + builder.WriteString("StderrToDevNull|") + case SpawnChildInheritsStdin: + builder.WriteString("ChildInheritsStdin|") + case SpawnFileAndArgvZero: + builder.WriteString("FileAndArgvZero|") + case SpawnSearchPathFromEnvp: + builder.WriteString("SearchPathFromEnvp|") + case SpawnCloexecPipes: + builder.WriteString("CloexecPipes|") + case SpawnChildInheritsStdout: + builder.WriteString("ChildInheritsStdout|") + case SpawnChildInheritsStderr: + builder.WriteString("ChildInheritsStderr|") + case SpawnStdinFromDevNull: + builder.WriteString("StdinFromDevNull|") + default: + builder.WriteString(fmt.Sprintf("SpawnFlags(0b%b)|", bit)) + } + + s = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if s contains other. +func (s SpawnFlags) Has(other SpawnFlags) bool { + return (s & other) == other +} + +// TraverseFlags specifies which nodes are visited during several of the tree +// functions, including g_node_traverse() and g_node_find(). +type TraverseFlags C.guint + +const ( + // TraverseLeaves: only leaf nodes should be visited. This name has been + // introduced in 2.6, for older version use G_TRAVERSE_LEAFS. + TraverseLeaves TraverseFlags = 0b1 + // TraverseNonLeaves: only non-leaf nodes should be visited. This name has + // been introduced in 2.6, for older version use G_TRAVERSE_NON_LEAFS. + TraverseNonLeaves TraverseFlags = 0b10 + // TraverseAll: all nodes should be visited. + TraverseAll TraverseFlags = 0b11 + // TraverseMask: mask of all traverse flags. + TraverseMask TraverseFlags = 0b11 + // TraverseLeafs: identical to G_TRAVERSE_LEAVES. + TraverseLeafs TraverseFlags = 0b1 + // TraverseNonLeafs: identical to G_TRAVERSE_NON_LEAVES. + TraverseNonLeafs TraverseFlags = 0b10 +) + +// String returns the names in string for TraverseFlags. +func (t TraverseFlags) String() string { + if t == 0 { + return "TraverseFlags(0)" + } + + var builder strings.Builder + builder.Grow(88) + + for t != 0 { + next := t & (t - 1) + bit := t - next + + switch bit { + case TraverseLeaves: + builder.WriteString("Leaves|") + case TraverseNonLeaves: + builder.WriteString("NonLeaves|") + case TraverseAll: + builder.WriteString("All|") + default: + builder.WriteString(fmt.Sprintf("TraverseFlags(0b%b)|", bit)) + } + + t = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if t contains other. +func (t TraverseFlags) Has(other TraverseFlags) bool { + return (t & other) == other +} + +// URIFlags flags that describe a URI. +// +// When parsing a URI, if you need to choose different flags based on the type +// of URI, you can use g_uri_peek_scheme() on the URI string to check the scheme +// first, and use that to decide what flags to parse it with. +type URIFlags C.guint + +const ( + // URIFlagsNone: no flags set. + URIFlagsNone URIFlags = 0b0 + // URIFlagsParseRelaxed: parse the URI more relaxedly than the RFC 3986 + // (https://tools.ietf.org/html/rfc3986) grammar specifies, fixing up or + // ignoring common mistakes in URIs coming from external sources. This is + // also needed for some obscure URI schemes where ; separates the host from + // the path. Don’t use this flag unless you need to. + URIFlagsParseRelaxed URIFlags = 0b1 + // URIFlagsHasPassword: userinfo field may contain a password, which will be + // separated from the username by :. + URIFlagsHasPassword URIFlags = 0b10 + // URIFlagsHasAuthParams: userinfo may contain additional + // authentication-related parameters, which will be separated from the + // username and/or password by ;. + URIFlagsHasAuthParams URIFlags = 0b100 + // URIFlagsEncoded: when parsing a URI, this indicates that %-encoded + // characters in the userinfo, path, query, and fragment fields should not + // be decoded. (And likewise the host field if G_URI_FLAGS_NON_DNS is also + // set.) When building a URI, it indicates that you have already %-encoded + // the components, and so #GUri should not do any encoding itself. + URIFlagsEncoded URIFlags = 0b1000 + // URIFlagsNonDns: host component should not be assumed to be a DNS hostname + // or IP address (for example, for smb URIs with NetBIOS hostnames). + URIFlagsNonDns URIFlags = 0b10000 + // URIFlagsEncodedQuery: same as G_URI_FLAGS_ENCODED, for the query field + // only. + URIFlagsEncodedQuery URIFlags = 0b100000 + // URIFlagsEncodedPath: same as G_URI_FLAGS_ENCODED, for the path only. + URIFlagsEncodedPath URIFlags = 0b1000000 + // URIFlagsEncodedFragment: same as G_URI_FLAGS_ENCODED, for the fragment + // only. + URIFlagsEncodedFragment URIFlags = 0b10000000 + // URIFlagsSchemeNormalize: scheme-based normalization will be applied. + // For example, when parsing an HTTP URI changing omitted path to / and + // omitted port to 80; and when building a URI, changing empty path to / and + // default port 80). This only supports a subset of known schemes. (Since: + // 2.68). + URIFlagsSchemeNormalize URIFlags = 0b100000000 +) + +// String returns the names in string for URIFlags. +func (u URIFlags) String() string { + if u == 0 { + return "URIFlags(0)" + } + + var builder strings.Builder + builder.Grow(195) + + for u != 0 { + next := u & (u - 1) + bit := u - next + + switch bit { + case URIFlagsNone: + builder.WriteString("None|") + case URIFlagsParseRelaxed: + builder.WriteString("ParseRelaxed|") + case URIFlagsHasPassword: + builder.WriteString("HasPassword|") + case URIFlagsHasAuthParams: + builder.WriteString("HasAuthParams|") + case URIFlagsEncoded: + builder.WriteString("Encoded|") + case URIFlagsNonDns: + builder.WriteString("NonDns|") + case URIFlagsEncodedQuery: + builder.WriteString("EncodedQuery|") + case URIFlagsEncodedPath: + builder.WriteString("EncodedPath|") + case URIFlagsEncodedFragment: + builder.WriteString("EncodedFragment|") + case URIFlagsSchemeNormalize: + builder.WriteString("SchemeNormalize|") + default: + builder.WriteString(fmt.Sprintf("URIFlags(0b%b)|", bit)) + } + + u = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if u contains other. +func (u URIFlags) Has(other URIFlags) bool { + return (u & other) == other +} + +// URIHideFlags flags describing what parts of the URI to hide in +// g_uri_to_string_partial(). Note that G_URI_HIDE_PASSWORD and +// G_URI_HIDE_AUTH_PARAMS will only work if the #GUri was parsed with the +// corresponding flags. +type URIHideFlags C.guint + +const ( + // URIHideNone: no flags set. + URIHideNone URIHideFlags = 0b0 + // URIHideUserinfo: hide the userinfo. + URIHideUserinfo URIHideFlags = 0b1 + // URIHidePassword: hide the password. + URIHidePassword URIHideFlags = 0b10 + // URIHideAuthParams: hide the auth_params. + URIHideAuthParams URIHideFlags = 0b100 + // URIHideQuery: hide the query. + URIHideQuery URIHideFlags = 0b1000 + // URIHideFragment: hide the fragment. + URIHideFragment URIHideFlags = 0b10000 +) + +// String returns the names in string for URIHideFlags. +func (u URIHideFlags) String() string { + if u == 0 { + return "URIHideFlags(0)" + } + + var builder strings.Builder + builder.Grow(90) + + for u != 0 { + next := u & (u - 1) + bit := u - next + + switch bit { + case URIHideNone: + builder.WriteString("None|") + case URIHideUserinfo: + builder.WriteString("Userinfo|") + case URIHidePassword: + builder.WriteString("Password|") + case URIHideAuthParams: + builder.WriteString("AuthParams|") + case URIHideQuery: + builder.WriteString("Query|") + case URIHideFragment: + builder.WriteString("Fragment|") + default: + builder.WriteString(fmt.Sprintf("URIHideFlags(0b%b)|", bit)) + } + + u = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if u contains other. +func (u URIHideFlags) Has(other URIHideFlags) bool { + return (u & other) == other +} + +// URIParamsFlags flags modifying the way parameters are handled by +// g_uri_parse_params() and ParamsIter. +type URIParamsFlags C.guint + +const ( + // URIParamsNone: no flags set. + URIParamsNone URIParamsFlags = 0b0 + // URIParamsCaseInsensitive: parameter names are case insensitive. + URIParamsCaseInsensitive URIParamsFlags = 0b1 + // URIParamsWwwForm: replace + with space character. Only useful for URLs on + // the web, using the https or http schemas. + URIParamsWwwForm URIParamsFlags = 0b10 + // URIParamsParseRelaxed: see G_URI_FLAGS_PARSE_RELAXED. + URIParamsParseRelaxed URIParamsFlags = 0b100 +) + +// String returns the names in string for URIParamsFlags. +func (u URIParamsFlags) String() string { + if u == 0 { + return "URIParamsFlags(0)" + } + + var builder strings.Builder + builder.Grow(77) + + for u != 0 { + next := u & (u - 1) + bit := u - next + + switch bit { + case URIParamsNone: + builder.WriteString("None|") + case URIParamsCaseInsensitive: + builder.WriteString("CaseInsensitive|") + case URIParamsWwwForm: + builder.WriteString("WwwForm|") + case URIParamsParseRelaxed: + builder.WriteString("ParseRelaxed|") + default: + builder.WriteString(fmt.Sprintf("URIParamsFlags(0b%b)|", bit)) + } + + u = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if u contains other. +func (u URIParamsFlags) Has(other URIParamsFlags) bool { + return (u & other) == other +} + +// CompareDataFunc specifies the type of a comparison function used to compare +// two values. The function should return a negative integer if the first value +// comes before the second, 0 if they are equal, or a positive integer if the +// first value comes after the second. +type CompareDataFunc func(a, b unsafe.Pointer) (gint int) + +// EqualFuncFull specifies the type of a function used to test two values for +// equality. The function should return TRUE if both values are equal and FALSE +// otherwise. +// +// This is a version of Func which provides a user_data closure from the caller. +type EqualFuncFull func(a, b unsafe.Pointer) (ok bool) + +// Func specifies the type of functions passed to g_list_foreach() and +// g_slist_foreach(). +type Func func(data unsafe.Pointer) + +// HFunc specifies the type of the function passed to g_hash_table_foreach(). +// It is called with each key/value pair, together with the user_data parameter +// which is passed to g_hash_table_foreach(). +type HFunc func(key, value unsafe.Pointer) + +// HRFunc specifies the type of the function passed to +// g_hash_table_foreach_remove(). It is called with each +// key/value pair, together with the user_data parameter passed to +// g_hash_table_foreach_remove(). It should return TRUE if the key/value pair +// should be removed from the Table. +type HRFunc func(key, value unsafe.Pointer) (ok bool) + +// LogFunc specifies the prototype of log handler functions. +// +// The default log handler, glib.LogDefaultHandler(), automatically appends a +// new-line character to message when printing it. It is advised that any custom +// log handler functions behave similarly, so that logging calls in user code +// do not need modifying to add a new-line character to the message if the log +// handler is changed. +// +// This is not used if structured logging is enabled; see Using Structured +// Logging (logging.html#using-structured-logging). +type LogFunc func(logDomain string, logLevel LogLevelFlags, message string) + +// LogWriterFunc: writer function for log entries. A log entry is a collection +// of one or more Fields, using the standard [field names from journal +// specification](https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html). +// See g_log_structured() for more information. +// +// Writer functions must ignore fields which they do not recognise, unless they +// can write arbitrary binary output, as field values may be arbitrary binary. +// +// log_level is guaranteed to be included in fields as the PRIORITY field, +// but is provided separately for convenience of deciding whether or where to +// output the log entry. +// +// Writer functions should return G_LOG_WRITER_HANDLED if they handled the log +// message successfully or if they deliberately ignored it. If there was an +// error handling the message (for example, if the writer function is meant +// to send messages to a remote logging server and there is a network error), +// it should return G_LOG_WRITER_UNHANDLED. This allows writer functions to be +// chained and fall back to simpler handlers in case of failure. +type LogWriterFunc func(logLevel LogLevelFlags, fields []LogField) (logWriterOutput LogWriterOutput) + +// SourceFunc specifies the type of function passed to g_timeout_add(), +// g_timeout_add_full(), g_idle_add(), and g_idle_add_full(). +// +// When calling g_source_set_callback(), you may need to cast a function of a +// different type to this type. Use G_SOURCE_FUNC() to avoid warnings about +// incompatible function types. +type SourceFunc func() (ok bool) + +// SourceOnceFunc: source function that is only called once before being removed +// from the main context automatically. +// +// See: g_idle_add_once(), g_timeout_add_once(). +type SourceOnceFunc func() + +// The function takes the following parameters: +// +// - logDomain +// - file +// - line +// - prettyFunction +// - expression +func AssertWarning(logDomain, file string, line int, prettyFunction, expression string) { + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 C.int // out + var _arg4 *C.char // out + var _arg5 *C.char // out + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(logDomain))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.int(line) + _arg4 = (*C.char)(unsafe.Pointer(C.CString(prettyFunction))) + defer C.free(unsafe.Pointer(_arg4)) + _arg5 = (*C.char)(unsafe.Pointer(C.CString(expression))) + defer C.free(unsafe.Pointer(_arg5)) + + C.g_assert_warning(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(logDomain) + runtime.KeepAlive(file) + runtime.KeepAlive(line) + runtime.KeepAlive(prettyFunction) + runtime.KeepAlive(expression) +} + +// Basename gets the name of the file without any leading directory components. +// It returns a pointer into the given file name string. +// +// Deprecated: Use g_path_get_basename() instead, but notice that +// g_path_get_basename() allocates new memory for the returned string, unlike +// this function which returns a pointer into the argument. +// +// The function takes the following parameters: +// +// - fileName: name of the file. +// +// The function returns the following values: +// +// - filename: name of the file without any leading directory components. +func Basename(fileName string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(fileName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_basename(_arg1) + runtime.KeepAlive(fileName) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// BitNthLSF: find the position of the first bit set in mask, searching +// from (but not including) nth_bit upwards. Bits are numbered from 0 (least +// significant) to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start +// searching from the 0th bit, set nth_bit to -1. +// +// The function takes the following parameters: +// +// - mask containing flags. +// - nthBit: index of the bit to start the search from. +// +// The function returns the following values: +// +// - gint: index of the first bit set which is higher than nth_bit, or -1 if +// no higher bits are set. +func BitNthLSF(mask uint32, nthBit int) int { + var _arg1 C.gulong // out + var _arg2 C.gint // out + var _cret C.gint // in + + _arg1 = C.gulong(mask) + _arg2 = C.gint(nthBit) + + _cret = C.g_bit_nth_lsf(_arg1, _arg2) + runtime.KeepAlive(mask) + runtime.KeepAlive(nthBit) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// BitNthMSF: find the position of the first bit set in mask, searching from +// (but not including) nth_bit downwards. Bits are numbered from 0 (least +// significant) to sizeof(#gulong) * 8 - 1 (31 or 63, usually). To start +// searching from the last bit, set nth_bit to -1 or GLIB_SIZEOF_LONG * 8. +// +// The function takes the following parameters: +// +// - mask containing flags. +// - nthBit: index of the bit to start the search from. +// +// The function returns the following values: +// +// - gint: index of the first bit set which is lower than nth_bit, or -1 if no +// lower bits are set. +func BitNthMSF(mask uint32, nthBit int) int { + var _arg1 C.gulong // out + var _arg2 C.gint // out + var _cret C.gint // in + + _arg1 = C.gulong(mask) + _arg2 = C.gint(nthBit) + + _cret = C.g_bit_nth_msf(_arg1, _arg2) + runtime.KeepAlive(mask) + runtime.KeepAlive(nthBit) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// BitStorage gets the number of bits used to hold number, e.g. if number is 4, +// 3 bits are needed. +// +// The function takes the following parameters: +// +// - number: #guint. +// +// The function returns the following values: +// +// - guint: number of bits used to hold number. +func BitStorage(number uint32) uint { + var _arg1 C.gulong // out + var _cret C.guint // in + + _arg1 = C.gulong(number) + + _cret = C.g_bit_storage(_arg1) + runtime.KeepAlive(number) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +func BlowChunks() { + C.g_blow_chunks() +} + +// BuildFilenamev creates a filename from a vector of elements using the correct +// separator for the current platform. +// +// This function behaves exactly like g_build_filename(), but takes the path +// elements as a string array, instead of varargs. This function is mainly meant +// for language bindings. +// +// If you are building a path programmatically you may want to use Buf instead. +// +// The function takes the following parameters: +// +// - args: NULL-terminated array of strings containing the path elements. +// +// The function returns the following values: +// +// - filename: newly allocated path. +func BuildFilenamev(args []string) string { + var _arg1 **C.gchar // out + var _cret *C.gchar // in + + { + _arg1 = (**C.gchar)(C.calloc(C.size_t((len(args) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(args)+1) + var zero *C.gchar + out[len(args)] = zero + for i := range args { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(args[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + _cret = C.g_build_filenamev(_arg1) + runtime.KeepAlive(args) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _filename +} + +// BuildPathv behaves exactly like g_build_path(), but takes the path elements +// as a string array, instead of variadic arguments. +// +// This function is mainly meant for language bindings. +// +// The function takes the following parameters: +// +// - separator: string used to separator the elements of the path. +// - args: NULL-terminated array of strings containing the path elements. +// +// The function returns the following values: +// +// - filename: newly-allocated string that must be freed with g_free(). +func BuildPathv(separator string, args []string) string { + var _arg1 *C.gchar // out + var _arg2 **C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(separator))) + defer C.free(unsafe.Pointer(_arg1)) + { + _arg2 = (**C.gchar)(C.calloc(C.size_t((len(args) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice(_arg2, len(args)+1) + var zero *C.gchar + out[len(args)] = zero + for i := range args { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(args[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + _cret = C.g_build_pathv(_arg1, _arg2) + runtime.KeepAlive(separator) + runtime.KeepAlive(args) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _filename +} + +// CanonicalizeFilename gets the canonical file name from filename. All triple +// slashes are turned into single slashes, and all .. and .s resolved against +// relative_to. +// +// Symlinks are not followed, and the returned path is guaranteed to be +// absolute. +// +// If filename is an absolute path, relative_to is ignored. Otherwise, +// relative_to will be prepended to filename to make it absolute. relative_to +// must be an absolute path, or NULL. If relative_to is NULL, it'll fallback to +// g_get_current_dir(). +// +// This function never fails, and will canonicalize file paths even if they +// don't exist. +// +// No file system I/O is done. +// +// The function takes the following parameters: +// +// - filename: name of the file. +// - relativeTo (optional): relative directory, or NULL to use the current +// working directory. +// +// The function returns the following values: +// +// - ret: newly allocated string with the canonical file path. +func CanonicalizeFilename(filename, relativeTo string) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + if relativeTo != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(relativeTo))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.g_canonicalize_filename(_arg1, _arg2) + runtime.KeepAlive(filename) + runtime.KeepAlive(relativeTo) + + var _ret string // out + + _ret = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _ret +} + +// CheckVersion checks that the GLib library in use is compatible with the given +// version. +// +// Generally you would pass in the constants GLIB_MAJOR_VERSION, +// GLIB_MINOR_VERSION, GLIB_MICRO_VERSION as the three arguments to this +// function; that produces a check that the library in use is compatible with +// the version of GLib the application or module was compiled against. +// +// Compatibility is defined by two things: first the +// version of the running library is newer than the version +// required_major.required_minor.required_micro. Second the +// running library must be binary compatible with the version +// required_major.required_minor.required_micro (same major version.). +// +// The function takes the following parameters: +// +// - requiredMajor: required major version. +// - requiredMinor: required minor version. +// - requiredMicro: required micro version. +// +// The function returns the following values: +// +// - utf8 (optional): NULL if the GLib library is compatible with the given +// version, or a string describing the version mismatch. The returned string +// is owned by GLib and must not be modified or freed. +func CheckVersion(requiredMajor, requiredMinor, requiredMicro uint) string { + var _arg1 C.guint // out + var _arg2 C.guint // out + var _arg3 C.guint // out + var _cret *C.gchar // in + + _arg1 = C.guint(requiredMajor) + _arg2 = C.guint(requiredMinor) + _arg3 = C.guint(requiredMicro) + + _cret = C.glib_check_version(_arg1, _arg2, _arg3) + runtime.KeepAlive(requiredMajor) + runtime.KeepAlive(requiredMinor) + runtime.KeepAlive(requiredMicro) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ComputeChecksumForBytes computes the checksum for a binary data. This is +// a convenience wrapper for g_checksum_new(), g_checksum_get_string() and +// g_checksum_free(). +// +// The hexadecimal string returned will be in lower case. +// +// The function takes the following parameters: +// +// - checksumType: Type. +// - data: binary blob to compute the digest of. +// +// The function returns the following values: +// +// - utf8 (optional): digest of the binary data as a string in hexadecimal, +// or NULL if g_checksum_new() fails for checksum_type. The returned string +// should be freed with g_free() when done using it. +func ComputeChecksumForBytes(checksumType ChecksumType, data *Bytes) string { + var _arg1 C.GChecksumType // out + var _arg2 *C.GBytes // out + var _cret *C.gchar // in + + _arg1 = C.GChecksumType(checksumType) + _arg2 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(data))) + + _cret = C.g_compute_checksum_for_bytes(_arg1, _arg2) + runtime.KeepAlive(checksumType) + runtime.KeepAlive(data) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// ComputeChecksumForData computes the checksum for a binary data of length. +// This is a convenience wrapper for g_checksum_new(), g_checksum_get_string() +// and g_checksum_free(). +// +// The hexadecimal string returned will be in lower case. +// +// The function takes the following parameters: +// +// - checksumType: Type. +// - data: binary blob to compute the digest of. +// +// The function returns the following values: +// +// - utf8 (optional): digest of the binary data as a string in hexadecimal, +// or NULL if g_checksum_new() fails for checksum_type. The returned string +// should be freed with g_free() when done using it. +func ComputeChecksumForData(checksumType ChecksumType, data []byte) string { + var _arg1 C.GChecksumType // out + var _arg2 *C.guchar // out + var _arg3 C.gsize + var _cret *C.gchar // in + + _arg1 = C.GChecksumType(checksumType) + _arg3 = (C.gsize)(len(data)) + if len(data) > 0 { + _arg2 = (*C.guchar)(unsafe.Pointer(&data[0])) + } + + _cret = C.g_compute_checksum_for_data(_arg1, _arg2, _arg3) + runtime.KeepAlive(checksumType) + runtime.KeepAlive(data) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// ComputeChecksumForString computes the checksum of a string. +// +// The hexadecimal string returned will be in lower case. +// +// The function takes the following parameters: +// +// - checksumType: Type. +// - str: string to compute the checksum of. +// +// The function returns the following values: +// +// - utf8 (optional): checksum as a hexadecimal string, or NULL if +// g_checksum_new() fails for checksum_type. The returned string should be +// freed with g_free() when done using it. +func ComputeChecksumForString(checksumType ChecksumType, str string) string { + var _arg1 C.GChecksumType // out + var _arg2 *C.gchar // out + var _arg3 C.gssize + var _cret *C.gchar // in + + _arg1 = C.GChecksumType(checksumType) + _arg3 = (C.gssize)(len(str)) + _arg2 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg2)), len(str)), str) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_compute_checksum_for_string(_arg1, _arg2, _arg3) + runtime.KeepAlive(checksumType) + runtime.KeepAlive(str) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// ComputeHMACForBytes computes the HMAC for a binary data. This is a +// convenience wrapper for g_hmac_new(), g_hmac_get_string() and g_hmac_unref(). +// +// The hexadecimal string returned will be in lower case. +// +// The function takes the following parameters: +// +// - digestType to use for the HMAC. +// - key to use in the HMAC. +// - data: binary blob to compute the HMAC of. +// +// The function returns the following values: +// +// - utf8: HMAC of the binary data as a string in hexadecimal. The returned +// string should be freed with g_free() when done using it. +func ComputeHMACForBytes(digestType ChecksumType, key, data *Bytes) string { + var _arg1 C.GChecksumType // out + var _arg2 *C.GBytes // out + var _arg3 *C.GBytes // out + var _cret *C.gchar // in + + _arg1 = C.GChecksumType(digestType) + _arg2 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(key))) + _arg3 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(data))) + + _cret = C.g_compute_hmac_for_bytes(_arg1, _arg2, _arg3) + runtime.KeepAlive(digestType) + runtime.KeepAlive(key) + runtime.KeepAlive(data) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// ComputeHMACForData computes the HMAC for a binary data of length. This is a +// convenience wrapper for g_hmac_new(), g_hmac_get_string() and g_hmac_unref(). +// +// The hexadecimal string returned will be in lower case. +// +// The function takes the following parameters: +// +// - digestType to use for the HMAC. +// - key to use in the HMAC. +// - data: binary blob to compute the HMAC of. +// +// The function returns the following values: +// +// - utf8: HMAC of the binary data as a string in hexadecimal. The returned +// string should be freed with g_free() when done using it. +func ComputeHMACForData(digestType ChecksumType, key, data []byte) string { + var _arg1 C.GChecksumType // out + var _arg2 *C.guchar // out + var _arg3 C.gsize + var _arg4 *C.guchar // out + var _arg5 C.gsize + var _cret *C.gchar // in + + _arg1 = C.GChecksumType(digestType) + _arg3 = (C.gsize)(len(key)) + if len(key) > 0 { + _arg2 = (*C.guchar)(unsafe.Pointer(&key[0])) + } + _arg5 = (C.gsize)(len(data)) + if len(data) > 0 { + _arg4 = (*C.guchar)(unsafe.Pointer(&data[0])) + } + + _cret = C.g_compute_hmac_for_data(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(digestType) + runtime.KeepAlive(key) + runtime.KeepAlive(data) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// ComputeHMACForString computes the HMAC for a string. +// +// The hexadecimal string returned will be in lower case. +// +// The function takes the following parameters: +// +// - digestType to use for the HMAC. +// - key to use in the HMAC. +// - str: string to compute the HMAC for. +// +// The function returns the following values: +// +// - utf8: HMAC as a hexadecimal string. The returned string should be freed +// with g_free() when done using it. +func ComputeHMACForString(digestType ChecksumType, key []byte, str string) string { + var _arg1 C.GChecksumType // out + var _arg2 *C.guchar // out + var _arg3 C.gsize + var _arg4 *C.gchar // out + var _arg5 C.gssize + var _cret *C.gchar // in + + _arg1 = C.GChecksumType(digestType) + _arg3 = (C.gsize)(len(key)) + if len(key) > 0 { + _arg2 = (*C.guchar)(unsafe.Pointer(&key[0])) + } + _arg5 = (C.gssize)(len(str)) + _arg4 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg4)), len(str)), str) + defer C.free(unsafe.Pointer(_arg4)) + + _cret = C.g_compute_hmac_for_string(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(digestType) + runtime.KeepAlive(key) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Convert converts a string from one character set to another. +// +// Note that you should use g_iconv() for streaming conversions. Despite the +// fact that bytes_read can return information about partial characters, +// the g_convert_... functions are not generally suitable for streaming. +// If the underlying converter maintains internal state, then this won't be +// preserved across successive calls to g_convert(), g_convert_with_iconv() or +// g_convert_with_fallback(). (An example of this is the GNU C converter for +// CP1255 which does not emit a base character until it knows that the next +// character is not a mark that could combine with the base character.) +// +// Using extensions such as "//TRANSLIT" may not work (or may not work well) on +// many platforms. Consider using g_str_to_ascii() instead. +// +// The function takes the following parameters: +// +// - str: the string to convert. +// - toCodeset: name of character set into which to convert str. +// - fromCodeset: character set of str. +// +// The function returns the following values: +// +// - bytesRead (optional): location to store the number of bytes in +// the input string that were successfully converted, or NULL. +// Even if the conversion was successful, this may be less than len if +// there were partial characters at the end of the input. If the error +// G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will be the +// byte offset after the last valid input sequence. +// - guint8s: If the conversion was successful, a newly allocated buffer +// containing the converted string, which must be freed with g_free(). +// Otherwise NULL and error will be set. +func Convert(str, toCodeset, fromCodeset string) (uint, []byte, error) { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 C.gsize // in + var _cret *C.gchar // in + var _arg6 C.gsize // in + var _cerr *C.GError // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(toCodeset))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(fromCodeset))) + defer C.free(unsafe.Pointer(_arg4)) + + _cret = C.g_convert(_arg1, _arg2, _arg3, _arg4, &_arg5, &_arg6, &_cerr) + runtime.KeepAlive(str) + runtime.KeepAlive(toCodeset) + runtime.KeepAlive(fromCodeset) + + var _bytesRead uint // out + var _guint8s []byte // out + var _goerr error // out + + _bytesRead = uint(_arg5) + defer C.free(unsafe.Pointer(_cret)) + _guint8s = make([]byte, _arg6) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg6)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _guint8s, _goerr +} + +func ConvertErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_convert_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// ConvertWithFallback converts a string from one character set to another, +// possibly including fallback sequences for characters not representable in +// the output. Note that it is not guaranteed that the specification for the +// fallback sequences in fallback will be honored. Some systems may do an +// approximate conversion from from_codeset to to_codeset in their iconv() +// functions, in which case GLib will simply return that approximate conversion. +// +// Note that you should use g_iconv() for streaming conversions. Despite the +// fact that bytes_read can return information about partial characters, +// the g_convert_... functions are not generally suitable for streaming. +// If the underlying converter maintains internal state, then this won't be +// preserved across successive calls to g_convert(), g_convert_with_iconv() or +// g_convert_with_fallback(). (An example of this is the GNU C converter for +// CP1255 which does not emit a base character until it knows that the next +// character is not a mark that could combine with the base character.). +// +// The function takes the following parameters: +// +// - str: the string to convert. +// - toCodeset: name of character set into which to convert str. +// - fromCodeset: character set of str. +// - fallback: UTF-8 string to use in place of characters not present in +// the target encoding. (The string must be representable in the target +// encoding). If NULL, characters not in the target encoding will be +// represented as Unicode escapes \uxxxx or \Uxxxxyyyy. +// +// The function returns the following values: +// +// - bytesRead (optional): location to store the number of bytes in the input +// string that were successfully converted, or NULL. Even if the conversion +// was successful, this may be less than len if there were partial +// characters at the end of the input. +// - guint8s: If the conversion was successful, a newly allocated buffer +// containing the converted string, which must be freed with g_free(). +// Otherwise NULL and error will be set. +func ConvertWithFallback(str, toCodeset, fromCodeset, fallback string) (uint, []byte, error) { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 *C.gchar // out + var _arg6 C.gsize // in + var _cret *C.gchar // in + var _arg7 C.gsize // in + var _cerr *C.GError // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(toCodeset))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(fromCodeset))) + defer C.free(unsafe.Pointer(_arg4)) + _arg5 = (*C.gchar)(unsafe.Pointer(C.CString(fallback))) + defer C.free(unsafe.Pointer(_arg5)) + + _cret = C.g_convert_with_fallback(_arg1, _arg2, _arg3, _arg4, _arg5, &_arg6, &_arg7, &_cerr) + runtime.KeepAlive(str) + runtime.KeepAlive(toCodeset) + runtime.KeepAlive(fromCodeset) + runtime.KeepAlive(fallback) + + var _bytesRead uint // out + var _guint8s []byte // out + var _goerr error // out + + _bytesRead = uint(_arg6) + defer C.free(unsafe.Pointer(_cret)) + _guint8s = make([]byte, _arg7) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg7)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _guint8s, _goerr +} + +// Dcgettext: this is a variant of g_dgettext() that allows specifying a +// locale category instead of always using LC_MESSAGES. See g_dgettext() for +// more information about how this functions differs from calling dcgettext() +// directly. +// +// The function takes the following parameters: +// +// - domain (optional): translation domain to use, or NULL to use the domain +// set with textdomain(). +// - msgid: message to translate. +// - category: locale category. +// +// The function returns the following values: +// +// - utf8: translated string for the given locale category. +func Dcgettext(domain, msgid string, category int) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gint // out + var _cret *C.gchar // in + + if domain != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(msgid))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.gint(category) + + _cret = C.g_dcgettext(_arg1, _arg2, _arg3) + runtime.KeepAlive(domain) + runtime.KeepAlive(msgid) + runtime.KeepAlive(category) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Dgettext: this function is a wrapper of dgettext() which does not +// translate the message if the default domain as set with textdomain() has no +// translations for the current locale. +// +// The advantage of using this function over dgettext() proper is that libraries +// using this function (like GTK) will not use translations if the application +// using the library does not have translations for the current locale. +// This results in a consistent English-only interface instead of one having +// partial translations. For this feature to work, the call to textdomain() and +// setlocale() should precede any g_dgettext() invocations. For GTK, it means +// calling textdomain() before gtk_init or its variants. +// +// This function disables translations if and only if upon its first call all +// the following conditions hold: +// +// - domain is not NULL +// +// - textdomain() has been called to set a default text domain +// +// - there is no translations available for the default text domain and the +// current locale +// +// - current locale is not "C" or any English locales (those starting with +// "en_") +// +// Note that this behavior may not be desired for example if an application has +// its untranslated messages in a language other than English. In those cases +// the application should call textdomain() after initializing GTK. +// +// Applications should normally not use this function directly, but use the _() +// macro for translations. +// +// The function takes the following parameters: +// +// - domain (optional): translation domain to use, or NULL to use the domain +// set with textdomain(). +// - msgid: message to translate. +// +// The function returns the following values: +// +// - utf8: translated string. +func Dgettext(domain, msgid string) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + + if domain != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(msgid))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_dgettext(_arg1, _arg2) + runtime.KeepAlive(domain) + runtime.KeepAlive(msgid) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// DirectEqual compares two #gpointer arguments and returns TRUE if they +// are equal. It can be passed to g_hash_table_new() as the key_equal_func +// parameter, when using opaque pointers compared by pointer value as keys in a +// Table. +// +// This equality function is also appropriate for keys that are integers stored +// in pointers, such as GINT_TO_POINTER (n). +// +// The function takes the following parameters: +// +// - v1 (optional): key. +// - v2 (optional): key to compare with v1. +// +// The function returns the following values: +// +// - ok: TRUE if the two keys match. +func DirectEqual(v1, v2 unsafe.Pointer) bool { + var _arg1 C.gconstpointer // out + var _arg2 C.gconstpointer // out + var _cret C.gboolean // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v1)) + _arg2 = (C.gconstpointer)(unsafe.Pointer(v2)) + + _cret = C.g_direct_equal(_arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DirectHash converts a gpointer to a hash value. It can be passed to +// g_hash_table_new() as the hash_func parameter, when using opaque pointers +// compared by pointer value as keys in a Table. +// +// This hash function is also appropriate for keys that are integers stored in +// pointers, such as GINT_TO_POINTER (n). +// +// The function takes the following parameters: +// +// - v (optional): #gpointer key. +// +// The function returns the following values: +// +// - guint: hash value corresponding to the key. +func DirectHash(v unsafe.Pointer) uint { + var _arg1 C.gconstpointer // out + var _cret C.guint // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v)) + + _cret = C.g_direct_hash(_arg1) + runtime.KeepAlive(v) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Dngettext: this function is a wrapper of dngettext() which does not +// translate the message if the default domain as set with textdomain() has no +// translations for the current locale. +// +// See g_dgettext() for details of how this differs from dngettext() proper. +// +// The function takes the following parameters: +// +// - domain (optional): translation domain to use, or NULL to use the domain +// set with textdomain(). +// - msgid: message to translate. +// - msgidPlural: plural form of the message. +// - n: quantity for which translation is needed. +// +// The function returns the following values: +// +// - utf8: translated string. +func Dngettext(domain, msgid, msgidPlural string, n uint32) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 C.gulong // out + var _cret *C.gchar // in + + if domain != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(msgid))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(msgidPlural))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = C.gulong(n) + + _cret = C.g_dngettext(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(domain) + runtime.KeepAlive(msgid) + runtime.KeepAlive(msgidPlural) + runtime.KeepAlive(n) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// DoubleEqual compares the two #gdouble values being pointed to and returns +// TRUE if they are equal. It can be passed to g_hash_table_new() as the +// key_equal_func parameter, when using non-NULL pointers to doubles as keys in +// a Table. +// +// The function takes the following parameters: +// +// - v1: pointer to a #gdouble key. +// - v2: pointer to a #gdouble key to compare with v1. +// +// The function returns the following values: +// +// - ok: TRUE if the two keys match. +func DoubleEqual(v1, v2 unsafe.Pointer) bool { + var _arg1 C.gconstpointer // out + var _arg2 C.gconstpointer // out + var _cret C.gboolean // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v1)) + _arg2 = (C.gconstpointer)(unsafe.Pointer(v2)) + + _cret = C.g_double_equal(_arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DoubleHash converts a pointer to a #gdouble to a hash value. It can be +// passed to g_hash_table_new() as the hash_func parameter, It can be passed to +// g_hash_table_new() as the hash_func parameter, when using non-NULL pointers +// to doubles as keys in a Table. +// +// The function takes the following parameters: +// +// - v: pointer to a #gdouble key. +// +// The function returns the following values: +// +// - guint: hash value corresponding to the key. +func DoubleHash(v unsafe.Pointer) uint { + var _arg1 C.gconstpointer // out + var _cret C.guint // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v)) + + _cret = C.g_double_hash(_arg1) + runtime.KeepAlive(v) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Dpgettext: this function is a variant of g_dgettext() which supports a +// disambiguating message context. GNU gettext uses the '\004' character to +// separate the message context and message id in msgctxtid. If 0 is passed as +// msgidoffset, this function will fall back to trying to use the deprecated +// convention of using "|" as a separation character. +// +// This uses g_dgettext() internally. See that functions for differences with +// dgettext() proper. +// +// Applications should normally not use this function directly, but use the C_() +// macro for translations with context. +// +// The function takes the following parameters: +// +// - domain (optional): translation domain to use, or NULL to use the domain +// set with textdomain(). +// - msgctxtid: combined message context and message id, separated by a \004 +// character. +// - msgidoffset: offset of the message id in msgctxid. +// +// The function returns the following values: +// +// - utf8: translated string. +func Dpgettext(domain, msgctxtid string, msgidoffset uint) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gsize // out + var _cret *C.gchar // in + + if domain != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(msgctxtid))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.gsize(msgidoffset) + + _cret = C.g_dpgettext(_arg1, _arg2, _arg3) + runtime.KeepAlive(domain) + runtime.KeepAlive(msgctxtid) + runtime.KeepAlive(msgidoffset) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Dpgettext2: this function is a variant of g_dgettext() which supports a +// disambiguating message context. GNU gettext uses the '\004' character to +// separate the message context and message id in msgctxtid. +// +// This uses g_dgettext() internally. See that functions for differences with +// dgettext() proper. +// +// This function differs from C_() in that it is not a macro and thus you may +// use non-string-literals as context and msgid arguments. +// +// The function takes the following parameters: +// +// - domain (optional): translation domain to use, or NULL to use the domain +// set with textdomain(). +// - context: message context. +// - msgid: message. +// +// The function returns the following values: +// +// - utf8: translated string. +func Dpgettext2(domain, context, msgid string) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret *C.gchar // in + + if domain != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(context))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(msgid))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.g_dpgettext2(_arg1, _arg2, _arg3) + runtime.KeepAlive(domain) + runtime.KeepAlive(context) + runtime.KeepAlive(msgid) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// EnvironGetenv returns the value of the environment variable variable in the +// provided list envp. +// +// The function takes the following parameters: +// +// - envp (optional): an environment list (eg, as returned from +// g_get_environ()), or NULL for an empty environment list. +// - variable: environment variable to get. +// +// The function returns the following values: +// +// - filename (optional): value of the environment variable, or NULL if the +// environment variable is not set in envp. The returned string is owned by +// envp, and will be freed if variable is set or unset again. +func EnvironGetenv(envp []string, variable string) string { + var _arg1 **C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + + { + _arg1 = (**C.gchar)(C.calloc(C.size_t((len(envp) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(envp)+1) + var zero *C.gchar + out[len(envp)] = zero + for i := range envp { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(envp[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(variable))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_environ_getenv(_arg1, _arg2) + runtime.KeepAlive(envp) + runtime.KeepAlive(variable) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// EnvironSetenv sets the environment variable variable in the provided list +// envp to value. +// +// The function takes the following parameters: +// +// - envp (optional): an environment list that can be freed using g_strfreev() +// (e.g., as returned from g_get_environ()), or NULL for an empty +// environment list. +// - variable: environment variable to set, must not contain '='. +// - value for to set the variable to. +// - overwrite: whether to change the variable if it already exists. +// +// The function returns the following values: +// +// - filenames: the updated environment list. Free it using g_strfreev(). +func EnvironSetenv(envp []string, variable, value string, overwrite bool) []string { + var _arg1 **C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 C.gboolean // out + var _cret **C.gchar // in + + { + _arg1 = (**C.gchar)(C.calloc(C.size_t((len(envp) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + { + out := unsafe.Slice(_arg1, len(envp)+1) + var zero *C.gchar + out[len(envp)] = zero + for i := range envp { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(envp[i]))) + } + } + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(variable))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg3)) + if overwrite { + _arg4 = C.TRUE + } + + _cret = C.g_environ_setenv(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(envp) + runtime.KeepAlive(variable) + runtime.KeepAlive(value) + runtime.KeepAlive(overwrite) + + var _filenames []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _filenames = make([]string, i) + for i := range src { + _filenames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _filenames +} + +// EnvironUnsetenv removes the environment variable variable from the provided +// environment envp. +// +// The function takes the following parameters: +// +// - envp (optional): an environment list that can be freed using g_strfreev() +// (e.g., as returned from g_get_environ()), or NULL for an empty +// environment list. +// - variable: environment variable to remove, must not contain '='. +// +// The function returns the following values: +// +// - filenames: the updated environment list. Free it using g_strfreev(). +func EnvironUnsetenv(envp []string, variable string) []string { + var _arg1 **C.gchar // out + var _arg2 *C.gchar // out + var _cret **C.gchar // in + + { + _arg1 = (**C.gchar)(C.calloc(C.size_t((len(envp) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + { + out := unsafe.Slice(_arg1, len(envp)+1) + var zero *C.gchar + out[len(envp)] = zero + for i := range envp { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(envp[i]))) + } + } + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(variable))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_environ_unsetenv(_arg1, _arg2) + runtime.KeepAlive(envp) + runtime.KeepAlive(variable) + + var _filenames []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _filenames = make([]string, i) + for i := range src { + _filenames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _filenames +} + +// FileErrorFromErrno gets a Error constant based on the passed-in err_no. +// +// For example, if you pass in EEXIST this function returns G_FILE_ERROR_EXIST. +// Unlike errno values, you can portably assume that all Error values will +// exist. +// +// Normally a Error value goes into a #GError returned from a function +// that manipulates files. So you would use g_file_error_from_errno() when +// constructing a #GError. +// +// The function takes the following parameters: +// +// - errNo: "errno" value. +// +// The function returns the following values: +// +// - fileError corresponding to the given err_no. +func FileErrorFromErrno(errNo int) FileError { + var _arg1 C.gint // out + var _cret C.GFileError // in + + _arg1 = C.gint(errNo) + + _cret = C.g_file_error_from_errno(_arg1) + runtime.KeepAlive(errNo) + + var _fileError FileError // out + + _fileError = FileError(_cret) + + return _fileError +} + +func FileErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_file_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// FileGetContents reads an entire file into allocated memory, with good error +// checking. +// +// If the call was successful, it returns TRUE and sets contents to the +// file contents and length to the length of the file contents in bytes. +// The string stored in contents will be nul-terminated, so for text files +// you can pass NULL for the length argument. If the call was not successful, +// it returns FALSE and sets error. The error domain is G_FILE_ERROR. +// Possible error codes are those in the Error enumeration. In the error case, +// contents is set to NULL and length is set to zero. +// +// The function takes the following parameters: +// +// - filename: name of a file to read contents from, in the GLib file name +// encoding. +// +// The function returns the following values: +// +// - contents: location to store an allocated string, use g_free() to free the +// returned string. +func FileGetContents(filename string) ([]byte, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // in + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_file_get_contents(_arg1, &_arg2, &_arg3, &_cerr) + runtime.KeepAlive(filename) + + var _contents []byte // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_arg2)) + _contents = make([]byte, _arg3) + copy(_contents, unsafe.Slice((*byte)(unsafe.Pointer(_arg2)), _arg3)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _contents, _goerr +} + +// FileOpenTmp opens a file for writing in the preferred directory for temporary +// files (as returned by g_get_tmp_dir()). +// +// tmpl should be a string in the GLib file name encoding containing a sequence +// of six 'X' characters, as the parameter to g_mkstemp(). However, unlike these +// functions, the template should only be a basename, no directory components +// are allowed. If template is NULL, a default template is used. +// +// Note that in contrast to g_mkstemp() (and mkstemp()) tmpl is not modified, +// and might thus be a read-only literal string. +// +// Upon success, and if name_used is non-NULL, the actual name used is returned +// in name_used. This string should be freed with g_free() when not needed any +// longer. The returned name is in the GLib file name encoding. +// +// The function takes the following parameters: +// +// - tmpl (optional): template for file name, as in g_mkstemp(), basename +// only, or NULL for a default template. +// +// The function returns the following values: +// +// - nameUsed: location to store actual name used, or NULL. +// - gint: file handle (as from open()) to the file opened for reading and +// writing. The file is opened in binary mode on platforms where there is +// a difference. The file handle should be closed with close(). In case of +// errors, -1 is returned and error will be set. +func FileOpenTmp(tmpl string) (string, int, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // in + var _cret C.gint // in + var _cerr *C.GError // in + + if tmpl != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(tmpl))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_file_open_tmp(_arg1, &_arg2, &_cerr) + runtime.KeepAlive(tmpl) + + var _nameUsed string // out + var _gint int // out + var _goerr error // out + + _nameUsed = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _nameUsed, _gint, _goerr +} + +// FileReadLink reads the contents of the symbolic link filename like the POSIX +// readlink() function. +// +// The returned string is in the encoding used for filenames. Use +// g_filename_to_utf8() to convert it to UTF-8. +// +// The returned string may also be a relative path. Use g_build_filename() to +// convert it to an absolute path: +// +// g_autoptr(GError) local_error = NULL; +// g_autofree gchar *link_target = g_file_read_link ("/etc/localtime", &local_error); +// +// if (local_error != NULL) +// g_error ("Error reading link: s", local_error->message); +// +// if (!g_path_is_absolute (link_target)) +// { +// g_autofree gchar *absolute_link_target = g_build_filename ("/etc", link_target, NULL); +// g_free (link_target); +// link_target = g_steal_pointer (&absolute_link_target); +// }. +// +// The function takes the following parameters: +// +// - filename: symbolic link. +// +// The function returns the following values: +// +// - ret: newly-allocated string with the contents of the symbolic link, +// or NULL if an error occurred. +func FileReadLink(filename string) (string, error) { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_file_read_link(_arg1, &_cerr) + runtime.KeepAlive(filename) + + var _ret string // out + var _goerr error // out + + _ret = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ret, _goerr +} + +// FileSetContents writes all of contents to a file named filename. This is a +// convenience wrapper around calling g_file_set_contents_full() with flags set +// to G_FILE_SET_CONTENTS_CONSISTENT | G_FILE_SET_CONTENTS_ONLY_EXISTING and +// mode set to 0666. +// +// The function takes the following parameters: +// +// - filename: name of a file to write contents to, in the GLib file name +// encoding. +// - contents: string to write to the file. +func FileSetContents(filename, contents string) error { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gssize + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = (C.gssize)(len(contents)) + _arg2 = (*C.gchar)(C.calloc(C.size_t((len(contents) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg2)), len(contents)), contents) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_file_set_contents(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(filename) + runtime.KeepAlive(contents) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// FileSetContentsFull writes all of contents to a file named filename, +// with good error checking. If a file called filename already exists it will be +// overwritten. +// +// flags control the properties of the write operation: whether it’s atomic, +// and what the tradeoff is between returning quickly or being resilient to +// system crashes. +// +// As this function performs file I/O, it is recommended to not call it +// anywhere where blocking would cause problems, such as in the main loop of +// a graphical application. In particular, if flags has any value other than +// G_FILE_SET_CONTENTS_NONE then this function may call fsync(). +// +// If G_FILE_SET_CONTENTS_CONSISTENT is set in flags, the operation is atomic in +// the sense that it is first written to a temporary file which is then renamed +// to the final name. +// +// Notes: +// +// - On UNIX, if filename already exists hard links to filename will break. +// Also since the file is recreated, existing permissions, access control lists, +// metadata etc. may be lost. If filename is a symbolic link, the link itself +// will be replaced, not the linked file. +// +// - On UNIX, if filename already exists and is non-empty, and if the +// system supports it (via a journalling filesystem or equivalent), +// and if G_FILE_SET_CONTENTS_CONSISTENT is set in flags, the fsync() call (or +// equivalent) will be used to ensure atomic replacement: filename will contain +// either its old contents or contents, even in the face of system power loss, +// the disk being unsafely removed, etc. +// +// - On UNIX, if filename does not already exist or is empty, +// there is a possibility that system power loss etc. after calling this +// function will leave filename empty or full of NUL bytes, depending +// on the underlying filesystem, unless G_FILE_SET_CONTENTS_DURABLE and +// G_FILE_SET_CONTENTS_CONSISTENT are set in flags. +// +// - On Windows renaming a file will not remove an existing file with the new +// name, so on Windows there is a race condition between the existing file being +// removed and the temporary file being renamed. +// +// - On Windows there is no way to remove a file that is open to some process, +// or mapped into memory. Thus, this function will fail if filename already +// exists and is open. +// +// If the call was successful, it returns TRUE. If the call was not successful, +// it returns FALSE and sets error. The error domain is G_FILE_ERROR. Possible +// error codes are those in the Error enumeration. +// +// Note that the name for the temporary file is constructed by appending up to 7 +// characters to filename. +// +// If the file didn’t exist before and is created, it will be given the +// permissions from mode. Otherwise, the permissions of the existing file may be +// changed to mode depending on flags, or they may remain unchanged. +// +// The function takes the following parameters: +// +// - filename: name of a file to write contents to, in the GLib file name +// encoding. +// - contents: string to write to the file. +// - flags controlling the safety vs speed of the operation. +// - mode: file mode, as passed to open(); typically this will be 0666. +func FileSetContentsFull(filename, contents string, flags FileSetContentsFlags, mode int) error { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gssize + var _arg4 C.GFileSetContentsFlags // out + var _arg5 C.int // out + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = (C.gssize)(len(contents)) + _arg2 = (*C.gchar)(C.calloc(C.size_t((len(contents) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg2)), len(contents)), contents) + defer C.free(unsafe.Pointer(_arg2)) + _arg4 = C.GFileSetContentsFlags(flags) + _arg5 = C.int(mode) + + C.g_file_set_contents_full(_arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(filename) + runtime.KeepAlive(contents) + runtime.KeepAlive(flags) + runtime.KeepAlive(mode) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// TestFile returns TRUE if any of the tests in the bitfield test are TRUE. +// For example, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR) will return TRUE if +// the file exists; the check whether it's a directory doesn't matter since the +// existence test is TRUE. With the current set of available tests, there's no +// point passing in more than one test at a time. +// +// Apart from G_FILE_TEST_IS_SYMLINK all tests follow symbolic links, so for +// a symbolic link to a regular file g_file_test() will return TRUE for both +// G_FILE_TEST_IS_SYMLINK and G_FILE_TEST_IS_REGULAR. +// +// Note, that for a dangling symbolic link g_file_test() will return TRUE for +// G_FILE_TEST_IS_SYMLINK and FALSE for all other flags. +// +// You should never use g_file_test() to test whether it is safe to +// perform an operation, because there is always the possibility of the +// condition changing before you actually perform the operation, see TOCTOU +// (https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use). +// +// For example, you might think you could use G_FILE_TEST_IS_SYMLINK to know +// whether it is safe to write to a file without being tricked into writing into +// a different location. It doesn't work! +// +// // DON'T DO THIS +// if (!g_file_test (filename, G_FILE_TEST_IS_SYMLINK)) +// { +// fd = g_open (filename, O_WRONLY); +// // write to fd +// } +// +// // DO THIS INSTEAD +// fd = g_open (filename, O_WRONLY | O_NOFOLLOW | O_CLOEXEC); +// if (fd == -1) +// { +// // check error +// if (errno == ELOOP) +// // file is a symlink and can be ignored +// else +// // handle errors as before +// } +// else +// { +// // write to fd +// } +// +// Another thing to note is that G_FILE_TEST_EXISTS and +// G_FILE_TEST_IS_EXECUTABLE are implemented using the access() system call. +// This usually doesn't matter, but if your program is setuid or setgid it means +// that these tests will give you the answer for the real user ID and group ID, +// rather than the effective user ID and group ID. +// +// On Windows, there are no symlinks, so testing for G_FILE_TEST_IS_SYMLINK will +// always return FALSE. Testing for G_FILE_TEST_IS_EXECUTABLE will just check +// that the file exists and its name indicates that it is executable, checking +// for well-known extensions and those listed in the PATHEXT environment +// variable. +// +// This type has been renamed from file_test. +// +// The function takes the following parameters: +// +// - filename to test in the GLib file name encoding. +// - test: bitfield of Test flags. +// +// The function returns the following values: +// +// - ok: whether a test was TRUE. +func TestFile(filename string, test FileTest) bool { + var _arg1 *C.gchar // out + var _arg2 C.GFileTest // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GFileTest(test) + + _cret = C.g_file_test(_arg1, _arg2) + runtime.KeepAlive(filename) + runtime.KeepAlive(test) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// FilenameDisplayBasename returns the display basename for the particular +// filename, guaranteed to be valid UTF-8. The display name might not be +// identical to the filename, for instance there might be problems converting it +// to UTF-8, and some files can be translated in the display. +// +// If GLib cannot make sense of the encoding of filename, as a last resort it +// replaces unknown characters with U+FFFD, the Unicode replacement character. +// You can search the result for the UTF-8 encoding of this character (which is +// "\357\277\275" in octal notation) to find out if filename was in an invalid +// encoding. +// +// You must pass the whole absolute pathname to this functions so that +// translation of well known locations can be done. +// +// This function is preferred over g_filename_display_name() if you know the +// whole path, as it allows translation. +// +// The function takes the following parameters: +// +// - filename: absolute pathname in the GLib file name encoding. +// +// The function returns the following values: +// +// - utf8: newly allocated string containing a rendition of the basename of +// the filename in valid UTF-8. +func FilenameDisplayBasename(filename string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_filename_display_basename(_arg1) + runtime.KeepAlive(filename) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// FilenameDisplayName converts a filename into a valid UTF-8 string. +// The conversion is not necessarily reversible, so you should keep the original +// around and use the return value of this function only for display purposes. +// Unlike g_filename_to_utf8(), the result is guaranteed to be non-NULL even if +// the filename actually isn't in the GLib file name encoding. +// +// If GLib cannot make sense of the encoding of filename, as a last resort it +// replaces unknown characters with U+FFFD, the Unicode replacement character. +// You can search the result for the UTF-8 encoding of this character (which is +// "\357\277\275" in octal notation) to find out if filename was in an invalid +// encoding. +// +// If you know the whole pathname of the file you should use +// g_filename_display_basename(), since that allows location-based translation +// of filenames. +// +// The function takes the following parameters: +// +// - filename: pathname hopefully in the GLib file name encoding. +// +// The function returns the following values: +// +// - utf8: newly allocated string containing a rendition of the filename in +// valid UTF-8. +func FilenameDisplayName(filename string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_filename_display_name(_arg1) + runtime.KeepAlive(filename) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// FilenameFromURI converts an escaped ASCII-encoded URI to a local filename in +// the encoding used for filenames. +// +// Since GLib 2.78, the query string and fragment can be present in the URI, +// but are not part of the resulting filename. We take inspiration from +// https://url.spec.whatwg.org/#file-state, but we don't support the entire +// standard. +// +// The function takes the following parameters: +// +// - uri describing a filename (escaped, encoded in ASCII). +// +// The function returns the following values: +// +// - hostname (optional): location to store hostname for the URI. If there is +// no hostname in the URI, NULL will be stored in this location. +// - filename: newly-allocated string holding the resulting filename, or NULL +// on an error. +func FilenameFromURI(uri string) (hostname, filename string, goerr error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // in + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_filename_from_uri(_arg1, &_arg2, &_cerr) + runtime.KeepAlive(uri) + + var _hostname string // out + var _filename string // out + var _goerr error // out + + if _arg2 != nil { + _hostname = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _hostname, _filename, _goerr +} + +// FilenameFromUTF8 converts a string from UTF-8 to the encoding GLib uses +// for filenames. Note that on Windows GLib uses UTF-8 for filenames; +// on other platforms, this function indirectly depends on the [current +// locale][setlocale]. +// +// The input string shall not contain nul characters even if the len argument +// is positive. A nul character found inside the string will result in +// error G_CONVERT_ERROR_ILLEGAL_SEQUENCE. If the filename encoding is not +// UTF-8 and the conversion output contains a nul character, the error +// G_CONVERT_ERROR_EMBEDDED_NUL is set and the function returns NULL. +// +// The function takes the following parameters: +// +// - utf8String: UTF-8 encoded string. +// +// The function returns the following values: +// +// - bytesRead (optional): location to store the number of bytes in +// the input string that were successfully converted, or NULL. +// Even if the conversion was successful, this may be less than len if +// there were partial characters at the end of the input. If the error +// G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will be the +// byte offset after the last valid input sequence. +// - bytesWritten (optional): number of bytes stored in the output buffer (not +// including the terminating nul). +// - filename: The converted string, or NULL on an error. +func FilenameFromUTF8(utf8String string) (bytesRead, bytesWritten uint, filename string, goerr error) { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 C.gsize // in + var _arg4 C.gsize // in + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg2 = (C.gssize)(len(utf8String)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(utf8String) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(utf8String)), utf8String) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_filename_from_utf8(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(utf8String) + + var _bytesRead uint // out + var _bytesWritten uint // out + var _filename string // out + var _goerr error // out + + _bytesRead = uint(_arg3) + _bytesWritten = uint(_arg4) + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _bytesWritten, _filename, _goerr +} + +// FilenameToURI converts an absolute filename to an escaped ASCII-encoded URI, +// with the path component following Section 3.3. of RFC 2396. +// +// The function takes the following parameters: +// +// - filename: absolute filename specified in the GLib file name encoding, +// which is the on-disk file name bytes on Unix, and UTF-8 on Windows. +// - hostname (optional): UTF-8 encoded hostname, or NULL for none. +// +// The function returns the following values: +// +// - utf8: newly-allocated string holding the resulting URI, or NULL on an +// error. +func FilenameToURI(filename, hostname string) (string, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + if hostname != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.g_filename_to_uri(_arg1, _arg2, &_cerr) + runtime.KeepAlive(filename) + runtime.KeepAlive(hostname) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// FilenameToUTF8 converts a string which is in the encoding used by GLib +// for filenames into a UTF-8 string. Note that on Windows GLib uses UTF-8 +// for filenames; on other platforms, this function indirectly depends on the +// [current locale][setlocale]. +// +// The input string shall not contain nul characters even if the len argument +// is positive. A nul character found inside the string will result in +// error G_CONVERT_ERROR_ILLEGAL_SEQUENCE. If the source encoding is not +// UTF-8 and the conversion output contains a nul character, the error +// G_CONVERT_ERROR_EMBEDDED_NUL is set and the function returns NULL. Use +// g_convert() to produce output that may contain embedded nul characters. +// +// The function takes the following parameters: +// +// - opsysstring: string in the encoding for filenames. +// +// The function returns the following values: +// +// - bytesRead (optional): location to store the number of bytes in +// the input string that were successfully converted, or NULL. +// Even if the conversion was successful, this may be less than len if +// there were partial characters at the end of the input. If the error +// G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will be the +// byte offset after the last valid input sequence. +// - bytesWritten (optional): number of bytes stored in the output buffer (not +// including the terminating nul). +// - utf8: converted string, or NULL on an error. +func FilenameToUTF8(opsysstring string) (bytesRead, bytesWritten uint, utf8 string, goerr error) { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 C.gsize // in + var _arg4 C.gsize // in + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg2 = (C.gssize)(len(opsysstring)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(opsysstring) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(opsysstring)), opsysstring) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_filename_to_utf8(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(opsysstring) + + var _bytesRead uint // out + var _bytesWritten uint // out + var _utf8 string // out + var _goerr error // out + + _bytesRead = uint(_arg3) + _bytesWritten = uint(_arg4) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _bytesWritten, _utf8, _goerr +} + +// FindProgramInPath locates the first executable named program in the user's +// path, in the same way that execvp() would locate it. Returns an allocated +// string with the absolute path name, or NULL if the program is not found +// in the path. If program is already an absolute path, returns a copy of +// program if program exists and is executable, and NULL otherwise. On Windows, +// if program does not have a file type suffix, tries with the suffixes .exe, +// .cmd, .bat and .com, and the suffixes in the PATHEXT environment variable. +// +// On Windows, it looks for the file in the same way as CreateProcess() would. +// This means first in the directory where the executing program was loaded +// from, then in the current directory, then in the Windows 32-bit system +// directory, then in the Windows directory, and finally in the directories +// in the PATH environment variable. If the program is found, the return value +// contains the full name including the type suffix. +// +// The function takes the following parameters: +// +// - program name in the GLib file name encoding. +// +// The function returns the following values: +// +// - filename (optional): newly-allocated string with the absolute path, +// or NULL. +func FindProgramInPath(program string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(program))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_find_program_in_path(_arg1) + runtime.KeepAlive(program) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// FormatSize formats a size (for example the size of a file) into a human +// readable string. Sizes are rounded to the nearest size prefix (kB, MB, +// GB) and are displayed rounded to the nearest tenth. E.g. the file size +// 3292528 bytes will be converted into the string "3.2 MB". The returned string +// is UTF-8, and may use a non-breaking space to separate the number and units, +// to ensure they aren’t separated when line wrapped. +// +// The prefix units base is 1000 (i.e. 1 kB is 1000 bytes). +// +// This string should be freed with g_free() when not needed any longer. +// +// See g_format_size_full() for more options about how the size might be +// formatted. +// +// The function takes the following parameters: +// +// - size in bytes. +// +// The function returns the following values: +// +// - utf8: newly-allocated formatted string containing a human readable file +// size. +func FormatSize(size uint64) string { + var _arg1 C.guint64 // out + var _cret *C.gchar // in + + _arg1 = C.guint64(size) + + _cret = C.g_format_size(_arg1) + runtime.KeepAlive(size) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// FormatSizeForDisplay formats a size (for example the size of a file) into +// a human readable string. Sizes are rounded to the nearest size prefix (KB, +// MB, GB) and are displayed rounded to the nearest tenth. E.g. the file size +// 3292528 bytes will be converted into the string "3.1 MB". +// +// The prefix units base is 1024 (i.e. 1 KB is 1024 bytes). +// +// This string should be freed with g_free() when not needed any longer. +// +// Deprecated: This function is broken due to its use of SI suffixes to denote +// IEC units. Use g_format_size() instead. +// +// The function takes the following parameters: +// +// - size in bytes. +// +// The function returns the following values: +// +// - utf8: newly-allocated formatted string containing a human readable file +// size. +func FormatSizeForDisplay(size int64) string { + var _arg1 C.goffset // out + var _cret *C.gchar // in + + _arg1 = C.goffset(size) + + _cret = C.g_format_size_for_display(_arg1) + runtime.KeepAlive(size) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// FormatSizeFull formats a size. +// +// This function is similar to g_format_size() but allows for flags that modify +// the output. See SizeFlags. +// +// The function takes the following parameters: +// +// - size in bytes. +// - flags to modify the output. +// +// The function returns the following values: +// +// - utf8: newly-allocated formatted string containing a human readable file +// size. +func FormatSizeFull(size uint64, flags FormatSizeFlags) string { + var _arg1 C.guint64 // out + var _arg2 C.GFormatSizeFlags // out + var _cret *C.gchar // in + + _arg1 = C.guint64(size) + _arg2 = C.GFormatSizeFlags(flags) + + _cret = C.g_format_size_full(_arg1, _arg2) + runtime.KeepAlive(size) + runtime.KeepAlive(flags) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// GetApplicationName gets a human-readable name for the application, as set +// by g_set_application_name(). This name should be localized if possible, +// and is intended for display to the user. Contrast with g_get_prgname(), which +// gets a non-localized name. If g_set_application_name() has not been called, +// returns the result of g_get_prgname() (which may be NULL if g_set_prgname() +// has also not been called). +// +// The function returns the following values: +// +// - utf8 (optional): human-readable application name. May return NULL. +func GetApplicationName() string { + var _cret *C.gchar // in + + _cret = C.g_get_application_name() + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// GetCharset obtains the character set for the [current locale][setlocale]; +// you might use this character set as an argument to g_convert(), to convert +// from the current locale's encoding to some other encoding. (Frequently +// g_locale_to_utf8() and g_locale_from_utf8() are nice shortcuts, though.) +// +// On Windows the character set returned by this function is the so-called +// system default ANSI code-page. That is the character set used by the "narrow" +// versions of C library and Win32 functions that handle file names. It might be +// different from the character set used by the C library's current locale. +// +// On Linux, the character set is found by consulting nl_langinfo() if +// available. If not, the environment variables LC_ALL, LC_CTYPE, LANG and +// CHARSET are queried in order. nl_langinfo() returns the C locale if no locale +// has been loaded by setlocale(). +// +// The return value is TRUE if the locale's encoding is UTF-8, in that case you +// can perhaps avoid calling g_convert(). +// +// The string returned in charset is not allocated, and should not be freed. +// +// The function returns the following values: +// +// - charset (optional): return location for character set name, or NULL. +// - ok: TRUE if the returned charset is UTF-8. +func GetCharset() (string, bool) { + var _arg1 *C.char // in + var _cret C.gboolean // in + + _cret = C.g_get_charset(&_arg1) + + var _charset string // out + var _ok bool // out + + if _arg1 != nil { + _charset = C.GoString((*C.gchar)(unsafe.Pointer(_arg1))) + } + if _cret != 0 { + _ok = true + } + + return _charset, _ok +} + +// GetCodeset gets the character set for the current locale. +// +// The function returns the following values: +// +// - utf8: newly allocated string containing the name of the character set. +// This string must be freed with g_free(). +func GetCodeset() string { + var _cret *C.gchar // in + + _cret = C.g_get_codeset() + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// GetConsoleCharset obtains the character set used by the console attached to +// the process, which is suitable for printing output to the terminal. +// +// Usually this matches the result returned by g_get_charset(), but in +// environments where the locale's character set does not match the encoding of +// the console this function tries to guess a more suitable value instead. +// +// On Windows the character set returned by this function is the output code +// page used by the console associated with the calling process. If the codepage +// can't be determined (for example because there is no console attached) UTF-8 +// is assumed. +// +// The return value is TRUE if the locale's encoding is UTF-8, in that case you +// can perhaps avoid calling g_convert(). +// +// The string returned in charset is not allocated, and should not be freed. +// +// The function returns the following values: +// +// - charset (optional): return location for character set name, or NULL. +// - ok: TRUE if the returned charset is UTF-8. +func GetConsoleCharset() (string, bool) { + var _arg1 *C.char // in + var _cret C.gboolean // in + + _cret = C.g_get_console_charset(&_arg1) + + var _charset string // out + var _ok bool // out + + if _arg1 != nil { + _charset = C.GoString((*C.gchar)(unsafe.Pointer(_arg1))) + } + if _cret != 0 { + _ok = true + } + + return _charset, _ok +} + +// GetCurrentDir gets the current directory. +// +// The returned string should be freed when no longer needed. The encoding of +// the returned string is system defined. On Windows, it is always UTF-8. +// +// Since GLib 2.40, this function will return the value of the "PWD" environment +// variable if it is set and it happens to be the same as the current directory. +// This can make a difference in the case that the current directory is the +// target of a symbolic link. +// +// The function returns the following values: +// +// - filename: current directory. +func GetCurrentDir() string { + var _cret *C.gchar // in + + _cret = C.g_get_current_dir() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _filename +} + +// GetCurrentTime: equivalent to the UNIX gettimeofday() function, but portable. +// +// You may find g_get_real_time() to be more convenient. +// +// Deprecated: Val is not year-2038-safe. Use g_get_real_time() instead. +// +// The function takes the following parameters: +// +// - result structure in which to store current time. +func GetCurrentTime(result *TimeVal) { + var _arg1 *C.GTimeVal // out + + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(result))) + + C.g_get_current_time(_arg1) + runtime.KeepAlive(result) +} + +// GetEnviron gets the list of environment variables for the current process. +// +// The list is NULL terminated and each item in the list is of the form +// 'NAME=VALUE'. +// +// This is equivalent to direct access to the 'environ' global variable, +// except portable. +// +// The return value is freshly allocated and it should be freed with +// g_strfreev() when it is no longer needed. +// +// The function returns the following values: +// +// - filenames: the list of environment variables. +func GetEnviron() []string { + var _cret **C.gchar // in + + _cret = C.g_get_environ() + + var _filenames []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _filenames = make([]string, i) + for i := range src { + _filenames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _filenames +} + +// GetFilenameCharsets determines the preferred character sets used for +// filenames. The first character set from the charsets is the filename +// encoding, the subsequent character sets are used when trying to generate a +// displayable representation of a filename, see g_filename_display_name(). +// +// On Unix, the character sets are determined by consulting the environment +// variables G_FILENAME_ENCODING and G_BROKEN_FILENAMES. On Windows, +// the character set used in the GLib API is always UTF-8 and said environment +// variables have no effect. +// +// G_FILENAME_ENCODING may be set to a comma-separated list of character set +// names. The special token "\locale" is taken to mean the character set +// for the [current locale][setlocale]. If G_FILENAME_ENCODING is not set, +// but G_BROKEN_FILENAMES is, the character set of the current locale is taken +// as the filename encoding. If neither environment variable is set, UTF-8 is +// taken as the filename encoding, but the character set of the current locale +// is also put in the list of encodings. +// +// The returned charsets belong to GLib and must not be freed. +// +// Note that on Unix, regardless of the locale character set or +// G_FILENAME_ENCODING value, the actual file names present on a system might be +// in any random encoding or just gibberish. +// +// The function returns the following values: +// +// - filenameCharsets: return location for the NULL-terminated list of +// encoding names. +// - ok: TRUE if the filename encoding is UTF-8. +func GetFilenameCharsets() ([]string, bool) { + var _arg1 **C.gchar // in + var _cret C.gboolean // in + + _cret = C.g_get_filename_charsets(&_arg1) + + var _filenameCharsets []string // out + var _ok bool // out + + { + var i int + var z *C.gchar + for p := _arg1; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg1, i) + _filenameCharsets = make([]string, i) + for i := range src { + _filenameCharsets[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + if _cret != 0 { + _ok = true + } + + return _filenameCharsets, _ok +} + +// GetHomeDir gets the current user's home directory. +// +// As with most UNIX tools, this function will return the value of the HOME +// environment variable if it is set to an existing absolute path name, falling +// back to the passwd file in the case that it is unset. +// +// If the path given in HOME is non-absolute, does not exist, or is not a +// directory, the result is undefined. +// +// Before version 2.36 this function would ignore the HOME environment variable, +// taking the value from the passwd database instead. This was changed to +// increase the compatibility of GLib with other programs (and the XDG basedir +// specification) and to increase testability of programs based on GLib (by +// making it easier to run them from test frameworks). +// +// If your program has a strong requirement for either the new or the old +// behaviour (and if you don't wish to increase your GLib dependency to ensure +// that the new behaviour is in effect) then you should either directly check +// the HOME environment variable yourself or unset it before calling any +// functions in GLib. +// +// The function returns the following values: +// +// - filename: current user's home directory. +func GetHomeDir() string { + var _cret *C.gchar // in + + _cret = C.g_get_home_dir() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// GetHostName: return a name for the machine. +// +// The returned name is not necessarily a fully-qualified domain name, +// or even present in DNS or some other name service at all. It need not even +// be unique on your local network or site, but usually it is. Callers should +// not rely on the return value having any specific properties like uniqueness +// for security purposes. Even if the name of the machine is changed while an +// application is running, the return value from this function does not change. +// The returned string is owned by GLib and should not be modified or freed. +// If no name can be determined, a default fixed string "localhost" is returned. +// +// The encoding of the returned string is UTF-8. +// +// The function returns the following values: +// +// - utf8: host name of the machine. +func GetHostName() string { + var _cret *C.gchar // in + + _cret = C.g_get_host_name() + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// GetLanguageNames computes a list of applicable locale names, which can +// be used to e.g. construct locale-dependent filenames or search paths. +// The returned list is sorted from most desirable to least desirable and always +// contains the default locale "C". +// +// For example, if LANGUAGE=de:en_US, then the returned list is "de", "en_US", +// "en", "C". +// +// This function consults the environment variables LANGUAGE, LC_ALL, +// LC_MESSAGES and LANG to find the list of locales specified by the user. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of strings owned by GLib that must not be +// modified or freed. +func GetLanguageNames() []string { + var _cret **C.gchar // in + + _cret = C.g_get_language_names() + + var _utf8s []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// GetLanguageNamesWithCategory computes a list of applicable locale names +// with a locale category name, which can be used to construct the fallback +// locale-dependent filenames or search paths. The returned list is sorted from +// most desirable to least desirable and always contains the default locale "C". +// +// This function consults the environment variables LANGUAGE, LC_ALL, +// category_name, and LANG to find the list of locales specified by the user. +// +// g_get_language_names() returns +// g_get_language_names_with_category("LC_MESSAGES"). +// +// The function takes the following parameters: +// +// - categoryName: locale category name. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of strings owned by the thread +// g_get_language_names_with_category was called from. It must not be +// modified or freed. It must be copied if planned to be used in another +// thread. +func GetLanguageNamesWithCategory(categoryName string) []string { + var _arg1 *C.gchar // out + var _cret **C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(categoryName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_get_language_names_with_category(_arg1) + runtime.KeepAlive(categoryName) + + var _utf8s []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// GetLocaleVariants returns a list of derived variants of locale, which can +// be used to e.g. construct locale-dependent filenames or search paths. The +// returned list is sorted from most desirable to least desirable. This function +// handles territory, charset and extra locale modifiers. See setlocale(3) +// (man:setlocale) for information about locales and their format. +// +// locale itself is guaranteed to be returned in the output. +// +// For example, if locale is fr_BE, then the returned list is fr_BE, fr. +// If locale is en_GB.UTF-8euro, then the returned list is en_GB.UTF-8euro, +// en_GB.UTF-8, en_GBeuro, en_GB, en.UTF-8euro, en.UTF-8, eneuro, en. +// +// If you need the list of variants for the current locale, use +// g_get_language_names(). +// +// The function takes the following parameters: +// +// - locale identifier. +// +// The function returns the following values: +// +// - utf8s: newly allocated array of newly allocated strings with the locale +// variants. Free with g_strfreev(). +func GetLocaleVariants(locale string) []string { + var _arg1 *C.gchar // out + var _cret **C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(locale))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_get_locale_variants(_arg1) + runtime.KeepAlive(locale) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// GetMonotonicTime queries the system monotonic time. +// +// The monotonic clock will always increase and doesn't suffer discontinuities +// when the user (or NTP) changes the system time. It may or may not continue to +// tick during times where the machine is suspended. +// +// We try to use the clock that corresponds as closely as possible to the +// passage of time as measured by system calls such as poll() but it may not +// always be possible to do this. +// +// The function returns the following values: +// +// - gint64: monotonic time, in microseconds. +func GetMonotonicTime() int64 { + var _cret C.gint64 // in + + _cret = C.g_get_monotonic_time() + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// GetOsInfo: get information about the operating system. +// +// On Linux this comes from the /etc/os-release file. On other systems, +// it may come from a variety of sources. You can either use the standard key +// names like G_OS_INFO_KEY_NAME or pass any UTF-8 string key name. For example, +// /etc/os-release provides a number of other less commonly used values that may +// be useful. No key is guaranteed to be provided, so the caller should always +// check if the result is NULL. +// +// The function takes the following parameters: +// +// - keyName: key for the OS info being requested, for example +// G_OS_INFO_KEY_NAME. +// +// The function returns the following values: +// +// - utf8 (optional): associated value for the requested key or NULL if this +// information is not provided. +func GetOsInfo(keyName string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(keyName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_get_os_info(_arg1) + runtime.KeepAlive(keyName) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// GetPrgname gets the name of the program. This name should not be localized, +// in contrast to g_get_application_name(). +// +// If you are using #GApplication the program name is set in +// g_application_run(). In case of GDK or GTK it is set in gdk_init(), which is +// called by gtk_init() and the Application::startup handler. The program name +// is found by taking the last component of argv[0]. +// +// The function returns the following values: +// +// - utf8 (optional): name of the program, or NULL if it has not been set yet. +// The returned string belongs to GLib and must not be modified or freed. +func GetPrgname() string { + var _cret *C.gchar // in + + _cret = C.g_get_prgname() + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// GetRealName gets the real name of the user. This usually comes from the +// user's entry in the passwd file. The encoding of the returned string is +// system-defined. (On Windows, it is, however, always UTF-8.) If the real user +// name cannot be determined, the string "Unknown" is returned. +// +// The function returns the following values: +// +// - filename user's real name. +func GetRealName() string { + var _cret *C.gchar // in + + _cret = C.g_get_real_name() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// GetRealTime queries the system wall-clock time. +// +// This call is functionally equivalent to g_get_current_time() except that the +// return value is often more convenient than dealing with a Val. +// +// You should only use this call if you are actually interested in the real +// wall-clock time. g_get_monotonic_time() is probably more useful for measuring +// intervals. +// +// The function returns the following values: +// +// - gint64: number of microseconds since January 1, 1970 UTC. +func GetRealTime() int64 { + var _cret C.gint64 // in + + _cret = C.g_get_real_time() + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// GetSystemConfigDirs returns an ordered list of base directories in which to +// access system-wide configuration information. +// +// On UNIX platforms this is determined using the mechanisms +// described in the XDG Base Directory Specification +// (http://www.freedesktop.org/Standards/basedir-spec). In this case the list of +// directories retrieved will be XDG_CONFIG_DIRS. +// +// On Windows it follows XDG Base Directory Specification if XDG_CONFIG_DIRS +// is defined. If XDG_CONFIG_DIRS is undefined, the directory that contains +// application data for all users is used instead. A typical path is +// C:\Documents and Settings\All Users\Application Data. This folder is used for +// application data that is not user specific. For example, an application can +// store a spell-check dictionary, a database of clip art, or a log file in the +// FOLDERID_ProgramData folder. This information will not roam and is available +// to anyone using the computer. +// +// The return value is cached and modifying it at runtime is not supported, +// as it’s not thread-safe to modify environment variables at runtime. +// +// The function returns the following values: +// +// - filenames: a NULL-terminated array of strings owned by GLib that must not +// be modified or freed. +func GetSystemConfigDirs() []string { + var _cret **C.gchar // in + + _cret = C.g_get_system_config_dirs() + + var _filenames []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _filenames = make([]string, i) + for i := range src { + _filenames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _filenames +} + +// GetSystemDataDirs returns an ordered list of base directories in which to +// access system-wide application data. +// +// On UNIX platforms this is determined using the mechanisms +// described in the XDG Base Directory Specification +// (http://www.freedesktop.org/Standards/basedir-spec) In this case the list of +// directories retrieved will be XDG_DATA_DIRS. +// +// On Windows it follows XDG Base Directory Specification if XDG_DATA_DIRS is +// defined. If XDG_DATA_DIRS is undefined, the first elements in the list are +// the Application Data and Documents folders for All Users. (These can be +// determined only on Windows 2000 or later and are not present in the list +// on other Windows versions.) See documentation for FOLDERID_ProgramData and +// FOLDERID_PublicDocuments. +// +// Then follows the "share" subfolder in the installation folder for the package +// containing the DLL that calls this function, if it can be determined. +// +// Finally the list contains the "share" subfolder in the installation folder +// for GLib, and in the installation folder for the package the application's +// .exe file belongs to. +// +// The installation folders above are determined by looking up the folder where +// the module (DLL or EXE) in question is located. If the folder's name is +// "bin", its parent is used, otherwise the folder itself. +// +// Note that on Windows the returned list can vary depending on where this +// function is called. +// +// The return value is cached and modifying it at runtime is not supported, +// as it’s not thread-safe to modify environment variables at runtime. +// +// The function returns the following values: +// +// - filenames: a NULL-terminated array of strings owned by GLib that must not +// be modified or freed. +func GetSystemDataDirs() []string { + var _cret **C.gchar // in + + _cret = C.g_get_system_data_dirs() + + var _filenames []string // out + + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _filenames = make([]string, i) + for i := range src { + _filenames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _filenames +} + +// GetTmpDir gets the directory to use for temporary files. +// +// On UNIX, this is taken from the TMPDIR environment variable. If the variable +// is not set, P_tmpdir is used, as defined by the system C library. Failing +// that, a hard-coded default of "/tmp" is returned. +// +// On Windows, the TEMP environment variable is used, with the root directory of +// the Windows installation (eg: "C:\") used as a default. +// +// The encoding of the returned string is system-defined. On Windows, it is +// always UTF-8. The return value is never NULL or the empty string. +// +// The function returns the following values: +// +// - filename: directory to use for temporary files. +func GetTmpDir() string { + var _cret *C.gchar // in + + _cret = C.g_get_tmp_dir() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// GetUserCacheDir returns a base directory in which to store non-essential, +// cached data specific to particular user. +// +// On UNIX platforms this is determined using the mechanisms +// described in the XDG Base Directory Specification +// (http://www.freedesktop.org/Standards/basedir-spec). In this case the +// directory retrieved will be XDG_CACHE_HOME. +// +// On Windows it follows XDG Base Directory Specification if XDG_CACHE_HOME +// is defined. If XDG_CACHE_HOME is undefined, the directory that serves +// as a common repository for temporary Internet files is used instead. +// A typical path is C:\Documents and Settings\username\Local Settings\Temporary +// Internet Files. See the documentation for FOLDERID_InternetCache +// (https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid). +// +// The return value is cached and modifying it at runtime is not supported, +// as it’s not thread-safe to modify environment variables at runtime. +// +// The function returns the following values: +// +// - filename: string owned by GLib that must not be modified or freed. +func GetUserCacheDir() string { + var _cret *C.gchar // in + + _cret = C.g_get_user_cache_dir() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// GetUserConfigDir returns a base directory in which to store user-specific +// application configuration information such as user preferences and settings. +// +// On UNIX platforms this is determined using the mechanisms +// described in the XDG Base Directory Specification +// (http://www.freedesktop.org/Standards/basedir-spec). In this case the +// directory retrieved will be XDG_CONFIG_HOME. +// +// On Windows it follows XDG Base Directory Specification if +// XDG_CONFIG_HOME is defined. If XDG_CONFIG_HOME is undefined, +// the folder to use for local (as opposed to roaming) application data +// is used instead. See the documentation for FOLDERID_LocalAppData +// (https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid). +// Note that in this case on Windows it will be the same as what +// g_get_user_data_dir() returns. +// +// The return value is cached and modifying it at runtime is not supported, +// as it’s not thread-safe to modify environment variables at runtime. +// +// The function returns the following values: +// +// - filename: string owned by GLib that must not be modified or freed. +func GetUserConfigDir() string { + var _cret *C.gchar // in + + _cret = C.g_get_user_config_dir() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// GetUserDataDir returns a base directory in which to access application data +// such as icons that is customized for a particular user. +// +// On UNIX platforms this is determined using the mechanisms +// described in the XDG Base Directory Specification +// (http://www.freedesktop.org/Standards/basedir-spec). In this case the +// directory retrieved will be XDG_DATA_HOME. +// +// On Windows it follows XDG Base Directory Specification if +// XDG_DATA_HOME is defined. If XDG_DATA_HOME is undefined, +// the folder to use for local (as opposed to roaming) application data +// is used instead. See the documentation for FOLDERID_LocalAppData +// (https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid). +// Note that in this case on Windows it will be the same as what +// g_get_user_config_dir() returns. +// +// The return value is cached and modifying it at runtime is not supported, +// as it’s not thread-safe to modify environment variables at runtime. +// +// The function returns the following values: +// +// - filename: string owned by GLib that must not be modified or freed. +func GetUserDataDir() string { + var _cret *C.gchar // in + + _cret = C.g_get_user_data_dir() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// GetUserName gets the user name of the current user. The encoding of the +// returned string is system-defined. On UNIX, it might be the preferred file +// name encoding, or something else, and there is no guarantee that it is even +// consistent on a machine. On Windows, it is always UTF-8. +// +// The function returns the following values: +// +// - filename: user name of the current user. +func GetUserName() string { + var _cret *C.gchar // in + + _cret = C.g_get_user_name() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// GetUserRuntimeDir returns a directory that is unique to the current user on +// the local system. +// +// This is determined using the mechanisms described in the XDG Base Directory +// Specification (http://www.freedesktop.org/Standards/basedir-spec). +// This is the directory specified in the XDG_RUNTIME_DIR environment variable. +// In the case that this variable is not set, we return the value of +// g_get_user_cache_dir(), after verifying that it exists. +// +// The return value is cached and modifying it at runtime is not supported, +// as it’s not thread-safe to modify environment variables at runtime. +// +// The function returns the following values: +// +// - filename: string owned by GLib that must not be modified or freed. +func GetUserRuntimeDir() string { + var _cret *C.gchar // in + + _cret = C.g_get_user_runtime_dir() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// GetUserSpecialDir returns the full path of a special directory using its +// logical id. +// +// On UNIX this is done using the XDG special user directories. For +// compatibility with existing practise, G_USER_DIRECTORY_DESKTOP falls back to +// $HOME/Desktop when XDG special user directories have not been set up. +// +// Depending on the platform, the user might be able to change the path of the +// special directory without requiring the session to restart; GLib will not +// reflect any change once the special directories are loaded. +// +// The function takes the following parameters: +// +// - directory: logical id of special directory. +// +// The function returns the following values: +// +// - filename (optional): path to the specified special directory, or NULL if +// the logical id was not found. The returned string is owned by GLib and +// should not be modified or freed. +func GetUserSpecialDir(directory UserDirectory) string { + var _arg1 C.GUserDirectory // out + var _cret *C.gchar // in + + _arg1 = C.GUserDirectory(directory) + + _cret = C.g_get_user_special_dir(_arg1) + runtime.KeepAlive(directory) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// GetUserStateDir returns a base directory in which to store state files +// specific to particular user. +// +// On UNIX platforms this is determined using the mechanisms +// described in the XDG Base Directory Specification +// (http://www.freedesktop.org/Standards/basedir-spec). In this case the +// directory retrieved will be XDG_STATE_HOME. +// +// On Windows it follows XDG Base Directory Specification if +// XDG_STATE_HOME is defined. If XDG_STATE_HOME is undefined, +// the folder to use for local (as opposed to roaming) application data +// is used instead. See the documentation for FOLDERID_LocalAppData +// (https://docs.microsoft.com/en-us/windows/win32/shell/knownfolderid). +// Note that in this case on Windows it will be the same as what +// g_get_user_data_dir() returns. +// +// The return value is cached and modifying it at runtime is not supported, +// as it’s not thread-safe to modify environment variables at runtime. +// +// The function returns the following values: +// +// - filename: string owned by GLib that must not be modified or freed. +func GetUserStateDir() string { + var _cret *C.gchar // in + + _cret = C.g_get_user_state_dir() + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// Getenv returns the value of an environment variable. +// +// On UNIX, the name and value are byte strings which might or might not be in +// some consistent character set and encoding. On Windows, they are in UTF-8. +// On Windows, in case the environment variable's value contains references to +// other environment variables, they are expanded. +// +// The function takes the following parameters: +// +// - variable: environment variable to get. +// +// The function returns the following values: +// +// - filename (optional): value of the environment variable, or NULL if the +// environment variable is not found. The returned string may be overwritten +// by the next call to g_getenv(), g_setenv() or g_unsetenv(). +func Getenv(variable string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(variable))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_getenv(_arg1) + runtime.KeepAlive(variable) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// HostnameIsASCIIEncoded tests if hostname contains segments with an +// ASCII-compatible encoding of an Internationalized Domain Name. If this +// returns TRUE, you should decode the hostname with g_hostname_to_unicode() +// before displaying it to the user. +// +// Note that a hostname might contain a mix of encoded and unencoded +// segments, and so it is possible for g_hostname_is_non_ascii() and +// g_hostname_is_ascii_encoded() to both return TRUE for a name. +// +// The function takes the following parameters: +// +// - hostname: hostname. +// +// The function returns the following values: +// +// - ok: TRUE if hostname contains any ASCII-encoded segments. +func HostnameIsASCIIEncoded(hostname string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_hostname_is_ascii_encoded(_arg1) + runtime.KeepAlive(hostname) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HostnameIsIPAddress tests if hostname is the string form of an IPv4 or IPv6 +// address. (Eg, "192.168.0.1".) +// +// Since 2.66, IPv6 addresses with a zone-id are accepted (RFC6874). +// +// The function takes the following parameters: +// +// - hostname (or IP address in string form). +// +// The function returns the following values: +// +// - ok: TRUE if hostname is an IP address. +func HostnameIsIPAddress(hostname string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_hostname_is_ip_address(_arg1) + runtime.KeepAlive(hostname) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HostnameIsNonASCII tests if hostname contains Unicode characters. If this +// returns TRUE, you need to encode the hostname with g_hostname_to_ascii() +// before using it in non-IDN-aware contexts. +// +// Note that a hostname might contain a mix of encoded and unencoded +// segments, and so it is possible for g_hostname_is_non_ascii() and +// g_hostname_is_ascii_encoded() to both return TRUE for a name. +// +// The function takes the following parameters: +// +// - hostname: hostname. +// +// The function returns the following values: +// +// - ok: TRUE if hostname contains any non-ASCII characters. +func HostnameIsNonASCII(hostname string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_hostname_is_non_ascii(_arg1) + runtime.KeepAlive(hostname) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HostnameToASCII converts hostname to its canonical ASCII form; an ASCII-only +// string containing no uppercase letters and not ending with a trailing dot. +// +// The function takes the following parameters: +// +// - hostname: valid UTF-8 or ASCII hostname. +// +// The function returns the following values: +// +// - utf8 (optional): ASCII hostname, which must be freed, or NULL if hostname +// is in some way invalid. +func HostnameToASCII(hostname string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_hostname_to_ascii(_arg1) + runtime.KeepAlive(hostname) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// HostnameToUnicode converts hostname to its canonical presentation form; +// a UTF-8 string in Unicode normalization form C, containing no uppercase +// letters, no forbidden characters, and no ASCII-encoded segments, and not +// ending with a trailing dot. +// +// Of course if hostname is not an internationalized hostname, then the +// canonical presentation form will be entirely ASCII. +// +// The function takes the following parameters: +// +// - hostname: valid UTF-8 or ASCII hostname. +// +// The function returns the following values: +// +// - utf8 (optional): UTF-8 hostname, which must be freed, or NULL if hostname +// is in some way invalid. +func HostnameToUnicode(hostname string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(hostname))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_hostname_to_unicode(_arg1) + runtime.KeepAlive(hostname) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// IdleRemoveByData removes the idle function with the given data. +// +// The function takes the following parameters: +// +// - data (optional) for the idle source's callback. +// +// The function returns the following values: +// +// - ok: TRUE if an idle source was found and removed. +func IdleRemoveByData(data unsafe.Pointer) bool { + var _arg1 C.gpointer // out + var _cret C.gboolean // in + + _arg1 = (C.gpointer)(unsafe.Pointer(data)) + + _cret = C.g_idle_remove_by_data(_arg1) + runtime.KeepAlive(data) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// NewIdleSource creates a new idle source. +// +// The source will not initially be associated with any Context and must be +// added to one with g_source_attach() before it will be executed. Note that the +// default priority for idle sources is G_PRIORITY_DEFAULT_IDLE, as compared to +// other sources which have a default priority of G_PRIORITY_DEFAULT. +// +// The function returns the following values: +// +// - source: newly-created idle source. +func NewIdleSource() *Source { + var _cret *C.GSource // in + + _cret = C.g_idle_source_new() + + var _source *Source // out + + _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// Int64Equal compares the two #gint64 values being pointed to and returns +// TRUE if they are equal. It can be passed to g_hash_table_new() as the +// key_equal_func parameter, when using non-NULL pointers to 64-bit integers as +// keys in a Table. +// +// The function takes the following parameters: +// +// - v1: pointer to a #gint64 key. +// - v2: pointer to a #gint64 key to compare with v1. +// +// The function returns the following values: +// +// - ok: TRUE if the two keys match. +func Int64Equal(v1, v2 unsafe.Pointer) bool { + var _arg1 C.gconstpointer // out + var _arg2 C.gconstpointer // out + var _cret C.gboolean // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v1)) + _arg2 = (C.gconstpointer)(unsafe.Pointer(v2)) + + _cret = C.g_int64_equal(_arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Int64Hash converts a pointer to a #gint64 to a hash value. +// +// It can be passed to g_hash_table_new() as the hash_func parameter, when using +// non-NULL pointers to 64-bit integer values as keys in a Table. +// +// The function takes the following parameters: +// +// - v: pointer to a #gint64 key. +// +// The function returns the following values: +// +// - guint: hash value corresponding to the key. +func Int64Hash(v unsafe.Pointer) uint { + var _arg1 C.gconstpointer // out + var _cret C.guint // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v)) + + _cret = C.g_int64_hash(_arg1) + runtime.KeepAlive(v) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// IntEqual compares the two #gint values being pointed to and returns TRUE if +// they are equal. It can be passed to g_hash_table_new() as the key_equal_func +// parameter, when using non-NULL pointers to integers as keys in a Table. +// +// Note that this function acts on pointers to #gint, not on #gint directly: +// if your hash table's keys are of the form GINT_TO_POINTER (n), use +// g_direct_equal() instead. +// +// The function takes the following parameters: +// +// - v1: pointer to a #gint key. +// - v2: pointer to a #gint key to compare with v1. +// +// The function returns the following values: +// +// - ok: TRUE if the two keys match. +func IntEqual(v1, v2 unsafe.Pointer) bool { + var _arg1 C.gconstpointer // out + var _arg2 C.gconstpointer // out + var _cret C.gboolean // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v1)) + _arg2 = (C.gconstpointer)(unsafe.Pointer(v2)) + + _cret = C.g_int_equal(_arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IntHash converts a pointer to a #gint to a hash value. It can be passed to +// g_hash_table_new() as the hash_func parameter, when using non-NULL pointers +// to integer values as keys in a Table. +// +// Note that this function acts on pointers to #gint, not on #gint directly: +// if your hash table's keys are of the form GINT_TO_POINTER (n), use +// g_direct_hash() instead. +// +// The function takes the following parameters: +// +// - v: pointer to a #gint key. +// +// The function returns the following values: +// +// - guint: hash value corresponding to the key. +func IntHash(v unsafe.Pointer) uint { + var _arg1 C.gconstpointer // out + var _cret C.guint // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v)) + + _cret = C.g_int_hash(_arg1) + runtime.KeepAlive(v) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// InternStaticString returns a canonical representation for string. +// Interned strings can be compared for equality by comparing the pointers, +// instead of using strcmp(). g_intern_static_string() does not copy the string, +// therefore string must not be freed or modified. +// +// This function must not be used before library constructors have finished +// running. In particular, this means it cannot be used to initialize global +// variables in C++. +// +// The function takes the following parameters: +// +// - str (optional): static string. +// +// The function returns the following values: +// +// - utf8: canonical representation for the string. +func InternStaticString(str string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + if str != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_intern_static_string(_arg1) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// InternString returns a canonical representation for string. Interned strings +// can be compared for equality by comparing the pointers, instead of using +// strcmp(). +// +// This function must not be used before library constructors have finished +// running. In particular, this means it cannot be used to initialize global +// variables in C++. +// +// The function takes the following parameters: +// +// - str (optional): string. +// +// The function returns the following values: +// +// - utf8: canonical representation for the string. +func InternString(str string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + if str != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_intern_string(_arg1) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// IOCreateWatch creates a #GSource that's dispatched when condition is met for +// the given channel. For example, if condition is G_IO_IN, the source will be +// dispatched when there's data available for reading. +// +// The callback function invoked by the #GSource should be added with +// g_source_set_callback(), but it has type OFunc (not Func). +// +// g_io_add_watch() is a simpler interface to this same functionality, for the +// case where you want to add the source to the default main loop context at the +// default priority. +// +// On Windows, polling a #GSource created to watch a channel for a socket puts +// the socket in non-blocking mode. This is a side-effect of the implementation +// and unavoidable. +// +// The function takes the following parameters: +// +// - channel to watch. +// - condition conditions to watch for. +// +// The function returns the following values: +// +// - source: new #GSource. +func IOCreateWatch(channel *IOChannel, condition IOCondition) *Source { + var _arg1 *C.GIOChannel // out + var _arg2 C.GIOCondition // out + var _cret *C.GSource // in + + _arg1 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg2 = C.GIOCondition(condition) + + _cret = C.g_io_create_watch(_arg1, _arg2) + runtime.KeepAlive(channel) + runtime.KeepAlive(condition) + + var _source *Source // out + + _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// Listenv gets the names of all variables set in the environment. +// +// Programs that want to be portable to Windows should typically use this +// function and g_getenv() instead of using the environ array from the C library +// directly. On Windows, the strings in the environ array are in system codepage +// encoding, while in most of the typical use cases for environment variables +// in GLib-using programs you want the UTF-8 encoding that this function and +// g_getenv() provide. +// +// The function returns the following values: +// +// - filenames: a NULL-terminated list of strings which must be freed with +// g_strfreev(). +func Listenv() []string { + var _cret **C.gchar // in + + _cret = C.g_listenv() + + var _filenames []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _filenames = make([]string, i) + for i := range src { + _filenames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _filenames +} + +// LocaleFromUTF8 converts a string from UTF-8 to the encoding used for strings +// by the C runtime (usually the same as that used by the operating system) in +// the [current locale][setlocale]. On Windows this means the system codepage. +// +// The input string shall not contain nul characters even if the len argument +// is positive. A nul character found inside the string will result in error +// G_CONVERT_ERROR_ILLEGAL_SEQUENCE. Use g_convert() to convert input that may +// contain embedded nul characters. +// +// The function takes the following parameters: +// +// - utf8String: UTF-8 encoded string. +// +// The function returns the following values: +// +// - bytesRead (optional): location to store the number of bytes in +// the input string that were successfully converted, or NULL. +// Even if the conversion was successful, this may be less than len if +// there were partial characters at the end of the input. If the error +// G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will be the +// byte offset after the last valid input sequence. +// - guint8s: A newly-allocated buffer containing the converted string, +// or NULL on an error, and error will be set. +func LocaleFromUTF8(utf8String string) (uint, []byte, error) { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 C.gsize // in + var _cret *C.gchar // in + var _arg4 C.gsize // in + var _cerr *C.GError // in + + _arg2 = (C.gssize)(len(utf8String)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(utf8String) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(utf8String)), utf8String) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_locale_from_utf8(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(utf8String) + + var _bytesRead uint // out + var _guint8s []byte // out + var _goerr error // out + + _bytesRead = uint(_arg3) + defer C.free(unsafe.Pointer(_cret)) + _guint8s = make([]byte, _arg4) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg4)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _guint8s, _goerr +} + +// LocaleToUTF8 converts a string which is in the encoding used for strings by +// the C runtime (usually the same as that used by the operating system) in the +// [current locale][setlocale] into a UTF-8 string. +// +// If the source encoding is not UTF-8 and the conversion output contains a nul +// character, the error G_CONVERT_ERROR_EMBEDDED_NUL is set and the function +// returns NULL. If the source encoding is UTF-8, an embedded nul character +// is treated with the G_CONVERT_ERROR_ILLEGAL_SEQUENCE error for backward +// compatibility with earlier versions of this library. Use g_convert() to +// produce output that may contain embedded nul characters. +// +// The function takes the following parameters: +// +// - opsysstring: string in the encoding of the current locale. On Windows +// this means the system codepage. +// +// The function returns the following values: +// +// - bytesRead (optional): location to store the number of bytes in +// the input string that were successfully converted, or NULL. +// Even if the conversion was successful, this may be less than len if +// there were partial characters at the end of the input. If the error +// G_CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will be the +// byte offset after the last valid input sequence. +// - bytesWritten (optional): number of bytes stored in the output buffer (not +// including the terminating nul). +// - utf8: converted string, or NULL on an error. +func LocaleToUTF8(opsysstring string) (bytesRead, bytesWritten uint, utf8 string, goerr error) { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 C.gsize // in + var _arg4 C.gsize // in + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg2 = (C.gssize)(len(opsysstring)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(opsysstring) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(opsysstring)), opsysstring) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_locale_to_utf8(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(opsysstring) + + var _bytesRead uint // out + var _bytesWritten uint // out + var _utf8 string // out + var _goerr error // out + + _bytesRead = uint(_arg3) + _bytesWritten = uint(_arg4) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _bytesWritten, _utf8, _goerr +} + +// LogDefaultHandler: default log handler set up by GLib; +// glib.LogSetDefaultHandler() allows to install an alternate default log +// handler. +// +// This is used if no log handler has been set for the particular log domain +// and log level combination. It outputs the message to stderr or stdout and if +// the log level is fatal it calls glib.BREAKPOINT(). It automatically prints +// a new-line character after the message, so one does not need to be manually +// included in message. +// +// The behavior of this log handler can be influenced by a number of environment +// variables: +// +// - G_MESSAGES_PREFIXED: A :-separated list of log levels for which messages +// should be prefixed by the program name and PID of the application. +// - G_MESSAGES_DEBUG: A space-separated list of log domains for which debug +// and informational messages are printed. By default these messages +// are not printed. If you need to set the allowed domains at runtime, +// use glib.LogWriterDefaultSetDebugDomains(). +// +// stderr is used for levels glib.LogLevelFlags.LEVELERROR, +// glib.LogLevelFlags.LEVELCRITICAL, glib.LogLevelFlags.LEVELWARNING and +// glib.LogLevelFlags.LEVELMESSAGE. stdout is used for the rest, unless stderr +// was requested by glib.LogWriterDefaultSetUseStderr(). +// +// This has no effect if structured logging is enabled; see Using Structured +// Logging (logging.html#using-structured-logging). +// +// The function takes the following parameters: +// +// - logDomain (optional): log domain of the message, or NULL for the default +// "" application domain. +// - logLevel: level of the message. +// - message (optional): message. +// - unusedData (optional): data passed from glib.Log() which is unused. +func LogDefaultHandler(logDomain string, logLevel LogLevelFlags, message string, unusedData unsafe.Pointer) { + var _arg1 *C.gchar // out + var _arg2 C.GLogLevelFlags // out + var _arg3 *C.gchar // out + var _arg4 C.gpointer // out + + if logDomain != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(logDomain))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = C.GLogLevelFlags(logLevel) + if message != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg3)) + } + _arg4 = (C.gpointer)(unsafe.Pointer(unusedData)) + + C.g_log_default_handler(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(logDomain) + runtime.KeepAlive(logLevel) + runtime.KeepAlive(message) + runtime.KeepAlive(unusedData) +} + +// LogGetDebugEnabled: return whether debug output from the GLib logging system +// is enabled. +// +// Note that this should not be used to conditionalise calls to glib.Debug() +// or other logging functions; it should only be used from glib.LogWriterFunc +// implementations. +// +// Note also that the value of this does not depend on G_MESSAGES_DEBUG, +// nor glib.LogWriterDefaultSetDebugDomains(); see the docs for +// glib.LogSetDebugEnabled(). +// +// The function returns the following values: +// +// - ok: TRUE if debug output is enabled, FALSE otherwise. +func LogGetDebugEnabled() bool { + var _cret C.gboolean // in + + _cret = C.g_log_get_debug_enabled() + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// LogRemoveHandler removes the log handler. +// +// This has no effect if structured logging is enabled; see Using Structured +// Logging (logging.html#using-structured-logging). +// +// The function takes the following parameters: +// +// - logDomain: log domain. +// - handlerId: ID of the handler, which was returned in glib.LogSetHandler(). +func LogRemoveHandler(logDomain string, handlerId uint) { + var _arg1 *C.gchar // out + var _arg2 C.guint // out + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(logDomain))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint(handlerId) + + C.g_log_remove_handler(_arg1, _arg2) + runtime.KeepAlive(logDomain) + runtime.KeepAlive(handlerId) +} + +// LogSetAlwaysFatal sets the message levels which are always fatal, in any log +// domain. +// +// When a message with any of these levels is logged the program +// terminates. You can only set the levels defined by GLib to be fatal. +// glib.LogLevelFlags.LEVELERROR is always fatal. +// +// You can also make some message levels fatal at runtime by setting the G_DEBUG +// environment variable (see Running GLib Applications (glib-running.html)). +// +// Libraries should not call this function, as it affects all messages logged by +// a process, including those from other libraries. +// +// Structured log messages (using glib.LogStructured() and +// glib.LogStructuredArray()) are fatal only if the default log writer is used; +// otherwise it is up to the writer function to determine which log messages are +// fatal. See Using Structured Logging (logging.html#using-structured-logging). +// +// The function takes the following parameters: +// +// - fatalMask: mask containing bits set for each level of error which is to +// be fatal. +// +// The function returns the following values: +// +// - logLevelFlags: old fatal mask. +func LogSetAlwaysFatal(fatalMask LogLevelFlags) LogLevelFlags { + var _arg1 C.GLogLevelFlags // out + var _cret C.GLogLevelFlags // in + + _arg1 = C.GLogLevelFlags(fatalMask) + + _cret = C.g_log_set_always_fatal(_arg1) + runtime.KeepAlive(fatalMask) + + var _logLevelFlags LogLevelFlags // out + + _logLevelFlags = LogLevelFlags(_cret) + + return _logLevelFlags +} + +// LogSetDebugEnabled: enable or disable debug output from the GLib logging +// system for all domains. +// +// This value interacts disjunctively with G_MESSAGES_DEBUG and +// glib.LogWriterDefaultSetDebugDomains() — if any of them would allow a debug +// message to be outputted, it will be. +// +// Note that this should not be used from within library code to enable debug +// output — it is intended for external use. +// +// The function takes the following parameters: +// +// - enabled: TRUE to enable debug output, FALSE otherwise. +func LogSetDebugEnabled(enabled bool) { + var _arg1 C.gboolean // out + + if enabled { + _arg1 = C.TRUE + } + + C.g_log_set_debug_enabled(_arg1) + runtime.KeepAlive(enabled) +} + +// LogSetFatalMask sets the log levels which are fatal in the given domain. +// +// glib.LogLevelFlags.LEVELERROR is always fatal. +// +// This has no effect on structured log messages (using glib.LogStructured() +// or glib.LogStructuredArray()). To change the fatal behaviour for +// specific log messages, programs must install a custom log writer +// function using glib.LogSetWriterFunc(). See Using Structured Logging +// (logging.html#using-structured-logging). +// +// This function is mostly intended to be used with +// glib.LogLevelFlags.LEVELCRITICAL. You should typically not set +// glib.LogLevelFlags.LEVELWARNING, glib.LogLevelFlags.LEVELMESSAGE, +// glib.LogLevelFlags.LEVELINFO or glib.LogLevelFlags.LEVELDEBUG as fatal except +// inside of test programs. +// +// The function takes the following parameters: +// +// - logDomain: log domain. +// - fatalMask: new fatal mask. +// +// The function returns the following values: +// +// - logLevelFlags: old fatal mask for the log domain. +func LogSetFatalMask(logDomain string, fatalMask LogLevelFlags) LogLevelFlags { + var _arg1 *C.gchar // out + var _arg2 C.GLogLevelFlags // out + var _cret C.GLogLevelFlags // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(logDomain))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GLogLevelFlags(fatalMask) + + _cret = C.g_log_set_fatal_mask(_arg1, _arg2) + runtime.KeepAlive(logDomain) + runtime.KeepAlive(fatalMask) + + var _logLevelFlags LogLevelFlags // out + + _logLevelFlags = LogLevelFlags(_cret) + + return _logLevelFlags +} + +// LogStructuredArray: log a message with structured data. +// +// The message will be passed through to the log writer set by the application +// using glib.LogSetWriterFunc(). If the message is fatal (i.e. its log level +// is glib.LogLevelFlags.LEVELERROR), the program will be aborted at the end of +// this function. +// +// See glib.LogStructured() for more documentation. +// +// This assumes that log_level is already present in fields (typically as the +// PRIORITY field). +// +// The function takes the following parameters: +// +// - logLevel: log level, either from glib.LogLevelFlags, or a user-defined +// level. +// - fields: key–value pairs of structured data to add to the log message. +func LogStructuredArray(logLevel LogLevelFlags, fields []LogField) { + var _arg1 C.GLogLevelFlags // out + var _arg2 *C.GLogField // out + var _arg3 C.gsize + + _arg1 = C.GLogLevelFlags(logLevel) + _arg3 = (C.gsize)(len(fields)) + _arg2 = (*C.GLogField)(C.calloc(C.size_t(len(fields)), C.size_t(C.sizeof_GLogField))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GLogField)(_arg2), len(fields)) + for i := range fields { + out[i] = *(*C.GLogField)(gextras.StructNative(unsafe.Pointer((&fields[i])))) + } + } + + C.g_log_structured_array(_arg1, _arg2, _arg3) + runtime.KeepAlive(logLevel) + runtime.KeepAlive(fields) +} + +// LogVariant: log a message with structured data, accepting the data within a +// glib.Variant. +// +// This version is especially useful for use in other languages, via +// introspection. +// +// The only mandatory item in the fields dictionary is the "MESSAGE" which must +// contain the text shown to the user. +// +// The values in the fields dictionary are likely to be of type +// G_VARIANT_TYPE_STRING. Array of bytes (G_VARIANT_TYPE_BYTESTRING) is +// also supported. In this case the message is handled as binary and will +// be forwarded to the log writer as such. The size of the array should not +// be higher than G_MAXSSIZE. Otherwise it will be truncated to this size. +// For other types glib.Variant.Print() will be used to convert the value into a +// string. +// +// For more details on its usage and about the parameters, see +// glib.LogStructured(). +// +// The function takes the following parameters: +// +// - logDomain (optional): log domain, usually G_LOG_DOMAIN. +// - logLevel: log level, either from glib.LogLevelFlags, or a user-defined +// level. +// - fields: dictionary (glib.Variant of the type G_VARIANT_TYPE_VARDICT) +// containing the key-value pairs of message data. +func LogVariant(logDomain string, logLevel LogLevelFlags, fields *Variant) { + var _arg1 *C.gchar // out + var _arg2 C.GLogLevelFlags // out + var _arg3 *C.GVariant // out + + if logDomain != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(logDomain))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = C.GLogLevelFlags(logLevel) + _arg3 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(fields))) + + C.g_log_variant(_arg1, _arg2, _arg3) + runtime.KeepAlive(logDomain) + runtime.KeepAlive(logLevel) + runtime.KeepAlive(fields) +} + +// LogWriterDefault: format a structured log message and output it to the +// default log destination for the platform. +// +// On Linux, this is typically the systemd journal, falling back to stdout or +// stderr if running from the terminal or if output is being redirected to a +// file. +// +// Support for other platform-specific logging mechanisms may be added in +// future. Distributors of GLib may modify this function to impose their own +// (documented) platform-specific log writing policies. +// +// This is suitable for use as a glib.LogWriterFunc, and is the default writer +// used if no other is set using glib.LogSetWriterFunc(). +// +// As with glib.LogDefaultHandler(), this function drops debug and +// informational messages unless their log domain (or all) is listed in the +// space-separated G_MESSAGES_DEBUG environment variable, or set at runtime by +// glib.LogWriterDefaultSetDebugDomains(). +// +// glib.LogWriterDefault() uses the mask set by glib.LogSetAlwaysFatal() to +// determine which messages are fatal. When using a custom writer function +// instead it is up to the writer function to determine which log messages are +// fatal. +// +// The function takes the following parameters: +// +// - logLevel: log level, either from glib.LogLevelFlags, or a user-defined +// level. +// - fields: key–value pairs of structured data forming the log message. +// - userData (optional): user data passed to glib.LogSetWriterFunc(). +// +// The function returns the following values: +// +// - logWriterOutput: glib.LogWriterOutput.HANDLED on success, +// glib.LogWriterOutput.UNHANDLED otherwise. +func LogWriterDefault(logLevel LogLevelFlags, fields []LogField, userData unsafe.Pointer) LogWriterOutput { + var _arg1 C.GLogLevelFlags // out + var _arg2 *C.GLogField // out + var _arg3 C.gsize + var _arg4 C.gpointer // out + var _cret C.GLogWriterOutput // in + + _arg1 = C.GLogLevelFlags(logLevel) + _arg3 = (C.gsize)(len(fields)) + _arg2 = (*C.GLogField)(C.calloc(C.size_t(len(fields)), C.size_t(C.sizeof_GLogField))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GLogField)(_arg2), len(fields)) + for i := range fields { + out[i] = *(*C.GLogField)(gextras.StructNative(unsafe.Pointer((&fields[i])))) + } + } + _arg4 = (C.gpointer)(unsafe.Pointer(userData)) + + _cret = C.g_log_writer_default(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(logLevel) + runtime.KeepAlive(fields) + runtime.KeepAlive(userData) + + var _logWriterOutput LogWriterOutput // out + + _logWriterOutput = LogWriterOutput(_cret) + + return _logWriterOutput +} + +// LogWriterDefaultSetUseStderr: configure whether the built-in log functions +// will output all log messages to stderr. +// +// The built-in log functions are glib.LogDefaultHandler() for the old-style +// API, and both glib.LogWriterDefault() and glib.LogWriterStandardStreams() for +// the structured API. +// +// By default, log messages of levels glib.LogLevelFlags.LEVELINFO and +// glib.LogLevelFlags.LEVELDEBUG are sent to stdout, and other log messages are +// sent to stderr. This is problematic for applications that intend to reserve +// stdout for structured output such as JSON or XML. +// +// This function sets global state. It is not thread-aware, and should be called +// at the very start of a program, before creating any other threads or creating +// objects that could create worker threads of their own. +// +// The function takes the following parameters: +// +// - useStderr: if TRUE, use stderr for log messages that would normally have +// appeared on stdout. +func LogWriterDefaultSetUseStderr(useStderr bool) { + var _arg1 C.gboolean // out + + if useStderr { + _arg1 = C.TRUE + } + + C.g_log_writer_default_set_use_stderr(_arg1) + runtime.KeepAlive(useStderr) +} + +// LogWriterDefaultWouldDrop: check whether glib.LogWriterDefault() and +// glib.LogDefaultHandler() would ignore a message with the given domain and +// level. +// +// As with glib.LogDefaultHandler(), this function drops debug and +// informational messages unless their log domain (or all) is listed +// in the space-separated G_MESSAGES_DEBUG environment variable, or by +// glib.LogWriterDefaultSetDebugDomains(). +// +// This can be used when implementing log writers with the same filtering +// behaviour as the default, but a different destination or output format: +// +// if (g_log_writer_default_would_drop (log_level, log_domain)) +// return G_LOG_WRITER_HANDLED; +// ]| +// +// or to skip an expensive computation if it is only needed for a debugging +// message, and G_MESSAGES_DEBUG is not set: +// +// c if (!g_log_writer_default_would_drop (G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN)) { +// g_autofree gchar *result = expensive_computation (my_object); +// +// g_debug ("my_object result: s", result); +// }. +// +// ` +// +// The function takes the following parameters: +// +// - logLevel: log level, either from glib.LogLevelFlags, or a user-defined +// level. +// - logDomain (optional): log domain. +// +// The function returns the following values: +// +// - ok: TRUE if the log message would be dropped by GLib’s default log +// handlers. +func LogWriterDefaultWouldDrop(logLevel LogLevelFlags, logDomain string) bool { + var _arg1 C.GLogLevelFlags // out + var _arg2 *C.char // out + var _cret C.gboolean // in + + _arg1 = C.GLogLevelFlags(logLevel) + if logDomain != "" { + _arg2 = (*C.char)(unsafe.Pointer(C.CString(logDomain))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.g_log_writer_default_would_drop(_arg1, _arg2) + runtime.KeepAlive(logLevel) + runtime.KeepAlive(logDomain) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// LogWriterFormatFields: format a structured log message as a string suitable +// for outputting to the terminal (or elsewhere). +// +// This will include the values of all fields it knows how to interpret, +// which includes MESSAGE and GLIB_DOMAIN (see the documentation for +// glib.LogStructured()). It does not include values from unknown fields. +// +// The returned string does **not** have a trailing new-line character. It is +// encoded in the character set of the current locale, which is not necessarily +// UTF-8. +// +// The function takes the following parameters: +// +// - logLevel: log level, either from glib.LogLevelFlags, or a user-defined +// level. +// - fields: key–value pairs of structured data forming the log message. +// - useColor: TRUE to use ANSI color escape sequences +// (https://en.wikipedia.org/wiki/ANSI_escape_code) when formatting the +// message, FALSE to not. +// +// The function returns the following values: +// +// - utf8: string containing the formatted log message, in the character set +// of the current locale. +func LogWriterFormatFields(logLevel LogLevelFlags, fields []LogField, useColor bool) string { + var _arg1 C.GLogLevelFlags // out + var _arg2 *C.GLogField // out + var _arg3 C.gsize + var _arg4 C.gboolean // out + var _cret *C.gchar // in + + _arg1 = C.GLogLevelFlags(logLevel) + _arg3 = (C.gsize)(len(fields)) + _arg2 = (*C.GLogField)(C.calloc(C.size_t(len(fields)), C.size_t(C.sizeof_GLogField))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GLogField)(_arg2), len(fields)) + for i := range fields { + out[i] = *(*C.GLogField)(gextras.StructNative(unsafe.Pointer((&fields[i])))) + } + } + if useColor { + _arg4 = C.TRUE + } + + _cret = C.g_log_writer_format_fields(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(logLevel) + runtime.KeepAlive(fields) + runtime.KeepAlive(useColor) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// LogWriterIsJournald: check whether the given output_fd file descriptor is +// a connection to the systemd journal, or something else (like a log file or +// stdout or stderr). +// +// Invalid file descriptors are accepted and return FALSE, which allows for the +// following construct without needing any additional error handling: +// +// is_journald = g_log_writer_is_journald (fileno (stderr));. +// +// The function takes the following parameters: +// +// - outputFd: output file descriptor to check. +// +// The function returns the following values: +// +// - ok: TRUE if output_fd points to the journal, FALSE otherwise. +func LogWriterIsJournald(outputFd int) bool { + var _arg1 C.gint // out + var _cret C.gboolean // in + + _arg1 = C.gint(outputFd) + + _cret = C.g_log_writer_is_journald(_arg1) + runtime.KeepAlive(outputFd) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// LogWriterJournald: format a structured log message and send it to the systemd +// journal as a set of key–value pairs. +// +// All fields are sent to the journal, but if a field has length zero +// (indicating program-specific data) then only its key will be sent. +// +// This is suitable for use as a glib.LogWriterFunc. +// +// If GLib has been compiled without systemd support, this function is still +// defined, but will always return glib.LogWriterOutput.UNHANDLED. +// +// The function takes the following parameters: +// +// - logLevel: log level, either from glib.LogLevelFlags, or a user-defined +// level. +// - fields: key–value pairs of structured data forming the log message. +// - userData (optional): user data passed to glib.LogSetWriterFunc(). +// +// The function returns the following values: +// +// - logWriterOutput: glib.LogWriterOutput.HANDLED on success, +// glib.LogWriterOutput.UNHANDLED otherwise. +func LogWriterJournald(logLevel LogLevelFlags, fields []LogField, userData unsafe.Pointer) LogWriterOutput { + var _arg1 C.GLogLevelFlags // out + var _arg2 *C.GLogField // out + var _arg3 C.gsize + var _arg4 C.gpointer // out + var _cret C.GLogWriterOutput // in + + _arg1 = C.GLogLevelFlags(logLevel) + _arg3 = (C.gsize)(len(fields)) + _arg2 = (*C.GLogField)(C.calloc(C.size_t(len(fields)), C.size_t(C.sizeof_GLogField))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GLogField)(_arg2), len(fields)) + for i := range fields { + out[i] = *(*C.GLogField)(gextras.StructNative(unsafe.Pointer((&fields[i])))) + } + } + _arg4 = (C.gpointer)(unsafe.Pointer(userData)) + + _cret = C.g_log_writer_journald(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(logLevel) + runtime.KeepAlive(fields) + runtime.KeepAlive(userData) + + var _logWriterOutput LogWriterOutput // out + + _logWriterOutput = LogWriterOutput(_cret) + + return _logWriterOutput +} + +// LogWriterStandardStreams: format a structured log message and print it to +// either stdout or stderr, depending on its log level. +// +// glib.LogLevelFlags.LEVELINFO and glib.LogLevelFlags.LEVELDEBUG +// messages are sent to stdout, or to stderr if requested by +// glib.LogWriterDefaultSetUseStderr(); all other log levels are sent to stderr. +// Only fields which are understood by this function are included in the +// formatted string which is printed. +// +// If the output stream supports ANSI color escape sequences +// (https://en.wikipedia.org/wiki/ANSI_escape_code), they will be used in the +// output. +// +// A trailing new-line character is added to the log message when it is printed. +// +// This is suitable for use as a glib.LogWriterFunc. +// +// The function takes the following parameters: +// +// - logLevel: log level, either from glib.LogLevelFlags, or a user-defined +// level. +// - fields: key–value pairs of structured data forming the log message. +// - userData (optional): user data passed to glib.LogSetWriterFunc(). +// +// The function returns the following values: +// +// - logWriterOutput: glib.LogWriterOutput.HANDLED on success, +// glib.LogWriterOutput.UNHANDLED otherwise. +func LogWriterStandardStreams(logLevel LogLevelFlags, fields []LogField, userData unsafe.Pointer) LogWriterOutput { + var _arg1 C.GLogLevelFlags // out + var _arg2 *C.GLogField // out + var _arg3 C.gsize + var _arg4 C.gpointer // out + var _cret C.GLogWriterOutput // in + + _arg1 = C.GLogLevelFlags(logLevel) + _arg3 = (C.gsize)(len(fields)) + _arg2 = (*C.GLogField)(C.calloc(C.size_t(len(fields)), C.size_t(C.sizeof_GLogField))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GLogField)(_arg2), len(fields)) + for i := range fields { + out[i] = *(*C.GLogField)(gextras.StructNative(unsafe.Pointer((&fields[i])))) + } + } + _arg4 = (C.gpointer)(unsafe.Pointer(userData)) + + _cret = C.g_log_writer_standard_streams(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(logLevel) + runtime.KeepAlive(fields) + runtime.KeepAlive(userData) + + var _logWriterOutput LogWriterOutput // out + + _logWriterOutput = LogWriterOutput(_cret) + + return _logWriterOutput +} + +// LogWriterSupportsColor: check whether the given output_fd +// file descriptor supports ANSI color escape sequences +// (https://en.wikipedia.org/wiki/ANSI_escape_code). +// +// If so, they can safely be used when formatting log messages. +// +// The function takes the following parameters: +// +// - outputFd: output file descriptor to check. +// +// The function returns the following values: +// +// - ok: TRUE if ANSI color escapes are supported, FALSE otherwise. +func LogWriterSupportsColor(outputFd int) bool { + var _arg1 C.gint // out + var _cret C.gboolean // in + + _arg1 = C.gint(outputFd) + + _cret = C.g_log_writer_supports_color(_arg1) + runtime.KeepAlive(outputFd) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// LogWriterSyslog: format a structured log message and send it to the syslog +// daemon. Only fields which are understood by this function are included in the +// formatted string which is printed. +// +// Log facility will be defined via the SYSLOG_FACILITY field and accepts the +// following values: "auth", "daemon", and "user". If SYSLOG_FACILITY is not +// specified, LOG_USER facility will be used. +// +// This is suitable for use as a glib.LogWriterFunc. +// +// If syslog is not supported, this function is still defined, but will always +// return glib.LogWriterOutput.UNHANDLED. +// +// The function takes the following parameters: +// +// - logLevel: log level, either from glib.LogLevelFlags, or a user-defined +// level. +// - fields: key–value pairs of structured data forming the log message. +// - userData (optional): user data passed to glib.LogSetWriterFunc(). +// +// The function returns the following values: +// +// - logWriterOutput: glib.LogWriterOutput.HANDLED on success, +// glib.LogWriterOutput.UNHANDLED otherwise. +func LogWriterSyslog(logLevel LogLevelFlags, fields []LogField, userData unsafe.Pointer) LogWriterOutput { + var _arg1 C.GLogLevelFlags // out + var _arg2 *C.GLogField // out + var _arg3 C.gsize + var _arg4 C.gpointer // out + var _cret C.GLogWriterOutput // in + + _arg1 = C.GLogLevelFlags(logLevel) + _arg3 = (C.gsize)(len(fields)) + _arg2 = (*C.GLogField)(C.calloc(C.size_t(len(fields)), C.size_t(C.sizeof_GLogField))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GLogField)(_arg2), len(fields)) + for i := range fields { + out[i] = *(*C.GLogField)(gextras.StructNative(unsafe.Pointer((&fields[i])))) + } + } + _arg4 = (C.gpointer)(unsafe.Pointer(userData)) + + _cret = C.g_log_writer_syslog(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(logLevel) + runtime.KeepAlive(fields) + runtime.KeepAlive(userData) + + var _logWriterOutput LogWriterOutput // out + + _logWriterOutput = LogWriterOutput(_cret) + + return _logWriterOutput +} + +// MainCurrentSource returns the currently firing source for this thread. +// +// The function returns the following values: +// +// - source (optional): currently firing source or NULL. +func MainCurrentSource() *Source { + var _cret *C.GSource // in + + _cret = C.g_main_current_source() + + var _source *Source // out + + if _cret != nil { + _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_source_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + } + + return _source +} + +// MainDepth returns the depth of the stack of calls to +// g_main_context_dispatch() on any Context in the current thread. That is, +// when called from the toplevel, it gives 0. When called from within a +// callback from g_main_context_iteration() (or g_main_loop_run(), etc.) +// it returns 1. When called from within a callback to a recursive call to +// g_main_context_iteration(), it returns 2. And so forth. +// +// This function is useful in a situation like the following: Imagine an +// extremely simple "garbage collected" system. +// +// gpointer +// allocate_memory (gsize size) +// { +// FreeListBlock *block = g_new (FreeListBlock, 1); +// block->mem = g_malloc (size); +// block->depth = g_main_depth (); +// free_list = g_list_prepend (free_list, block); +// return block->mem; +// } +// +// void +// free_allocated_memory (void) +// { +// GList *l; +// +// int depth = g_main_depth (); +// for (l = free_list; l; ); +// { +// GList *next = l->next; +// FreeListBlock *block = l->data; +// if (block->depth > depth) +// { +// g_free (block->mem); +// g_free (block); +// free_list = g_list_delete_link (free_list, l); +// } +// +// l = next; +// } +// } +// +// There is a temptation to use g_main_depth() to solve problems with +// reentrancy. For instance, while waiting for data to be received from the +// network in response to a menu item, the menu item might be selected again. +// It might seem that one could make the menu item's callback return immediately +// and do nothing if g_main_depth() returns a value greater than 1. However, +// this should be avoided since the user then sees selecting the menu item do +// nothing. Furthermore, you'll find yourself adding these checks all over your +// code, since there are doubtless many, many things that the user could do. +// Instead, you can use the following techniques: +// +// 1. Use gtk_widget_set_sensitive() or modal dialogs to prevent the user from +// interacting with elements while the main loop is recursing. +// +// 2. Avoid main loop recursion in situations where you can't handle arbitrary +// callbacks. Instead, structure your code so that you simply return to the main +// loop and then get called again when there is more work to do. +// +// The function returns the following values: +// +// - gint: main loop recursion level in the current thread. +func MainDepth() int { + var _cret C.gint // in + + _cret = C.g_main_depth() + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +func MarkupErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_markup_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// MarkupEscapeText escapes text so that the markup parser will parse it +// verbatim. Less than, greater than, ampersand, etc. are replaced with the +// corresponding entities. This function would typically be used when writing +// out a file to be parsed with the markup parser. +// +// Note that this function doesn't protect whitespace and line endings from +// being processed according to the XML rules for normalization of line endings +// and attribute values. +// +// Note also that this function will produce character references in the range +// of  ...  for all control sequences except for tabstop, newline +// and carriage return. The character references in this range are not valid XML +// 1.0, but they are valid XML 1.1 and will be accepted by the GMarkup parser. +// +// The function takes the following parameters: +// +// - text: some valid UTF-8 text. +// +// The function returns the following values: +// +// - utf8: newly allocated string with the escaped text. +func MarkupEscapeText(text string) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(text)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(text) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(text)), text) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_markup_escape_text(_arg1, _arg2) + runtime.KeepAlive(text) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// MkdirWithParents: create a directory if it doesn't already exist. Create +// intermediate parent directories as needed, too. +// +// The function takes the following parameters: +// +// - pathname in the GLib file name encoding. +// - mode permissions to use for newly created directories. +// +// The function returns the following values: +// +// - gint: 0 if the directory already exists, or was successfully created. +// Returns -1 if an error occurred, with errno set. +func MkdirWithParents(pathname string, mode int) int { + var _arg1 *C.gchar // out + var _arg2 C.gint // out + var _cret C.gint // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(pathname))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gint(mode) + + _cret = C.g_mkdir_with_parents(_arg1, _arg2) + runtime.KeepAlive(pathname) + runtime.KeepAlive(mode) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +func NumberParserErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_number_parser_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +func OptionErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_option_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// ParseDebugString parses a string containing debugging options into a guint +// containing bit flags. This is used within GDK and GTK to parse the debug +// options passed on the command line or through environment variables. +// +// If string is equal to "all", all flags are set. Any flags specified along +// with "all" in string are inverted; thus, "all,foo,bar" or "foo,bar,all" sets +// all flags except those corresponding to "foo" and "bar". +// +// If string is equal to "help", all the available keys in keys are printed out +// to standard error. +// +// The function takes the following parameters: +// +// - str (optional): list of debug options separated by colons, spaces, +// or commas, or NULL. +// - keys: pointer to an array of Key which associate strings with bit flags. +// +// The function returns the following values: +// +// - guint: combined set of bit flags. +func ParseDebugString(str string, keys []DebugKey) uint { + var _arg1 *C.gchar // out + var _arg2 *C.GDebugKey // out + var _arg3 C.guint + var _cret C.guint // in + + if str != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg3 = (C.guint)(len(keys)) + _arg2 = (*C.GDebugKey)(C.calloc(C.size_t(len(keys)), C.size_t(C.sizeof_GDebugKey))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GDebugKey)(_arg2), len(keys)) + for i := range keys { + out[i] = *(*C.GDebugKey)(gextras.StructNative(unsafe.Pointer((&keys[i])))) + } + } + + _cret = C.g_parse_debug_string(_arg1, _arg2, _arg3) + runtime.KeepAlive(str) + runtime.KeepAlive(keys) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// PathGetBasename gets the last component of the filename. +// +// If file_name ends with a directory separator it gets the component before +// the last slash. If file_name consists only of directory separators (and +// on Windows, possibly a drive letter), a single separator is returned. +// If file_name is empty, it gets ".". +// +// The function takes the following parameters: +// +// - fileName: name of the file. +// +// The function returns the following values: +// +// - filename: newly allocated string containing the last component of the +// filename. +func PathGetBasename(fileName string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(fileName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_path_get_basename(_arg1) + runtime.KeepAlive(fileName) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _filename +} + +// PathGetDirname gets the directory components of a file name. For example, +// the directory component of /usr/bin/test is /usr/bin. The directory component +// of / is /. +// +// If the file name has no directory components "." is returned. The returned +// string should be freed when no longer needed. +// +// The function takes the following parameters: +// +// - fileName: name of the file. +// +// The function returns the following values: +// +// - filename: directory components of the file. +func PathGetDirname(fileName string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(fileName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_path_get_dirname(_arg1) + runtime.KeepAlive(fileName) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _filename +} + +// PathIsAbsolute returns TRUE if the given file_name is an absolute file name. +// Note that this is a somewhat vague concept on Windows. +// +// On POSIX systems, an absolute file name is well-defined. It always starts +// from the single root directory. For example "/usr/local". +// +// On Windows, the concepts of current drive and drive-specific current +// directory introduce vagueness. This function interprets as an absolute file +// name one that either begins with a directory separator such as "\Users\tml" +// or begins with the root on a drive, for example "C:\Windows". The first +// case also includes UNC paths such as "\\\\myserver\docs\foo". In all cases, +// either slashes or backslashes are accepted. +// +// Note that a file name relative to the current drive root does not truly +// specify a file uniquely over time and across processes, as the current drive +// is a per-process value and can be changed. +// +// File names relative the current directory on some specific drive, +// such as "D:foo/bar", are not interpreted as absolute by this function, but +// they obviously are not relative to the normal current directory as returned +// by getcwd() or g_get_current_dir() either. Such paths should be avoided, +// or need to be handled using Windows-specific code. +// +// The function takes the following parameters: +// +// - fileName: file name. +// +// The function returns the following values: +// +// - ok: TRUE if file_name is absolute. +func PathIsAbsolute(fileName string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(fileName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_path_is_absolute(_arg1) + runtime.KeepAlive(fileName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PathSkipRoot returns a pointer into file_name after the root component, i.e. +// after the "/" in UNIX or "C:\" under Windows. If file_name is not an absolute +// path it returns NULL. +// +// The function takes the following parameters: +// +// - fileName: file name. +// +// The function returns the following values: +// +// - filename (optional): pointer into file_name after the root component. +func PathSkipRoot(fileName string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(fileName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_path_skip_root(_arg1) + runtime.KeepAlive(fileName) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _filename +} + +// PatternMatchSimple matches a string against a pattern given as a string. +// If this function is to be called in a loop, it's more efficient to compile +// the pattern once with g_pattern_spec_new() and call g_pattern_match_string() +// repeatedly. +// +// The function takes the following parameters: +// +// - pattern: UTF-8 encoded pattern. +// - str: UTF-8 encoded string to match. +// +// The function returns the following values: +// +// - ok: TRUE if string matches pspec. +func PatternMatchSimple(pattern, str string) bool { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(pattern))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_pattern_match_simple(_arg1, _arg2) + runtime.KeepAlive(pattern) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// QsortWithData: this is just like the standard C qsort() function, but the +// comparison routine accepts a user data argument. +// +// This is guaranteed to be a stable sort since version 2.32. +// +// The function takes the following parameters: +// +// - pbase: start of array to sort. +// - totalElems elements in the array. +// - size of each element. +// - compareFunc: function to compare elements. +func QsortWithData(pbase unsafe.Pointer, totalElems int, size uint, compareFunc CompareDataFunc) { + var _arg1 C.gconstpointer // out + var _arg2 C.gint // out + var _arg3 C.gsize // out + var _arg4 C.GCompareDataFunc // out + var _arg5 C.gpointer + + _arg1 = (C.gconstpointer)(unsafe.Pointer(pbase)) + _arg2 = C.gint(totalElems) + _arg3 = C.gsize(size) + _arg4 = (*[0]byte)(C._gotk4_glib2_CompareDataFunc) + _arg5 = C.gpointer(gbox.Assign(compareFunc)) + defer gbox.Delete(uintptr(_arg5)) + + C.g_qsort_with_data(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(pbase) + runtime.KeepAlive(totalElems) + runtime.KeepAlive(size) + runtime.KeepAlive(compareFunc) +} + +// QuarkFromStaticString gets the #GQuark identifying the given (static) string. +// If the string does not currently have an associated #GQuark, a new #GQuark is +// created, linked to the given string. +// +// Note that this function is identical to g_quark_from_string() except that if +// a new #GQuark is created the string itself is used rather than a copy. This +// saves memory, but can only be used if the string will continue to exist until +// the program terminates. It can be used with statically allocated strings in +// the main program, but not with statically allocated memory in dynamically +// loaded modules, if you expect to ever unload the module again (e.g. do not +// use this function in GTK theme engines). +// +// This function must not be used before library constructors have finished +// running. In particular, this means it cannot be used to initialize global +// variables in C++. +// +// The function takes the following parameters: +// +// - str (optional): string. +// +// The function returns the following values: +// +// - quark identifying the string, or 0 if string is NULL. +func QuarkFromStaticString(str string) Quark { + var _arg1 *C.gchar // out + var _cret C.GQuark // in + + if str != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_quark_from_static_string(_arg1) + runtime.KeepAlive(str) + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// QuarkFromString gets the #GQuark identifying the given string. If the string +// does not currently have an associated #GQuark, a new #GQuark is created, +// using a copy of the string. +// +// This function must not be used before library constructors have finished +// running. In particular, this means it cannot be used to initialize global +// variables in C++. +// +// The function takes the following parameters: +// +// - str (optional): string. +// +// The function returns the following values: +// +// - quark identifying the string, or 0 if string is NULL. +func QuarkFromString(str string) Quark { + var _arg1 *C.gchar // out + var _cret C.GQuark // in + + if str != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_quark_from_string(_arg1) + runtime.KeepAlive(str) + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// QuarkToString gets the string associated with the given #GQuark. +// +// The function takes the following parameters: +// +// - quark: #GQuark. +// +// The function returns the following values: +// +// - utf8: string associated with the #GQuark. +func QuarkToString(quark Quark) string { + var _arg1 C.GQuark // out + var _cret *C.gchar // in + + _arg1 = C.GQuark(quark) + + _cret = C.g_quark_to_string(_arg1) + runtime.KeepAlive(quark) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// QuarkTryString gets the #GQuark associated with the given string, or 0 if +// string is NULL or it has no associated #GQuark. +// +// If you want the GQuark to be created if it doesn't already exist, use +// g_quark_from_string() or g_quark_from_static_string(). +// +// This function must not be used before library constructors have finished +// running. +// +// The function takes the following parameters: +// +// - str (optional): string. +// +// The function returns the following values: +// +// - quark associated with the string, or 0 if string is NULL or there is no +// #GQuark associated with it. +func QuarkTryString(str string) Quark { + var _arg1 *C.gchar // out + var _cret C.GQuark // in + + if str != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_quark_try_string(_arg1) + runtime.KeepAlive(str) + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// RandomDouble returns a random #gdouble equally distributed over the range +// [0..1). +// +// The function returns the following values: +// +// - gdouble: random number. +func RandomDouble() float64 { + var _cret C.gdouble // in + + _cret = C.g_random_double() + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// RandomDoubleRange returns a random #gdouble equally distributed over the +// range [begin..end). +// +// The function takes the following parameters: +// +// - begin: lower closed bound of the interval. +// - end: upper open bound of the interval. +// +// The function returns the following values: +// +// - gdouble: random number. +func RandomDoubleRange(begin, end float64) float64 { + var _arg1 C.gdouble // out + var _arg2 C.gdouble // out + var _cret C.gdouble // in + + _arg1 = C.gdouble(begin) + _arg2 = C.gdouble(end) + + _cret = C.g_random_double_range(_arg1, _arg2) + runtime.KeepAlive(begin) + runtime.KeepAlive(end) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// RandomInt: return a random #guint32 equally distributed over the range +// [0..2^32-1]. +// +// The function returns the following values: +// +// - guint32: random number. +func RandomInt() uint32 { + var _cret C.guint32 // in + + _cret = C.g_random_int() + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// RandomIntRange returns a random #gint32 equally distributed over the range +// [begin..end-1]. +// +// The function takes the following parameters: +// +// - begin: lower closed bound of the interval. +// - end: upper open bound of the interval. +// +// The function returns the following values: +// +// - gint32: random number. +func RandomIntRange(begin, end int32) int32 { + var _arg1 C.gint32 // out + var _arg2 C.gint32 // out + var _cret C.gint32 // in + + _arg1 = C.gint32(begin) + _arg2 = C.gint32(end) + + _cret = C.g_random_int_range(_arg1, _arg2) + runtime.KeepAlive(begin) + runtime.KeepAlive(end) + + var _gint32 int32 // out + + _gint32 = int32(_cret) + + return _gint32 +} + +// RandomSetSeed sets the seed for the global random number generator, which is +// used by the g_random_* functions, to seed. +// +// The function takes the following parameters: +// +// - seed: value to reinitialize the global random number generator. +func RandomSetSeed(seed uint32) { + var _arg1 C.guint32 // out + + _arg1 = C.guint32(seed) + + C.g_random_set_seed(_arg1) + runtime.KeepAlive(seed) +} + +// ReloadUserSpecialDirsCache resets the cache used for +// g_get_user_special_dir(), so that the latest on-disk version is used. +// Call this only if you just changed the data on disk yourself. +// +// Due to thread safety issues this may cause leaking of strings that were +// previously returned from g_get_user_special_dir() that can't be freed. +// We ensure to only leak the data for the directories that actually changed +// value though. +func ReloadUserSpecialDirsCache() { + C.g_reload_user_special_dirs_cache() +} + +// SetApplicationName sets a human-readable name for the application. +// This name should be localized if possible, and is intended for display +// to the user. Contrast with g_set_prgname(), which sets a non-localized +// name. g_set_prgname() will be called automatically by gtk_init(), but +// g_set_application_name() will not. +// +// Note that for thread safety reasons, this function can only be called once. +// +// The application name will be used in contexts such as error messages, or when +// displaying an application's name in the task list. +// +// The function takes the following parameters: +// +// - applicationName: localized name of the application. +func SetApplicationName(applicationName string) { + var _arg1 *C.gchar // out + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(applicationName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_set_application_name(_arg1) + runtime.KeepAlive(applicationName) +} + +// SetPrgname sets the name of the program. This name should not be localized, +// in contrast to g_set_application_name(). +// +// If you are using #GApplication the program name is set in +// g_application_run(). In case of GDK or GTK it is set in gdk_init(), which is +// called by gtk_init() and the Application::startup handler. The program name +// is found by taking the last component of argv[0]. +// +// Since GLib 2.72, this function can be called multiple times and is fully +// thread safe. Prior to GLib 2.72, this function could only be called once per +// process. +// +// The function takes the following parameters: +// +// - prgname: name of the program. +func SetPrgname(prgname string) { + var _arg1 *C.gchar // out + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(prgname))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_set_prgname(_arg1) + runtime.KeepAlive(prgname) +} + +// Setenv sets an environment variable. On UNIX, both the variable's name and +// value can be arbitrary byte strings, except that the variable's name cannot +// contain '='. On Windows, they should be in UTF-8. +// +// Note that on some systems, when variables are overwritten, the memory used +// for the previous variables and its value isn't reclaimed. +// +// You should be mindful of the fact that environment variable handling in UNIX +// is not thread-safe, and your program may crash if one thread calls g_setenv() +// while another thread is calling getenv(). (And note that many functions, +// such as gettext(), call getenv() internally.) This function is only safe to +// use at the very start of your program, before creating any other threads (or +// creating objects that create worker threads of their own). +// +// If you need to set up the environment for a child process, you can +// use g_get_environ() to get an environment array, modify that with +// g_environ_setenv() and g_environ_unsetenv(), and then pass that array +// directly to execvpe(), g_spawn_async(), or the like. +// +// The function takes the following parameters: +// +// - variable: environment variable to set, must not contain '='. +// - value for to set the variable to. +// - overwrite: whether to change the variable if it already exists. +// +// The function returns the following values: +// +// - ok: FALSE if the environment variable couldn't be set. +func Setenv(variable, value string, overwrite bool) bool { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gboolean // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(variable))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg2)) + if overwrite { + _arg3 = C.TRUE + } + + _cret = C.g_setenv(_arg1, _arg2, _arg3) + runtime.KeepAlive(variable) + runtime.KeepAlive(value) + runtime.KeepAlive(overwrite) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +func ShellErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_shell_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// ShellParseArgv parses a command line into an argument vector, in much the +// same way the shell would, but without many of the expansions the shell would +// perform (variable expansion, globs, operators, filename expansion, etc. +// are not supported). +// +// The results are defined to be the same as those you would get from a +// UNIX98 /bin/sh, as long as the input contains none of the unsupported shell +// expansions. If the input does contain such expansions, they are passed +// through literally. +// +// Possible errors are those from the G_SHELL_ERROR domain. +// +// In particular, if command_line is an empty string (or a string containing +// only whitespace), G_SHELL_ERROR_EMPTY_STRING will be returned. It’s +// guaranteed that argvp will be a non-empty array if this function returns +// successfully. +// +// Free the returned vector with g_strfreev(). +// +// The function takes the following parameters: +// +// - commandLine: command line to parse. +// +// The function returns the following values: +// +// - argvp (optional): return location for array of args. +func ShellParseArgv(commandLine string) ([]string, error) { + var _arg1 *C.gchar // out + var _arg3 **C.gchar // in + var _arg2 C.gint // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(commandLine))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_shell_parse_argv(_arg1, &_arg2, &_arg3, &_cerr) + runtime.KeepAlive(commandLine) + + var _argvp []string // out + var _goerr error // out + + if _arg3 != nil { + defer C.free(unsafe.Pointer(_arg3)) + { + src := unsafe.Slice((**C.gchar)(_arg3), _arg2) + _argvp = make([]string, _arg2) + for i := 0; i < int(_arg2); i++ { + _argvp[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _argvp, _goerr +} + +// ShellQuote quotes a string so that the shell (/bin/sh) will interpret the +// quoted string to mean unquoted_string. +// +// If you pass a filename to the shell, for example, you should first quote it +// with this function. +// +// The return value must be freed with g_free(). +// +// The quoting style used is undefined (single or double quotes may be used). +// +// The function takes the following parameters: +// +// - unquotedString: literal string. +// +// The function returns the following values: +// +// - filename: quoted string. +func ShellQuote(unquotedString string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(unquotedString))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_shell_quote(_arg1) + runtime.KeepAlive(unquotedString) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _filename +} + +// ShellUnquote unquotes a string as the shell (/bin/sh) would. +// +// This function only handles quotes; if a string contains file globs, +// arithmetic operators, variables, backticks, redirections, or other +// special-to-the-shell features, the result will be different from the result +// a real shell would produce (the variables, backticks, etc. will be passed +// through literally instead of being expanded). +// +// This function is guaranteed to succeed if applied to the result of +// g_shell_quote(). If it fails, it returns NULL and sets the error. +// +// The quoted_string need not actually contain quoted or escaped text; +// g_shell_unquote() simply goes through the string and unquotes/unescapes +// anything that the shell would. Both single and double quotes are handled, +// as are escapes including escaped newlines. +// +// The return value must be freed with g_free(). +// +// Possible errors are in the G_SHELL_ERROR domain. +// +// Shell quoting rules are a bit strange. Single quotes preserve the literal +// string exactly. escape sequences are not allowed; not even \' - if you +// want a ' in the quoted text, you have to do something like 'foo'\”bar'. +// Double quotes allow $, , ", \`, and newline to be escaped with backslash. +// Otherwise double quotes preserve things literally. +// +// The function takes the following parameters: +// +// - quotedString: shell-quoted string. +// +// The function returns the following values: +// +// - filename: unquoted string. +func ShellUnquote(quotedString string) (string, error) { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(quotedString))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_shell_unquote(_arg1, &_cerr) + runtime.KeepAlive(quotedString) + + var _filename string // out + var _goerr error // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _filename, _goerr +} + +// SpacedPrimesClosest gets the smallest prime number from a built-in array of +// primes which is larger than num. This is used within GLib to calculate the +// optimum size of a Table. +// +// The built-in array of primes ranges from 11 to 13845163 such that each prime +// is approximately 1.5-2 times the previous prime. +// +// The function takes the following parameters: +// +// - num: #guint. +// +// The function returns the following values: +// +// - guint: smallest prime number from a built-in array of primes which is +// larger than num. +func SpacedPrimesClosest(num uint) uint { + var _arg1 C.guint // out + var _cret C.guint // in + + _arg1 = C.guint(num) + + _cret = C.g_spaced_primes_closest(_arg1) + runtime.KeepAlive(num) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// SpawnCheckExitStatus: old name for g_spawn_check_wait_status(), deprecated +// because its name is misleading. +// +// Despite the name of the function, wait_status must be the wait status as +// returned by g_spawn_sync(), g_subprocess_get_status(), waitpid(), etc. +// On Unix platforms, it is incorrect for it to be the exit status as passed to +// exit() or returned by g_subprocess_get_exit_status() or WEXITSTATUS(). +// +// Deprecated: Use g_spawn_check_wait_status() instead, and check whether your +// code is conflating wait and exit statuses. +// +// The function takes the following parameters: +// +// - waitStatus status as returned from g_spawn_sync(). +func SpawnCheckExitStatus(waitStatus int) error { + var _arg1 C.gint // out + var _cerr *C.GError // in + + _arg1 = C.gint(waitStatus) + + C.g_spawn_check_exit_status(_arg1, &_cerr) + runtime.KeepAlive(waitStatus) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SpawnCheckWaitStatus: set error if wait_status indicates the child exited +// abnormally (e.g. with a nonzero exit code, or via a fatal signal). +// +// The g_spawn_sync() and g_child_watch_add() family of APIs return the +// status of subprocesses encoded in a platform-specific way. On Unix, this is +// guaranteed to be in the same format waitpid() returns, and on Windows it is +// guaranteed to be the result of GetExitCodeProcess(). +// +// Prior to the introduction of this function in GLib 2.34, interpreting +// wait_status required use of platform-specific APIs, which is problematic for +// software using GLib as a cross-platform layer. +// +// Additionally, many programs simply want to determine whether or not the child +// exited successfully, and either propagate a #GError or print a message to +// standard error. In that common case, this function can be used. Note that the +// error message in error will contain human-readable information about the wait +// status. +// +// The domain and code of error have special semantics in the case where the +// process has an "exit code", as opposed to being killed by a signal. On Unix, +// this happens if WIFEXITED() would be true of wait_status. On Windows, +// it is always the case. +// +// The special semantics are that the actual exit code will be the code set +// in error, and the domain will be G_SPAWN_EXIT_ERROR. This allows you to +// differentiate between different exit codes. +// +// If the process was terminated by some means other than an exit status (for +// example if it was killed by a signal), the domain will be G_SPAWN_ERROR and +// the code will be G_SPAWN_ERROR_FAILED. +// +// This function just offers convenience; you can of course also check the +// available platform via a macro such as G_OS_UNIX, and use WIFEXITED() and +// WEXITSTATUS() on wait_status directly. Do not attempt to scan or parse the +// error message string; it may be translated and/or change in future versions +// of GLib. +// +// Prior to version 2.70, g_spawn_check_exit_status() provides the same +// functionality, although under a misleading name. +// +// The function takes the following parameters: +// +// - waitStatus: platform-specific wait status as returned from +// g_spawn_sync(). +func SpawnCheckWaitStatus(waitStatus int) error { + var _arg1 C.gint // out + var _cerr *C.GError // in + + _arg1 = C.gint(waitStatus) + + C.g_spawn_check_wait_status(_arg1, &_cerr) + runtime.KeepAlive(waitStatus) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SpawnCommandLineAsync: simple version of g_spawn_async() that parses a +// command line with g_shell_parse_argv() and passes it to g_spawn_async(). +// +// Runs a command line in the background. Unlike g_spawn_async(), +// the G_SPAWN_SEARCH_PATH flag is enabled, other flags are not. Note that +// G_SPAWN_SEARCH_PATH can have security implications, so consider using +// g_spawn_async() directly if appropriate. Possible errors are those from +// g_shell_parse_argv() and g_spawn_async(). +// +// The same concerns on Windows apply as for g_spawn_command_line_sync(). +// +// The function takes the following parameters: +// +// - commandLine: command line. +func SpawnCommandLineAsync(commandLine string) error { + var _arg1 *C.gchar // out + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(commandLine))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_spawn_command_line_async(_arg1, &_cerr) + runtime.KeepAlive(commandLine) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SpawnCommandLineSync: simple version of g_spawn_sync() with little-used +// parameters removed, taking a command line instead of an argument vector. +// +// See g_spawn_sync() for full details. +// +// The command_line argument will be parsed by g_shell_parse_argv(). +// +// Unlike g_spawn_sync(), the G_SPAWN_SEARCH_PATH flag is enabled. Note that +// G_SPAWN_SEARCH_PATH can have security implications, so consider using +// g_spawn_sync() directly if appropriate. +// +// Possible errors are those from g_spawn_sync() and those from +// g_shell_parse_argv(). +// +// If wait_status is non-NULL, the platform-specific status of the child is +// stored there; see the documentation of g_spawn_check_wait_status() for how to +// use and interpret this. On Unix platforms, note that it is usually not equal +// to the integer passed to exit() or returned from main(). +// +// On Windows, please note the implications of g_shell_parse_argv() parsing +// command_line. Parsing is done according to Unix shell rules, not Windows +// command interpreter rules. Space is a separator, and backslashes are special. +// Thus you cannot simply pass a command_line containing canonical Windows +// paths, like "c:\\program files\\app\\app.exe", as the backslashes will +// be eaten, and the space will act as a separator. You need to enclose +// such paths with single quotes, like "'c:\\program files\\app\\app.exe' +// 'e:\\folder\\argument.txt'". +// +// The function takes the following parameters: +// +// - commandLine: command line. +// +// The function returns the following values: +// +// - standardOutput (optional): return location for child output. +// - standardError (optional): return location for child errors. +// - waitStatus (optional): return location for child wait status, as returned +// by waitpid(). +func SpawnCommandLineSync(commandLine string) (standardOutput, standardError []byte, waitStatus int, goerr error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // in + var _arg3 *C.gchar // in + var _arg4 C.gint // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(commandLine))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_spawn_command_line_sync(_arg1, &_arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(commandLine) + + var _standardOutput []byte // out + var _standardError []byte // out + var _waitStatus int // out + var _goerr error // out + + if _arg2 != nil { + defer C.free(unsafe.Pointer(_arg2)) + { + var i int + var z C.gchar + for p := _arg2; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg2, i) + _standardOutput = make([]byte, i) + for i := range src { + _standardOutput[i] = byte(src[i]) + } + } + } + if _arg3 != nil { + defer C.free(unsafe.Pointer(_arg3)) + { + var i int + var z C.gchar + for p := _arg3; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg3, i) + _standardError = make([]byte, i) + for i := range src { + _standardError[i] = byte(src[i]) + } + } + } + _waitStatus = int(_arg4) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _standardOutput, _standardError, _waitStatus, _goerr +} + +func SpawnErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_spawn_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +func SpawnExitErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_spawn_exit_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// StrEqual compares two strings for byte-by-byte equality and returns TRUE if +// they are equal. It can be passed to g_hash_table_new() as the key_equal_func +// parameter, when using non-NULL strings as keys in a Table. +// +// This function is typically used for hash table comparisons, but can be used +// for general purpose comparisons of non-NULL strings. For a NULL-safe string +// comparison function, see g_strcmp0(). +// +// The function takes the following parameters: +// +// - v1: key. +// - v2: key to compare with v1. +// +// The function returns the following values: +// +// - ok: TRUE if the two keys match. +func StrEqual(v1, v2 unsafe.Pointer) bool { + var _arg1 C.gconstpointer // out + var _arg2 C.gconstpointer // out + var _cret C.gboolean // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v1)) + _arg2 = (C.gconstpointer)(unsafe.Pointer(v2)) + + _cret = C.g_str_equal(_arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// StrHash converts a string to a hash value. +// +// This function implements the widely used "djb" hash apparently posted by +// Daniel Bernstein to comp.lang.c some time ago. The 32 bit unsigned hash value +// starts at 5381 and for each byte 'c' in the string, is updated: hash = hash * +// 33 + c. This function uses the signed value of each byte. +// +// It can be passed to g_hash_table_new() as the hash_func parameter, when using +// non-NULL strings as keys in a Table. +// +// Note that this function may not be a perfect fit for all use cases. +// For example, it produces some hash collisions with strings as short as 2. +// +// The function takes the following parameters: +// +// - v: string key. +// +// The function returns the following values: +// +// - guint: hash value corresponding to the key. +func StrHash(v unsafe.Pointer) uint { + var _arg1 C.gconstpointer // out + var _cret C.guint // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v)) + + _cret = C.g_str_hash(_arg1) + runtime.KeepAlive(v) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// StripContext: auxiliary function for gettext() support (see Q_()). +// +// The function takes the following parameters: +// +// - msgid: string. +// - msgval: another string. +// +// The function returns the following values: +// +// - utf8: msgval, unless msgval is identical to msgid and contains a '|' +// character, in which case a pointer to the substring of msgid after the +// first '|' character is returned. +func StripContext(msgid, msgval string) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(msgid))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(msgval))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_strip_context(_arg1, _arg2) + runtime.KeepAlive(msgid) + runtime.KeepAlive(msgval) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +func StrvGetType() coreglib.Type { + var _cret C.GType // in + + _cret = C.g_strv_get_type() + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// NewTimeoutSource creates a new timeout source. +// +// The source will not initially be associated with any Context and must be +// added to one with g_source_attach() before it will be executed. +// +// The interval given is in terms of monotonic time, not wall clock time. +// See g_get_monotonic_time(). +// +// The function takes the following parameters: +// +// - interval: timeout interval in milliseconds. +// +// The function returns the following values: +// +// - source: newly-created timeout source. +func NewTimeoutSource(interval uint) *Source { + var _arg1 C.guint // out + var _cret *C.GSource // in + + _arg1 = C.guint(interval) + + _cret = C.g_timeout_source_new(_arg1) + runtime.KeepAlive(interval) + + var _source *Source // out + + _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// TimeoutSourceNewSeconds creates a new timeout source. +// +// The source will not initially be associated with any Context and must be +// added to one with g_source_attach() before it will be executed. +// +// The scheduling granularity/accuracy of this timeout source will be in +// seconds. +// +// The interval given is in terms of monotonic time, not wall clock time. +// See g_get_monotonic_time(). +// +// The function takes the following parameters: +// +// - interval: timeout interval in seconds. +// +// The function returns the following values: +// +// - source: newly-created timeout source. +func TimeoutSourceNewSeconds(interval uint) *Source { + var _arg1 C.guint // out + var _cret *C.GSource // in + + _arg1 = C.guint(interval) + + _cret = C.g_timeout_source_new_seconds(_arg1) + runtime.KeepAlive(interval) + + var _source *Source // out + + _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// UCS4ToUTF16: convert a string from UCS-4 to UTF-16. A 0 character will be +// added to the result after the converted text. +// +// The function takes the following parameters: +// +// - str: UCS-4 encoded string. +// +// The function returns the following values: +// +// - itemsRead (optional): location to store number of bytes read, or NULL. +// If an error occurs then the index of the invalid input is stored here. +// - itemsWritten (optional): location to store number of #gunichar2 written, +// or NULL. The value stored here does not include the trailing 0. +// - guint16: pointer to a newly allocated UTF-16 string. This value must be +// freed with g_free(). If an error occurs, NULL will be returned and error +// set. +func UCS4ToUTF16(str []uint32) (itemsRead, itemsWritten int32, guint16 *uint16, goerr error) { + var _arg1 *C.gunichar // out + var _arg2 C.glong + var _arg3 C.glong // in + var _arg4 C.glong // in + var _cret *C.gunichar2 // in + var _cerr *C.GError // in + + _arg2 = (C.glong)(len(str)) + if len(str) > 0 { + _arg1 = (*C.gunichar)(unsafe.Pointer(&str[0])) + } + + _cret = C.g_ucs4_to_utf16(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(str) + + var _itemsRead int32 // out + var _itemsWritten int32 // out + var _guint16 *uint16 // out + var _goerr error // out + + _itemsRead = int32(_arg3) + _itemsWritten = int32(_arg4) + _guint16 = (*uint16)(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _itemsRead, _itemsWritten, _guint16, _goerr +} + +// UCS4ToUTF8: convert a string from a 32-bit fixed width representation as +// UCS-4. to UTF-8. The result will be terminated with a 0 byte. +// +// The function takes the following parameters: +// +// - str: UCS-4 encoded string. +// +// The function returns the following values: +// +// - itemsRead (optional): location to store number of characters read, +// or NULL. +// - itemsWritten (optional): location to store number of bytes written or +// NULL. The value here stored does not include the trailing 0 byte. +// - utf8: pointer to a newly allocated UTF-8 string. This value must be freed +// with g_free(). If an error occurs, NULL will be returned and error set. +// In that case, items_read will be set to the position of the first invalid +// input character. +func UCS4ToUTF8(str []uint32) (itemsRead, itemsWritten int32, utf8 string, goerr error) { + var _arg1 *C.gunichar // out + var _arg2 C.glong + var _arg3 C.glong // in + var _arg4 C.glong // in + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg2 = (C.glong)(len(str)) + if len(str) > 0 { + _arg1 = (*C.gunichar)(unsafe.Pointer(&str[0])) + } + + _cret = C.g_ucs4_to_utf8(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(str) + + var _itemsRead int32 // out + var _itemsWritten int32 // out + var _utf8 string // out + var _goerr error // out + + _itemsRead = int32(_arg3) + _itemsWritten = int32(_arg4) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _itemsRead, _itemsWritten, _utf8, _goerr +} + +// UnicharBreakType determines the break type of c. c should be a +// Unicode character (to derive a character from UTF-8 encoded text, +// use g_utf8_get_char()). The break type is used to find word and line breaks +// ("text boundaries"), Pango implements the Unicode boundary resolution +// algorithms and normally you would use a function such as pango_break() +// instead of caring about break types yourself. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - unicodeBreakType: break type of c. +func UnicharBreakType(c uint32) UnicodeBreakType { + var _arg1 C.gunichar // out + var _cret C.GUnicodeBreakType // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_break_type(_arg1) + runtime.KeepAlive(c) + + var _unicodeBreakType UnicodeBreakType // out + + _unicodeBreakType = UnicodeBreakType(_cret) + + return _unicodeBreakType +} + +// UnicharCombiningClass determines the canonical combining class of a Unicode +// character. +// +// The function takes the following parameters: +// +// - uc: unicode character. +// +// The function returns the following values: +// +// - gint: combining class of the character. +func UnicharCombiningClass(uc uint32) int { + var _arg1 C.gunichar // out + var _cret C.gint // in + + _arg1 = C.gunichar(uc) + + _cret = C.g_unichar_combining_class(_arg1) + runtime.KeepAlive(uc) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// UnicharCompose performs a single composition step of the Unicode canonical +// composition algorithm. +// +// This function includes algorithmic Hangul Jamo composition, but it is not +// exactly the inverse of g_unichar_decompose(). No composition can have either +// of a or b equal to zero. To be precise, this function composes if and only +// if there exists a Primary Composite P which is canonically equivalent to +// the sequence . See the Unicode Standard for the definition of Primary +// Composite. +// +// If a and b do not compose a new character, ch is set to zero. +// +// See UAX#15 (http://unicode.org/reports/tr15/) for details. +// +// The function takes the following parameters: +// +// - a: unicode character. +// - b: unicode character. +// +// The function returns the following values: +// +// - ch: return location for the composed character. +// - ok: TRUE if the characters could be composed. +func UnicharCompose(a, b uint32) (uint32, bool) { + var _arg1 C.gunichar // out + var _arg2 C.gunichar // out + var _arg3 C.gunichar // in + var _cret C.gboolean // in + + _arg1 = C.gunichar(a) + _arg2 = C.gunichar(b) + + _cret = C.g_unichar_compose(_arg1, _arg2, &_arg3) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ch uint32 // out + var _ok bool // out + + _ch = uint32(_arg3) + if _cret != 0 { + _ok = true + } + + return _ch, _ok +} + +// UnicharDecompose performs a single decomposition step of the Unicode +// canonical decomposition algorithm. +// +// This function does not include compatibility decompositions. It does, +// however, include algorithmic Hangul Jamo decomposition, as well as +// 'singleton' decompositions which replace a character by a single other +// character. In the case of singletons *b will be set to zero. +// +// If ch is not decomposable, *a is set to ch and *b is set to zero. +// +// Note that the way Unicode decomposition pairs are defined, it is guaranteed +// that b would not decompose further, but a may itself decompose. To get the +// full canonical decomposition for ch, one would need to recursively call this +// function on a. Or use g_unichar_fully_decompose(). +// +// See UAX#15 (http://unicode.org/reports/tr15/) for details. +// +// The function takes the following parameters: +// +// - ch: unicode character. +// +// The function returns the following values: +// +// - a: return location for the first component of ch. +// - b: return location for the second component of ch. +// - ok: TRUE if the character could be decomposed. +func UnicharDecompose(ch uint32) (a, b uint32, ok bool) { + var _arg1 C.gunichar // out + var _arg2 C.gunichar // in + var _arg3 C.gunichar // in + var _cret C.gboolean // in + + _arg1 = C.gunichar(ch) + + _cret = C.g_unichar_decompose(_arg1, &_arg2, &_arg3) + runtime.KeepAlive(ch) + + var _a uint32 // out + var _b uint32 // out + var _ok bool // out + + _a = uint32(_arg2) + _b = uint32(_arg3) + if _cret != 0 { + _ok = true + } + + return _a, _b, _ok +} + +// UnicharDigitValue determines the numeric value of a character as a decimal +// digit. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - gint: if c is a decimal digit (according to g_unichar_isdigit()), +// its numeric value. Otherwise, -1. +func UnicharDigitValue(c uint32) int { + var _arg1 C.gunichar // out + var _cret C.gint // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_digit_value(_arg1) + runtime.KeepAlive(c) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// UnicharFullyDecompose computes the canonical or compatibility decomposition +// of a Unicode character. For compatibility decomposition, pass TRUE for +// compat; for canonical decomposition pass FALSE for compat. +// +// The decomposed sequence is placed in result. Only up to result_len characters +// are written into result. The length of the full decomposition (irrespective +// of result_len) is returned by the function. For canonical decomposition, +// currently all decompositions are of length at most 4, but this may change +// in the future (very unlikely though). At any rate, Unicode does guarantee +// that a buffer of length 18 is always enough for both compatibility and +// canonical decompositions, so that is the size recommended. This is provided +// as G_UNICHAR_MAX_DECOMPOSITION_LENGTH. +// +// See UAX#15 (http://unicode.org/reports/tr15/) for details. +// +// The function takes the following parameters: +// +// - ch: unicode character. +// - compat: whether perform canonical or compatibility decomposition. +// - resultLen: length of result. +// +// The function returns the following values: +// +// - result (optional): location to store decomposed result, or NULL. +// - gsize: length of the full decomposition. +func UnicharFullyDecompose(ch uint32, compat bool, resultLen uint) (uint32, uint) { + var _arg1 C.gunichar // out + var _arg2 C.gboolean // out + var _arg3 C.gunichar // in + var _arg4 C.gsize // out + var _cret C.gsize // in + + _arg1 = C.gunichar(ch) + if compat { + _arg2 = C.TRUE + } + _arg4 = C.gsize(resultLen) + + _cret = C.g_unichar_fully_decompose(_arg1, _arg2, &_arg3, _arg4) + runtime.KeepAlive(ch) + runtime.KeepAlive(compat) + runtime.KeepAlive(resultLen) + + var _result uint32 // out + var _gsize uint // out + + _result = uint32(_arg3) + _gsize = uint(_cret) + + return _result, _gsize +} + +// UnicharGetMirrorChar: in Unicode, some characters are "mirrored". This +// means that their images are mirrored horizontally in text that is laid out +// from right to left. For instance, "(" would become its mirror image, ")", +// in right-to-left text. +// +// If ch has the Unicode mirrored property and there is another unicode +// character that typically has a glyph that is the mirror image of ch's glyph +// and mirrored_ch is set, it puts that character in the address pointed to by +// mirrored_ch. Otherwise the original character is put. +// +// The function takes the following parameters: +// +// - ch: unicode character. +// +// The function returns the following values: +// +// - mirroredCh: location to store the mirrored character. +// - ok: TRUE if ch has a mirrored character, FALSE otherwise. +func UnicharGetMirrorChar(ch uint32) (uint32, bool) { + var _arg1 C.gunichar // out + var _arg2 C.gunichar // in + var _cret C.gboolean // in + + _arg1 = C.gunichar(ch) + + _cret = C.g_unichar_get_mirror_char(_arg1, &_arg2) + runtime.KeepAlive(ch) + + var _mirroredCh uint32 // out + var _ok bool // out + + _mirroredCh = uint32(_arg2) + if _cret != 0 { + _ok = true + } + + return _mirroredCh, _ok +} + +// UnicharGetScript looks up the Script for a particular character (as defined +// by Unicode Standard Annex \#24). No check is made for ch being a valid +// Unicode character; if you pass in invalid character, the result is undefined. +// +// This function is equivalent to pango_script_for_unichar() and the two are +// interchangeable. +// +// The function takes the following parameters: +// +// - ch: unicode character. +// +// The function returns the following values: +// +// - unicodeScript for the character. +func UnicharGetScript(ch uint32) UnicodeScript { + var _arg1 C.gunichar // out + var _cret C.GUnicodeScript // in + + _arg1 = C.gunichar(ch) + + _cret = C.g_unichar_get_script(_arg1) + runtime.KeepAlive(ch) + + var _unicodeScript UnicodeScript // out + + _unicodeScript = UnicodeScript(_cret) + + return _unicodeScript +} + +// UnicharIsalnum determines whether a character is alphanumeric. Given some +// UTF-8 text, obtain a character value with g_utf8_get_char(). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is an alphanumeric character. +func UnicharIsalnum(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_isalnum(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIsalpha determines whether a character is alphabetic (i.e. a letter). +// Given some UTF-8 text, obtain a character value with g_utf8_get_char(). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is an alphabetic character. +func UnicharIsalpha(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_isalpha(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIscntrl determines whether a character is a control character. +// Given some UTF-8 text, obtain a character value with g_utf8_get_char(). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is a control character. +func UnicharIscntrl(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_iscntrl(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIsdefined determines if a given character is assigned in the Unicode +// standard. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if the character has an assigned value. +func UnicharIsdefined(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_isdefined(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIsdigit determines whether a character is numeric (i.e. a digit). +// This covers ASCII 0-9 and also digits in other languages/scripts. Given some +// UTF-8 text, obtain a character value with g_utf8_get_char(). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is a digit. +func UnicharIsdigit(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_isdigit(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIsgraph determines whether a character is printable and not a space +// (returns FALSE for control characters, format characters, and spaces). +// g_unichar_isprint() is similar, but returns TRUE for spaces. Given some UTF-8 +// text, obtain a character value with g_utf8_get_char(). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is printable unless it's a space. +func UnicharIsgraph(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_isgraph(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIslower determines whether a character is a lowercase letter. Given +// some UTF-8 text, obtain a character value with g_utf8_get_char(). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is a lowercase letter. +func UnicharIslower(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_islower(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIsmark determines whether a character is a mark (non-spacing mark, +// combining mark, or enclosing mark in Unicode speak). Given some UTF-8 text, +// obtain a character value with g_utf8_get_char(). +// +// Note: in most cases where isalpha characters are allowed, ismark characters +// should be allowed to as they are essential for writing most European +// languages as well as many non-Latin scripts. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is a mark character. +func UnicharIsmark(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_ismark(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIsprint determines whether a character is printable. Unlike +// g_unichar_isgraph(), returns TRUE for spaces. Given some UTF-8 text, obtain a +// character value with g_utf8_get_char(). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is printable. +func UnicharIsprint(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_isprint(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIspunct determines whether a character is punctuation or a symbol. +// Given some UTF-8 text, obtain a character value with g_utf8_get_char(). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is a punctuation or symbol character. +func UnicharIspunct(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_ispunct(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIsspace determines whether a character is a space, tab, or line +// separator (newline, carriage return, etc.). Given some UTF-8 text, obtain a +// character value with g_utf8_get_char(). +// +// (Note: don't use this to do word breaking; you have to use Pango or +// equivalent to get word breaking right, the algorithm is fairly complex.). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is a space character. +func UnicharIsspace(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_isspace(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIstitle determines if a character is titlecase. Some characters in +// Unicode which are composites, such as the DZ digraph have three case variants +// instead of just two. The titlecase form is used at the beginning of a word +// where only the first letter is capitalized. The titlecase form of the DZ +// digraph is U+01F2 LATIN CAPITAL LETTTER D WITH SMALL LETTER Z. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if the character is titlecase. +func UnicharIstitle(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_istitle(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIsupper determines if a character is uppercase. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if c is an uppercase character. +func UnicharIsupper(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_isupper(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIswide determines if a character is typically rendered in a +// double-width cell. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if the character is wide. +func UnicharIswide(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_iswide(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIswideCjk determines if a character is typically rendered in a +// double-width cell under legacy East Asian locales. If a character is wide +// according to g_unichar_iswide(), then it is also reported wide with this +// function, but the converse is not necessarily true. See the Unicode Standard +// Annex #11 (http://www.unicode.org/reports/tr11/) for details. +// +// If a character passes the g_unichar_iswide() test then it will also pass this +// test, but not the other way around. Note that some characters may pass both +// this test and g_unichar_iszerowidth(). +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if the character is wide in legacy East Asian locales. +func UnicharIswideCjk(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_iswide_cjk(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIsxdigit determines if a character is a hexadecimal digit. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if the character is a hexadecimal digit. +func UnicharIsxdigit(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_isxdigit(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharIszerowidth determines if a given character typically takes zero width +// when rendered. The return value is TRUE for all non-spacing and enclosing +// marks (e.g., combining accents), format characters, zero-width space, but not +// U+00AD SOFT HYPHEN. +// +// A typical use of this function is with one of g_unichar_iswide() or +// g_unichar_iswide_cjk() to determine the number of cells a string occupies +// when displayed on a grid display (terminals). However, note that not all +// terminals support zero-width rendering of zero-width marks. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if the character has zero width. +func UnicharIszerowidth(c uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_iszerowidth(_arg1) + runtime.KeepAlive(c) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharToLower converts a character to lower case. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - gunichar: result of converting c to lower case. If c is not an upperlower +// or titlecase character, or has no lowercase equivalent c is returned +// unchanged. +func UnicharToLower(c uint32) uint32 { + var _arg1 C.gunichar // out + var _cret C.gunichar // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_tolower(_arg1) + runtime.KeepAlive(c) + + var _gunichar uint32 // out + + _gunichar = uint32(_cret) + + return _gunichar +} + +// UnicharToTitle converts a character to the titlecase. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - gunichar: result of converting c to titlecase. If c is not an uppercase +// or lowercase character, c is returned unchanged. +func UnicharToTitle(c uint32) uint32 { + var _arg1 C.gunichar // out + var _cret C.gunichar // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_totitle(_arg1) + runtime.KeepAlive(c) + + var _gunichar uint32 // out + + _gunichar = uint32(_cret) + + return _gunichar +} + +// UnicharToUpper converts a character to uppercase. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - gunichar: result of converting c to uppercase. If c is not a lowercase +// or titlecase character, or has no upper case equivalent c is returned +// unchanged. +func UnicharToUpper(c uint32) uint32 { + var _arg1 C.gunichar // out + var _cret C.gunichar // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_toupper(_arg1) + runtime.KeepAlive(c) + + var _gunichar uint32 // out + + _gunichar = uint32(_cret) + + return _gunichar +} + +// UnicharType classifies a Unicode character by type. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - unicodeType: type of the character. +func UnicharType(c uint32) UnicodeType { + var _arg1 C.gunichar // out + var _cret C.GUnicodeType // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_type(_arg1) + runtime.KeepAlive(c) + + var _unicodeType UnicodeType // out + + _unicodeType = UnicodeType(_cret) + + return _unicodeType +} + +// UnicharValidate checks whether ch is a valid Unicode character. Some possible +// integer values of ch will not be valid. 0 is considered a valid character, +// though it's normally a string terminator. +// +// The function takes the following parameters: +// +// - ch: unicode character. +// +// The function returns the following values: +// +// - ok: TRUE if ch is a valid Unicode character. +func UnicharValidate(ch uint32) bool { + var _arg1 C.gunichar // out + var _cret C.gboolean // in + + _arg1 = C.gunichar(ch) + + _cret = C.g_unichar_validate(_arg1) + runtime.KeepAlive(ch) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnicharXDigitValue determines the numeric value of a character as a +// hexadecimal digit. +// +// The function takes the following parameters: +// +// - c: unicode character. +// +// The function returns the following values: +// +// - gint: if c is a hex digit (according to g_unichar_isxdigit()), its +// numeric value. Otherwise, -1. +func UnicharXDigitValue(c uint32) int { + var _arg1 C.gunichar // out + var _cret C.gint // in + + _arg1 = C.gunichar(c) + + _cret = C.g_unichar_xdigit_value(_arg1) + runtime.KeepAlive(c) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// UnicodeCanonicalDecomposition computes the canonical decomposition of a +// Unicode character. +// +// Deprecated: Use the more flexible g_unichar_fully_decompose() instead. +// +// The function takes the following parameters: +// +// - ch: unicode character. +// - resultLen: location to store the length of the return value. +// +// The function returns the following values: +// +// - gunichar: newly allocated string of Unicode characters. result_len is set +// to the resulting length of the string. +func UnicodeCanonicalDecomposition(ch uint32, resultLen *uint) *uint32 { + var _arg1 C.gunichar // out + var _arg2 *C.gsize // out + var _cret *C.gunichar // in + + _arg1 = C.gunichar(ch) + _arg2 = (*C.gsize)(unsafe.Pointer(resultLen)) + + _cret = C.g_unicode_canonical_decomposition(_arg1, _arg2) + runtime.KeepAlive(ch) + runtime.KeepAlive(resultLen) + + var _gunichar *uint32 // out + + _gunichar = (*uint32)(unsafe.Pointer(_cret)) + + return _gunichar +} + +// UnicodeCanonicalOrdering computes the canonical ordering of a string +// in-place. This rearranges decomposed characters in the string according to +// their combining classes. See the Unicode manual for more information. +// +// The function takes the following parameters: +// +// - str: UCS-4 encoded string. +func UnicodeCanonicalOrdering(str []uint32) { + var _arg1 *C.gunichar // out + var _arg2 C.gsize + + _arg2 = (C.gsize)(len(str)) + if len(str) > 0 { + _arg1 = (*C.gunichar)(unsafe.Pointer(&str[0])) + } + + C.g_unicode_canonical_ordering(_arg1, _arg2) + runtime.KeepAlive(str) +} + +// Unsetenv removes an environment variable from the environment. +// +// Note that on some systems, when variables are overwritten, the memory used +// for the previous variables and its value isn't reclaimed. +// +// You should be mindful of the fact that environment variable handling in +// UNIX is not thread-safe, and your program may crash if one thread calls +// g_unsetenv() while another thread is calling getenv(). (And note that many +// functions, such as gettext(), call getenv() internally.) This function is +// only safe to use at the very start of your program, before creating any other +// threads (or creating objects that create worker threads of their own). +// +// If you need to set up the environment for a child process, you can +// use g_get_environ() to get an environment array, modify that with +// g_environ_setenv() and g_environ_unsetenv(), and then pass that array +// directly to execvpe(), g_spawn_async(), or the like. +// +// The function takes the following parameters: +// +// - variable: environment variable to remove, must not contain '='. +func Unsetenv(variable string) { + var _arg1 *C.gchar // out + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(variable))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_unsetenv(_arg1) + runtime.KeepAlive(variable) +} + +// Usleep pauses the current thread for the given number of microseconds. +// +// There are 1 million microseconds per second (represented by the +// G_USEC_PER_SEC macro). g_usleep() may have limited precision, depending on +// hardware and operating system; don't rely on the exact length of the sleep. +// +// The function takes the following parameters: +// +// - microseconds: number of microseconds to pause. +func Usleep(microseconds uint32) { + var _arg1 C.gulong // out + + _arg1 = C.gulong(microseconds) + + C.g_usleep(_arg1) + runtime.KeepAlive(microseconds) +} + +// UTF16ToUCS4: convert a string from UTF-16 to UCS-4. The result will be +// nul-terminated. +// +// The function takes the following parameters: +// +// - str: UTF-16 encoded string. +// +// The function returns the following values: +// +// - itemsRead (optional): location to store number of words read, or NULL. +// If NULL, then G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case str +// contains a trailing partial character. If an error occurs then the index +// of the invalid input is stored here. +// - itemsWritten (optional): location to store number of characters written, +// or NULL. The value stored here does not include the trailing 0 character. +// - gunichar: pointer to a newly allocated UCS-4 string. This value must be +// freed with g_free(). If an error occurs, NULL will be returned and error +// set. +func UTF16ToUCS4(str []uint16) (itemsRead, itemsWritten int32, gunichar *uint32, goerr error) { + var _arg1 *C.gunichar2 // out + var _arg2 C.glong + var _arg3 C.glong // in + var _arg4 C.glong // in + var _cret *C.gunichar // in + var _cerr *C.GError // in + + _arg2 = (C.glong)(len(str)) + if len(str) > 0 { + _arg1 = (*C.gunichar2)(unsafe.Pointer(&str[0])) + } + + _cret = C.g_utf16_to_ucs4(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(str) + + var _itemsRead int32 // out + var _itemsWritten int32 // out + var _gunichar *uint32 // out + var _goerr error // out + + _itemsRead = int32(_arg3) + _itemsWritten = int32(_arg4) + _gunichar = (*uint32)(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _itemsRead, _itemsWritten, _gunichar, _goerr +} + +// UTF16ToUTF8: convert a string from UTF-16 to UTF-8. The result will be +// terminated with a 0 byte. +// +// Note that the input is expected to be already in native endianness, +// an initial byte-order-mark character is not handled specially. g_convert() +// can be used to convert a byte buffer of UTF-16 data of ambiguous endianness. +// +// Further note that this function does not validate the result string; +// it may e.g. include embedded NUL characters. The only validation done by this +// function is to ensure that the input can be correctly interpreted as UTF-16, +// i.e. it doesn't contain unpaired surrogates or partial character sequences. +// +// The function takes the following parameters: +// +// - str: UTF-16 encoded string. +// +// The function returns the following values: +// +// - itemsRead (optional): location to store number of words read, or NULL. +// If NULL, then G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case str +// contains a trailing partial character. If an error occurs then the index +// of the invalid input is stored here. It’s guaranteed to be non-negative. +// - itemsWritten (optional): location to store number of bytes written, +// or NULL. The value stored here does not include the trailing 0 byte. +// It’s guaranteed to be non-negative. +// - utf8: pointer to a newly allocated UTF-8 string. This value must be freed +// with g_free(). If an error occurs, NULL will be returned and error set. +func UTF16ToUTF8(str []uint16) (itemsRead, itemsWritten int32, utf8 string, goerr error) { + var _arg1 *C.gunichar2 // out + var _arg2 C.glong + var _arg3 C.glong // in + var _arg4 C.glong // in + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg2 = (C.glong)(len(str)) + if len(str) > 0 { + _arg1 = (*C.gunichar2)(unsafe.Pointer(&str[0])) + } + + _cret = C.g_utf16_to_utf8(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(str) + + var _itemsRead int32 // out + var _itemsWritten int32 // out + var _utf8 string // out + var _goerr error // out + + _itemsRead = int32(_arg3) + _itemsWritten = int32(_arg4) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _itemsRead, _itemsWritten, _utf8, _goerr +} + +// UTF8Casefold converts a string into a form that is independent of case. +// The result will not correspond to any particular case, but can be compared +// for equality or ordered with the results of calling g_utf8_casefold() on +// other strings. +// +// Note that calling g_utf8_casefold() followed by g_utf8_collate() is only an +// approximation to the correct linguistic case insensitive ordering, though +// it is a fairly good one. Getting this exactly right would require a more +// sophisticated collation function that takes case sensitivity into account. +// GLib does not currently provide such a function. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// +// The function returns the following values: +// +// - utf8: newly allocated string, that is a case independent form of str. +func UTF8Casefold(str string) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_casefold(_arg1, _arg2) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// UTF8Collate compares two strings for ordering using the linguistically +// correct rules for the [current locale][setlocale]. When sorting a large +// number of strings, it will be significantly faster to obtain collation keys +// with g_utf8_collate_key() and compare the keys with strcmp() when sorting +// instead of sorting the original strings. +// +// If the two strings are not comparable due to being in different collation +// sequences, the result is undefined. This can happen if the strings are in +// different language scripts, for example. +// +// The function takes the following parameters: +// +// - str1: UTF-8 encoded string. +// - str2: UTF-8 encoded string. +// +// The function returns the following values: +// +// - gint: < 0 if str1 compares before str2, 0 if they compare equal, > 0 if +// str1 compares after str2. +func UTF8Collate(str1, str2 string) int { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gint // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str1))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(str2))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_utf8_collate(_arg1, _arg2) + runtime.KeepAlive(str1) + runtime.KeepAlive(str2) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// UTF8CollateKey converts a string into a collation key that can be compared +// with other collation keys produced by the same function using strcmp(). +// +// The results of comparing the collation keys of two strings with strcmp() will +// always be the same as comparing the two original keys with g_utf8_collate(). +// +// Note that this function depends on the [current locale][setlocale]. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// +// The function returns the following values: +// +// - utf8: newly allocated string. This string should be freed with g_free() +// when you are done with it. +func UTF8CollateKey(str string) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_collate_key(_arg1, _arg2) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// UTF8CollateKeyForFilename converts a string into a collation key that can +// be compared with other collation keys produced by the same function using +// strcmp(). +// +// In order to sort filenames correctly, this function treats the dot '.' as a +// special case. Most dictionary orderings seem to consider it insignificant, +// thus producing the ordering "event.c" "eventgenerator.c" "event.h" instead of +// "event.c" "event.h" "eventgenerator.c". Also, we would like to treat numbers +// intelligently so that "file1" "file10" "file5" is sorted as "file1" "file5" +// "file10". +// +// Note that this function depends on the [current locale][setlocale]. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// +// The function returns the following values: +// +// - utf8: newly allocated string. This string should be freed with g_free() +// when you are done with it. +func UTF8CollateKeyForFilename(str string) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_collate_key_for_filename(_arg1, _arg2) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// UTF8FindNextChar finds the start of the next UTF-8 character in the string +// after p. +// +// p does not have to be at the beginning of a UTF-8 character. No check is made +// to see if the character found is actually valid other than it starts with an +// appropriate byte. +// +// If end is NULL, the return value will never be NULL: if the end of the string +// is reached, a pointer to the terminating nul byte is returned. If end is +// non-NULL, the return value will be NULL if the end of the string is reached. +// +// The function takes the following parameters: +// +// - p: pointer to a position within a UTF-8 encoded string. +// - end (optional): pointer to the byte following the end of the string, +// or NULL to indicate that the string is nul-terminated. +// +// The function returns the following values: +// +// - utf8 (optional): pointer to the found character or NULL if end is set and +// is reached. +func UTF8FindNextChar(p, end string) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(p))) + defer C.free(unsafe.Pointer(_arg1)) + if end != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(end))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.g_utf8_find_next_char(_arg1, _arg2) + runtime.KeepAlive(p) + runtime.KeepAlive(end) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// UTF8FindPrevChar: given a position p with a UTF-8 encoded string str, find +// the start of the previous UTF-8 character starting before p. Returns NULL if +// no UTF-8 characters are present in str before p. +// +// p does not have to be at the beginning of a UTF-8 character. No check is made +// to see if the character found is actually valid other than it starts with an +// appropriate byte. +// +// The function takes the following parameters: +// +// - str: pointer to the beginning of a UTF-8 encoded string. +// - p: pointer to some position within str. +// +// The function returns the following values: +// +// - utf8 (optional): pointer to the found character or NULL. +func UTF8FindPrevChar(str, p string) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(p))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_utf8_find_prev_char(_arg1, _arg2) + runtime.KeepAlive(str) + runtime.KeepAlive(p) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// UTF8GetChar converts a sequence of bytes encoded as UTF-8 to a Unicode +// character. +// +// If p does not point to a valid UTF-8 encoded character, results are +// undefined. If you are not sure that the bytes are complete valid Unicode +// characters, you should use g_utf8_get_char_validated() instead. +// +// The function takes the following parameters: +// +// - p: pointer to Unicode character encoded as UTF-8. +// +// The function returns the following values: +// +// - gunichar: resulting character. +func UTF8GetChar(p string) uint32 { + var _arg1 *C.gchar // out + var _cret C.gunichar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(p))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_get_char(_arg1) + runtime.KeepAlive(p) + + var _gunichar uint32 // out + + _gunichar = uint32(_cret) + + return _gunichar +} + +// UTF8GetCharValidated: convert a sequence of bytes encoded as UTF-8 to a +// Unicode character. This function checks for incomplete characters, for +// invalid characters such as characters that are out of the range of Unicode, +// and for overlong encodings of valid characters. +// +// Note that g_utf8_get_char_validated() returns (gunichar)-2 if max_len is +// positive and any of the bytes in the first UTF-8 character sequence are nul. +// +// The function takes the following parameters: +// +// - p: pointer to Unicode character encoded as UTF-8. +// +// The function returns the following values: +// +// - gunichar: resulting character. If p points to a partial sequence at the +// end of a string that could begin a valid character (or if max_len is +// zero), returns (gunichar)-2; otherwise, if p does not point to a valid +// UTF-8 encoded Unicode character, returns (gunichar)-1. +func UTF8GetCharValidated(p string) uint32 { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret C.gunichar // in + + _arg2 = (C.gssize)(len(p)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(p) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(p)), p) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_get_char_validated(_arg1, _arg2) + runtime.KeepAlive(p) + + var _gunichar uint32 // out + + _gunichar = uint32(_cret) + + return _gunichar +} + +// UTF8MakeValid: if the provided string is valid UTF-8, return a copy of it. +// If not, return a copy in which bytes that could not be interpreted as valid +// Unicode are replaced with the Unicode replacement character (U+FFFD). +// +// For example, this is an appropriate function to use if you have received +// a string that was incorrectly declared to be UTF-8, and you need a valid +// UTF-8 version of it that can be logged or displayed to the user, with the +// assumption that it is close enough to ASCII or UTF-8 to be mostly readable +// as-is. +// +// The function takes the following parameters: +// +// - str: string to coerce into UTF-8. +// +// The function returns the following values: +// +// - utf8: valid UTF-8 string whose content resembles str. +func UTF8MakeValid(str string) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_make_valid(_arg1, _arg2) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// UTF8Normalize converts a string into canonical form, standardizing such +// issues as whether a character with an accent is represented as a base +// character and combining accent or as a single precomposed character. +// The string has to be valid UTF-8, otherwise NULL is returned. You should +// generally call g_utf8_normalize() before comparing two Unicode strings. +// +// The normalization mode G_NORMALIZE_DEFAULT only standardizes differences +// that do not affect the text content, such as the above-mentioned accent +// representation. G_NORMALIZE_ALL also standardizes the "compatibility" +// characters in Unicode, such as SUPERSCRIPT THREE to the standard forms (in +// this case DIGIT THREE). Formatting information may be lost but for most text +// operations such characters should be considered the same. +// +// G_NORMALIZE_DEFAULT_COMPOSE and G_NORMALIZE_ALL_COMPOSE are like +// G_NORMALIZE_DEFAULT and G_NORMALIZE_ALL, but returned a result with composed +// forms rather than a maximally decomposed form. This is often useful if you +// intend to convert the string to a legacy encoding or pass it to a system with +// less capable Unicode handling. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// - mode: type of normalization to perform. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string, that is the normalized form of +// str, or NULL if str is not valid UTF-8. +func UTF8Normalize(str string, mode NormalizeMode) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 C.GNormalizeMode // out + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = C.GNormalizeMode(mode) + + _cret = C.g_utf8_normalize(_arg1, _arg2, _arg3) + runtime.KeepAlive(str) + runtime.KeepAlive(mode) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// UTF8OffsetToPointer converts from an integer character offset to a pointer to +// a position within the string. +// +// Since 2.10, this function allows to pass a negative offset to step backwards. +// It is usually worth stepping backwards from the end instead of forwards if +// offset is in the last fourth of the string, since moving forward is about 3 +// times faster than moving backward. +// +// Note that this function doesn't abort when reaching the end of str. Therefore +// you should be sure that offset is within string boundaries before calling +// that function. Call g_utf8_strlen() when unsure. This limitation exists as +// this function is called frequently during text rendering and therefore has to +// be as fast as possible. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// - offset: character offset within str. +// +// The function returns the following values: +// +// - utf8: resulting pointer. +func UTF8OffsetToPointer(str string, offset int32) string { + var _arg1 *C.gchar // out + var _arg2 C.glong // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.glong(offset) + + _cret = C.g_utf8_offset_to_pointer(_arg1, _arg2) + runtime.KeepAlive(str) + runtime.KeepAlive(offset) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// UTF8PointerToOffset converts from a pointer to position within a string to an +// integer character offset. +// +// Since 2.10, this function allows pos to be before str, and returns a negative +// offset in this case. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// - pos: pointer to a position within str. +// +// The function returns the following values: +// +// - glong: resulting character offset. +func UTF8PointerToOffset(str, pos string) int32 { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.glong // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(pos))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_utf8_pointer_to_offset(_arg1, _arg2) + runtime.KeepAlive(str) + runtime.KeepAlive(pos) + + var _glong int32 // out + + _glong = int32(_cret) + + return _glong +} + +// UTF8PrevChar finds the previous UTF-8 character in the string before p. +// +// p does not have to be at the beginning of a UTF-8 character. No check is +// made to see if the character found is actually valid other than it starts +// with an appropriate byte. If p might be the first character of the string, +// you must use g_utf8_find_prev_char() instead. +// +// The function takes the following parameters: +// +// - p: pointer to a position within a UTF-8 encoded string. +// +// The function returns the following values: +// +// - utf8: pointer to the found character. +func UTF8PrevChar(p string) string { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(p))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_prev_char(_arg1) + runtime.KeepAlive(p) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// UTF8Strchr finds the leftmost occurrence of the given Unicode character in a +// UTF-8 encoded string, while limiting the search to len bytes. If len is -1, +// allow unbounded search. +// +// The function takes the following parameters: +// +// - p: nul-terminated UTF-8 encoded string. +// - c: unicode character. +// +// The function returns the following values: +// +// - utf8 (optional): NULL if the string does not contain the character, +// otherwise, a pointer to the start of the leftmost occurrence of the +// character in the string. +func UTF8Strchr(p string, c uint32) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 C.gunichar // out + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(p)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(p) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(p)), p) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = C.gunichar(c) + + _cret = C.g_utf8_strchr(_arg1, _arg2, _arg3) + runtime.KeepAlive(p) + runtime.KeepAlive(c) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// UTF8Strdown converts all Unicode characters in the string that have a case to +// lowercase. The exact manner that this is done depends on the current locale, +// and may result in the number of characters in the string changing. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// +// The function returns the following values: +// +// - utf8: newly allocated string, with all characters converted to lowercase. +func UTF8Strdown(str string) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_strdown(_arg1, _arg2) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// UTF8Strlen computes the length of the string in characters, not including +// the terminating nul character. If the max'th byte falls in the middle of a +// character, the last (partial) character is not counted. +// +// The function takes the following parameters: +// +// - p: pointer to the start of a UTF-8 encoded string. +// - max: maximum number of bytes to examine. If max is less than 0, then +// the string is assumed to be nul-terminated. If max is 0, p will not be +// examined and may be NULL. If max is greater than 0, up to max bytes are +// examined. +// +// The function returns the following values: +// +// - glong: length of the string in characters. +func UTF8Strlen(p string, max int) int32 { + var _arg1 *C.gchar // out + var _arg2 C.gssize // out + var _cret C.glong // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(p))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gssize(max) + + _cret = C.g_utf8_strlen(_arg1, _arg2) + runtime.KeepAlive(p) + runtime.KeepAlive(max) + + var _glong int32 // out + + _glong = int32(_cret) + + return _glong +} + +// UTF8Strncpy: like the standard C strncpy() function, but copies a given +// number of characters instead of a given number of bytes. The src string must +// be valid UTF-8 encoded text. (Use g_utf8_validate() on all text before trying +// to use UTF-8 utility functions with it.) +// +// Note you must ensure dest is at least 4 * n + 1 to fit the largest possible +// UTF-8 characters. +// +// The function takes the following parameters: +// +// - dest: buffer to fill with characters from src. +// - src: UTF-8 encoded string. +// - n: character count. +// +// The function returns the following values: +// +// - utf8: dest. +func UTF8Strncpy(dest, src string, n uint) string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gsize // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(dest))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(src))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.gsize(n) + + _cret = C.g_utf8_strncpy(_arg1, _arg2, _arg3) + runtime.KeepAlive(dest) + runtime.KeepAlive(src) + runtime.KeepAlive(n) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// UTF8Strrchr: find the rightmost occurrence of the given Unicode character in +// a UTF-8 encoded string, while limiting the search to len bytes. If len is -1, +// allow unbounded search. +// +// The function takes the following parameters: +// +// - p: nul-terminated UTF-8 encoded string. +// - c: unicode character. +// +// The function returns the following values: +// +// - utf8 (optional): NULL if the string does not contain the character, +// otherwise, a pointer to the start of the rightmost occurrence of the +// character in the string. +func UTF8Strrchr(p string, c uint32) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 C.gunichar // out + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(p)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(p) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(p)), p) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = C.gunichar(c) + + _cret = C.g_utf8_strrchr(_arg1, _arg2, _arg3) + runtime.KeepAlive(p) + runtime.KeepAlive(c) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// UTF8Strreverse reverses a UTF-8 string. str must be valid UTF-8 encoded text. +// (Use g_utf8_validate() on all text before trying to use UTF-8 utility +// functions with it.) +// +// This function is intended for programmatic uses of reversed strings. It pays +// no attention to decomposed characters, combining marks, byte order marks, +// directional indicators (LRM, LRO, etc) and similar characters which might +// need special handling when reversing a string for display purposes. +// +// Note that unlike g_strreverse(), this function returns newly-allocated +// memory, which should be freed with g_free() when no longer needed. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// +// The function returns the following values: +// +// - utf8: newly-allocated string which is the reverse of str. +func UTF8Strreverse(str string) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_strreverse(_arg1, _arg2) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// UTF8Strup converts all Unicode characters in the string that have a case to +// uppercase. The exact manner that this is done depends on the current locale, +// and may result in the number of characters in the string increasing. (For +// instance, the German ess-zet will be changed to SS.). +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// +// The function returns the following values: +// +// - utf8: newly allocated string, with all characters converted to uppercase. +func UTF8Strup(str string) string { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cret *C.gchar // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_strup(_arg1, _arg2) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// UTF8Substring copies a substring out of a UTF-8 encoded string. The substring +// will contain end_pos - start_pos characters. +// +// Since GLib 2.72, -1 can be passed to end_pos to indicate the end of the +// string. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// - startPos: character offset within str. +// - endPos: another character offset within str, or -1 to indicate the end of +// the string. +// +// The function returns the following values: +// +// - utf8: newly allocated copy of the requested substring. Free with g_free() +// when no longer needed. +func UTF8Substring(str string, startPos, endPos int32) string { + var _arg1 *C.gchar // out + var _arg2 C.glong // out + var _arg3 C.glong // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.glong(startPos) + _arg3 = C.glong(endPos) + + _cret = C.g_utf8_substring(_arg1, _arg2, _arg3) + runtime.KeepAlive(str) + runtime.KeepAlive(startPos) + runtime.KeepAlive(endPos) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// UTF8ToUCS4: convert a string from UTF-8 to a 32-bit fixed width +// representation as UCS-4. A trailing 0 character will be added to the string +// after the converted text. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// +// The function returns the following values: +// +// - itemsRead (optional): location to store number of bytes read, or NULL. +// If NULL, then G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case str +// contains a trailing partial character. If an error occurs then the index +// of the invalid input is stored here. +// - itemsWritten (optional): location to store number of characters written +// or NULL. The value here stored does not include the trailing 0 character. +// - gunichar: pointer to a newly allocated UCS-4 string. This value must be +// freed with g_free(). If an error occurs, NULL will be returned and error +// set. +func UTF8ToUCS4(str string) (itemsRead, itemsWritten int32, gunichar *uint32, goerr error) { + var _arg1 *C.gchar // out + var _arg2 C.glong + var _arg3 C.glong // in + var _arg4 C.glong // in + var _cret *C.gunichar // in + var _cerr *C.GError // in + + _arg2 = (C.glong)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_to_ucs4(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(str) + + var _itemsRead int32 // out + var _itemsWritten int32 // out + var _gunichar *uint32 // out + var _goerr error // out + + _itemsRead = int32(_arg3) + _itemsWritten = int32(_arg4) + _gunichar = (*uint32)(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _itemsRead, _itemsWritten, _gunichar, _goerr +} + +// UTF8ToUCS4Fast: convert a string from UTF-8 to a 32-bit fixed width +// representation as UCS-4, assuming valid UTF-8 input. This function is roughly +// twice as fast as g_utf8_to_ucs4() but does no error checking on the input. +// A trailing 0 character will be added to the string after the converted text. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// +// The function returns the following values: +// +// - itemsWritten (optional): location to store the number of characters in +// the result, or NULL. +// - gunichar: pointer to a newly allocated UCS-4 string. This value must be +// freed with g_free(). +func UTF8ToUCS4Fast(str string) (int32, *uint32) { + var _arg1 *C.gchar // out + var _arg2 C.glong + var _arg3 C.glong // in + var _cret *C.gunichar // in + + _arg2 = (C.glong)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_to_ucs4_fast(_arg1, _arg2, &_arg3) + runtime.KeepAlive(str) + + var _itemsWritten int32 // out + var _gunichar *uint32 // out + + _itemsWritten = int32(_arg3) + _gunichar = (*uint32)(unsafe.Pointer(_cret)) + + return _itemsWritten, _gunichar +} + +// UTF8ToUTF16: convert a string from UTF-8 to UTF-16. A 0 character will be +// added to the result after the converted text. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string. +// +// The function returns the following values: +// +// - itemsRead (optional): location to store number of bytes read, or NULL. +// If NULL, then G_CONVERT_ERROR_PARTIAL_INPUT will be returned in case str +// contains a trailing partial character. If an error occurs then the index +// of the invalid input is stored here. +// - itemsWritten (optional): location to store number of #gunichar2 written, +// or NULL. The value stored here does not include the trailing 0. +// - guint16: pointer to a newly allocated UTF-16 string. This value must be +// freed with g_free(). If an error occurs, NULL will be returned and error +// set. +func UTF8ToUTF16(str string) (itemsRead, itemsWritten int32, guint16 *uint16, goerr error) { + var _arg1 *C.gchar // out + var _arg2 C.glong + var _arg3 C.glong // in + var _arg4 C.glong // in + var _cret *C.gunichar2 // in + var _cerr *C.GError // in + + _arg2 = (C.glong)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_to_utf16(_arg1, _arg2, &_arg3, &_arg4, &_cerr) + runtime.KeepAlive(str) + + var _itemsRead int32 // out + var _itemsWritten int32 // out + var _guint16 *uint16 // out + var _goerr error // out + + _itemsRead = int32(_arg3) + _itemsWritten = int32(_arg4) + _guint16 = (*uint16)(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _itemsRead, _itemsWritten, _guint16, _goerr +} + +// UTF8TruncateMiddle cuts off the middle of the string, preserving half of +// truncate_length characters at the beginning and half at the end. +// +// If string is already short enough, this returns a copy of string. +// If truncate_length is 0, an empty string is returned. +// +// The function takes the following parameters: +// +// - str: nul-terminated UTF-8 encoded string. +// - truncateLength: new size of string, in characters, including the ellipsis +// character. +// +// The function returns the following values: +// +// - utf8: newly-allocated copy of string ellipsized in the middle. +func UTF8TruncateMiddle(str string, truncateLength uint) string { + var _arg1 *C.gchar // out + var _arg2 C.gsize // out + var _cret *C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gsize(truncateLength) + + _cret = C.g_utf8_truncate_middle(_arg1, _arg2) + runtime.KeepAlive(str) + runtime.KeepAlive(truncateLength) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// UTF8Validate validates UTF-8 encoded text. str is the text to validate; +// if str is nul-terminated, then max_len can be -1, otherwise max_len should +// be the number of bytes to validate. If end is non-NULL, then the end of +// the valid range will be stored there (i.e. the start of the first invalid +// character if some bytes were invalid, or the end of the text being validated +// otherwise). +// +// Note that g_utf8_validate() returns FALSE if max_len is positive and any of +// the max_len bytes are nul. +// +// Returns TRUE if all of str was valid. Many GLib and GTK routines require +// valid UTF-8 as input; so data read from a file or the network should be +// checked with g_utf8_validate() before doing anything else with it. +// +// The function takes the following parameters: +// +// - str: pointer to character data. +// +// The function returns the following values: +// +// - end (optional): return location for end of valid data. +// - ok: TRUE if the text was valid UTF-8. +func UTF8Validate(str string) (string, bool) { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 *C.gchar // in + var _cret C.gboolean // in + + _arg2 = (C.gssize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_validate(_arg1, _arg2, &_arg3) + runtime.KeepAlive(str) + + var _end string // out + var _ok bool // out + + if _arg3 != nil { + _end = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) + } + if _cret != 0 { + _ok = true + } + + return _end, _ok +} + +// UTF8ValidateLen validates UTF-8 encoded text. +// +// As with g_utf8_validate(), but max_len must be set, and hence this function +// will always return FALSE if any of the bytes of str are nul. +// +// The function takes the following parameters: +// +// - str: pointer to character data. +// +// The function returns the following values: +// +// - end (optional): return location for end of valid data. +// - ok: TRUE if the text was valid UTF-8. +func UTF8ValidateLen(str string) (string, bool) { + var _arg1 *C.gchar // out + var _arg2 C.gsize + var _arg3 *C.gchar // in + var _cret C.gboolean // in + + _arg2 = (C.gsize)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_utf8_validate_len(_arg1, _arg2, &_arg3) + runtime.KeepAlive(str) + + var _end string // out + var _ok bool // out + + if _arg3 != nil { + _end = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) + } + if _cret != 0 { + _ok = true + } + + return _end, _ok +} + +// UUIDStringIsValid parses the string str and verify if it is a UUID. +// +// The function accepts the following syntax: +// +// - simple forms (e.g. f81d4fae-7dec-11d0-a765-00a0c91e6bf6) +// +// Note that hyphens are required within the UUID string itself, as per the +// aforementioned RFC. +// +// The function takes the following parameters: +// +// - str: string representing a UUID. +// +// The function returns the following values: +// +// - ok: TRUE if str is a valid UUID, FALSE otherwise. +func UUIDStringIsValid(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_uuid_string_is_valid(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UUIDStringRandom generates a random UUID (RFC 4122 version 4) as a string. +// It has the same randomness guarantees as #GRand, so must not be used for +// cryptographic purposes such as key generation, nonces, salts or one-time +// pads. +// +// The function returns the following values: +// +// - utf8: string that should be freed with g_free(). +func UUIDStringRandom() string { + var _cret *C.gchar // in + + _cret = C.g_uuid_string_random() + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +func VariantGetGType() coreglib.Type { + var _cret C.GType // in + + _cret = C.g_variant_get_gtype() + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// Array contains the public fields of a GArray. +// +// An instance of this type is always passed by reference. +type Array struct { + *array +} + +// array is the struct that's finalized. +type array struct { + native *C.GArray +} + +// Data: pointer to the element data. The data may be moved as elements are +// added to the #GArray. +func (a *Array) Data() string { + valptr := &a.native.data + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Len: number of elements in the #GArray not including the possible terminating +// zero element. +func (a *Array) Len() uint { + valptr := &a.native.len + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Len: number of elements in the #GArray not including the possible terminating +// zero element. +func (a *Array) SetLen(len uint) { + valptr := &a.native.len + *valptr = C.guint(len) +} + +// BookmarkFile: GBookmarkFile lets you parse, edit or create files containing +// bookmarks. +// +// Bookmarks refer to a URI, along with some meta-data about the resource +// pointed by the URI like its MIME type, the application that is +// registering the bookmark and the icon that should be used to represent +// the bookmark. The data is stored using the Desktop Bookmark Specification +// (http://www.gnome.org/~ebassi/bookmark-spec). +// +// The syntax of the bookmark files is described in detail inside the Desktop +// Bookmark Specification, here is a quick summary: bookmark files use a +// sub-class of the XML Bookmark Exchange Language specification, consisting +// of valid UTF-8 encoded XML, under the root element; each bookmark is +// stored inside a element, using its URI: no relative paths can be +// used inside a bookmark file. The bookmark may have a user defined title and +// description, to be used instead of the URI. Under the element, +// with its owner attribute set to http://freedesktop.org, is stored the +// meta-data about a resource pointed by its URI. The meta-data consists of +// the resource's MIME type; the applications that have registered a bookmark; +// the groups to which a bookmark belongs to; a visibility flag, used to set the +// bookmark as "private" to the applications and groups that has it registered; +// the URI and MIME type of an icon, to be used when displaying the bookmark +// inside a GUI. +// +// Here is an example of a bookmark file: bookmarks.xbel +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/glib/tests/bookmarks.xbel) +// +// A bookmark file might contain more than one bookmark; each bookmark is +// accessed through its URI. +// +// The important caveat of bookmark files is that when you add a new +// bookmark you must also add the application that is registering it, using +// glib.BookmarkFile.AddApplication() or glib.BookmarkFile.SetApplicationInfo(). +// If a bookmark has no applications then it won't be dumped when creating +// the on disk representation, using glib.BookmarkFile.ToData() or +// glib.BookmarkFile.ToFile(). +// +// An instance of this type is always passed by reference. +type BookmarkFile struct { + *bookmarkFile +} + +// bookmarkFile is the struct that's finalized. +type bookmarkFile struct { + native *C.GBookmarkFile +} + +func marshalBookmarkFile(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &BookmarkFile{&bookmarkFile{(*C.GBookmarkFile)(b)}}, nil +} + +// NewBookmarkFile constructs a struct BookmarkFile. +func NewBookmarkFile() *BookmarkFile { + var _cret *C.GBookmarkFile // in + + _cret = C.g_bookmark_file_new() + + var _bookmarkFile *BookmarkFile // out + + _bookmarkFile = (*BookmarkFile)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bookmarkFile)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bookmark_file_free((*C.GBookmarkFile)(intern.C)) + }, + ) + + return _bookmarkFile +} + +// AddApplication adds the application with name and exec to the list of +// applications that have registered a bookmark for uri into bookmark. +// +// Every bookmark inside a File must have at least an application registered. +// Each application must provide a name, a command line useful for launching +// the bookmark, the number of times the bookmark has been registered by the +// application and the last time the application registered this bookmark. +// +// If name is NULL, the name of the application will be the same returned +// by g_get_application_name(); if exec is NULL, the command line will be a +// composition of the program name as returned by g_get_prgname() and the "\u" +// modifier, which will be expanded to the bookmark's URI. +// +// This function will automatically take care of updating the registrations +// count and timestamping in case an application with the same name had already +// registered a bookmark for uri inside bookmark. +// +// If no bookmark for uri is found, one is created. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - name (optional) of the application registering the bookmark or NULL. +// - exec (optional): command line to be used to launch the bookmark or NULL. +func (bookmark *BookmarkFile) AddApplication(uri string, name string, exec string) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + if name != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg2)) + } + if exec != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(exec))) + defer C.free(unsafe.Pointer(_arg3)) + } + + C.g_bookmark_file_add_application(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(name) + runtime.KeepAlive(exec) +} + +// AddGroup adds group to the list of groups to which the bookmark for uri +// belongs to. +// +// If no bookmark for uri is found then it is created. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - group name to be added. +func (bookmark *BookmarkFile) AddGroup(uri string, group string) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(group))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_bookmark_file_add_group(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(group) +} + +// Copy: deeply copies a bookmark File object to a new one. +// +// The function returns the following values: +// +// - bookmarkFile: copy of bookmark. Use g_bookmark_free() when finished using +// it. +func (bookmark *BookmarkFile) Copy() *BookmarkFile { + var _arg0 *C.GBookmarkFile // out + var _cret *C.GBookmarkFile // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + + _cret = C.g_bookmark_file_copy(_arg0) + runtime.KeepAlive(bookmark) + + var _bookmarkFile *BookmarkFile // out + + _bookmarkFile = (*BookmarkFile)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bookmarkFile)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bookmark_file_free((*C.GBookmarkFile)(intern.C)) + }, + ) + + return _bookmarkFile +} + +// AddedDateTime gets the time the bookmark for uri was added to bookmark +// +// In the event the URI cannot be found, NULL is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - dateTime: Time. +func (bookmark *BookmarkFile) AddedDateTime(uri string) (*DateTime, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.char // out + var _cret *C.GDateTime // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_bookmark_file_get_added_date_time(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _dateTime *DateTime // out + var _goerr error // out + + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_date_time_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dateTime, _goerr +} + +// ApplicationInfo gets the registration information of app_name for the +// bookmark for uri. See g_bookmark_file_set_application_info() for more +// information about the returned data. +// +// The string returned in app_exec must be freed. +// +// In the event the URI cannot be found, FALSE is returned and error is set +// to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the event that no application +// with name app_name has registered a bookmark for uri, FALSE is returned and +// error is set to G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. In the event that +// unquoting the command line fails, an error of the G_SHELL_ERROR domain is set +// and FALSE is returned. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - name application's name. +// +// The function returns the following values: +// +// - exec (optional): return location for the command line of the application, +// or NULL. +// - count (optional): return location for the registration count, or NULL. +// - stamp (optional): return location for the last registration time, +// or NULL. +func (bookmark *BookmarkFile) ApplicationInfo(uri string, name string) (string, uint, *DateTime, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 *C.char // in + var _arg4 C.uint // in + var _arg5 *C.GDateTime // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_bookmark_file_get_application_info(_arg0, _arg1, _arg2, &_arg3, &_arg4, &_arg5, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(name) + + var _exec string // out + var _count uint // out + var _stamp *DateTime // out + var _goerr error // out + + if _arg3 != nil { + _exec = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) + defer C.free(unsafe.Pointer(_arg3)) + } + _count = uint(_arg4) + if _arg5 != nil { + _stamp = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_arg5))) + C.g_date_time_ref(_arg5) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_stamp)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _exec, _count, _stamp, _goerr +} + +// Applications retrieves the names of the applications that have registered the +// bookmark for uri. +// +// In the event the URI cannot be found, NULL is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - utf8s: newly allocated NULL-terminated array of strings. Use g_strfreev() +// to free it. +func (bookmark *BookmarkFile) Applications(uri string) ([]string, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cret **C.gchar // in + var _arg2 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_bookmark_file_get_applications(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg2) + _utf8s = make([]string, _arg2) + for i := 0; i < int(_arg2); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// Description retrieves the description of the bookmark for uri. +// +// In the event the URI cannot be found, NULL is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - utf8: newly allocated string or NULL if the specified URI cannot be +// found. +func (bookmark *BookmarkFile) Description(uri string) (string, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_bookmark_file_get_description(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// Groups retrieves the list of group names of the bookmark for uri. +// +// In the event the URI cannot be found, NULL is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The returned array is NULL terminated, so length may optionally be NULL. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - utf8s: newly allocated NULL-terminated array of group names. Use +// g_strfreev() to free it. +func (bookmark *BookmarkFile) Groups(uri string) ([]string, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cret **C.gchar // in + var _arg2 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_bookmark_file_get_groups(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg2) + _utf8s = make([]string, _arg2) + for i := 0; i < int(_arg2); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// Icon gets the icon of the bookmark for uri. +// +// In the event the URI cannot be found, FALSE is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - href (optional): return location for the icon's location or NULL. +// - mimeType (optional): return location for the icon's MIME type or NULL. +func (bookmark *BookmarkFile) Icon(uri string) (href string, mimeType string, goerr error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // in + var _arg3 *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_bookmark_file_get_icon(_arg0, _arg1, &_arg2, &_arg3, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _href string // out + var _mimeType string // out + var _goerr error // out + + if _arg2 != nil { + _href = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + if _arg3 != nil { + _mimeType = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) + defer C.free(unsafe.Pointer(_arg3)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _href, _mimeType, _goerr +} + +// IsPrivate gets whether the private flag of the bookmark for uri is set. +// +// In the event the URI cannot be found, FALSE is returned and error +// is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the event that the +// private flag cannot be found, FALSE is returned and error is set to +// G_BOOKMARK_FILE_ERROR_INVALID_VALUE. +// +// The function takes the following parameters: +// +// - uri: valid URI. +func (bookmark *BookmarkFile) IsPrivate(uri string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_bookmark_file_get_is_private(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// MIMEType retrieves the MIME type of the resource pointed by uri. +// +// In the event the URI cannot be found, NULL is returned and error +// is set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the event that +// the MIME type cannot be found, NULL is returned and error is set to +// G_BOOKMARK_FILE_ERROR_INVALID_VALUE. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - utf8: newly allocated string or NULL if the specified URI cannot be +// found. +func (bookmark *BookmarkFile) MIMEType(uri string) (string, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_bookmark_file_get_mime_type(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// ModifiedDateTime gets the time when the bookmark for uri was last modified. +// +// In the event the URI cannot be found, NULL is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - dateTime: Time. +func (bookmark *BookmarkFile) ModifiedDateTime(uri string) (*DateTime, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.char // out + var _cret *C.GDateTime // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_bookmark_file_get_modified_date_time(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _dateTime *DateTime // out + var _goerr error // out + + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_date_time_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dateTime, _goerr +} + +// Size gets the number of bookmarks inside bookmark. +// +// The function returns the following values: +// +// - gint: number of bookmarks. +func (bookmark *BookmarkFile) Size() int { + var _arg0 *C.GBookmarkFile // out + var _cret C.gint // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + + _cret = C.g_bookmark_file_get_size(_arg0) + runtime.KeepAlive(bookmark) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Title returns the title of the bookmark for uri. +// +// If uri is NULL, the title of bookmark is returned. +// +// In the event the URI cannot be found, NULL is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - uri (optional): valid URI or NULL. +// +// The function returns the following values: +// +// - utf8: newly allocated string or NULL if the specified URI cannot be +// found. +func (bookmark *BookmarkFile) Title(uri string) (string, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + if uri != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_bookmark_file_get_title(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// URIs returns all URIs of the bookmarks in the bookmark file bookmark. +// The array of returned URIs will be NULL-terminated, so length may optionally +// be NULL. +// +// The function returns the following values: +// +// - utf8s: newly allocated NULL-terminated array of strings. Use g_strfreev() +// to free it. +func (bookmark *BookmarkFile) URIs() []string { + var _arg0 *C.GBookmarkFile // out + var _cret **C.gchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + + _cret = C.g_bookmark_file_get_uris(_arg0, &_arg1) + runtime.KeepAlive(bookmark) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg1) + _utf8s = make([]string, _arg1) + for i := 0; i < int(_arg1); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// VisitedDateTime gets the time the bookmark for uri was last visited. +// +// In the event the URI cannot be found, NULL is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - dateTime: Time. +func (bookmark *BookmarkFile) VisitedDateTime(uri string) (*DateTime, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.char // out + var _cret *C.GDateTime // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_bookmark_file_get_visited_date_time(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _dateTime *DateTime // out + var _goerr error // out + + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_date_time_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dateTime, _goerr +} + +// HasApplication checks whether the bookmark for uri inside bookmark has been +// registered by application name. +// +// In the event the URI cannot be found, FALSE is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - name of the application. +func (bookmark *BookmarkFile) HasApplication(uri string, name string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_bookmark_file_has_application(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(name) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// HasGroup checks whether group appears in the list of groups to which the +// bookmark for uri belongs to. +// +// In the event the URI cannot be found, FALSE is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - group name to be searched. +func (bookmark *BookmarkFile) HasGroup(uri string, group string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(group))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_bookmark_file_has_group(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(group) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// HasItem looks whether the desktop bookmark has an item with its URI set to +// uri. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - ok: TRUE if uri is inside bookmark, FALSE otherwise. +func (bookmark *BookmarkFile) HasItem(uri string) bool { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_bookmark_file_has_item(_arg0, _arg1) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// LoadFromData loads a bookmark file from memory into an empty File structure. +// If the object cannot be created then error is set to a FileError. +// +// The function takes the following parameters: +// +// - data: desktop bookmarks loaded in memory. +func (bookmark *BookmarkFile) LoadFromData(data string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 C.gsize + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg2 = (C.gsize)(len(data)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(data) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(data)), data) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_bookmark_file_load_from_data(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(data) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// LoadFromDataDirs: this function looks for a desktop bookmark file +// named file in the paths returned from g_get_user_data_dir() and +// g_get_system_data_dirs(), loads the file into bookmark and returns the file's +// full path in full_path. If the file could not be loaded then error is set to +// either a Error or FileError. +// +// The function takes the following parameters: +// +// - file: relative path to a filename to open and parse. +// +// The function returns the following values: +// +// - fullPath (optional): return location for a string containing the full +// path of the file, or NULL. +func (bookmark *BookmarkFile) LoadFromDataDirs(file string) (string, error) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_bookmark_file_load_from_data_dirs(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(file) + + var _fullPath string // out + var _goerr error // out + + if _arg2 != nil { + _fullPath = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fullPath, _goerr +} + +// LoadFromFile loads a desktop bookmark file into an empty File structure. +// If the file could not be loaded then error is set to either a Error or +// FileError. +// +// The function takes the following parameters: +// +// - filename: path of a filename to load, in the GLib file name encoding. +func (bookmark *BookmarkFile) LoadFromFile(filename string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_bookmark_file_load_from_file(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(filename) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// MoveItem changes the URI of a bookmark item from old_uri to new_uri. +// Any existing bookmark for new_uri will be overwritten. If new_uri is NULL, +// then the bookmark is removed. +// +// In the event the URI cannot be found, FALSE is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. +// +// The function takes the following parameters: +// +// - oldUri: valid URI. +// - newUri (optional): valid URI, or NULL. +func (bookmark *BookmarkFile) MoveItem(oldUri string, newUri string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(oldUri))) + defer C.free(unsafe.Pointer(_arg1)) + if newUri != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(newUri))) + defer C.free(unsafe.Pointer(_arg2)) + } + + C.g_bookmark_file_move_item(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(oldUri) + runtime.KeepAlive(newUri) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// RemoveApplication removes application registered with name from the list of +// applications that have registered a bookmark for uri inside bookmark. +// +// In the event the URI cannot be found, FALSE is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the event that no application with +// name app_name has registered a bookmark for uri, FALSE is returned and error +// is set to G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - name of the application. +func (bookmark *BookmarkFile) RemoveApplication(uri string, name string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_bookmark_file_remove_application(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(name) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// RemoveGroup removes group from the list of groups to which the bookmark for +// uri belongs to. +// +// In the event the URI cannot be found, FALSE is returned and error is set +// to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. In the event no group was defined, +// FALSE is returned and error is set to G_BOOKMARK_FILE_ERROR_INVALID_VALUE. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - group name to be removed. +func (bookmark *BookmarkFile) RemoveGroup(uri string, group string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(group))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_bookmark_file_remove_group(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(group) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// RemoveItem removes the bookmark for uri from the bookmark file bookmark. +// +// The function takes the following parameters: +// +// - uri: valid URI. +func (bookmark *BookmarkFile) RemoveItem(uri string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_bookmark_file_remove_item(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAddedDateTime sets the time the bookmark for uri was added into bookmark. +// +// If no bookmark for uri is found then it is created. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - added: Time. +func (bookmark *BookmarkFile) SetAddedDateTime(uri string, added *DateTime) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.char // out + var _arg2 *C.GDateTime // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(added))) + + C.g_bookmark_file_set_added_date_time(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(added) +} + +// SetApplicationInfo sets the meta-data of application name inside the list of +// applications that have registered a bookmark for uri inside bookmark. +// +// You should rarely use this function; use g_bookmark_file_add_application() +// and g_bookmark_file_remove_application() instead. +// +// name can be any UTF-8 encoded string used to identify an application. +// exec can have one of these two modifiers: "\f", which will be +// expanded as the local file name retrieved from the bookmark's URI; +// "\u", which will be expanded as the bookmark's URI. The expansion is +// done automatically when retrieving the stored command line using the +// g_bookmark_file_get_application_info() function. count is the number of +// times the application has registered the bookmark; if is < 0, the current +// registration count will be increased by one, if is 0, the application with +// name will be removed from the list of registered applications. stamp is the +// Unix time of the last registration. +// +// If you try to remove an application by setting its registration count to +// zero, and no bookmark for uri is found, FALSE is returned and error is +// set to G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND; similarly, in the event that +// no application name has registered a bookmark for uri, FALSE is returned +// and error is set to G_BOOKMARK_FILE_ERROR_APP_NOT_REGISTERED. Otherwise, +// if no bookmark for uri is found, one is created. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - name application's name. +// - exec application's command line. +// - count: number of registrations done for this application. +// - stamp (optional): time of the last registration for this application, +// which may be NULL if count is 0. +func (bookmark *BookmarkFile) SetApplicationInfo(uri string, name string, exec string, count int, stamp *DateTime) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 *C.char // out + var _arg4 C.int // out + var _arg5 *C.GDateTime // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.char)(unsafe.Pointer(C.CString(exec))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = C.int(count) + if stamp != nil { + _arg5 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(stamp))) + } + + C.g_bookmark_file_set_application_info(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(name) + runtime.KeepAlive(exec) + runtime.KeepAlive(count) + runtime.KeepAlive(stamp) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetDescription sets description as the description of the bookmark for uri. +// +// If uri is NULL, the description of bookmark is set. +// +// If a bookmark for uri cannot be found then it is created. +// +// The function takes the following parameters: +// +// - uri (optional): valid URI or NULL. +// - description: string. +func (bookmark *BookmarkFile) SetDescription(uri string, description string) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + if uri != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(description))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_bookmark_file_set_description(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(description) +} + +// SetGroups sets a list of group names for the item with URI uri. Each +// previously set group name list is removed. +// +// If uri cannot be found then an item for it is created. +// +// The function takes the following parameters: +// +// - uri item's URI. +// - groups (optional): array of group names, or NULL to remove all groups. +func (bookmark *BookmarkFile) SetGroups(uri string, groups []string) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 **C.gchar // out + var _arg3 C.gsize + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = (C.gsize)(len(groups)) + _arg2 = (**C.gchar)(C.calloc(C.size_t(len(groups)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((**C.gchar)(_arg2), len(groups)) + for i := range groups { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(groups[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + + C.g_bookmark_file_set_groups(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(groups) +} + +// SetIcon sets the icon for the bookmark for uri. If href is NULL, unsets the +// currently set icon. href can either be a full URL for the icon file or the +// icon name following the Icon Naming specification. +// +// If no bookmark for uri is found one is created. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - href (optional): URI of the icon for the bookmark, or NULL. +// - mimeType: MIME type of the icon for the bookmark. +func (bookmark *BookmarkFile) SetIcon(uri string, href string, mimeType string) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + if href != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(href))) + defer C.free(unsafe.Pointer(_arg2)) + } + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg3)) + + C.g_bookmark_file_set_icon(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(href) + runtime.KeepAlive(mimeType) +} + +// SetIsPrivate sets the private flag of the bookmark for uri. +// +// If a bookmark for uri cannot be found then it is created. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - isPrivate: TRUE if the bookmark should be marked as private. +func (bookmark *BookmarkFile) SetIsPrivate(uri string, isPrivate bool) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + if isPrivate { + _arg2 = C.TRUE + } + + C.g_bookmark_file_set_is_private(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(isPrivate) +} + +// SetMIMEType sets mime_type as the MIME type of the bookmark for uri. +// +// If a bookmark for uri cannot be found then it is created. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - mimeType: MIME type. +func (bookmark *BookmarkFile) SetMIMEType(uri string, mimeType string) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(mimeType))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_bookmark_file_set_mime_type(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(mimeType) +} + +// SetModifiedDateTime sets the last time the bookmark for uri was last +// modified. +// +// If no bookmark for uri is found then it is created. +// +// The "modified" time should only be set when the bookmark's +// meta-data was actually changed. Every function of File that +// modifies a bookmark also changes the modification time, except for +// g_bookmark_file_set_visited_date_time(). +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - modified: Time. +func (bookmark *BookmarkFile) SetModifiedDateTime(uri string, modified *DateTime) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.char // out + var _arg2 *C.GDateTime // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(modified))) + + C.g_bookmark_file_set_modified_date_time(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(modified) +} + +// SetTitle sets title as the title of the bookmark for uri inside the bookmark +// file bookmark. +// +// If uri is NULL, the title of bookmark is set. +// +// If a bookmark for uri cannot be found then it is created. +// +// The function takes the following parameters: +// +// - uri (optional): valid URI or NULL. +// - title: UTF-8 encoded string. +func (bookmark *BookmarkFile) SetTitle(uri string, title string) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + if uri != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(title))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_bookmark_file_set_title(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(title) +} + +// SetVisitedDateTime sets the time the bookmark for uri was last visited. +// +// If no bookmark for uri is found then it is created. +// +// The "visited" time should only be set if the bookmark was launched, either +// using the command line retrieved by g_bookmark_file_get_application_info() +// or by the default application for the bookmark's MIME type, retrieved using +// g_bookmark_file_get_mime_type(). Changing the "visited" time does not affect +// the "modified" time. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// - visited: Time. +func (bookmark *BookmarkFile) SetVisitedDateTime(uri string, visited *DateTime) { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.char // out + var _arg2 *C.GDateTime // out + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(visited))) + + C.g_bookmark_file_set_visited_date_time(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(visited) +} + +// ToData: this function outputs bookmark as a string. +// +// The function returns the following values: +// +// - guint8s: a newly allocated string holding the contents of the File. +func (bookmark *BookmarkFile) ToData() ([]byte, error) { + var _arg0 *C.GBookmarkFile // out + var _cret *C.gchar // in + var _arg1 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + + _cret = C.g_bookmark_file_to_data(_arg0, &_arg1, &_cerr) + runtime.KeepAlive(bookmark) + + var _guint8s []byte // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint8s, _goerr +} + +// ToFile: this function outputs bookmark into a file. The write process is +// guaranteed to be atomic by using g_file_set_contents() internally. +// +// The function takes the following parameters: +// +// - filename: path of the output file. +func (bookmark *BookmarkFile) ToFile(filename string) error { + var _arg0 *C.GBookmarkFile // out + var _arg1 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_bookmark_file_to_file(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(filename) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +func BookmarkFileErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_bookmark_file_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// ByteArray contains the public fields of a GByteArray. +// +// An instance of this type is always passed by reference. +type ByteArray struct { + *byteArray +} + +// byteArray is the struct that's finalized. +type byteArray struct { + native *C.GByteArray +} + +// Data: pointer to the element data. The data may be moved as elements are +// added to the Array. +func (b *ByteArray) Data() *byte { + valptr := &b.native.data + var _v *byte // out + _v = (*byte)(unsafe.Pointer(*valptr)) + return _v +} + +// Len: number of elements in the Array. +func (b *ByteArray) Len() uint { + valptr := &b.native.len + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Len: number of elements in the Array. +func (b *ByteArray) SetLen(len uint) { + valptr := &b.native.len + *valptr = C.guint(len) +} + +// Bytes: simple refcounted data type representing an immutable sequence of zero +// or more bytes from an unspecified origin. +// +// The purpose of a #GBytes is to keep the memory region that it holds alive for +// as long as anyone holds a reference to the bytes. When the last reference +// count is dropped, the memory is released. Multiple unrelated callers +// can use byte data in the #GBytes without coordinating their activities, +// resting assured that the byte data will not change or move while they hold a +// reference. +// +// A #GBytes can come from many different origins that may have different +// procedures for freeing the memory region. Examples are memory from +// g_malloc(), from memory slices, from a File or memory from other allocators. +// +// #GBytes work well as keys in Table. Use g_bytes_equal() and g_bytes_hash() +// as parameters to g_hash_table_new() or g_hash_table_new_full(). #GBytes can +// also be used as keys in a #GTree by passing the g_bytes_compare() function to +// g_tree_new(). +// +// The data pointed to by this bytes must not be modified. For a mutable array +// of bytes see Array. Use g_bytes_unref_to_array() to create a mutable array +// for a #GBytes sequence. To create an immutable #GBytes from a mutable Array, +// use the g_byte_array_free_to_bytes() function. +// +// An instance of this type is always passed by reference. +type Bytes struct { + *bytes +} + +// bytes is the struct that's finalized. +type bytes struct { + native *C.GBytes +} + +// NewBytes constructs a struct Bytes. +func NewBytes(data []byte) *Bytes { + var _arg1 C.gconstpointer // out + var _arg2 C.gsize + var _cret *C.GBytes // in + + _arg2 = (C.gsize)(len(data)) + if len(data) > 0 { + _arg1 = (C.gconstpointer)(unsafe.Pointer(&data[0])) + } + + _cret = C.g_bytes_new(_arg1, _arg2) + runtime.KeepAlive(data) + + var _bytes *Bytes // out + + _bytes = (*Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// Compare compares the two #GBytes values. +// +// This function can be used to sort GBytes instances in lexicographical order. +// +// If bytes1 and bytes2 have different length but the shorter one is a prefix of +// the longer one then the shorter one is considered to be less than the longer +// one. Otherwise the first byte where both differ is used for comparison. +// If bytes1 has a smaller value at that position it is considered less, +// otherwise greater than bytes2. +// +// The function takes the following parameters: +// +// - bytes2: pointer to a #GBytes to compare with bytes1. +// +// The function returns the following values: +// +// - gint: negative value if bytes1 is less than bytes2, a positive value if +// bytes1 is greater than bytes2, and zero if bytes1 is equal to bytes2. +func (bytes1 *Bytes) Compare(bytes2 *Bytes) int { + var _arg0 C.gconstpointer // out + var _arg1 C.gconstpointer // out + var _cret C.gint // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes2))) + + _cret = C.g_bytes_compare(_arg0, _arg1) + runtime.KeepAlive(bytes1) + runtime.KeepAlive(bytes2) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Equal compares the two #GBytes values being pointed to and returns TRUE if +// they are equal. +// +// This function can be passed to g_hash_table_new() as the key_equal_func +// parameter, when using non-NULL #GBytes pointers as keys in a Table. +// +// The function takes the following parameters: +// +// - bytes2: pointer to a #GBytes to compare with bytes1. +// +// The function returns the following values: +// +// - ok: TRUE if the two keys match. +func (bytes1 *Bytes) Equal(bytes2 *Bytes) bool { + var _arg0 C.gconstpointer // out + var _arg1 C.gconstpointer // out + var _cret C.gboolean // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes2))) + + _cret = C.g_bytes_equal(_arg0, _arg1) + runtime.KeepAlive(bytes1) + runtime.KeepAlive(bytes2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Data: get the byte data in the #GBytes. This data should not be modified. +// +// This function will always return the same pointer for a given #GBytes. +// +// NULL may be returned if size is 0. This is not guaranteed, as the #GBytes may +// represent an empty string with data non-NULL and size as 0. NULL will not be +// returned if size is non-zero. +// +// The function returns the following values: +// +// - guint8s (optional): a pointer to the byte data, or NULL. +func (bytes *Bytes) Data() []byte { + var _arg0 *C.GBytes // out + var _cret C.gconstpointer // in + var _arg1 C.gsize // in + + _arg0 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + + _cret = C.g_bytes_get_data(_arg0, &_arg1) + runtime.KeepAlive(bytes) + + var _guint8s []byte // out + + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) + + return _guint8s +} + +// Region gets a pointer to a region in bytes. +// +// The region starts at offset many bytes from the start of the data and +// contains n_elements many elements of element_size size. +// +// n_elements may be zero, but element_size must always be non-zero. Ideally, +// element_size is a static constant (eg: sizeof a struct). +// +// This function does careful bounds checking (including checking for arithmetic +// overflows) and returns a non-NULL pointer if the specified region lies +// entirely within the bytes. If the region is in some way out of range, +// or if an overflow has occurred, then NULL is returned. +// +// Note: it is possible to have a valid zero-size region. In this case, +// the returned pointer will be equal to the base pointer of the data of bytes, +// plus offset. This will be non-NULL except for the case where bytes itself +// was a zero-sized region. Since it is unlikely that you will be using this +// function to check for a zero-sized region in a zero-sized bytes, NULL +// effectively always means "error". +// +// The function takes the following parameters: +// +// - elementSize: non-zero element size. +// - offset to the start of the region within the bytes. +// - nElements: number of elements in the region. +// +// The function returns the following values: +// +// - gpointer (optional): requested region, or NULL in case of an error. +func (bytes *Bytes) Region(elementSize uint, offset uint, nElements uint) unsafe.Pointer { + var _arg0 *C.GBytes // out + var _arg1 C.gsize // out + var _arg2 C.gsize // out + var _arg3 C.gsize // out + var _cret C.gconstpointer // in + + _arg0 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + _arg1 = C.gsize(elementSize) + _arg2 = C.gsize(offset) + _arg3 = C.gsize(nElements) + + _cret = C.g_bytes_get_region(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(bytes) + runtime.KeepAlive(elementSize) + runtime.KeepAlive(offset) + runtime.KeepAlive(nElements) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// Size: get the size of the byte data in the #GBytes. +// +// This function will always return the same value for a given #GBytes. +// +// The function returns the following values: +// +// - gsize: size. +func (bytes *Bytes) Size() uint { + var _arg0 *C.GBytes // out + var _cret C.gsize // in + + _arg0 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + + _cret = C.g_bytes_get_size(_arg0) + runtime.KeepAlive(bytes) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Hash creates an integer hash code for the byte data in the #GBytes. +// +// This function can be passed to g_hash_table_new() as the key_hash_func +// parameter, when using non-NULL #GBytes pointers as keys in a Table. +// +// The function returns the following values: +// +// - guint: hash value corresponding to the key. +func (bytes *Bytes) Hash() uint { + var _arg0 C.gconstpointer // out + var _cret C.guint // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes))) + + _cret = C.g_bytes_hash(_arg0) + runtime.KeepAlive(bytes) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// NewFromBytes creates a #GBytes which is a subsection of another #GBytes. +// The offset + length may not be longer than the size of bytes. +// +// A reference to bytes will be held by the newly created #GBytes until the byte +// data is no longer needed. +// +// Since 2.56, if offset is 0 and length matches the size of bytes, then bytes +// will be returned with the reference count incremented by 1. If bytes is a +// slice of another #GBytes, then the resulting #GBytes will reference the same +// #GBytes instead of bytes. This allows consumers to simplify the usage of +// #GBytes when asynchronously writing to streams. +// +// The function takes the following parameters: +// +// - offset which subsection starts at. +// - length of subsection. +// +// The function returns the following values: +// +// - ret: new #GBytes. +func (bytes *Bytes) NewFromBytes(offset uint, length uint) *Bytes { + var _arg0 *C.GBytes // out + var _arg1 C.gsize // out + var _arg2 C.gsize // out + var _cret *C.GBytes // in + + _arg0 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + _arg1 = C.gsize(offset) + _arg2 = C.gsize(length) + + _cret = C.g_bytes_new_from_bytes(_arg0, _arg1, _arg2) + runtime.KeepAlive(bytes) + runtime.KeepAlive(offset) + runtime.KeepAlive(length) + + var _ret *Bytes // out + + _ret = (*Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_ret)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _ret +} + +// Checksum: GLib provides a generic API for computing checksums (or ‘digests’) +// for a sequence of arbitrary bytes, using various hashing algorithms like MD5, +// SHA-1 and SHA-256. Checksums are commonly used in various environments and +// specifications. +// +// To create a new GChecksum, use glib.Checksum.New. To free a GChecksum, +// use glib.Checksum.Free(). +// +// GLib supports incremental checksums using the GChecksum data structure, +// by calling glib.Checksum.Update() as long as there’s data available and +// then using glib.Checksum.GetString() or glib.Checksum.GetDigest() to +// compute the checksum and return it either as a string in hexadecimal form, +// or as a raw sequence of bytes. To compute the checksum for binary blobs +// and nul-terminated strings in one go, use the convenience functions +// glib.ComputeChecksumForData() and glib.ComputeChecksumForString(), +// respectively. +// +// An instance of this type is always passed by reference. +type Checksum struct { + *checksum +} + +// checksum is the struct that's finalized. +type checksum struct { + native *C.GChecksum +} + +func marshalChecksum(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Checksum{&checksum{(*C.GChecksum)(b)}}, nil +} + +// NewChecksum constructs a struct Checksum. +func NewChecksum(checksumType ChecksumType) *Checksum { + var _arg1 C.GChecksumType // out + var _cret *C.GChecksum // in + + _arg1 = C.GChecksumType(checksumType) + + _cret = C.g_checksum_new(_arg1) + runtime.KeepAlive(checksumType) + + var _checksum *Checksum // out + + if _cret != nil { + _checksum = (*Checksum)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_checksum)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_checksum_free((*C.GChecksum)(intern.C)) + }, + ) + } + + return _checksum +} + +// Copy copies a #GChecksum. If checksum has been closed, by calling +// g_checksum_get_string() or g_checksum_get_digest(), the copied checksum will +// be closed as well. +// +// The function returns the following values: +// +// - ret: copy of the passed #GChecksum. Use g_checksum_free() when finished +// using it. +func (checksum *Checksum) Copy() *Checksum { + var _arg0 *C.GChecksum // out + var _cret *C.GChecksum // in + + _arg0 = (*C.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) + + _cret = C.g_checksum_copy(_arg0) + runtime.KeepAlive(checksum) + + var _ret *Checksum // out + + _ret = (*Checksum)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_ret)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_checksum_free((*C.GChecksum)(intern.C)) + }, + ) + + return _ret +} + +// String gets the digest as a hexadecimal string. +// +// Once this function has been called the #GChecksum can no longer be updated +// with g_checksum_update(). +// +// The hexadecimal characters will be lower case. +// +// The function returns the following values: +// +// - utf8: hexadecimal representation of the checksum. The returned string is +// owned by the checksum and should not be modified or freed. +func (checksum *Checksum) String() string { + var _arg0 *C.GChecksum // out + var _cret *C.gchar // in + + _arg0 = (*C.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) + + _cret = C.g_checksum_get_string(_arg0) + runtime.KeepAlive(checksum) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Reset resets the state of the checksum back to its initial state. +func (checksum *Checksum) Reset() { + var _arg0 *C.GChecksum // out + + _arg0 = (*C.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) + + C.g_checksum_reset(_arg0) + runtime.KeepAlive(checksum) +} + +// Update feeds data into an existing #GChecksum. The checksum must still be +// open, that is g_checksum_get_string() or g_checksum_get_digest() must not +// have been called on checksum. +// +// The function takes the following parameters: +// +// - data: buffer used to compute the checksum. +func (checksum *Checksum) Update(data []byte) { + var _arg0 *C.GChecksum // out + var _arg1 *C.guchar // out + var _arg2 C.gssize + + _arg0 = (*C.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) + _arg2 = (C.gssize)(len(data)) + if len(data) > 0 { + _arg1 = (*C.guchar)(unsafe.Pointer(&data[0])) + } + + C.g_checksum_update(_arg0, _arg1, _arg2) + runtime.KeepAlive(checksum) + runtime.KeepAlive(data) +} + +// ChecksumTypeGetLength gets the length in bytes of digests of type +// checksum_type. +// +// The function takes the following parameters: +// +// - checksumType: Type. +// +// The function returns the following values: +// +// - gssize: checksum length, or -1 if checksum_type is not supported. +func ChecksumTypeGetLength(checksumType ChecksumType) int { + var _arg1 C.GChecksumType // out + var _cret C.gssize // in + + _arg1 = C.GChecksumType(checksumType) + + _cret = C.g_checksum_type_get_length(_arg1) + runtime.KeepAlive(checksumType) + + var _gssize int // out + + _gssize = int(_cret) + + return _gssize +} + +// Completion: GCompletion provides support for automatic completion of a +// string using any group of target strings. It is typically used for file name +// completion as is common in many UNIX shells. +// +// A GCompletion is created using glib.Completion().New. Target items are added +// and removed with glib.Completion.AddItems(), glib.Completion.RemoveItems() +// and glib.Completion.ClearItems(). A completion attempt is requested with +// glib.Completion.Complete() or glib.Completion.CompleteUTF8(). When no longer +// needed, the GCompletion is freed with glib.Completion.Free(). +// +// Items in the completion can be simple strings (e.g. filenames), +// or pointers to arbitrary data structures. If data structures are used you +// must provide a glib.CompletionFunc in glib.Completion().New, which retrieves +// the item’s string from the data structure. You can change the way in which +// strings are compared by setting a different glib.CompletionStrncmpFunc in +// glib.Completion.SetCompare(). +// +// GCompletion has been marked as deprecated, since this API is rarely used and +// not very actively maintained. +// +// Deprecated: Rarely used API. +// +// An instance of this type is always passed by reference. +type Completion struct { + *completion +} + +// completion is the struct that's finalized. +type completion struct { + native *C.GCompletion +} + +// ClearItems removes all items from the #GCompletion. The items are not freed, +// so if the memory was dynamically allocated, it should be freed after calling +// this function. +// +// Deprecated: Rarely used API. +func (cmp *Completion) ClearItems() { + var _arg0 *C.GCompletion // out + + _arg0 = (*C.GCompletion)(gextras.StructNative(unsafe.Pointer(cmp))) + + C.g_completion_clear_items(_arg0) + runtime.KeepAlive(cmp) +} + +// DateTime: GDateTime is a structure that combines a Gregorian date and time +// into a single structure. +// +// GDateTime provides many conversion and methods to manipulate dates and times. +// Time precision is provided down to microseconds and the time can range +// (proleptically) from 0001-01-01 00:00:00 to 9999-12-31 23:59:59.999999. +// GDateTime follows POSIX time in the sense that it is oblivious to leap +// seconds. +// +// GDateTime is an immutable object; once it has been created it cannot be +// modified further. All modifiers will create a new GDateTime. Nearly all such +// functions can fail due to the date or time going out of range, in which case +// NULL will be returned. +// +// GDateTime is reference counted: the reference count is increased by calling +// glib.DateTime.Ref() and decreased by calling glib.DateTime.Unref(). +// When the reference count drops to 0, the resources allocated by the GDateTime +// structure are released. +// +// Many parts of the API may produce non-obvious results. As an example, +// adding two months to January 31st will yield March 31st whereas adding one +// month and then one month again will yield either March 28th or March 29th. +// Also note that adding 24 hours is not always the same as adding one day +// (since days containing daylight savings time transitions are either 23 or 25 +// hours in length). +// +// An instance of this type is always passed by reference. +type DateTime struct { + *dateTime +} + +// dateTime is the struct that's finalized. +type dateTime struct { + native *C.GDateTime +} + +func marshalDateTime(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DateTime{&dateTime{(*C.GDateTime)(b)}}, nil +} + +// NewDateTime constructs a struct DateTime. +func NewDateTime(tz *TimeZone, year int, month int, day int, hour int, minute int, seconds float64) *DateTime { + var _arg1 *C.GTimeZone // out + var _arg2 C.gint // out + var _arg3 C.gint // out + var _arg4 C.gint // out + var _arg5 C.gint // out + var _arg6 C.gint // out + var _arg7 C.gdouble // out + var _cret *C.GDateTime // in + + _arg1 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) + _arg2 = C.gint(year) + _arg3 = C.gint(month) + _arg4 = C.gint(day) + _arg5 = C.gint(hour) + _arg6 = C.gint(minute) + _arg7 = C.gdouble(seconds) + + _cret = C.g_date_time_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(tz) + runtime.KeepAlive(year) + runtime.KeepAlive(month) + runtime.KeepAlive(day) + runtime.KeepAlive(hour) + runtime.KeepAlive(minute) + runtime.KeepAlive(seconds) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeFromISO8601 constructs a struct DateTime. +func NewDateTimeFromISO8601(text string, defaultTz *TimeZone) *DateTime { + var _arg1 *C.gchar // out + var _arg2 *C.GTimeZone // out + var _cret *C.GDateTime // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(text))) + defer C.free(unsafe.Pointer(_arg1)) + if defaultTz != nil { + _arg2 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(defaultTz))) + } + + _cret = C.g_date_time_new_from_iso8601(_arg1, _arg2) + runtime.KeepAlive(text) + runtime.KeepAlive(defaultTz) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeFromTimevalLocal constructs a struct DateTime. +func NewDateTimeFromTimevalLocal(tv *TimeVal) *DateTime { + var _arg1 *C.GTimeVal // out + var _cret *C.GDateTime // in + + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(tv))) + + _cret = C.g_date_time_new_from_timeval_local(_arg1) + runtime.KeepAlive(tv) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeFromTimevalUTC constructs a struct DateTime. +func NewDateTimeFromTimevalUTC(tv *TimeVal) *DateTime { + var _arg1 *C.GTimeVal // out + var _cret *C.GDateTime // in + + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(tv))) + + _cret = C.g_date_time_new_from_timeval_utc(_arg1) + runtime.KeepAlive(tv) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeFromUnixLocal constructs a struct DateTime. +func NewDateTimeFromUnixLocal(t int64) *DateTime { + var _arg1 C.gint64 // out + var _cret *C.GDateTime // in + + _arg1 = C.gint64(t) + + _cret = C.g_date_time_new_from_unix_local(_arg1) + runtime.KeepAlive(t) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeFromUnixLocalUsec constructs a struct DateTime. +func NewDateTimeFromUnixLocalUsec(usecs int64) *DateTime { + var _arg1 C.gint64 // out + var _cret *C.GDateTime // in + + _arg1 = C.gint64(usecs) + + _cret = C.g_date_time_new_from_unix_local_usec(_arg1) + runtime.KeepAlive(usecs) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeFromUnixUTC constructs a struct DateTime. +func NewDateTimeFromUnixUTC(t int64) *DateTime { + var _arg1 C.gint64 // out + var _cret *C.GDateTime // in + + _arg1 = C.gint64(t) + + _cret = C.g_date_time_new_from_unix_utc(_arg1) + runtime.KeepAlive(t) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeFromUnixUTCUsec constructs a struct DateTime. +func NewDateTimeFromUnixUTCUsec(usecs int64) *DateTime { + var _arg1 C.gint64 // out + var _cret *C.GDateTime // in + + _arg1 = C.gint64(usecs) + + _cret = C.g_date_time_new_from_unix_utc_usec(_arg1) + runtime.KeepAlive(usecs) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeLocal constructs a struct DateTime. +func NewDateTimeLocal(year int, month int, day int, hour int, minute int, seconds float64) *DateTime { + var _arg1 C.gint // out + var _arg2 C.gint // out + var _arg3 C.gint // out + var _arg4 C.gint // out + var _arg5 C.gint // out + var _arg6 C.gdouble // out + var _cret *C.GDateTime // in + + _arg1 = C.gint(year) + _arg2 = C.gint(month) + _arg3 = C.gint(day) + _arg4 = C.gint(hour) + _arg5 = C.gint(minute) + _arg6 = C.gdouble(seconds) + + _cret = C.g_date_time_new_local(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(year) + runtime.KeepAlive(month) + runtime.KeepAlive(day) + runtime.KeepAlive(hour) + runtime.KeepAlive(minute) + runtime.KeepAlive(seconds) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeNow constructs a struct DateTime. +func NewDateTimeNow(tz *TimeZone) *DateTime { + var _arg1 *C.GTimeZone // out + var _cret *C.GDateTime // in + + _arg1 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) + + _cret = C.g_date_time_new_now(_arg1) + runtime.KeepAlive(tz) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeNowLocal constructs a struct DateTime. +func NewDateTimeNowLocal() *DateTime { + var _cret *C.GDateTime // in + + _cret = C.g_date_time_new_now_local() + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeNowUTC constructs a struct DateTime. +func NewDateTimeNowUTC() *DateTime { + var _cret *C.GDateTime // in + + _cret = C.g_date_time_new_now_utc() + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// NewDateTimeUTC constructs a struct DateTime. +func NewDateTimeUTC(year int, month int, day int, hour int, minute int, seconds float64) *DateTime { + var _arg1 C.gint // out + var _arg2 C.gint // out + var _arg3 C.gint // out + var _arg4 C.gint // out + var _arg5 C.gint // out + var _arg6 C.gdouble // out + var _cret *C.GDateTime // in + + _arg1 = C.gint(year) + _arg2 = C.gint(month) + _arg3 = C.gint(day) + _arg4 = C.gint(hour) + _arg5 = C.gint(minute) + _arg6 = C.gdouble(seconds) + + _cret = C.g_date_time_new_utc(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(year) + runtime.KeepAlive(month) + runtime.KeepAlive(day) + runtime.KeepAlive(hour) + runtime.KeepAlive(minute) + runtime.KeepAlive(seconds) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// Add creates a copy of datetime and adds the specified timespan to the copy. +// +// The function takes the following parameters: +// +// - timespan: Span. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) Add(timespan TimeSpan) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 C.GTimeSpan // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.GTimeSpan(timespan) + + _cret = C.g_date_time_add(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(timespan) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// AddDays creates a copy of datetime and adds the specified number of days to +// the copy. Add negative values to subtract days. +// +// The function takes the following parameters: +// +// - days: number of days. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) AddDays(days int) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 C.gint // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(days) + + _cret = C.g_date_time_add_days(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(days) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// AddFull creates a new Time adding the specified values to the current date +// and time in datetime. Add negative values to subtract. +// +// The function takes the following parameters: +// +// - years: number of years to add. +// - months: number of months to add. +// - days: number of days to add. +// - hours: number of hours to add. +// - minutes: number of minutes to add. +// - seconds: number of seconds to add. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) AddFull(years int, months int, days int, hours int, minutes int, seconds float64) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 C.gint // out + var _arg2 C.gint // out + var _arg3 C.gint // out + var _arg4 C.gint // out + var _arg5 C.gint // out + var _arg6 C.gdouble // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(years) + _arg2 = C.gint(months) + _arg3 = C.gint(days) + _arg4 = C.gint(hours) + _arg5 = C.gint(minutes) + _arg6 = C.gdouble(seconds) + + _cret = C.g_date_time_add_full(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(datetime) + runtime.KeepAlive(years) + runtime.KeepAlive(months) + runtime.KeepAlive(days) + runtime.KeepAlive(hours) + runtime.KeepAlive(minutes) + runtime.KeepAlive(seconds) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// AddHours creates a copy of datetime and adds the specified number of hours. +// Add negative values to subtract hours. +// +// The function takes the following parameters: +// +// - hours: number of hours to add. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) AddHours(hours int) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 C.gint // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(hours) + + _cret = C.g_date_time_add_hours(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(hours) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// AddMinutes creates a copy of datetime adding the specified number of minutes. +// Add negative values to subtract minutes. +// +// The function takes the following parameters: +// +// - minutes: number of minutes to add. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) AddMinutes(minutes int) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 C.gint // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(minutes) + + _cret = C.g_date_time_add_minutes(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(minutes) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// AddMonths creates a copy of datetime and adds the specified number of months +// to the copy. Add negative values to subtract months. +// +// The day of the month of the resulting Time is clamped to the number of +// days in the updated calendar month. For example, if adding 1 month to 31st +// January 2018, the result would be 28th February 2018. In 2020 (a leap year), +// the result would be 29th February. +// +// The function takes the following parameters: +// +// - months: number of months. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) AddMonths(months int) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 C.gint // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(months) + + _cret = C.g_date_time_add_months(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(months) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// AddSeconds creates a copy of datetime and adds the specified number of +// seconds. Add negative values to subtract seconds. +// +// The function takes the following parameters: +// +// - seconds: number of seconds to add. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) AddSeconds(seconds float64) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 C.gdouble // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gdouble(seconds) + + _cret = C.g_date_time_add_seconds(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(seconds) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// AddWeeks creates a copy of datetime and adds the specified number of weeks to +// the copy. Add negative values to subtract weeks. +// +// The function takes the following parameters: +// +// - weeks: number of weeks. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) AddWeeks(weeks int) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 C.gint // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(weeks) + + _cret = C.g_date_time_add_weeks(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(weeks) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// AddYears creates a copy of datetime and adds the specified number of years to +// the copy. Add negative values to subtract years. +// +// As with g_date_time_add_months(), if the resulting date would be 29th +// February on a non-leap year, the day will be clamped to 28th February. +// +// The function takes the following parameters: +// +// - years: number of years. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) AddYears(years int) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 C.gint // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(years) + + _cret = C.g_date_time_add_years(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(years) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// Compare: comparison function for Times that is suitable as a Func. Both Times +// must be non-NULL. +// +// The function takes the following parameters: +// +// - dt2: second Time to compare. +// +// The function returns the following values: +// +// - gint: -1, 0 or 1 if dt1 is less than, equal to or greater than dt2. +func (dt1 *DateTime) Compare(dt2 *DateTime) int { + var _arg0 C.gconstpointer // out + var _arg1 C.gconstpointer // out + var _cret C.gint // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt2))) + + _cret = C.g_date_time_compare(_arg0, _arg1) + runtime.KeepAlive(dt1) + runtime.KeepAlive(dt2) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Difference calculates the difference in time between end and begin. The +// Span that is returned is effectively end - begin (ie: positive if the first +// parameter is larger). +// +// The function takes the following parameters: +// +// - begin: Time. +// +// The function returns the following values: +// +// - timeSpan: difference between the two Time, as a time span expressed in +// microseconds. +func (end *DateTime) Difference(begin *DateTime) TimeSpan { + var _arg0 *C.GDateTime // out + var _arg1 *C.GDateTime // out + var _cret C.GTimeSpan // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(end))) + _arg1 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(begin))) + + _cret = C.g_date_time_difference(_arg0, _arg1) + runtime.KeepAlive(end) + runtime.KeepAlive(begin) + + var _timeSpan TimeSpan // out + + _timeSpan = TimeSpan(_cret) + + return _timeSpan +} + +// Equal checks to see if dt1 and dt2 are equal. +// +// Equal here means that they represent the same moment after converting them to +// the same time zone. +// +// The function takes the following parameters: +// +// - dt2: Time. +// +// The function returns the following values: +// +// - ok: TRUE if dt1 and dt2 are equal. +func (dt1 *DateTime) Equal(dt2 *DateTime) bool { + var _arg0 C.gconstpointer // out + var _arg1 C.gconstpointer // out + var _cret C.gboolean // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt2))) + + _cret = C.g_date_time_equal(_arg0, _arg1) + runtime.KeepAlive(dt1) + runtime.KeepAlive(dt2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Format creates a newly allocated string representing the requested format. +// +// The format strings understood by this function are a subset of the strftime() +// format language as specified by C99. The D, U and W conversions are not +// supported, nor is the E modifier. The GNU extensions k, l, s and P are +// supported, however, as are the 0, _ and - modifiers. The Python extension f +// is also supported. +// +// In contrast to strftime(), this function always produces a UTF-8 string, +// regardless of the current locale. Note that the rendering of many formats is +// locale-dependent and may not match the strftime() output exactly. +// +// The following format specifiers are supported: +// +// - a: the abbreviated weekday name according to the current locale +// +// - A: the full weekday name according to the current locale +// +// - b: the abbreviated month name according to the current locale +// +// - B: the full month name according to the current locale +// +// - c: the preferred date and time representation for the current locale +// +// - C: the century number (year/100) as a 2-digit integer (00-99) +// +// - d: the day of the month as a decimal number (range 01 to 31) +// +// - e: the day of the month as a decimal number (range 1 to 31); single digits +// are preceded by a figure space (U+2007) +// +// - F: equivalent to Y-m-d (the ISO 8601 date format) +// +// - g: the last two digits of the ISO 8601 week-based year as a decimal number +// (00-99). This works well with V and u. +// +// - G: the ISO 8601 week-based year as a decimal number. This works well with V +// and u. +// +// - h: equivalent to b +// +// - H: the hour as a decimal number using a 24-hour clock (range 00 to 23) +// +// - I: the hour as a decimal number using a 12-hour clock (range 01 to 12) +// +// - j: the day of the year as a decimal number (range 001 to 366) +// +// - k: the hour (24-hour clock) as a decimal number (range 0 to 23); single +// digits are preceded by a figure space (U+2007) +// +// - l: the hour (12-hour clock) as a decimal number (range 1 to 12); single +// digits are preceded by a figure space (U+2007) +// +// - m: the month as a decimal number (range 01 to 12) +// +// - M: the minute as a decimal number (range 00 to 59) +// +// - f: the microsecond as a decimal number (range 000000 to 999999) +// +// - p: either ‘AM’ or ‘PM’ according to the given time value, or the +// corresponding strings for the current locale. Noon is treated as ‘PM’ and +// midnight as ‘AM’. Use of this format specifier is discouraged, as many +// locales have no concept of AM/PM formatting. Use c or X instead. +// +// - P: like p but lowercase: ‘am’ or ‘pm’ or a corresponding string for the +// current locale. Use of this format specifier is discouraged, as many locales +// have no concept of AM/PM formatting. Use c or X instead. +// +// - r: the time in a.m. or p.m. notation. Use of this format specifier is +// discouraged, as many locales have no concept of AM/PM formatting. Use c or X +// instead. +// +// - R: the time in 24-hour notation (H:M) +// +// - s: the number of seconds since the Epoch, that is, since 1970-01-01 +// 00:00:00 UTC +// +// - S: the second as a decimal number (range 00 to 60) +// +// - t: a tab character +// +// - T: the time in 24-hour notation with seconds (H:M:S) +// +// - u: the ISO 8601 standard day of the week as a decimal, range 1 to 7, +// Monday being 1. This works well with G and V. +// +// - V: the ISO 8601 standard week number of the current year as a decimal +// number, range 01 to 53, where week 1 is the first week that has at least 4 +// days in the new year. See g_date_time_get_week_of_year(). This works well +// with G and u. +// +// - w: the day of the week as a decimal, range 0 to 6, Sunday being 0. This is +// not the ISO 8601 standard format — use u instead. +// +// - x: the preferred date representation for the current locale without the +// time +// +// - X: the preferred time representation for the current locale without the +// date +// +// - y: the year as a decimal number without the century +// +// - Y: the year as a decimal number including the century +// +// - z: the time zone as an offset from UTC (+hhmm) +// +// - %:z: the time zone as an offset from UTC (+hh:mm). This is a gnulib +// strftime() extension. Since: 2.38 +// +// - %::z: the time zone as an offset from UTC (+hh:mm:ss). This is a gnulib +// strftime() extension. Since: 2.38 +// +// - %:::z: the time zone as an offset from UTC, with : to necessary precision +// (e.g., -04, +05:30). This is a gnulib strftime() extension. Since: 2.38 +// +// - Z: the time zone or name or abbreviation +// +// - %%: a literal % character +// +// Some conversion specifications can be modified by preceding the conversion +// specifier by one or more modifier characters. +// +// The following modifiers are supported for many of the numeric conversions: +// +// - O: Use alternative numeric symbols, if the current locale supports those. +// +// - _: Pad a numeric result with spaces. This overrides the default padding for +// the specifier. +// +// - -: Do not pad a numeric result. This overrides the default padding for the +// specifier. +// +// - 0: Pad a numeric result with zeros. This overrides the default padding for +// the specifier. +// +// The following modifiers are supported for many of the alphabetic conversions: +// +// - ^: Use upper case if possible. This is a gnulib strftime() extension. +// Since: 2.80 +// +// - #: Use opposite case if possible. This is a gnulib strftime() extension. +// Since: 2.80 +// +// Additionally, when O is used with B, b, or h, it produces the alternative +// form of a month name. The alternative form should be used when the month +// name is used without a day number (e.g., standalone). It is required in some +// languages (Baltic, Slavic, Greek, and more) due to their grammatical rules. +// For other languages there is no difference. OB is a GNU and BSD strftime() +// extension expected to be added to the future POSIX specification, Ob and Oh +// are GNU strftime() extensions. Since: 2.56 +// +// Since GLib 2.80, when E is used with c, C, x, X, y or Y, the date is +// formatted using an alternate era representation specific to the locale. +// This is typically used for the Thai solar calendar or Japanese era names, +// for example. +// +// - Ec: the preferred date and time representation for the current locale, +// using the alternate era representation +// +// - EC: the name of the era +// +// - Ex: the preferred date representation for the current locale without the +// time, using the alternate era representation +// +// - EX: the preferred time representation for the current locale without the +// date, using the alternate era representation +// +// - Ey: the year since the beginning of the era denoted by the EC specifier +// +// - EY: the full alternative year representation. +// +// The function takes the following parameters: +// +// - format: valid UTF-8 string, containing the format for the Time. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string formatted to the requested format +// or NULL in the case that there was an error (such as a format specifier +// not being supported in the current locale). The string should be freed +// with g_free(). +func (datetime *DateTime) Format(format string) string { + var _arg0 *C.GDateTime // out + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(format))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_date_time_format(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(format) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// FormatISO8601: format datetime in ISO 8601 format +// (https://en.wikipedia.org/wiki/ISO_8601), including the date, time and time +// zone, and return that as a UTF-8 encoded string. +// +// Since GLib 2.66, this will output to sub-second precision if needed. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string formatted in ISO 8601 format or +// NULL in the case that there was an error. The string should be freed with +// g_free(). +func (datetime *DateTime) FormatISO8601() string { + var _arg0 *C.GDateTime // out + var _cret *C.gchar // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_format_iso8601(_arg0) + runtime.KeepAlive(datetime) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// DayOfMonth retrieves the day of the month represented by datetime in the +// gregorian calendar. +// +// The function returns the following values: +// +// - gint: day of the month. +func (datetime *DateTime) DayOfMonth() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_day_of_month(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// DayOfWeek retrieves the ISO 8601 day of the week on which datetime falls (1 +// is Monday, 2 is Tuesday... 7 is Sunday). +// +// The function returns the following values: +// +// - gint: day of the week. +func (datetime *DateTime) DayOfWeek() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_day_of_week(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// DayOfYear retrieves the day of the year represented by datetime in the +// Gregorian calendar. +// +// The function returns the following values: +// +// - gint: day of the year. +func (datetime *DateTime) DayOfYear() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_day_of_year(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Hour retrieves the hour of the day represented by datetime. +// +// The function returns the following values: +// +// - gint: hour of the day. +func (datetime *DateTime) Hour() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_hour(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Microsecond retrieves the microsecond of the date represented by datetime. +// +// The function returns the following values: +// +// - gint: microsecond of the second. +func (datetime *DateTime) Microsecond() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_microsecond(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Minute retrieves the minute of the hour represented by datetime. +// +// The function returns the following values: +// +// - gint: minute of the hour. +func (datetime *DateTime) Minute() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_minute(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Month retrieves the month of the year represented by datetime in the +// Gregorian calendar. +// +// The function returns the following values: +// +// - gint: month represented by datetime. +func (datetime *DateTime) Month() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_month(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Second retrieves the second of the minute represented by datetime. +// +// The function returns the following values: +// +// - gint: second represented by datetime. +func (datetime *DateTime) Second() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_second(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Seconds retrieves the number of seconds since the start of the last minute, +// including the fractional part. +// +// The function returns the following values: +// +// - gdouble: number of seconds. +func (datetime *DateTime) Seconds() float64 { + var _arg0 *C.GDateTime // out + var _cret C.gdouble // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_seconds(_arg0) + runtime.KeepAlive(datetime) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// Timezone: get the time zone for this datetime. +// +// The function returns the following values: +// +// - timeZone: time zone. +func (datetime *DateTime) Timezone() *TimeZone { + var _arg0 *C.GDateTime // out + var _cret *C.GTimeZone // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_timezone(_arg0) + runtime.KeepAlive(datetime) + + var _timeZone *TimeZone // out + + _timeZone = (*TimeZone)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_time_zone_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_timeZone)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_time_zone_unref((*C.GTimeZone)(intern.C)) + }, + ) + + return _timeZone +} + +// TimezoneAbbreviation determines the time zone abbreviation to be used at the +// time and in the time zone of datetime. +// +// For example, in Toronto this is currently "EST" during the winter months and +// "EDT" during the summer months when daylight savings time is in effect. +// +// The function returns the following values: +// +// - utf8: time zone abbreviation. The returned string is owned by the Time +// and it should not be modified or freed. +func (datetime *DateTime) TimezoneAbbreviation() string { + var _arg0 *C.GDateTime // out + var _cret *C.gchar // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_timezone_abbreviation(_arg0) + runtime.KeepAlive(datetime) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// UTCOffset determines the offset to UTC in effect at the time and in the time +// zone of datetime. +// +// The offset is the number of microseconds that you add to UTC time to arrive +// at local time for the time zone (ie: negative numbers for time zones west of +// GMT, positive numbers for east). +// +// If datetime represents UTC time, then the offset is always zero. +// +// The function returns the following values: +// +// - timeSpan: number of microseconds that should be added to UTC to get the +// local time. +func (datetime *DateTime) UTCOffset() TimeSpan { + var _arg0 *C.GDateTime // out + var _cret C.GTimeSpan // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_utc_offset(_arg0) + runtime.KeepAlive(datetime) + + var _timeSpan TimeSpan // out + + _timeSpan = TimeSpan(_cret) + + return _timeSpan +} + +// WeekNumberingYear returns the ISO 8601 week-numbering year in which the week +// containing datetime falls. +// +// This function, taken together with g_date_time_get_week_of_year() and +// g_date_time_get_day_of_week() can be used to determine the full ISO week date +// on which datetime falls. +// +// This is usually equal to the normal Gregorian year (as returned by +// g_date_time_get_year()), except as detailed below: +// +// For Thursday, the week-numbering year is always equal to the usual calendar +// year. For other days, the number is such that every day within a complete +// week (Monday to Sunday) is contained within the same week-numbering year. +// +// For Monday, Tuesday and Wednesday occurring near the end of the year, +// this may mean that the week-numbering year is one greater than the calendar +// year (so that these days have the same week-numbering year as the Thursday +// occurring early in the next year). +// +// For Friday, Saturday and Sunday occurring near the start of the year, this +// may mean that the week-numbering year is one less than the calendar year (so +// that these days have the same week-numbering year as the Thursday occurring +// late in the previous year). +// +// An equivalent description is that the week-numbering year is equal to the +// calendar year containing the majority of the days in the current week (Monday +// to Sunday). +// +// Note that January 1 0001 in the proleptic Gregorian calendar is a Monday, +// so this function never returns 0. +// +// The function returns the following values: +// +// - gint: ISO 8601 week-numbering year for datetime. +func (datetime *DateTime) WeekNumberingYear() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_week_numbering_year(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// WeekOfYear returns the ISO 8601 week number for the week containing datetime. +// The ISO 8601 week number is the same for every day of the week (from Moday +// through Sunday). That can produce some unusual results (described below). +// +// The first week of the year is week 1. This is the week that contains the +// first Thursday of the year. Equivalently, this is the first week that has +// more than 4 of its days falling within the calendar year. +// +// The value 0 is never returned by this function. Days contained within a year +// but occurring before the first ISO 8601 week of that year are considered as +// being contained in the last week of the previous year. Similarly, the final +// days of a calendar year may be considered as being part of the first ISO 8601 +// week of the next year if 4 or more days of that week are contained within the +// new year. +// +// The function returns the following values: +// +// - gint: ISO 8601 week number for datetime. +func (datetime *DateTime) WeekOfYear() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_week_of_year(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Year retrieves the year represented by datetime in the Gregorian calendar. +// +// The function returns the following values: +// +// - gint: year represented by datetime. +func (datetime *DateTime) Year() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_get_year(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Ymd retrieves the Gregorian day, month, and year of a given Time. +// +// The function returns the following values: +// +// - year (optional): return location for the gregorian year, or NULL. +// - month (optional): return location for the month of the year, or NULL. +// - day (optional): return location for the day of the month, or NULL. +func (datetime *DateTime) Ymd() (year int, month int, day int) { + var _arg0 *C.GDateTime // out + var _arg1 C.gint // in + var _arg2 C.gint // in + var _arg3 C.gint // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + C.g_date_time_get_ymd(_arg0, &_arg1, &_arg2, &_arg3) + runtime.KeepAlive(datetime) + + var _year int // out + var _month int // out + var _day int // out + + _year = int(_arg1) + _month = int(_arg2) + _day = int(_arg3) + + return _year, _month, _day +} + +// Hash hashes datetime into a #guint, suitable for use within Table. +// +// The function returns the following values: +// +// - guint containing the hash. +func (datetime *DateTime) Hash() uint { + var _arg0 C.gconstpointer // out + var _cret C.guint // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_hash(_arg0) + runtime.KeepAlive(datetime) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// IsDaylightSavings determines if daylight savings time is in effect at the +// time and in the time zone of datetime. +// +// The function returns the following values: +// +// - ok: TRUE if daylight savings time is in effect. +func (datetime *DateTime) IsDaylightSavings() bool { + var _arg0 *C.GDateTime // out + var _cret C.gboolean // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_is_daylight_savings(_arg0) + runtime.KeepAlive(datetime) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ToLocal creates a new Time corresponding to the same instant in time as +// datetime, but in the local time zone. +// +// This call is equivalent to calling g_date_time_to_timezone() with the time +// zone returned by g_time_zone_new_local(). +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) ToLocal() *DateTime { + var _arg0 *C.GDateTime // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_to_local(_arg0) + runtime.KeepAlive(datetime) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// ToTimeval stores the instant in time that datetime represents into tv. +// +// The time contained in a Val is always stored in the form of seconds elapsed +// since 1970-01-01 00:00:00 UTC, regardless of the time zone associated with +// datetime. +// +// On systems where 'long' is 32bit (ie: all 32bit systems and all Windows +// systems), a Val is incapable of storing the entire range of values that Time +// is capable of expressing. On those systems, this function returns FALSE to +// indicate that the time is out of range. +// +// On systems where 'long' is 64bit, this function never fails. +// +// Deprecated: Val is not year-2038-safe. Use g_date_time_to_unix() instead. +// +// The function takes the following parameters: +// +// - tv to modify. +// +// The function returns the following values: +// +// - ok: TRUE if successful, else FALSE. +func (datetime *DateTime) ToTimeval(tv *TimeVal) bool { + var _arg0 *C.GDateTime // out + var _arg1 *C.GTimeVal // out + var _cret C.gboolean // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(tv))) + + _cret = C.g_date_time_to_timeval(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(tv) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ToTimezone: create a new Time corresponding to the same instant in time as +// datetime, but in the time zone tz. +// +// This call can fail in the case that the time goes out of bounds. For example, +// converting 0001-01-01 00:00:00 UTC to a time zone west of Greenwich will fail +// (due to the year 0 being out of range). +// +// The function takes the following parameters: +// +// - tz: new Zone. +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) ToTimezone(tz *TimeZone) *DateTime { + var _arg0 *C.GDateTime // out + var _arg1 *C.GTimeZone // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) + + _cret = C.g_date_time_to_timezone(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(tz) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// ToUnix gives the Unix time corresponding to datetime, rounding down to the +// nearest second. +// +// Unix time is the number of seconds that have elapsed since 1970-01-01 +// 00:00:00 UTC, regardless of the time zone associated with datetime. +// +// The function returns the following values: +// +// - gint64: unix time corresponding to datetime. +func (datetime *DateTime) ToUnix() int64 { + var _arg0 *C.GDateTime // out + var _cret C.gint64 // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_to_unix(_arg0) + runtime.KeepAlive(datetime) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// ToUnixUsec gives the Unix time corresponding to datetime, in microseconds. +// +// Unix time is the number of microseconds that have elapsed since 1970-01-01 +// 00:00:00 UTC, regardless of the time zone associated with datetime. +// +// The function returns the following values: +// +// - gint64: unix time corresponding to datetime. +func (datetime *DateTime) ToUnixUsec() int64 { + var _arg0 *C.GDateTime // out + var _cret C.gint64 // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_to_unix_usec(_arg0) + runtime.KeepAlive(datetime) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// ToUTC creates a new Time corresponding to the same instant in time as +// datetime, but in UTC. +// +// This call is equivalent to calling g_date_time_to_timezone() with the time +// zone returned by g_time_zone_new_utc(). +// +// The function returns the following values: +// +// - dateTime (optional): newly created Time which should be freed with +// g_date_time_unref(), or NULL. +func (datetime *DateTime) ToUTC() *DateTime { + var _arg0 *C.GDateTime // out + var _cret *C.GDateTime // in + + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + + _cret = C.g_date_time_to_utc(_arg0) + runtime.KeepAlive(datetime) + + var _dateTime *DateTime // out + + if _cret != nil { + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dateTime)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_date_time_unref((*C.GDateTime)(intern.C)) + }, + ) + } + + return _dateTime +} + +// DebugKey associates a string with a bit flag. Used in g_parse_debug_string(). +// +// An instance of this type is always passed by reference. +type DebugKey struct { + *debugKey +} + +// debugKey is the struct that's finalized. +type debugKey struct { + native *C.GDebugKey +} + +// Key: string. +func (d *DebugKey) Key() string { + valptr := &d.native.key + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Value: flag. +func (d *DebugKey) Value() uint { + valptr := &d.native.value + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Value: flag. +func (d *DebugKey) SetValue(value uint) { + valptr := &d.native.value + *valptr = C.guint(value) +} + +// Dir: opaque structure representing an opened directory. +// +// An instance of this type is always passed by reference. +type Dir struct { + *dir +} + +// dir is the struct that's finalized. +type dir struct { + native *C.GDir +} + +func marshalDir(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Dir{&dir{(*C.GDir)(b)}}, nil +} + +// NewDirOpen constructs a struct Dir. +func NewDirOpen(path string, flags uint) (*Dir, error) { + var _arg1 *C.gchar // out + var _arg2 C.guint // out + var _cret *C.GDir // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.guint(flags) + + _cret = C.g_dir_open(_arg1, _arg2, &_cerr) + runtime.KeepAlive(path) + runtime.KeepAlive(flags) + + var _dir *Dir // out + var _goerr error // out + + _dir = (*Dir)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_dir)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_dir_unref((*C.GDir)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _dir, _goerr +} + +// Close closes the directory immediately and decrements the reference count. +// +// Once the reference count reaches zero, the GDir structure itself will be +// freed. Prior to GLib 2.80, GDir was not reference counted. +// +// It is an error to call any of the GDir methods other than glib.Dir.Ref() and +// glib.Dir.Unref() on a GDir after calling glib.Dir.Close() on it. +func (dir *Dir) Close() { + var _arg0 *C.GDir // out + + _arg0 = (*C.GDir)(gextras.StructNative(unsafe.Pointer(dir))) + + C.g_dir_close(_arg0) + runtime.KeepAlive(dir) +} + +// ReadName retrieves the name of another entry in the directory, or NULL. +// The order of entries returned from this function is not defined, and may vary +// by file system or other operating-system dependent factors. +// +// NULL may also be returned in case of errors. On Unix, you can check errno to +// find out if NULL was returned because of an error. +// +// On Unix, the '.' and '..' entries are omitted, and the returned name is in +// the on-disk encoding. +// +// On Windows, as is true of all GLib functions which operate on filenames, +// the returned name is in UTF-8. +// +// The function returns the following values: +// +// - filename entry's name or NULL if there are no more entries. The return +// value is owned by GLib and must not be modified or freed. +func (dir *Dir) ReadName() string { + var _arg0 *C.GDir // out + var _cret *C.gchar // in + + _arg0 = (*C.GDir)(gextras.StructNative(unsafe.Pointer(dir))) + + _cret = C.g_dir_read_name(_arg0) + runtime.KeepAlive(dir) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// Rewind resets the given directory. The next call to g_dir_read_name() will +// return the first entry again. +func (dir *Dir) Rewind() { + var _arg0 *C.GDir // out + + _arg0 = (*C.GDir)(gextras.StructNative(unsafe.Pointer(dir))) + + C.g_dir_rewind(_arg0) + runtime.KeepAlive(dir) +} + +// DirMakeTmp creates a subdirectory in the preferred directory for temporary +// files (as returned by g_get_tmp_dir()). +// +// tmpl should be a string in the GLib file name encoding containing a sequence +// of six 'X' characters, as the parameter to g_mkstemp(). However, unlike these +// functions, the template should only be a basename, no directory components +// are allowed. If template is NULL, a default template is used. +// +// Note that in contrast to g_mkdtemp() (and mkdtemp()) tmpl is not modified, +// and might thus be a read-only literal string. +// +// The function takes the following parameters: +// +// - tmpl (optional): template for directory name, as in g_mkdtemp(), basename +// only, or NULL for a default template. +// +// The function returns the following values: +// +// - filename: actual name used. This string should be freed with g_free() +// when not needed any longer and is is in the GLib file name encoding. +// In case of errors, NULL is returned and error will be set. +func DirMakeTmp(tmpl string) (string, error) { + var _arg1 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + if tmpl != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(tmpl))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_dir_make_tmp(_arg1, &_cerr) + runtime.KeepAlive(tmpl) + + var _filename string // out + var _goerr error // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _filename, _goerr +} + +// HashTable struct is an opaque data structure to represent a [Hash +// Table][glib-Hash-Tables]. It should only be accessed via the following +// functions. +// +// An instance of this type is always passed by reference. +type HashTable struct { + *hashTable +} + +// hashTable is the struct that's finalized. +type hashTable struct { + native *C.GHashTable +} + +func marshalHashTable(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &HashTable{&hashTable{(*C.GHashTable)(b)}}, nil +} + +// HashTableAdd: this is a convenience function for using a Table as a set. +// It is equivalent to calling g_hash_table_replace() with key as both the key +// and the value. +// +// In particular, this means that if key already exists in the hash table, +// then the old copy of key in the hash table is freed and key replaces it in +// the table. +// +// When a hash table only ever contains keys that have themselves as the +// corresponding value it is able to be stored more efficiently. See the +// discussion in the section description. +// +// Starting from GLib 2.40, this function returns a boolean value to indicate +// whether the newly added value was already in the hash table or not. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - key (optional) to insert. +// +// The function returns the following values: +// +// - ok: TRUE if the key did not exist yet. +func HashTableAdd(hashTable map[unsafe.Pointer]unsafe.Pointer, key unsafe.Pointer) bool { + var _arg1 *C.GHashTable // out + var _arg2 C.gpointer // out + var _cret C.gboolean // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (C.gpointer)(unsafe.Pointer(key)) + + _cret = C.g_hash_table_add(_arg1, _arg2) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HashTableContains checks if key is in hash_table. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - key (optional) to check. +// +// The function returns the following values: +// +// - ok: TRUE if key is in hash_table, FALSE otherwise. +func HashTableContains(hashTable map[unsafe.Pointer]unsafe.Pointer, key unsafe.Pointer) bool { + var _arg1 *C.GHashTable // out + var _arg2 C.gconstpointer // out + var _cret C.gboolean // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (C.gconstpointer)(unsafe.Pointer(key)) + + _cret = C.g_hash_table_contains(_arg1, _arg2) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HashTableDestroy destroys all keys and values in the Table and decrements +// its reference count by 1. If keys and/or values are dynamically allocated, +// you should either free them first or create the Table with destroy notifiers +// using g_hash_table_new_full(). In the latter case the destroy functions you +// supplied will be called on all keys and values during the destruction phase. +// +// The function takes the following parameters: +// +// - hashTable: Table. +func HashTableDestroy(hashTable map[unsafe.Pointer]unsafe.Pointer) { + var _arg1 *C.GHashTable // out + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + + C.g_hash_table_destroy(_arg1) + runtime.KeepAlive(hashTable) +} + +// HashTableFind calls the given function for key/value pairs in the Table until +// predicate returns TRUE. The function is passed the key and value of each +// pair, and the given user_data parameter. The hash table may not be modified +// while iterating over it (you can't add/remove items). +// +// Note, that hash tables are really only optimized for forward lookups, i.e. +// g_hash_table_lookup(). So code that frequently issues g_hash_table_find() +// or g_hash_table_foreach() (e.g. in the order of once per every entry in +// a hash table) should probably be reworked to use additional or different +// data structures for reverse lookups (keep in mind that an O(n) find/foreach +// operation issued for all n values in a hash table ends up needing O(n*n) +// operations). +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - predicate: function to test the key/value pairs for a certain property. +// +// The function returns the following values: +// +// - gpointer (optional): value of the first key/value pair is returned, +// for which predicate evaluates to TRUE. If no pair with the requested +// property is found, NULL is returned. +func HashTableFind(hashTable map[unsafe.Pointer]unsafe.Pointer, predicate HRFunc) unsafe.Pointer { + var _arg1 *C.GHashTable // out + var _arg2 C.GHRFunc // out + var _arg3 C.gpointer + var _cret C.gpointer // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (*[0]byte)(C._gotk4_glib2_HRFunc) + _arg3 = C.gpointer(gbox.Assign(predicate)) + defer gbox.Delete(uintptr(_arg3)) + + _cret = C.g_hash_table_find(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(predicate) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// HashTableForEach calls the given function for each of the key/value pairs +// in the Table. The function is passed the key and value of each pair, +// and the given user_data parameter. The hash table may not be modified while +// iterating over it (you can't add/remove items). To remove all items matching +// a predicate, use g_hash_table_foreach_remove(). +// +// The order in which g_hash_table_foreach() iterates over the keys/values in +// the hash table is not defined. +// +// See g_hash_table_find() for performance caveats for linear order searches in +// contrast to g_hash_table_lookup(). +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - fn: function to call for each key/value pair. +func HashTableForEach(hashTable map[unsafe.Pointer]unsafe.Pointer, fn HFunc) { + var _arg1 *C.GHashTable // out + var _arg2 C.GHFunc // out + var _arg3 C.gpointer + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (*[0]byte)(C._gotk4_glib2_HFunc) + _arg3 = C.gpointer(gbox.Assign(fn)) + defer gbox.Delete(uintptr(_arg3)) + + C.g_hash_table_foreach(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(fn) +} + +// HashTableForEachRemove calls the given function for each key/value pair in +// the Table. If the function returns TRUE, then the key/value pair is removed +// from the Table. If you supplied key or value destroy functions when creating +// the Table, they are used to free the memory allocated for the removed keys +// and values. +// +// See TableIter for an alternative way to loop over the key/value pairs in the +// hash table. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - fn: function to call for each key/value pair. +// +// The function returns the following values: +// +// - guint: number of key/value pairs removed. +func HashTableForEachRemove(hashTable map[unsafe.Pointer]unsafe.Pointer, fn HRFunc) uint { + var _arg1 *C.GHashTable // out + var _arg2 C.GHRFunc // out + var _arg3 C.gpointer + var _cret C.guint // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (*[0]byte)(C._gotk4_glib2_HRFunc) + _arg3 = C.gpointer(gbox.Assign(fn)) + defer gbox.Delete(uintptr(_arg3)) + + _cret = C.g_hash_table_foreach_remove(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(fn) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// HashTableForEachSteal calls the given function for each key/value pair in the +// Table. If the function returns TRUE, then the key/value pair is removed from +// the Table, but no key or value destroy functions are called. +// +// See TableIter for an alternative way to loop over the key/value pairs in the +// hash table. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - fn: function to call for each key/value pair. +// +// The function returns the following values: +// +// - guint: number of key/value pairs removed. +func HashTableForEachSteal(hashTable map[unsafe.Pointer]unsafe.Pointer, fn HRFunc) uint { + var _arg1 *C.GHashTable // out + var _arg2 C.GHRFunc // out + var _arg3 C.gpointer + var _cret C.guint // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (*[0]byte)(C._gotk4_glib2_HRFunc) + _arg3 = C.gpointer(gbox.Assign(fn)) + defer gbox.Delete(uintptr(_arg3)) + + _cret = C.g_hash_table_foreach_steal(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(fn) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// HashTableInsert inserts a new key and value into a Table. +// +// If the key already exists in the Table its current value is replaced with the +// new value. If you supplied a value_destroy_func when creating the Table, the +// old value is freed using that function. If you supplied a key_destroy_func +// when creating the Table, the passed key is freed using that function. +// +// Starting from GLib 2.40, this function returns a boolean value to indicate +// whether the newly added value was already in the hash table or not. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - key (optional) to insert. +// - value (optional) to associate with the key. +// +// The function returns the following values: +// +// - ok: TRUE if the key did not exist yet. +func HashTableInsert(hashTable map[unsafe.Pointer]unsafe.Pointer, key, value unsafe.Pointer) bool { + var _arg1 *C.GHashTable // out + var _arg2 C.gpointer // out + var _arg3 C.gpointer // out + var _cret C.gboolean // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (C.gpointer)(unsafe.Pointer(key)) + _arg3 = (C.gpointer)(unsafe.Pointer(value)) + + _cret = C.g_hash_table_insert(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HashTableLookup looks up a key in a Table. Note that this function +// cannot distinguish between a key that is not present and one which +// is present and has the value NULL. If you need this distinction, use +// g_hash_table_lookup_extended(). +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - key (optional) to look up. +// +// The function returns the following values: +// +// - gpointer (optional): associated value, or NULL if the key is not found. +func HashTableLookup(hashTable map[unsafe.Pointer]unsafe.Pointer, key unsafe.Pointer) unsafe.Pointer { + var _arg1 *C.GHashTable // out + var _arg2 C.gconstpointer // out + var _cret C.gpointer // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (C.gconstpointer)(unsafe.Pointer(key)) + + _cret = C.g_hash_table_lookup(_arg1, _arg2) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(key) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// HashTableLookupExtended looks up a key in the Table, returning the original +// key and the associated value and a #gboolean which is TRUE if the key was +// found. This is useful if you need to free the memory allocated for the +// original key, for example before calling g_hash_table_remove(). +// +// You can actually pass NULL for lookup_key to test whether the NULL key +// exists, provided the hash and equal functions of hash_table are NULL-safe. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - lookupKey (optional): key to look up. +// +// The function returns the following values: +// +// - origKey (optional): return location for the original key. +// - value (optional): return location for the value associated with the key. +// - ok: TRUE if the key was found in the Table. +func HashTableLookupExtended(hashTable map[unsafe.Pointer]unsafe.Pointer, lookupKey unsafe.Pointer) (origKey, value unsafe.Pointer, ok bool) { + var _arg1 *C.GHashTable // out + var _arg2 C.gconstpointer // out + var _arg3 C.gpointer // in + var _arg4 C.gpointer // in + var _cret C.gboolean // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (C.gconstpointer)(unsafe.Pointer(lookupKey)) + + _cret = C.g_hash_table_lookup_extended(_arg1, _arg2, &_arg3, &_arg4) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(lookupKey) + + var _origKey unsafe.Pointer // out + var _value unsafe.Pointer // out + var _ok bool // out + + _origKey = (unsafe.Pointer)(unsafe.Pointer(_arg3)) + _value = (unsafe.Pointer)(unsafe.Pointer(_arg4)) + if _cret != 0 { + _ok = true + } + + return _origKey, _value, _ok +} + +// NewHashTableSimilar creates a new Table like g_hash_table_new_full() with a +// reference count of 1. +// +// It inherits the hash function, the key equal function, the key destroy +// function, as well as the value destroy function, from other_hash_table. +// +// The returned hash table will be empty; it will not contain the keys or values +// from other_hash_table. +// +// The function takes the following parameters: +// +// - otherHashTable: another Table. +// +// The function returns the following values: +// +// - hashTable: new Table. +func NewHashTableSimilar(otherHashTable map[unsafe.Pointer]unsafe.Pointer) map[unsafe.Pointer]unsafe.Pointer { + var _arg1 *C.GHashTable // out + var _cret *C.GHashTable // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range otherHashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + + _cret = C.g_hash_table_new_similar(_arg1) + runtime.KeepAlive(otherHashTable) + + var _hashTable map[unsafe.Pointer]unsafe.Pointer // out + + _hashTable = make(map[unsafe.Pointer]unsafe.Pointer, gextras.HashTableSize(unsafe.Pointer(_cret))) + gextras.MoveHashTable(unsafe.Pointer(_cret), true, func(k, v unsafe.Pointer) { + ksrc := *(*C.gpointer)(k) + vsrc := *(*C.gpointer)(v) + var kdst unsafe.Pointer // out + var vdst unsafe.Pointer // out + kdst = (unsafe.Pointer)(unsafe.Pointer(ksrc)) + vdst = (unsafe.Pointer)(unsafe.Pointer(vsrc)) + _hashTable[kdst] = vdst + }) + + return _hashTable +} + +// HashTableRemoveAll removes all keys and their associated values from a Table. +// +// If the Table was created using g_hash_table_new_full(), the keys and values +// are freed using the supplied destroy functions, otherwise you have to make +// sure that any dynamically allocated values are freed yourself. +// +// The function takes the following parameters: +// +// - hashTable: Table. +func HashTableRemoveAll(hashTable map[unsafe.Pointer]unsafe.Pointer) { + var _arg1 *C.GHashTable // out + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + + C.g_hash_table_remove_all(_arg1) + runtime.KeepAlive(hashTable) +} + +// HashTableReplace inserts a new key and value into a Table similar +// to g_hash_table_insert(). The difference is that if the key already +// exists in the Table, it gets replaced by the new key. If you supplied a +// value_destroy_func when creating the Table, the old value is freed using +// that function. If you supplied a key_destroy_func when creating the Table, +// the old key is freed using that function. +// +// Starting from GLib 2.40, this function returns a boolean value to indicate +// whether the newly added value was already in the hash table or not. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - key (optional) to insert. +// - value (optional) to associate with the key. +// +// The function returns the following values: +// +// - ok: TRUE if the key did not exist yet. +func HashTableReplace(hashTable map[unsafe.Pointer]unsafe.Pointer, key, value unsafe.Pointer) bool { + var _arg1 *C.GHashTable // out + var _arg2 C.gpointer // out + var _arg3 C.gpointer // out + var _cret C.gboolean // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (C.gpointer)(unsafe.Pointer(key)) + _arg3 = (C.gpointer)(unsafe.Pointer(value)) + + _cret = C.g_hash_table_replace(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HashTableSize returns the number of elements contained in the Table. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// +// The function returns the following values: +// +// - guint: number of key/value pairs in the Table. +func HashTableSize(hashTable map[unsafe.Pointer]unsafe.Pointer) uint { + var _arg1 *C.GHashTable // out + var _cret C.guint // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + + _cret = C.g_hash_table_size(_arg1) + runtime.KeepAlive(hashTable) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// HashTableSteal removes a key and its associated value from a Table without +// calling the key and value destroy functions. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - key (optional) to remove. +// +// The function returns the following values: +// +// - ok: TRUE if the key was found and removed from the Table. +func HashTableSteal(hashTable map[unsafe.Pointer]unsafe.Pointer, key unsafe.Pointer) bool { + var _arg1 *C.GHashTable // out + var _arg2 C.gconstpointer // out + var _cret C.gboolean // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (C.gconstpointer)(unsafe.Pointer(key)) + + _cret = C.g_hash_table_steal(_arg1, _arg2) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// HashTableStealAll removes all keys and their associated values from a Table +// without calling the key and value destroy functions. +// +// The function takes the following parameters: +// +// - hashTable: Table. +func HashTableStealAll(hashTable map[unsafe.Pointer]unsafe.Pointer) { + var _arg1 *C.GHashTable // out + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + + C.g_hash_table_steal_all(_arg1) + runtime.KeepAlive(hashTable) +} + +// HashTableStealExtended looks up a key in the Table, stealing the original key +// and the associated value and returning TRUE if the key was found. If the key +// was not found, FALSE is returned. +// +// If found, the stolen key and value are removed from the hash table without +// calling the key and value destroy functions, and ownership is transferred +// to the caller of this method, as with g_hash_table_steal(). That is the +// case regardless whether stolen_key or stolen_value output parameters are +// requested. +// +// You can pass NULL for lookup_key, provided the hash and equal functions of +// hash_table are NULL-safe. +// +// The dictionary implementation optimizes for having all values identical to +// their keys, for example by using g_hash_table_add(). When stealing both the +// key and the value from such a dictionary, the value will be NULL. +// +// The function takes the following parameters: +// +// - hashTable: Table. +// - lookupKey (optional): key to look up. +// +// The function returns the following values: +// +// - stolenKey (optional): return location for the original key. +// - stolenValue (optional): return location for the value associated with the +// key. +// - ok: TRUE if the key was found in the Table. +func HashTableStealExtended(hashTable map[unsafe.Pointer]unsafe.Pointer, lookupKey unsafe.Pointer) (stolenKey, stolenValue unsafe.Pointer, ok bool) { + var _arg1 *C.GHashTable // out + var _arg2 C.gconstpointer // out + var _arg3 C.gpointer // in + var _arg4 C.gpointer // in + var _cret C.gboolean // in + + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + _arg2 = (C.gconstpointer)(unsafe.Pointer(lookupKey)) + + _cret = C.g_hash_table_steal_extended(_arg1, _arg2, &_arg3, &_arg4) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(lookupKey) + + var _stolenKey unsafe.Pointer // out + var _stolenValue unsafe.Pointer // out + var _ok bool // out + + _stolenKey = (unsafe.Pointer)(unsafe.Pointer(_arg3)) + _stolenValue = (unsafe.Pointer)(unsafe.Pointer(_arg4)) + if _cret != 0 { + _ok = true + } + + return _stolenKey, _stolenValue, _ok +} + +// HashTableIter structure represents an iterator that can be used to iterate +// over the elements of a Table. GHashTableIter structures are typically +// allocated on the stack and then initialized with g_hash_table_iter_init(). +// +// The iteration order of a TableIter over the keys/values in a hash table is +// not defined. +// +// An instance of this type is always passed by reference. +type HashTableIter struct { + *hashTableIter +} + +// hashTableIter is the struct that's finalized. +type hashTableIter struct { + native *C.GHashTableIter +} + +// HashTable returns the Table associated with iter. +// +// The function returns the following values: +// +// - hashTable associated with iter. +func (iter *HashTableIter) HashTable() map[unsafe.Pointer]unsafe.Pointer { + var _arg0 *C.GHashTableIter // out + var _cret *C.GHashTable // in + + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C.g_hash_table_iter_get_hash_table(_arg0) + runtime.KeepAlive(iter) + + var _hashTable map[unsafe.Pointer]unsafe.Pointer // out + + _hashTable = make(map[unsafe.Pointer]unsafe.Pointer, gextras.HashTableSize(unsafe.Pointer(_cret))) + gextras.MoveHashTable(unsafe.Pointer(_cret), false, func(k, v unsafe.Pointer) { + ksrc := *(*C.gpointer)(k) + vsrc := *(*C.gpointer)(v) + var kdst unsafe.Pointer // out + var vdst unsafe.Pointer // out + kdst = (unsafe.Pointer)(unsafe.Pointer(ksrc)) + vdst = (unsafe.Pointer)(unsafe.Pointer(vsrc)) + _hashTable[kdst] = vdst + }) + + return _hashTable +} + +// Init initializes a key/value pair iterator and associates it with hash_table. +// Modifying the hash table after calling this function invalidates the returned +// iterator. +// +// The iteration order of a TableIter over the keys/values in a hash table is +// not defined. +// +// GHashTableIter iter; +// gpointer key, value; +// +// g_hash_table_iter_init (&iter, hash_table); +// while (g_hash_table_iter_next (&iter, &key, &value)) +// { +// // do something with key and value +// }. +// +// The function takes the following parameters: +// +// - hashTable: Table. +func (iter *HashTableIter) Init(hashTable map[unsafe.Pointer]unsafe.Pointer) { + var _arg0 *C.GHashTableIter // out + var _arg1 *C.GHashTable // out + + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + _arg1 = C.g_hash_table_new_full(nil, nil, (*[0]byte)(C.free), (*[0]byte)(C.free)) + for ksrc, vsrc := range hashTable { + var kdst C.gpointer // out + var vdst C.gpointer // out + kdst = (C.gpointer)(unsafe.Pointer(ksrc)) + vdst = (C.gpointer)(unsafe.Pointer(vsrc)) + C.g_hash_table_insert(_arg1, C.gpointer(unsafe.Pointer(kdst)), C.gpointer(unsafe.Pointer(vdst))) + } + defer C.g_hash_table_unref(_arg1) + + C.g_hash_table_iter_init(_arg0, _arg1) + runtime.KeepAlive(iter) + runtime.KeepAlive(hashTable) +} + +// Next advances iter and retrieves the key and/or value that are now pointed to +// as a result of this advancement. If FALSE is returned, key and value are not +// set, and the iterator becomes invalid. +// +// The function returns the following values: +// +// - key (optional): location to store the key. +// - value (optional): location to store the value. +// - ok: FALSE if the end of the Table has been reached. +func (iter *HashTableIter) Next() (key unsafe.Pointer, value unsafe.Pointer, ok bool) { + var _arg0 *C.GHashTableIter // out + var _arg1 C.gpointer // in + var _arg2 C.gpointer // in + var _cret C.gboolean // in + + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C.g_hash_table_iter_next(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(iter) + + var _key unsafe.Pointer // out + var _value unsafe.Pointer // out + var _ok bool // out + + _key = (unsafe.Pointer)(unsafe.Pointer(_arg1)) + _value = (unsafe.Pointer)(unsafe.Pointer(_arg2)) + if _cret != 0 { + _ok = true + } + + return _key, _value, _ok +} + +// Remove removes the key/value pair currently pointed to by the iterator from +// its associated Table. Can only be called after g_hash_table_iter_next() +// returned TRUE, and cannot be called more than once for the same key/value +// pair. +// +// If the Table was created using g_hash_table_new_full(), the key and value are +// freed using the supplied destroy functions, otherwise you have to make sure +// that any dynamically allocated values are freed yourself. +// +// It is safe to continue iterating the Table afterward: +// +// while (g_hash_table_iter_next (&iter, &key, &value)) +// { +// if (condition) +// g_hash_table_iter_remove (&iter); +// }. +func (iter *HashTableIter) Remove() { + var _arg0 *C.GHashTableIter // out + + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C.g_hash_table_iter_remove(_arg0) + runtime.KeepAlive(iter) +} + +// Replace replaces the value currently pointed to by the iterator from its +// associated Table. Can only be called after g_hash_table_iter_next() returned +// TRUE. +// +// If you supplied a value_destroy_func when creating the Table, the old value +// is freed using that function. +// +// The function takes the following parameters: +// +// - value (optional) to replace with. +func (iter *HashTableIter) Replace(value unsafe.Pointer) { + var _arg0 *C.GHashTableIter // out + var _arg1 C.gpointer // out + + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + _arg1 = (C.gpointer)(unsafe.Pointer(value)) + + C.g_hash_table_iter_replace(_arg0, _arg1) + runtime.KeepAlive(iter) + runtime.KeepAlive(value) +} + +// Steal removes the key/value pair currently pointed to by the iterator from +// its associated Table, without calling the key and value destroy functions. +// Can only be called after g_hash_table_iter_next() returned TRUE, and cannot +// be called more than once for the same key/value pair. +func (iter *HashTableIter) Steal() { + var _arg0 *C.GHashTableIter // out + + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C.g_hash_table_iter_steal(_arg0) + runtime.KeepAlive(iter) +} + +// HMAC HMACs should be used when producing a cookie or hash based on data +// and a key. Simple mechanisms for using SHA1 and other algorithms to digest +// a key and data together are vulnerable to various security issues. HMAC +// (http://en.wikipedia.org/wiki/HMAC) uses algorithms like SHA1 in a secure way +// to produce a digest of a key and data. +// +// Both the key and data are arbitrary byte arrays of bytes or characters. +// +// Support for HMAC Digests has been added in GLib 2.30, and support for SHA-512 +// in GLib 2.42. Support for SHA-384 was added in GLib 2.52. +// +// To create a new GHmac, use glib.HMAC.New. To free a GHmac, use +// glib.HMAC.Unref(). +// +// An instance of this type is always passed by reference. +type HMAC struct { + *hmaC +} + +// hmaC is the struct that's finalized. +type hmaC struct { + native *C.GHmac +} + +func marshalHMAC(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &HMAC{&hmaC{(*C.GHmac)(b)}}, nil +} + +// NewHMAC constructs a struct HMAC. +func NewHMAC(digestType ChecksumType, key []byte) *HMAC { + var _arg1 C.GChecksumType // out + var _arg2 *C.guchar // out + var _arg3 C.gsize + var _cret *C.GHmac // in + + _arg1 = C.GChecksumType(digestType) + _arg3 = (C.gsize)(len(key)) + if len(key) > 0 { + _arg2 = (*C.guchar)(unsafe.Pointer(&key[0])) + } + + _cret = C.g_hmac_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(digestType) + runtime.KeepAlive(key) + + var _hmac *HMAC // out + + if _cret != nil { + _hmac = (*HMAC)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_hmac)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_hmac_unref((*C.GHmac)(intern.C)) + }, + ) + } + + return _hmac +} + +// Copy copies a #GHmac. If hmac has been closed, by calling g_hmac_get_string() +// or g_hmac_get_digest(), the copied HMAC will be closed as well. +// +// The function returns the following values: +// +// - ret: copy of the passed #GHmac. Use g_hmac_unref() when finished using +// it. +func (hmac *HMAC) Copy() *HMAC { + var _arg0 *C.GHmac // out + var _cret *C.GHmac // in + + _arg0 = (*C.GHmac)(gextras.StructNative(unsafe.Pointer(hmac))) + + _cret = C.g_hmac_copy(_arg0) + runtime.KeepAlive(hmac) + + var _ret *HMAC // out + + _ret = (*HMAC)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_ret)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_hmac_unref((*C.GHmac)(intern.C)) + }, + ) + + return _ret +} + +// String gets the HMAC as a hexadecimal string. +// +// Once this function has been called the #GHmac can no longer be updated with +// g_hmac_update(). +// +// The hexadecimal characters will be lower case. +// +// The function returns the following values: +// +// - utf8: hexadecimal representation of the HMAC. The returned string is +// owned by the HMAC and should not be modified or freed. +func (hmac *HMAC) String() string { + var _arg0 *C.GHmac // out + var _cret *C.gchar // in + + _arg0 = (*C.GHmac)(gextras.StructNative(unsafe.Pointer(hmac))) + + _cret = C.g_hmac_get_string(_arg0) + runtime.KeepAlive(hmac) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Update feeds data into an existing #GHmac. +// +// The HMAC must still be open, that is g_hmac_get_string() or +// g_hmac_get_digest() must not have been called on hmac. +// +// The function takes the following parameters: +// +// - data: buffer used to compute the checksum. +func (hmac *HMAC) Update(data []byte) { + var _arg0 *C.GHmac // out + var _arg1 *C.guchar // out + var _arg2 C.gssize + + _arg0 = (*C.GHmac)(gextras.StructNative(unsafe.Pointer(hmac))) + _arg2 = (C.gssize)(len(data)) + if len(data) > 0 { + _arg1 = (*C.guchar)(unsafe.Pointer(&data[0])) + } + + C.g_hmac_update(_arg0, _arg1, _arg2) + runtime.KeepAlive(hmac) + runtime.KeepAlive(data) +} + +// IOChannel: GIOChannel data type aims to provide a portable method for using +// file descriptors, pipes, and sockets, and integrating them into the main +// event loop (see glib.MainContext). Currently, full support is available on +// UNIX platforms; support for Windows is only partially complete. +// +// To create a new GIOChannel on UNIX systems use glib.IOChannel.NewUnix. +// This works for plain file descriptors, pipes and sockets. Alternatively, +// a channel can be created for a file in a system independent manner using +// glib.IOChannel.NewFile. +// +// Once a GIOChannel has been created, it can be used in a generic manner with +// the functions glib.IOChannel.ReadChars(), glib.IOChannel.WriteChars(), +// glib.IOChannel.SeekPosition(), and glib.IOChannel.Shutdown(). +// +// To add a GIOChannel to the main event loop, use glib.IOAddWatch() or +// glib.IOAddWatchFull(). Here you specify which events you are interested in +// on the GIOChannel, and provide a function to be called whenever these events +// occur. +// +// GIOChannel instances are created with an initial reference count of 1. +// glib.IOChannel.Ref() and glib.IOChannel.Unref() can be used to increment +// or decrement the reference count respectively. When the reference count +// falls to 0, the GIOChannel is freed. (Though it isn’t closed automatically, +// unless it was created using glib.IOChannel.NewFile.) Using glib.IOAddWatch() +// or glib.IOAddWatchFull() increments a channel’s reference count. +// +// The new functions glib.IOChannel.ReadChars(), glib.IOChannel.ReadLine(), +// glib.IOChannel.ReadLineString(), glib.IOChannel.ReadToEnd(), +// glib.IOChannel.WriteChars(), glib.IOChannel.SeekPosition(), and +// glib.IOChannel.Flush() should not be mixed with the deprecated functions +// glib.IOChannel.Read(), glib.IOChannel.Write(), and glib.IOChannel.Seek() on +// the same channel. +// +// An instance of this type is always passed by reference. +type IOChannel struct { + *ioChannel +} + +// ioChannel is the struct that's finalized. +type ioChannel struct { + native *C.GIOChannel +} + +func marshalIOChannel(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &IOChannel{&ioChannel{(*C.GIOChannel)(b)}}, nil +} + +// NewIOChannelFile constructs a struct IOChannel. +func NewIOChannelFile(filename string, mode string) (*IOChannel, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.GIOChannel // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(mode))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_io_channel_new_file(_arg1, _arg2, &_cerr) + runtime.KeepAlive(filename) + runtime.KeepAlive(mode) + + var _ioChannel *IOChannel // out + var _goerr error // out + + _ioChannel = (*IOChannel)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_ioChannel)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_io_channel_unref((*C.GIOChannel)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioChannel, _goerr +} + +// NewIOChannelUnix constructs a struct IOChannel. +func NewIOChannelUnix(fd int) *IOChannel { + var _arg1 C.int // out + var _cret *C.GIOChannel // in + + _arg1 = C.int(fd) + + _cret = C.g_io_channel_unix_new(_arg1) + runtime.KeepAlive(fd) + + var _ioChannel *IOChannel // out + + _ioChannel = (*IOChannel)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_ioChannel)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_io_channel_unref((*C.GIOChannel)(intern.C)) + }, + ) + + return _ioChannel +} + +// Close an IO channel. Any pending data to be written will be flushed, ignoring +// errors. The channel will not be freed until the last reference is dropped +// using g_io_channel_unref(). +// +// Deprecated: Use g_io_channel_shutdown() instead. +func (channel *IOChannel) Close() { + var _arg0 *C.GIOChannel // out + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + C.g_io_channel_close(_arg0) + runtime.KeepAlive(channel) +} + +// Flush flushes the write buffer for the GIOChannel. +// +// The function returns the following values: +// +// - ioStatus status of the operation: One of G_IO_STATUS_NORMAL, +// G_IO_STATUS_AGAIN, or G_IO_STATUS_ERROR. +func (channel *IOChannel) Flush() (IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_flush(_arg0, &_cerr) + runtime.KeepAlive(channel) + + var _ioStatus IOStatus // out + var _goerr error // out + + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStatus, _goerr +} + +// BufferCondition: this function returns a OCondition depending on whether +// there is data to be read/space to write data in the internal buffers in the +// OChannel. Only the flags G_IO_IN and G_IO_OUT may be set. +// +// The function returns the following values: +// +// - ioCondition: OCondition. +func (channel *IOChannel) BufferCondition() IOCondition { + var _arg0 *C.GIOChannel // out + var _cret C.GIOCondition // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_get_buffer_condition(_arg0) + runtime.KeepAlive(channel) + + var _ioCondition IOCondition // out + + _ioCondition = IOCondition(_cret) + + return _ioCondition +} + +// BufferSize gets the buffer size. +// +// The function returns the following values: +// +// - gsize: size of the buffer. +func (channel *IOChannel) BufferSize() uint { + var _arg0 *C.GIOChannel // out + var _cret C.gsize // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_get_buffer_size(_arg0) + runtime.KeepAlive(channel) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Buffered returns whether channel is buffered. +// +// The function returns the following values: +// +// - ok: TRUE if the channel is buffered. +func (channel *IOChannel) Buffered() bool { + var _arg0 *C.GIOChannel // out + var _cret C.gboolean // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_get_buffered(_arg0) + runtime.KeepAlive(channel) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Encoding gets the encoding for the input/output of the channel. The internal +// encoding is always UTF-8. The encoding NULL makes the channel safe for binary +// data. +// +// The function returns the following values: +// +// - utf8: string containing the encoding, this string is owned by GLib and +// must not be freed. +func (channel *IOChannel) Encoding() string { + var _arg0 *C.GIOChannel // out + var _cret *C.gchar // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_get_encoding(_arg0) + runtime.KeepAlive(channel) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Flags gets the current flags for a OChannel, including read-only flags such +// as G_IO_FLAG_IS_READABLE. +// +// The values of the flags G_IO_FLAG_IS_READABLE and G_IO_FLAG_IS_WRITABLE +// are cached for internal use by the channel when it is created. If they +// should change at some later point (e.g. partial shutdown of a socket +// with the UNIX shutdown() function), the user should immediately call +// g_io_channel_get_flags() to update the internal values of these flags. +// +// The function returns the following values: +// +// - ioFlags flags which are set on the channel. +func (channel *IOChannel) Flags() IOFlags { + var _arg0 *C.GIOChannel // out + var _cret C.GIOFlags // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_get_flags(_arg0) + runtime.KeepAlive(channel) + + var _ioFlags IOFlags // out + + _ioFlags = IOFlags(_cret) + + return _ioFlags +} + +// LineTerm: this returns the string that OChannel uses to determine where in +// the file a line break occurs. A value of NULL indicates autodetection. +// +// The function returns the following values: +// +// - length (optional): location to return the length of the line terminator. +// - utf8: line termination string. This value is owned by GLib and must not +// be freed. +func (channel *IOChannel) LineTerm() (int, string) { + var _arg0 *C.GIOChannel // out + var _arg1 C.gint // in + var _cret *C.gchar // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_get_line_term(_arg0, &_arg1) + runtime.KeepAlive(channel) + + var _length int // out + var _utf8 string // out + + _length = int(_arg1) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _length, _utf8 +} + +// Init initializes a OChannel struct. +// +// This is called by each of the above functions when creating a OChannel, +// and so is not often needed by the application programmer (unless you are +// creating a new type of OChannel). +func (channel *IOChannel) Init() { + var _arg0 *C.GIOChannel // out + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + C.g_io_channel_init(_arg0) + runtime.KeepAlive(channel) +} + +// ReadChars: replacement for g_io_channel_read() with the new API. +// +// The function takes the following parameters: +// +// - buf: a buffer to read data into. +// +// The function returns the following values: +// +// - bytesRead (optional): number of bytes read. This may be zero even +// on success if count < 6 and the channel's encoding is non-NULL. This +// indicates that the next UTF-8 character is too wide for the buffer. +// - ioStatus status of the operation. +func (channel *IOChannel) ReadChars(buf []byte) (uint, IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _arg1 *C.gchar // out + var _arg2 C.gsize + var _arg3 C.gsize // in + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg2 = (C.gsize)(len(buf)) + _arg1 = (*C.gchar)(C.CBytes(buf)) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_io_channel_read_chars(_arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(channel) + runtime.KeepAlive(buf) + + var _bytesRead uint // out + var _ioStatus IOStatus // out + var _goerr error // out + + _bytesRead = uint(_arg3) + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesRead, _ioStatus, _goerr +} + +// ReadLine reads a line, including the terminating character(s), from a +// OChannel into a newly-allocated string. str_return will contain allocated +// memory if the return is G_IO_STATUS_NORMAL. +// +// The function returns the following values: +// +// - strReturn: line read from the OChannel, including the line terminator. +// This data should be freed with g_free() when no longer needed. This is a +// nul-terminated string. If a length of zero is returned, this will be NULL +// instead. +// - length (optional): location to store length of the read data, or NULL. +// - terminatorPos (optional): location to store position of line terminator, +// or NULL. +// - ioStatus status of the operation. +func (channel *IOChannel) ReadLine() (strReturn string, length uint, terminatorPos uint, ioStatus IOStatus, goerr error) { + var _arg0 *C.GIOChannel // out + var _arg1 *C.gchar // in + var _arg2 C.gsize // in + var _arg3 C.gsize // in + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_read_line(_arg0, &_arg1, &_arg2, &_arg3, &_cerr) + runtime.KeepAlive(channel) + + var _strReturn string // out + var _length uint // out + var _terminatorPos uint // out + var _ioStatus IOStatus // out + var _goerr error // out + + _strReturn = C.GoString((*C.gchar)(unsafe.Pointer(_arg1))) + defer C.free(unsafe.Pointer(_arg1)) + _length = uint(_arg2) + _terminatorPos = uint(_arg3) + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _strReturn, _length, _terminatorPos, _ioStatus, _goerr +} + +// ReadToEnd reads all the remaining data from the file. +// +// The function returns the following values: +// +// - strReturn: location to store a pointer to a string holding the remaining +// data in the OChannel. This data should be freed with g_free() when +// no longer needed. This data is terminated by an extra nul character, +// but there may be other nuls in the intervening data. +// - ioStatus: G_IO_STATUS_NORMAL on success. This function never returns +// G_IO_STATUS_EOF. +func (channel *IOChannel) ReadToEnd() ([]byte, IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _arg1 *C.gchar // in + var _arg2 C.gsize // in + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_read_to_end(_arg0, &_arg1, &_arg2, &_cerr) + runtime.KeepAlive(channel) + + var _strReturn []byte // out + var _ioStatus IOStatus // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_arg1)) + _strReturn = make([]byte, _arg2) + copy(_strReturn, unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), _arg2)) + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _strReturn, _ioStatus, _goerr +} + +// ReadUnichar reads a Unicode character from channel. This function cannot be +// called on a channel with NULL encoding. +// +// The function returns the following values: +// +// - thechar: location to return a character. +// - ioStatus: OStatus. +func (channel *IOChannel) ReadUnichar() (uint32, IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _arg1 C.gunichar // in + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_read_unichar(_arg0, &_arg1, &_cerr) + runtime.KeepAlive(channel) + + var _thechar uint32 // out + var _ioStatus IOStatus // out + var _goerr error // out + + _thechar = uint32(_arg1) + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _thechar, _ioStatus, _goerr +} + +// Seek sets the current position in the OChannel, similar to the standard +// library function fseek(). +// +// Deprecated: Use g_io_channel_seek_position() instead. +// +// The function takes the following parameters: +// +// - offset: offset, in bytes, which is added to the position specified by +// type. +// - typ: position in the file, which can be G_SEEK_CUR (the current +// position), G_SEEK_SET (the start of the file), or G_SEEK_END (the end of +// the file). +// +// The function returns the following values: +// +// - ioError: G_IO_ERROR_NONE if the operation was successful. +func (channel *IOChannel) Seek(offset int64, typ SeekType) IOError { + var _arg0 *C.GIOChannel // out + var _arg1 C.gint64 // out + var _arg2 C.GSeekType // out + var _cret C.GIOError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg1 = C.gint64(offset) + _arg2 = C.GSeekType(typ) + + _cret = C.g_io_channel_seek(_arg0, _arg1, _arg2) + runtime.KeepAlive(channel) + runtime.KeepAlive(offset) + runtime.KeepAlive(typ) + + var _ioError IOError // out + + _ioError = IOError(_cret) + + return _ioError +} + +// SeekPosition: replacement for g_io_channel_seek() with the new API. +// +// The function takes the following parameters: +// +// - offset in bytes from the position specified by type. +// - typ The type G_SEEK_CUR is only allowed in those cases where a call +// to g_io_channel_set_encoding () is allowed. See the documentation for +// g_io_channel_set_encoding () for details. +// +// The function returns the following values: +// +// - ioStatus status of the operation. +func (channel *IOChannel) SeekPosition(offset int64, typ SeekType) (IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _arg1 C.gint64 // out + var _arg2 C.GSeekType // out + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg1 = C.gint64(offset) + _arg2 = C.GSeekType(typ) + + _cret = C.g_io_channel_seek_position(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(channel) + runtime.KeepAlive(offset) + runtime.KeepAlive(typ) + + var _ioStatus IOStatus // out + var _goerr error // out + + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStatus, _goerr +} + +// SetBufferSize sets the buffer size. +// +// The function takes the following parameters: +// +// - size of the buffer, or 0 to let GLib pick a good size. +func (channel *IOChannel) SetBufferSize(size uint) { + var _arg0 *C.GIOChannel // out + var _arg1 C.gsize // out + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg1 = C.gsize(size) + + C.g_io_channel_set_buffer_size(_arg0, _arg1) + runtime.KeepAlive(channel) + runtime.KeepAlive(size) +} + +// SetBuffered: buffering state can only be set if the channel's encoding is +// NULL. For any other encoding, the channel must be buffered. +// +// A buffered channel can only be set unbuffered if the channel's internal +// buffers have been flushed. Newly created channels or channels which have +// returned G_IO_STATUS_EOF not require such a flush. For write-only channels, +// a call to g_io_channel_flush () is sufficient. For all other channels, +// the buffers may be flushed by a call to g_io_channel_seek_position (). +// This includes the possibility of seeking with seek type G_SEEK_CUR and an +// offset of zero. Note that this means that socket-based channels cannot be set +// unbuffered once they have had data read from them. +// +// On unbuffered channels, it is safe to mix read and write calls from the new +// and old APIs, if this is necessary for maintaining old code. +// +// The default state of the channel is buffered. +// +// The function takes the following parameters: +// +// - buffered: whether to set the channel buffered or unbuffered. +func (channel *IOChannel) SetBuffered(buffered bool) { + var _arg0 *C.GIOChannel // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + if buffered { + _arg1 = C.TRUE + } + + C.g_io_channel_set_buffered(_arg0, _arg1) + runtime.KeepAlive(channel) + runtime.KeepAlive(buffered) +} + +// SetEncoding sets the encoding for the input/output of the channel. The +// internal encoding is always UTF-8. The default encoding for the external file +// is UTF-8. +// +// The encoding NULL is safe to use with binary data. +// +// The encoding can only be set if one of the following conditions is true: +// +// - The channel was just created, and has not been written to or read from yet. +// +// - The channel is write-only. +// +// - The channel is a file, and the file pointer was just repositioned by a call +// to g_io_channel_seek_position(). (This flushes all the internal buffers.) +// +// - The current encoding is NULL or UTF-8. +// +// - One of the (new API) read functions has just returned G_IO_STATUS_EOF (or, +// in the case of g_io_channel_read_to_end(), G_IO_STATUS_NORMAL). +// +// - One of the functions g_io_channel_read_chars() or +// g_io_channel_read_unichar() has returned G_IO_STATUS_AGAIN +// or G_IO_STATUS_ERROR. This may be useful in the case of +// G_CONVERT_ERROR_ILLEGAL_SEQUENCE. Returning one of these statuses +// from g_io_channel_read_line(), g_io_channel_read_line_string(), +// or g_io_channel_read_to_end() does not guarantee that the encoding can be +// changed. +// +// Channels which do not meet one of the above conditions cannot call +// g_io_channel_seek_position() with an offset of G_SEEK_CUR, and, if they are +// "seekable", cannot call g_io_channel_write_chars() after calling one of the +// API "read" functions. +// +// The function takes the following parameters: +// +// - encoding (optional) type. +// +// The function returns the following values: +// +// - ioStatus: G_IO_STATUS_NORMAL if the encoding was successfully set. +func (channel *IOChannel) SetEncoding(encoding string) (IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _arg1 *C.gchar // out + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + if encoding != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(encoding))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_io_channel_set_encoding(_arg0, _arg1, &_cerr) + runtime.KeepAlive(channel) + runtime.KeepAlive(encoding) + + var _ioStatus IOStatus // out + var _goerr error // out + + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStatus, _goerr +} + +// SetFlags sets the (writeable) flags in channel to (flags & +// G_IO_FLAG_SET_MASK). +// +// The function takes the following parameters: +// +// - flags to set on the IO channel. +// +// The function returns the following values: +// +// - ioStatus status of the operation. +func (channel *IOChannel) SetFlags(flags IOFlags) (IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _arg1 C.GIOFlags // out + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg1 = C.GIOFlags(flags) + + _cret = C.g_io_channel_set_flags(_arg0, _arg1, &_cerr) + runtime.KeepAlive(channel) + runtime.KeepAlive(flags) + + var _ioStatus IOStatus // out + var _goerr error // out + + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStatus, _goerr +} + +// SetLineTerm: this sets the string that OChannel uses to determine where in +// the file a line break occurs. +// +// The function takes the following parameters: +// +// - lineTerm (optional): line termination string. Use NULL for autodetect. +// Autodetection breaks on "\n", "\r\n", "\r", "\0", and the Unicode +// paragraph separator. Autodetection should not be used for anything other +// than file-based channels. +func (channel *IOChannel) SetLineTerm(lineTerm string) { + var _arg0 *C.GIOChannel // out + var _arg1 *C.gchar // out + var _arg2 C.gint + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg2 = (C.gint)(len(lineTerm)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(lineTerm) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(lineTerm)), lineTerm) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_io_channel_set_line_term(_arg0, _arg1, _arg2) + runtime.KeepAlive(channel) + runtime.KeepAlive(lineTerm) +} + +// Shutdown: close an IO channel. Any pending data to be written will be flushed +// if flush is TRUE. The channel will not be freed until the last reference is +// dropped using g_io_channel_unref(). +// +// The function takes the following parameters: +// +// - flush: if TRUE, flush pending. +// +// The function returns the following values: +// +// - ioStatus status of the operation. +func (channel *IOChannel) Shutdown(flush bool) (IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _arg1 C.gboolean // out + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + if flush { + _arg1 = C.TRUE + } + + _cret = C.g_io_channel_shutdown(_arg0, _arg1, &_cerr) + runtime.KeepAlive(channel) + runtime.KeepAlive(flush) + + var _ioStatus IOStatus // out + var _goerr error // out + + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStatus, _goerr +} + +// UnixGetFd returns the file descriptor of the OChannel. +// +// On Windows this function returns the file descriptor or socket of the +// OChannel. +// +// The function returns the following values: +// +// - gint: file descriptor of the OChannel. +func (channel *IOChannel) UnixGetFd() int { + var _arg0 *C.GIOChannel // out + var _cret C.gint // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + + _cret = C.g_io_channel_unix_get_fd(_arg0) + runtime.KeepAlive(channel) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Write writes data to a OChannel. +// +// Deprecated: Use g_io_channel_write_chars() instead. +// +// The function takes the following parameters: +// +// - buf: buffer containing the data to write. +// - count: number of bytes to write. +// - bytesWritten: number of bytes actually written. +// +// The function returns the following values: +// +// - ioError: G_IO_ERROR_NONE if the operation was successful. +func (channel *IOChannel) Write(buf string, count uint, bytesWritten *uint) IOError { + var _arg0 *C.GIOChannel // out + var _arg1 *C.gchar // out + var _arg2 C.gsize // out + var _arg3 *C.gsize // out + var _cret C.GIOError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(buf))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gsize(count) + _arg3 = (*C.gsize)(unsafe.Pointer(bytesWritten)) + + _cret = C.g_io_channel_write(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(channel) + runtime.KeepAlive(buf) + runtime.KeepAlive(count) + runtime.KeepAlive(bytesWritten) + + var _ioError IOError // out + + _ioError = IOError(_cret) + + return _ioError +} + +// WriteChars: replacement for g_io_channel_write() with the new API. +// +// On seekable channels with encodings other than NULL or UTF-8, generic mixing +// of reading and writing is not allowed. A call to g_io_channel_write_chars +// () may only be made on a channel from which data has been read in the cases +// described in the documentation for g_io_channel_set_encoding (). +// +// The function takes the following parameters: +// +// - buf: buffer to write data from. +// - count: size of the buffer. If -1, the buffer is taken to be a +// nul-terminated string. +// +// The function returns the following values: +// +// - bytesWritten: number of bytes written. This can be nonzero even if +// the return value is not G_IO_STATUS_NORMAL. If the return value is +// G_IO_STATUS_NORMAL and the channel is blocking, this will always be equal +// to count if count >= 0. +// - ioStatus status of the operation. +func (channel *IOChannel) WriteChars(buf string, count int) (uint, IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _arg1 *C.gchar // out + var _arg2 C.gssize // out + var _arg3 C.gsize // in + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(buf) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(buf)), buf) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.gssize(count) + + _cret = C.g_io_channel_write_chars(_arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(channel) + runtime.KeepAlive(buf) + runtime.KeepAlive(count) + + var _bytesWritten uint // out + var _ioStatus IOStatus // out + var _goerr error // out + + _bytesWritten = uint(_arg3) + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytesWritten, _ioStatus, _goerr +} + +// WriteUnichar writes a Unicode character to channel. This function cannot be +// called on a channel with NULL encoding. +// +// The function takes the following parameters: +// +// - thechar: character. +// +// The function returns the following values: +// +// - ioStatus: OStatus. +func (channel *IOChannel) WriteUnichar(thechar uint32) (IOStatus, error) { + var _arg0 *C.GIOChannel // out + var _arg1 C.gunichar // out + var _cret C.GIOStatus // in + var _cerr *C.GError // in + + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg1 = C.gunichar(thechar) + + _cret = C.g_io_channel_write_unichar(_arg0, _arg1, &_cerr) + runtime.KeepAlive(channel) + runtime.KeepAlive(thechar) + + var _ioStatus IOStatus // out + var _goerr error // out + + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _ioStatus, _goerr +} + +// IOChannelErrorFromErrno converts an errno error number to a OChannelError. +// +// The function takes the following parameters: +// +// - en: errno error number, e.g. EINVAL. +// +// The function returns the following values: +// +// - ioChannelError error number, e.g. G_IO_CHANNEL_ERROR_INVAL. +func IOChannelErrorFromErrno(en int) IOChannelError { + var _arg1 C.gint // out + var _cret C.GIOChannelError // in + + _arg1 = C.gint(en) + + _cret = C.g_io_channel_error_from_errno(_arg1) + runtime.KeepAlive(en) + + var _ioChannelError IOChannelError // out + + _ioChannelError = IOChannelError(_cret) + + return _ioChannelError +} + +func IOChannelErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_io_channel_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// IOFuncs: table of functions used to handle different types of OChannel in a +// generic way. +// +// An instance of this type is always passed by reference. +type IOFuncs struct { + *ioFuncs +} + +// ioFuncs is the struct that's finalized. +type ioFuncs struct { + native *C.GIOFuncs +} + +// KeyFile: GKeyFile parses .ini-like config files. +// +// GKeyFile lets you parse, edit or create files containing groups of key-value +// pairs, which we call "key files" for lack of a better name. Several +// freedesktop.org specifications use key files now, e.g the Desktop Entry +// Specification (http://freedesktop.org/Standards/desktop-entry-spec) and the +// Icon Theme Specification (http://freedesktop.org/Standards/icon-theme-spec). +// +// The syntax of key files is described in detail in the Desktop Entry +// Specification (http://freedesktop.org/Standards/desktop-entry-spec), +// here is a quick summary: Key files consists of groups of key-value pairs, +// interspersed with comments. +// +// this is just an example +// +// there can be comments before the first group +// +// [First Group] +// +// Name=Key File Example\tthis value shows\nescaping +// +// localized strings are stored in multiple key-value pairs +// +// Welcome=Hello +// Welcome[de]=Hallo +// Welcome[fr_FR]=Bonjour +// Welcome[it]=Ciao +// +// [Another Group] +// +// Numbers=2;20;-200;0 +// +// Booleans=true;false;true;true +// +// Lines beginning with a '#' and blank lines are considered comments. +// +// Groups are started by a header line containing the group name enclosed in '[' +// and ']', and ended implicitly by the start of the next group or the end of +// the file. Each key-value pair must be contained in a group. +// +// Key-value pairs generally have the form key=value, with the exception of +// localized strings, which have the form key[locale]=value, with a locale +// identifier of the form lang_COUNTRYMODIFIER where COUNTRY and MODIFIER are +// optional. Space before and after the '=' character are ignored. Newline, tab, +// carriage return and backslash characters in value are escaped as \n, \t, \r, +// and \\\\, respectively. To preserve leading spaces in values, these can also +// be escaped as \s. +// +// Key files can store strings (possibly with localized variants), integers, +// booleans and lists of these. Lists are separated by a separator character, +// typically ';' or ','. To use the list separator character in a value in a +// list, it has to be escaped by prefixing it with a backslash. +// +// This syntax is obviously inspired by the .ini files commonly met on Windows, +// but there are some important differences: +// +// - .ini files use the ';' character to begin comments, key files use the '#' +// character. +// +// - Key files do not allow for ungrouped keys meaning only comments can precede +// the first group. +// +// - Key files are always encoded in UTF-8. +// +// - Key and Group names are case-sensitive. For example, a group called [GROUP] +// is a different from [group]. +// +// - .ini files don't have a strongly typed boolean entry type, they only +// have GetProfileInt(). In key files, only true and false (in lower case) are +// allowed. +// +// Note that in contrast to the Desktop Entry Specification +// (http://freedesktop.org/Standards/desktop-entry-spec), groups in key files +// may contain the same key multiple times; the last entry wins. Key files may +// also contain multiple groups with the same name; they are merged together. +// Another difference is that keys and group names in key files are not +// restricted to ASCII characters. +// +// Here is an example of loading a key file and reading a value: +// +// g_autoptr(GError) error = NULL; +// g_autoptr(GKeyFile) key_file = g_key_file_new (); +// +// if (!g_key_file_load_from_file (key_file, "key-file.ini", flags, &error)) +// { +// if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT)) +// g_warning ("Error loading key file: s", error->message); +// return; +// } +// +// g_autofree gchar *val = g_key_file_get_string (key_file, "Group Name", "SomeKey", &error); +// if (val == NULL && +// !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_KEY_NOT_FOUND)) +// { +// g_warning ("Error finding key in key file: s", error->message); +// return; +// } +// else if (val == NULL) +// { +// // Fall back to a default value. +// val = g_strdup ("default-value"); +// } +// +// Here is an example of creating and saving a key file: +// +// g_autoptr(GKeyFile) key_file = g_key_file_new (); +// const gchar *val = …; +// g_autoptr(GError) error = NULL; +// +// g_key_file_set_string (key_file, "Group Name", "SomeKey", val); +// +// // Save as a file. +// if (!g_key_file_save_to_file (key_file, "key-file.ini", &error)) +// { +// g_warning ("Error saving key file: s", error->message); +// return; +// } +// +// // Or store to a GBytes for use elsewhere. +// gsize data_len; +// g_autofree guint8 *data = (guint8 *) g_key_file_to_data (key_file, &data_len, &error); +// if (data == NULL) +// { +// g_warning ("Error saving key file: s", error->message); +// return; +// } +// g_autoptr(GBytes) bytes = g_bytes_new_take (g_steal_pointer (&data), data_len); +// +// An instance of this type is always passed by reference. +type KeyFile struct { + *keyFile +} + +// keyFile is the struct that's finalized. +type keyFile struct { + native *C.GKeyFile +} + +func marshalKeyFile(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &KeyFile{&keyFile{(*C.GKeyFile)(b)}}, nil +} + +// NewKeyFile constructs a struct KeyFile. +func NewKeyFile() *KeyFile { + var _cret *C.GKeyFile // in + + _cret = C.g_key_file_new() + + var _keyFile *KeyFile // out + + _keyFile = (*KeyFile)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_keyFile)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_key_file_unref((*C.GKeyFile)(intern.C)) + }, + ) + + return _keyFile +} + +// Boolean returns the value associated with key under group_name as a boolean. +// +// If key cannot be found then FALSE is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated with key +// cannot be interpreted as a boolean then FALSE is returned and error is set to +// G_KEY_FILE_ERROR_INVALID_VALUE. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +func (keyFile *KeyFile) Boolean(groupName string, key string) error { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_key_file_get_boolean(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// BooleanList returns the values associated with key under group_name as +// booleans. +// +// If key cannot be found then NULL is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated with key +// cannot be interpreted as booleans then NULL is returned and error is set to +// G_KEY_FILE_ERROR_INVALID_VALUE. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// +// The function returns the following values: +// +// - oks: the values associated with the key as a list of booleans, or NULL +// if the key was not found or could not be parsed. The returned list of +// booleans should be freed with g_free() when no longer needed. +func (keyFile *KeyFile) BooleanList(groupName string, key string) ([]bool, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gboolean // in + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_boolean_list(_arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _oks []bool // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + _oks = make([]bool, _arg3) + copy(_oks, unsafe.Slice((*bool)(unsafe.Pointer(_cret)), _arg3)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _oks, _goerr +} + +// Comment retrieves a comment above key from group_name. If key is NULL then +// comment will be read from above group_name. If both key and group_name are +// NULL, then comment will be read from above the first group in the file. +// +// Note that the returned string does not include the '#' comment markers, +// but does include any whitespace after them (on each line). It includes the +// line breaks between lines, but does not include the final line break. +// +// The function takes the following parameters: +// +// - groupName (optional): group name, or NULL. +// - key (optional): key. +// +// The function returns the following values: +// +// - utf8: comment that should be freed with g_free(). +func (keyFile *KeyFile) Comment(groupName string, key string) (string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + if groupName != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + } + if key != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.g_key_file_get_comment(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// Double returns the value associated with key under group_name as a double. +// If group_name is NULL, the start_group is used. +// +// If key cannot be found then 0.0 is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated with key +// cannot be interpreted as a double then 0.0 is returned and error is set to +// G_KEY_FILE_ERROR_INVALID_VALUE. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// +// The function returns the following values: +// +// - gdouble: value associated with the key as a double, or 0.0 if the key was +// not found or could not be parsed. +func (keyFile *KeyFile) Double(groupName string, key string) (float64, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gdouble // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_double(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _gdouble float64 // out + var _goerr error // out + + _gdouble = float64(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gdouble, _goerr +} + +// DoubleList returns the values associated with key under group_name as +// doubles. +// +// If key cannot be found then NULL is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated with key +// cannot be interpreted as doubles then NULL is returned and error is set to +// G_KEY_FILE_ERROR_INVALID_VALUE. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// +// The function returns the following values: +// +// - gdoubles: the values associated with the key as a list of doubles, +// or NULL if the key was not found or could not be parsed. The returned +// list of doubles should be freed with g_free() when no longer needed. +func (keyFile *KeyFile) DoubleList(groupName string, key string) ([]float64, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gdouble // in + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_double_list(_arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _gdoubles []float64 // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + _gdoubles = make([]float64, _arg3) + copy(_gdoubles, unsafe.Slice((*float64)(unsafe.Pointer(_cret)), _arg3)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gdoubles, _goerr +} + +// Groups returns all groups in the key file loaded with key_file. The array of +// returned groups will be NULL-terminated, so length may optionally be NULL. +// +// The function returns the following values: +// +// - length (optional): return location for the number of returned groups, +// or NULL. +// - utf8s: newly-allocated NULL-terminated array of strings. Use g_strfreev() +// to free it. +func (keyFile *KeyFile) Groups() (uint, []string) { + var _arg0 *C.GKeyFile // out + var _arg1 C.gsize // in + var _cret **C.gchar // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + + _cret = C.g_key_file_get_groups(_arg0, &_arg1) + runtime.KeepAlive(keyFile) + + var _length uint // out + var _utf8s []string // out + + _length = uint(_arg1) + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _length, _utf8s +} + +// Int64 returns the value associated with key under group_name as a signed +// 64-bit integer. This is similar to g_key_file_get_integer() but can return +// 64-bit results without truncation. +// +// The function takes the following parameters: +// +// - groupName: non-NULL group name. +// - key: non-NULL key. +// +// The function returns the following values: +// +// - gint64: value associated with the key as a signed 64-bit integer, or 0 if +// the key was not found or could not be parsed. +func (keyFile *KeyFile) Int64(groupName string, key string) (int64, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gint64 // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_int64(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _gint64 int64 // out + var _goerr error // out + + _gint64 = int64(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint64, _goerr +} + +// Integer returns the value associated with key under group_name as an integer. +// +// If key cannot be found then 0 is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the value associated with +// key cannot be interpreted as an integer, or is out of range for a #gint, +// then 0 is returned and error is set to G_KEY_FILE_ERROR_INVALID_VALUE. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// +// The function returns the following values: +// +// - gint: value associated with the key as an integer, or 0 if the key was +// not found or could not be parsed. +func (keyFile *KeyFile) Integer(groupName string, key string) (int, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.gint // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_integer(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _gint int // out + var _goerr error // out + + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint, _goerr +} + +// IntegerList returns the values associated with key under group_name as +// integers. +// +// If key cannot be found then NULL is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. Likewise, if the values associated with key +// cannot be interpreted as integers, or are out of range for #gint, then NULL +// is returned and error is set to G_KEY_FILE_ERROR_INVALID_VALUE. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// +// The function returns the following values: +// +// - gints: the values associated with the key as a list of integers, or NULL +// if the key was not found or could not be parsed. The returned list of +// integers should be freed with g_free() when no longer needed. +func (keyFile *KeyFile) IntegerList(groupName string, key string) ([]int, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gint // in + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_integer_list(_arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _gints []int // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((*C.gint)(_cret), _arg3) + _gints = make([]int, _arg3) + for i := 0; i < int(_arg3); i++ { + _gints[i] = int(src[i]) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gints, _goerr +} + +// Keys returns all keys for the group name group_name. The array of returned +// keys will be NULL-terminated, so length may optionally be NULL. In the event +// that the group_name cannot be found, NULL is returned and error is set to +// G_KEY_FILE_ERROR_GROUP_NOT_FOUND. +// +// The function takes the following parameters: +// +// - groupName: group name. +// +// The function returns the following values: +// +// - length (optional): return location for the number of keys returned, +// or NULL. +// - utf8s: newly-allocated NULL-terminated array of strings. Use g_strfreev() +// to free it. +func (keyFile *KeyFile) Keys(groupName string) (uint, []string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 C.gsize // in + var _cret **C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_key_file_get_keys(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + + var _length uint // out + var _utf8s []string // out + var _goerr error // out + + _length = uint(_arg2) + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _utf8s, _goerr +} + +// LocaleForKey returns the actual locale which the result of +// g_key_file_get_locale_string() or g_key_file_get_locale_string_list() came +// from. +// +// If calling g_key_file_get_locale_string() or +// g_key_file_get_locale_string_list() with exactly the same key_file, +// group_name, key and locale, the result of those functions will have +// originally been tagged with the locale that is the result of this function. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - locale (optional) identifier or NULL. +// +// The function returns the following values: +// +// - utf8 (optional): locale from the file, or NULL if the key was not found +// or the entry in the file was was untranslated. +func (keyFile *KeyFile) LocaleForKey(groupName string, key string, locale string) string { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret *C.gchar // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + if locale != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(locale))) + defer C.free(unsafe.Pointer(_arg3)) + } + + _cret = C.g_key_file_get_locale_for_key(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(locale) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// LocaleString returns the value associated with key under group_name +// translated in the given locale if available. If locale is NULL then the +// current locale is assumed. +// +// If locale is to be non-NULL, or if the current locale will change over the +// lifetime of the File, it must be loaded with G_KEY_FILE_KEEP_TRANSLATIONS in +// order to load strings for all locales. +// +// If key cannot be found then NULL is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the value associated with key cannot be +// interpreted or no suitable translation can be found then the untranslated +// value is returned. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - locale (optional) identifier or NULL. +// +// The function returns the following values: +// +// - utf8: newly allocated string or NULL if the specified key cannot be +// found. +func (keyFile *KeyFile) LocaleString(groupName string, key string, locale string) (string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + if locale != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(locale))) + defer C.free(unsafe.Pointer(_arg3)) + } + + _cret = C.g_key_file_get_locale_string(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(locale) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// LocaleStringList returns the values associated with key under group_name +// translated in the given locale if available. If locale is NULL then the +// current locale is assumed. +// +// If locale is to be non-NULL, or if the current locale will change over the +// lifetime of the File, it must be loaded with G_KEY_FILE_KEEP_TRANSLATIONS in +// order to load strings for all locales. +// +// If key cannot be found then NULL is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. If the values associated with key cannot be +// interpreted or no suitable translations can be found then the untranslated +// values are returned. The returned array is NULL-terminated, so length may +// optionally be NULL. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - locale (optional) identifier or NULL. +// +// The function returns the following values: +// +// - utf8s: newly allocated NULL-terminated string array or NULL if the key +// isn't found. The string array should be freed with g_strfreev(). +func (keyFile *KeyFile) LocaleStringList(groupName string, key string, locale string) ([]string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret **C.gchar // in + var _arg4 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + if locale != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(locale))) + defer C.free(unsafe.Pointer(_arg3)) + } + + _cret = C.g_key_file_get_locale_string_list(_arg0, _arg1, _arg2, _arg3, &_arg4, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(locale) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg4) + _utf8s = make([]string, _arg4) + for i := 0; i < int(_arg4); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// StartGroup returns the name of the start group of the file. +// +// The function returns the following values: +// +// - utf8 (optional): start group of the key file. +func (keyFile *KeyFile) StartGroup() string { + var _arg0 *C.GKeyFile // out + var _cret *C.gchar // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + + _cret = C.g_key_file_get_start_group(_arg0) + runtime.KeepAlive(keyFile) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// String returns the string value associated with key under group_name. Unlike +// g_key_file_get_value(), this function handles escape sequences like \s. +// +// In the event the key cannot be found, NULL is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the group_name cannot be +// found, NULL is returned and error is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// +// The function returns the following values: +// +// - utf8: newly allocated string or NULL if the specified key cannot be +// found. +func (keyFile *KeyFile) String(groupName string, key string) (string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_string(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// StringList returns the values associated with key under group_name. +// +// In the event the key cannot be found, NULL is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the group_name cannot be +// found, NULL is returned and error is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// +// The function returns the following values: +// +// - utf8s: a NULL-terminated string array or NULL if the specified key cannot +// be found. The array should be freed with g_strfreev(). +func (keyFile *KeyFile) StringList(groupName string, key string) ([]string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret **C.gchar // in + var _arg3 C.gsize // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_string_list(_arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _utf8s []string // out + var _goerr error // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg3) + _utf8s = make([]string, _arg3) + for i := 0; i < int(_arg3); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8s, _goerr +} + +// Uint64 returns the value associated with key under group_name as an unsigned +// 64-bit integer. This is similar to g_key_file_get_integer() but can return +// large positive results without truncation. +// +// The function takes the following parameters: +// +// - groupName: non-NULL group name. +// - key: non-NULL key. +// +// The function returns the following values: +// +// - guint64: value associated with the key as an unsigned 64-bit integer, +// or 0 if the key was not found or could not be parsed. +func (keyFile *KeyFile) Uint64(groupName string, key string) (uint64, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret C.guint64 // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_uint64(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _guint64 uint64 // out + var _goerr error // out + + _guint64 = uint64(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _guint64, _goerr +} + +// Value returns the raw value associated with key under group_name. Use +// g_key_file_get_string() to retrieve an unescaped UTF-8 string. +// +// In the event the key cannot be found, NULL is returned and error is set to +// G_KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the group_name cannot be +// found, NULL is returned and error is set to G_KEY_FILE_ERROR_GROUP_NOT_FOUND. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// +// The function returns the following values: +// +// - utf8: newly allocated string or NULL if the specified key cannot be +// found. +func (keyFile *KeyFile) Value(groupName string, key string) (string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_key_file_get_value(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// HasGroup looks whether the key file has the group group_name. +// +// The function takes the following parameters: +// +// - groupName: group name. +// +// The function returns the following values: +// +// - ok: TRUE if group_name is a part of key_file, FALSE otherwise. +func (keyFile *KeyFile) HasGroup(groupName string) bool { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_key_file_has_group(_arg0, _arg1) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// LoadFromBytes loads a key file from the data in bytes into an empty File +// structure. If the object cannot be created then error is set to a FileError. +// +// The function takes the following parameters: +// +// - bytes: #GBytes. +// - flags from FileFlags. +func (keyFile *KeyFile) LoadFromBytes(bytes *Bytes, flags KeyFileFlags) error { + var _arg0 *C.GKeyFile // out + var _arg1 *C.GBytes // out + var _arg2 C.GKeyFileFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + _arg2 = C.GKeyFileFlags(flags) + + C.g_key_file_load_from_bytes(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(bytes) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// LoadFromData loads a key file from memory into an empty File structure. +// If the object cannot be created then error is set to a FileError. +// +// The function takes the following parameters: +// +// - data: key file loaded in memory. +// - flags from FileFlags. +func (keyFile *KeyFile) LoadFromData(data string, flags KeyFileFlags) error { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 C.gsize + var _arg3 C.GKeyFileFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg2 = (C.gsize)(len(data)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(data) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(data)), data) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = C.GKeyFileFlags(flags) + + C.g_key_file_load_from_data(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(data) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// LoadFromDataDirs: this function looks for a key file named file in the paths +// returned from g_get_user_data_dir() and g_get_system_data_dirs(), loads the +// file into key_file and returns the file's full path in full_path. If the file +// could not be loaded then an error is set to either a Error or FileError. +// +// The function takes the following parameters: +// +// - file: relative path to a filename to open and parse. +// - flags from FileFlags. +// +// The function returns the following values: +// +// - fullPath (optional): return location for a string containing the full +// path of the file, or NULL. +func (keyFile *KeyFile) LoadFromDataDirs(file string, flags KeyFileFlags) (string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // in + var _arg3 C.GKeyFileFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = C.GKeyFileFlags(flags) + + C.g_key_file_load_from_data_dirs(_arg0, _arg1, &_arg2, _arg3, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(file) + runtime.KeepAlive(flags) + + var _fullPath string // out + var _goerr error // out + + if _arg2 != nil { + _fullPath = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fullPath, _goerr +} + +// LoadFromDirs: this function looks for a key file named file in the paths +// specified in search_dirs, loads the file into key_file and returns the file's +// full path in full_path. +// +// If the file could not be found in any of the search_dirs, +// G_KEY_FILE_ERROR_NOT_FOUND is returned. If the file is found but the +// OS returns an error when opening or reading the file, a G_FILE_ERROR is +// returned. If there is a problem parsing the file, a G_KEY_FILE_ERROR is +// returned. +// +// The function takes the following parameters: +// +// - file: relative path to a filename to open and parse. +// - searchDirs: NULL-terminated array of directories to search. +// - flags from FileFlags. +// +// The function returns the following values: +// +// - fullPath (optional): return location for a string containing the full +// path of the file, or NULL. +func (keyFile *KeyFile) LoadFromDirs(file string, searchDirs []string, flags KeyFileFlags) (string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 **C.gchar // out + var _arg3 *C.gchar // in + var _arg4 C.GKeyFileFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg1)) + { + _arg2 = (**C.gchar)(C.calloc(C.size_t((len(searchDirs) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice(_arg2, len(searchDirs)+1) + var zero *C.gchar + out[len(searchDirs)] = zero + for i := range searchDirs { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(searchDirs[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + _arg4 = C.GKeyFileFlags(flags) + + C.g_key_file_load_from_dirs(_arg0, _arg1, _arg2, &_arg3, _arg4, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(file) + runtime.KeepAlive(searchDirs) + runtime.KeepAlive(flags) + + var _fullPath string // out + var _goerr error // out + + if _arg3 != nil { + _fullPath = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) + defer C.free(unsafe.Pointer(_arg3)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _fullPath, _goerr +} + +// LoadFromFile loads a key file into an empty File structure. +// +// If the OS returns an error when opening or reading the file, a G_FILE_ERROR +// is returned. If there is a problem parsing the file, a G_KEY_FILE_ERROR is +// returned. +// +// This function will never return a G_KEY_FILE_ERROR_NOT_FOUND error. If the +// file is not found, G_FILE_ERROR_NOENT is returned. +// +// The function takes the following parameters: +// +// - file: path of a filename to load, in the GLib filename encoding. +// - flags from FileFlags. +func (keyFile *KeyFile) LoadFromFile(file string, flags KeyFileFlags) error { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 C.GKeyFileFlags // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GKeyFileFlags(flags) + + C.g_key_file_load_from_file(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(file) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// RemoveComment removes a comment above key from group_name. If key is NULL +// then comment will be removed above group_name. If both key and group_name are +// NULL, then comment will be removed above the first group in the file. +// +// The function takes the following parameters: +// +// - groupName (optional): group name, or NULL. +// - key (optional): key. +func (keyFile *KeyFile) RemoveComment(groupName string, key string) error { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + if groupName != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + } + if key != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + } + + C.g_key_file_remove_comment(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// RemoveGroup removes the specified group, group_name, from the key file. +// +// The function takes the following parameters: +// +// - groupName: group name. +func (keyFile *KeyFile) RemoveGroup(groupName string) error { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_key_file_remove_group(_arg0, _arg1, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// RemoveKey removes key in group_name from the key file. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key name to remove. +func (keyFile *KeyFile) RemoveKey(groupName string, key string) error { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_key_file_remove_key(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SaveToFile writes the contents of key_file to filename using +// g_file_set_contents(). If you need stricter guarantees about durability +// of the written file than are provided by g_file_set_contents(), use +// g_file_set_contents_full() with the return value of g_key_file_to_data(). +// +// This function can fail for any of the reasons that g_file_set_contents() may +// fail. +// +// The function takes the following parameters: +// +// - filename: name of the file to write to. +func (keyFile *KeyFile) SaveToFile(filename string) error { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_key_file_save_to_file(_arg0, _arg1, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(filename) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetBoolean associates a new boolean value with key under group_name. If key +// cannot be found then it is created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - value: TRUE or FALSE. +func (keyFile *KeyFile) SetBoolean(groupName string, key string, value bool) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gboolean // out + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + if value { + _arg3 = C.TRUE + } + + C.g_key_file_set_boolean(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(value) +} + +// SetBooleanList associates a list of boolean values with key under group_name. +// If key cannot be found then it is created. If group_name is NULL, the +// start_group is used. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - list: array of boolean values. +func (keyFile *KeyFile) SetBooleanList(groupName string, key string, list []bool) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gboolean // out + var _arg4 C.gsize + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg4 = (C.gsize)(len(list)) + if len(list) > 0 { + _arg3 = (*C.gboolean)(unsafe.Pointer(&list[0])) + } + + C.g_key_file_set_boolean_list(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(list) +} + +// SetComment places a comment above key from group_name. +// +// If key is NULL then comment will be written above group_name. If both key and +// group_name are NULL, then comment will be written above the first group in +// the file. +// +// Note that this function prepends a '#' comment marker to each line of +// comment. +// +// The function takes the following parameters: +// +// - groupName (optional): group name, or NULL. +// - key (optional): key. +// - comment: comment. +func (keyFile *KeyFile) SetComment(groupName string, key string, comment string) error { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + if groupName != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + } + if key != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + } + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(comment))) + defer C.free(unsafe.Pointer(_arg3)) + + C.g_key_file_set_comment(_arg0, _arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(comment) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetDouble associates a new double value with key under group_name. If key +// cannot be found then it is created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - value: double value. +func (keyFile *KeyFile) SetDouble(groupName string, key string, value float64) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gdouble // out + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.gdouble(value) + + C.g_key_file_set_double(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(value) +} + +// SetDoubleList associates a list of double values with key under group_name. +// If key cannot be found then it is created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - list: array of double values. +func (keyFile *KeyFile) SetDoubleList(groupName string, key string, list []float64) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gdouble // out + var _arg4 C.gsize + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg4 = (C.gsize)(len(list)) + if len(list) > 0 { + _arg3 = (*C.gdouble)(unsafe.Pointer(&list[0])) + } + + C.g_key_file_set_double_list(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(list) +} + +// SetInt64 associates a new integer value with key under group_name. If key +// cannot be found then it is created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - value: integer value. +func (keyFile *KeyFile) SetInt64(groupName string, key string, value int64) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gint64 // out + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.gint64(value) + + C.g_key_file_set_int64(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(value) +} + +// SetInteger associates a new integer value with key under group_name. If key +// cannot be found then it is created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - value: integer value. +func (keyFile *KeyFile) SetInteger(groupName string, key string, value int) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.gint // out + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.gint(value) + + C.g_key_file_set_integer(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(value) +} + +// SetIntegerList associates a list of integer values with key under group_name. +// If key cannot be found then it is created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - list: array of integer values. +func (keyFile *KeyFile) SetIntegerList(groupName string, key string, list []int) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gint // out + var _arg4 C.gsize + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg4 = (C.gsize)(len(list)) + _arg3 = (*C.gint)(C.calloc(C.size_t(len(list)), C.size_t(C.sizeof_gint))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice((*C.gint)(_arg3), len(list)) + for i := range list { + out[i] = C.gint(list[i]) + } + } + + C.g_key_file_set_integer_list(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(list) +} + +// SetListSeparator sets the character which is used to separate values +// in lists. Typically ';' or ',' are used as separators. The default list +// separator is ';'. +// +// The function takes the following parameters: +// +// - separator: separator. +func (keyFile *KeyFile) SetListSeparator(separator byte) { + var _arg0 *C.GKeyFile // out + var _arg1 C.gchar // out + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = C.gchar(separator) + + C.g_key_file_set_list_separator(_arg0, _arg1) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(separator) +} + +// SetLocaleString associates a string value for key and locale under +// group_name. If the translation for key cannot be found then it is created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - locale identifier. +// - str: string. +func (keyFile *KeyFile) SetLocaleString(groupName string, key string, locale string, str string) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(locale))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg4)) + + C.g_key_file_set_locale_string(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(locale) + runtime.KeepAlive(str) +} + +// SetLocaleStringList associates a list of string values for key and locale +// under group_name. If the translation for key cannot be found then it is +// created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - locale identifier. +// - list: NULL-terminated array of locale string values. +func (keyFile *KeyFile) SetLocaleStringList(groupName string, key string, locale string, list []string) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 **C.gchar // out + var _arg5 C.gsize + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(locale))) + defer C.free(unsafe.Pointer(_arg3)) + _arg5 = (C.gsize)(len(list)) + _arg4 = (**C.gchar)(C.calloc(C.size_t(len(list)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((**C.gchar)(_arg4), len(list)) + for i := range list { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(list[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + + C.g_key_file_set_locale_string_list(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(locale) + runtime.KeepAlive(list) +} + +// SetString associates a new string value with key under group_name. If key +// cannot be found then it is created. If group_name cannot be found then it is +// created. Unlike g_key_file_set_value(), this function handles characters that +// need escaping, such as newlines. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - str: string. +func (keyFile *KeyFile) SetString(groupName string, key string, str string) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg3)) + + C.g_key_file_set_string(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(str) +} + +// SetStringList associates a list of string values for key under group_name. +// If key cannot be found then it is created. If group_name cannot be found then +// it is created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - list: array of string values. +func (keyFile *KeyFile) SetStringList(groupName string, key string, list []string) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 **C.gchar // out + var _arg4 C.gsize + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg4 = (C.gsize)(len(list)) + _arg3 = (**C.gchar)(C.calloc(C.size_t(len(list)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice((**C.gchar)(_arg3), len(list)) + for i := range list { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(list[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + + C.g_key_file_set_string_list(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(list) +} + +// SetUint64 associates a new integer value with key under group_name. If key +// cannot be found then it is created. +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - value: integer value. +func (keyFile *KeyFile) SetUint64(groupName string, key string, value uint64) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.guint64 // out + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.guint64(value) + + C.g_key_file_set_uint64(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(value) +} + +// SetValue associates a new value with key under group_name. +// +// If key cannot be found then it is created. If group_name cannot be found then +// it is created. To set an UTF-8 string which may contain characters that need +// escaping (such as newlines or spaces), use g_key_file_set_string(). +// +// The function takes the following parameters: +// +// - groupName: group name. +// - key: key. +// - value: string. +func (keyFile *KeyFile) SetValue(groupName string, key string, value string) { + var _arg0 *C.GKeyFile // out + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(value))) + defer C.free(unsafe.Pointer(_arg3)) + + C.g_key_file_set_value(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(keyFile) + runtime.KeepAlive(groupName) + runtime.KeepAlive(key) + runtime.KeepAlive(value) +} + +// ToData: this function outputs key_file as a string. +// +// Note that this function never reports an error, so it is safe to pass NULL as +// error. +// +// The function returns the following values: +// +// - length (optional): return location for the length of the returned string, +// or NULL. +// - utf8: newly allocated string holding the contents of the File. +func (keyFile *KeyFile) ToData() (uint, string, error) { + var _arg0 *C.GKeyFile // out + var _arg1 C.gsize // in + var _cret *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + + _cret = C.g_key_file_to_data(_arg0, &_arg1, &_cerr) + runtime.KeepAlive(keyFile) + + var _length uint // out + var _utf8 string // out + var _goerr error // out + + _length = uint(_arg1) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _length, _utf8, _goerr +} + +func KeyFileErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_key_file_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// LogField: structure representing a single field in a structured log entry. +// See g_log_structured() for details. +// +// Log fields may contain arbitrary values, including binary with embedded nul +// bytes. If the field contains a string, the string must be UTF-8 encoded and +// have a trailing nul byte. Otherwise, length must be set to a non-negative +// value. +// +// An instance of this type is always passed by reference. +type LogField struct { + *logField +} + +// logField is the struct that's finalized. +type logField struct { + native *C.GLogField +} + +// Key: field name (UTF-8 string). +func (l *LogField) Key() string { + valptr := &l.native.key + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// MainContext: GMainContext struct is an opaque data type representing a set of +// sources to be handled in a main loop. +// +// An instance of this type is always passed by reference. +type MainContext struct { + *mainContext +} + +// mainContext is the struct that's finalized. +type mainContext struct { + native *C.GMainContext +} + +func marshalMainContext(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &MainContext{&mainContext{(*C.GMainContext)(b)}}, nil +} + +// NewMainContext constructs a struct MainContext. +func NewMainContext() *MainContext { + var _cret *C.GMainContext // in + + _cret = C.g_main_context_new() + + var _mainContext *MainContext // out + + _mainContext = (*MainContext)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mainContext)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_main_context_unref((*C.GMainContext)(intern.C)) + }, + ) + + return _mainContext +} + +// NewMainContextWithFlags constructs a struct MainContext. +func NewMainContextWithFlags(flags MainContextFlags) *MainContext { + var _arg1 C.GMainContextFlags // out + var _cret *C.GMainContext // in + + _arg1 = C.GMainContextFlags(flags) + + _cret = C.g_main_context_new_with_flags(_arg1) + runtime.KeepAlive(flags) + + var _mainContext *MainContext // out + + _mainContext = (*MainContext)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mainContext)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_main_context_unref((*C.GMainContext)(intern.C)) + }, + ) + + return _mainContext +} + +// Acquire tries to become the owner of the specified context. If some other +// thread is the owner of the context, returns FALSE immediately. Ownership +// is properly recursive: the owner can require ownership again and will +// release ownership when g_main_context_release() is called as many times as +// g_main_context_acquire(). +// +// You must be the owner of a context before you can call +// g_main_context_prepare(), g_main_context_query(), g_main_context_check(), +// g_main_context_dispatch(), g_main_context_release(). +// +// Since 2.76 context can be NULL to use the global-default main context. +// +// The function returns the following values: +// +// - ok: TRUE if the operation succeeded, and this thread is now the owner of +// context. +func (context *MainContext) Acquire() bool { + var _arg0 *C.GMainContext // out + var _cret C.gboolean // in + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + _cret = C.g_main_context_acquire(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Dispatch dispatches all pending sources. +// +// You must have successfully acquired the context with g_main_context_acquire() +// before you may call this function. +// +// Since 2.76 context can be NULL to use the global-default main context. +func (context *MainContext) Dispatch() { + var _arg0 *C.GMainContext // out + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + C.g_main_context_dispatch(_arg0) + runtime.KeepAlive(context) +} + +// FindSourceByFuncsUserData finds a source with the given source functions and +// user data. If multiple sources exist with the same source function and user +// data, the first one found will be returned. +// +// The function takes the following parameters: +// +// - funcs passed to g_source_new(). +// - userData (optional): user data from the callback. +// +// The function returns the following values: +// +// - source: source, if one was found, otherwise NULL. +func (context *MainContext) FindSourceByFuncsUserData(funcs *SourceFuncs, userData unsafe.Pointer) *Source { + var _arg0 *C.GMainContext // out + var _arg1 *C.GSourceFuncs // out + var _arg2 C.gpointer // out + var _cret *C.GSource // in + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + _arg1 = (*C.GSourceFuncs)(gextras.StructNative(unsafe.Pointer(funcs))) + _arg2 = (C.gpointer)(unsafe.Pointer(userData)) + + _cret = C.g_main_context_find_source_by_funcs_user_data(_arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(funcs) + runtime.KeepAlive(userData) + + var _source *Source // out + + _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_source_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// FindSourceByID finds a #GSource given a pair of context and ID. +// +// It is a programmer error to attempt to look up a non-existent source. +// +// More specifically: source IDs can be reissued after a source has been +// destroyed and therefore it is never valid to use this function with a source +// ID which may have already been removed. An example is when scheduling an idle +// to run in another thread with g_idle_add(): the idle may already have run and +// been removed by the time this function is called on its (now invalid) source +// ID. This source ID may have been reissued, leading to the operation being +// performed against the wrong source. +// +// The function takes the following parameters: +// +// - sourceId: source ID, as returned by g_source_get_id(). +// +// The function returns the following values: +// +// - source: #GSource. +func (context *MainContext) FindSourceByID(sourceId uint) *Source { + var _arg0 *C.GMainContext // out + var _arg1 C.guint // out + var _cret *C.GSource // in + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + _arg1 = C.guint(sourceId) + + _cret = C.g_main_context_find_source_by_id(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(sourceId) + + var _source *Source // out + + _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_source_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// FindSourceByUserData finds a source with the given user data for the +// callback. If multiple sources exist with the same user data, the first one +// found will be returned. +// +// The function takes the following parameters: +// +// - userData (optional): user_data for the callback. +// +// The function returns the following values: +// +// - source: source, if one was found, otherwise NULL. +func (context *MainContext) FindSourceByUserData(userData unsafe.Pointer) *Source { + var _arg0 *C.GMainContext // out + var _arg1 C.gpointer // out + var _cret *C.GSource // in + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + _arg1 = (C.gpointer)(unsafe.Pointer(userData)) + + _cret = C.g_main_context_find_source_by_user_data(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(userData) + + var _source *Source // out + + _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_source_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// InvokeFull invokes a function in such a way that context is owned during the +// invocation of function. +// +// This function is the same as g_main_context_invoke() except that it lets you +// specify the priority in case function ends up being scheduled as an idle and +// also lets you give a Notify for data. +// +// notify should not assume that it is called from any particular thread or with +// any particular context acquired. +// +// The function takes the following parameters: +// +// - priority at which to run function. +// - function to call. +func (context *MainContext) InvokeFull(priority int, function SourceFunc) { + var _arg0 *C.GMainContext // out + var _arg1 C.gint // out + var _arg2 C.GSourceFunc // out + var _arg3 C.gpointer + var _arg4 C.GDestroyNotify + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + _arg1 = C.gint(priority) + _arg2 = (*[0]byte)(C._gotk4_glib2_SourceFunc) + _arg3 = C.gpointer(gbox.Assign(function)) + _arg4 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + + C.g_main_context_invoke_full(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(context) + runtime.KeepAlive(priority) + runtime.KeepAlive(function) +} + +// IsOwner determines whether this thread holds the (recursive) ownership of +// this Context. This is useful to know before waiting on another thread that +// may be blocking to get ownership of context. +// +// The function returns the following values: +// +// - ok: TRUE if current thread is owner of context. +func (context *MainContext) IsOwner() bool { + var _arg0 *C.GMainContext // out + var _cret C.gboolean // in + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + _cret = C.g_main_context_is_owner(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Iteration runs a single iteration for the given main loop. This involves +// checking to see if any event sources are ready to be processed, then if +// no events sources are ready and may_block is TRUE, waiting for a source to +// become ready, then dispatching the highest priority events sources that are +// ready. Otherwise, if may_block is FALSE sources are not waited to become +// ready, only those highest priority events sources will be dispatched (if +// any), that are ready at this given moment without further waiting. +// +// Note that even when may_block is TRUE, it is still possible for +// g_main_context_iteration() to return FALSE, since the wait may be interrupted +// for other reasons than an event source becoming ready. +// +// The function takes the following parameters: +// +// - mayBlock: whether the call may block. +// +// The function returns the following values: +// +// - ok: TRUE if events were dispatched. +func (context *MainContext) Iteration(mayBlock bool) bool { + var _arg0 *C.GMainContext // out + var _arg1 C.gboolean // out + var _cret C.gboolean // in + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + if mayBlock { + _arg1 = C.TRUE + } + + _cret = C.g_main_context_iteration(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(mayBlock) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Pending checks if any sources have pending events for the given context. +// +// The function returns the following values: +// +// - ok: TRUE if events are pending. +func (context *MainContext) Pending() bool { + var _arg0 *C.GMainContext // out + var _cret C.gboolean // in + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + _cret = C.g_main_context_pending(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PopThreadDefault pops context off the thread-default context stack (verifying +// that it was on the top of the stack). +func (context *MainContext) PopThreadDefault() { + var _arg0 *C.GMainContext // out + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + C.g_main_context_pop_thread_default(_arg0) + runtime.KeepAlive(context) +} + +// Prepare prepares to poll sources within a main loop. The resulting +// information for polling is determined by calling g_main_context_query (). +// +// You must have successfully acquired the context with g_main_context_acquire() +// before you may call this function. +// +// The function returns the following values: +// +// - priority (optional): location to store priority of highest priority +// source already ready. +// - ok: TRUE if some source is ready to be dispatched prior to polling. +func (context *MainContext) Prepare() (int, bool) { + var _arg0 *C.GMainContext // out + var _arg1 C.gint // in + var _cret C.gboolean // in + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + _cret = C.g_main_context_prepare(_arg0, &_arg1) + runtime.KeepAlive(context) + + var _priority int // out + var _ok bool // out + + _priority = int(_arg1) + if _cret != 0 { + _ok = true + } + + return _priority, _ok +} + +// PushThreadDefault acquires context and sets it as the thread-default context +// for the current thread. This will cause certain asynchronous operations (such +// as most [gio][gio]-based I/O) which are started in this thread to run under +// context and deliver their results to its main loop, rather than running under +// the global default main context in the main thread. Note that calling this +// function changes the context returned by g_main_context_get_thread_default(), +// not the one returned by g_main_context_default(), so it does not affect the +// context used by functions like g_idle_add(). +// +// Normally you would call this function shortly after creating a new thread, +// passing it a Context which will be run by a Loop in that thread, to set a new +// default context for all async operations in that thread. In this case you may +// not need to ever call g_main_context_pop_thread_default(), assuming you want +// the new Context to be the default for the whole lifecycle of the thread. +// +// If you don't have control over how the new thread was created (e.g. +// in the new thread isn't newly created, or if the thread life cycle is +// managed by a Pool), it is always suggested to wrap the logic that needs +// to use the new Context inside a g_main_context_push_thread_default() / +// g_main_context_pop_thread_default() pair, otherwise threads that are re-used +// will end up never explicitly releasing the Context reference they hold. +// +// In some cases you may want to schedule a single operation in a non-default +// context, or temporarily use a non-default context in the main thread. +// In that case, you can wrap the call to the asynchronous operation inside a +// g_main_context_push_thread_default() / g_main_context_pop_thread_default() +// pair, but it is up to you to ensure that no other asynchronous operations +// accidentally get started while the non-default context is active. +// +// Beware that libraries that predate this function may not correctly +// handle being used from a thread with a thread-default context. Eg, see +// g_file_supports_thread_contexts(). +func (context *MainContext) PushThreadDefault() { + var _arg0 *C.GMainContext // out + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + C.g_main_context_push_thread_default(_arg0) + runtime.KeepAlive(context) +} + +// Release releases ownership of a context previously acquired by this thread +// with g_main_context_acquire(). If the context was acquired multiple times, +// the ownership will be released only when g_main_context_release() is called +// as many times as it was acquired. +// +// You must have successfully acquired the context with g_main_context_acquire() +// before you may call this function. +func (context *MainContext) Release() { + var _arg0 *C.GMainContext // out + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + C.g_main_context_release(_arg0) + runtime.KeepAlive(context) +} + +// Wakeup: if context is currently blocking in g_main_context_iteration() +// waiting for a source to become ready, cause it to stop blocking and return. +// Otherwise, cause the next invocation of g_main_context_iteration() to return +// without blocking. +// +// This API is useful for low-level control over Context; for example, +// integrating it with main loop implementations such as Loop. +// +// Another related use for this function is when implementing a main loop with a +// termination condition, computed from multiple threads: +// +// perform_work(); +// +// if (g_atomic_int_dec_and_test (&tasks_remaining)) +// g_main_context_wakeup (NULL);. +func (context *MainContext) Wakeup() { + var _arg0 *C.GMainContext // out + + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + C.g_main_context_wakeup(_arg0) + runtime.KeepAlive(context) +} + +// MainContextDefault returns the global-default main context. This is +// the main context used for main loop functions when a main loop is not +// explicitly specified, and corresponds to the "main" main loop. See also +// g_main_context_get_thread_default(). +// +// The function returns the following values: +// +// - mainContext: global-default main context. +func MainContextDefault() *MainContext { + var _cret *C.GMainContext // in + + _cret = C.g_main_context_default() + + var _mainContext *MainContext // out + + _mainContext = (*MainContext)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_main_context_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mainContext)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_main_context_unref((*C.GMainContext)(intern.C)) + }, + ) + + return _mainContext +} + +// MainContextGetThreadDefault gets the thread-default Context for +// this thread. Asynchronous operations that want to be able to be run +// in contexts other than the default one should call this method or +// g_main_context_ref_thread_default() to get a Context to add their #GSources +// to. (Note that even in single-threaded programs applications may sometimes +// want to temporarily push a non-default context, so it is not safe to assume +// that this will always return NULL if you are running in the default thread.) +// +// If you need to hold a reference on the context, use +// g_main_context_ref_thread_default() instead. +// +// The function returns the following values: +// +// - mainContext (optional): thread-default Context, or NULL if the +// thread-default context is the global-default main context. +func MainContextGetThreadDefault() *MainContext { + var _cret *C.GMainContext // in + + _cret = C.g_main_context_get_thread_default() + + var _mainContext *MainContext // out + + if _cret != nil { + _mainContext = (*MainContext)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_main_context_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mainContext)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_main_context_unref((*C.GMainContext)(intern.C)) + }, + ) + } + + return _mainContext +} + +// MainContextRefThreadDefault gets the thread-default Context for this +// thread, as with g_main_context_get_thread_default(), but also adds +// a reference to it with g_main_context_ref(). In addition, unlike +// g_main_context_get_thread_default(), if the thread-default context is the +// global-default context, this will return that Context (with a ref added to +// it) rather than returning NULL. +// +// The function returns the following values: +// +// - mainContext: thread-default Context. Unref with g_main_context_unref() +// when you are done with it. +func MainContextRefThreadDefault() *MainContext { + var _cret *C.GMainContext // in + + _cret = C.g_main_context_ref_thread_default() + + var _mainContext *MainContext // out + + _mainContext = (*MainContext)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mainContext)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_main_context_unref((*C.GMainContext)(intern.C)) + }, + ) + + return _mainContext +} + +// MainLoop: GMainLoop struct is an opaque data type representing the main event +// loop of a GLib or GTK application. +// +// An instance of this type is always passed by reference. +type MainLoop struct { + *mainLoop +} + +// mainLoop is the struct that's finalized. +type mainLoop struct { + native *C.GMainLoop +} + +func marshalMainLoop(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &MainLoop{&mainLoop{(*C.GMainLoop)(b)}}, nil +} + +// NewMainLoop constructs a struct MainLoop. +func NewMainLoop(context *MainContext, isRunning bool) *MainLoop { + var _arg1 *C.GMainContext // out + var _arg2 C.gboolean // out + var _cret *C.GMainLoop // in + + if context != nil { + _arg1 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + if isRunning { + _arg2 = C.TRUE + } + + _cret = C.g_main_loop_new(_arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(isRunning) + + var _mainLoop *MainLoop // out + + _mainLoop = (*MainLoop)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mainLoop)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_main_loop_unref((*C.GMainLoop)(intern.C)) + }, + ) + + return _mainLoop +} + +// Context returns the Context of loop. +// +// The function returns the following values: +// +// - mainContext of loop. +func (loop *MainLoop) Context() *MainContext { + var _arg0 *C.GMainLoop // out + var _cret *C.GMainContext // in + + _arg0 = (*C.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) + + _cret = C.g_main_loop_get_context(_arg0) + runtime.KeepAlive(loop) + + var _mainContext *MainContext // out + + _mainContext = (*MainContext)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_main_context_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mainContext)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_main_context_unref((*C.GMainContext)(intern.C)) + }, + ) + + return _mainContext +} + +// IsRunning checks to see if the main loop is currently being run via +// g_main_loop_run(). +// +// The function returns the following values: +// +// - ok: TRUE if the mainloop is currently being run. +func (loop *MainLoop) IsRunning() bool { + var _arg0 *C.GMainLoop // out + var _cret C.gboolean // in + + _arg0 = (*C.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) + + _cret = C.g_main_loop_is_running(_arg0) + runtime.KeepAlive(loop) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Quit stops a Loop from running. Any calls to g_main_loop_run() for the loop +// will return. +// +// Note that sources that have already been dispatched when g_main_loop_quit() +// is called will still be executed. +func (loop *MainLoop) Quit() { + var _arg0 *C.GMainLoop // out + + _arg0 = (*C.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) + + C.g_main_loop_quit(_arg0) + runtime.KeepAlive(loop) +} + +// Run runs a main loop until g_main_loop_quit() is called on the loop. If this +// is called for the thread of the loop's Context, it will process events from +// the loop, otherwise it will simply wait. +func (loop *MainLoop) Run() { + var _arg0 *C.GMainLoop // out + + _arg0 = (*C.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) + + C.g_main_loop_run(_arg0) + runtime.KeepAlive(loop) +} + +// MappedFile represents a file mapping created with g_mapped_file_new(). +// It has only private members and should not be accessed directly. +// +// An instance of this type is always passed by reference. +type MappedFile struct { + *mappedFile +} + +// mappedFile is the struct that's finalized. +type mappedFile struct { + native *C.GMappedFile +} + +func marshalMappedFile(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &MappedFile{&mappedFile{(*C.GMappedFile)(b)}}, nil +} + +// NewMappedFile constructs a struct MappedFile. +func NewMappedFile(filename string, writable bool) (*MappedFile, error) { + var _arg1 *C.gchar // out + var _arg2 C.gboolean // out + var _cret *C.GMappedFile // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + if writable { + _arg2 = C.TRUE + } + + _cret = C.g_mapped_file_new(_arg1, _arg2, &_cerr) + runtime.KeepAlive(filename) + runtime.KeepAlive(writable) + + var _mappedFile *MappedFile // out + var _goerr error // out + + _mappedFile = (*MappedFile)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mappedFile)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_mapped_file_unref((*C.GMappedFile)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _mappedFile, _goerr +} + +// NewMappedFileFromFd constructs a struct MappedFile. +func NewMappedFileFromFd(fd int, writable bool) (*MappedFile, error) { + var _arg1 C.gint // out + var _arg2 C.gboolean // out + var _cret *C.GMappedFile // in + var _cerr *C.GError // in + + _arg1 = C.gint(fd) + if writable { + _arg2 = C.TRUE + } + + _cret = C.g_mapped_file_new_from_fd(_arg1, _arg2, &_cerr) + runtime.KeepAlive(fd) + runtime.KeepAlive(writable) + + var _mappedFile *MappedFile // out + var _goerr error // out + + _mappedFile = (*MappedFile)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mappedFile)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_mapped_file_unref((*C.GMappedFile)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _mappedFile, _goerr +} + +// Bytes creates a new #GBytes which references the data mapped from file. +// The mapped contents of the file must not be modified after creating this +// bytes object, because a #GBytes should be immutable. +// +// The function returns the following values: +// +// - bytes: newly allocated #GBytes referencing data from file. +func (file *MappedFile) Bytes() *Bytes { + var _arg0 *C.GMappedFile // out + var _cret *C.GBytes // in + + _arg0 = (*C.GMappedFile)(gextras.StructNative(unsafe.Pointer(file))) + + _cret = C.g_mapped_file_get_bytes(_arg0) + runtime.KeepAlive(file) + + var _bytes *Bytes // out + + _bytes = (*Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// Contents returns the contents of a File. +// +// Note that the contents may not be zero-terminated, even if the File is backed +// by a text file. +// +// If the file is empty then NULL is returned. +// +// The function returns the following values: +// +// - utf8 contents of file, or NULL. +func (file *MappedFile) Contents() string { + var _arg0 *C.GMappedFile // out + var _cret *C.gchar // in + + _arg0 = (*C.GMappedFile)(gextras.StructNative(unsafe.Pointer(file))) + + _cret = C.g_mapped_file_get_contents(_arg0) + runtime.KeepAlive(file) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Length returns the length of the contents of a File. +// +// The function returns the following values: +// +// - gsize: length of the contents of file. +func (file *MappedFile) Length() uint { + var _arg0 *C.GMappedFile // out + var _cret C.gsize // in + + _arg0 = (*C.GMappedFile)(gextras.StructNative(unsafe.Pointer(file))) + + _cret = C.g_mapped_file_get_length(_arg0) + runtime.KeepAlive(file) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// MarkupParseContext: parse context is used to parse a stream of bytes that you +// expect to contain marked-up text. +// +// See g_markup_parse_context_new(), Parser, and so on for more details. +// +// An instance of this type is always passed by reference. +type MarkupParseContext struct { + *markupParseContext +} + +// markupParseContext is the struct that's finalized. +type markupParseContext struct { + native *C.GMarkupParseContext +} + +func marshalMarkupParseContext(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &MarkupParseContext{&markupParseContext{(*C.GMarkupParseContext)(b)}}, nil +} + +// EndParse signals to the ParseContext that all data has been fed into the +// parse context with g_markup_parse_context_parse(). +// +// This function reports an error if the document isn't complete, for example if +// elements are still open. +func (context *MarkupParseContext) EndParse() error { + var _arg0 *C.GMarkupParseContext // out + var _cerr *C.GError // in + + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + + C.g_markup_parse_context_end_parse(_arg0, &_cerr) + runtime.KeepAlive(context) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Element retrieves the name of the currently open element. +// +// If called from the start_element or end_element handlers this will give +// the element_name as passed to those functions. For the parent elements, +// see g_markup_parse_context_get_element_stack(). +// +// The function returns the following values: +// +// - utf8: name of the currently open element, or NULL. +func (context *MarkupParseContext) Element() string { + var _arg0 *C.GMarkupParseContext // out + var _cret *C.gchar // in + + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + + _cret = C.g_markup_parse_context_get_element(_arg0) + runtime.KeepAlive(context) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// ElementStack retrieves the element stack from the internal state of the +// parser. +// +// The returned List is a list of strings where the first item is the currently +// open tag (as would be returned by g_markup_parse_context_get_element()) and +// the next item is its immediate parent. +// +// This function is intended to be used in the start_element and end_element +// handlers where g_markup_parse_context_get_element() would merely return the +// name of the element that is being processed. +// +// The function returns the following values: +// +// - sList: element stack, which must not be modified. +func (context *MarkupParseContext) ElementStack() []string { + var _arg0 *C.GMarkupParseContext // out + var _cret *C.GSList // in + + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + + _cret = C.g_markup_parse_context_get_element_stack(_arg0) + runtime.KeepAlive(context) + + var _sList []string // out + + _sList = make([]string, 0, gextras.SListSize(unsafe.Pointer(_cret))) + gextras.MoveSList(unsafe.Pointer(_cret), false, func(v unsafe.Pointer) { + src := (*C.gchar)(v) + var dst string // out + dst = C.GoString((*C.gchar)(unsafe.Pointer(src))) + _sList = append(_sList, dst) + }) + + return _sList +} + +// Position retrieves the current line number and the number of the character on +// that line. Intended for use in error messages; there are no strict semantics +// for what constitutes the "current" line number other than "the best number we +// could come up with for error messages.". +// +// The function returns the following values: +// +// - lineNumber (optional): return location for a line number, or NULL. +// - charNumber (optional): return location for a char-on-line number, +// or NULL. +func (context *MarkupParseContext) Position() (lineNumber int, charNumber int) { + var _arg0 *C.GMarkupParseContext // out + var _arg1 C.gint // in + var _arg2 C.gint // in + + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + + C.g_markup_parse_context_get_position(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(context) + + var _lineNumber int // out + var _charNumber int // out + + _lineNumber = int(_arg1) + _charNumber = int(_arg2) + + return _lineNumber, _charNumber +} + +// UserData returns the user_data associated with context. +// +// This will either be the user_data that was provided to +// g_markup_parse_context_new() or to the most recent call of +// g_markup_parse_context_push(). +// +// The function returns the following values: +// +// - gpointer (optional): provided user_data. The returned data belongs to the +// markup context and will be freed when g_markup_parse_context_free() is +// called. +func (context *MarkupParseContext) UserData() unsafe.Pointer { + var _arg0 *C.GMarkupParseContext // out + var _cret C.gpointer // in + + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + + _cret = C.g_markup_parse_context_get_user_data(_arg0) + runtime.KeepAlive(context) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// Parse: feed some data to the ParseContext. +// +// The data need not be valid UTF-8; an error will be signaled if it's invalid. +// The data need not be an entire document; you can feed a document into the +// parser incrementally, via multiple calls to this function. Typically, +// as you receive data from a network connection or file, you feed each received +// chunk of data into this function, aborting the process if an error occurs. +// Once an error is reported, no further data may be fed to the ParseContext; +// all errors are fatal. +// +// The function takes the following parameters: +// +// - text: chunk of text to parse. +func (context *MarkupParseContext) Parse(text string) error { + var _arg0 *C.GMarkupParseContext // out + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _cerr *C.GError // in + + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + _arg2 = (C.gssize)(len(text)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(text) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(text)), text) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_markup_parse_context_parse(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(context) + runtime.KeepAlive(text) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Pop completes the process of a temporary sub-parser redirection. +// +// This function exists to collect the user_data allocated by a matching call +// to g_markup_parse_context_push(). It must be called in the end_element +// handler corresponding to the start_element handler during which +// g_markup_parse_context_push() was called. You must not call this function +// from the error callback -- the user_data is provided directly to the callback +// in that case. +// +// This function is not intended to be directly called by users interested in +// invoking subparsers. Instead, it is intended to be used by the subparsers +// themselves to implement a higher-level interface. +// +// The function returns the following values: +// +// - gpointer (optional): user data passed to g_markup_parse_context_push(). +func (context *MarkupParseContext) Pop() unsafe.Pointer { + var _arg0 *C.GMarkupParseContext // out + var _cret C.gpointer // in + + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + + _cret = C.g_markup_parse_context_pop(_arg0) + runtime.KeepAlive(context) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// Push: temporarily redirects markup data to a sub-parser. +// +// This function may only be called from the start_element handler of a Parser. +// It must be matched with a corresponding call to g_markup_parse_context_pop() +// in the matching end_element handler (except in the case that the parser +// aborts due to an error). +// +// All tags, text and other data between the matching tags is redirected to +// the subparser given by parser. user_data is used as the user_data for that +// parser. user_data is also passed to the error callback in the event that an +// error occurs. This includes errors that occur in subparsers of the subparser. +// +// The end tag matching the start tag for which this call was made is handled +// by the previous parser (which is given its own user_data) which is why +// g_markup_parse_context_pop() is provided to allow "one last access" to the +// user_data provided to this function. In the case of error, the user_data +// provided here is passed directly to the error callback of the subparser +// and g_markup_parse_context_pop() should not be called. In either case, +// if user_data was allocated then it ought to be freed from both of these +// locations. +// +// This function is not intended to be directly called by users interested in +// invoking subparsers. Instead, it is intended to be used by the subparsers +// themselves to implement a higher-level interface. +// +// As an example, see the following implementation of a simple parser that +// counts the number of tags encountered. +// +// static void start_element (context, element_name, ...) +// { +// if (strcmp (element_name, "count-these") == 0) +// start_counting (context); +// +// // else, handle other tags... +// } +// +// static void end_element (context, element_name, ...) +// { +// if (strcmp (element_name, "count-these") == 0) +// g_print ("Counted d tags\n", end_counting (context)); +// +// // else, handle other tags... +// }. +// +// The function takes the following parameters: +// +// - parser: Parser. +// - userData (optional): user data to pass to Parser functions. +func (context *MarkupParseContext) Push(parser *MarkupParser, userData unsafe.Pointer) { + var _arg0 *C.GMarkupParseContext // out + var _arg1 *C.GMarkupParser // out + var _arg2 C.gpointer // out + + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + _arg1 = (*C.GMarkupParser)(gextras.StructNative(unsafe.Pointer(parser))) + _arg2 = (C.gpointer)(unsafe.Pointer(userData)) + + C.g_markup_parse_context_push(_arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(parser) + runtime.KeepAlive(userData) +} + +// MarkupParser: any of the fields in Parser can be NULL, in which case they +// will be ignored. Except for the error function, any of these callbacks +// can set an error; in particular the G_MARKUP_ERROR_UNKNOWN_ELEMENT, +// G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, and G_MARKUP_ERROR_INVALID_CONTENT errors +// are intended to be set from these callbacks. If you set an error from a +// callback, g_markup_parse_context_parse() will report that error back to its +// caller. +// +// An instance of this type is always passed by reference. +type MarkupParser struct { + *markupParser +} + +// markupParser is the struct that's finalized. +type markupParser struct { + native *C.GMarkupParser +} + +// MatchInfo is an opaque struct used to return information about matches. +// +// An instance of this type is always passed by reference. +type MatchInfo struct { + *matchInfo +} + +// matchInfo is the struct that's finalized. +type matchInfo struct { + native *C.GMatchInfo +} + +func marshalMatchInfo(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &MatchInfo{&matchInfo{(*C.GMatchInfo)(b)}}, nil +} + +// ExpandReferences returns a new string containing the text in string_to_expand +// with references and escape sequences expanded. References refer to the +// last match done with string against regex and have the same syntax used by +// g_regex_replace(). +// +// The string_to_expand must be UTF-8 encoded even if G_REGEX_RAW was passed to +// g_regex_new(). +// +// The backreferences are extracted from the string passed to the match +// function, so you cannot call this function after freeing the string. +// +// match_info may be NULL in which case string_to_expand must not contain +// references. For instance "foo\n" does not refer to an actual pattern and '\n' +// merely will be replaced with \n character, while to expand "\0" (whole match) +// one needs the result of a match. Use g_regex_check_replacement() to find out +// whether string_to_expand contains references. +// +// The function takes the following parameters: +// +// - stringToExpand: string to expand. +// +// The function returns the following values: +// +// - utf8 (optional): expanded string, or NULL if an error occurred. +func (matchInfo *MatchInfo) ExpandReferences(stringToExpand string) (string, error) { + var _arg0 *C.GMatchInfo // out + var _arg1 *C.gchar // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + if matchInfo != nil { + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(stringToExpand))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_match_info_expand_references(_arg0, _arg1, &_cerr) + runtime.KeepAlive(matchInfo) + runtime.KeepAlive(stringToExpand) + + var _utf8 string // out + var _goerr error // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// Fetch retrieves the text matching the match_num'th capturing parentheses. +// 0 is the full text of the match, 1 is the first paren set, 2 the second, +// and so on. +// +// If match_num is a valid sub pattern but it didn't match anything (e.g. sub +// pattern 1, matching "b" against "(a)?b") then an empty string is returned. +// +// If the match was obtained using the DFA algorithm, that is using +// g_regex_match_all() or g_regex_match_all_full(), the retrieved string is not +// that of a set of parentheses but that of a matched substring. Substrings are +// matched in reverse order of length, so 0 is the longest match. +// +// The string is fetched from the string passed to the match function, so you +// cannot call this function after freeing the string. +// +// The function takes the following parameters: +// +// - matchNum: number of the sub expression. +// +// The function returns the following values: +// +// - utf8 (optional): matched substring, or NULL if an error occurred. +// You have to free the string yourself. +func (matchInfo *MatchInfo) Fetch(matchNum int) string { + var _arg0 *C.GMatchInfo // out + var _arg1 C.gint // out + var _cret *C.gchar // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + _arg1 = C.gint(matchNum) + + _cret = C.g_match_info_fetch(_arg0, _arg1) + runtime.KeepAlive(matchInfo) + runtime.KeepAlive(matchNum) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// FetchAll bundles up pointers to each of the matching substrings from a match +// and stores them in an array of gchar pointers. The first element in the +// returned array is the match number 0, i.e. the entire matched text. +// +// If a sub pattern didn't match anything (e.g. sub pattern 1, matching "b" +// against "(a)?b") then an empty string is inserted. +// +// If the last match was obtained using the DFA algorithm, that is using +// g_regex_match_all() or g_regex_match_all_full(), the retrieved strings are +// not that matched by sets of parentheses but that of the matched substring. +// Substrings are matched in reverse order of length, so the first one is the +// longest match. +// +// The strings are fetched from the string passed to the match function, +// so you cannot call this function after freeing the string. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of gchar * pointers. It must be freed using +// g_strfreev(). If the previous match failed NULL is returned. +func (matchInfo *MatchInfo) FetchAll() []string { + var _arg0 *C.GMatchInfo // out + var _cret **C.gchar // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + + _cret = C.g_match_info_fetch_all(_arg0) + runtime.KeepAlive(matchInfo) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// FetchNamed retrieves the text matching the capturing parentheses named name. +// +// If name is a valid sub pattern name but it didn't match anything (e.g. +// sub pattern "X", matching "b" against "(?Pa)?b") then an empty string is +// returned. +// +// The string is fetched from the string passed to the match function, so you +// cannot call this function after freeing the string. +// +// The function takes the following parameters: +// +// - name of the subexpression. +// +// The function returns the following values: +// +// - utf8 (optional): matched substring, or NULL if an error occurred. +// You have to free the string yourself. +func (matchInfo *MatchInfo) FetchNamed(name string) string { + var _arg0 *C.GMatchInfo // out + var _arg1 *C.gchar // out + var _cret *C.gchar // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_match_info_fetch_named(_arg0, _arg1) + runtime.KeepAlive(matchInfo) + runtime.KeepAlive(name) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// FetchNamedPos retrieves the position in bytes of the capturing parentheses +// named name. +// +// If name is a valid sub pattern name but it didn't match anything (e.g. sub +// pattern "X", matching "b" against "(?Pa)?b") then start_pos and end_pos +// are set to -1 and TRUE is returned. +// +// The function takes the following parameters: +// +// - name of the subexpression. +// +// The function returns the following values: +// +// - startPos (optional): pointer to location where to store the start +// position, or NULL. +// - endPos (optional): pointer to location where to store the end position, +// or NULL. +// - ok: TRUE if the position was fetched, FALSE otherwise. If the position +// cannot be fetched, start_pos and end_pos are left unchanged. +func (matchInfo *MatchInfo) FetchNamedPos(name string) (startPos int, endPos int, ok bool) { + var _arg0 *C.GMatchInfo // out + var _arg1 *C.gchar // out + var _arg2 C.gint // in + var _arg3 C.gint // in + var _cret C.gboolean // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_match_info_fetch_named_pos(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(matchInfo) + runtime.KeepAlive(name) + + var _startPos int // out + var _endPos int // out + var _ok bool // out + + _startPos = int(_arg2) + _endPos = int(_arg3) + if _cret != 0 { + _ok = true + } + + return _startPos, _endPos, _ok +} + +// FetchPos retrieves the position in bytes of the match_num'th capturing +// parentheses. 0 is the full text of the match, 1 is the first paren set, +// 2 the second, and so on. +// +// If match_num is a valid sub pattern but it didn't match anything (e.g. +// sub pattern 1, matching "b" against "(a)?b") then start_pos and end_pos are +// set to -1 and TRUE is returned. +// +// If the match was obtained using the DFA algorithm, that is using +// g_regex_match_all() or g_regex_match_all_full(), the retrieved position is +// not that of a set of parentheses but that of a matched substring. Substrings +// are matched in reverse order of length, so 0 is the longest match. +// +// The function takes the following parameters: +// +// - matchNum: number of the sub expression. +// +// The function returns the following values: +// +// - startPos (optional): pointer to location where to store the start +// position, or NULL. +// - endPos (optional): pointer to location where to store the end position, +// or NULL. +// - ok: TRUE if the position was fetched, FALSE otherwise. If the position +// cannot be fetched, start_pos and end_pos are left unchanged. +func (matchInfo *MatchInfo) FetchPos(matchNum int) (startPos int, endPos int, ok bool) { + var _arg0 *C.GMatchInfo // out + var _arg1 C.gint // out + var _arg2 C.gint // in + var _arg3 C.gint // in + var _cret C.gboolean // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + _arg1 = C.gint(matchNum) + + _cret = C.g_match_info_fetch_pos(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(matchInfo) + runtime.KeepAlive(matchNum) + + var _startPos int // out + var _endPos int // out + var _ok bool // out + + _startPos = int(_arg2) + _endPos = int(_arg3) + if _cret != 0 { + _ok = true + } + + return _startPos, _endPos, _ok +} + +// MatchCount retrieves the number of matched substrings (including substring 0, +// that is the whole matched text), so 1 is returned if the pattern has no +// substrings in it and 0 is returned if the match failed. +// +// If the last match was obtained using the DFA algorithm, that is using +// g_regex_match_all() or g_regex_match_all_full(), the retrieved count is not +// that of the number of capturing parentheses but that of the number of matched +// substrings. +// +// The function returns the following values: +// +// - gint: number of matched substrings, or -1 if an error occurred. +func (matchInfo *MatchInfo) MatchCount() int { + var _arg0 *C.GMatchInfo // out + var _cret C.gint // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + + _cret = C.g_match_info_get_match_count(_arg0) + runtime.KeepAlive(matchInfo) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Regex returns #GRegex object used in match_info. It belongs to Glib and +// must not be freed. Use g_regex_ref() if you need to keep it after you free +// match_info object. +// +// The function returns the following values: +// +// - regex object used in match_info. +func (matchInfo *MatchInfo) Regex() *Regex { + var _arg0 *C.GMatchInfo // out + var _cret *C.GRegex // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + + _cret = C.g_match_info_get_regex(_arg0) + runtime.KeepAlive(matchInfo) + + var _regex *Regex // out + + _regex = (*Regex)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_regex_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_regex)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_regex_unref((*C.GRegex)(intern.C)) + }, + ) + + return _regex +} + +// String returns the string searched with match_info. This is the string passed +// to g_regex_match() or g_regex_replace() so you may not free it before calling +// this function. +// +// The function returns the following values: +// +// - utf8: string searched with match_info. +func (matchInfo *MatchInfo) String() string { + var _arg0 *C.GMatchInfo // out + var _cret *C.gchar // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + + _cret = C.g_match_info_get_string(_arg0) + runtime.KeepAlive(matchInfo) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// IsPartialMatch: usually if the string passed to g_regex_match*() matches +// as far as it goes, but is too short to match the entire pattern, FALSE is +// returned. There are circumstances where it might be helpful to distinguish +// this case from other cases in which there is no match. +// +// Consider, for example, an application where a human is required to +// type in data for a field with specific formatting requirements. +// An example might be a date in the form ddmmmyy, defined by the pattern +// "^\d?\d(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)\d\d$". If the +// application sees the user’s keystrokes one by one, and can check that what +// has been typed so far is potentially valid, it is able to raise an error as +// soon as a mistake is made. +// +// GRegex supports the concept of partial matching by means of the +// G_REGEX_MATCH_PARTIAL_SOFT and G_REGEX_MATCH_PARTIAL_HARD flags. When they +// are used, the return code for g_regex_match() or g_regex_match_full() is, +// as usual, TRUE for a complete match, FALSE otherwise. But, when these +// functions return FALSE, you can check if the match was partial calling +// g_match_info_is_partial_match(). +// +// The difference between G_REGEX_MATCH_PARTIAL_SOFT and +// G_REGEX_MATCH_PARTIAL_HARD is that when a partial match is encountered +// with G_REGEX_MATCH_PARTIAL_SOFT, matching continues to search for a +// possible complete match, while with G_REGEX_MATCH_PARTIAL_HARD matching +// stops at the partial match. When both G_REGEX_MATCH_PARTIAL_SOFT and +// G_REGEX_MATCH_PARTIAL_HARD are set, the latter takes precedence. +// +// There were formerly some restrictions on the pattern for partial matching. +// The restrictions no longer apply. +// +// See pcrepartial(3) for more information on partial matching. +// +// The function returns the following values: +// +// - ok: TRUE if the match was partial, FALSE otherwise. +func (matchInfo *MatchInfo) IsPartialMatch() bool { + var _arg0 *C.GMatchInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + + _cret = C.g_match_info_is_partial_match(_arg0) + runtime.KeepAlive(matchInfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Matches returns whether the previous match operation succeeded. +// +// The function returns the following values: +// +// - ok: TRUE if the previous match operation succeeded, FALSE otherwise. +func (matchInfo *MatchInfo) Matches() bool { + var _arg0 *C.GMatchInfo // out + var _cret C.gboolean // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + + _cret = C.g_match_info_matches(_arg0) + runtime.KeepAlive(matchInfo) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Next scans for the next match using the same parameters of the previous call +// to g_regex_match_full() or g_regex_match() that returned match_info. +// +// The match is done on the string passed to the match function, so you cannot +// free it before calling this function. +func (matchInfo *MatchInfo) Next() error { + var _arg0 *C.GMatchInfo // out + var _cerr *C.GError // in + + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + + C.g_match_info_next(_arg0, &_cerr) + runtime.KeepAlive(matchInfo) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Node struct represents one node in a [n-ary tree][glib-N-ary-Trees]. +// +// An instance of this type is always passed by reference. +type Node struct { + *node +} + +// node is the struct that's finalized. +type node struct { + native *C.GNode +} + +// Data contains the actual data of the node. +func (n *Node) Data() unsafe.Pointer { + valptr := &n.native.data + var _v unsafe.Pointer // out + _v = (unsafe.Pointer)(unsafe.Pointer(*valptr)) + return _v +} + +// Next points to the node's next sibling (a sibling is another #GNode with the +// same parent). +func (n *Node) Next() *Node { + valptr := &n.native.next + var _v *Node // out + _v = (*Node)(gextras.NewStructNative(unsafe.Pointer(*valptr))) + return _v +} + +// Prev points to the node's previous sibling. +func (n *Node) Prev() *Node { + valptr := &n.native.prev + var _v *Node // out + _v = (*Node)(gextras.NewStructNative(unsafe.Pointer(*valptr))) + return _v +} + +// Parent points to the parent of the #GNode, or is NULL if the #GNode is the +// root of the tree. +func (n *Node) Parent() *Node { + valptr := &n.native.parent + var _v *Node // out + _v = (*Node)(gextras.NewStructNative(unsafe.Pointer(*valptr))) + return _v +} + +// Children points to the first child of the #GNode. The other children are +// accessed by using the next pointer of each child. +func (n *Node) Children() *Node { + valptr := &n.native.children + var _v *Node // out + _v = (*Node)(gextras.NewStructNative(unsafe.Pointer(*valptr))) + return _v +} + +// ChildIndex gets the position of the first child of a #GNode which contains +// the given data. +// +// The function takes the following parameters: +// +// - data (optional) to find. +// +// The function returns the following values: +// +// - gint: index of the child of node which contains data, or -1 if the data +// is not found. +func (node *Node) ChildIndex(data unsafe.Pointer) int { + var _arg0 *C.GNode // out + var _arg1 C.gpointer // out + var _cret C.gint // in + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _arg1 = (C.gpointer)(unsafe.Pointer(data)) + + _cret = C.g_node_child_index(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(data) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// ChildPosition gets the position of a #GNode with respect to its siblings. +// child must be a child of node. The first child is numbered 0, the second 1, +// and so on. +// +// The function takes the following parameters: +// +// - child of node. +// +// The function returns the following values: +// +// - gint: position of child with respect to its siblings. +func (node *Node) ChildPosition(child *Node) int { + var _arg0 *C.GNode // out + var _arg1 *C.GNode // out + var _cret C.gint // in + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _arg1 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(child))) + + _cret = C.g_node_child_position(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(child) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Depth gets the depth of a #GNode. +// +// If node is NULL the depth is 0. The root node has a depth of 1. For the +// children of the root node the depth is 2. And so on. +// +// The function returns the following values: +// +// - guint: depth of the #GNode. +func (node *Node) Depth() uint { + var _arg0 *C.GNode // out + var _cret C.guint // in + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + + _cret = C.g_node_depth(_arg0) + runtime.KeepAlive(node) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Destroy removes root and its children from the tree, freeing any memory +// allocated. +func (root *Node) Destroy() { + var _arg0 *C.GNode // out + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(root))) + + C.g_node_destroy(_arg0) + runtime.KeepAlive(root) +} + +// IsAncestor returns TRUE if node is an ancestor of descendant. This is true if +// node is the parent of descendant, or if node is the grandparent of descendant +// etc. +// +// The function takes the following parameters: +// +// - descendant: #GNode. +// +// The function returns the following values: +// +// - ok: TRUE if node is an ancestor of descendant. +func (node *Node) IsAncestor(descendant *Node) bool { + var _arg0 *C.GNode // out + var _arg1 *C.GNode // out + var _cret C.gboolean // in + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _arg1 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(descendant))) + + _cret = C.g_node_is_ancestor(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(descendant) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// MaxHeight gets the maximum height of all branches beneath a #GNode. This is +// the maximum distance from the #GNode to all leaf nodes. +// +// If root is NULL, 0 is returned. If root has no children, 1 is returned. +// If root has children, 2 is returned. And so on. +// +// The function returns the following values: +// +// - guint: maximum height of the tree beneath root. +func (root *Node) MaxHeight() uint { + var _arg0 *C.GNode // out + var _cret C.guint // in + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(root))) + + _cret = C.g_node_max_height(_arg0) + runtime.KeepAlive(root) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// NChildren gets the number of children of a #GNode. +// +// The function returns the following values: +// +// - guint: number of children of node. +func (node *Node) NChildren() uint { + var _arg0 *C.GNode // out + var _cret C.guint // in + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + + _cret = C.g_node_n_children(_arg0) + runtime.KeepAlive(node) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// NNodes gets the number of nodes in a tree. +// +// The function takes the following parameters: +// +// - flags: which types of children are to be counted, one of G_TRAVERSE_ALL, +// G_TRAVERSE_LEAVES and G_TRAVERSE_NON_LEAVES. +// +// The function returns the following values: +// +// - guint: number of nodes in the tree. +func (root *Node) NNodes(flags TraverseFlags) uint { + var _arg0 *C.GNode // out + var _arg1 C.GTraverseFlags // out + var _cret C.guint // in + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(root))) + _arg1 = C.GTraverseFlags(flags) + + _cret = C.g_node_n_nodes(_arg0, _arg1) + runtime.KeepAlive(root) + runtime.KeepAlive(flags) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// ReverseChildren reverses the order of the children of a #GNode. (It doesn't +// change the order of the grandchildren.). +func (node *Node) ReverseChildren() { + var _arg0 *C.GNode // out + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + + C.g_node_reverse_children(_arg0) + runtime.KeepAlive(node) +} + +// Unlink unlinks a #GNode from a tree, resulting in two separate trees. +func (node *Node) Unlink() { + var _arg0 *C.GNode // out + + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + + C.g_node_unlink(_arg0) + runtime.KeepAlive(node) +} + +func NodePopAllocator() { + C.g_node_pop_allocator() +} + +// OptionEntry struct defines a single option. To have an effect, +// they must be added to a Group with g_option_context_add_main_entries() or +// g_option_group_add_entries(). +// +// An instance of this type is always passed by reference. +type OptionEntry struct { + *optionEntry +} + +// optionEntry is the struct that's finalized. +type optionEntry struct { + native *C.GOptionEntry +} + +// LongName: long name of an option can be used to specify it in a commandline +// as --long_name. Every option must have a long name. To resolve conflicts if +// multiple option groups contain the same long name, it is also possible to +// specify the option as --groupname-long_name. +func (o *OptionEntry) LongName() string { + valptr := &o.native.long_name + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// ShortName: if an option has a short name, it can be specified -short_name in +// a commandline. short_name must be a printable ASCII character different from +// '-', or zero if the option has no short name. +func (o *OptionEntry) ShortName() byte { + valptr := &o.native.short_name + var _v byte // out + _v = byte(*valptr) + return _v +} + +// Flags from Flags. +func (o *OptionEntry) Flags() int { + valptr := &o.native.flags + var _v int // out + _v = int(*valptr) + return _v +} + +// Arg: type of the option, as a Arg. +func (o *OptionEntry) Arg() OptionArg { + valptr := &o.native.arg + var _v OptionArg // out + _v = OptionArg(*valptr) + return _v +} + +// ArgData: if the arg type is G_OPTION_ARG_CALLBACK, then arg_data must +// point to a ArgFunc callback function, which will be called to handle the +// extra argument. Otherwise, arg_data is a pointer to a location to store +// the value, the required type of the location depends on the arg type: - +// G_OPTION_ARG_NONE: gboolean - G_OPTION_ARG_STRING: gchar* - G_OPTION_ARG_INT: +// gint - G_OPTION_ARG_FILENAME: gchar* - G_OPTION_ARG_STRING_ARRAY: +// gchar** - G_OPTION_ARG_FILENAME_ARRAY: gchar** - G_OPTION_ARG_DOUBLE: +// gdouble If arg type is G_OPTION_ARG_STRING or G_OPTION_ARG_FILENAME, +// the location will contain a newly allocated string if the option was given. +// That string needs to be freed by the callee using g_free(). Likewise if arg +// type is G_OPTION_ARG_STRING_ARRAY or G_OPTION_ARG_FILENAME_ARRAY, the data +// should be freed using g_strfreev(). +func (o *OptionEntry) ArgData() unsafe.Pointer { + valptr := &o.native.arg_data + var _v unsafe.Pointer // out + _v = (unsafe.Pointer)(unsafe.Pointer(*valptr)) + return _v +} + +// Description: description for the option in --help output. The +// description is translated using the translate_func of the group, see +// g_option_group_set_translation_domain(). +func (o *OptionEntry) Description() string { + valptr := &o.native.description + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// ArgDescription: placeholder to use for the extra argument parsed by the +// option in --help output. The arg_description is translated using the +// translate_func of the group, see g_option_group_set_translation_domain(). +func (o *OptionEntry) ArgDescription() string { + valptr := &o.native.arg_description + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// ShortName: if an option has a short name, it can be specified -short_name in +// a commandline. short_name must be a printable ASCII character different from +// '-', or zero if the option has no short name. +func (o *OptionEntry) SetShortName(shortName byte) { + valptr := &o.native.short_name + *valptr = C.gchar(shortName) +} + +// Flags from Flags. +func (o *OptionEntry) SetFlags(flags int) { + valptr := &o.native.flags + *valptr = C.gint(flags) +} + +// OptionGroup: GOptionGroup struct defines the options in a single group. +// The struct has only private fields and should not be directly accessed. +// +// All options in a group share the same translation function. Libraries which +// need to parse commandline options are expected to provide a function for +// getting a GOptionGroup holding their options, which the application can then +// add to its Context. +// +// An instance of this type is always passed by reference. +type OptionGroup struct { + *optionGroup +} + +// optionGroup is the struct that's finalized. +type optionGroup struct { + native *C.GOptionGroup +} + +func marshalOptionGroup(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &OptionGroup{&optionGroup{(*C.GOptionGroup)(b)}}, nil +} + +// AddEntries adds the options specified in entries to group. +// +// The function takes the following parameters: +// +// - entries: NULL-terminated array of Entrys. +func (group *OptionGroup) AddEntries(entries []OptionEntry) { + var _arg0 *C.GOptionGroup // out + var _arg1 *C.GOptionEntry // out + + _arg0 = (*C.GOptionGroup)(gextras.StructNative(unsafe.Pointer(group))) + { + _arg1 = (*C.GOptionEntry)(C.calloc(C.size_t((len(entries) + 1)), C.size_t(C.sizeof_GOptionEntry))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(entries)+1) + var zero C.GOptionEntry + out[len(entries)] = zero + for i := range entries { + out[i] = *(*C.GOptionEntry)(gextras.StructNative(unsafe.Pointer((&entries[i])))) + } + } + } + + C.g_option_group_add_entries(_arg0, _arg1) + runtime.KeepAlive(group) + runtime.KeepAlive(entries) +} + +// SetTranslationDomain: convenience function to use gettext() for translating +// user-visible strings. +// +// The function takes the following parameters: +// +// - domain to use. +func (group *OptionGroup) SetTranslationDomain(domain string) { + var _arg0 *C.GOptionGroup // out + var _arg1 *C.gchar // out + + _arg0 = (*C.GOptionGroup)(gextras.StructNative(unsafe.Pointer(group))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_option_group_set_translation_domain(_arg0, _arg1) + runtime.KeepAlive(group) + runtime.KeepAlive(domain) +} + +// PathBuf: GPathBuf is a helper type that allows you to easily build paths +// from individual elements, using the platform specific conventions for path +// separators. +// +// g_auto (GPathBuf) path; +// +// g_path_buf_init (&path); +// +// g_path_buf_push (&path, "usr"); +// g_path_buf_push (&path, "bin"); +// g_path_buf_push (&path, "echo"); +// +// g_autofree char *echo = g_path_buf_to_path (&path); +// g_assert_cmpstr (echo, ==, "/usr/bin/echo"); +// +// You can also load a full path and then operate on its components: +// +// g_auto (GPathBuf) path; +// +// g_path_buf_init_from_path (&path, "/usr/bin/echo"); +// +// g_path_buf_pop (&path); +// g_path_buf_push (&path, "sh"); +// +// g_autofree char *sh = g_path_buf_to_path (&path); +// g_assert_cmpstr (sh, ==, "/usr/bin/sh"); +// +// An instance of this type is always passed by reference. +type PathBuf struct { + *pathBuf +} + +// pathBuf is the struct that's finalized. +type pathBuf struct { + native *C.GPathBuf +} + +// Clear clears the contents of the path buffer. +// +// This function should be use to free the resources in a stack-allocated +// GPathBuf initialized using g_path_buf_init() or g_path_buf_init_from_path(). +func (buf *PathBuf) Clear() { + var _arg0 *C.GPathBuf // out + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + + C.g_path_buf_clear(_arg0) + runtime.KeepAlive(buf) +} + +// ClearToPath clears the contents of the path buffer and returns the built +// path. +// +// This function returns NULL if the GPathBuf is empty. +// +// See also: g_path_buf_to_path(). +// +// The function returns the following values: +// +// - filename (optional): built path. +func (buf *PathBuf) ClearToPath() string { + var _arg0 *C.GPathBuf // out + var _cret *C.char // in + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + + _cret = C.g_path_buf_clear_to_path(_arg0) + runtime.KeepAlive(buf) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// FreeToPath frees a GPathBuf allocated by g_path_buf_new(), and returns the +// path inside the buffer. +// +// This function returns NULL if the GPathBuf is empty. +// +// See also: g_path_buf_to_path(). +// +// The function returns the following values: +// +// - filename (optional): path. +func (buf *PathBuf) FreeToPath() string { + var _arg0 *C.GPathBuf // out + var _cret *C.char // in + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + runtime.SetFinalizer(gextras.StructIntern(unsafe.Pointer(buf)), nil) + + _cret = C.g_path_buf_free_to_path(_arg0) + runtime.KeepAlive(buf) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// Init initializes a GPathBuf instance. +// +// The function returns the following values: +// +// - pathBuf: initialized path builder. +func (buf *PathBuf) Init() *PathBuf { + var _arg0 *C.GPathBuf // out + var _cret *C.GPathBuf // in + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + + _cret = C.g_path_buf_init(_arg0) + runtime.KeepAlive(buf) + + var _pathBuf *PathBuf // out + + _pathBuf = (*PathBuf)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _pathBuf +} + +// InitFromPath initializes a GPathBuf instance with the given path. +// +// The function takes the following parameters: +// +// - path (optional): file system path. +// +// The function returns the following values: +// +// - pathBuf: initialized path builder. +func (buf *PathBuf) InitFromPath(path string) *PathBuf { + var _arg0 *C.GPathBuf // out + var _arg1 *C.char // out + var _cret *C.GPathBuf // in + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + if path != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_path_buf_init_from_path(_arg0, _arg1) + runtime.KeepAlive(buf) + runtime.KeepAlive(path) + + var _pathBuf *PathBuf // out + + _pathBuf = (*PathBuf)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _pathBuf +} + +// Pop removes the last element of the path buffer. +// +// If there is only one element in the path buffer (for example, / on Unix-like +// operating systems or the drive on Windows systems), it will not be removed +// and FALSE will be returned instead. +// +// GPathBuf buf, cmp; +// +// g_path_buf_init_from_path (&buf, "/bin/sh"); +// +// g_path_buf_pop (&buf); +// g_path_buf_init_from_path (&cmp, "/bin"); +// g_assert_true (g_path_buf_equal (&buf, &cmp)); +// g_path_buf_clear (&cmp); +// +// g_path_buf_pop (&buf); +// g_path_buf_init_from_path (&cmp, "/"); +// g_assert_true (g_path_buf_equal (&buf, &cmp)); +// g_path_buf_clear (&cmp); +// +// g_path_buf_clear (&buf);. +// +// The function returns the following values: +// +// - ok: TRUE if the buffer was modified and FALSE otherwise. +func (buf *PathBuf) Pop() bool { + var _arg0 *C.GPathBuf // out + var _cret C.gboolean // in + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + + _cret = C.g_path_buf_pop(_arg0) + runtime.KeepAlive(buf) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Push extends the given path buffer with path. +// +// If path is absolute, it replaces the current path. +// +// If path contains a directory separator, the buffer is extended by as many +// elements the path provides. +// +// On Windows, both forward slashes and backslashes are treated as directory +// separators. On other platforms, G_DIR_SEPARATOR_S is the only directory +// separator. +// +// GPathBuf buf, cmp; +// +// g_path_buf_init_from_path (&buf, "/tmp"); +// g_path_buf_push (&buf, ".X11-unix/X0"); +// g_path_buf_init_from_path (&cmp, "/tmp/.X11-unix/X0"); +// g_assert_true (g_path_buf_equal (&buf, &cmp)); +// g_path_buf_clear (&cmp); +// +// g_path_buf_push (&buf, "/etc/locale.conf"); +// g_path_buf_init_from_path (&cmp, "/etc/locale.conf"); +// g_assert_true (g_path_buf_equal (&buf, &cmp)); +// g_path_buf_clear (&cmp); +// +// g_path_buf_clear (&buf);. +// +// The function takes the following parameters: +// +// - path: path. +// +// The function returns the following values: +// +// - pathBuf: same pointer to buf, for convenience. +func (buf *PathBuf) Push(path string) *PathBuf { + var _arg0 *C.GPathBuf // out + var _arg1 *C.char // out + var _cret *C.GPathBuf // in + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_path_buf_push(_arg0, _arg1) + runtime.KeepAlive(buf) + runtime.KeepAlive(path) + + var _pathBuf *PathBuf // out + + _pathBuf = (*PathBuf)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _pathBuf +} + +// SetExtension adds an extension to the file name in the path buffer. +// +// If extension is NULL, the extension will be unset. +// +// If the path buffer does not have a file name set, this function returns FALSE +// and leaves the path buffer unmodified. +// +// The function takes the following parameters: +// +// - extension (optional): file extension. +// +// The function returns the following values: +// +// - ok: TRUE if the extension was replaced, and FALSE otherwise. +func (buf *PathBuf) SetExtension(extension string) bool { + var _arg0 *C.GPathBuf // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + if extension != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(extension))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_path_buf_set_extension(_arg0, _arg1) + runtime.KeepAlive(buf) + runtime.KeepAlive(extension) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetFilename sets the file name of the path. +// +// If the path buffer is empty, the filename is left unset and this function +// returns FALSE. +// +// If the path buffer only contains the root element (on Unix-like operating +// systems) or the drive (on Windows), this is the equivalent of pushing the new +// file_name. +// +// If the path buffer contains a path, this is the equivalent of popping the +// path buffer and pushing file_name, creating a sibling of the original path. +// +// GPathBuf buf, cmp; +// +// g_path_buf_init_from_path (&buf, "/"); +// +// g_path_buf_set_filename (&buf, "bar"); +// g_path_buf_init_from_path (&cmp, "/bar"); +// g_assert_true (g_path_buf_equal (&buf, &cmp)); +// g_path_buf_clear (&cmp); +// +// g_path_buf_set_filename (&buf, "baz.txt"); +// g_path_buf_init_from_path (&cmp, "/baz.txt"); +// g_assert_true (g_path_buf_equal (&buf, &cmp); +// g_path_buf_clear (&cmp); +// +// g_path_buf_clear (&buf);. +// +// The function takes the following parameters: +// +// - fileName: file name in the path. +// +// The function returns the following values: +// +// - ok: TRUE if the file name was replaced, and FALSE otherwise. +func (buf *PathBuf) SetFilename(fileName string) bool { + var _arg0 *C.GPathBuf // out + var _arg1 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(fileName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_path_buf_set_filename(_arg0, _arg1) + runtime.KeepAlive(buf) + runtime.KeepAlive(fileName) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ToPath retrieves the built path from the path buffer. +// +// On Windows, the result contains backslashes as directory separators, even if +// forward slashes were used in input. +// +// If the path buffer is empty, this function returns NULL. +// +// The function returns the following values: +// +// - filename (optional): path. +func (buf *PathBuf) ToPath() string { + var _arg0 *C.GPathBuf // out + var _cret *C.char // in + + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + + _cret = C.g_path_buf_to_path(_arg0) + runtime.KeepAlive(buf) + + var _filename string // out + + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _filename +} + +// PathBufEqual compares two path buffers for equality and returns TRUE if they +// are equal. +// +// The path inside the paths buffers are not going to be normalized, +// so X/Y/Z/A/.., X/./Y/Z and X/Y/Z are not going to be considered equal. +// +// This function can be passed to g_hash_table_new() as the key_equal_func +// parameter. +// +// The function takes the following parameters: +// +// - v1: path buffer to compare. +// - v2: path buffer to compare. +// +// The function returns the following values: +// +// - ok: TRUE if the two path buffers are equal, and FALSE otherwise. +func PathBufEqual(v1, v2 unsafe.Pointer) bool { + var _arg1 C.gconstpointer // out + var _arg2 C.gconstpointer // out + var _cret C.gboolean // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(v1)) + _arg2 = (C.gconstpointer)(unsafe.Pointer(v2)) + + _cret = C.g_path_buf_equal(_arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PatternSpec: GPatternSpec struct is the 'compiled' form of a glob-style +// pattern. +// +// The glib.PatternMatchSimple() and glib.PatternSpec.Match() functions match +// a string against a pattern containing '*' and '?' wildcards with similar +// semantics as the standard glob() function: '*' matches an arbitrary, possibly +// empty, string, '?' matches an arbitrary character. +// +// Note that in contrast to glob(), the '/' character can be matched by the +// wildcards, there are no '[...]' character ranges and '*' and '?' can not be +// escaped to include them literally in a pattern. +// +// When multiple strings must be matched against the same pattern, it is better +// to compile the pattern to a glib.PatternSpec using glib.PatternSpec.New and +// use glib.PatternSpec.MatchString() instead of glib.PatternMatchSimple(). +// This avoids the overhead of repeated pattern compilation. +// +// An instance of this type is always passed by reference. +type PatternSpec struct { + *patternSpec +} + +// patternSpec is the struct that's finalized. +type patternSpec struct { + native *C.GPatternSpec +} + +func marshalPatternSpec(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &PatternSpec{&patternSpec{(*C.GPatternSpec)(b)}}, nil +} + +// NewPatternSpec constructs a struct PatternSpec. +func NewPatternSpec(pattern string) *PatternSpec { + var _arg1 *C.gchar // out + var _cret *C.GPatternSpec // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(pattern))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_pattern_spec_new(_arg1) + runtime.KeepAlive(pattern) + + var _patternSpec *PatternSpec // out + + _patternSpec = (*PatternSpec)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_patternSpec)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_pattern_spec_free((*C.GPatternSpec)(intern.C)) + }, + ) + + return _patternSpec +} + +// Copy copies pspec in a new Spec. +// +// The function returns the following values: +// +// - patternSpec: copy of pspec. +func (pspec *PatternSpec) Copy() *PatternSpec { + var _arg0 *C.GPatternSpec // out + var _cret *C.GPatternSpec // in + + _arg0 = (*C.GPatternSpec)(gextras.StructNative(unsafe.Pointer(pspec))) + + _cret = C.g_pattern_spec_copy(_arg0) + runtime.KeepAlive(pspec) + + var _patternSpec *PatternSpec // out + + _patternSpec = (*PatternSpec)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_patternSpec)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_pattern_spec_free((*C.GPatternSpec)(intern.C)) + }, + ) + + return _patternSpec +} + +// Equal compares two compiled pattern specs and returns whether they will match +// the same set of strings. +// +// The function takes the following parameters: +// +// - pspec2: another Spec. +// +// The function returns the following values: +// +// - ok: whether the compiled patterns are equal. +func (pspec1 *PatternSpec) Equal(pspec2 *PatternSpec) bool { + var _arg0 *C.GPatternSpec // out + var _arg1 *C.GPatternSpec // out + var _cret C.gboolean // in + + _arg0 = (*C.GPatternSpec)(gextras.StructNative(unsafe.Pointer(pspec1))) + _arg1 = (*C.GPatternSpec)(gextras.StructNative(unsafe.Pointer(pspec2))) + + _cret = C.g_pattern_spec_equal(_arg0, _arg1) + runtime.KeepAlive(pspec1) + runtime.KeepAlive(pspec2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Match matches a string against a compiled pattern. Passing the correct length +// of the string given is mandatory. The reversed string can be omitted by +// passing NULL, this is more efficient if the reversed version of the string to +// be matched is not at hand, as g_pattern_match() will only construct it if the +// compiled pattern requires reverse matches. +// +// Note that, if the user code will (possibly) match a string against a +// multitude of patterns containing wildcards, chances are high that some +// patterns will require a reversed string. In this case, it's more efficient +// to provide the reversed string to avoid multiple constructions thereof in the +// various calls to g_pattern_match(). +// +// Note also that the reverse of a UTF-8 encoded string can in general not be +// obtained by g_strreverse(). This works only if the string does not contain +// any multibyte characters. GLib offers the g_utf8_strreverse() function to +// reverse UTF-8 encoded strings. +// +// The function takes the following parameters: +// +// - stringLength: length of string (in bytes, i.e. strlen(), not +// g_utf8_strlen()). +// - str: UTF-8 encoded string to match. +// - stringReversed (optional): reverse of string or NULL. +// +// The function returns the following values: +// +// - ok: TRUE if string matches pspec. +func (pspec *PatternSpec) Match(stringLength uint, str string, stringReversed string) bool { + var _arg0 *C.GPatternSpec // out + var _arg1 C.gsize // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GPatternSpec)(gextras.StructNative(unsafe.Pointer(pspec))) + _arg1 = C.gsize(stringLength) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg2)) + if stringReversed != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(stringReversed))) + defer C.free(unsafe.Pointer(_arg3)) + } + + _cret = C.g_pattern_spec_match(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(pspec) + runtime.KeepAlive(stringLength) + runtime.KeepAlive(str) + runtime.KeepAlive(stringReversed) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// MatchString matches a string against a compiled pattern. If the string is to +// be matched against more than one pattern, consider using g_pattern_match() +// instead while supplying the reversed string. +// +// The function takes the following parameters: +// +// - str: UTF-8 encoded string to match. +// +// The function returns the following values: +// +// - ok: TRUE if string matches pspec. +func (pspec *PatternSpec) MatchString(str string) bool { + var _arg0 *C.GPatternSpec // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GPatternSpec)(gextras.StructNative(unsafe.Pointer(pspec))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_pattern_spec_match_string(_arg0, _arg1) + runtime.KeepAlive(pspec) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PtrArray contains the public fields of a pointer array. +// +// An instance of this type is always passed by reference. +type PtrArray struct { + *ptrArray +} + +// ptrArray is the struct that's finalized. +type ptrArray struct { + native *C.GPtrArray +} + +// Pdata points to the array of pointers, which may be moved when the array +// grows. +func (p *PtrArray) Pdata() *unsafe.Pointer { + valptr := &p.native.pdata + var _v *unsafe.Pointer // out + _v = (*unsafe.Pointer)(unsafe.Pointer(*valptr)) + return _v +} + +// Len: number of pointers in the array. +func (p *PtrArray) Len() uint { + valptr := &p.native.len + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Len: number of pointers in the array. +func (p *PtrArray) SetLen(len uint) { + valptr := &p.native.len + *valptr = C.guint(len) +} + +// Queue contains the public fields of a [Queue][glib-Double-ended-Queues]. +// +// An instance of this type is always passed by reference. +type Queue struct { + *queue +} + +// queue is the struct that's finalized. +type queue struct { + native *C.GQueue +} + +// Clear removes all the elements in queue. If queue elements contain +// dynamically-allocated memory, they should be freed first. +func (queue *Queue) Clear() { + var _arg0 *C.GQueue // out + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + + C.g_queue_clear(_arg0) + runtime.KeepAlive(queue) +} + +// ForEach calls func for each element in the queue passing user_data to the +// function. +// +// It is safe for func to remove the element from queue, but it must not modify +// any part of the queue after that element. +// +// The function takes the following parameters: +// +// - fn: function to call for each element's data. +func (queue *Queue) ForEach(fn Func) { + var _arg0 *C.GQueue // out + var _arg1 C.GFunc // out + var _arg2 C.gpointer + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = (*[0]byte)(C._gotk4_glib2_Func) + _arg2 = C.gpointer(gbox.Assign(fn)) + defer gbox.Delete(uintptr(_arg2)) + + C.g_queue_foreach(_arg0, _arg1, _arg2) + runtime.KeepAlive(queue) + runtime.KeepAlive(fn) +} + +// Length returns the number of items in queue. +// +// The function returns the following values: +// +// - guint: number of items in queue. +func (queue *Queue) Length() uint { + var _arg0 *C.GQueue // out + var _cret C.guint // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + + _cret = C.g_queue_get_length(_arg0) + runtime.KeepAlive(queue) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Index returns the position of the first element in queue which contains data. +// +// The function takes the following parameters: +// +// - data (optional) to find. +// +// The function returns the following values: +// +// - gint: position of the first element in queue which contains data, +// or -1 if no element in queue contains data. +func (queue *Queue) Index(data unsafe.Pointer) int { + var _arg0 *C.GQueue // out + var _arg1 C.gconstpointer // out + var _cret C.gint // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = (C.gconstpointer)(unsafe.Pointer(data)) + + _cret = C.g_queue_index(_arg0, _arg1) + runtime.KeepAlive(queue) + runtime.KeepAlive(data) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Init: statically-allocated #GQueue must be initialized with this function +// before it can be used. Alternatively you can initialize it with G_QUEUE_INIT. +// It is not necessary to initialize queues created with g_queue_new(). +func (queue *Queue) Init() { + var _arg0 *C.GQueue // out + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + + C.g_queue_init(_arg0) + runtime.KeepAlive(queue) +} + +// InsertSorted inserts data into queue using func to determine the new +// position. +// +// The function takes the following parameters: +// +// - data (optional) to insert. +// - fn used to compare elements in the queue. It is called with two elements +// of the queue and user_data. It should return 0 if the elements are equal, +// a negative value if the first element comes before the second, and a +// positive value if the second element comes before the first. +func (queue *Queue) InsertSorted(data unsafe.Pointer, fn CompareDataFunc) { + var _arg0 *C.GQueue // out + var _arg1 C.gpointer // out + var _arg2 C.GCompareDataFunc // out + var _arg3 C.gpointer + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = (C.gpointer)(unsafe.Pointer(data)) + _arg2 = (*[0]byte)(C._gotk4_glib2_CompareDataFunc) + _arg3 = C.gpointer(gbox.Assign(fn)) + defer gbox.Delete(uintptr(_arg3)) + + C.g_queue_insert_sorted(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(queue) + runtime.KeepAlive(data) + runtime.KeepAlive(fn) +} + +// IsEmpty returns TRUE if the queue is empty. +// +// The function returns the following values: +// +// - ok: TRUE if the queue is empty. +func (queue *Queue) IsEmpty() bool { + var _arg0 *C.GQueue // out + var _cret C.gboolean // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + + _cret = C.g_queue_is_empty(_arg0) + runtime.KeepAlive(queue) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PeekHead returns the first element of the queue. +// +// The function returns the following values: +// +// - gpointer (optional): data of the first element in the queue, or NULL if +// the queue is empty. +func (queue *Queue) PeekHead() unsafe.Pointer { + var _arg0 *C.GQueue // out + var _cret C.gpointer // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + + _cret = C.g_queue_peek_head(_arg0) + runtime.KeepAlive(queue) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// PeekNth returns the n'th element of queue. +// +// The function takes the following parameters: +// +// - n of the element. +// +// The function returns the following values: +// +// - gpointer (optional): data for the n'th element of queue, or NULL if n is +// off the end of queue. +func (queue *Queue) PeekNth(n uint) unsafe.Pointer { + var _arg0 *C.GQueue // out + var _arg1 C.guint // out + var _cret C.gpointer // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = C.guint(n) + + _cret = C.g_queue_peek_nth(_arg0, _arg1) + runtime.KeepAlive(queue) + runtime.KeepAlive(n) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// PeekTail returns the last element of the queue. +// +// The function returns the following values: +// +// - gpointer (optional): data of the last element in the queue, or NULL if +// the queue is empty. +func (queue *Queue) PeekTail() unsafe.Pointer { + var _arg0 *C.GQueue // out + var _cret C.gpointer // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + + _cret = C.g_queue_peek_tail(_arg0) + runtime.KeepAlive(queue) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// PopHead removes the first element of the queue and returns its data. +// +// The function returns the following values: +// +// - gpointer (optional): data of the first element in the queue, or NULL if +// the queue is empty. +func (queue *Queue) PopHead() unsafe.Pointer { + var _arg0 *C.GQueue // out + var _cret C.gpointer // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + + _cret = C.g_queue_pop_head(_arg0) + runtime.KeepAlive(queue) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// PopNth removes the n'th element of queue and returns its data. +// +// The function takes the following parameters: +// +// - n of the element. +// +// The function returns the following values: +// +// - gpointer (optional) element's data, or NULL if n is off the end of queue. +func (queue *Queue) PopNth(n uint) unsafe.Pointer { + var _arg0 *C.GQueue // out + var _arg1 C.guint // out + var _cret C.gpointer // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = C.guint(n) + + _cret = C.g_queue_pop_nth(_arg0, _arg1) + runtime.KeepAlive(queue) + runtime.KeepAlive(n) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// PopTail removes the last element of the queue and returns its data. +// +// The function returns the following values: +// +// - gpointer (optional): data of the last element in the queue, or NULL if +// the queue is empty. +func (queue *Queue) PopTail() unsafe.Pointer { + var _arg0 *C.GQueue // out + var _cret C.gpointer // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + + _cret = C.g_queue_pop_tail(_arg0) + runtime.KeepAlive(queue) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// PushHead adds a new element at the head of the queue. +// +// The function takes the following parameters: +// +// - data (optional) for the new element. +func (queue *Queue) PushHead(data unsafe.Pointer) { + var _arg0 *C.GQueue // out + var _arg1 C.gpointer // out + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = (C.gpointer)(unsafe.Pointer(data)) + + C.g_queue_push_head(_arg0, _arg1) + runtime.KeepAlive(queue) + runtime.KeepAlive(data) +} + +// PushNth inserts a new element into queue at the given position. +// +// The function takes the following parameters: +// +// - data (optional) for the new element. +// - n to insert the new element. If n is negative or larger than the number +// of elements in the queue, the element is added to the end of the queue. +func (queue *Queue) PushNth(data unsafe.Pointer, n int) { + var _arg0 *C.GQueue // out + var _arg1 C.gpointer // out + var _arg2 C.gint // out + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = (C.gpointer)(unsafe.Pointer(data)) + _arg2 = C.gint(n) + + C.g_queue_push_nth(_arg0, _arg1, _arg2) + runtime.KeepAlive(queue) + runtime.KeepAlive(data) + runtime.KeepAlive(n) +} + +// PushTail adds a new element at the tail of the queue. +// +// The function takes the following parameters: +// +// - data (optional) for the new element. +func (queue *Queue) PushTail(data unsafe.Pointer) { + var _arg0 *C.GQueue // out + var _arg1 C.gpointer // out + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = (C.gpointer)(unsafe.Pointer(data)) + + C.g_queue_push_tail(_arg0, _arg1) + runtime.KeepAlive(queue) + runtime.KeepAlive(data) +} + +// Remove removes the first element in queue that contains data. +// +// The function takes the following parameters: +// +// - data (optional) to remove. +// +// The function returns the following values: +// +// - ok: TRUE if data was found and removed from queue. +func (queue *Queue) Remove(data unsafe.Pointer) bool { + var _arg0 *C.GQueue // out + var _arg1 C.gconstpointer // out + var _cret C.gboolean // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = (C.gconstpointer)(unsafe.Pointer(data)) + + _cret = C.g_queue_remove(_arg0, _arg1) + runtime.KeepAlive(queue) + runtime.KeepAlive(data) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RemoveAll: remove all elements whose data equals data from queue. +// +// The function takes the following parameters: +// +// - data (optional) to remove. +// +// The function returns the following values: +// +// - guint: number of elements removed from queue. +func (queue *Queue) RemoveAll(data unsafe.Pointer) uint { + var _arg0 *C.GQueue // out + var _arg1 C.gconstpointer // out + var _cret C.guint // in + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = (C.gconstpointer)(unsafe.Pointer(data)) + + _cret = C.g_queue_remove_all(_arg0, _arg1) + runtime.KeepAlive(queue) + runtime.KeepAlive(data) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Reverse reverses the order of the items in queue. +func (queue *Queue) Reverse() { + var _arg0 *C.GQueue // out + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + + C.g_queue_reverse(_arg0) + runtime.KeepAlive(queue) +} + +// Sort sorts queue using compare_func. +// +// The function takes the following parameters: +// +// - compareFunc used to sort queue. This function is passed two elements of +// the queue and should return 0 if they are equal, a negative value if the +// first comes before the second, and a positive value if the second comes +// before the first. +func (queue *Queue) Sort(compareFunc CompareDataFunc) { + var _arg0 *C.GQueue // out + var _arg1 C.GCompareDataFunc // out + var _arg2 C.gpointer + + _arg0 = (*C.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg1 = (*[0]byte)(C._gotk4_glib2_CompareDataFunc) + _arg2 = C.gpointer(gbox.Assign(compareFunc)) + defer gbox.Delete(uintptr(_arg2)) + + C.g_queue_sort(_arg0, _arg1, _arg2) + runtime.KeepAlive(queue) + runtime.KeepAlive(compareFunc) +} + +// Rand struct is an opaque data structure. It should only be accessed through +// the g_rand_* functions. +// +// An instance of this type is always passed by reference. +type Rand struct { + *rand +} + +// rand is the struct that's finalized. +type rand struct { + native *C.GRand +} + +func marshalRand(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Rand{&rand{(*C.GRand)(b)}}, nil +} + +// NewRand constructs a struct Rand. +func NewRand() *Rand { + var _cret *C.GRand // in + + _cret = C.g_rand_new() + + var _rand *Rand // out + + _rand = (*Rand)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_rand)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_rand_free((*C.GRand)(intern.C)) + }, + ) + + return _rand +} + +// NewRandWithSeed constructs a struct Rand. +func NewRandWithSeed(seed uint32) *Rand { + var _arg1 C.guint32 // out + var _cret *C.GRand // in + + _arg1 = C.guint32(seed) + + _cret = C.g_rand_new_with_seed(_arg1) + runtime.KeepAlive(seed) + + var _rand *Rand // out + + _rand = (*Rand)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_rand)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_rand_free((*C.GRand)(intern.C)) + }, + ) + + return _rand +} + +// NewRandWithSeedArray constructs a struct Rand. +func NewRandWithSeedArray(seed *uint32, seedLength uint) *Rand { + var _arg1 *C.guint32 // out + var _arg2 C.guint // out + var _cret *C.GRand // in + + _arg1 = (*C.guint32)(unsafe.Pointer(seed)) + _arg2 = C.guint(seedLength) + + _cret = C.g_rand_new_with_seed_array(_arg1, _arg2) + runtime.KeepAlive(seed) + runtime.KeepAlive(seedLength) + + var _rand *Rand // out + + _rand = (*Rand)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_rand)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_rand_free((*C.GRand)(intern.C)) + }, + ) + + return _rand +} + +// Copy copies a #GRand into a new one with the same exact state as before. +// This way you can take a snapshot of the random number generator for replaying +// later. +// +// The function returns the following values: +// +// - rand: new #GRand. +func (rand_ *Rand) Copy() *Rand { + var _arg0 *C.GRand // out + var _cret *C.GRand // in + + _arg0 = (*C.GRand)(gextras.StructNative(unsafe.Pointer(rand_))) + + _cret = C.g_rand_copy(_arg0) + runtime.KeepAlive(rand_) + + var _rand *Rand // out + + _rand = (*Rand)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_rand)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_rand_free((*C.GRand)(intern.C)) + }, + ) + + return _rand +} + +// Double returns the next random #gdouble from rand_ equally distributed over +// the range [0..1). +// +// The function returns the following values: +// +// - gdouble: random number. +func (rand_ *Rand) Double() float64 { + var _arg0 *C.GRand // out + var _cret C.gdouble // in + + _arg0 = (*C.GRand)(gextras.StructNative(unsafe.Pointer(rand_))) + + _cret = C.g_rand_double(_arg0) + runtime.KeepAlive(rand_) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// DoubleRange returns the next random #gdouble from rand_ equally distributed +// over the range [begin..end). +// +// The function takes the following parameters: +// +// - begin: lower closed bound of the interval. +// - end: upper open bound of the interval. +// +// The function returns the following values: +// +// - gdouble: random number. +func (rand_ *Rand) DoubleRange(begin float64, end float64) float64 { + var _arg0 *C.GRand // out + var _arg1 C.gdouble // out + var _arg2 C.gdouble // out + var _cret C.gdouble // in + + _arg0 = (*C.GRand)(gextras.StructNative(unsafe.Pointer(rand_))) + _arg1 = C.gdouble(begin) + _arg2 = C.gdouble(end) + + _cret = C.g_rand_double_range(_arg0, _arg1, _arg2) + runtime.KeepAlive(rand_) + runtime.KeepAlive(begin) + runtime.KeepAlive(end) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// Int returns the next random #guint32 from rand_ equally distributed over the +// range [0..2^32-1]. +// +// The function returns the following values: +// +// - guint32: random number. +func (rand_ *Rand) Int() uint32 { + var _arg0 *C.GRand // out + var _cret C.guint32 // in + + _arg0 = (*C.GRand)(gextras.StructNative(unsafe.Pointer(rand_))) + + _cret = C.g_rand_int(_arg0) + runtime.KeepAlive(rand_) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// IntRange returns the next random #gint32 from rand_ equally distributed over +// the range [begin..end-1]. +// +// The function takes the following parameters: +// +// - begin: lower closed bound of the interval. +// - end: upper open bound of the interval. +// +// The function returns the following values: +// +// - gint32: random number. +func (rand_ *Rand) IntRange(begin int32, end int32) int32 { + var _arg0 *C.GRand // out + var _arg1 C.gint32 // out + var _arg2 C.gint32 // out + var _cret C.gint32 // in + + _arg0 = (*C.GRand)(gextras.StructNative(unsafe.Pointer(rand_))) + _arg1 = C.gint32(begin) + _arg2 = C.gint32(end) + + _cret = C.g_rand_int_range(_arg0, _arg1, _arg2) + runtime.KeepAlive(rand_) + runtime.KeepAlive(begin) + runtime.KeepAlive(end) + + var _gint32 int32 // out + + _gint32 = int32(_cret) + + return _gint32 +} + +// SetSeed sets the seed for the random number generator #GRand to seed. +// +// The function takes the following parameters: +// +// - seed: value to reinitialize the random number generator. +func (rand_ *Rand) SetSeed(seed uint32) { + var _arg0 *C.GRand // out + var _arg1 C.guint32 // out + + _arg0 = (*C.GRand)(gextras.StructNative(unsafe.Pointer(rand_))) + _arg1 = C.guint32(seed) + + C.g_rand_set_seed(_arg0, _arg1) + runtime.KeepAlive(rand_) + runtime.KeepAlive(seed) +} + +// SetSeedArray initializes the random number generator by an array of longs. +// Array can be of arbitrary size, though only the first 624 values are taken. +// This function is useful if you have many low entropy seeds, or if you require +// more then 32 bits of actual entropy for your application. +// +// The function takes the following parameters: +// +// - seed: array to initialize with. +// - seedLength: length of array. +func (rand_ *Rand) SetSeedArray(seed *uint32, seedLength uint) { + var _arg0 *C.GRand // out + var _arg1 *C.guint32 // out + var _arg2 C.guint // out + + _arg0 = (*C.GRand)(gextras.StructNative(unsafe.Pointer(rand_))) + _arg1 = (*C.guint32)(unsafe.Pointer(seed)) + _arg2 = C.guint(seedLength) + + C.g_rand_set_seed_array(_arg0, _arg1, _arg2) + runtime.KeepAlive(rand_) + runtime.KeepAlive(seed) + runtime.KeepAlive(seedLength) +} + +// Regex: GRegex is the "compiled" form of a regular expression pattern. +// +// GRegex implements regular expression pattern matching using syntax and +// semantics similar to Perl regular expression. See the PCRE documentation +// (man:pcrepattern(3)) for the syntax definition. +// +// Some functions accept a start_position argument, setting it differs from just +// passing over a shortened string and setting G_REGEX_MATCH_NOTBOL in the case +// of a pattern that begins with any kind of lookbehind assertion. For example, +// consider the pattern "\Biss\B" which finds occurrences of "iss" in the middle +// of words. ("\B" matches only if the current position in the subject is not a +// word boundary.) When applied to the string "Mississipi" from the fourth byte, +// namely "issipi", it does not match, because "\B" is always false at the start +// of the subject, which is deemed to be a word boundary. However, if the entire +// string is passed , but with start_position set to 4, it finds the second +// occurrence of "iss" because it is able to look behind the starting point to +// discover that it is preceded by a letter. +// +// Note that, unless you set the G_REGEX_RAW flag, all the strings passed to +// these functions must be encoded in UTF-8. The lengths and the positions +// inside the strings are in bytes and not in characters, so, for instance, +// "\xc3\xa0" (i.e. "à") is two bytes long but it is treated as a single +// character. If you set G_REGEX_RAW the strings can be non-valid UTF-8 strings +// and a byte is treated as a character, so "\xc3\xa0" is two bytes and two +// characters long. +// +// When matching a pattern, "\n" matches only against a "\n" character in the +// string, and "\r" matches only a "\r" character. To match any newline sequence +// use "\R". This particular group matches either the two-character sequence CR +// + LF ("\r\n"), or one of the single characters LF (linefeed, U+000A, "\n"), +// VT vertical tab, U+000B, "\v"), FF (formfeed, U+000C, "\f"), CR (carriage +// return, U+000D, "\r"), NEL (next line, U+0085), LS (line separator, U+2028), +// or PS (paragraph separator, U+2029). +// +// The behaviour of the dot, circumflex, and dollar metacharacters are +// affected by newline characters, the default is to recognize any newline +// character (the same characters recognized by "\R"). This can be changed +// with G_REGEX_NEWLINE_CR, G_REGEX_NEWLINE_LF and G_REGEX_NEWLINE_CRLF compile +// options, and with G_REGEX_MATCH_NEWLINE_ANY, G_REGEX_MATCH_NEWLINE_CR, +// G_REGEX_MATCH_NEWLINE_LF and G_REGEX_MATCH_NEWLINE_CRLF match options. +// These settings are also relevant when compiling a pattern if G_REGEX_EXTENDED +// is set, and an unescaped "#" outside a character class is encountered. +// This indicates a comment that lasts until after the next newline. +// +// Creating and manipulating the same GRegex structure from different threads is +// not a problem as GRegex does not modify its internal state between creation +// and destruction, on the other hand GMatchInfo is not threadsafe. +// +// The regular expressions low-level functionalities are obtained through the +// excellent PCRE (http://www.pcre.org/) library written by Philip Hazel. +// +// An instance of this type is always passed by reference. +type Regex struct { + *regex +} + +// regex is the struct that's finalized. +type regex struct { + native *C.GRegex +} + +func marshalRegex(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Regex{®ex{(*C.GRegex)(b)}}, nil +} + +// NewRegex constructs a struct Regex. +func NewRegex(pattern string, compileOptions RegexCompileFlags, matchOptions RegexMatchFlags) (*Regex, error) { + var _arg1 *C.gchar // out + var _arg2 C.GRegexCompileFlags // out + var _arg3 C.GRegexMatchFlags // out + var _cret *C.GRegex // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(pattern))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GRegexCompileFlags(compileOptions) + _arg3 = C.GRegexMatchFlags(matchOptions) + + _cret = C.g_regex_new(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(pattern) + runtime.KeepAlive(compileOptions) + runtime.KeepAlive(matchOptions) + + var _regex *Regex // out + var _goerr error // out + + if _cret != nil { + _regex = (*Regex)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_regex)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_regex_unref((*C.GRegex)(intern.C)) + }, + ) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _regex, _goerr +} + +// CaptureCount returns the number of capturing subpatterns in the pattern. +// +// The function returns the following values: +// +// - gint: number of capturing subpatterns. +func (regex *Regex) CaptureCount() int { + var _arg0 *C.GRegex // out + var _cret C.gint // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + + _cret = C.g_regex_get_capture_count(_arg0) + runtime.KeepAlive(regex) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// CompileFlags returns the compile options that regex was created with. +// +// Depending on the version of PCRE that is used, this may or may not include +// flags set by option expressions such as (?i) found at the top-level within +// the compiled pattern. +// +// The function returns the following values: +// +// - regexCompileFlags flags from CompileFlags. +func (regex *Regex) CompileFlags() RegexCompileFlags { + var _arg0 *C.GRegex // out + var _cret C.GRegexCompileFlags // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + + _cret = C.g_regex_get_compile_flags(_arg0) + runtime.KeepAlive(regex) + + var _regexCompileFlags RegexCompileFlags // out + + _regexCompileFlags = RegexCompileFlags(_cret) + + return _regexCompileFlags +} + +// HasCrOrLf checks whether the pattern contains explicit CR or LF references. +// +// The function returns the following values: +// +// - ok: TRUE if the pattern contains explicit CR or LF references. +func (regex *Regex) HasCrOrLf() bool { + var _arg0 *C.GRegex // out + var _cret C.gboolean // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + + _cret = C.g_regex_get_has_cr_or_lf(_arg0) + runtime.KeepAlive(regex) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// MatchFlags returns the match options that regex was created with. +// +// The function returns the following values: +// +// - regexMatchFlags flags from MatchFlags. +func (regex *Regex) MatchFlags() RegexMatchFlags { + var _arg0 *C.GRegex // out + var _cret C.GRegexMatchFlags // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + + _cret = C.g_regex_get_match_flags(_arg0) + runtime.KeepAlive(regex) + + var _regexMatchFlags RegexMatchFlags // out + + _regexMatchFlags = RegexMatchFlags(_cret) + + return _regexMatchFlags +} + +// MaxBackref returns the number of the highest back reference in the pattern, +// or 0 if the pattern does not contain back references. +// +// The function returns the following values: +// +// - gint: number of the highest back reference. +func (regex *Regex) MaxBackref() int { + var _arg0 *C.GRegex // out + var _cret C.gint // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + + _cret = C.g_regex_get_max_backref(_arg0) + runtime.KeepAlive(regex) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// MaxLookbehind gets the number of characters in the longest lookbehind +// assertion in the pattern. This information is useful when doing multi-segment +// matching using the partial matching facilities. +// +// The function returns the following values: +// +// - gint: number of characters in the longest lookbehind assertion. +func (regex *Regex) MaxLookbehind() int { + var _arg0 *C.GRegex // out + var _cret C.gint // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + + _cret = C.g_regex_get_max_lookbehind(_arg0) + runtime.KeepAlive(regex) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Pattern gets the pattern string associated with regex, i.e. a copy of the +// string passed to g_regex_new(). +// +// The function returns the following values: +// +// - utf8: pattern of regex. +func (regex *Regex) Pattern() string { + var _arg0 *C.GRegex // out + var _cret *C.gchar // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + + _cret = C.g_regex_get_pattern(_arg0) + runtime.KeepAlive(regex) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// StringNumber retrieves the number of the subexpression named name. +// +// The function takes the following parameters: +// +// - name of the subexpression. +// +// The function returns the following values: +// +// - gint: number of the subexpression or -1 if name does not exists. +func (regex *Regex) StringNumber(name string) int { + var _arg0 *C.GRegex // out + var _arg1 *C.gchar // out + var _cret C.gint // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_regex_get_string_number(_arg0, _arg1) + runtime.KeepAlive(regex) + runtime.KeepAlive(name) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Match scans for a match in string for the pattern in regex. The match_options +// are combined with the match options specified when the regex structure was +// created, letting you have more flexibility in reusing #GRegex structures. +// +// Unless G_REGEX_RAW is specified in the options, string must be valid UTF-8. +// +// A Info structure, used to get information on the match, is stored in +// match_info if not NULL. Note that if match_info is not NULL then it is +// created even if the function returns FALSE, i.e. you must free it regardless +// if regular expression actually matched. +// +// To retrieve all the non-overlapping matches of the pattern in string you can +// use g_match_info_next(). +// +// static void +// print_uppercase_words (const gchar *string) +// { +// // Print all uppercase-only words. +// GRegex *regex; +// GMatchInfo *match_info; +// +// regex = g_regex_new ("[A-Z]+", G_REGEX_DEFAULT, G_REGEX_MATCH_DEFAULT, NULL); +// g_regex_match (regex, string, 0, &match_info); +// while (g_match_info_matches (match_info)) +// { +// gchar *word = g_match_info_fetch (match_info, 0); +// g_print ("Found: s\n", word); +// g_free (word); +// g_match_info_next (match_info, NULL); +// } +// g_match_info_free (match_info); +// g_regex_unref (regex); +// } +// +// string is not copied and is used in Info internally. If you use any Info +// method (except g_match_info_free()) after freeing or modifying string then +// the behaviour is undefined. +// +// The function takes the following parameters: +// +// - str: string to scan for matches. +// - matchOptions: match options. +// +// The function returns the following values: +// +// - matchInfo (optional): pointer to location where to store the Info, +// or NULL if you do not need it. +// - ok: TRUE is the string matched, FALSE otherwise. +func (regex *Regex) Match(str string, matchOptions RegexMatchFlags) (*MatchInfo, bool) { + var _arg0 *C.GRegex // out + var _arg1 *C.gchar // out + var _arg2 C.GRegexMatchFlags // out + var _arg3 *C.GMatchInfo // in + var _cret C.gboolean // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GRegexMatchFlags(matchOptions) + + _cret = C.g_regex_match(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(regex) + runtime.KeepAlive(str) + runtime.KeepAlive(matchOptions) + + var _matchInfo *MatchInfo // out + var _ok bool // out + + if _arg3 != nil { + _matchInfo = (*MatchInfo)(gextras.NewStructNative(unsafe.Pointer(_arg3))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_matchInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_match_info_unref((*C.GMatchInfo)(intern.C)) + }, + ) + } + if _cret != 0 { + _ok = true + } + + return _matchInfo, _ok +} + +// MatchAll: using the standard algorithm for regular expression matching only +// the longest match in the string is retrieved. This function uses a different +// algorithm so it can retrieve all the possible matches. For more documentation +// see g_regex_match_all_full(). +// +// A Info structure, used to get information on the match, is stored in +// match_info if not NULL. Note that if match_info is not NULL then it is +// created even if the function returns FALSE, i.e. you must free it regardless +// if regular expression actually matched. +// +// string is not copied and is used in Info internally. If you use any Info +// method (except g_match_info_free()) after freeing or modifying string then +// the behaviour is undefined. +// +// The function takes the following parameters: +// +// - str: string to scan for matches. +// - matchOptions: match options. +// +// The function returns the following values: +// +// - matchInfo (optional): pointer to location where to store the Info, +// or NULL if you do not need it. +// - ok: TRUE is the string matched, FALSE otherwise. +func (regex *Regex) MatchAll(str string, matchOptions RegexMatchFlags) (*MatchInfo, bool) { + var _arg0 *C.GRegex // out + var _arg1 *C.gchar // out + var _arg2 C.GRegexMatchFlags // out + var _arg3 *C.GMatchInfo // in + var _cret C.gboolean // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GRegexMatchFlags(matchOptions) + + _cret = C.g_regex_match_all(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(regex) + runtime.KeepAlive(str) + runtime.KeepAlive(matchOptions) + + var _matchInfo *MatchInfo // out + var _ok bool // out + + if _arg3 != nil { + _matchInfo = (*MatchInfo)(gextras.NewStructNative(unsafe.Pointer(_arg3))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_matchInfo)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_match_info_unref((*C.GMatchInfo)(intern.C)) + }, + ) + } + if _cret != 0 { + _ok = true + } + + return _matchInfo, _ok +} + +// Split breaks the string on the pattern, and returns an array of the tokens. +// If the pattern contains capturing parentheses, then the text for each of the +// substrings will also be returned. If the pattern does not match anywhere in +// the string, then the whole string is returned as the first token. +// +// As a special case, the result of splitting the empty string "" is an empty +// vector, not a vector containing a single string. The reason for this special +// case is that being able to represent an empty vector is typically more useful +// than consistent handling of empty elements. If you do need to represent +// empty elements, you'll need to check for the empty string before calling this +// function. +// +// A pattern that can match empty strings splits string into separate characters +// wherever it matches the empty string between characters. For example +// splitting "ab c" using as a separator "\s*", you will get "a", "b" and "c". +// +// The function takes the following parameters: +// +// - str: string to split with the pattern. +// - matchOptions: match time option flags. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated gchar ** array. Free it using g_strfreev(). +func (regex *Regex) Split(str string, matchOptions RegexMatchFlags) []string { + var _arg0 *C.GRegex // out + var _arg1 *C.gchar // out + var _arg2 C.GRegexMatchFlags // out + var _cret **C.gchar // in + + _arg0 = (*C.GRegex)(gextras.StructNative(unsafe.Pointer(regex))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GRegexMatchFlags(matchOptions) + + _cret = C.g_regex_split(_arg0, _arg1, _arg2) + runtime.KeepAlive(regex) + runtime.KeepAlive(str) + runtime.KeepAlive(matchOptions) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// RegexCheckReplacement checks whether replacement is a valid replacement +// string (see g_regex_replace()), i.e. that all escape sequences in it are +// valid. +// +// If has_references is not NULL then replacement is checked for pattern +// references. For instance, replacement text 'foo\n' does not contain +// references and may be evaluated without information about actual match, but +// '\0\1' (whole match followed by first subpattern) requires valid Info object. +// +// The function takes the following parameters: +// +// - replacement string. +// +// The function returns the following values: +// +// - hasReferences (optional): location to store information about references +// in replacement or NULL. +func RegexCheckReplacement(replacement string) (bool, error) { + var _arg1 *C.gchar // out + var _arg2 C.gboolean // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(replacement))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_regex_check_replacement(_arg1, &_arg2, &_cerr) + runtime.KeepAlive(replacement) + + var _hasReferences bool // out + var _goerr error // out + + if _arg2 != 0 { + _hasReferences = true + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _hasReferences, _goerr +} + +func RegexErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_regex_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// RegexEscapeNUL escapes the nul characters in string to "\x00". It can be used +// to compile a regex with embedded nul characters. +// +// For completeness, length can be -1 for a nul-terminated string. In this case +// the output string will be of course equal to string. +// +// The function takes the following parameters: +// +// - str: string to escape. +// +// The function returns the following values: +// +// - utf8: newly-allocated escaped string. +func RegexEscapeNUL(str string) string { + var _arg1 *C.gchar // out + var _arg2 C.gint + var _cret *C.gchar // in + + _arg2 = (C.gint)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_regex_escape_nul(_arg1, _arg2) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// RegexEscapeString escapes the special characters used for regular expressions +// in string, for instance "a.b*c" becomes "a\.b\*c". This function is useful to +// dynamically generate regular expressions. +// +// string can contain nul characters that are replaced with "\0", in this case +// remember to specify the correct length of string in length. +// +// The function takes the following parameters: +// +// - str: string to escape. +// +// The function returns the following values: +// +// - utf8: newly-allocated escaped string. +func RegexEscapeString(str string) string { + var _arg1 *C.gchar // out + var _arg2 C.gint + var _cret *C.gchar // in + + _arg2 = (C.gint)(len(str)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_regex_escape_string(_arg1, _arg2) + runtime.KeepAlive(str) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// RegexMatchSimple scans for a match in string for pattern. +// +// This function is equivalent to g_regex_match() but it does not require to +// compile the pattern with g_regex_new(), avoiding some lines of code when +// you need just to do a match without extracting substrings, capture counts, +// and so on. +// +// If this function is to be called on the same pattern more than once, +// it's more efficient to compile the pattern once with g_regex_new() and then +// use g_regex_match(). +// +// The function takes the following parameters: +// +// - pattern: regular expression. +// - str: string to scan for matches. +// - compileOptions: compile options for the regular expression, or 0. +// - matchOptions: match options, or 0. +// +// The function returns the following values: +// +// - ok: TRUE if the string matched, FALSE otherwise. +func RegexMatchSimple(pattern, str string, compileOptions RegexCompileFlags, matchOptions RegexMatchFlags) bool { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.GRegexCompileFlags // out + var _arg4 C.GRegexMatchFlags // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(pattern))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.GRegexCompileFlags(compileOptions) + _arg4 = C.GRegexMatchFlags(matchOptions) + + _cret = C.g_regex_match_simple(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(pattern) + runtime.KeepAlive(str) + runtime.KeepAlive(compileOptions) + runtime.KeepAlive(matchOptions) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RegexSplitSimple breaks the string on the pattern, and returns an array of +// the tokens. If the pattern contains capturing parentheses, then the text for +// each of the substrings will also be returned. If the pattern does not match +// anywhere in the string, then the whole string is returned as the first token. +// +// This function is equivalent to g_regex_split() but it does not require to +// compile the pattern with g_regex_new(), avoiding some lines of code when +// you need just to do a split without extracting substrings, capture counts, +// and so on. +// +// If this function is to be called on the same pattern more than once, +// it's more efficient to compile the pattern once with g_regex_new() and then +// use g_regex_split(). +// +// As a special case, the result of splitting the empty string "" is an empty +// vector, not a vector containing a single string. The reason for this special +// case is that being able to represent an empty vector is typically more useful +// than consistent handling of empty elements. If you do need to represent +// empty elements, you'll need to check for the empty string before calling this +// function. +// +// A pattern that can match empty strings splits string into separate characters +// wherever it matches the empty string between characters. For example +// splitting "ab c" using as a separator "\s*", you will get "a", "b" and "c". +// +// The function takes the following parameters: +// +// - pattern: regular expression. +// - str: string to scan for matches. +// - compileOptions: compile options for the regular expression, or 0. +// - matchOptions: match options, or 0. +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of strings. Free it using g_strfreev(). +func RegexSplitSimple(pattern, str string, compileOptions RegexCompileFlags, matchOptions RegexMatchFlags) []string { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.GRegexCompileFlags // out + var _arg4 C.GRegexMatchFlags // out + var _cret **C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(pattern))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.GRegexCompileFlags(compileOptions) + _arg4 = C.GRegexMatchFlags(matchOptions) + + _cret = C.g_regex_split_simple(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(pattern) + runtime.KeepAlive(str) + runtime.KeepAlive(compileOptions) + runtime.KeepAlive(matchOptions) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// Scanner: GScanner provides a general-purpose lexical scanner. +// +// You should set input_name after creating the scanner, since it is used by +// the default message handler when displaying warnings and errors. If you are +// scanning a file, the filename would be a good choice. +// +// The user_data and max_parse_errors fields are not used. If you need to +// associate extra data with the scanner you can place them here. +// +// If you want to use your own message handler you can set the msg_handler +// field. The type of the message handler function is declared by MsgFunc. +// +// An instance of this type is always passed by reference. +type Scanner struct { + *scanner +} + +// scanner is the struct that's finalized. +type scanner struct { + native *C.GScanner +} + +// CurLine returns the current line in the input stream (counting from 1). +// This is the line of the last token parsed via g_scanner_get_next_token(). +// +// The function returns the following values: +// +// - guint: current line. +func (scanner *Scanner) CurLine() uint { + var _arg0 *C.GScanner // out + var _cret C.guint // in + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + + _cret = C.g_scanner_cur_line(_arg0) + runtime.KeepAlive(scanner) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// CurPosition returns the current position in the current line +// (counting from 0). This is the position of the last token parsed via +// g_scanner_get_next_token(). +// +// The function returns the following values: +// +// - guint: current position on the line. +func (scanner *Scanner) CurPosition() uint { + var _arg0 *C.GScanner // out + var _cret C.guint // in + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + + _cret = C.g_scanner_cur_position(_arg0) + runtime.KeepAlive(scanner) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// CurToken gets the current token type. This is simply the token field in the +// #GScanner structure. +// +// The function returns the following values: +// +// - tokenType: current token type. +func (scanner *Scanner) CurToken() TokenType { + var _arg0 *C.GScanner // out + var _cret C.GTokenType // in + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + + _cret = C.g_scanner_cur_token(_arg0) + runtime.KeepAlive(scanner) + + var _tokenType TokenType // out + + _tokenType = TokenType(_cret) + + return _tokenType +} + +// Destroy frees all memory used by the #GScanner. +func (scanner *Scanner) Destroy() { + var _arg0 *C.GScanner // out + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + + C.g_scanner_destroy(_arg0) + runtime.KeepAlive(scanner) +} + +// EOF returns TRUE if the scanner has reached the end of the file or text +// buffer. +// +// The function returns the following values: +// +// - ok: TRUE if the scanner has reached the end of the file or text buffer. +func (scanner *Scanner) EOF() bool { + var _arg0 *C.GScanner // out + var _cret C.gboolean // in + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + + _cret = C.g_scanner_eof(_arg0) + runtime.KeepAlive(scanner) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// NextToken parses the next token just like g_scanner_peek_next_token() and +// also removes it from the input stream. The token data is placed in the token, +// value, line, and position fields of the #GScanner structure. +// +// The function returns the following values: +// +// - tokenType: type of the token. +func (scanner *Scanner) NextToken() TokenType { + var _arg0 *C.GScanner // out + var _cret C.GTokenType // in + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + + _cret = C.g_scanner_get_next_token(_arg0) + runtime.KeepAlive(scanner) + + var _tokenType TokenType // out + + _tokenType = TokenType(_cret) + + return _tokenType +} + +// InputFile prepares to scan a file. +// +// The function takes the following parameters: +// +// - inputFd: file descriptor. +func (scanner *Scanner) InputFile(inputFd int) { + var _arg0 *C.GScanner // out + var _arg1 C.gint // out + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + _arg1 = C.gint(inputFd) + + C.g_scanner_input_file(_arg0, _arg1) + runtime.KeepAlive(scanner) + runtime.KeepAlive(inputFd) +} + +// InputText prepares to scan a text buffer. +// +// The function takes the following parameters: +// +// - text buffer to scan. +func (scanner *Scanner) InputText(text string) { + var _arg0 *C.GScanner // out + var _arg1 *C.gchar // out + var _arg2 C.guint + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + _arg2 = (C.guint)(len(text)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(text) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(text)), text) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_scanner_input_text(_arg0, _arg1, _arg2) + runtime.KeepAlive(scanner) + runtime.KeepAlive(text) +} + +// LookupSymbol looks up a symbol in the current scope and return its value. +// If the symbol is not bound in the current scope, NULL is returned. +// +// The function takes the following parameters: +// +// - symbol to look up. +// +// The function returns the following values: +// +// - gpointer (optional): value of symbol in the current scope, or NULL if +// symbol is not bound in the current scope. +func (scanner *Scanner) LookupSymbol(symbol string) unsafe.Pointer { + var _arg0 *C.GScanner // out + var _arg1 *C.gchar // out + var _cret C.gpointer // in + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(symbol))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_scanner_lookup_symbol(_arg0, _arg1) + runtime.KeepAlive(scanner) + runtime.KeepAlive(symbol) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// PeekNextToken parses the next token, without removing it from the input +// stream. The token data is placed in the next_token, next_value, next_line, +// and next_position fields of the #GScanner structure. +// +// Note that, while the token is not removed from the input stream (i.e. +// the next call to g_scanner_get_next_token() will return the same token), +// it will not be reevaluated. This can lead to surprising results when changing +// scope or the scanner configuration after peeking the next token. Getting the +// next token after switching the scope or configuration will return whatever +// was peeked before, regardless of any symbols that may have been added or +// removed in the new scope. +// +// The function returns the following values: +// +// - tokenType: type of the token. +func (scanner *Scanner) PeekNextToken() TokenType { + var _arg0 *C.GScanner // out + var _cret C.GTokenType // in + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + + _cret = C.g_scanner_peek_next_token(_arg0) + runtime.KeepAlive(scanner) + + var _tokenType TokenType // out + + _tokenType = TokenType(_cret) + + return _tokenType +} + +// ScopeAddSymbol adds a symbol to the given scope. +// +// The function takes the following parameters: +// +// - scopeId: scope id. +// - symbol to add. +// - value (optional) of the symbol. +func (scanner *Scanner) ScopeAddSymbol(scopeId uint, symbol string, value unsafe.Pointer) { + var _arg0 *C.GScanner // out + var _arg1 C.guint // out + var _arg2 *C.gchar // out + var _arg3 C.gpointer // out + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + _arg1 = C.guint(scopeId) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(symbol))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (C.gpointer)(unsafe.Pointer(value)) + + C.g_scanner_scope_add_symbol(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(scanner) + runtime.KeepAlive(scopeId) + runtime.KeepAlive(symbol) + runtime.KeepAlive(value) +} + +// ScopeForEachSymbol calls the given function for each of the symbol/value +// pairs in the given scope of the #GScanner. The function is passed the symbol +// and value of each pair, and the given user_data parameter. +// +// The function takes the following parameters: +// +// - scopeId: scope id. +// - fn: function to call for each symbol/value pair. +func (scanner *Scanner) ScopeForEachSymbol(scopeId uint, fn HFunc) { + var _arg0 *C.GScanner // out + var _arg1 C.guint // out + var _arg2 C.GHFunc // out + var _arg3 C.gpointer + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + _arg1 = C.guint(scopeId) + _arg2 = (*[0]byte)(C._gotk4_glib2_HFunc) + _arg3 = C.gpointer(gbox.Assign(fn)) + defer gbox.Delete(uintptr(_arg3)) + + C.g_scanner_scope_foreach_symbol(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(scanner) + runtime.KeepAlive(scopeId) + runtime.KeepAlive(fn) +} + +// ScopeLookupSymbol looks up a symbol in a scope and return its value. If the +// symbol is not bound in the scope, NULL is returned. +// +// The function takes the following parameters: +// +// - scopeId: scope id. +// - symbol to look up. +// +// The function returns the following values: +// +// - gpointer (optional): value of symbol in the given scope, or NULL if +// symbol is not bound in the given scope. +func (scanner *Scanner) ScopeLookupSymbol(scopeId uint, symbol string) unsafe.Pointer { + var _arg0 *C.GScanner // out + var _arg1 C.guint // out + var _arg2 *C.gchar // out + var _cret C.gpointer // in + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + _arg1 = C.guint(scopeId) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(symbol))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_scanner_scope_lookup_symbol(_arg0, _arg1, _arg2) + runtime.KeepAlive(scanner) + runtime.KeepAlive(scopeId) + runtime.KeepAlive(symbol) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// ScopeRemoveSymbol removes a symbol from a scope. +// +// The function takes the following parameters: +// +// - scopeId: scope id. +// - symbol to remove. +func (scanner *Scanner) ScopeRemoveSymbol(scopeId uint, symbol string) { + var _arg0 *C.GScanner // out + var _arg1 C.guint // out + var _arg2 *C.gchar // out + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + _arg1 = C.guint(scopeId) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(symbol))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_scanner_scope_remove_symbol(_arg0, _arg1, _arg2) + runtime.KeepAlive(scanner) + runtime.KeepAlive(scopeId) + runtime.KeepAlive(symbol) +} + +// SetScope sets the current scope. +// +// The function takes the following parameters: +// +// - scopeId: new scope id. +// +// The function returns the following values: +// +// - guint: old scope id. +func (scanner *Scanner) SetScope(scopeId uint) uint { + var _arg0 *C.GScanner // out + var _arg1 C.guint // out + var _cret C.guint // in + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + _arg1 = C.guint(scopeId) + + _cret = C.g_scanner_set_scope(_arg0, _arg1) + runtime.KeepAlive(scanner) + runtime.KeepAlive(scopeId) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// SyncFileOffset rewinds the filedescriptor to the current buffer position and +// blows the file read ahead buffer. This is useful for third party uses of the +// scanners filedescriptor, which hooks onto the current scanning position. +func (scanner *Scanner) SyncFileOffset() { + var _arg0 *C.GScanner // out + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + + C.g_scanner_sync_file_offset(_arg0) + runtime.KeepAlive(scanner) +} + +// UnexpToken outputs a message through the scanner's msg_handler, resulting +// from an unexpected token in the input stream. Note that you should not call +// g_scanner_peek_next_token() followed by g_scanner_unexp_token() without an +// intermediate call to g_scanner_get_next_token(), as g_scanner_unexp_token() +// evaluates the scanner's current token (not the peeked token) to construct +// part of the message. +// +// The function takes the following parameters: +// +// - expectedToken: expected token. +// - identifierSpec: string describing how the scanner's user refers +// to identifiers (NULL defaults to "identifier"). This is used if +// expected_token is G_TOKEN_IDENTIFIER or G_TOKEN_IDENTIFIER_NULL. +// - symbolSpec: string describing how the scanner's user refers to +// symbols (NULL defaults to "symbol"). This is used if expected_token is +// G_TOKEN_SYMBOL or any token value greater than G_TOKEN_LAST. +// - symbolName: name of the symbol, if the scanner's current token is a +// symbol. +// - message string to output at the end of the warning/error, or NULL. +// - isError: if TRUE it is output as an error. If FALSE it is output as a +// warning. +func (scanner *Scanner) UnexpToken(expectedToken TokenType, identifierSpec string, symbolSpec string, symbolName string, message string, isError int) { + var _arg0 *C.GScanner // out + var _arg1 C.GTokenType // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 *C.gchar // out + var _arg6 C.gint // out + + _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) + _arg1 = C.GTokenType(expectedToken) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(identifierSpec))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(symbolSpec))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(symbolName))) + defer C.free(unsafe.Pointer(_arg4)) + _arg5 = (*C.gchar)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg5)) + _arg6 = C.gint(isError) + + C.g_scanner_unexp_token(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(scanner) + runtime.KeepAlive(expectedToken) + runtime.KeepAlive(identifierSpec) + runtime.KeepAlive(symbolSpec) + runtime.KeepAlive(symbolName) + runtime.KeepAlive(message) + runtime.KeepAlive(isError) +} + +// ScannerConfig specifies the #GScanner parser configuration. Most settings can +// be changed during the parsing phase and will affect the lexical parsing of +// the next unpeeked token. +// +// An instance of this type is always passed by reference. +type ScannerConfig struct { + *scannerConfig +} + +// scannerConfig is the struct that's finalized. +type scannerConfig struct { + native *C.GScannerConfig +} + +// CsetSkipCharacters specifies which characters should be skipped by +// the scanner (the default is the whitespace characters: space, tab, +// carriage-return and line-feed). +func (s *ScannerConfig) CsetSkipCharacters() string { + valptr := &s.native.cset_skip_characters + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// CsetIdentifierFirst specifies the characters which can start identifiers (the +// default is G_CSET_a_2_z, "_", and G_CSET_A_2_Z). +func (s *ScannerConfig) CsetIdentifierFirst() string { + valptr := &s.native.cset_identifier_first + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// CsetIdentifierNth specifies the characters which can be used in identifiers, +// after the first character (the default is G_CSET_a_2_z, "_0123456789", +// G_CSET_A_2_Z, G_CSET_LATINS, G_CSET_LATINC). +func (s *ScannerConfig) CsetIdentifierNth() string { + valptr := &s.native.cset_identifier_nth + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// CpairCommentSingle specifies the characters at the start and end of +// single-line comments. The default is "#\n" which means that single-line +// comments start with a '#' and continue until a '\n' (end of line). +func (s *ScannerConfig) CpairCommentSingle() string { + valptr := &s.native.cpair_comment_single + var _v string // out + _v = C.GoString((*C.gchar)(unsafe.Pointer(*valptr))) + return _v +} + +// Source: GSource struct is an opaque data type representing an event source. +// +// An instance of this type is always passed by reference. +type Source struct { + *source +} + +// source is the struct that's finalized. +type source struct { + native *C.GSource +} + +func marshalSource(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Source{&source{(*C.GSource)(b)}}, nil +} + +// NewSource constructs a struct Source. +func NewSource(sourceFuncs *SourceFuncs, structSize uint) *Source { + var _arg1 *C.GSourceFuncs // out + var _arg2 C.guint // out + var _cret *C.GSource // in + + _arg1 = (*C.GSourceFuncs)(gextras.StructNative(unsafe.Pointer(sourceFuncs))) + _arg2 = C.guint(structSize) + + _cret = C.g_source_new(_arg1, _arg2) + runtime.KeepAlive(sourceFuncs) + runtime.KeepAlive(structSize) + + var _source *Source // out + + _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_source)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_source_unref((*C.GSource)(intern.C)) + }, + ) + + return _source +} + +// AddChildSource adds child_source to source as a "polled" source; when source +// is added to a Context, child_source will be automatically added with the same +// priority, when child_source is triggered, it will cause source to dispatch +// (in addition to calling its own callback), and when source is destroyed, +// it will destroy child_source as well. (source will also still be dispatched +// if its own prepare/check functions indicate that it is ready.) +// +// If you don't need child_source to do anything on its own when it triggers, +// you can call g_source_set_dummy_callback() on it to set a callback that does +// nothing (except return TRUE if appropriate). +// +// source will hold a reference on child_source while child_source is attached +// to it. +// +// This API is only intended to be used by implementations of #GSource. Do not +// call this API on a #GSource that you did not create. +// +// The function takes the following parameters: +// +// - childSource: second #GSource that source should "poll". +func (source *Source) AddChildSource(childSource *Source) { + var _arg0 *C.GSource // out + var _arg1 *C.GSource // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(childSource))) + + C.g_source_add_child_source(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(childSource) +} + +// Attach adds a #GSource to a context so that it will be executed within that +// context. Remove it by calling g_source_destroy(). +// +// This function is safe to call from any thread, regardless of which thread the +// context is running in. +// +// The function takes the following parameters: +// +// - context (optional) (if NULL, the global-default main context will be +// used). +// +// The function returns the following values: +// +// - guint: ID (greater than 0) for the source within the Context. +func (source *Source) Attach(context *MainContext) uint { + var _arg0 *C.GSource // out + var _arg1 *C.GMainContext // out + var _cret C.guint // in + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + if context != nil { + _arg1 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + + _cret = C.g_source_attach(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(context) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Destroy removes a source from its Context, if any, and mark it as destroyed. +// The source cannot be subsequently added to another context. It is safe to +// call this on sources which have already been removed from their context. +// +// This does not unref the #GSource: if you still hold a reference, use +// g_source_unref() to drop it. +// +// This function is safe to call from any thread, regardless of which thread the +// Context is running in. +// +// If the source is currently attached to a Context, destroying it will +// effectively unset the callback similar to calling g_source_set_callback(). +// This can mean, that the data's Notify gets called right away. +func (source *Source) Destroy() { + var _arg0 *C.GSource // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + + C.g_source_destroy(_arg0) + runtime.KeepAlive(source) +} + +// CanRecurse checks whether a source is allowed to be called recursively. +// see g_source_set_can_recurse(). +// +// The function returns the following values: +// +// - ok: whether recursion is allowed. +func (source *Source) CanRecurse() bool { + var _arg0 *C.GSource // out + var _cret C.gboolean // in + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + + _cret = C.g_source_get_can_recurse(_arg0) + runtime.KeepAlive(source) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Context gets the Context with which the source is associated. +// +// You can call this on a source that has been destroyed, provided that the +// Context it was attached to still exists (in which case it will return that +// Context). In particular, you can always call this function on the source +// returned from g_main_current_source(). But calling this function on a source +// whose Context has been destroyed is an error. +// +// The function returns the following values: +// +// - mainContext (optional) with which the source is associated, or NULL if +// the context has not yet been added to a source. +func (source *Source) Context() *MainContext { + var _arg0 *C.GSource // out + var _cret *C.GMainContext // in + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + + _cret = C.g_source_get_context(_arg0) + runtime.KeepAlive(source) + + var _mainContext *MainContext // out + + if _cret != nil { + _mainContext = (*MainContext)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_main_context_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_mainContext)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_main_context_unref((*C.GMainContext)(intern.C)) + }, + ) + } + + return _mainContext +} + +// CurrentTime: this function ignores source and is otherwise the same as +// g_get_current_time(). +// +// Deprecated: use g_source_get_time() instead. +// +// The function takes the following parameters: +// +// - timeval structure in which to store current time. +func (source *Source) CurrentTime(timeval *TimeVal) { + var _arg0 *C.GSource // out + var _arg1 *C.GTimeVal // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(timeval))) + + C.g_source_get_current_time(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(timeval) +} + +// ID returns the numeric ID for a particular source. The ID of a +// source is a positive integer which is unique within a particular +// main loop context. The reverse mapping from ID to source is done by +// g_main_context_find_source_by_id(). +// +// You can only call this function while the source is associated to a +// Context instance; calling this function before g_source_attach() or after +// g_source_destroy() yields undefined behavior. The ID returned is unique +// within the Context instance passed to g_source_attach(). +// +// The function returns the following values: +// +// - guint: ID (greater than 0) for the source. +func (source *Source) ID() uint { + var _arg0 *C.GSource // out + var _cret C.guint // in + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + + _cret = C.g_source_get_id(_arg0) + runtime.KeepAlive(source) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Name gets a name for the source, used in debugging and profiling. The name +// may be LL if it has never been set with g_source_set_name(). +// +// The function returns the following values: +// +// - utf8 (optional): name of the source. +func (source *Source) Name() string { + var _arg0 *C.GSource // out + var _cret *C.char // in + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + + _cret = C.g_source_get_name(_arg0) + runtime.KeepAlive(source) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Priority gets the priority of a source. +// +// The function returns the following values: +// +// - gint: priority of the source. +func (source *Source) Priority() int { + var _arg0 *C.GSource // out + var _cret C.gint // in + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + + _cret = C.g_source_get_priority(_arg0) + runtime.KeepAlive(source) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// ReadyTime gets the "ready time" of source, as set by +// g_source_set_ready_time(). +// +// Any time before or equal to the current monotonic time (including 0) is an +// indication that the source will fire immediately. +// +// The function returns the following values: +// +// - gint64: monotonic ready time, -1 for "never". +func (source *Source) ReadyTime() int64 { + var _arg0 *C.GSource // out + var _cret C.gint64 // in + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + + _cret = C.g_source_get_ready_time(_arg0) + runtime.KeepAlive(source) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// Time gets the time to be used when checking this source. The advantage of +// calling this function over calling g_get_monotonic_time() directly is that +// when checking multiple sources, GLib can cache a single value instead of +// having to repeatedly get the system monotonic time. +// +// The time here is the system monotonic time, if available, or some other +// reasonable alternative otherwise. See g_get_monotonic_time(). +// +// The function returns the following values: +// +// - gint64: monotonic time in microseconds. +func (source *Source) Time() int64 { + var _arg0 *C.GSource // out + var _cret C.gint64 // in + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + + _cret = C.g_source_get_time(_arg0) + runtime.KeepAlive(source) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// IsDestroyed returns whether source has been destroyed. +// +// This is important when you operate upon your objects from within idle +// handlers, but may have freed the object before the dispatch of your idle +// handler. +// +// static gboolean +// idle_callback (gpointer data) +// { +// SomeWidget *self = data; +// +// g_mutex_lock (&self->idle_id_mutex); +// if (!g_source_is_destroyed (g_main_current_source ())) +// { +// // do stuff with self +// } +// g_mutex_unlock (&self->idle_id_mutex); +// +// return FALSE; +// } +// +// Calls to this function from a thread other than the one acquired by the +// Context the #GSource is attached to are typically redundant, as the source +// could be destroyed immediately after this function returns. However, once a +// source is destroyed it cannot be un-destroyed, so this function can be used +// for opportunistic checks from any thread. +// +// The function returns the following values: +// +// - ok: TRUE if the source has been destroyed. +func (source *Source) IsDestroyed() bool { + var _arg0 *C.GSource // out + var _cret C.gboolean // in + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + + _cret = C.g_source_is_destroyed(_arg0) + runtime.KeepAlive(source) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RemoveChildSource detaches child_source from source and destroys it. +// +// This API is only intended to be used by implementations of #GSource. Do not +// call this API on a #GSource that you did not create. +// +// The function takes the following parameters: +// +// - childSource previously passed to g_source_add_child_source(). +func (source *Source) RemoveChildSource(childSource *Source) { + var _arg0 *C.GSource // out + var _arg1 *C.GSource // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(childSource))) + + C.g_source_remove_child_source(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(childSource) +} + +// SetCallback sets the callback function for a source. The callback for a +// source is called from the source's dispatch function. +// +// The exact type of func depends on the type of source; ie. you should not +// count on func being called with data as its first parameter. Cast func with +// G_SOURCE_FUNC() to avoid warnings about incompatible function types. +// +// See [memory management of sources][mainloop-memory-management] for details on +// how to handle memory management of data. +// +// Typically, you won't use this function. Instead use functions specific to the +// type of source you are using, such as g_idle_add() or g_timeout_add(). +// +// It is safe to call this function multiple times on a source which has already +// been attached to a context. The changes will take effect for the next time +// the source is dispatched after this call returns. +// +// Note that g_source_destroy() for a currently attached source has the effect +// of also unsetting the callback. +// +// The function takes the following parameters: +// +// - fn: callback function. +func (source *Source) SetCallback(fn SourceFunc) { + var _arg0 *C.GSource // out + var _arg1 C.GSourceFunc // out + var _arg2 C.gpointer + var _arg3 C.GDestroyNotify + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = (*[0]byte)(C._gotk4_glib2_SourceFunc) + _arg2 = C.gpointer(gbox.Assign(fn)) + _arg3 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + + C.g_source_set_callback(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(source) + runtime.KeepAlive(fn) +} + +// SetCallbackIndirect sets the callback function storing the data as a +// refcounted callback "object". This is used internally. Note that calling +// g_source_set_callback_indirect() assumes an initial reference count on +// callback_data, and thus callback_funcs->unref will eventually be called once +// more than callback_funcs->ref. +// +// It is safe to call this function multiple times on a source which has already +// been attached to a context. The changes will take effect for the next time +// the source is dispatched after this call returns. +// +// The function takes the following parameters: +// +// - callbackData (optional): pointer to callback data "object". +// - callbackFuncs functions for reference counting callback_data and getting +// the callback and data. +func (source *Source) SetCallbackIndirect(callbackData unsafe.Pointer, callbackFuncs *SourceCallbackFuncs) { + var _arg0 *C.GSource // out + var _arg1 C.gpointer // out + var _arg2 *C.GSourceCallbackFuncs // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = (C.gpointer)(unsafe.Pointer(callbackData)) + _arg2 = (*C.GSourceCallbackFuncs)(gextras.StructNative(unsafe.Pointer(callbackFuncs))) + + C.g_source_set_callback_indirect(_arg0, _arg1, _arg2) + runtime.KeepAlive(source) + runtime.KeepAlive(callbackData) + runtime.KeepAlive(callbackFuncs) +} + +// SetCanRecurse sets whether a source can be called recursively. If can_recurse +// is TRUE, then while the source is being dispatched then this source will be +// processed normally. Otherwise, all processing of this source is blocked until +// the dispatch function returns. +// +// The function takes the following parameters: +// +// - canRecurse: whether recursion is allowed for this source. +func (source *Source) SetCanRecurse(canRecurse bool) { + var _arg0 *C.GSource // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + if canRecurse { + _arg1 = C.TRUE + } + + C.g_source_set_can_recurse(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(canRecurse) +} + +// SetFuncs sets the source functions (can be used to override default +// implementations) of an unattached source. +// +// The function takes the following parameters: +// +// - funcs: new Funcs. +func (source *Source) SetFuncs(funcs *SourceFuncs) { + var _arg0 *C.GSource // out + var _arg1 *C.GSourceFuncs // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = (*C.GSourceFuncs)(gextras.StructNative(unsafe.Pointer(funcs))) + + C.g_source_set_funcs(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(funcs) +} + +// SetName sets a name for the source, used in debugging and profiling. The name +// defaults to LL. +// +// The source name should describe in a human-readable way what the source does. +// For example, "X11 event queue" or "GTK repaint idle handler" or whatever it +// is. +// +// It is permitted to call this function multiple times, but is not recommended +// due to the potential performance impact. For example, one could change the +// name in the "check" function of a Funcs to include details like the event +// type in the source name. +// +// Use caution if changing the name while another thread may be accessing it +// with g_source_get_name(); that function does not copy the value, and changing +// the value will free it while the other thread may be attempting to use it. +// +// Also see g_source_set_static_name(). +// +// The function takes the following parameters: +// +// - name: debug name for the source. +func (source *Source) SetName(name string) { + var _arg0 *C.GSource // out + var _arg1 *C.char // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_source_set_name(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(name) +} + +// SetPriority sets the priority of a source. While the main loop is being run, +// a source will be dispatched if it is ready to be dispatched and no sources at +// a higher (numerically smaller) priority are ready to be dispatched. +// +// A child source always has the same priority as its parent. It is not +// permitted to change the priority of a source once it has been added as a +// child of another source. +// +// The function takes the following parameters: +// +// - priority: new priority. +func (source *Source) SetPriority(priority int) { + var _arg0 *C.GSource // out + var _arg1 C.gint // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = C.gint(priority) + + C.g_source_set_priority(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(priority) +} + +// SetReadyTime sets a #GSource to be dispatched when the given monotonic time +// is reached (or passed). If the monotonic time is in the past (as it always +// will be if ready_time is 0) then the source will be dispatched immediately. +// +// If ready_time is -1 then the source is never woken up on the basis of the +// passage of time. +// +// Dispatching the source does not reset the ready time. You should do so +// yourself, from the source dispatch function. +// +// Note that if you have a pair of sources where the ready time of one suggests +// that it will be delivered first but the priority for the other suggests +// that it would be delivered first, and the ready time for both sources is +// reached during the same main context iteration, then the order of dispatch is +// undefined. +// +// It is a no-op to call this function on a #GSource which has already been +// destroyed with g_source_destroy(). +// +// This API is only intended to be used by implementations of #GSource. Do not +// call this API on a #GSource that you did not create. +// +// The function takes the following parameters: +// +// - readyTime: monotonic time at which the source will be ready, 0 for +// "immediately", -1 for "never". +func (source *Source) SetReadyTime(readyTime int64) { + var _arg0 *C.GSource // out + var _arg1 C.gint64 // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = C.gint64(readyTime) + + C.g_source_set_ready_time(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(readyTime) +} + +// SetStaticName: variant of g_source_set_name() that does not duplicate the +// name, and can only be used with string literals. +// +// The function takes the following parameters: +// +// - name: debug name for the source. +func (source *Source) SetStaticName(name string) { + var _arg0 *C.GSource // out + var _arg1 *C.char // out + + _arg0 = (*C.GSource)(gextras.StructNative(unsafe.Pointer(source))) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + C.g_source_set_static_name(_arg0, _arg1) + runtime.KeepAlive(source) + runtime.KeepAlive(name) +} + +// SourceRemoveByFuncsUserData removes a source from the default main loop +// context given the source functions and user data. If multiple sources exist +// with the same source functions and user data, only one will be destroyed. +// +// The function takes the following parameters: +// +// - funcs passed to g_source_new(). +// - userData (optional): user data for the callback. +// +// The function returns the following values: +// +// - ok: TRUE if a source was found and removed. +func SourceRemoveByFuncsUserData(funcs *SourceFuncs, userData unsafe.Pointer) bool { + var _arg1 *C.GSourceFuncs // out + var _arg2 C.gpointer // out + var _cret C.gboolean // in + + _arg1 = (*C.GSourceFuncs)(gextras.StructNative(unsafe.Pointer(funcs))) + _arg2 = (C.gpointer)(unsafe.Pointer(userData)) + + _cret = C.g_source_remove_by_funcs_user_data(_arg1, _arg2) + runtime.KeepAlive(funcs) + runtime.KeepAlive(userData) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SourceRemoveByUserData removes a source from the default main loop context +// given the user data for the callback. If multiple sources exist with the same +// user data, only one will be destroyed. +// +// The function takes the following parameters: +// +// - userData (optional): user_data for the callback. +// +// The function returns the following values: +// +// - ok: TRUE if a source was found and removed. +func SourceRemoveByUserData(userData unsafe.Pointer) bool { + var _arg1 C.gpointer // out + var _cret C.gboolean // in + + _arg1 = (C.gpointer)(unsafe.Pointer(userData)) + + _cret = C.g_source_remove_by_user_data(_arg1) + runtime.KeepAlive(userData) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SourceSetNameByID sets the name of a source using its ID. +// +// This is a convenience utility to set source names from the return value of +// g_idle_add(), g_timeout_add(), etc. +// +// It is a programmer error to attempt to set the name of a non-existent source. +// +// More specifically: source IDs can be reissued after a source has been +// destroyed and therefore it is never valid to use this function with a source +// ID which may have already been removed. An example is when scheduling an idle +// to run in another thread with g_idle_add(): the idle may already have run and +// been removed by the time this function is called on its (now invalid) source +// ID. This source ID may have been reissued, leading to the operation being +// performed against the wrong source. +// +// The function takes the following parameters: +// +// - tag: #GSource ID. +// - name: debug name for the source. +func SourceSetNameByID(tag uint, name string) { + var _arg1 C.guint // out + var _arg2 *C.char // out + + _arg1 = C.guint(tag) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg2)) + + C.g_source_set_name_by_id(_arg1, _arg2) + runtime.KeepAlive(tag) + runtime.KeepAlive(name) +} + +// SourceCallbackFuncs: GSourceCallbackFuncs struct contains functions for +// managing callback objects. +// +// An instance of this type is always passed by reference. +type SourceCallbackFuncs struct { + *sourceCallbackFuncs +} + +// sourceCallbackFuncs is the struct that's finalized. +type sourceCallbackFuncs struct { + native *C.GSourceCallbackFuncs +} + +// SourceFuncs: GSourceFuncs struct contains a table of functions used to handle +// event sources in a generic manner. +// +// For idle sources, the prepare and check functions always return TRUE to +// indicate that the source is always ready to be processed. The prepare +// function also returns a timeout value of 0 to ensure that the poll() call +// doesn't block (since that would be time wasted which could have been spent +// running the idle function). +// +// For timeout sources, the prepare and check functions both return TRUE if the +// timeout interval has expired. The prepare function also returns a timeout +// value to ensure that the poll() call doesn't block too long and miss the next +// timeout. +// +// For file descriptor sources, the prepare function typically returns FALSE, +// since it must wait until poll() has been called before it knows whether any +// events need to be processed. It sets the returned timeout to -1 to indicate +// that it doesn't mind how long the poll() call blocks. In the check function, +// it tests the results of the poll() call to see if the required condition has +// been met, and returns TRUE if so. +// +// An instance of this type is always passed by reference. +type SourceFuncs struct { + *sourceFuncs +} + +// sourceFuncs is the struct that's finalized. +type sourceFuncs struct { + native *C.GSourceFuncs +} + +// TimeVal represents a precise time, with seconds and microseconds. +// +// Similar to the struct timeval returned by the gettimeofday() UNIX system +// call. +// +// GLib is attempting to unify around the use of 64-bit integers to represent +// microsecond-precision time. As such, this type will be removed from a future +// version of GLib. A consequence of using glong for tv_sec is that on 32-bit +// systems GTimeVal is subject to the year 2038 problem. +// +// Deprecated: Use Time or #guint64 instead. +// +// An instance of this type is always passed by reference. +type TimeVal struct { + *timeVal +} + +// timeVal is the struct that's finalized. +type timeVal struct { + native *C.GTimeVal +} + +// NewTimeVal creates a new TimeVal instance from the given +// fields. Beware that this function allocates on the Go heap; be careful +// when using it! +func NewTimeVal(tvSec, tvUsec int32) TimeVal { + var f0 C.glong // out + f0 = C.glong(tvSec) + var f1 C.glong // out + f1 = C.glong(tvUsec) + + v := C.GTimeVal{ + tv_sec: f0, + tv_usec: f1, + } + + return *(*TimeVal)(gextras.NewStructNative(unsafe.Pointer(&v))) +} + +// TvSec: seconds. +func (t *TimeVal) TvSec() int32 { + valptr := &t.native.tv_sec + var _v int32 // out + _v = int32(*valptr) + return _v +} + +// TvUsec: microseconds. +func (t *TimeVal) TvUsec() int32 { + valptr := &t.native.tv_usec + var _v int32 // out + _v = int32(*valptr) + return _v +} + +// TvSec: seconds. +func (t *TimeVal) SetTvSec(tvSec int32) { + valptr := &t.native.tv_sec + *valptr = C.glong(tvSec) +} + +// TvUsec: microseconds. +func (t *TimeVal) SetTvUsec(tvUsec int32) { + valptr := &t.native.tv_usec + *valptr = C.glong(tvUsec) +} + +// Add adds the given number of microseconds to time_. microseconds can also be +// negative to decrease the value of time_. +// +// Deprecated: Val is not year-2038-safe. Use guint64 for representing +// microseconds since the epoch, or use Time. +// +// The function takes the following parameters: +// +// - microseconds: number of microseconds to add to time. +func (time_ *TimeVal) Add(microseconds int32) { + var _arg0 *C.GTimeVal // out + var _arg1 C.glong // out + + _arg0 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(time_))) + _arg1 = C.glong(microseconds) + + C.g_time_val_add(_arg0, _arg1) + runtime.KeepAlive(time_) + runtime.KeepAlive(microseconds) +} + +// ToISO8601 converts time_ into an RFC 3339 encoded string, relative to the +// Coordinated Universal Time (UTC). This is one of the many formats allowed by +// ISO 8601. +// +// ISO 8601 allows a large number of date/time formats, with or without +// punctuation and optional elements. The format returned by this function is +// a complete date and time, with optional punctuation included, the UTC time +// zone represented as "Z", and the tv_usec part included if and only if it is +// nonzero, i.e. either "YYYY-MM-DDTHH:MM:SSZ" or "YYYY-MM-DDTHH:MM:SS.fffffZ". +// +// This corresponds to the Internet date/time format defined by RFC 3339 +// (https://www.ietf.org/rfc/rfc3339.txt), and to either of the two +// most-precise formats defined by the W3C Note Date and Time Formats +// (http://www.w3.org/TR/NOTE-datetime-19980827). Both of these documents are +// profiles of ISO 8601. +// +// Use g_date_time_format() or g_strdup_printf() if a different variation of ISO +// 8601 format is required. +// +// If time_ represents a date which is too large to fit into a struct tm, NULL +// will be returned. This is platform dependent. Note also that since GTimeVal +// stores the number of seconds as a glong, on 32-bit systems it is subject to +// the year 2038 problem. Accordingly, since GLib 2.62, this function has been +// deprecated. Equivalent functionality is available using: +// +// GDateTime *dt = g_date_time_new_from_unix_utc (time_val); +// iso8601_string = g_date_time_format_iso8601 (dt); +// g_date_time_unref (dt); +// +// The return value of g_time_val_to_iso8601() has been nullable since GLib +// 2.54; before then, GLib would crash under the same conditions. +// +// Deprecated: Val is not year-2038-safe. Use g_date_time_format_iso8601(dt) +// instead. +// +// The function returns the following values: +// +// - utf8 (optional): newly allocated string containing an ISO 8601 date, +// or NULL if time_ was too large. +func (time_ *TimeVal) ToISO8601() string { + var _arg0 *C.GTimeVal // out + var _cret *C.gchar // in + + _arg0 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(time_))) + + _cret = C.g_time_val_to_iso8601(_arg0) + runtime.KeepAlive(time_) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// TimeValFromISO8601 converts a string containing an ISO 8601 encoded date and +// time to a Val and puts it into time_. +// +// iso_date must include year, month, day, hours, minutes, and seconds. +// It can optionally include fractions of a second and a time zone indicator. +// (In the absence of any time zone indication, the timestamp is assumed to be +// in local time.) +// +// Any leading or trailing space in iso_date is ignored. +// +// This function was deprecated, along with Val itself, in GLib 2.62. Equivalent +// functionality is available using code like: +// +// GDateTime *dt = g_date_time_new_from_iso8601 (iso8601_string, NULL); +// gint64 time_val = g_date_time_to_unix (dt); +// g_date_time_unref (dt); +// +// Deprecated: Val is not year-2038-safe. Use g_date_time_new_from_iso8601() +// instead. +// +// The function takes the following parameters: +// +// - isoDate: ISO 8601 encoded date string. +// +// The function returns the following values: +// +// - time_: Val. +// - ok: TRUE if the conversion was successful. +func TimeValFromISO8601(isoDate string) (*TimeVal, bool) { + var _arg1 *C.gchar // out + var _arg2 C.GTimeVal // in + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(isoDate))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_time_val_from_iso8601(_arg1, &_arg2) + runtime.KeepAlive(isoDate) + + var _time_ *TimeVal // out + var _ok bool // out + + _time_ = (*TimeVal)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + if _cret != 0 { + _ok = true + } + + return _time_, _ok +} + +// TimeZone: GTimeZone represents a time zone, at no particular point in time. +// +// The GTimeZone struct is refcounted and immutable. +// +// Each time zone has an identifier (for example, ‘Europe/London’) which +// is platform dependent. See glib.TimeZone.New for information on the +// identifier formats. The identifier of a time zone can be retrieved using +// glib.TimeZone.GetIdentifier(). +// +// A time zone contains a number of intervals. Each interval has an abbreviation +// to describe it (for example, ‘PDT’), an offset to UTC and a flag indicating +// if the daylight savings time is in effect during that interval. A time +// zone always has at least one interval — interval 0. Note that interval +// abbreviations are not the same as time zone identifiers (apart from ‘UTC’), +// and cannot be passed to glib.TimeZone.New. +// +// Every UTC time is contained within exactly one interval, but a given +// local time may be contained within zero, one or two intervals (due to +// incontinuities associated with daylight savings time). +// +// An interval may refer to a specific period of time (eg: the duration of +// daylight savings time during 2010) or it may refer to many periods of time +// that share the same properties (eg: all periods of daylight savings time). It +// is also possible (usually for political reasons) that some properties (like +// the abbreviation) change between intervals without other properties changing. +// +// An instance of this type is always passed by reference. +type TimeZone struct { + *timeZone +} + +// timeZone is the struct that's finalized. +type timeZone struct { + native *C.GTimeZone +} + +func marshalTimeZone(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &TimeZone{&timeZone{(*C.GTimeZone)(b)}}, nil +} + +// NewTimeZone constructs a struct TimeZone. +func NewTimeZone(identifier string) *TimeZone { + var _arg1 *C.gchar // out + var _cret *C.GTimeZone // in + + if identifier != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(identifier))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_time_zone_new(_arg1) + runtime.KeepAlive(identifier) + + var _timeZone *TimeZone // out + + _timeZone = (*TimeZone)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_timeZone)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_time_zone_unref((*C.GTimeZone)(intern.C)) + }, + ) + + return _timeZone +} + +// NewTimeZoneIdentifier constructs a struct TimeZone. +func NewTimeZoneIdentifier(identifier string) *TimeZone { + var _arg1 *C.gchar // out + var _cret *C.GTimeZone // in + + if identifier != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(identifier))) + defer C.free(unsafe.Pointer(_arg1)) + } + + _cret = C.g_time_zone_new_identifier(_arg1) + runtime.KeepAlive(identifier) + + var _timeZone *TimeZone // out + + if _cret != nil { + _timeZone = (*TimeZone)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_timeZone)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_time_zone_unref((*C.GTimeZone)(intern.C)) + }, + ) + } + + return _timeZone +} + +// NewTimeZoneLocal constructs a struct TimeZone. +func NewTimeZoneLocal() *TimeZone { + var _cret *C.GTimeZone // in + + _cret = C.g_time_zone_new_local() + + var _timeZone *TimeZone // out + + _timeZone = (*TimeZone)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_timeZone)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_time_zone_unref((*C.GTimeZone)(intern.C)) + }, + ) + + return _timeZone +} + +// NewTimeZoneOffset constructs a struct TimeZone. +func NewTimeZoneOffset(seconds int32) *TimeZone { + var _arg1 C.gint32 // out + var _cret *C.GTimeZone // in + + _arg1 = C.gint32(seconds) + + _cret = C.g_time_zone_new_offset(_arg1) + runtime.KeepAlive(seconds) + + var _timeZone *TimeZone // out + + _timeZone = (*TimeZone)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_timeZone)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_time_zone_unref((*C.GTimeZone)(intern.C)) + }, + ) + + return _timeZone +} + +// NewTimeZoneUTC constructs a struct TimeZone. +func NewTimeZoneUTC() *TimeZone { + var _cret *C.GTimeZone // in + + _cret = C.g_time_zone_new_utc() + + var _timeZone *TimeZone // out + + _timeZone = (*TimeZone)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_timeZone)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_time_zone_unref((*C.GTimeZone)(intern.C)) + }, + ) + + return _timeZone +} + +// FindInterval finds an interval within tz that corresponds to the given time_. +// The meaning of time_ depends on type. +// +// If type is G_TIME_TYPE_UNIVERSAL then this function will always succeed +// (since universal time is monotonic and continuous). +// +// Otherwise time_ is treated as local time. The distinction between +// G_TIME_TYPE_STANDARD and G_TIME_TYPE_DAYLIGHT is ignored except in the case +// that the given time_ is ambiguous. In Toronto, for example, 01:30 on November +// 7th 2010 occurred twice (once inside of daylight savings time and the next, +// an hour later, outside of daylight savings time). In this case, the different +// value of type would result in a different interval being returned. +// +// It is still possible for this function to fail. In Toronto, for example, +// 02:00 on March 14th 2010 does not exist (due to the leap forward to begin +// daylight savings time). -1 is returned in that case. +// +// The function takes the following parameters: +// +// - typ of time_. +// - time_: number of seconds since January 1, 1970. +// +// The function returns the following values: +// +// - gint: interval containing time_, or -1 in case of failure. +func (tz *TimeZone) FindInterval(typ TimeType, time_ int64) int { + var _arg0 *C.GTimeZone // out + var _arg1 C.GTimeType // out + var _arg2 C.gint64 // out + var _cret C.gint // in + + _arg0 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) + _arg1 = C.GTimeType(typ) + _arg2 = C.gint64(time_) + + _cret = C.g_time_zone_find_interval(_arg0, _arg1, _arg2) + runtime.KeepAlive(tz) + runtime.KeepAlive(typ) + runtime.KeepAlive(time_) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Abbreviation determines the time zone abbreviation to be used during a +// particular interval of time in the time zone tz. +// +// For example, in Toronto this is currently "EST" during the winter months and +// "EDT" during the summer months when daylight savings time is in effect. +// +// The function takes the following parameters: +// +// - interval within the timezone. +// +// The function returns the following values: +// +// - utf8: time zone abbreviation, which belongs to tz. +func (tz *TimeZone) Abbreviation(interval int) string { + var _arg0 *C.GTimeZone // out + var _arg1 C.gint // out + var _cret *C.gchar // in + + _arg0 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) + _arg1 = C.gint(interval) + + _cret = C.g_time_zone_get_abbreviation(_arg0, _arg1) + runtime.KeepAlive(tz) + runtime.KeepAlive(interval) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Identifier: get the identifier of this Zone, as passed to g_time_zone_new(). +// If the identifier passed at construction time was not recognised, +// UTC will be returned. If it was NULL, the identifier of the local timezone at +// construction time will be returned. +// +// The identifier will be returned in the same format as provided at +// construction time: if provided as a time offset, that will be returned by +// this function. +// +// The function returns the following values: +// +// - utf8: identifier for this timezone. +func (tz *TimeZone) Identifier() string { + var _arg0 *C.GTimeZone // out + var _cret *C.gchar // in + + _arg0 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) + + _cret = C.g_time_zone_get_identifier(_arg0) + runtime.KeepAlive(tz) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Offset determines the offset to UTC in effect during a particular interval of +// time in the time zone tz. +// +// The offset is the number of seconds that you add to UTC time to arrive at +// local time for tz (ie: negative numbers for time zones west of GMT, positive +// numbers for east). +// +// The function takes the following parameters: +// +// - interval within the timezone. +// +// The function returns the following values: +// +// - gint32: number of seconds that should be added to UTC to get the local +// time in tz. +func (tz *TimeZone) Offset(interval int) int32 { + var _arg0 *C.GTimeZone // out + var _arg1 C.gint // out + var _cret C.gint32 // in + + _arg0 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) + _arg1 = C.gint(interval) + + _cret = C.g_time_zone_get_offset(_arg0, _arg1) + runtime.KeepAlive(tz) + runtime.KeepAlive(interval) + + var _gint32 int32 // out + + _gint32 = int32(_cret) + + return _gint32 +} + +// IsDst determines if daylight savings time is in effect during a particular +// interval of time in the time zone tz. +// +// The function takes the following parameters: +// +// - interval within the timezone. +// +// The function returns the following values: +// +// - ok: TRUE if daylight savings time is in effect. +func (tz *TimeZone) IsDst(interval int) bool { + var _arg0 *C.GTimeZone // out + var _arg1 C.gint // out + var _cret C.gboolean // in + + _arg0 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) + _arg1 = C.gint(interval) + + _cret = C.g_time_zone_is_dst(_arg0, _arg1) + runtime.KeepAlive(tz) + runtime.KeepAlive(interval) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Tree struct is an opaque data structure representing a [balanced binary +// tree][glib-Balanced-Binary-Trees]. It should be accessed only by using the +// following functions. +// +// An instance of this type is always passed by reference. +type Tree struct { + *tree +} + +// tree is the struct that's finalized. +type tree struct { + native *C.GTree +} + +func marshalTree(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Tree{&tree{(*C.GTree)(b)}}, nil +} + +// Destroy removes all keys and values from the #GTree and decreases its +// reference count by one. If keys and/or values are dynamically allocated, you +// should either free them first or create the #GTree using g_tree_new_full(). +// In the latter case the destroy functions you supplied will be called on all +// keys and values before destroying the #GTree. +func (tree *Tree) Destroy() { + var _arg0 *C.GTree // out + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + + C.g_tree_destroy(_arg0) + runtime.KeepAlive(tree) +} + +// Height gets the height of a #GTree. +// +// If the #GTree contains no nodes, the height is 0. If the #GTree contains only +// one root node the height is 1. If the root node has children the height is 2, +// etc. +// +// The function returns the following values: +// +// - gint: height of tree. +func (tree *Tree) Height() int { + var _arg0 *C.GTree // out + var _cret C.gint // in + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + + _cret = C.g_tree_height(_arg0) + runtime.KeepAlive(tree) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Insert inserts a key/value pair into a #GTree. +// +// Inserts a new key and value into a #GTree as g_tree_insert_node() does, +// only this function does not return the inserted or set node. +// +// The function takes the following parameters: +// +// - key (optional) to insert. +// - value (optional) corresponding to the key. +func (tree *Tree) Insert(key unsafe.Pointer, value unsafe.Pointer) { + var _arg0 *C.GTree // out + var _arg1 C.gpointer // out + var _arg2 C.gpointer // out + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + _arg1 = (C.gpointer)(unsafe.Pointer(key)) + _arg2 = (C.gpointer)(unsafe.Pointer(value)) + + C.g_tree_insert(_arg0, _arg1, _arg2) + runtime.KeepAlive(tree) + runtime.KeepAlive(key) + runtime.KeepAlive(value) +} + +// Lookup gets the value corresponding to the given key. Since a #GTree is +// automatically balanced as key/value pairs are added, key lookup is O(log n) +// (where n is the number of key/value pairs in the tree). +// +// The function takes the following parameters: +// +// - key (optional) to look up. +// +// The function returns the following values: +// +// - gpointer (optional): value corresponding to the key, or NULL if the key +// was not found. +func (tree *Tree) Lookup(key unsafe.Pointer) unsafe.Pointer { + var _arg0 *C.GTree // out + var _arg1 C.gconstpointer // out + var _cret C.gpointer // in + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + _arg1 = (C.gconstpointer)(unsafe.Pointer(key)) + + _cret = C.g_tree_lookup(_arg0, _arg1) + runtime.KeepAlive(tree) + runtime.KeepAlive(key) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// LookupExtended looks up a key in the #GTree, returning the original key and +// the associated value. This is useful if you need to free the memory allocated +// for the original key, for example before calling g_tree_remove(). +// +// The function takes the following parameters: +// +// - lookupKey (optional): key to look up. +// +// The function returns the following values: +// +// - origKey (optional) returns the original key. +// - value (optional) returns the value associated with the key. +// - ok: TRUE if the key was found in the #GTree. +func (tree *Tree) LookupExtended(lookupKey unsafe.Pointer) (origKey unsafe.Pointer, value unsafe.Pointer, ok bool) { + var _arg0 *C.GTree // out + var _arg1 C.gconstpointer // out + var _arg2 C.gpointer // in + var _arg3 C.gpointer // in + var _cret C.gboolean // in + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + _arg1 = (C.gconstpointer)(unsafe.Pointer(lookupKey)) + + _cret = C.g_tree_lookup_extended(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(tree) + runtime.KeepAlive(lookupKey) + + var _origKey unsafe.Pointer // out + var _value unsafe.Pointer // out + var _ok bool // out + + _origKey = (unsafe.Pointer)(unsafe.Pointer(_arg2)) + _value = (unsafe.Pointer)(unsafe.Pointer(_arg3)) + if _cret != 0 { + _ok = true + } + + return _origKey, _value, _ok +} + +// Nnodes gets the number of nodes in a #GTree. +// +// The function returns the following values: +// +// - gint: number of nodes in tree +// +// The node counter value type is really a #guint, but it is returned as a +// #gint due to backward compatibility issues (can be cast back to #guint to +// support its full range of values). +func (tree *Tree) Nnodes() int { + var _arg0 *C.GTree // out + var _cret C.gint // in + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + + _cret = C.g_tree_nnodes(_arg0) + runtime.KeepAlive(tree) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Remove removes a key/value pair from a #GTree. +// +// If the #GTree was created using g_tree_new_full(), the key and value are +// freed using the supplied destroy functions, otherwise you have to make sure +// that any dynamically allocated values are freed yourself. If the key does not +// exist in the #GTree, the function does nothing. +// +// The cost of maintaining a balanced tree while removing a key/value result in +// a O(n log(n)) operation where most of the other operations are O(log(n)). +// +// The function takes the following parameters: +// +// - key (optional) to remove. +// +// The function returns the following values: +// +// - ok: TRUE if the key was found (prior to 2.8, this function returned +// nothing). +func (tree *Tree) Remove(key unsafe.Pointer) bool { + var _arg0 *C.GTree // out + var _arg1 C.gconstpointer // out + var _cret C.gboolean // in + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + _arg1 = (C.gconstpointer)(unsafe.Pointer(key)) + + _cret = C.g_tree_remove(_arg0, _arg1) + runtime.KeepAlive(tree) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RemoveAll removes all nodes from a #GTree and destroys their keys and values, +// then resets the #GTree’s root to NULL. +func (tree *Tree) RemoveAll() { + var _arg0 *C.GTree // out + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + + C.g_tree_remove_all(_arg0) + runtime.KeepAlive(tree) +} + +// Replace inserts a new key and value into a #GTree as g_tree_replace_node() +// does, only this function does not return the inserted or set node. +// +// The function takes the following parameters: +// +// - key (optional) to insert. +// - value (optional) corresponding to the key. +func (tree *Tree) Replace(key unsafe.Pointer, value unsafe.Pointer) { + var _arg0 *C.GTree // out + var _arg1 C.gpointer // out + var _arg2 C.gpointer // out + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + _arg1 = (C.gpointer)(unsafe.Pointer(key)) + _arg2 = (C.gpointer)(unsafe.Pointer(value)) + + C.g_tree_replace(_arg0, _arg1, _arg2) + runtime.KeepAlive(tree) + runtime.KeepAlive(key) + runtime.KeepAlive(value) +} + +// Steal removes a key and its associated value from a #GTree without calling +// the key and value destroy functions. +// +// If the key does not exist in the #GTree, the function does nothing. +// +// The function takes the following parameters: +// +// - key (optional) to remove. +// +// The function returns the following values: +// +// - ok: TRUE if the key was found (prior to 2.8, this function returned +// nothing). +func (tree *Tree) Steal(key unsafe.Pointer) bool { + var _arg0 *C.GTree // out + var _arg1 C.gconstpointer // out + var _cret C.gboolean // in + + _arg0 = (*C.GTree)(gextras.StructNative(unsafe.Pointer(tree))) + _arg1 = (C.gconstpointer)(unsafe.Pointer(key)) + + _cret = C.g_tree_steal(_arg0, _arg1) + runtime.KeepAlive(tree) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Tuples struct is used to return records (or tuples) from the #GRelation +// by g_relation_select(). It only contains one public member - the number +// of records that matched. To access the matched records, you must use +// g_tuples_index(). +// +// Deprecated: Rarely used API. +// +// An instance of this type is always passed by reference. +type Tuples struct { + *tuples +} + +// tuples is the struct that's finalized. +type tuples struct { + native *C.GTuples +} + +// NewTuples creates a new Tuples instance from the given +// fields. Beware that this function allocates on the Go heap; be careful +// when using it! +func NewTuples(len uint) Tuples { + var f0 C.guint // out + f0 = C.guint(len) + + v := C.GTuples{ + len: f0, + } + + return *(*Tuples)(gextras.NewStructNative(unsafe.Pointer(&v))) +} + +// Len: number of records that matched. +func (t *Tuples) Len() uint { + valptr := &t.native.len + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Len: number of records that matched. +func (t *Tuples) SetLen(len uint) { + valptr := &t.native.len + *valptr = C.guint(len) +} + +// Destroy frees the records which were returned by g_relation_select(). +// This should always be called after g_relation_select() when you are finished +// with the records. The records are not removed from the #GRelation. +// +// Deprecated: Rarely used API. +func (tuples *Tuples) Destroy() { + var _arg0 *C.GTuples // out + + _arg0 = (*C.GTuples)(gextras.StructNative(unsafe.Pointer(tuples))) + + C.g_tuples_destroy(_arg0) + runtime.KeepAlive(tuples) +} + +// Index gets a field from the records returned by g_relation_select(). +// It returns the given field of the record at the given index. The returned +// value should not be changed. +// +// Deprecated: Rarely used API. +// +// The function takes the following parameters: +// +// - index_: index of the record. +// - field to return. +// +// The function returns the following values: +// +// - gpointer (optional): field of the record. +func (tuples *Tuples) Index(index_ int, field int) unsafe.Pointer { + var _arg0 *C.GTuples // out + var _arg1 C.gint // out + var _arg2 C.gint // out + var _cret C.gpointer // in + + _arg0 = (*C.GTuples)(gextras.StructNative(unsafe.Pointer(tuples))) + _arg1 = C.gint(index_) + _arg2 = C.gint(field) + + _cret = C.g_tuples_index(_arg0, _arg1, _arg2) + runtime.KeepAlive(tuples) + runtime.KeepAlive(index_) + runtime.KeepAlive(field) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// URI: GUri type and related functions can be used to parse URIs into their +// components, and build valid URIs from individual components. +// +// Since GUri only represents absolute URIs, all GUris will have a URI scheme, +// so glib.URI.GetScheme() will always return a non-NULL answer. Likewise, +// by definition, all URIs have a path component, so glib.URI.GetPath() will +// always return a non-NULL string (which may be empty). +// +// If the URI string has an ‘authority’ component +// (https://tools.ietf.org/html/rfc3986#section-3) (that is, if the scheme is +// followed by :// rather than just :), then the GUri will contain a hostname, +// and possibly a port and ‘userinfo’. Additionally, depending on how the GUri +// was constructed/parsed (for example, using the G_URI_FLAGS_HAS_PASSWORD and +// G_URI_FLAGS_HAS_AUTH_PARAMS flags), the userinfo may be split out into a +// username, password, and additional authorization-related parameters. +// +// Normally, the components of a GUri will have all %-encoded characters +// decoded. However, if you construct/parse a GUri with G_URI_FLAGS_ENCODED, +// then the %-encoding will be preserved instead in the userinfo, +// path, and query fields (and in the host field if also created with +// G_URI_FLAGS_NON_DNS). In particular, this is necessary if the URI may contain +// binary data or non-UTF-8 text, or if decoding the components might change the +// interpretation of the URI. +// +// For example, with the encoded flag: +// +// g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http3A2F2Fhost2Fpath3Fparam3Dvalue", G_URI_FLAGS_ENCODED, &err); +// g_assert_cmpstr (g_uri_get_query (uri), ==, "query=http3A2F2Fhost2Fpath3Fparam3Dvalue"); +// +// While the default %-decoding behaviour would give: +// +// g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http3A2F2Fhost2Fpath3Fparam3Dvalue", G_URI_FLAGS_NONE, &err); +// g_assert_cmpstr (g_uri_get_query (uri), ==, "query=http://host/path?param=value"); +// +// During decoding, if an invalid UTF-8 string is encountered, parsing will fail +// with an error indicating the bad string location: +// +// g_autoptr(GUri) uri = g_uri_parse ("http://host/path?query=http3A2F2Fhost2Fpath3Fbad3D00alue", G_URI_FLAGS_NONE, &err); +// g_assert_error (err, G_URI_ERROR, G_URI_ERROR_BAD_QUERY); +// +// You should pass G_URI_FLAGS_ENCODED or G_URI_FLAGS_ENCODED_QUERY if you need +// to handle that case manually. In particular, if the query string contains = +// characters that are %-encoded, you should let glib.URI().ParseParams do the +// decoding once of the query. +// +// GUri is immutable once constructed, and can safely be accessed from multiple +// threads. Its reference counting is atomic. +// +// Note that the scope of GUri is to help manipulate URIs in various +// applications, following RFC 3986 (https://tools.ietf.org/html/rfc3986). +// In particular, it doesn't intend to cover web browser needs, +// and doesn’t implement the WHATWG URL (https://url.spec.whatwg.org/) +// standard. No APIs are provided to help prevent homograph attacks +// (https://en.wikipedia.org/wiki/IDN_homograph_attack), so GUri is not suitable +// for formatting URIs for display to the user for making security-sensitive +// decisions. +// +// # Relative and absolute URIs +// +// As defined in RFC 3986 (https://tools.ietf.org/html/rfc3986#section-4), +// the hierarchical nature of URIs means that they can either +// be ‘relative references’ (sometimes referred to as ‘relative +// URIs’) or ‘URIs’ (for clarity, ‘URIs’ are referred to in this +// documentation as ‘absolute URIs’ — although in constrast to RFC 3986 +// (https://tools.ietf.org/html/rfc3986#section-4.3), fragment identifiers are +// always allowed). +// +// Relative references have one or more components of the URI missing. +// In particular, they have no scheme. Any other component, such as hostname, +// query, etc. may be missing, apart from a path, which has to be specified (but +// may be empty). The path may be relative, starting with ./ rather than /. +// +// For example, a valid relative reference is ./path?query, /?query#fragment or +// //example.com. +// +// Absolute URIs have a scheme specified. Any other components of the URI which +// are missing are specified as explicitly unset in the URI, rather than being +// resolved relative to a base URI using glib.URI.ParseRelative(). +// +// For example, a valid absolute URI is file:///home/bob or +// https://search.com?query=string. +// +// A GUri instance is always an absolute URI. A string may be an absolute URI +// or a relative reference; see the documentation for individual functions as to +// what forms they accept. +// +// # Parsing URIs +// +// The most minimalist APIs for parsing URIs are glib.URI().Split and +// glib.URI().SplitWithUser. These split a URI into its component parts, +// and return the parts; the difference between the two is that glib.URI().Split +// treats the ‘userinfo’ component of the URI as a single element, while +// glib.URI().SplitWithUser can (depending on the glib.URIFlags you pass) +// treat it as containing a username, password, and authentication parameters. +// Alternatively, glib.URI().SplitNetwork can be used when you are only +// interested in the components that are needed to initiate a network connection +// to the service (scheme, host, and port). +// +// glib.URI().Parse is similar to glib.URI().Split, but instead of returning +// individual strings, it returns a GUri structure (and it requires that the URI +// be an absolute URI). +// +// glib.URI().ResolveRelative and glib.URI.ParseRelative() allow you to resolve +// a relative URI relative to a base URI. glib.URI().ResolveRelative takes two +// strings and returns a string, and glib.URI.ParseRelative() takes a GUri and a +// string and returns a GUri. +// +// All of the parsing functions take a glib.URIFlags argument describing exactly +// how to parse the URI; see the documentation for that type for more details on +// the specific flags that you can pass. If you need to choose different flags +// based on the type of URI, you can use glib.URI().PeekScheme on the URI string +// to check the scheme first, and use that to decide what flags to parse it +// with. +// +// For example, you might want to use G_URI_PARAMS_WWW_FORM when parsing the +// params for a web URI, so compare the result of glib.URI().PeekScheme against +// http and https. +// +// # Building URIs +// +// glib.URI().Join and glib.URI().JoinWithUser can be used to construct +// valid URI strings from a set of component strings. They are the inverse of +// glib.URI().Split and glib.URI().SplitWithUser. +// +// Similarly, glib.URI().Build and glib.URI().BuildWithUser can be used to +// construct a GUri from a set of component strings. +// +// As with the parsing functions, the building functions take a glib.URIFlags +// argument. In particular, it is important to keep in mind whether the URI +// components you are using are already %-encoded. If so, you must pass the +// G_URI_FLAGS_ENCODED flag. +// +// file:// URIs +// +// Note that Windows and Unix both define special rules for parsing file:// +// URIs (involving non-UTF-8 character sets on Unix, and the interpretation +// of path separators on Windows). GUri does not implement these rules. +// Use glib.FilenameFromURI() and glib.FilenameToURI() if you want to properly +// convert between file:// URIs and local filenames. +// +// # URI Equality +// +// Note that there is no g_uri_equal () function, because comparing URIs +// usefully requires scheme-specific knowledge that GUri does not have. GUri can +// help with normalization if you use the various encoded glib.URIFlags as well +// as G_URI_FLAGS_SCHEME_NORMALIZE however it is not comprehensive. For example, +// data:,foo and data:;base64,Zm9v resolve to the same thing according to the +// data: URI specification which GLib does not handle. +// +// An instance of this type is always passed by reference. +type URI struct { + *urI +} + +// urI is the struct that's finalized. +type urI struct { + native *C.GUri +} + +func marshalURI(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &URI{&urI{(*C.GUri)(b)}}, nil +} + +// AuthParams gets uri's authentication parameters, which may contain +// %-encoding, depending on the flags with which uri was created. (If uri was +// not created with G_URI_FLAGS_HAS_AUTH_PARAMS then this will be NULL.) +// +// Depending on the URI scheme, g_uri_parse_params() may be useful for further +// parsing this information. +// +// The function returns the following values: +// +// - utf8 (optional) uri's authentication parameters. +func (uri *URI) AuthParams() string { + var _arg0 *C.GUri // out + var _cret *C.gchar // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_auth_params(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Flags gets uri's flags set upon construction. +// +// The function returns the following values: +// +// - uriFlags uri's flags. +func (uri *URI) Flags() URIFlags { + var _arg0 *C.GUri // out + var _cret C.GUriFlags // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_flags(_arg0) + runtime.KeepAlive(uri) + + var _uriFlags URIFlags // out + + _uriFlags = URIFlags(_cret) + + return _uriFlags +} + +// Fragment gets uri's fragment, which may contain %-encoding, depending on the +// flags with which uri was created. +// +// The function returns the following values: +// +// - utf8 (optional) uri's fragment. +func (uri *URI) Fragment() string { + var _arg0 *C.GUri // out + var _cret *C.gchar // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_fragment(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Host gets uri's host. This will never have %-encoded characters, +// unless it is non-UTF-8 (which can only be the case if uri was created with +// G_URI_FLAGS_NON_DNS). +// +// If uri contained an IPv6 address literal, this value will be just that +// address, without the brackets around it that are necessary in the string form +// of the URI. Note that in this case there may also be a scope ID attached to +// the address. Eg, fe80::1234em1 (or fe80::123425em1 if the string is still +// encoded). +// +// The function returns the following values: +// +// - utf8 (optional) uri's host. +func (uri *URI) Host() string { + var _arg0 *C.GUri // out + var _cret *C.gchar // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_host(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Password gets uri's password, which may contain %-encoding, depending +// on the flags with which uri was created. (If uri was not created with +// G_URI_FLAGS_HAS_PASSWORD then this will be NULL.). +// +// The function returns the following values: +// +// - utf8 (optional) uri's password. +func (uri *URI) Password() string { + var _arg0 *C.GUri // out + var _cret *C.gchar // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_password(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Path gets uri's path, which may contain %-encoding, depending on the flags +// with which uri was created. +// +// The function returns the following values: +// +// - utf8 uri's path. +func (uri *URI) Path() string { + var _arg0 *C.GUri // out + var _cret *C.gchar // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_path(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Port gets uri's port. +// +// The function returns the following values: +// +// - gint uri's port, or -1 if no port was specified. +func (uri *URI) Port() int { + var _arg0 *C.GUri // out + var _cret C.gint // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_port(_arg0) + runtime.KeepAlive(uri) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Query gets uri's query, which may contain %-encoding, depending on the flags +// with which uri was created. +// +// For queries consisting of a series of name=value parameters, ParamsIter or +// g_uri_parse_params() may be useful. +// +// The function returns the following values: +// +// - utf8 (optional) uri's query. +func (uri *URI) Query() string { + var _arg0 *C.GUri // out + var _cret *C.gchar // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_query(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Scheme gets uri's scheme. Note that this will always be all-lowercase, +// regardless of the string or strings that uri was created from. +// +// The function returns the following values: +// +// - utf8 uri's scheme. +func (uri *URI) Scheme() string { + var _arg0 *C.GUri // out + var _cret *C.gchar // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_scheme(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// User gets the ‘username’ component of uri's userinfo, which may contain +// %-encoding, depending on the flags with which uri was created. If uri was +// not created with G_URI_FLAGS_HAS_PASSWORD or G_URI_FLAGS_HAS_AUTH_PARAMS, +// this is the same as g_uri_get_userinfo(). +// +// The function returns the following values: +// +// - utf8 (optional) uri's user. +func (uri *URI) User() string { + var _arg0 *C.GUri // out + var _cret *C.gchar // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_user(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Userinfo gets uri's userinfo, which may contain %-encoding, depending on the +// flags with which uri was created. +// +// The function returns the following values: +// +// - utf8 (optional) uri's userinfo. +func (uri *URI) Userinfo() string { + var _arg0 *C.GUri // out + var _cret *C.gchar // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_get_userinfo(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ParseRelative parses uri_ref according to flags and, if it is a relative +// URI (#relative-and-absolute-uris), resolves it relative to base_uri. +// If the result is not a valid absolute URI, it will be discarded, and an error +// returned. +// +// The function takes the following parameters: +// +// - uriRef: string representing a relative or absolute URI. +// - flags describing how to parse uri_ref. +// +// The function returns the following values: +// +// - uri: new #GUri, or NULL on error. +func (baseUri *URI) ParseRelative(uriRef string, flags URIFlags) (*URI, error) { + var _arg0 *C.GUri // out + var _arg1 *C.gchar // out + var _arg2 C.GUriFlags // out + var _cret *C.GUri // in + var _cerr *C.GError // in + + if baseUri != nil { + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(baseUri))) + } + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uriRef))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GUriFlags(flags) + + _cret = C.g_uri_parse_relative(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(baseUri) + runtime.KeepAlive(uriRef) + runtime.KeepAlive(flags) + + var _uri *URI // out + var _goerr error // out + + _uri = (*URI)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_uri)), + func(intern *struct{ C unsafe.Pointer }) { + C.free(intern.C) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _uri, _goerr +} + +// String returns a string representing uri. +// +// This is not guaranteed to return a string which is identical to the string +// that uri was parsed from. However, if the source URI was syntactically +// correct (according to RFC 3986), and it was parsed with G_URI_FLAGS_ENCODED, +// then g_uri_to_string() is guaranteed to return a string which is at least +// semantically equivalent to the source URI (according to RFC 3986). +// +// If uri might contain sensitive details, such as authentication parameters, +// or private data in its query string, and the returned string is going to be +// logged, then consider using g_uri_to_string_partial() to redact parts. +// +// The function returns the following values: +// +// - utf8: string representing uri, which the caller must free. +func (uri *URI) String() string { + var _arg0 *C.GUri // out + var _cret *C.char // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + + _cret = C.g_uri_to_string(_arg0) + runtime.KeepAlive(uri) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// ToStringPartial returns a string representing uri, subject to the options in +// flags. See g_uri_to_string() and HideFlags for more details. +// +// The function takes the following parameters: +// +// - flags describing what parts of uri to hide. +// +// The function returns the following values: +// +// - utf8: string representing uri, which the caller must free. +func (uri *URI) ToStringPartial(flags URIHideFlags) string { + var _arg0 *C.GUri // out + var _arg1 C.GUriHideFlags // out + var _cret *C.char // in + + _arg0 = (*C.GUri)(gextras.StructNative(unsafe.Pointer(uri))) + _arg1 = C.GUriHideFlags(flags) + + _cret = C.g_uri_to_string_partial(_arg0, _arg1) + runtime.KeepAlive(uri) + runtime.KeepAlive(flags) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// URIBuild creates a new #GUri from the given components according to flags. +// +// See also g_uri_build_with_user(), which allows specifying the components of +// the "userinfo" separately. +// +// The function takes the following parameters: +// +// - flags describing how to build the #GUri. +// - scheme: URI scheme. +// - userinfo (optional) component, or NULL. +// - host (optional) component, or NULL. +// - port: port, or -1. +// - path component. +// - query (optional) component, or NULL. +// - fragment (optional): fragment, or NULL. +// +// The function returns the following values: +// +// - uri: new #GUri. +func URIBuild(flags URIFlags, scheme, userinfo, host string, port int, path, query, fragment string) *URI { + var _arg1 C.GUriFlags // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 C.gint // out + var _arg6 *C.gchar // out + var _arg7 *C.gchar // out + var _arg8 *C.gchar // out + var _cret *C.GUri // in + + _arg1 = C.GUriFlags(flags) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(scheme))) + defer C.free(unsafe.Pointer(_arg2)) + if userinfo != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(userinfo))) + defer C.free(unsafe.Pointer(_arg3)) + } + if host != "" { + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(host))) + defer C.free(unsafe.Pointer(_arg4)) + } + _arg5 = C.gint(port) + _arg6 = (*C.gchar)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg6)) + if query != "" { + _arg7 = (*C.gchar)(unsafe.Pointer(C.CString(query))) + defer C.free(unsafe.Pointer(_arg7)) + } + if fragment != "" { + _arg8 = (*C.gchar)(unsafe.Pointer(C.CString(fragment))) + defer C.free(unsafe.Pointer(_arg8)) + } + + _cret = C.g_uri_build(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) + runtime.KeepAlive(flags) + runtime.KeepAlive(scheme) + runtime.KeepAlive(userinfo) + runtime.KeepAlive(host) + runtime.KeepAlive(port) + runtime.KeepAlive(path) + runtime.KeepAlive(query) + runtime.KeepAlive(fragment) + + var _uri *URI // out + + _uri = (*URI)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_uri)), + func(intern *struct{ C unsafe.Pointer }) { + C.free(intern.C) + }, + ) + + return _uri +} + +// URIBuildWithUser creates a new #GUri from the given components according to +// flags (G_URI_FLAGS_HAS_PASSWORD is added unconditionally). The flags must +// be coherent with the passed values, in particular use %-encoded values with +// G_URI_FLAGS_ENCODED. +// +// In contrast to g_uri_build(), this allows specifying the components of the +// ‘userinfo’ field separately. Note that user must be non-NULL if either +// password or auth_params is non-NULL. +// +// The function takes the following parameters: +// +// - flags describing how to build the #GUri. +// - scheme: URI scheme. +// - user (optional) component of the userinfo, or NULL. +// - password (optional) component of the userinfo, or NULL. +// - authParams (optional): auth params of the userinfo, or NULL. +// - host (optional) component, or NULL. +// - port: port, or -1. +// - path component. +// - query (optional) component, or NULL. +// - fragment (optional): fragment, or NULL. +// +// The function returns the following values: +// +// - uri: new #GUri. +func URIBuildWithUser(flags URIFlags, scheme, user, password, authParams, host string, port int, path, query, fragment string) *URI { + var _arg1 C.GUriFlags // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 *C.gchar // out + var _arg6 *C.gchar // out + var _arg7 C.gint // out + var _arg8 *C.gchar // out + var _arg9 *C.gchar // out + var _arg10 *C.gchar // out + var _cret *C.GUri // in + + _arg1 = C.GUriFlags(flags) + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(scheme))) + defer C.free(unsafe.Pointer(_arg2)) + if user != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(user))) + defer C.free(unsafe.Pointer(_arg3)) + } + if password != "" { + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(password))) + defer C.free(unsafe.Pointer(_arg4)) + } + if authParams != "" { + _arg5 = (*C.gchar)(unsafe.Pointer(C.CString(authParams))) + defer C.free(unsafe.Pointer(_arg5)) + } + if host != "" { + _arg6 = (*C.gchar)(unsafe.Pointer(C.CString(host))) + defer C.free(unsafe.Pointer(_arg6)) + } + _arg7 = C.gint(port) + _arg8 = (*C.gchar)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg8)) + if query != "" { + _arg9 = (*C.gchar)(unsafe.Pointer(C.CString(query))) + defer C.free(unsafe.Pointer(_arg9)) + } + if fragment != "" { + _arg10 = (*C.gchar)(unsafe.Pointer(C.CString(fragment))) + defer C.free(unsafe.Pointer(_arg10)) + } + + _cret = C.g_uri_build_with_user(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10) + runtime.KeepAlive(flags) + runtime.KeepAlive(scheme) + runtime.KeepAlive(user) + runtime.KeepAlive(password) + runtime.KeepAlive(authParams) + runtime.KeepAlive(host) + runtime.KeepAlive(port) + runtime.KeepAlive(path) + runtime.KeepAlive(query) + runtime.KeepAlive(fragment) + + var _uri *URI // out + + _uri = (*URI)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_uri)), + func(intern *struct{ C unsafe.Pointer }) { + C.free(intern.C) + }, + ) + + return _uri +} + +func URIErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_uri_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// URIEscapeBytes escapes arbitrary data for use in a URI. +// +// Normally all characters that are not ‘unreserved’ (i.e. ASCII alphanumerical +// characters plus dash, dot, underscore and tilde) are escaped. But if you +// specify characters in reserved_chars_allowed they are not escaped. This is +// useful for the ‘reserved’ characters in the URI specification, since those +// are allowed unescaped in some portions of a URI. +// +// Though technically incorrect, this will also allow escaping nul bytes as 00. +// +// The function takes the following parameters: +// +// - unescaped input data. +// - reservedCharsAllowed (optional): string of reserved characters that are +// allowed to be used, or NULL. +// +// The function returns the following values: +// +// - utf8: escaped version of unescaped. The returned string should be freed +// when no longer needed. +func URIEscapeBytes(unescaped []byte, reservedCharsAllowed string) string { + var _arg1 *C.guint8 // out + var _arg2 C.gsize + var _arg3 *C.char // out + var _cret *C.char // in + + _arg2 = (C.gsize)(len(unescaped)) + if len(unescaped) > 0 { + _arg1 = (*C.guint8)(unsafe.Pointer(&unescaped[0])) + } + if reservedCharsAllowed != "" { + _arg3 = (*C.char)(unsafe.Pointer(C.CString(reservedCharsAllowed))) + defer C.free(unsafe.Pointer(_arg3)) + } + + _cret = C.g_uri_escape_bytes(_arg1, _arg2, _arg3) + runtime.KeepAlive(unescaped) + runtime.KeepAlive(reservedCharsAllowed) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// URIEscapeString escapes a string for use in a URI. +// +// Normally all characters that are not "unreserved" (i.e. ASCII alphanumerical +// characters plus dash, dot, underscore and tilde) are escaped. But if you +// specify characters in reserved_chars_allowed they are not escaped. This is +// useful for the "reserved" characters in the URI specification, since those +// are allowed unescaped in some portions of a URI. +// +// The function takes the following parameters: +// +// - unescaped input string. +// - reservedCharsAllowed (optional): string of reserved characters that are +// allowed to be used, or NULL. +// - allowUtf8: TRUE if the result can include UTF-8 characters. +// +// The function returns the following values: +// +// - utf8: escaped version of unescaped. The returned string should be freed +// when no longer needed. +func URIEscapeString(unescaped, reservedCharsAllowed string, allowUtf8 bool) string { + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 C.gboolean // out + var _cret *C.char // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(unescaped))) + defer C.free(unsafe.Pointer(_arg1)) + if reservedCharsAllowed != "" { + _arg2 = (*C.char)(unsafe.Pointer(C.CString(reservedCharsAllowed))) + defer C.free(unsafe.Pointer(_arg2)) + } + if allowUtf8 { + _arg3 = C.TRUE + } + + _cret = C.g_uri_escape_string(_arg1, _arg2, _arg3) + runtime.KeepAlive(unescaped) + runtime.KeepAlive(reservedCharsAllowed) + runtime.KeepAlive(allowUtf8) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// URIIsValid parses uri_string according to flags, to determine whether it is a +// valid absolute URI (#relative-and-absolute-uris), i.e. it does not need to be +// resolved relative to another URI using g_uri_parse_relative(). +// +// If it’s not a valid URI, an error is returned explaining how it’s invalid. +// +// See g_uri_split(), and the definition of Flags, for more information on the +// effect of flags. +// +// The function takes the following parameters: +// +// - uriString: string containing an absolute URI. +// - flags for parsing uri_string. +func URIIsValid(uriString string, flags URIFlags) error { + var _arg1 *C.gchar // out + var _arg2 C.GUriFlags // out + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uriString))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GUriFlags(flags) + + C.g_uri_is_valid(_arg1, _arg2, &_cerr) + runtime.KeepAlive(uriString) + runtime.KeepAlive(flags) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// URIJoin joins the given components together according to flags to create +// an absolute URI string. path may not be NULL (though it may be the empty +// string). +// +// When host is present, path must either be empty or begin with +// a slash (/) character. When host is not present, path cannot +// begin with two slash characters (//). See RFC 3986, section 3 +// (https://tools.ietf.org/html/rfc3986#section-3). +// +// See also g_uri_join_with_user(), which allows specifying the components of +// the ‘userinfo’ separately. +// +// G_URI_FLAGS_HAS_PASSWORD and G_URI_FLAGS_HAS_AUTH_PARAMS are ignored if set +// in flags. +// +// The function takes the following parameters: +// +// - flags describing how to build the URI string. +// - scheme (optional): URI scheme, or NULL. +// - userinfo (optional) component, or NULL. +// - host (optional) component, or NULL. +// - port: port, or -1. +// - path component. +// - query (optional) component, or NULL. +// - fragment (optional): fragment, or NULL. +// +// The function returns the following values: +// +// - utf8: absolute URI string. +func URIJoin(flags URIFlags, scheme, userinfo, host string, port int, path, query, fragment string) string { + var _arg1 C.GUriFlags // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 C.gint // out + var _arg6 *C.gchar // out + var _arg7 *C.gchar // out + var _arg8 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = C.GUriFlags(flags) + if scheme != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(scheme))) + defer C.free(unsafe.Pointer(_arg2)) + } + if userinfo != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(userinfo))) + defer C.free(unsafe.Pointer(_arg3)) + } + if host != "" { + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(host))) + defer C.free(unsafe.Pointer(_arg4)) + } + _arg5 = C.gint(port) + _arg6 = (*C.gchar)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg6)) + if query != "" { + _arg7 = (*C.gchar)(unsafe.Pointer(C.CString(query))) + defer C.free(unsafe.Pointer(_arg7)) + } + if fragment != "" { + _arg8 = (*C.gchar)(unsafe.Pointer(C.CString(fragment))) + defer C.free(unsafe.Pointer(_arg8)) + } + + _cret = C.g_uri_join(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) + runtime.KeepAlive(flags) + runtime.KeepAlive(scheme) + runtime.KeepAlive(userinfo) + runtime.KeepAlive(host) + runtime.KeepAlive(port) + runtime.KeepAlive(path) + runtime.KeepAlive(query) + runtime.KeepAlive(fragment) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// URIJoinWithUser joins the given components together according to flags to +// create an absolute URI string. path may not be NULL (though it may be the +// empty string). +// +// In contrast to g_uri_join(), this allows specifying the components of the +// ‘userinfo’ separately. It otherwise behaves the same. +// +// G_URI_FLAGS_HAS_PASSWORD and G_URI_FLAGS_HAS_AUTH_PARAMS are ignored if set +// in flags. +// +// The function takes the following parameters: +// +// - flags describing how to build the URI string. +// - scheme (optional): URI scheme, or NULL. +// - user (optional) component of the userinfo, or NULL. +// - password (optional) component of the userinfo, or NULL. +// - authParams (optional): auth params of the userinfo, or NULL. +// - host (optional) component, or NULL. +// - port: port, or -1. +// - path component. +// - query (optional) component, or NULL. +// - fragment (optional): fragment, or NULL. +// +// The function returns the following values: +// +// - utf8: absolute URI string. +func URIJoinWithUser(flags URIFlags, scheme, user, password, authParams, host string, port int, path, query, fragment string) string { + var _arg1 C.GUriFlags // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // out + var _arg4 *C.gchar // out + var _arg5 *C.gchar // out + var _arg6 *C.gchar // out + var _arg7 C.gint // out + var _arg8 *C.gchar // out + var _arg9 *C.gchar // out + var _arg10 *C.gchar // out + var _cret *C.gchar // in + + _arg1 = C.GUriFlags(flags) + if scheme != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(scheme))) + defer C.free(unsafe.Pointer(_arg2)) + } + if user != "" { + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(user))) + defer C.free(unsafe.Pointer(_arg3)) + } + if password != "" { + _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(password))) + defer C.free(unsafe.Pointer(_arg4)) + } + if authParams != "" { + _arg5 = (*C.gchar)(unsafe.Pointer(C.CString(authParams))) + defer C.free(unsafe.Pointer(_arg5)) + } + if host != "" { + _arg6 = (*C.gchar)(unsafe.Pointer(C.CString(host))) + defer C.free(unsafe.Pointer(_arg6)) + } + _arg7 = C.gint(port) + _arg8 = (*C.gchar)(unsafe.Pointer(C.CString(path))) + defer C.free(unsafe.Pointer(_arg8)) + if query != "" { + _arg9 = (*C.gchar)(unsafe.Pointer(C.CString(query))) + defer C.free(unsafe.Pointer(_arg9)) + } + if fragment != "" { + _arg10 = (*C.gchar)(unsafe.Pointer(C.CString(fragment))) + defer C.free(unsafe.Pointer(_arg10)) + } + + _cret = C.g_uri_join_with_user(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10) + runtime.KeepAlive(flags) + runtime.KeepAlive(scheme) + runtime.KeepAlive(user) + runtime.KeepAlive(password) + runtime.KeepAlive(authParams) + runtime.KeepAlive(host) + runtime.KeepAlive(port) + runtime.KeepAlive(path) + runtime.KeepAlive(query) + runtime.KeepAlive(fragment) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// URIListExtractURIs splits an URI list conforming to the text/uri-list mime +// type defined in RFC 2483 into individual URIs, discarding any comments. +// The URIs are not validated. +// +// The function takes the following parameters: +// +// - uriList: URI list. +// +// The function returns the following values: +// +// - utf8s: newly allocated NULL-terminated list of strings holding the +// individual URIs. The array should be freed with g_strfreev(). +func URIListExtractURIs(uriList string) []string { + var _arg1 *C.gchar // out + var _cret **C.gchar // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uriList))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_uri_list_extract_uris(_arg1) + runtime.KeepAlive(uriList) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// URIParse parses uri_string according to flags. If the result is not a valid +// absolute URI (#relative-and-absolute-uris), it will be discarded, and an +// error returned. +// +// The function takes the following parameters: +// +// - uriString: string representing an absolute URI. +// - flags describing how to parse uri_string. +// +// The function returns the following values: +// +// - uri: new #GUri, or NULL on error. +func URIParse(uriString string, flags URIFlags) (*URI, error) { + var _arg1 *C.gchar // out + var _arg2 C.GUriFlags // out + var _cret *C.GUri // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uriString))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GUriFlags(flags) + + _cret = C.g_uri_parse(_arg1, _arg2, &_cerr) + runtime.KeepAlive(uriString) + runtime.KeepAlive(flags) + + var _uri *URI // out + var _goerr error // out + + _uri = (*URI)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_uri)), + func(intern *struct{ C unsafe.Pointer }) { + C.free(intern.C) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _uri, _goerr +} + +// URIParseParams: many URI schemes include one or more attribute/value pairs +// as part of the URI value. This method can be used to parse them into a hash +// table. When an attribute has multiple occurrences, the last value is the +// final returned value. If you need to handle repeated attributes differently, +// use ParamsIter. +// +// The params string is assumed to still be %-encoded, but the returned values +// will be fully decoded. (Thus it is possible that the returned values may +// contain = or separators, if the value was encoded in the input.) Invalid +// %-encoding is treated as with the G_URI_FLAGS_PARSE_RELAXED rules for +// g_uri_parse(). (However, if params is the path or query string from a #GUri +// that was parsed without G_URI_FLAGS_PARSE_RELAXED and G_URI_FLAGS_ENCODED, +// then you already know that it does not contain any invalid encoding.) +// +// G_URI_PARAMS_WWW_FORM is handled as documented for g_uri_params_iter_init(). +// +// If G_URI_PARAMS_CASE_INSENSITIVE is passed to flags, attributes will be +// compared case-insensitively, so a params string attr=123&Attr=456 will only +// return a single attribute–value pair, Attr=456. Case will be preserved in the +// returned attributes. +// +// If params cannot be parsed (for example, it contains two separators +// characters in a row), then error is set and NULL is returned. +// +// The function takes the following parameters: +// +// - params: %-encoded string containing attribute=value parameters. +// - separators: separator byte character set between parameters. (usually &, +// but sometimes ; or both &;). Note that this function works on bytes not +// characters, so it can't be used to delimit UTF-8 strings for anything but +// ASCII characters. You may pass an empty set, in which case no splitting +// will occur. +// - flags to modify the way the parameters are handled. +// +// The function returns the following values: +// +// - hashTable: A hash table of attribute/value pairs, with both names and +// values fully-decoded; or NULL on error. +func URIParseParams(params, separators string, flags URIParamsFlags) (map[string]string, error) { + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 *C.gchar // out + var _arg4 C.GUriParamsFlags // out + var _cret *C.GHashTable // in + var _cerr *C.GError // in + + _arg2 = (C.gssize)(len(params)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(params) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(params)), params) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(separators))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = C.GUriParamsFlags(flags) + + _cret = C.g_uri_parse_params(_arg1, _arg2, _arg3, _arg4, &_cerr) + runtime.KeepAlive(params) + runtime.KeepAlive(separators) + runtime.KeepAlive(flags) + + var _hashTable map[string]string // out + var _goerr error // out + + _hashTable = make(map[string]string, gextras.HashTableSize(unsafe.Pointer(_cret))) + gextras.MoveHashTable(unsafe.Pointer(_cret), true, func(k, v unsafe.Pointer) { + ksrc := *(**C.gchar)(k) + vsrc := *(**C.gchar)(v) + var kdst string // out + var vdst string // out + kdst = C.GoString((*C.gchar)(unsafe.Pointer(ksrc))) + defer C.free(unsafe.Pointer(ksrc)) + vdst = C.GoString((*C.gchar)(unsafe.Pointer(vsrc))) + defer C.free(unsafe.Pointer(vsrc)) + _hashTable[kdst] = vdst + }) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _hashTable, _goerr +} + +// URIParseScheme gets the scheme portion of a URI string. RFC 3986 +// (https://tools.ietf.org/html/rfc3986#section-3) decodes the scheme as: +// +// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] +// +// Common schemes include file, https, svn+ssh, etc. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - utf8 (optional): ‘scheme’ component of the URI, or NULL on error. +// The returned string should be freed when no longer needed. +func URIParseScheme(uri string) string { + var _arg1 *C.char // out + var _cret *C.char // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_uri_parse_scheme(_arg1) + runtime.KeepAlive(uri) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// URIPeekScheme gets the scheme portion of a URI string. RFC 3986 +// (https://tools.ietf.org/html/rfc3986#section-3) decodes the scheme as: +// +// URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] +// +// Common schemes include file, https, svn+ssh, etc. +// +// Unlike g_uri_parse_scheme(), the returned scheme is normalized to +// all-lowercase and does not need to be freed. +// +// The function takes the following parameters: +// +// - uri: valid URI. +// +// The function returns the following values: +// +// - utf8 (optional): ‘scheme’ component of the URI, or NULL on error. +// The returned string is normalized to all-lowercase, and interned via +// g_intern_string(), so it does not need to be freed. +func URIPeekScheme(uri string) string { + var _arg1 *C.char // out + var _cret *C.char // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_uri_peek_scheme(_arg1) + runtime.KeepAlive(uri) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// URIResolveRelative parses uri_ref according to flags and, if it is a relative +// URI (#relative-and-absolute-uris), resolves it relative to base_uri_string. +// If the result is not a valid absolute URI, it will be discarded, and an error +// returned. +// +// (If base_uri_string is NULL, this just returns uri_ref, or NULL if uri_ref is +// invalid or not absolute.). +// +// The function takes the following parameters: +// +// - baseUriString (optional): string representing a base URI. +// - uriRef: string representing a relative or absolute URI. +// - flags describing how to parse uri_ref. +// +// The function returns the following values: +// +// - utf8: resolved URI string, or NULL on error. +func URIResolveRelative(baseUriString, uriRef string, flags URIFlags) (string, error) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 C.GUriFlags // out + var _cret *C.gchar // in + var _cerr *C.GError // in + + if baseUriString != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(baseUriString))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(uriRef))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.GUriFlags(flags) + + _cret = C.g_uri_resolve_relative(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(baseUriString) + runtime.KeepAlive(uriRef) + runtime.KeepAlive(flags) + + var _utf8 string // out + var _goerr error // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _utf8, _goerr +} + +// URISplit parses uri_ref (which can be an absolute or relative URI +// (#relative-and-absolute-uris)) according to flags, and returns the pieces. +// Any component that doesn't appear in uri_ref will be returned as NULL (but +// note that all URIs always have a path component, though it may be the empty +// string). +// +// If flags contains G_URI_FLAGS_ENCODED, then %-encoded characters in uri_ref +// will remain encoded in the output strings. (If not, then all such characters +// will be decoded.) Note that decoding will only work if the URI components are +// ASCII or UTF-8, so you will need to use G_URI_FLAGS_ENCODED if they are not. +// +// Note that the G_URI_FLAGS_HAS_PASSWORD and G_URI_FLAGS_HAS_AUTH_PARAMS flags +// are ignored by g_uri_split(), since it always returns only the full userinfo; +// use g_uri_split_with_user() if you want it split up. +// +// The function takes the following parameters: +// +// - uriRef: string containing a relative or absolute URI. +// - flags for parsing uri_ref. +// +// The function returns the following values: +// +// - scheme (optional): on return, contains the scheme (converted to +// lowercase), or NULL. +// - userinfo (optional): on return, contains the userinfo, or NULL. +// - host (optional): on return, contains the host, or NULL. +// - port (optional): on return, contains the port, or -1. +// - path (optional): on return, contains the path. +// - query (optional): on return, contains the query, or NULL. +// - fragment (optional): on return, contains the fragment, or NULL. +func URISplit(uriRef string, flags URIFlags) (scheme, userinfo, host string, port int, path, query, fragment string, goerr error) { + var _arg1 *C.gchar // out + var _arg2 C.GUriFlags // out + var _arg3 *C.gchar // in + var _arg4 *C.gchar // in + var _arg5 *C.gchar // in + var _arg6 C.gint // in + var _arg7 *C.gchar // in + var _arg8 *C.gchar // in + var _arg9 *C.gchar // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uriRef))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GUriFlags(flags) + + C.g_uri_split(_arg1, _arg2, &_arg3, &_arg4, &_arg5, &_arg6, &_arg7, &_arg8, &_arg9, &_cerr) + runtime.KeepAlive(uriRef) + runtime.KeepAlive(flags) + + var _scheme string // out + var _userinfo string // out + var _host string // out + var _port int // out + var _path string // out + var _query string // out + var _fragment string // out + var _goerr error // out + + if _arg3 != nil { + _scheme = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) + defer C.free(unsafe.Pointer(_arg3)) + } + if _arg4 != nil { + _userinfo = C.GoString((*C.gchar)(unsafe.Pointer(_arg4))) + defer C.free(unsafe.Pointer(_arg4)) + } + if _arg5 != nil { + _host = C.GoString((*C.gchar)(unsafe.Pointer(_arg5))) + defer C.free(unsafe.Pointer(_arg5)) + } + _port = int(_arg6) + if _arg7 != nil { + _path = C.GoString((*C.gchar)(unsafe.Pointer(_arg7))) + defer C.free(unsafe.Pointer(_arg7)) + } + if _arg8 != nil { + _query = C.GoString((*C.gchar)(unsafe.Pointer(_arg8))) + defer C.free(unsafe.Pointer(_arg8)) + } + if _arg9 != nil { + _fragment = C.GoString((*C.gchar)(unsafe.Pointer(_arg9))) + defer C.free(unsafe.Pointer(_arg9)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _scheme, _userinfo, _host, _port, _path, _query, _fragment, _goerr +} + +// URISplitNetwork parses uri_string (which must be an absolute URI +// (#relative-and-absolute-uris)) according to flags, and returns the pieces +// relevant to connecting to a host. See the documentation for g_uri_split() +// for more details; this is mostly a wrapper around that function with simpler +// arguments. However, it will return an error if uri_string is a relative URI, +// or does not contain a hostname component. +// +// The function takes the following parameters: +// +// - uriString: string containing an absolute URI. +// - flags for parsing uri_string. +// +// The function returns the following values: +// +// - scheme (optional): on return, contains the scheme (converted to +// lowercase), or NULL. +// - host (optional): on return, contains the host, or NULL. +// - port (optional): on return, contains the port, or -1. +func URISplitNetwork(uriString string, flags URIFlags) (scheme, host string, port int, goerr error) { + var _arg1 *C.gchar // out + var _arg2 C.GUriFlags // out + var _arg3 *C.gchar // in + var _arg4 *C.gchar // in + var _arg5 C.gint // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uriString))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GUriFlags(flags) + + C.g_uri_split_network(_arg1, _arg2, &_arg3, &_arg4, &_arg5, &_cerr) + runtime.KeepAlive(uriString) + runtime.KeepAlive(flags) + + var _scheme string // out + var _host string // out + var _port int // out + var _goerr error // out + + if _arg3 != nil { + _scheme = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) + defer C.free(unsafe.Pointer(_arg3)) + } + if _arg4 != nil { + _host = C.GoString((*C.gchar)(unsafe.Pointer(_arg4))) + defer C.free(unsafe.Pointer(_arg4)) + } + _port = int(_arg5) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _scheme, _host, _port, _goerr +} + +// URISplitWithUser parses uri_ref (which can be an absolute or relative URI +// (#relative-and-absolute-uris)) according to flags, and returns the pieces. +// Any component that doesn't appear in uri_ref will be returned as NULL (but +// note that all URIs always have a path component, though it may be the empty +// string). +// +// See g_uri_split(), and the definition of Flags, for more information on the +// effect of flags. Note that password will only be parsed out if flags contains +// G_URI_FLAGS_HAS_PASSWORD, and auth_params will only be parsed out if flags +// contains G_URI_FLAGS_HAS_AUTH_PARAMS. +// +// The function takes the following parameters: +// +// - uriRef: string containing a relative or absolute URI. +// - flags for parsing uri_ref. +// +// The function returns the following values: +// +// - scheme (optional): on return, contains the scheme (converted to +// lowercase), or NULL. +// - user (optional): on return, contains the user, or NULL. +// - password (optional): on return, contains the password, or NULL. +// - authParams (optional): on return, contains the auth_params, or NULL. +// - host (optional): on return, contains the host, or NULL. +// - port (optional): on return, contains the port, or -1. +// - path (optional): on return, contains the path. +// - query (optional): on return, contains the query, or NULL. +// - fragment (optional): on return, contains the fragment, or NULL. +func URISplitWithUser(uriRef string, flags URIFlags) (scheme, user, password, authParams, host string, port int, path, query, fragment string, goerr error) { + var _arg1 *C.gchar // out + var _arg2 C.GUriFlags // out + var _arg3 *C.gchar // in + var _arg4 *C.gchar // in + var _arg5 *C.gchar // in + var _arg6 *C.gchar // in + var _arg7 *C.gchar // in + var _arg8 C.gint // in + var _arg9 *C.gchar // in + var _arg10 *C.gchar // in + var _arg11 *C.gchar // in + var _cerr *C.GError // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uriRef))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GUriFlags(flags) + + C.g_uri_split_with_user(_arg1, _arg2, &_arg3, &_arg4, &_arg5, &_arg6, &_arg7, &_arg8, &_arg9, &_arg10, &_arg11, &_cerr) + runtime.KeepAlive(uriRef) + runtime.KeepAlive(flags) + + var _scheme string // out + var _user string // out + var _password string // out + var _authParams string // out + var _host string // out + var _port int // out + var _path string // out + var _query string // out + var _fragment string // out + var _goerr error // out + + if _arg3 != nil { + _scheme = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) + defer C.free(unsafe.Pointer(_arg3)) + } + if _arg4 != nil { + _user = C.GoString((*C.gchar)(unsafe.Pointer(_arg4))) + defer C.free(unsafe.Pointer(_arg4)) + } + if _arg5 != nil { + _password = C.GoString((*C.gchar)(unsafe.Pointer(_arg5))) + defer C.free(unsafe.Pointer(_arg5)) + } + if _arg6 != nil { + _authParams = C.GoString((*C.gchar)(unsafe.Pointer(_arg6))) + defer C.free(unsafe.Pointer(_arg6)) + } + if _arg7 != nil { + _host = C.GoString((*C.gchar)(unsafe.Pointer(_arg7))) + defer C.free(unsafe.Pointer(_arg7)) + } + _port = int(_arg8) + if _arg9 != nil { + _path = C.GoString((*C.gchar)(unsafe.Pointer(_arg9))) + defer C.free(unsafe.Pointer(_arg9)) + } + if _arg10 != nil { + _query = C.GoString((*C.gchar)(unsafe.Pointer(_arg10))) + defer C.free(unsafe.Pointer(_arg10)) + } + if _arg11 != nil { + _fragment = C.GoString((*C.gchar)(unsafe.Pointer(_arg11))) + defer C.free(unsafe.Pointer(_arg11)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _scheme, _user, _password, _authParams, _host, _port, _path, _query, _fragment, _goerr +} + +// URIUnescapeBytes unescapes a segment of an escaped string as binary data. +// +// Note that in contrast to g_uri_unescape_string(), this does allow nul bytes +// to appear in the output. +// +// If any of the characters in illegal_characters appears as an escaped +// character in escaped_string, then that is an error and NULL will be returned. +// This is useful if you want to avoid for instance having a slash being +// expanded in an escaped path element, which might confuse pathname handling. +// +// The function takes the following parameters: +// +// - escapedString: URI-escaped string. +// - illegalCharacters (optional): string of illegal characters not to be +// allowed, or NULL. +// +// The function returns the following values: +// +// - bytes: unescaped version of escaped_string or NULL on error (if decoding +// failed, using G_URI_ERROR_FAILED error code). The returned #GBytes should +// be unreffed when no longer needed. +func URIUnescapeBytes(escapedString, illegalCharacters string) (*Bytes, error) { + var _arg1 *C.char // out + var _arg2 C.gssize + var _arg3 *C.char // out + var _cret *C.GBytes // in + var _cerr *C.GError // in + + _arg2 = (C.gssize)(len(escapedString)) + _arg1 = (*C.char)(C.calloc(C.size_t((len(escapedString) + 1)), C.size_t(C.sizeof_char))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(escapedString)), escapedString) + defer C.free(unsafe.Pointer(_arg1)) + if illegalCharacters != "" { + _arg3 = (*C.char)(unsafe.Pointer(C.CString(illegalCharacters))) + defer C.free(unsafe.Pointer(_arg3)) + } + + _cret = C.g_uri_unescape_bytes(_arg1, _arg2, _arg3, &_cerr) + runtime.KeepAlive(escapedString) + runtime.KeepAlive(illegalCharacters) + + var _bytes *Bytes // out + var _goerr error // out + + _bytes = (*Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _bytes, _goerr +} + +// URIUnescapeSegment unescapes a segment of an escaped string. +// +// If any of the characters in illegal_characters or the NUL character appears +// as an escaped character in escaped_string, then that is an error and NULL +// will be returned. This is useful if you want to avoid for instance having a +// slash being expanded in an escaped path element, which might confuse pathname +// handling. +// +// Note: NUL byte is not accepted in the output, in contrast to +// g_uri_unescape_bytes(). +// +// The function takes the following parameters: +// +// - escapedString (optional): string, may be NULL. +// - escapedStringEnd (optional): pointer to end of escaped_string, may be +// NULL. +// - illegalCharacters (optional): optional string of illegal characters not +// to be allowed, may be NULL. +// +// The function returns the following values: +// +// - utf8 (optional): unescaped version of escaped_string, or NULL on error. +// The returned string should be freed when no longer needed. As a special +// case if NULL is given for escaped_string, this function will return NULL. +func URIUnescapeSegment(escapedString, escapedStringEnd, illegalCharacters string) string { + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 *C.char // out + var _cret *C.char // in + + if escapedString != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(escapedString))) + defer C.free(unsafe.Pointer(_arg1)) + } + if escapedStringEnd != "" { + _arg2 = (*C.char)(unsafe.Pointer(C.CString(escapedStringEnd))) + defer C.free(unsafe.Pointer(_arg2)) + } + if illegalCharacters != "" { + _arg3 = (*C.char)(unsafe.Pointer(C.CString(illegalCharacters))) + defer C.free(unsafe.Pointer(_arg3)) + } + + _cret = C.g_uri_unescape_segment(_arg1, _arg2, _arg3) + runtime.KeepAlive(escapedString) + runtime.KeepAlive(escapedStringEnd) + runtime.KeepAlive(illegalCharacters) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// URIUnescapeString unescapes a whole escaped string. +// +// If any of the characters in illegal_characters or the NUL character appears +// as an escaped character in escaped_string, then that is an error and NULL +// will be returned. This is useful if you want to avoid for instance having a +// slash being expanded in an escaped path element, which might confuse pathname +// handling. +// +// The function takes the following parameters: +// +// - escapedString: escaped string to be unescaped. +// - illegalCharacters (optional): string of illegal characters not to be +// allowed, or NULL. +// +// The function returns the following values: +// +// - utf8 (optional): unescaped version of escaped_string. The returned string +// should be freed when no longer needed. +func URIUnescapeString(escapedString, illegalCharacters string) string { + var _arg1 *C.char // out + var _arg2 *C.char // out + var _cret *C.char // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(escapedString))) + defer C.free(unsafe.Pointer(_arg1)) + if illegalCharacters != "" { + _arg2 = (*C.char)(unsafe.Pointer(C.CString(illegalCharacters))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.g_uri_unescape_string(_arg1, _arg2) + runtime.KeepAlive(escapedString) + runtime.KeepAlive(illegalCharacters) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// URIParamsIter: many URI schemes include one or more attribute/value pairs as +// part of the URI value. For example scheme://server/path?query=string&is=there +// has two attributes – query=string and is=there – in its query part. +// +// A ParamsIter structure represents an iterator that can be used to +// iterate over the attribute/value pairs of a URI query string. ParamsIter +// structures are typically allocated on the stack and then initialized with +// g_uri_params_iter_init(). See the documentation for g_uri_params_iter_init() +// for a usage example. +// +// An instance of this type is always passed by reference. +type URIParamsIter struct { + *uriParamsIter +} + +// uriParamsIter is the struct that's finalized. +type uriParamsIter struct { + native *C.GUriParamsIter +} + +// Init initializes an attribute/value pair iterator. +// +// The iterator keeps pointers to the params and separators arguments, +// those variables must thus outlive the iterator and not be modified during the +// iteration. +// +// If G_URI_PARAMS_WWW_FORM is passed in flags, + characters in the param string +// will be replaced with spaces in the output. For example, foo=bar+baz will +// give attribute foo with value bar baz. This is commonly used on the web (the +// https and http schemes only), but is deprecated in favour of the equivalent +// of encoding spaces as 20. +// +// Unlike with g_uri_parse_params(), G_URI_PARAMS_CASE_INSENSITIVE has no effect +// if passed to flags for g_uri_params_iter_init(). The caller is responsible +// for doing their own case-insensitive comparisons. +// +// GUriParamsIter iter; +// GError *error = NULL; +// gchar *unowned_attr, *unowned_value; +// +// g_uri_params_iter_init (&iter, "foo=bar&baz=bar&Foo=frob&baz=bar2", -1, "&", G_URI_PARAMS_NONE); +// while (g_uri_params_iter_next (&iter, &unowned_attr, &unowned_value, &error)) +// { +// g_autofree gchar *attr = g_steal_pointer (&unowned_attr); +// g_autofree gchar *value = g_steal_pointer (&unowned_value); +// // do something with attr and value; this code will be called 4 times +// // for the params string in this example: once with attr=foo and value=bar, +// // then with baz/bar, then Foo/frob, then baz/bar2. +// } +// if (error) +// // handle parsing error. +// +// The function takes the following parameters: +// +// - params: %-encoded string containing attribute=value parameters. +// - separators: separator byte character set between parameters. (usually &, +// but sometimes ; or both &;). Note that this function works on bytes not +// characters, so it can't be used to delimit UTF-8 strings for anything but +// ASCII characters. You may pass an empty set, in which case no splitting +// will occur. +// - flags to modify the way the parameters are handled. +func (iter *URIParamsIter) Init(params string, separators string, flags URIParamsFlags) { + var _arg0 *C.GUriParamsIter // out + var _arg1 *C.gchar // out + var _arg2 C.gssize + var _arg3 *C.gchar // out + var _arg4 C.GUriParamsFlags // out + + _arg0 = (*C.GUriParamsIter)(gextras.StructNative(unsafe.Pointer(iter))) + _arg2 = (C.gssize)(len(params)) + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(params) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(params)), params) + defer C.free(unsafe.Pointer(_arg1)) + _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(separators))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = C.GUriParamsFlags(flags) + + C.g_uri_params_iter_init(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(iter) + runtime.KeepAlive(params) + runtime.KeepAlive(separators) + runtime.KeepAlive(flags) +} + +// Next advances iter and retrieves the next attribute/value. FALSE is returned +// if an error has occurred (in which case error is set), or if the end of the +// iteration is reached (in which case attribute and value are set to NULL and +// the iterator becomes invalid). If TRUE is returned, g_uri_params_iter_next() +// may be called again to receive another attribute/value pair. +// +// Note that the same attribute may be returned multiple times, since URIs allow +// repeated attributes. +// +// The function returns the following values: +// +// - attribute (optional): on return, contains the attribute, or NULL. +// - value (optional): on return, contains the value, or NULL. +func (iter *URIParamsIter) Next() (attribute string, value string, goerr error) { + var _arg0 *C.GUriParamsIter // out + var _arg1 *C.gchar // in + var _arg2 *C.gchar // in + var _cerr *C.GError // in + + _arg0 = (*C.GUriParamsIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C.g_uri_params_iter_next(_arg0, &_arg1, &_arg2, &_cerr) + runtime.KeepAlive(iter) + + var _attribute string // out + var _value string // out + var _goerr error // out + + if _arg1 != nil { + _attribute = C.GoString((*C.gchar)(unsafe.Pointer(_arg1))) + defer C.free(unsafe.Pointer(_arg1)) + } + if _arg2 != nil { + _value = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + defer C.free(unsafe.Pointer(_arg2)) + } + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _attribute, _value, _goerr +} + +// Variant: GVariant is a variant datatype; it can contain one or more values +// along with information about the type of the values. +// +// A GVariant may contain simple types, like an integer, or a boolean value; +// or complex types, like an array of two strings, or a dictionary of key value +// pairs. A GVariant is also immutable: once it’s been created neither its type +// nor its content can be modified further. +// +// GVariant is useful whenever data needs to be serialized, for example when +// sending method parameters in D-Bus, or when saving settings using GSettings +// (../gio/class.Settings.html). +// +// When creating a new GVariant, you pass the data you want to store in it along +// with a string representing the type of data you wish to pass to it. +// +// For instance, if you want to create a GVariant holding an integer value you +// can use: +// +// GVariant *v = g_variant_new ("u", 40); +// +// The string u in the first argument tells GVariant that the data passed to the +// constructor (40) is going to be an unsigned integer. +// +// More advanced examples of GVariant in use can be found in documentation for +// GVariant format strings (gvariant-format-strings.html#pointers). +// +// The range of possible values is determined by the type. +// +// The type system used by GVariant is glib.VariantType. +// +// GVariant instances always have a type and a value (which are given at +// construction time). The type and value of a GVariant instance can never +// change other than by the GVariant itself being destroyed. A GVariant cannot +// contain a pointer. +// +// GVariant is reference counted using glib.Variant.Ref() and +// glib.Variant.Unref(). GVariant also has floating reference counts — see +// glib.Variant.RefSink(). +// +// GVariant is completely threadsafe. A GVariant instance can be concurrently +// accessed in any way from any number of threads without problems. +// +// GVariant is heavily optimised for dealing with data in serialized form. +// It works particularly well with data located in memory-mapped files. It can +// perform nearly all deserialization operations in a small constant time, +// usually touching only a single memory page. Serialized GVariant data can also +// be sent over the network. +// +// GVariant is largely compatible with D-Bus. Almost all types of GVariant +// instances can be sent over D-Bus. See glib.VariantType for exceptions. +// (However, GVariant’s serialization format is not the same as the +// serialization format of a D-Bus message body: use GDBusMessage +// (../gio/class.DBusMessage.html), in the GIO library, for those.) +// +// For space-efficiency, the GVariant serialization format does not +// automatically include the variant’s length, type or endianness, which +// must either be implied from context (such as knowledge that a particular +// file format always contains a little-endian G_VARIANT_TYPE_VARIANT which +// occupies the whole length of the file) or supplied out-of-band (for instance, +// a length, type and/or endianness indicator could be placed at the beginning +// of a file, network message or network stream). +// +// A GVariant’s size is limited mainly by any lower level operating system +// constraints, such as the number of bits in gsize. For example, it is +// reasonable to have a 2GB file mapped into memory with glib.MappedFile, +// and call glib.Variant.NewFromData on it. +// +// For convenience to C programmers, GVariant features powerful varargs-based +// value construction and destruction. This feature is designed to be embedded +// in other libraries. +// +// There is a Python-inspired text language for describing GVariant values. +// GVariant includes a printer for this language and a parser with type +// inferencing. +// +// # Memory Use +// +// GVariant tries to be quite efficient with respect to memory use. This section +// gives a rough idea of how much memory is used by the current implementation. +// The information here is subject to change in the future. +// +// The memory allocated by GVariant can be grouped into 4 broad purposes: memory +// for serialized data, memory for the type information cache, buffer management +// memory and memory for the GVariant structure itself. +// +// # Serialized Data Memory +// +// This is the memory that is used for storing GVariant data in serialized form. +// This is what would be sent over the network or what would end up on disk, +// not counting any indicator of the endianness, or of the length or type of the +// top-level variant. +// +// The amount of memory required to store a boolean is 1 byte. 16, 32 and 64 +// bit integers and double precision floating point numbers use their ‘natural’ +// size. Strings (including object path and signature strings) are stored with a +// nul terminator, and as such use the length of the string plus 1 byte. +// +// ‘Maybe’ types use no space at all to represent the null value and use +// the same amount of space (sometimes plus one byte) as the equivalent +// non-maybe-typed value to represent the non-null case. +// +// Arrays use the amount of space required to store each of their members, +// concatenated. Additionally, if the items stored in an array are not of a +// fixed-size (ie: strings, other arrays, etc) then an additional framing +// offset is stored for each item. The size of this offset is either 1, +// 2 or 4 bytes depending on the overall size of the container. Additionally, +// extra padding bytes are added as required for alignment of child values. +// +// Tuples (including dictionary entries) use the amount of space required to +// store each of their members, concatenated, plus one framing offset (as per +// arrays) for each non-fixed-sized item in the tuple, except for the last one. +// Additionally, extra padding bytes are added as required for alignment of +// child values. +// +// Variants use the same amount of space as the item inside of the variant, plus +// 1 byte, plus the length of the type string for the item inside the variant. +// +// As an example, consider a dictionary mapping strings to variants. In the case +// that the dictionary is empty, 0 bytes are required for the serialization. +// +// If we add an item ‘width’ that maps to the int32 value of 500 then we will +// use 4 bytes to store the int32 (so 6 for the variant containing it) and 6 +// bytes for the string. The variant must be aligned to 8 after the 6 bytes of +// the string, so that’s 2 extra bytes. 6 (string) + 2 (padding) + 6 (variant) +// is 14 bytes used for the dictionary entry. An additional 1 byte is added to +// the array as a framing offset making a total of 15 bytes. +// +// If we add another entry, ‘title’ that maps to a nullable string that happens +// to have a value of null, then we use 0 bytes for the null value (and 3 bytes +// for the variant to contain it along with its type string) plus 6 bytes for +// the string. Again, we need 2 padding bytes. That makes a total of 6 + 2 + 3 = +// 11 bytes. +// +// We now require extra padding between the two items in the array. After the 14 +// bytes of the first item, that’s 2 bytes required. We now require 2 framing +// offsets for an extra two bytes. 14 + 2 + 11 + 2 = 29 bytes to encode the +// entire two-item dictionary. +// +// # Type Information Cache +// +// For each GVariant type that currently exists in the program a type +// information structure is kept in the type information cache. The type +// information structure is required for rapid deserialization. +// +// Continuing with the above example, if a GVariant exists with the type a{sv} +// then a type information struct will exist for a{sv}, {sv}, s, and v. Multiple +// uses of the same type will share the same type information. Additionally, +// all single-digit types are stored in read-only static memory and do not +// contribute to the writable memory footprint of a program using GVariant. +// +// Aside from the type information structures stored in read-only memory, +// there are two forms of type information. One is used for container types +// where there is a single element type: arrays and maybe types. The other is +// used for container types where there are multiple element types: tuples and +// dictionary entries. +// +// Array type info structures are 6 * sizeof (void *), plus the memory required +// to store the type string itself. This means that on 32-bit systems, the cache +// entry for a{sv} would require 30 bytes of memory (plus allocation overhead). +// +// Tuple type info structures are 6 * sizeof (void *), plus 4 * sizeof (void *) +// for each item in the tuple, plus the memory required to store the type string +// itself. A 2-item tuple, for example, would have a type information structure +// that consumed writable memory in the size of 14 * sizeof (void *) (plus type +// string) This means that on 32-bit systems, the cache entry for {sv} would +// require 61 bytes of memory (plus allocation overhead). +// +// This means that in total, for our a{sv} example, 91 bytes of type information +// would be allocated. +// +// The type information cache, additionally, uses a glib.HashTable to store and +// look up the cached items and stores a pointer to this hash table in static +// storage. The hash table is freed when there are zero items in the type cache. +// +// Although these sizes may seem large it is important to remember that a +// program will probably only have a very small number of different types of +// values in it and that only one type information structure is required for +// many different values of the same type. +// +// # Buffer Management Memory +// +// GVariant uses an internal buffer management structure to deal with the +// various different possible sources of serialized data that it uses. +// The buffer is responsible for ensuring that the correct call is made when the +// data is no longer in use by GVariant. This may involve a glib.Free() or even +// glib.MappedFile.Unref(). +// +// One buffer management structure is used for each chunk of serialized data. +// The size of the buffer management structure is 4 * (void *). On 32-bit +// systems, that’s 16 bytes. +// +// # GVariant structure +// +// The size of a GVariant structure is 6 * (void *). On 32-bit systems, that’s +// 24 bytes. +// +// GVariant structures only exist if they are explicitly created with API calls. +// For example, if a GVariant is constructed out of serialized data for +// the example given above (with the dictionary) then although there are 9 +// individual values that comprise the entire dictionary (two keys, two values, +// two variants containing the values, two dictionary entries, plus the +// dictionary itself), only 1 GVariant instance exists — the one referring to +// the dictionary. +// +// If calls are made to start accessing the other values then GVariant instances +// will exist for those values only for as long as they are in use (ie: +// until you call glib.Variant.Unref()). The type information is shared. +// The serialized data and the buffer management structure for that serialized +// data is shared by the child. +// +// # Summary +// +// To put the entire example together, for our dictionary mapping strings +// to variants (with two entries, as given above), we are using 91 bytes of +// memory for type information, 29 bytes of memory for the serialized data, +// 16 bytes for buffer management and 24 bytes for the GVariant instance, +// or a total of 160 bytes, plus allocation overhead. If we were to use +// glib.Variant.GetChildValue() to access the two dictionary entries, we would +// use an additional 48 bytes. If we were to have other dictionaries of the same +// type, we would use more memory for the serialized data and buffer management +// for those dictionaries, but the type information would be shared. +// +// An instance of this type is always passed by reference. +type Variant struct { + *variant +} + +// variant is the struct that's finalized. +type variant struct { + native *C.GVariant +} + +// NewVariantArray constructs a struct Variant. +func NewVariantArray(childType *VariantType, children []*Variant) *Variant { + var _arg1 *C.GVariantType // out + var _arg2 **C.GVariant // out + var _arg3 C.gsize + var _cret *C.GVariant // in + + if childType != nil { + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(childType))) + } + if children != nil { + _arg3 = (C.gsize)(len(children)) + _arg2 = (**C.GVariant)(C.calloc(C.size_t(len(children)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((**C.GVariant)(_arg2), len(children)) + for i := range children { + out[i] = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(children[i]))) + } + } + } + + _cret = C.g_variant_new_array(_arg1, _arg2, _arg3) + runtime.KeepAlive(childType) + runtime.KeepAlive(children) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantBoolean constructs a struct Variant. +func NewVariantBoolean(value bool) *Variant { + var _arg1 C.gboolean // out + var _cret *C.GVariant // in + + if value { + _arg1 = C.TRUE + } + + _cret = C.g_variant_new_boolean(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantByte constructs a struct Variant. +func NewVariantByte(value byte) *Variant { + var _arg1 C.guint8 // out + var _cret *C.GVariant // in + + _arg1 = C.guint8(value) + + _cret = C.g_variant_new_byte(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantBytestring constructs a struct Variant. +func NewVariantBytestring(str []byte) *Variant { + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg1 = (*C.gchar)(C.calloc(C.size_t((len(str) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg1)), len(str)), str) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_new_bytestring(_arg1) + runtime.KeepAlive(str) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantBytestringArray constructs a struct Variant. +func NewVariantBytestringArray(strv []string) *Variant { + var _arg1 **C.gchar // out + var _arg2 C.gssize + var _cret *C.GVariant // in + + _arg2 = (C.gssize)(len(strv)) + _arg1 = (**C.gchar)(C.calloc(C.size_t(len(strv)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.gchar)(_arg1), len(strv)) + for i := range strv { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(strv[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + + _cret = C.g_variant_new_bytestring_array(_arg1, _arg2) + runtime.KeepAlive(strv) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantDictEntry constructs a struct Variant. +func NewVariantDictEntry(key *Variant, value *Variant) *Variant { + var _arg1 *C.GVariant // out + var _arg2 *C.GVariant // out + var _cret *C.GVariant // in + + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(key))) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_new_dict_entry(_arg1, _arg2) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantDouble constructs a struct Variant. +func NewVariantDouble(value float64) *Variant { + var _arg1 C.gdouble // out + var _cret *C.GVariant // in + + _arg1 = C.gdouble(value) + + _cret = C.g_variant_new_double(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantFixedArray constructs a struct Variant. +func NewVariantFixedArray(elementType *VariantType, elements unsafe.Pointer, nElements uint, elementSize uint) *Variant { + var _arg1 *C.GVariantType // out + var _arg2 C.gconstpointer // out + var _arg3 C.gsize // out + var _arg4 C.gsize // out + var _cret *C.GVariant // in + + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(elementType))) + _arg2 = (C.gconstpointer)(unsafe.Pointer(elements)) + _arg3 = C.gsize(nElements) + _arg4 = C.gsize(elementSize) + + _cret = C.g_variant_new_fixed_array(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(elementType) + runtime.KeepAlive(elements) + runtime.KeepAlive(nElements) + runtime.KeepAlive(elementSize) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantFromBytes constructs a struct Variant. +func NewVariantFromBytes(typ *VariantType, bytes *Bytes, trusted bool) *Variant { + var _arg1 *C.GVariantType // out + var _arg2 *C.GBytes // out + var _arg3 C.gboolean // out + var _cret *C.GVariant // in + + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + _arg2 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + if trusted { + _arg3 = C.TRUE + } + + _cret = C.g_variant_new_from_bytes(_arg1, _arg2, _arg3) + runtime.KeepAlive(typ) + runtime.KeepAlive(bytes) + runtime.KeepAlive(trusted) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantHandle constructs a struct Variant. +func NewVariantHandle(value int32) *Variant { + var _arg1 C.gint32 // out + var _cret *C.GVariant // in + + _arg1 = C.gint32(value) + + _cret = C.g_variant_new_handle(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantInt16 constructs a struct Variant. +func NewVariantInt16(value int16) *Variant { + var _arg1 C.gint16 // out + var _cret *C.GVariant // in + + _arg1 = C.gint16(value) + + _cret = C.g_variant_new_int16(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantInt32 constructs a struct Variant. +func NewVariantInt32(value int32) *Variant { + var _arg1 C.gint32 // out + var _cret *C.GVariant // in + + _arg1 = C.gint32(value) + + _cret = C.g_variant_new_int32(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantInt64 constructs a struct Variant. +func NewVariantInt64(value int64) *Variant { + var _arg1 C.gint64 // out + var _cret *C.GVariant // in + + _arg1 = C.gint64(value) + + _cret = C.g_variant_new_int64(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantMaybe constructs a struct Variant. +func NewVariantMaybe(childType *VariantType, child *Variant) *Variant { + var _arg1 *C.GVariantType // out + var _arg2 *C.GVariant // out + var _cret *C.GVariant // in + + if childType != nil { + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(childType))) + } + if child != nil { + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(child))) + } + + _cret = C.g_variant_new_maybe(_arg1, _arg2) + runtime.KeepAlive(childType) + runtime.KeepAlive(child) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantObjectPath constructs a struct Variant. +func NewVariantObjectPath(objectPath string) *Variant { + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_new_object_path(_arg1) + runtime.KeepAlive(objectPath) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantObjv constructs a struct Variant. +func NewVariantObjv(strv []string) *Variant { + var _arg1 **C.gchar // out + var _arg2 C.gssize + var _cret *C.GVariant // in + + _arg2 = (C.gssize)(len(strv)) + _arg1 = (**C.gchar)(C.calloc(C.size_t(len(strv)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.gchar)(_arg1), len(strv)) + for i := range strv { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(strv[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + + _cret = C.g_variant_new_objv(_arg1, _arg2) + runtime.KeepAlive(strv) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantSignature constructs a struct Variant. +func NewVariantSignature(signature string) *Variant { + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(signature))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_new_signature(_arg1) + runtime.KeepAlive(signature) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantString constructs a struct Variant. +func NewVariantString(str string) *Variant { + var _arg1 *C.gchar // out + var _cret *C.GVariant // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_new_string(_arg1) + runtime.KeepAlive(str) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantStrv constructs a struct Variant. +func NewVariantStrv(strv []string) *Variant { + var _arg1 **C.gchar // out + var _arg2 C.gssize + var _cret *C.GVariant // in + + _arg2 = (C.gssize)(len(strv)) + _arg1 = (**C.gchar)(C.calloc(C.size_t(len(strv)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.gchar)(_arg1), len(strv)) + for i := range strv { + out[i] = (*C.gchar)(unsafe.Pointer(C.CString(strv[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + + _cret = C.g_variant_new_strv(_arg1, _arg2) + runtime.KeepAlive(strv) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantTuple constructs a struct Variant. +func NewVariantTuple(children []*Variant) *Variant { + var _arg1 **C.GVariant // out + var _arg2 C.gsize + var _cret *C.GVariant // in + + _arg2 = (C.gsize)(len(children)) + _arg1 = (**C.GVariant)(C.calloc(C.size_t(len(children)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.GVariant)(_arg1), len(children)) + for i := range children { + out[i] = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(children[i]))) + } + } + + _cret = C.g_variant_new_tuple(_arg1, _arg2) + runtime.KeepAlive(children) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantUint16 constructs a struct Variant. +func NewVariantUint16(value uint16) *Variant { + var _arg1 C.guint16 // out + var _cret *C.GVariant // in + + _arg1 = C.guint16(value) + + _cret = C.g_variant_new_uint16(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantUint32 constructs a struct Variant. +func NewVariantUint32(value uint32) *Variant { + var _arg1 C.guint32 // out + var _cret *C.GVariant // in + + _arg1 = C.guint32(value) + + _cret = C.g_variant_new_uint32(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantUint64 constructs a struct Variant. +func NewVariantUint64(value uint64) *Variant { + var _arg1 C.guint64 // out + var _cret *C.GVariant // in + + _arg1 = C.guint64(value) + + _cret = C.g_variant_new_uint64(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// NewVariantVariant constructs a struct Variant. +func NewVariantVariant(value *Variant) *Variant { + var _arg1 *C.GVariant // out + var _cret *C.GVariant // in + + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_new_variant(_arg1) + runtime.KeepAlive(value) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// Byteswap performs a byteswapping operation on the contents of value. The +// result is that all multi-byte numeric data contained in value is byteswapped. +// That includes 16, 32, and 64bit signed and unsigned integers as well as file +// handles and double precision floating point values. +// +// This function is an identity mapping on any value that does not contain +// multi-byte numeric data. That include strings, booleans, bytes and containers +// containing only these things (recursively). +// +// While this function can safely handle untrusted, non-normal data, +// it is recommended to check whether the input is in normal form beforehand, +// using g_variant_is_normal_form(), and to reject non-normal inputs if your +// application can be strict about what inputs it rejects. +// +// The returned value is always in normal form and is marked as trusted. A full, +// not floating, reference is returned. +// +// The function returns the following values: +// +// - variant (optional): byteswapped form of value. +func (value *Variant) Byteswap() *Variant { + var _arg0 *C.GVariant // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_byteswap(_arg0) + runtime.KeepAlive(value) + + var _variant *Variant // out + + if _cret != nil { + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// CheckFormatString checks if calling g_variant_get() with format_string on +// value would be valid from a type-compatibility standpoint. format_string is +// assumed to be a valid format string (from a syntactic standpoint). +// +// If copy_only is TRUE then this function additionally checks that it would +// be safe to call g_variant_unref() on value immediately after the call to +// g_variant_get() without invalidating the result. This is only possible if +// deep copies are made (ie: there are no pointers to the data inside of the +// soon-to-be-freed #GVariant instance). If this check fails then a g_critical() +// is printed and FALSE is returned. +// +// This function is meant to be used by functions that wish to provide varargs +// accessors to #GVariant values of uncertain values (eg: g_variant_lookup() or +// g_menu_model_get_item_attribute()). +// +// The function takes the following parameters: +// +// - formatString: valid #GVariant format string. +// - copyOnly: TRUE to ensure the format string makes deep copies. +// +// The function returns the following values: +// +// - ok: TRUE if format_string is safe to use. +func (value *Variant) CheckFormatString(formatString string, copyOnly bool) bool { + var _arg0 *C.GVariant // out + var _arg1 *C.gchar // out + var _arg2 C.gboolean // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(formatString))) + defer C.free(unsafe.Pointer(_arg1)) + if copyOnly { + _arg2 = C.TRUE + } + + _cret = C.g_variant_check_format_string(_arg0, _arg1, _arg2) + runtime.KeepAlive(value) + runtime.KeepAlive(formatString) + runtime.KeepAlive(copyOnly) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Classify classifies value according to its top-level type. +// +// The function returns the following values: +// +// - variantClass of value. +func (value *Variant) Classify() VariantClass { + var _arg0 *C.GVariant // out + var _cret C.GVariantClass // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_classify(_arg0) + runtime.KeepAlive(value) + + var _variantClass VariantClass // out + + _variantClass = VariantClass(_cret) + + return _variantClass +} + +// Compare compares one and two. +// +// The types of one and two are #gconstpointer only to allow use of this +// function with #GTree, Array, etc. They must each be a #GVariant. +// +// Comparison is only defined for basic types (ie: booleans, numbers, strings). +// For booleans, FALSE is less than TRUE. Numbers are ordered in the usual way. +// Strings are in ASCII lexographical order. +// +// It is a programmer error to attempt to compare container values or two values +// that have types that are not exactly equal. For example, you cannot compare +// a 32-bit signed integer with a 32-bit unsigned integer. Also note that this +// function is not particularly well-behaved when it comes to comparison of +// doubles; in particular, the handling of incomparable values (ie: NaN) is +// undefined. +// +// If you only require an equality comparison, g_variant_equal() is more +// general. +// +// The function takes the following parameters: +// +// - two instance of the same type. +// +// The function returns the following values: +// +// - gint: negative value if a < b; zero if a = b; positive value if a > b. +func (one *Variant) Compare(two *Variant) int { + var _arg0 C.gconstpointer // out + var _arg1 C.gconstpointer // out + var _cret C.gint // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(one))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(two))) + + _cret = C.g_variant_compare(_arg0, _arg1) + runtime.KeepAlive(one) + runtime.KeepAlive(two) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// DupBytestring: similar to g_variant_get_bytestring() except that instead of +// returning a constant string, the string is duplicated. +// +// The return value must be freed using g_free(). +// +// The function returns the following values: +// +// - guint8s: a newly allocated string. +func (value *Variant) DupBytestring() []byte { + var _arg0 *C.GVariant // out + var _cret *C.gchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_dup_bytestring(_arg0, &_arg1) + runtime.KeepAlive(value) + + var _guint8s []byte // out + + defer C.free(unsafe.Pointer(_cret)) + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) + + return _guint8s +} + +// DupBytestringArray gets the contents of an array of array of bytes #GVariant. +// This call makes a deep copy; the return result should be released with +// g_strfreev(). +// +// If length is non-NULL then the number of elements in the result is stored +// there. In any case, the resulting array will be NULL-terminated. +// +// For an empty array, length will be set to 0 and a pointer to a NULL pointer +// will be returned. +// +// The function returns the following values: +// +// - utf8s: array of strings. +func (value *Variant) DupBytestringArray() []string { + var _arg0 *C.GVariant // out + var _cret **C.gchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_dup_bytestring_array(_arg0, &_arg1) + runtime.KeepAlive(value) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg1) + _utf8s = make([]string, _arg1) + for i := 0; i < int(_arg1); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// DupObjv gets the contents of an array of object paths #GVariant. This call +// makes a deep copy; the return result should be released with g_strfreev(). +// +// If length is non-NULL then the number of elements in the result is stored +// there. In any case, the resulting array will be NULL-terminated. +// +// For an empty array, length will be set to 0 and a pointer to a NULL pointer +// will be returned. +// +// The function returns the following values: +// +// - utf8s: array of strings. +func (value *Variant) DupObjv() []string { + var _arg0 *C.GVariant // out + var _cret **C.gchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_dup_objv(_arg0, &_arg1) + runtime.KeepAlive(value) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg1) + _utf8s = make([]string, _arg1) + for i := 0; i < int(_arg1); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// DupString: similar to g_variant_get_string() except that instead of returning +// a constant string, the string is duplicated. +// +// The string will always be UTF-8 encoded. +// +// The return value must be freed using g_free(). +// +// The function returns the following values: +// +// - length: pointer to a #gsize, to store the length. +// - utf8: newly allocated string, UTF-8 encoded. +func (value *Variant) DupString() (uint, string) { + var _arg0 *C.GVariant // out + var _arg1 C.gsize // in + var _cret *C.gchar // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_dup_string(_arg0, &_arg1) + runtime.KeepAlive(value) + + var _length uint // out + var _utf8 string // out + + _length = uint(_arg1) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _length, _utf8 +} + +// DupStrv gets the contents of an array of strings #GVariant. This call makes a +// deep copy; the return result should be released with g_strfreev(). +// +// If length is non-NULL then the number of elements in the result is stored +// there. In any case, the resulting array will be NULL-terminated. +// +// For an empty array, length will be set to 0 and a pointer to a NULL pointer +// will be returned. +// +// The function returns the following values: +// +// - utf8s: array of strings. +func (value *Variant) DupStrv() []string { + var _arg0 *C.GVariant // out + var _cret **C.gchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_dup_strv(_arg0, &_arg1) + runtime.KeepAlive(value) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg1) + _utf8s = make([]string, _arg1) + for i := 0; i < int(_arg1); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// Equal checks if one and two have the same type and value. +// +// The types of one and two are #gconstpointer only to allow use of this +// function with Table. They must each be a #GVariant. +// +// The function takes the following parameters: +// +// - two: #GVariant instance. +// +// The function returns the following values: +// +// - ok: TRUE if one and two are equal. +func (one *Variant) Equal(two *Variant) bool { + var _arg0 C.gconstpointer // out + var _arg1 C.gconstpointer // out + var _cret C.gboolean // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(one))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(two))) + + _cret = C.g_variant_equal(_arg0, _arg1) + runtime.KeepAlive(one) + runtime.KeepAlive(two) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Boolean returns the boolean value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_BOOLEAN. +// +// The function returns the following values: +// +// - ok: TRUE or FALSE. +func (value *Variant) Boolean() bool { + var _arg0 *C.GVariant // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_boolean(_arg0) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Byte returns the byte value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_BYTE. +// +// The function returns the following values: +// +// - guint8: #guint8. +func (value *Variant) Byte() byte { + var _arg0 *C.GVariant // out + var _cret C.guint8 // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_byte(_arg0) + runtime.KeepAlive(value) + + var _guint8 byte // out + + _guint8 = byte(_cret) + + return _guint8 +} + +// Bytestring returns the string value of a #GVariant instance with an +// array-of-bytes type. The string has no particular encoding. +// +// If the array does not end with a nul terminator character, the empty +// string is returned. For this reason, you can always trust that a non-NULL +// nul-terminated string will be returned by this function. +// +// If the array contains a nul terminator character somewhere other than the +// last byte then the returned string is the string, up to the first such nul +// character. +// +// g_variant_get_fixed_array() should be used instead if the array contains +// arbitrary data that could not be nul-terminated or could contain nul bytes. +// +// It is an error to call this function with a value that is not an array of +// bytes. +// +// The return value remains valid as long as value exists. +// +// The function returns the following values: +// +// - guint8s: the constant string. +func (value *Variant) Bytestring() []byte { + var _arg0 *C.GVariant // out + var _cret *C.gchar // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_bytestring(_arg0) + runtime.KeepAlive(value) + + var _guint8s []byte // out + + { + var i int + var z C.gchar + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _guint8s = make([]byte, i) + for i := range src { + _guint8s[i] = byte(src[i]) + } + } + + return _guint8s +} + +// BytestringArray gets the contents of an array of array of bytes #GVariant. +// This call makes a shallow copy; the return result should be released with +// g_free(), but the individual strings must not be modified. +// +// If length is non-NULL then the number of elements in the result is stored +// there. In any case, the resulting array will be NULL-terminated. +// +// For an empty array, length will be set to 0 and a pointer to a NULL pointer +// will be returned. +// +// The function returns the following values: +// +// - utf8s: array of constant strings. +func (value *Variant) BytestringArray() []string { + var _arg0 *C.GVariant // out + var _cret **C.gchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_bytestring_array(_arg0, &_arg1) + runtime.KeepAlive(value) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg1) + _utf8s = make([]string, _arg1) + for i := 0; i < int(_arg1); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// ChildValue reads a child item out of a container #GVariant instance. +// This includes variants, maybes, arrays, tuples and dictionary entries. +// It is an error to call this function on any other type of #GVariant. +// +// It is an error if index_ is greater than the number of child items in the +// container. See g_variant_n_children(). +// +// The returned value is never floating. You should free it with +// g_variant_unref() when you're done with it. +// +// Note that values borrowed from the returned child are not guaranteed to +// still be valid after the child is freed even if you still hold a reference to +// value, if value has not been serialized at the time this function is called. +// To avoid this, you can serialize value by calling g_variant_get_data() and +// optionally ignoring the return value. +// +// There may be implementation specific restrictions on deeply nested values, +// which would result in the unit tuple being returned as the child value, +// instead of further nested children. #GVariant is guaranteed to handle nesting +// up to at least 64 levels. +// +// This function is O(1). +// +// The function takes the following parameters: +// +// - index_: index of the child to fetch. +// +// The function returns the following values: +// +// - variant (optional): child at the specified index. +func (value *Variant) ChildValue(index_ uint) *Variant { + var _arg0 *C.GVariant // out + var _arg1 C.gsize // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + _arg1 = C.gsize(index_) + + _cret = C.g_variant_get_child_value(_arg0, _arg1) + runtime.KeepAlive(value) + runtime.KeepAlive(index_) + + var _variant *Variant // out + + if _cret != nil { + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// Data returns a pointer to the serialized form of a #GVariant instance. The +// returned data may not be in fully-normalised form if read from an untrusted +// source. The returned data must not be freed; it remains valid for as long as +// value exists. +// +// If value is a fixed-sized value that was deserialized from a corrupted +// serialized container then NULL may be returned. In this case, the proper +// thing to do is typically to use the appropriate number of nul bytes in place +// of value. If value is not fixed-sized then NULL is never returned. +// +// In the case that value is already in serialized form, this function is O(1). +// If the value is not already in serialized form, serialization occurs +// implicitly and is approximately O(n) in the size of the result. +// +// To deserialize the data returned by this function, in addition to the +// serialized data, you must know the type of the #GVariant, and (if the +// machine might be different) the endianness of the machine that stored it. +// As a result, file formats or network messages that incorporate serialized +// #GVariants must include this information either implicitly (for instance +// "the file always contains a G_VARIANT_TYPE_VARIANT and it is always in +// little-endian order") or explicitly (by storing the type and/or endianness in +// addition to the serialized data). +// +// The function returns the following values: +// +// - gpointer (optional): serialized form of value, or NULL. +func (value *Variant) Data() unsafe.Pointer { + var _arg0 *C.GVariant // out + var _cret C.gconstpointer // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_data(_arg0) + runtime.KeepAlive(value) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// DataAsBytes returns a pointer to the serialized form of a #GVariant instance. +// The semantics of this function are exactly the same as g_variant_get_data(), +// except that the returned #GBytes holds a reference to the variant data. +// +// The function returns the following values: +// +// - bytes: new #GBytes representing the variant data. +func (value *Variant) DataAsBytes() *Bytes { + var _arg0 *C.GVariant // out + var _cret *C.GBytes // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_data_as_bytes(_arg0) + runtime.KeepAlive(value) + + var _bytes *Bytes // out + + _bytes = (*Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// Double returns the double precision floating point value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_DOUBLE. +// +// The function returns the following values: +// +// - gdouble: #gdouble. +func (value *Variant) Double() float64 { + var _arg0 *C.GVariant // out + var _cret C.gdouble // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_double(_arg0) + runtime.KeepAlive(value) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// Handle returns the 32-bit signed integer value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_HANDLE. +// +// By convention, handles are indexes into an array of file descriptors that +// are sent alongside a D-Bus message. If you're not interacting with D-Bus, +// you probably don't need them. +// +// The function returns the following values: +// +// - gint32: #gint32. +func (value *Variant) Handle() int32 { + var _arg0 *C.GVariant // out + var _cret C.gint32 // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_handle(_arg0) + runtime.KeepAlive(value) + + var _gint32 int32 // out + + _gint32 = int32(_cret) + + return _gint32 +} + +// Int16 returns the 16-bit signed integer value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_INT16. +// +// The function returns the following values: +// +// - gint16: #gint16. +func (value *Variant) Int16() int16 { + var _arg0 *C.GVariant // out + var _cret C.gint16 // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_int16(_arg0) + runtime.KeepAlive(value) + + var _gint16 int16 // out + + _gint16 = int16(_cret) + + return _gint16 +} + +// Int32 returns the 32-bit signed integer value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_INT32. +// +// The function returns the following values: +// +// - gint32: #gint32. +func (value *Variant) Int32() int32 { + var _arg0 *C.GVariant // out + var _cret C.gint32 // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_int32(_arg0) + runtime.KeepAlive(value) + + var _gint32 int32 // out + + _gint32 = int32(_cret) + + return _gint32 +} + +// Int64 returns the 64-bit signed integer value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_INT64. +// +// The function returns the following values: +// +// - gint64: #gint64. +func (value *Variant) Int64() int64 { + var _arg0 *C.GVariant // out + var _cret C.gint64 // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_int64(_arg0) + runtime.KeepAlive(value) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 +} + +// Maybe: given a maybe-typed #GVariant instance, extract its value. If the +// value is Nothing, then this function returns NULL. +// +// The function returns the following values: +// +// - variant (optional) contents of value, or NULL. +func (value *Variant) Maybe() *Variant { + var _arg0 *C.GVariant // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_maybe(_arg0) + runtime.KeepAlive(value) + + var _variant *Variant // out + + if _cret != nil { + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// NormalForm gets a #GVariant instance that has the same value as value and is +// trusted to be in normal form. +// +// If value is already trusted to be in normal form then a new reference to +// value is returned. +// +// If value is not already trusted, then it is scanned to check if it is in +// normal form. If it is found to be in normal form then it is marked as trusted +// and a new reference to it is returned. +// +// If value is found not to be in normal form then a new trusted #GVariant is +// created with the same value as value. The non-normal parts of value will be +// replaced with default values which are guaranteed to be in normal form. +// +// It makes sense to call this function if you've received #GVariant data from +// untrusted sources and you want to ensure your serialized output is definitely +// in normal form. +// +// If value is already in normal form, a new reference will be returned (which +// will be floating if value is floating). If it is not in normal form, +// the newly created #GVariant will be returned with a single non-floating +// reference. Typically, g_variant_take_ref() should be called on the return +// value from this function to guarantee ownership of a single non-floating +// reference to it. +// +// The function returns the following values: +// +// - variant (optional): trusted #GVariant. +func (value *Variant) NormalForm() *Variant { + var _arg0 *C.GVariant // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_normal_form(_arg0) + runtime.KeepAlive(value) + + var _variant *Variant // out + + if _cret != nil { + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// Objv gets the contents of an array of object paths #GVariant. This call +// makes a shallow copy; the return result should be released with g_free(), +// but the individual strings must not be modified. +// +// If length is non-NULL then the number of elements in the result is stored +// there. In any case, the resulting array will be NULL-terminated. +// +// For an empty array, length will be set to 0 and a pointer to a NULL pointer +// will be returned. +// +// The function returns the following values: +// +// - utf8s: array of constant strings. +func (value *Variant) Objv() []string { + var _arg0 *C.GVariant // out + var _cret **C.gchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_objv(_arg0, &_arg1) + runtime.KeepAlive(value) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg1) + _utf8s = make([]string, _arg1) + for i := 0; i < int(_arg1); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// Size determines the number of bytes that would be required to store value +// with g_variant_store(). +// +// If value has a fixed-sized type then this function always returned that fixed +// size. +// +// In the case that value is already in serialized form or the size has already +// been calculated (ie: this function has been called before) then this +// function is O(1). Otherwise, the size is calculated, an operation which is +// approximately O(n) in the number of values involved. +// +// The function returns the following values: +// +// - gsize: serialized size of value. +func (value *Variant) Size() uint { + var _arg0 *C.GVariant // out + var _cret C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_size(_arg0) + runtime.KeepAlive(value) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// String returns the string value of a #GVariant instance with a string type. +// This includes the types G_VARIANT_TYPE_STRING, G_VARIANT_TYPE_OBJECT_PATH and +// G_VARIANT_TYPE_SIGNATURE. +// +// The string will always be UTF-8 encoded, will never be NULL, and will never +// contain nul bytes. +// +// If length is non-NULL then the length of the string (in bytes) is returned +// there. For trusted values, this information is already known. Untrusted +// values will be validated and, if valid, a strlen() will be performed. If +// invalid, a default value will be returned — for G_VARIANT_TYPE_OBJECT_PATH, +// this is "/", and for other types it is the empty string. +// +// It is an error to call this function with a value of any type other than +// those three. +// +// The return value remains valid as long as value exists. +// +// The function returns the following values: +// +// - utf8: constant string, UTF-8 encoded. +func (value *Variant) String() string { + var _arg0 *C.GVariant // out + var _cret *C.gchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_string(_arg0, &_arg1) + runtime.KeepAlive(value) + + var _utf8 string + + _utf8 = C.GoStringN(_cret, C.int(_arg1)) + + return _utf8 +} + +// Strv gets the contents of an array of strings #GVariant. This call makes a +// shallow copy; the return result should be released with g_free(), but the +// individual strings must not be modified. +// +// If length is non-NULL then the number of elements in the result is stored +// there. In any case, the resulting array will be NULL-terminated. +// +// For an empty array, length will be set to 0 and a pointer to a NULL pointer +// will be returned. +// +// The function returns the following values: +// +// - utf8s: array of constant strings. +func (value *Variant) Strv() []string { + var _arg0 *C.GVariant // out + var _cret **C.gchar // in + var _arg1 C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_strv(_arg0, &_arg1) + runtime.KeepAlive(value) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + src := unsafe.Slice((**C.gchar)(_cret), _arg1) + _utf8s = make([]string, _arg1) + for i := 0; i < int(_arg1); i++ { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// Type determines the type of value. +// +// The return value is valid for the lifetime of value and must not be freed. +// +// The function returns the following values: +// +// - variantType: Type. +func (value *Variant) Type() *VariantType { + var _arg0 *C.GVariant // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_type(_arg0) + runtime.KeepAlive(value) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _variantType +} + +// TypeString returns the type string of value. Unlike the result of calling +// g_variant_type_peek_string(), this string is nul-terminated. This string +// belongs to #GVariant and must not be freed. +// +// The function returns the following values: +// +// - utf8: type string for the type of value. +func (value *Variant) TypeString() string { + var _arg0 *C.GVariant // out + var _cret *C.gchar // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_type_string(_arg0) + runtime.KeepAlive(value) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Uint16 returns the 16-bit unsigned integer value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_UINT16. +// +// The function returns the following values: +// +// - guint16: #guint16. +func (value *Variant) Uint16() uint16 { + var _arg0 *C.GVariant // out + var _cret C.guint16 // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_uint16(_arg0) + runtime.KeepAlive(value) + + var _guint16 uint16 // out + + _guint16 = uint16(_cret) + + return _guint16 +} + +// Uint32 returns the 32-bit unsigned integer value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_UINT32. +// +// The function returns the following values: +// +// - guint32: #guint32. +func (value *Variant) Uint32() uint32 { + var _arg0 *C.GVariant // out + var _cret C.guint32 // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_uint32(_arg0) + runtime.KeepAlive(value) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// Uint64 returns the 64-bit unsigned integer value of value. +// +// It is an error to call this function with a value of any type other than +// G_VARIANT_TYPE_UINT64. +// +// The function returns the following values: +// +// - guint64: #guint64. +func (value *Variant) Uint64() uint64 { + var _arg0 *C.GVariant // out + var _cret C.guint64 // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_uint64(_arg0) + runtime.KeepAlive(value) + + var _guint64 uint64 // out + + _guint64 = uint64(_cret) + + return _guint64 +} + +// Variant unboxes value. The result is the #GVariant instance that was +// contained in value. +// +// The function returns the following values: +// +// - variant (optional): item contained in the variant. +func (value *Variant) Variant() *Variant { + var _arg0 *C.GVariant // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_get_variant(_arg0) + runtime.KeepAlive(value) + + var _variant *Variant // out + + if _cret != nil { + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// Hash generates a hash value for a #GVariant instance. +// +// The output of this function is guaranteed to be the same for a given value +// only per-process. It may change between different processor architectures +// or even different versions of GLib. Do not use this function as a basis for +// building protocols or file formats. +// +// The type of value is #gconstpointer only to allow use of this function with +// Table. value must be a #GVariant. +// +// The function returns the following values: +// +// - guint: hash value corresponding to value. +func (value *Variant) Hash() uint { + var _arg0 C.gconstpointer // out + var _cret C.guint // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_hash(_arg0) + runtime.KeepAlive(value) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// IsContainer checks if value is a container. +// +// The function returns the following values: +// +// - ok: TRUE if value is a container. +func (value *Variant) IsContainer() bool { + var _arg0 *C.GVariant // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_is_container(_arg0) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsFloating checks whether value has a floating reference count. +// +// This function should only ever be used to assert that a given variant +// is or is not floating, or for debug purposes. To acquire a reference +// to a variant that might be floating, always use g_variant_ref_sink() or +// g_variant_take_ref(). +// +// See g_variant_ref_sink() for more information about floating reference +// counts. +// +// The function returns the following values: +// +// - ok: whether value is floating. +func (value *Variant) IsFloating() bool { + var _arg0 *C.GVariant // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_is_floating(_arg0) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsNormalForm checks if value is in normal form. +// +// The main reason to do this is to detect if a given chunk of serialized +// data is in normal form: load the data into a #GVariant using +// g_variant_new_from_data() and then use this function to check. +// +// If value is found to be in normal form then it will be marked as being +// trusted. If the value was already marked as being trusted then this function +// will immediately return TRUE. +// +// There may be implementation specific restrictions on deeply nested values. +// GVariant is guaranteed to handle nesting up to at least 64 levels. +// +// The function returns the following values: +// +// - ok: TRUE if value is in normal form. +func (value *Variant) IsNormalForm() bool { + var _arg0 *C.GVariant // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_is_normal_form(_arg0) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsOfType checks if a value has a type matching the provided type. +// +// The function takes the following parameters: +// +// - typ: Type. +// +// The function returns the following values: +// +// - ok: TRUE if the type of value matches type. +func (value *Variant) IsOfType(typ *VariantType) bool { + var _arg0 *C.GVariant // out + var _arg1 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_is_of_type(_arg0, _arg1) + runtime.KeepAlive(value) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// LookupValue looks up a value in a dictionary #GVariant. +// +// This function works with dictionaries of the type a{s*} (and equally well +// with type a{o*}, but we only further discuss the string case for sake of +// clarity). +// +// In the event that dictionary has the type a{sv}, the expected_type string +// specifies what type of value is expected to be inside of the variant. +// If the value inside the variant has a different type then NULL is returned. +// In the event that dictionary has a value type other than v then expected_type +// must directly match the value type and it is used to unpack the value +// directly or an error occurs. +// +// In either case, if key is not found in dictionary, NULL is returned. +// +// If the key is found and the value has the correct type, it is returned. +// If expected_type was specified then any non-NULL return value will have this +// type. +// +// This function is currently implemented with a linear scan. If you plan to do +// many lookups then Dict may be more efficient. +// +// The function takes the following parameters: +// +// - key to look up in the dictionary. +// - expectedType (optional) or NULL. +// +// The function returns the following values: +// +// - variant (optional): value of the dictionary key, or NULL. +func (dictionary *Variant) LookupValue(key string, expectedType *VariantType) *Variant { + var _arg0 *C.GVariant // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariantType // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(dictionary))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + if expectedType != nil { + _arg2 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(expectedType))) + } + + _cret = C.g_variant_lookup_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(dictionary) + runtime.KeepAlive(key) + runtime.KeepAlive(expectedType) + + var _variant *Variant // out + + if _cret != nil { + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// NChildren determines the number of children in a container #GVariant +// instance. This includes variants, maybes, arrays, tuples and dictionary +// entries. It is an error to call this function on any other type of #GVariant. +// +// For variants, the return value is always 1. For values with maybe types, +// it is always zero or one. For arrays, it is the length of the array. +// For tuples it is the number of tuple items (which depends only on the type). +// For dictionary entries, it is always 2 +// +// This function is O(1). +// +// The function returns the following values: +// +// - gsize: number of children in the container. +func (value *Variant) NChildren() uint { + var _arg0 *C.GVariant // out + var _cret C.gsize // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_n_children(_arg0) + runtime.KeepAlive(value) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Print pretty-prints value in the format understood by g_variant_parse(). +// +// The format is described [here][gvariant-text]. +// +// If type_annotate is TRUE, then type information is included in the output. +// +// The function takes the following parameters: +// +// - typeAnnotate: TRUE if type information should be included in the output. +// +// The function returns the following values: +// +// - utf8: newly-allocated string holding the result. +func (value *Variant) Print(typeAnnotate bool) string { + var _arg0 *C.GVariant // out + var _arg1 C.gboolean // out + var _cret *C.gchar // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + if typeAnnotate { + _arg1 = C.TRUE + } + + _cret = C.g_variant_print(_arg0, _arg1) + runtime.KeepAlive(value) + runtime.KeepAlive(typeAnnotate) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// RefSink uses a floating reference count system. All functions with names +// starting with g_variant_new_ return floating references. +// +// Calling g_variant_ref_sink() on a #GVariant with a floating reference +// will convert the floating reference into a full reference. Calling +// g_variant_ref_sink() on a non-floating #GVariant results in an additional +// normal reference being added. +// +// In other words, if the value is floating, then this call "assumes ownership" +// of the floating reference, converting it to a normal reference. If the value +// is not floating, then this call adds a new normal reference increasing the +// reference count by one. +// +// All calls that result in a #GVariant instance being inserted into a container +// will call g_variant_ref_sink() on the instance. This means that if the value +// was just created (and has only its floating reference) then the container +// will assume sole ownership of the value at that point and the caller will not +// need to unreference it. This makes certain common styles of programming much +// easier while still maintaining normal refcounting semantics in situations +// where values are not floating. +// +// The function returns the following values: +// +// - variant (optional): same value. +func (value *Variant) RefSink() *Variant { + var _arg0 *C.GVariant // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_ref_sink(_arg0) + runtime.KeepAlive(value) + + var _variant *Variant // out + + if _cret != nil { + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// Store stores the serialized form of value at data. data should be large +// enough. See g_variant_get_size(). +// +// The stored data is in machine native byte order but may not be +// in fully-normalised form if read from an untrusted source. See +// g_variant_get_normal_form() for a solution. +// +// As with g_variant_get_data(), to be able to deserialize the serialized +// variant successfully, its type and (if the destination machine might be +// different) its endianness must also be available. +// +// This function is approximately O(n) in the size of data. +// +// The function takes the following parameters: +// +// - data: location to store the serialized data at. +func (value *Variant) Store(data unsafe.Pointer) { + var _arg0 *C.GVariant // out + var _arg1 C.gpointer // out + + _arg0 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + _arg1 = (C.gpointer)(unsafe.Pointer(data)) + + C.g_variant_store(_arg0, _arg1) + runtime.KeepAlive(value) + runtime.KeepAlive(data) +} + +// VariantIsObjectPath determines if a given string is a valid D-Bus object +// path. You should ensure that a string is a valid D-Bus object path before +// passing it to g_variant_new_object_path(). +// +// A valid object path starts with / followed by zero or more sequences of +// characters separated by / characters. Each sequence must contain only the +// characters [A-Z][a-z][0-9]_. No sequence (including the one following the +// final / character) may be empty. +// +// The function takes the following parameters: +// +// - str: normal C nul-terminated string. +// +// The function returns the following values: +// +// - ok: TRUE if string is a D-Bus object path. +func VariantIsObjectPath(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_is_object_path(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// VariantIsSignature determines if a given string is a valid D-Bus type +// signature. You should ensure that a string is a valid D-Bus type signature +// before passing it to g_variant_new_signature(). +// +// D-Bus type signatures consist of zero or more definite Type strings in +// sequence. +// +// The function takes the following parameters: +// +// - str: normal C nul-terminated string. +// +// The function returns the following values: +// +// - ok: TRUE if string is a D-Bus type signature. +func VariantIsSignature(str string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_is_signature(_arg1) + runtime.KeepAlive(str) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// VariantParseErrorPrintContext pretty-prints a message showing the context of +// a #GVariant parse error within the string for which parsing was attempted. +// +// The resulting string is suitable for output to the console or other monospace +// media where newlines are treated in the usual way. +// +// The message will typically look something like one of the following: +// +// unterminated string constant: +// (1, 2, 3, 'abc +// ^^^^ +// +// or +// +// unable to find a common type: +// [1, 2, 3, 'str'] +// ^ ^^^^^ +// +// The format of the message may change in a future version. +// +// error must have come from a failed attempt to g_variant_parse() and +// source_str must be exactly the same string that caused the error. +// If source_str was not nul-terminated when you passed it to g_variant_parse() +// then you must add nul termination before using this function. +// +// The function takes the following parameters: +// +// - err from the ParseError domain. +// - sourceStr: string that was given to the parser. +// +// The function returns the following values: +// +// - utf8: printed message. +func VariantParseErrorPrintContext(err error, sourceStr string) string { + var _arg1 *C.GError // out + var _arg2 *C.gchar // out + var _cret *C.gchar // in + + if err != nil { + _arg1 = (*C.GError)(gerror.New(err)) + } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(sourceStr))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.g_variant_parse_error_print_context(_arg1, _arg2) + runtime.KeepAlive(err) + runtime.KeepAlive(sourceStr) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +func VariantParseErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_variant_parse_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// VariantParserGetErrorQuark: same as g_variant_error_quark(). +// +// Deprecated: Use g_variant_parse_error_quark() instead. +func VariantParserGetErrorQuark() Quark { + var _cret C.GQuark // in + + _cret = C.g_variant_parser_get_error_quark() + + var _quark Quark // out + + _quark = Quark(_cret) + + return _quark +} + +// VariantBuilder: utility type for constructing container-type #GVariant +// instances. +// +// This is an opaque structure and may only be accessed using the following +// functions. +// +// Builder is not threadsafe in any way. Do not attempt to access it from more +// than one thread. +// +// An instance of this type is always passed by reference. +type VariantBuilder struct { + *variantBuilder +} + +// variantBuilder is the struct that's finalized. +type variantBuilder struct { + native *C.GVariantBuilder +} + +func marshalVariantBuilder(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &VariantBuilder{&variantBuilder{(*C.GVariantBuilder)(b)}}, nil +} + +// NewVariantBuilder constructs a struct VariantBuilder. +func NewVariantBuilder(typ *VariantType) *VariantBuilder { + var _arg1 *C.GVariantType // out + var _cret *C.GVariantBuilder // in + + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_builder_new(_arg1) + runtime.KeepAlive(typ) + + var _variantBuilder *VariantBuilder // out + + _variantBuilder = (*VariantBuilder)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variantBuilder)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_builder_unref((*C.GVariantBuilder)(intern.C)) + }, + ) + + return _variantBuilder +} + +// AddValue adds value to builder. +// +// It is an error to call this function in any way that would create an +// inconsistent value to be constructed. Some examples of this are putting +// different types of items into an array, putting the wrong types or number of +// items in a tuple, putting more than one value into a variant, etc. +// +// If value is a floating reference (see g_variant_ref_sink()), the builder +// instance takes ownership of value. +// +// The function takes the following parameters: +// +// - value: #GVariant. +func (builder *VariantBuilder) AddValue(value *Variant) { + var _arg0 *C.GVariantBuilder // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GVariantBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + C.g_variant_builder_add_value(_arg0, _arg1) + runtime.KeepAlive(builder) + runtime.KeepAlive(value) +} + +// Close closes the subcontainer inside the given builder that was opened by the +// most recent call to g_variant_builder_open(). +// +// It is an error to call this function in any way that would create an +// inconsistent value to be constructed (ie: too few values added to the +// subcontainer). +func (builder *VariantBuilder) Close() { + var _arg0 *C.GVariantBuilder // out + + _arg0 = (*C.GVariantBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + + C.g_variant_builder_close(_arg0) + runtime.KeepAlive(builder) +} + +// End ends the builder process and returns the constructed value. +// +// It is not permissible to use builder in any way after this call except +// for reference counting operations (in the case of a heap-allocated +// Builder) or by reinitialising it with g_variant_builder_init() (in the +// case of stack-allocated). This means that for the stack-allocated builders +// there is no need to call g_variant_builder_clear() after the call to +// g_variant_builder_end(). +// +// It is an error to call this function in any way that would create an +// inconsistent value to be constructed (ie: insufficient number of items added +// to a container with a specific number of children required). It is also an +// error to call this function if the builder was created with an indefinite +// array or maybe type and no children have been added; in this case it is +// impossible to infer the type of the empty array. +// +// The function returns the following values: +// +// - variant: new, floating, #GVariant. +func (builder *VariantBuilder) End() *Variant { + var _arg0 *C.GVariantBuilder // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariantBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + + _cret = C.g_variant_builder_end(_arg0) + runtime.KeepAlive(builder) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// Open opens a subcontainer inside the given builder. When done adding items to +// the subcontainer, g_variant_builder_close() must be called. type is the type +// of the container: so to build a tuple of several values, type must include +// the tuple itself. +// +// It is an error to call this function in any way that would cause an +// inconsistent value to be constructed (ie: adding too many values or a value +// of an incorrect type). +// +// Example of building a nested variant: +// +// GVariantBuilder builder; +// guint32 some_number = get_number (); +// g_autoptr (GHashTable) some_dict = get_dict (); +// GHashTableIter iter; +// const gchar *key; +// const GVariant *value; +// g_autoptr (GVariant) output = NULL; +// +// g_variant_builder_init (&builder, G_VARIANT_TYPE ("(ua{sv})")); +// g_variant_builder_add (&builder, "u", some_number); +// g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}")); +// +// g_hash_table_iter_init (&iter, some_dict); +// while (g_hash_table_iter_next (&iter, (gpointer *) &key, (gpointer *) &value)) +// { +// g_variant_builder_open (&builder, G_VARIANT_TYPE ("{sv}")); +// g_variant_builder_add (&builder, "s", key); +// g_variant_builder_add (&builder, "v", value); +// g_variant_builder_close (&builder); +// } +// +// g_variant_builder_close (&builder); +// +// output = g_variant_builder_end (&builder);. +// +// The function takes the following parameters: +// +// - typ of the container. +func (builder *VariantBuilder) Open(typ *VariantType) { + var _arg0 *C.GVariantBuilder // out + var _arg1 *C.GVariantType // out + + _arg0 = (*C.GVariantBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + C.g_variant_builder_open(_arg0, _arg1) + runtime.KeepAlive(builder) + runtime.KeepAlive(typ) +} + +// VariantDict is a mutable interface to #GVariant dictionaries. +// +// It can be used for doing a sequence of dictionary lookups in an efficient +// way on an existing #GVariant dictionary or it can be used to construct new +// dictionaries with a hashtable-like interface. It can also be used for taking +// existing dictionaries and modifying them in order to create new ones. +// +// Dict can only be used with G_VARIANT_TYPE_VARDICT dictionaries. +// +// It is possible to use Dict allocated on the stack or on the heap. When using +// a stack-allocated Dict, you begin with a call to g_variant_dict_init() and +// free the resources with a call to g_variant_dict_clear(). +// +// Heap-allocated Dict follows normal refcounting rules: you allocate it with +// g_variant_dict_new() and use g_variant_dict_ref() and g_variant_dict_unref(). +// +// g_variant_dict_end() is used to convert the Dict back into a dictionary-type +// #GVariant. When used with stack-allocated instances, this also implicitly +// frees all associated memory, but for heap-allocated instances, you must still +// call g_variant_dict_unref() afterwards. +// +// You will typically want to use a heap-allocated Dict when you expose it as +// part of an API. For most other uses, the stack-allocated form will be more +// convenient. +// +// Consider the following two examples that do the same thing in each style: +// take an existing dictionary and look up the "count" uint32 key, adding +// 1 to it if it is found, or returning an error if the key is not found. +// Each returns the new dictionary as a floating #GVariant. +// +// Using a stack-allocated GVariantDict +// +// GVariant * +// add_to_count (GVariant *orig, +// GError **error) +// { +// GVariantDict *dict; +// GVariant *result; +// guint32 count; +// +// dict = g_variant_dict_new (orig); +// +// if (g_variant_dict_lookup (dict, "count", "u", &count)) +// { +// g_variant_dict_insert (dict, "count", "u", count + 1); +// result = g_variant_dict_end (dict); +// } +// else +// { +// g_set_error (...); +// result = NULL; +// } +// +// g_variant_dict_unref (dict); +// +// return result; +// } +// +// An instance of this type is always passed by reference. +type VariantDict struct { + *variantDict +} + +// variantDict is the struct that's finalized. +type variantDict struct { + native *C.GVariantDict +} + +func marshalVariantDict(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &VariantDict{&variantDict{(*C.GVariantDict)(b)}}, nil +} + +// NewVariantDict constructs a struct VariantDict. +func NewVariantDict(fromAsv *Variant) *VariantDict { + var _arg1 *C.GVariant // out + var _cret *C.GVariantDict // in + + if fromAsv != nil { + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(fromAsv))) + } + + _cret = C.g_variant_dict_new(_arg1) + runtime.KeepAlive(fromAsv) + + var _variantDict *VariantDict // out + + _variantDict = (*VariantDict)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variantDict)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_dict_unref((*C.GVariantDict)(intern.C)) + }, + ) + + return _variantDict +} + +// Clear releases all memory associated with a Dict without freeing the Dict +// structure itself. +// +// It typically only makes sense to do this on a stack-allocated Dict if you +// want to abort building the value part-way through. This function need not be +// called if you call g_variant_dict_end() and it also doesn't need to be called +// on dicts allocated with g_variant_dict_new (see g_variant_dict_unref() for +// that). +// +// It is valid to call this function on either an initialised Dict or one that +// was previously cleared by an earlier call to g_variant_dict_clear() but it is +// not valid to call this function on uninitialised memory. +func (dict *VariantDict) Clear() { + var _arg0 *C.GVariantDict // out + + _arg0 = (*C.GVariantDict)(gextras.StructNative(unsafe.Pointer(dict))) + + C.g_variant_dict_clear(_arg0) + runtime.KeepAlive(dict) +} + +// Contains checks if key exists in dict. +// +// The function takes the following parameters: +// +// - key to look up in the dictionary. +// +// The function returns the following values: +// +// - ok: TRUE if key is in dict. +func (dict *VariantDict) Contains(key string) bool { + var _arg0 *C.GVariantDict // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantDict)(gextras.StructNative(unsafe.Pointer(dict))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_dict_contains(_arg0, _arg1) + runtime.KeepAlive(dict) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// End returns the current value of dict as a #GVariant of type +// G_VARIANT_TYPE_VARDICT, clearing it in the process. +// +// It is not permissible to use dict in any way after this call except for +// reference counting operations (in the case of a heap-allocated Dict) +// or by reinitialising it with g_variant_dict_init() (in the case of +// stack-allocated). +// +// The function returns the following values: +// +// - variant: new, floating, #GVariant. +func (dict *VariantDict) End() *Variant { + var _arg0 *C.GVariantDict // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariantDict)(gextras.StructNative(unsafe.Pointer(dict))) + + _cret = C.g_variant_dict_end(_arg0) + runtime.KeepAlive(dict) + + var _variant *Variant // out + + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return _variant +} + +// InsertValue inserts (or replaces) a key in a Dict. +// +// value is consumed if it is floating. +// +// The function takes the following parameters: +// +// - key to insert a value for. +// - value to insert. +func (dict *VariantDict) InsertValue(key string, value *Variant) { + var _arg0 *C.GVariantDict // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariant // out + + _arg0 = (*C.GVariantDict)(gextras.StructNative(unsafe.Pointer(dict))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + C.g_variant_dict_insert_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(dict) + runtime.KeepAlive(key) + runtime.KeepAlive(value) +} + +// LookupValue looks up a value in a Dict. +// +// If key is not found in dictionary, NULL is returned. +// +// The expected_type string specifies what type of value is expected. If the +// value associated with key has a different type then NULL is returned. +// +// If the key is found and the value has the correct type, it is returned. +// If expected_type was specified then any non-NULL return value will have this +// type. +// +// The function takes the following parameters: +// +// - key to look up in the dictionary. +// - expectedType (optional) or NULL. +// +// The function returns the following values: +// +// - variant (optional): value of the dictionary key, or NULL. +func (dict *VariantDict) LookupValue(key string, expectedType *VariantType) *Variant { + var _arg0 *C.GVariantDict // out + var _arg1 *C.gchar // out + var _arg2 *C.GVariantType // out + var _cret *C.GVariant // in + + _arg0 = (*C.GVariantDict)(gextras.StructNative(unsafe.Pointer(dict))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + if expectedType != nil { + _arg2 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(expectedType))) + } + + _cret = C.g_variant_dict_lookup_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(dict) + runtime.KeepAlive(key) + runtime.KeepAlive(expectedType) + + var _variant *Variant // out + + if _cret != nil { + _variant = (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// Remove removes a key and its associated value from a Dict. +// +// The function takes the following parameters: +// +// - key to remove. +// +// The function returns the following values: +// +// - ok: TRUE if the key was found and removed. +func (dict *VariantDict) Remove(key string) bool { + var _arg0 *C.GVariantDict // out + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantDict)(gextras.StructNative(unsafe.Pointer(dict))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(key))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_dict_remove(_arg0, _arg1) + runtime.KeepAlive(dict) + runtime.KeepAlive(key) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// VariantType: type in the glib.Variant type system. +// +// This section introduces the glib.Variant type system. It is based, +// in large part, on the D-Bus type system, with two major changes +// and some minor lifting of restrictions. The D-Bus specification +// (http://dbus.freedesktop.org/doc/dbus-specification.html), therefore, +// provides a significant amount of information that is useful when working with +// glib.Variant. +// +// The first major change with respect to the D-Bus type system is the +// introduction of maybe (or ‘nullable’) types. Any type in glib.Variant can be +// converted to a maybe type, in which case, nothing (or null) becomes a valid +// value. Maybe types have been added by introducing the character m to type +// strings. +// +// The second major change is that the glib.Variant type system supports the +// concept of ‘indefinite types’ — types that are less specific than the normal +// types found in D-Bus. For example, it is possible to speak of ‘an array of +// any type’ in glib.Variant, where the D-Bus type system would require you to +// speak of ‘an array of integers’ or ‘an array of strings’. Indefinite types +// have been added by introducing the characters *, ? and r to type strings. +// +// Finally, all arbitrary restrictions relating to the complexity of types are +// lifted along with the restriction that dictionary entries may only appear +// nested inside of arrays. +// +// Just as in D-Bus, glib.Variant types are described with strings (‘type +// strings’). Subject to the differences mentioned above, these strings are of +// the same form as those found in D-Bus. Note, however: D-Bus always works in +// terms of messages and therefore individual type strings appear nowhere in its +// interface. Instead, ‘signatures’ are a concatenation of the strings of the +// type of each argument in a message. glib.Variant deals with single values +// directly so glib.Variant type strings always describe the type of exactly +// one value. This means that a D-Bus signature string is generally not a valid +// glib.Variant type string — except in the case that it is the signature of a +// message containing exactly one argument. +// +// An indefinite type is similar in spirit to what may be called an abstract +// type in other type systems. No value can exist that has an indefinite type +// as its type, but values can exist that have types that are subtypes of +// indefinite types. That is to say, glib.Variant.GetType() will never return an +// indefinite type, but calling glib.Variant.IsOfType() with an indefinite type +// may return true. For example, you cannot have a value that represents ‘an +// array of no particular type’, but you can have an ‘array of integers’ which +// certainly matches the type of ‘an array of no particular type’, since ‘array +// of integers’ is a subtype of ‘array of no particular type’. +// +// This is similar to how instances of abstract classes may not directly +// exist in other type systems, but instances of their non-abstract +// subtypes may. For example, in GTK, no object that has the type +// of GtkWidget (https://docs.gtk.org/gtk4/class.Widget.html) can +// exist (since GtkWidget is an abstract class), but a GtkWindow +// (https://docs.gtk.org/gtk4/class.Window.html) can certainly be instantiated, +// and you would say that a GtkWindow is a GtkWidget (since GtkWindow is a +// subclass of GtkWidget). +// +// Two types may not be compared by value; use glib.VariantType.Equal() or +// glib.VariantType.IsSubtypeOf() May be copied using glib.VariantType.Copy() +// and freed using glib.VariantType.Free(). +// +// # GVariant Type Strings +// +// A glib.Variant type string can be any of the following: +// +// - any basic type string (listed below) +// +// - v, r or * +// +// - one of the characters a or m, followed by another type string +// +// - the character (, followed by a concatenation of zero or more other type +// strings, followed by the character ) +// +// - the character {, followed by a basic type string (see below), followed by +// another type string, followed by the character } +// +// A basic type string describes a basic type (as per +// glib.VariantType.IsBasic()) and is always a single character in length. +// The valid basic type strings are b, y, n, q, i, u, x, t, h, d, s, o, g and ?. +// +// The above definition is recursive to arbitrary depth. aaaaai and +// (ui(nq((y)))s) are both valid type strings, as is a(aa(ui)(qna{ya(yd)})). +// In order to not hit memory limits, glib.Variant imposes a limit on recursion +// depth of 65 nested containers. This is the limit in the D-Bus specification +// (64) plus one to allow a GDBusMessage (../gio/class.DBusMessage.html) to be +// nested in a top-level tuple. +// +// The meaning of each of the characters is as follows: +// +// - b: the type string of G_VARIANT_TYPE_BOOLEAN; a boolean value. +// +// - y: the type string of G_VARIANT_TYPE_BYTE; a byte. +// +// - n: the type string of G_VARIANT_TYPE_INT16; a signed 16 bit integer. +// +// - q: the type string of G_VARIANT_TYPE_UINT16; an unsigned 16 bit integer. +// +// - i: the type string of G_VARIANT_TYPE_INT32; a signed 32 bit integer. +// +// - u: the type string of G_VARIANT_TYPE_UINT32; an unsigned 32 bit integer. +// +// - x: the type string of G_VARIANT_TYPE_INT64; a signed 64 bit integer. +// +// - t: the type string of G_VARIANT_TYPE_UINT64; an unsigned 64 bit integer. +// +// - h: the type string of G_VARIANT_TYPE_HANDLE; a signed 32 bit value that, +// by convention, is used as an index into an array of file descriptors that are +// sent alongside a D-Bus message. +// +// - d: the type string of G_VARIANT_TYPE_DOUBLE; a double precision floating +// point value. +// +// - s: the type string of G_VARIANT_TYPE_STRING; a string. +// +// - o: the type string of G_VARIANT_TYPE_OBJECT_PATH; a string in the form of a +// D-Bus object path. +// +// - g: the type string of G_VARIANT_TYPE_SIGNATURE; a string in the form of a +// D-Bus type signature. +// +// - ?: the type string of G_VARIANT_TYPE_BASIC; an indefinite type that is a +// supertype of any of the basic types. +// +// - v: the type string of G_VARIANT_TYPE_VARIANT; a container type that contain +// any other type of value. +// +// - a: used as a prefix on another type string to mean an array of that type; +// the type string ai, for example, is the type of an array of signed 32-bit +// integers. +// +// - m: used as a prefix on another type string to mean a ‘maybe’, +// or ‘nullable’, version of that type; the type string ms, for example, is the +// type of a value that maybe contains a string, or maybe contains nothing. +// +// - (): used to enclose zero or more other concatenated type strings to create +// a tuple type; the type string (is), for example, is the type of a pair of an +// integer and a string. +// +// - r: the type string of G_VARIANT_TYPE_TUPLE; an indefinite type that is a +// supertype of any tuple type, regardless of the number of items. +// +// - {}: used to enclose a basic type string concatenated with another type +// string to create a dictionary entry type, which usually appears inside of an +// array to form a dictionary; the type string a{sd}, for example, is the type +// of a dictionary that maps strings to double precision floating point values. +// +// The first type (the basic type) is the key type and the second type is +// the value type. The reason that the first type is restricted to being a +// basic type is so that it can easily be hashed. +// +// - *: the type string of G_VARIANT_TYPE_ANY; the indefinite type that is a +// supertype of all types. Note that, as with all type strings, this character +// represents exactly one type. It cannot be used inside of tuples to mean ‘any +// number of items’. +// +// Any type string of a container that contains an indefinite type is, itself, +// an indefinite type. For example, the type string a* (corresponding to +// G_VARIANT_TYPE_ARRAY) is an indefinite type that is a supertype of every +// array type. (*s) is a supertype of all tuples that contain exactly two items +// where the second item is a string. +// +// a{?*} is an indefinite type that is a supertype of all arrays containing +// dictionary entries where the key is any basic type and the value is any type +// at all. This is, by definition, a dictionary, so this type string corresponds +// to G_VARIANT_TYPE_DICTIONARY. Note that, due to the restriction that the key +// of a dictionary entry must be a basic type, {**} is not a valid type string. +// +// An instance of this type is always passed by reference. +type VariantType struct { + *variantType +} + +// variantType is the struct that's finalized. +type variantType struct { + native *C.GVariantType +} + +func marshalVariantType(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &VariantType{&variantType{(*C.GVariantType)(b)}}, nil +} + +// NewVariantType constructs a struct VariantType. +func NewVariantType(typeString string) *VariantType { + var _arg1 *C.gchar // out + var _cret *C.GVariantType // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typeString))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_type_new(_arg1) + runtime.KeepAlive(typeString) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variantType)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_type_free((*C.GVariantType)(intern.C)) + }, + ) + + return _variantType +} + +// NewVariantTypeArray constructs a struct VariantType. +func NewVariantTypeArray(element *VariantType) *VariantType { + var _arg1 *C.GVariantType // out + var _cret *C.GVariantType // in + + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(element))) + + _cret = C.g_variant_type_new_array(_arg1) + runtime.KeepAlive(element) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variantType)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_type_free((*C.GVariantType)(intern.C)) + }, + ) + + return _variantType +} + +// NewVariantTypeDictEntry constructs a struct VariantType. +func NewVariantTypeDictEntry(key *VariantType, value *VariantType) *VariantType { + var _arg1 *C.GVariantType // out + var _arg2 *C.GVariantType // out + var _cret *C.GVariantType // in + + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(key))) + _arg2 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(value))) + + _cret = C.g_variant_type_new_dict_entry(_arg1, _arg2) + runtime.KeepAlive(key) + runtime.KeepAlive(value) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variantType)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_type_free((*C.GVariantType)(intern.C)) + }, + ) + + return _variantType +} + +// NewVariantTypeMaybe constructs a struct VariantType. +func NewVariantTypeMaybe(element *VariantType) *VariantType { + var _arg1 *C.GVariantType // out + var _cret *C.GVariantType // in + + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(element))) + + _cret = C.g_variant_type_new_maybe(_arg1) + runtime.KeepAlive(element) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variantType)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_type_free((*C.GVariantType)(intern.C)) + }, + ) + + return _variantType +} + +// NewVariantTypeTuple constructs a struct VariantType. +func NewVariantTypeTuple(items []*VariantType) *VariantType { + var _arg1 **C.GVariantType // out + var _arg2 C.gint + var _cret *C.GVariantType // in + + _arg2 = (C.gint)(len(items)) + _arg1 = (**C.GVariantType)(C.calloc(C.size_t(len(items)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.GVariantType)(_arg1), len(items)) + for i := range items { + out[i] = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(items[i]))) + } + } + + _cret = C.g_variant_type_new_tuple(_arg1, _arg2) + runtime.KeepAlive(items) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variantType)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_type_free((*C.GVariantType)(intern.C)) + }, + ) + + return _variantType +} + +// Copy makes a copy of a Type. It is appropriate to call g_variant_type_free() +// on the return value. type may not be NULL. +// +// The function returns the following values: +// +// - variantType: new Type +// +// Since 2.24. +func (typ *VariantType) Copy() *VariantType { + var _arg0 *C.GVariantType // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_copy(_arg0) + runtime.KeepAlive(typ) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variantType)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_type_free((*C.GVariantType)(intern.C)) + }, + ) + + return _variantType +} + +// DupString returns a newly-allocated copy of the type string corresponding +// to type. The returned string is nul-terminated. It is appropriate to call +// g_free() on the return value. +// +// The function returns the following values: +// +// - utf8: corresponding type string +// +// Since 2.24. +func (typ *VariantType) DupString() string { + var _arg0 *C.GVariantType // out + var _cret *C.gchar // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_dup_string(_arg0) + runtime.KeepAlive(typ) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Element determines the element type of an array or maybe type. +// +// This function may only be used with array or maybe types. +// +// The function returns the following values: +// +// - variantType: element type of type +// +// Since 2.24. +func (typ *VariantType) Element() *VariantType { + var _arg0 *C.GVariantType // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_element(_arg0) + runtime.KeepAlive(typ) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _variantType +} + +// Equal compares type1 and type2 for equality. +// +// Only returns TRUE if the types are exactly equal. Even if one type is an +// indefinite type and the other is a subtype of it, FALSE will be returned +// if they are not exactly equal. If you want to check for subtypes, use +// g_variant_type_is_subtype_of(). +// +// The argument types of type1 and type2 are only #gconstpointer to allow use +// with Table without function pointer casting. For both arguments, a valid Type +// must be provided. +// +// The function takes the following parameters: +// +// - type2: Type. +// +// The function returns the following values: +// +// - ok: TRUE if type1 and type2 are exactly equal +// +// Since 2.24. +func (type1 *VariantType) Equal(type2 *VariantType) bool { + var _arg0 C.gconstpointer // out + var _arg1 C.gconstpointer // out + var _cret C.gboolean // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(type1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(type2))) + + _cret = C.g_variant_type_equal(_arg0, _arg1) + runtime.KeepAlive(type1) + runtime.KeepAlive(type2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// First determines the first item type of a tuple or dictionary entry type. +// +// This function may only be used with tuple or dictionary entry types, but must +// not be used with the generic tuple type G_VARIANT_TYPE_TUPLE. +// +// In the case of a dictionary entry type, this returns the type of the key. +// +// NULL is returned in case of type being G_VARIANT_TYPE_UNIT. +// +// This call, together with g_variant_type_next() provides an iterator interface +// over tuple and dictionary entry types. +// +// The function returns the following values: +// +// - variantType: first item type of type, or NULL +// +// Since 2.24. +func (typ *VariantType) First() *VariantType { + var _arg0 *C.GVariantType // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_first(_arg0) + runtime.KeepAlive(typ) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _variantType +} + +// StringLength returns the length of the type string corresponding to the given +// type. This function must be used to determine the valid extent of the memory +// region returned by g_variant_type_peek_string(). +// +// The function returns the following values: +// +// - gsize: length of the corresponding type string +// +// Since 2.24. +func (typ *VariantType) StringLength() uint { + var _arg0 *C.GVariantType // out + var _cret C.gsize // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_get_string_length(_arg0) + runtime.KeepAlive(typ) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Hash hashes type. +// +// The argument type of type is only #gconstpointer to allow use with Table +// without function pointer casting. A valid Type must be provided. +// +// The function returns the following values: +// +// - guint: hash value +// +// Since 2.24. +func (typ *VariantType) Hash() uint { + var _arg0 C.gconstpointer // out + var _cret C.guint // in + + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_hash(_arg0) + runtime.KeepAlive(typ) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// IsArray determines if the given type is an array type. This is true if the +// type string for type starts with an 'a'. +// +// This function returns TRUE for any indefinite type for which every definite +// subtype is an array type -- G_VARIANT_TYPE_ARRAY, for example. +// +// The function returns the following values: +// +// - ok: TRUE if type is an array type +// +// Since 2.24. +func (typ *VariantType) IsArray() bool { + var _arg0 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_is_array(_arg0) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsBasic determines if the given type is a basic type. +// +// Basic types are booleans, bytes, integers, doubles, strings, object paths and +// signatures. +// +// Only a basic type may be used as the key of a dictionary entry. +// +// This function returns FALSE for all indefinite types except +// G_VARIANT_TYPE_BASIC. +// +// The function returns the following values: +// +// - ok: TRUE if type is a basic type +// +// Since 2.24. +func (typ *VariantType) IsBasic() bool { + var _arg0 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_is_basic(_arg0) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsContainer determines if the given type is a container type. +// +// Container types are any array, maybe, tuple, or dictionary entry types plus +// the variant type. +// +// This function returns TRUE for any indefinite type for which every definite +// subtype is a container -- G_VARIANT_TYPE_ARRAY, for example. +// +// The function returns the following values: +// +// - ok: TRUE if type is a container type +// +// Since 2.24. +func (typ *VariantType) IsContainer() bool { + var _arg0 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_is_container(_arg0) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsDefinite determines if the given type is definite (ie: not indefinite). +// +// A type is definite if its type string does not contain any indefinite type +// characters ('*', '?', or 'r'). +// +// A #GVariant instance may not have an indefinite type, so calling this +// function on the result of g_variant_get_type() will always result in +// TRUE being returned. Calling this function on an indefinite type like +// G_VARIANT_TYPE_ARRAY, however, will result in FALSE being returned. +// +// The function returns the following values: +// +// - ok: TRUE if type is definite +// +// Since 2.24. +func (typ *VariantType) IsDefinite() bool { + var _arg0 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_is_definite(_arg0) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsDictEntry determines if the given type is a dictionary entry type. This is +// true if the type string for type starts with a '{'. +// +// This function returns TRUE for any indefinite type for which every definite +// subtype is a dictionary entry type -- G_VARIANT_TYPE_DICT_ENTRY, for example. +// +// The function returns the following values: +// +// - ok: TRUE if type is a dictionary entry type +// +// Since 2.24. +func (typ *VariantType) IsDictEntry() bool { + var _arg0 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_is_dict_entry(_arg0) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsMaybe determines if the given type is a maybe type. This is true if the +// type string for type starts with an 'm'. +// +// This function returns TRUE for any indefinite type for which every definite +// subtype is a maybe type -- G_VARIANT_TYPE_MAYBE, for example. +// +// The function returns the following values: +// +// - ok: TRUE if type is a maybe type +// +// Since 2.24. +func (typ *VariantType) IsMaybe() bool { + var _arg0 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_is_maybe(_arg0) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsSubtypeOf checks if type is a subtype of supertype. +// +// This function returns TRUE if type is a subtype of supertype. All types are +// considered to be subtypes of themselves. Aside from that, only indefinite +// types can have subtypes. +// +// The function takes the following parameters: +// +// - supertype: Type. +// +// The function returns the following values: +// +// - ok: TRUE if type is a subtype of supertype +// +// Since 2.24. +func (typ *VariantType) IsSubtypeOf(supertype *VariantType) bool { + var _arg0 *C.GVariantType // out + var _arg1 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + _arg1 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(supertype))) + + _cret = C.g_variant_type_is_subtype_of(_arg0, _arg1) + runtime.KeepAlive(typ) + runtime.KeepAlive(supertype) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsTuple determines if the given type is a tuple type. This is true if the +// type string for type starts with a '(' or if type is G_VARIANT_TYPE_TUPLE. +// +// This function returns TRUE for any indefinite type for which every definite +// subtype is a tuple type -- G_VARIANT_TYPE_TUPLE, for example. +// +// The function returns the following values: +// +// - ok: TRUE if type is a tuple type +// +// Since 2.24. +func (typ *VariantType) IsTuple() bool { + var _arg0 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_is_tuple(_arg0) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsVariant determines if the given type is the variant type. +// +// The function returns the following values: +// +// - ok: TRUE if type is the variant type +// +// Since 2.24. +func (typ *VariantType) IsVariant() bool { + var _arg0 *C.GVariantType // out + var _cret C.gboolean // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_is_variant(_arg0) + runtime.KeepAlive(typ) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Key determines the key type of a dictionary entry type. +// +// This function may only be used with a dictionary entry type. Other than the +// additional restriction, this call is equivalent to g_variant_type_first(). +// +// The function returns the following values: +// +// - variantType: key type of the dictionary entry +// +// Since 2.24. +func (typ *VariantType) Key() *VariantType { + var _arg0 *C.GVariantType // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_key(_arg0) + runtime.KeepAlive(typ) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _variantType +} + +// NItems determines the number of items contained in a tuple or dictionary +// entry type. +// +// This function may only be used with tuple or dictionary entry types, but must +// not be used with the generic tuple type G_VARIANT_TYPE_TUPLE. +// +// In the case of a dictionary entry type, this function will always return 2. +// +// The function returns the following values: +// +// - gsize: number of items in type +// +// Since 2.24. +func (typ *VariantType) NItems() uint { + var _arg0 *C.GVariantType // out + var _cret C.gsize // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_n_items(_arg0) + runtime.KeepAlive(typ) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Next determines the next item type of a tuple or dictionary entry type. +// +// type must be the result of a previous call to g_variant_type_first() or +// g_variant_type_next(). +// +// If called on the key type of a dictionary entry then this call returns the +// value type. If called on the value type of a dictionary entry then this call +// returns NULL. +// +// For tuples, NULL is returned when type is the last item in a tuple. +// +// The function returns the following values: +// +// - variantType: next Type after type, or NULL +// +// Since 2.24. +func (typ *VariantType) Next() *VariantType { + var _arg0 *C.GVariantType // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_next(_arg0) + runtime.KeepAlive(typ) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _variantType +} + +// Value determines the value type of a dictionary entry type. +// +// This function may only be used with a dictionary entry type. +// +// The function returns the following values: +// +// - variantType: value type of the dictionary entry +// +// Since 2.24. +func (typ *VariantType) Value() *VariantType { + var _arg0 *C.GVariantType // out + var _cret *C.GVariantType // in + + _arg0 = (*C.GVariantType)(gextras.StructNative(unsafe.Pointer(typ))) + + _cret = C.g_variant_type_value(_arg0) + runtime.KeepAlive(typ) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _variantType +} + +func VariantTypeChecked_(typeString string) *VariantType { + var _arg1 *C.gchar // out + var _cret *C.GVariantType // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typeString))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_type_checked_(_arg1) + runtime.KeepAlive(typeString) + + var _variantType *VariantType // out + + _variantType = (*VariantType)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _variantType +} + +func VariantTypeStringGetDepth_(typeString string) uint { + var _arg1 *C.gchar // out + var _cret C.gsize // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typeString))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_type_string_get_depth_(_arg1) + runtime.KeepAlive(typeString) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// VariantTypeStringIsValid checks if type_string is a valid GVariant type +// string. This call is equivalent to calling g_variant_type_string_scan() and +// confirming that the following character is a nul terminator. +// +// The function takes the following parameters: +// +// - typeString: pointer to any string. +// +// The function returns the following values: +// +// - ok: TRUE if type_string is exactly one valid type string +// +// Since 2.24. +func VariantTypeStringIsValid(typeString string) bool { + var _arg1 *C.gchar // out + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typeString))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.g_variant_type_string_is_valid(_arg1) + runtime.KeepAlive(typeString) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// VariantTypeStringScan: scan for a single complete and valid GVariant type +// string in string. The memory pointed to by limit (or bytes beyond it) is +// never accessed. +// +// If a valid type string is found, endptr is updated to point to the first +// character past the end of the string that was found and TRUE is returned. +// +// If there is no valid type string starting at string, or if the type string +// does not end before limit then FALSE is returned. +// +// For the simple case of checking if a string is a valid type string, +// see g_variant_type_string_is_valid(). +// +// The function takes the following parameters: +// +// - str: pointer to any string. +// - limit (optional): end of string, or NULL. +// +// The function returns the following values: +// +// - endptr (optional): location to store the end pointer, or NULL. +// - ok: TRUE if a valid type string was found. +func VariantTypeStringScan(str, limit string) (string, bool) { + var _arg1 *C.gchar // out + var _arg2 *C.gchar // out + var _arg3 *C.gchar // in + var _cret C.gboolean // in + + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + if limit != "" { + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(limit))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.g_variant_type_string_scan(_arg1, _arg2, &_arg3) + runtime.KeepAlive(str) + runtime.KeepAlive(limit) + + var _endptr string // out + var _ok bool // out + + if _arg3 != nil { + _endptr = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) + defer C.free(unsafe.Pointer(_arg3)) + } + if _cret != 0 { + _ok = true + } + + return _endptr, _ok +} + +// NewBytesWithGo is similar to NewBytes, except the given Go byte slice +// is not copied, but will be kept alive for the lifetime of the GBytes. +// Note that the user must NOT modify data. +// +// Refer to g_bytes_new_with_free_func() for more information. +func NewBytesWithGo(data []byte) *Bytes { + byteID := gbox.Assign(data) + + v := C.g_bytes_new_with_free_func( + C.gconstpointer(unsafe.Pointer(&data[0])), + C.gsize(len(data)), + C.GDestroyNotify((*[0]byte)(C.callbackDelete)), + C.gpointer(byteID), + ) + + _bytes := (*Bytes)(gextras.NewStructNative(unsafe.Pointer(v))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// Use calls f with Bytes' internal byte slice without making a copy. f +// must NOT move the byte slice to outside of the closure, since the +// slice's internal array buffer may be freed after. +func (b *Bytes) Use(f func([]byte)) { + var ptr C.gconstpointer // in + var len C.gsize // in + + ptr = C.g_bytes_get_data( + (*C.GBytes)(gextras.StructNative(unsafe.Pointer(b))), + &len, + ) + + var buf []byte + + h := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) + h.Data = uintptr(ptr) + h.Len = int(len) + h.Cap = int(len) + + f(buf) + runtime.KeepAlive(b) +} + +func marshalVariant(p uintptr) (interface{}, error) { + _cret := C.g_value_dup_variant((*C.GValue)(unsafe.Pointer(p))) + if _cret == nil { + return (*Variant)(nil), nil + } + + _variant := (*Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + return _variant, nil +} + +// ForEach iterates over items in value. The iteration breaks out once f +// returns true. This method wraps around g_variant_iter_new. +func (value *Variant) ForEach(f func(*Variant) (stop bool)) { + valueNative := (*C.GVariant)(gextras.StructNative(unsafe.Pointer(value))) + + var iter C.GVariantIter + C.g_variant_iter_init(&iter, valueNative) + + next := func() *Variant { + item := C.g_variant_iter_next_value(&iter) + if item == nil { + return nil + } + + variant := (*Variant)(gextras.NewStructNative(unsafe.Pointer(item))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + + return variant + } + + for item := next(); item != nil; item = next() { + if f(item) { + break + } + } + + runtime.KeepAlive(value) +} + +// IdleAdd is an alias for pkg/core/glib.IdleAdd. +func IdleAdd(f interface{}) SourceHandle { + return coreglib.IdleAdd(f) +} + +// IdleAddPriority is an alias for pkg/core/glib.IdleAddPriority. +func IdleAddPriority(p Priority, f interface{}) SourceHandle { + return coreglib.IdleAddPriority(p, f) +} + +// TimeoutAdd is an alias for pkg/core/glib.TimeoutAdd. +func TimeoutAdd(ms uint, f interface{}) SourceHandle { + return coreglib.TimeoutAdd(ms, f) +} + +// TimeoutAddPriority is an alias for pkg/core/glib.TimeoutAddPriority. +func TimeoutAddPriority(ms uint, p Priority, f interface{}) SourceHandle { + return coreglib.TimeoutAddPriority(ms, p, f) +} + +// TimeoutSecondsAdd is an alias for pkg/core/glib.TimeoutSecondsAdd. +func TimeoutSecondsAdd(s uint, f interface{}) SourceHandle { + return coreglib.TimeoutSecondsAdd(s, f) +} + +// TimeoutSecondsAddPriority is an alias for pkg/core/glib.TimeoutSecondsAddPriority. +func TimeoutSecondsAddPriority(s uint, p Priority, f interface{}) SourceHandle { + return coreglib.TimeoutSecondsAddPriority(s, p, f) +} + +// TypeFromName is an alias for pkg/core/glib.TypeFromName. +func TypeFromName(typeName string) Type { + return coreglib.TypeFromName(typeName) +} + +// NewValue is an alias for pkg/core/glib.NewValue. +func NewValue(v interface{}) *Value { + return coreglib.NewValue(v) +} + +// SourceRemove is an alias for pkg/core/glib.SourceRemove. +func SourceRemove(src SourceHandle) bool { + return coreglib.SourceRemove(src) +} + +// ObjectEq is an alias for pkg/core/glib.ObjectEq. +func ObjectEq(obj1 Objector, obj2 Objector) bool { + return coreglib.ObjectEq(obj1, obj2) +} + +// BaseObject is an alias for pkg/core/glib.BaseObject. +func BaseObject(obj Objector) *Object { + return coreglib.BaseObject(obj) +} + +// Object is an alias for pkg/core/glib.Object. +type Object = coreglib.Object + +// Objector is an alias for pkg/core/glib.Objector. +type Objector = coreglib.Objector + +// Type is an alias for pkg/core/glib.Type. +type Type = coreglib.Type + +// Value is an alias for pkg/core/glib.Value. +type Value = coreglib.Value + +// Priority is an alias for pkg/core/glib.Priority. +type Priority = coreglib.Priority + +// SourceHandle is an alias for pkg/core/glib.SourceHandle. +type SourceHandle = coreglib.SourceHandle + +// SignalHandle is an alias for pkg/core/glib.SignalHandle. +type SignalHandle = coreglib.SignalHandle + +// Constant aliases from pkg/core/glib. +const ( + TypeInvalid = coreglib.TypeInvalid + TypeNone = coreglib.TypeNone + TypeInterface = coreglib.TypeInterface + TypeChar = coreglib.TypeChar + TypeUchar = coreglib.TypeUchar + TypeBoolean = coreglib.TypeBoolean + TypeInt = coreglib.TypeInt + TypeUint = coreglib.TypeUint + TypeLong = coreglib.TypeLong + TypeUlong = coreglib.TypeUlong + TypeInt64 = coreglib.TypeInt64 + TypeUint64 = coreglib.TypeUint64 + TypeEnum = coreglib.TypeEnum + TypeFlags = coreglib.TypeFlags + TypeFloat = coreglib.TypeFloat + TypeDouble = coreglib.TypeDouble + TypeString = coreglib.TypeString + TypePointer = coreglib.TypePointer + TypeBoxed = coreglib.TypeBoxed + TypeParam = coreglib.TypeParam + TypeObject = coreglib.TypeObject + TypeVariant = coreglib.TypeVariant + + PriorityHigh = coreglib.PriorityHigh + PriorityDefault = coreglib.PriorityDefault + PriorityHighIdle = coreglib.PriorityHighIdle + PriorityDefaultIdle = coreglib.PriorityDefaultIdle + PriorityLow = coreglib.PriorityLow +) + +// NewVariantValue creates a new GValue from a GVariant. This function +// only exists as a workaround for coreglib's cyclical imports. It +// be removed in the future once coreglib is merged in. +func NewVariantValue(variant *Variant) *coreglib.Value { + value := coreglib.InitValue(coreglib.TypeVariant) + C.g_value_set_variant( + (*C.GValue)(unsafe.Pointer(value.Native())), + (*C.GVariant)(gextras.StructNative(unsafe.Pointer(variant))), + ) + return value +} + +// Value returns the field's value. +func (l *LogField) Value() string { + if l.native.length == -1 { + return C.GoString((*C.gchar)(unsafe.Pointer(l.native.value))) + } + return C.GoStringN((*C.gchar)(unsafe.Pointer(l.native.value)), C.int(l.native.length)) +} + +// logSetWriter sets the log writer to the given callback, which should +// take in a list of pair of key-value strings and return true if the +// log has been successfully written. It is a wrapper around +// g_log_set_writer_func. +func logSetWriter(f LogWriterFunc) { + data := gbox.Assign(f) + C.g_log_set_writer_func( + C.GLogWriterFunc((*[0]byte)(C._gotk4_glib2_LogWriterFunc)), + C.gpointer(data), + C.GDestroyNotify((*[0]byte)(C.callbackDelete)), + ) +} + +func init() { + logSetWriter(func(lvl LogLevelFlags, fields []LogField) LogWriterOutput { + handle := newSlogWriterFunc(slog.Default()) + handle(lvl, fields) + return LogWriterHandled + }) +} + +// Support $G_MESSAGES_DEBUG. +var debugDomains = func() map[string]struct{} { + debugDomains := make(map[string]struct{}) + for _, debugDomain := range strings.Fields(os.Getenv("G_MESSAGES_DEBUG")) { + debugDomains[debugDomain] = struct{}{} + } + return debugDomains +}() + +// Special case: G_MESSAGES_DEBUG=all. +var _, debugAllDomains = debugDomains["all"] + +// newSlogWriterFunc returns a new LogWriterFunc that writes to the given +// slog.Logger. +func newSlogWriterFunc(l *slog.Logger) LogWriterFunc { + return func(lvl LogLevelFlags, fields []LogField) LogWriterOutput { + attrs := make([]slog.Attr, 0, len(fields)) + var message, domain string + + for _, field := range fields { + k := field.Key() + v := field.Value() + if k == "MESSAGE" { + message = v + } else { + if k == "GLIB_DOMAIN" { + domain = v + } + k = strings.ToLower(k) + attrs = append(attrs, slog.String(k, v)) + } + } + + if !debugAllDomains && (lvl&LogLevelDebug != 0) && domain != "" { + if _, ok := debugDomains[domain]; !ok { + return LogWriterHandled + } + } + + slogLevel := slog.LevelInfo + switch { + case lvl.Has(LogLevelError), lvl.Has(LogLevelCritical): + slogLevel = slog.LevelError + case lvl.Has(LogLevelWarning): + slogLevel = slog.LevelWarn + case lvl.Has(LogLevelMessage), lvl.Has(LogLevelInfo): + slogLevel = slog.LevelInfo + case lvl.Has(LogLevelDebug): + slogLevel = slog.LevelDebug + } + + l.LogAttrs(context.Background(), slogLevel, message, attrs...) + + if lvl.Has(LogFlagFatal) { + panic(message) + } + + return LogWriterHandled + } +} + +// NewTimeZoneFromGo creates a new TimeZone instance from Go's Location. +// The location's accuracy is down to the second. +func NewTimeZoneFromGo(loc *time.Location) *TimeZone { + switch loc { + case time.UTC: + return NewTimeZoneUTC() + case time.Local: + return NewTimeZoneLocal() + } + + t1 := time.Date(2009, time.November, 10, 23, 0, 0, 0, loc) + t2 := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC) + return NewTimeZoneOffset(int32(t2.Sub(t1) / time.Second)) +} + +// NewDateTimeFromGo creates a new DateTime instance from Go's Time. The +// TimeZone of the DateTime will be implicitly converted from the Time. +func NewDateTimeFromGo(t time.Time) *DateTime { + tz := NewTimeZoneFromGo(t.Location()) + + Y, M, D := t.Date() + h, m, s := t.Clock() + + // Second offset within a minute in nanoseconds. + seconds := (time.Duration(s) * time.Second) + time.Duration(t.Nanosecond()) + + return NewDateTime(tz, int(Y), int(M), int(D), int(h), int(m), seconds.Seconds()) +} + +// NewObjectComparer returns a CompareDataFunc that uses the given function to +// compare two objects of type T. If the underlying objects are not of type T, +// then the function panics. If the underlying pointers aren't objects, then the +// behavior is undefined. +func NewObjectComparer[T Objector](f func(a, b T) int) CompareDataFunc { + return func(a, b unsafe.Pointer) int { + var aobj, bobj T + if a != nil { + aobj = coreglib.Take(a).Cast().(T) + } + if b != nil { + bobj = coreglib.Take(b).Cast().(T) + } + return f(aobj, bobj) + } +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/glib/v2/glib_export.go b/vendor/github.com/diamondburned/gotk4/pkg/glib/v2/glib_export.go new file mode 100644 index 00000000..4f400edb --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/glib/v2/glib_export.go @@ -0,0 +1,224 @@ +// Code generated by girgen. DO NOT EDIT. + +package glib + +import ( + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gextras" +) + +// #include +// #include +import "C" + +//export _gotk4_glib2_CompareDataFunc +func _gotk4_glib2_CompareDataFunc(arg1 C.gconstpointer, arg2 C.gconstpointer, arg3 C.gpointer) (cret C.gint) { + var fn CompareDataFunc + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(CompareDataFunc) + } + + var _a unsafe.Pointer // out + var _b unsafe.Pointer // out + + _a = (unsafe.Pointer)(unsafe.Pointer(arg1)) + _b = (unsafe.Pointer)(unsafe.Pointer(arg2)) + + gint := fn(_a, _b) + + var _ int + + cret = C.gint(gint) + + return cret +} + +//export _gotk4_glib2_EqualFuncFull +func _gotk4_glib2_EqualFuncFull(arg1 C.gconstpointer, arg2 C.gconstpointer, arg3 C.gpointer) (cret C.gboolean) { + var fn EqualFuncFull + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(EqualFuncFull) + } + + var _a unsafe.Pointer // out + var _b unsafe.Pointer // out + + _a = (unsafe.Pointer)(unsafe.Pointer(arg1)) + _b = (unsafe.Pointer)(unsafe.Pointer(arg2)) + + ok := fn(_a, _b) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_glib2_Func +func _gotk4_glib2_Func(arg1 C.gpointer, arg2 C.gpointer) { + var fn Func + { + v := gbox.Get(uintptr(arg2)) + if v == nil { + panic(`callback not found`) + } + fn = v.(Func) + } + + var _data unsafe.Pointer // out + + _data = (unsafe.Pointer)(unsafe.Pointer(arg1)) + + fn(_data) +} + +//export _gotk4_glib2_HFunc +func _gotk4_glib2_HFunc(arg1 C.gpointer, arg2 C.gpointer, arg3 C.gpointer) { + var fn HFunc + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(HFunc) + } + + var _key unsafe.Pointer // out + var _value unsafe.Pointer // out + + _key = (unsafe.Pointer)(unsafe.Pointer(arg1)) + _value = (unsafe.Pointer)(unsafe.Pointer(arg2)) + + fn(_key, _value) +} + +//export _gotk4_glib2_HRFunc +func _gotk4_glib2_HRFunc(arg1 C.gpointer, arg2 C.gpointer, arg3 C.gpointer) (cret C.gboolean) { + var fn HRFunc + { + v := gbox.Get(uintptr(arg3)) + if v == nil { + panic(`callback not found`) + } + fn = v.(HRFunc) + } + + var _key unsafe.Pointer // out + var _value unsafe.Pointer // out + + _key = (unsafe.Pointer)(unsafe.Pointer(arg1)) + _value = (unsafe.Pointer)(unsafe.Pointer(arg2)) + + ok := fn(_key, _value) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_glib2_LogFunc +func _gotk4_glib2_LogFunc(arg1 *C.gchar, arg2 C.GLogLevelFlags, arg3 *C.gchar, arg4 C.gpointer) { + var fn LogFunc + { + v := gbox.Get(uintptr(arg4)) + if v == nil { + panic(`callback not found`) + } + fn = v.(LogFunc) + } + + var _logDomain string // out + var _logLevel LogLevelFlags // out + var _message string // out + + _logDomain = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _logLevel = LogLevelFlags(arg2) + _message = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) + + fn(_logDomain, _logLevel, _message) +} + +//export _gotk4_glib2_LogWriterFunc +func _gotk4_glib2_LogWriterFunc(arg1 C.GLogLevelFlags, arg2 *C.GLogField, arg3 C.gsize, arg4 C.gpointer) (cret C.GLogWriterOutput) { + var fn LogWriterFunc + { + v := gbox.Get(uintptr(arg4)) + if v == nil { + panic(`callback not found`) + } + fn = v.(LogWriterFunc) + } + + var _logLevel LogLevelFlags // out + var _fields []LogField // out + + _logLevel = LogLevelFlags(arg1) + { + src := unsafe.Slice((*C.GLogField)(arg2), arg3) + _fields = make([]LogField, arg3) + for i := 0; i < int(arg3); i++ { + _fields[i] = *(*LogField)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + + logWriterOutput := fn(_logLevel, _fields) + + var _ LogWriterOutput + + cret = C.GLogWriterOutput(logWriterOutput) + + return cret +} + +//export _gotk4_glib2_SourceFunc +func _gotk4_glib2_SourceFunc(arg1 C.gpointer) (cret C.gboolean) { + var fn SourceFunc + { + v := gbox.Get(uintptr(arg1)) + if v == nil { + panic(`callback not found`) + } + fn = v.(SourceFunc) + } + + ok := fn() + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} + +//export _gotk4_glib2_SourceOnceFunc +func _gotk4_glib2_SourceOnceFunc(arg1 C.gpointer) { + var fn SourceOnceFunc + { + v := gbox.Get(uintptr(arg1)) + if v == nil { + panic(`callback not found`) + } + fn = v.(SourceOnceFunc) + } + + fn() +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/graphene/graphene.go b/vendor/github.com/diamondburned/gotk4/pkg/graphene/graphene.go new file mode 100644 index 00000000..fe1a1120 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/graphene/graphene.go @@ -0,0 +1,11069 @@ +// Code generated by girgen. DO NOT EDIT. + +package graphene + +import ( + "fmt" + "runtime" + _ "runtime/cgo" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gextras" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" +) + +// #cgo pkg-config: graphene-gobject-1.0 graphene-1.0 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// #include +// #include +import "C" + +// GType values. +var ( + GTypeBox = coreglib.Type(C.graphene_box_get_type()) + GTypeEuler = coreglib.Type(C.graphene_euler_get_type()) + GTypeFrustum = coreglib.Type(C.graphene_frustum_get_type()) + GTypeMatrix = coreglib.Type(C.graphene_matrix_get_type()) + GTypePlane = coreglib.Type(C.graphene_plane_get_type()) + GTypePoint = coreglib.Type(C.graphene_point_get_type()) + GTypePoint3D = coreglib.Type(C.graphene_point3d_get_type()) + GTypeQuad = coreglib.Type(C.graphene_quad_get_type()) + GTypeQuaternion = coreglib.Type(C.graphene_quaternion_get_type()) + GTypeRay = coreglib.Type(C.graphene_ray_get_type()) + GTypeRect = coreglib.Type(C.graphene_rect_get_type()) + GTypeSize = coreglib.Type(C.graphene_size_get_type()) + GTypeSphere = coreglib.Type(C.graphene_sphere_get_type()) + GTypeTriangle = coreglib.Type(C.graphene_triangle_get_type()) + GTypeVec2 = coreglib.Type(C.graphene_vec2_get_type()) + GTypeVec3 = coreglib.Type(C.graphene_vec3_get_type()) + GTypeVec4 = coreglib.Type(C.graphene_vec4_get_type()) +) + +func init() { + coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{ + coreglib.TypeMarshaler{T: GTypeBox, F: marshalBox}, + coreglib.TypeMarshaler{T: GTypeEuler, F: marshalEuler}, + coreglib.TypeMarshaler{T: GTypeFrustum, F: marshalFrustum}, + coreglib.TypeMarshaler{T: GTypeMatrix, F: marshalMatrix}, + coreglib.TypeMarshaler{T: GTypePlane, F: marshalPlane}, + coreglib.TypeMarshaler{T: GTypePoint, F: marshalPoint}, + coreglib.TypeMarshaler{T: GTypePoint3D, F: marshalPoint3D}, + coreglib.TypeMarshaler{T: GTypeQuad, F: marshalQuad}, + coreglib.TypeMarshaler{T: GTypeQuaternion, F: marshalQuaternion}, + coreglib.TypeMarshaler{T: GTypeRay, F: marshalRay}, + coreglib.TypeMarshaler{T: GTypeRect, F: marshalRect}, + coreglib.TypeMarshaler{T: GTypeSize, F: marshalSize}, + coreglib.TypeMarshaler{T: GTypeSphere, F: marshalSphere}, + coreglib.TypeMarshaler{T: GTypeTriangle, F: marshalTriangle}, + coreglib.TypeMarshaler{T: GTypeVec2, F: marshalVec2}, + coreglib.TypeMarshaler{T: GTypeVec3, F: marshalVec3}, + coreglib.TypeMarshaler{T: GTypeVec4, F: marshalVec4}, + }) +} + +const PI = 3.141593 +const PI_2 = 1.570796 + +// VEC2_LEN evaluates to the number of components of a #graphene_vec2_t. +// +// This symbol is useful when declaring a C array of floating point values to be +// used with graphene_vec2_init_from_float() and graphene_vec2_to_float(), e.g. +// +// float v[GRAPHENE_VEC2_LEN]; +// +// // vec is defined elsewhere +// graphene_vec2_to_float (&vec, v); +// +// for (int i = 0; i < GRAPHENE_VEC2_LEN; i++) +// fprintf (stdout, "component d: g\n", i, v[i]);. +const VEC2_LEN = 2 + +// VEC3_LEN evaluates to the number of components of a #graphene_vec3_t. +// +// This symbol is useful when declaring a C array of floating point values to be +// used with graphene_vec3_init_from_float() and graphene_vec3_to_float(), e.g. +// +// float v[GRAPHENE_VEC3_LEN]; +// +// // vec is defined elsewhere +// graphene_vec3_to_float (&vec, v); +// +// for (int i = 0; i < GRAPHENE_VEC2_LEN; i++) +// fprintf (stdout, "component d: g\n", i, v[i]);. +const VEC3_LEN = 3 + +// VEC4_LEN evaluates to the number of components of a #graphene_vec4_t. +// +// This symbol is useful when declaring a C array of floating point values to be +// used with graphene_vec4_init_from_float() and graphene_vec4_to_float(), e.g. +// +// float v[GRAPHENE_VEC4_LEN]; +// +// // vec is defined elsewhere +// graphene_vec4_to_float (&vec, v); +// +// for (int i = 0; i < GRAPHENE_VEC4_LEN; i++) +// fprintf (stdout, "component d: g\n", i, v[i]);. +const VEC4_LEN = 4 + +// EulerOrder: specify the order of the rotations on each axis. +// +// The GRAPHENE_EULER_ORDER_DEFAULT value is special, and is used as an alias +// for one of the other orders. +type EulerOrder C.gint + +const ( + // EulerOrderDefault: rotate in the default order; the default order is one + // of the following enumeration values. + EulerOrderDefault EulerOrder = -1 + // EulerOrderXYZ: rotate in the X, Y, and Z order. Deprecated in Graphene + // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SXYZ. + EulerOrderXYZ EulerOrder = 0 + // EulerOrderYZX: rotate in the Y, Z, and X order. Deprecated in Graphene + // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SYZX. + EulerOrderYZX EulerOrder = 1 + // EulerOrderZXY: rotate in the Z, X, and Y order. Deprecated in Graphene + // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SZXY. + EulerOrderZXY EulerOrder = 2 + // EulerOrderXZY: rotate in the X, Z, and Y order. Deprecated in Graphene + // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SXZY. + EulerOrderXZY EulerOrder = 3 + // EulerOrderYXZ: rotate in the Y, X, and Z order. Deprecated in Graphene + // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SYXZ. + EulerOrderYXZ EulerOrder = 4 + // EulerOrderZYX: rotate in the Z, Y, and X order. Deprecated in Graphene + // 1.10, it's an alias for GRAPHENE_EULER_ORDER_SZYX. + EulerOrderZYX EulerOrder = 5 + // EulerOrderSXYZ defines a static rotation along the X, Y, and Z axes + // (Since: 1.10). + EulerOrderSXYZ EulerOrder = 6 + // EulerOrderSXYX defines a static rotation along the X, Y, and X axes + // (Since: 1.10). + EulerOrderSXYX EulerOrder = 7 + // EulerOrderSXZY defines a static rotation along the X, Z, and Y axes + // (Since: 1.10). + EulerOrderSXZY EulerOrder = 8 + // EulerOrderSXZX defines a static rotation along the X, Z, and X axes + // (Since: 1.10). + EulerOrderSXZX EulerOrder = 9 + // EulerOrderSYZX defines a static rotation along the Y, Z, and X axes + // (Since: 1.10). + EulerOrderSYZX EulerOrder = 10 + // EulerOrderSYZY defines a static rotation along the Y, Z, and Y axes + // (Since: 1.10). + EulerOrderSYZY EulerOrder = 11 + // EulerOrderSYXZ defines a static rotation along the Y, X, and Z axes + // (Since: 1.10). + EulerOrderSYXZ EulerOrder = 12 + // EulerOrderSYXY defines a static rotation along the Y, X, and Y axes + // (Since: 1.10). + EulerOrderSYXY EulerOrder = 13 + // EulerOrderSZXY defines a static rotation along the Z, X, and Y axes + // (Since: 1.10). + EulerOrderSZXY EulerOrder = 14 + // EulerOrderSZXZ defines a static rotation along the Z, X, and Z axes + // (Since: 1.10). + EulerOrderSZXZ EulerOrder = 15 + // EulerOrderSZYX defines a static rotation along the Z, Y, and X axes + // (Since: 1.10). + EulerOrderSZYX EulerOrder = 16 + // EulerOrderSZYZ defines a static rotation along the Z, Y, and Z axes + // (Since: 1.10). + EulerOrderSZYZ EulerOrder = 17 + // EulerOrderRZYX defines a relative rotation along the Z, Y, and X axes + // (Since: 1.10). + EulerOrderRZYX EulerOrder = 18 + // EulerOrderRXYX defines a relative rotation along the X, Y, and X axes + // (Since: 1.10). + EulerOrderRXYX EulerOrder = 19 + // EulerOrderRYZX defines a relative rotation along the Y, Z, and X axes + // (Since: 1.10). + EulerOrderRYZX EulerOrder = 20 + // EulerOrderRXZX defines a relative rotation along the X, Z, and X axes + // (Since: 1.10). + EulerOrderRXZX EulerOrder = 21 + // EulerOrderRXZY defines a relative rotation along the X, Z, and Y axes + // (Since: 1.10). + EulerOrderRXZY EulerOrder = 22 + // EulerOrderRYZY defines a relative rotation along the Y, Z, and Y axes + // (Since: 1.10). + EulerOrderRYZY EulerOrder = 23 + // EulerOrderRZXY defines a relative rotation along the Z, X, and Y axes + // (Since: 1.10). + EulerOrderRZXY EulerOrder = 24 + // EulerOrderRYXY defines a relative rotation along the Y, X, and Y axes + // (Since: 1.10). + EulerOrderRYXY EulerOrder = 25 + // EulerOrderRYXZ defines a relative rotation along the Y, X, and Z axes + // (Since: 1.10). + EulerOrderRYXZ EulerOrder = 26 + // EulerOrderRZXZ defines a relative rotation along the Z, X, and Z axes + // (Since: 1.10). + EulerOrderRZXZ EulerOrder = 27 + // EulerOrderRXYZ defines a relative rotation along the X, Y, and Z axes + // (Since: 1.10). + EulerOrderRXYZ EulerOrder = 28 + // EulerOrderRZYZ defines a relative rotation along the Z, Y, and Z axes + // (Since: 1.10). + EulerOrderRZYZ EulerOrder = 29 +) + +// String returns the name in string for EulerOrder. +func (e EulerOrder) String() string { + switch e { + case EulerOrderDefault: + return "Default" + case EulerOrderXYZ: + return "XYZ" + case EulerOrderYZX: + return "YZX" + case EulerOrderZXY: + return "ZXY" + case EulerOrderXZY: + return "XZY" + case EulerOrderYXZ: + return "YXZ" + case EulerOrderZYX: + return "ZYX" + case EulerOrderSXYZ: + return "SXYZ" + case EulerOrderSXYX: + return "SXYX" + case EulerOrderSXZY: + return "SXZY" + case EulerOrderSXZX: + return "SXZX" + case EulerOrderSYZX: + return "SYZX" + case EulerOrderSYZY: + return "SYZY" + case EulerOrderSYXZ: + return "SYXZ" + case EulerOrderSYXY: + return "SYXY" + case EulerOrderSZXY: + return "SZXY" + case EulerOrderSZXZ: + return "SZXZ" + case EulerOrderSZYX: + return "SZYX" + case EulerOrderSZYZ: + return "SZYZ" + case EulerOrderRZYX: + return "RZYX" + case EulerOrderRXYX: + return "RXYX" + case EulerOrderRYZX: + return "RYZX" + case EulerOrderRXZX: + return "RXZX" + case EulerOrderRXZY: + return "RXZY" + case EulerOrderRYZY: + return "RYZY" + case EulerOrderRZXY: + return "RZXY" + case EulerOrderRYXY: + return "RYXY" + case EulerOrderRYXZ: + return "RYXZ" + case EulerOrderRZXZ: + return "RZXZ" + case EulerOrderRXYZ: + return "RXYZ" + case EulerOrderRZYZ: + return "RZYZ" + default: + return fmt.Sprintf("EulerOrder(%d)", e) + } +} + +// RayIntersectionKind: type of intersection. +type RayIntersectionKind C.gint + +const ( + // RayIntersectionKindNone: no intersection. + RayIntersectionKindNone RayIntersectionKind = iota + // RayIntersectionKindEnter: ray is entering the intersected object. + RayIntersectionKindEnter + // RayIntersectionKindLeave: ray is leaving the intersected object. + RayIntersectionKindLeave +) + +// String returns the name in string for RayIntersectionKind. +func (r RayIntersectionKind) String() string { + switch r { + case RayIntersectionKindNone: + return "None" + case RayIntersectionKindEnter: + return "Enter" + case RayIntersectionKindLeave: + return "Leave" + default: + return fmt.Sprintf("RayIntersectionKind(%d)", r) + } +} + +// Box: 3D box, described as the volume between a minimum and a maximum +// vertices. +// +// An instance of this type is always passed by reference. +type Box struct { + *box +} + +// box is the struct that's finalized. +type box struct { + native *C.graphene_box_t +} + +func marshalBox(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Box{&box{(*C.graphene_box_t)(b)}}, nil +} + +// NewBoxAlloc constructs a struct Box. +func NewBoxAlloc() *Box { + var _cret *C.graphene_box_t // in + + _cret = C.graphene_box_alloc() + + var _box *Box // out + + _box = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_box)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_box_free((*C.graphene_box_t)(intern.C)) + }, + ) + + return _box +} + +// ContainsBox checks whether the #graphene_box_t a contains the given +// #graphene_box_t b. +// +// The function takes the following parameters: +// +// - b: #graphene_box_t. +// +// The function returns the following values: +// +// - ok: true if the box is contained in the given box. +func (a *Box) ContainsBox(b *Box) bool { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_box_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_box_contains_box(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// ContainsPoint checks whether box contains the given point. +// +// The function takes the following parameters: +// +// - point coordinates to check. +// +// The function returns the following values: +// +// - ok: true if the point is contained in the given box. +func (box *Box) ContainsPoint(point *Point3D) bool { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.graphene_box_contains_point(_arg0, _arg1) + runtime.KeepAlive(box) + runtime.KeepAlive(point) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Equal checks whether the two given boxes are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_box_t. +// +// The function returns the following values: +// +// - ok: true if the boxes are equal. +func (a *Box) Equal(b *Box) bool { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_box_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_box_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Expand expands the dimensions of box to include the coordinates at point. +// +// The function takes the following parameters: +// +// - point coordinates of the point to include. +// +// The function returns the following values: +// +// - res: return location for the expanded box. +func (box *Box) Expand(point *Point3D) *Box { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.graphene_box_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + C.graphene_box_expand(_arg0, _arg1, &_arg2) + runtime.KeepAlive(box) + runtime.KeepAlive(point) + + var _res *Box // out + + _res = (*Box)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// ExpandScalar expands the dimensions of box by the given scalar value. +// +// If scalar is positive, the #graphene_box_t will grow; if scalar is negative, +// the #graphene_box_t will shrink. +// +// The function takes the following parameters: +// +// - scalar value. +// +// The function returns the following values: +// +// - res: return location for the expanded box. +func (box *Box) ExpandScalar(scalar float32) *Box { + var _arg0 *C.graphene_box_t // out + var _arg1 C.float // out + var _arg2 C.graphene_box_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + _arg1 = C.float(scalar) + + C.graphene_box_expand_scalar(_arg0, _arg1, &_arg2) + runtime.KeepAlive(box) + runtime.KeepAlive(scalar) + + var _res *Box // out + + _res = (*Box)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// ExpandVec3 expands the dimensions of box to include the coordinates of the +// given vector. +// +// The function takes the following parameters: +// +// - vec coordinates of the point to include, as a #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the expanded box. +func (box *Box) ExpandVec3(vec *Vec3) *Box { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_box_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(vec))) + + C.graphene_box_expand_vec3(_arg0, _arg1, &_arg2) + runtime.KeepAlive(box) + runtime.KeepAlive(vec) + + var _res *Box // out + + _res = (*Box)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// BoundingSphere computes the bounding #graphene_sphere_t capable of containing +// the given #graphene_box_t. +// +// The function returns the following values: +// +// - sphere: return location for the bounding sphere. +func (box *Box) BoundingSphere() *Sphere { + var _arg0 *C.graphene_box_t // out + var _arg1 C.graphene_sphere_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + C.graphene_box_get_bounding_sphere(_arg0, &_arg1) + runtime.KeepAlive(box) + + var _sphere *Sphere // out + + _sphere = (*Sphere)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _sphere +} + +// Center retrieves the coordinates of the center of a #graphene_box_t. +// +// The function returns the following values: +// +// - center: return location for the coordinates of the center. +func (box *Box) Center() *Point3D { + var _arg0 *C.graphene_box_t // out + var _arg1 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + C.graphene_box_get_center(_arg0, &_arg1) + runtime.KeepAlive(box) + + var _center *Point3D // out + + _center = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _center +} + +// Depth retrieves the size of the box on the Z axis. +// +// The function returns the following values: +// +// - gfloat: depth of the box. +func (box *Box) Depth() float32 { + var _arg0 *C.graphene_box_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + _cret = C.graphene_box_get_depth(_arg0) + runtime.KeepAlive(box) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Height retrieves the size of the box on the Y axis. +// +// The function returns the following values: +// +// - gfloat: height of the box. +func (box *Box) Height() float32 { + var _arg0 *C.graphene_box_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + _cret = C.graphene_box_get_height(_arg0) + runtime.KeepAlive(box) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Max retrieves the coordinates of the maximum point of the given +// #graphene_box_t. +// +// The function returns the following values: +// +// - max: return location for the maximum point. +func (box *Box) Max() *Point3D { + var _arg0 *C.graphene_box_t // out + var _arg1 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + C.graphene_box_get_max(_arg0, &_arg1) + runtime.KeepAlive(box) + + var _max *Point3D // out + + _max = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _max +} + +// Min retrieves the coordinates of the minimum point of the given +// #graphene_box_t. +// +// The function returns the following values: +// +// - min: return location for the minimum point. +func (box *Box) Min() *Point3D { + var _arg0 *C.graphene_box_t // out + var _arg1 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + C.graphene_box_get_min(_arg0, &_arg1) + runtime.KeepAlive(box) + + var _min *Point3D // out + + _min = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _min +} + +// Size retrieves the size of the box on all three axes, and stores it into the +// given size vector. +// +// The function returns the following values: +// +// - size: return location for the size. +func (box *Box) Size() *Vec3 { + var _arg0 *C.graphene_box_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + C.graphene_box_get_size(_arg0, &_arg1) + runtime.KeepAlive(box) + + var _size *Vec3 // out + + _size = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _size +} + +// Vertices computes the vertices of the given #graphene_box_t. +// +// The function returns the following values: +// +// - vertices: return location for an array of 8 #graphene_vec3_t. +func (box *Box) Vertices() [8]Vec3 { + var _arg0 *C.graphene_box_t // out + var _arg1 [8]C.graphene_vec3_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + C.graphene_box_get_vertices(_arg0, &_arg1[0]) + runtime.KeepAlive(box) + + var _vertices [8]Vec3 // out + + { + src := &_arg1 + for i := 0; i < 8; i++ { + _vertices[i] = *(*Vec3)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + + return _vertices +} + +// Width retrieves the size of the box on the X axis. +// +// The function returns the following values: +// +// - gfloat: width of the box. +func (box *Box) Width() float32 { + var _arg0 *C.graphene_box_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + _cret = C.graphene_box_get_width(_arg0) + runtime.KeepAlive(box) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Init initializes the given #graphene_box_t with two vertices. +// +// The function takes the following parameters: +// +// - min (optional) coordinates of the minimum vertex. +// - max (optional) coordinates of the maximum vertex. +// +// The function returns the following values: +// +// - ret: initialized #graphene_box_t. +func (box *Box) Init(min *Point3D, max *Point3D) *Box { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 *C.graphene_point3d_t // out + var _cret *C.graphene_box_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + if min != nil { + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(min))) + } + if max != nil { + _arg2 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(max))) + } + + _cret = C.graphene_box_init(_arg0, _arg1, _arg2) + runtime.KeepAlive(box) + runtime.KeepAlive(min) + runtime.KeepAlive(max) + + var _ret *Box // out + + _ret = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _ret +} + +// InitFromBox initializes the given #graphene_box_t with the vertices of +// another #graphene_box_t. +// +// The function takes the following parameters: +// +// - src: #graphene_box_t. +// +// The function returns the following values: +// +// - ret: initialized #graphene_box_t. +func (box *Box) InitFromBox(src *Box) *Box { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_box_t // out + var _cret *C.graphene_box_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + _arg1 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_box_init_from_box(_arg0, _arg1) + runtime.KeepAlive(box) + runtime.KeepAlive(src) + + var _ret *Box // out + + _ret = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _ret +} + +// InitFromPoints initializes the given #graphene_box_t with the given array of +// vertices. +// +// If n_points is 0, the returned box is initialized with graphene_box_empty(). +// +// The function takes the following parameters: +// +// - points: array of #graphene_point3d_t. +// +// The function returns the following values: +// +// - ret: initialized #graphene_box_t. +func (box *Box) InitFromPoints(points []Point3D) *Box { + var _arg0 *C.graphene_box_t // out + var _arg2 *C.graphene_point3d_t // out + var _arg1 C.uint + var _cret *C.graphene_box_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + _arg1 = (C.uint)(len(points)) + _arg2 = (*C.graphene_point3d_t)(C.calloc(C.size_t(len(points)), C.size_t(C.sizeof_graphene_point3d_t))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.graphene_point3d_t)(_arg2), len(points)) + for i := range points { + out[i] = *(*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer((&points[i])))) + } + } + + _cret = C.graphene_box_init_from_points(_arg0, _arg1, _arg2) + runtime.KeepAlive(box) + runtime.KeepAlive(points) + + var _ret *Box // out + + _ret = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _ret +} + +// InitFromVec3 initializes the given #graphene_box_t with two vertices stored +// inside #graphene_vec3_t. +// +// The function takes the following parameters: +// +// - min (optional) coordinates of the minimum vertex. +// - max (optional) coordinates of the maximum vertex. +// +// The function returns the following values: +// +// - ret: initialized #graphene_box_t. +func (box *Box) InitFromVec3(min *Vec3, max *Vec3) *Box { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 *C.graphene_vec3_t // out + var _cret *C.graphene_box_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + if min != nil { + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(min))) + } + if max != nil { + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(max))) + } + + _cret = C.graphene_box_init_from_vec3(_arg0, _arg1, _arg2) + runtime.KeepAlive(box) + runtime.KeepAlive(min) + runtime.KeepAlive(max) + + var _ret *Box // out + + _ret = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _ret +} + +// InitFromVectors initializes the given #graphene_box_t with the given array of +// vertices. +// +// If n_vectors is 0, the returned box is initialized with graphene_box_empty(). +// +// The function takes the following parameters: +// +// - vectors: array of #graphene_vec3_t. +// +// The function returns the following values: +// +// - ret: initialized #graphene_box_t. +func (box *Box) InitFromVectors(vectors []Vec3) *Box { + var _arg0 *C.graphene_box_t // out + var _arg2 *C.graphene_vec3_t // out + var _arg1 C.uint + var _cret *C.graphene_box_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + _arg1 = (C.uint)(len(vectors)) + _arg2 = (*C.graphene_vec3_t)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_graphene_vec3_t))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.graphene_vec3_t)(_arg2), len(vectors)) + for i := range vectors { + out[i] = *(*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + + _cret = C.graphene_box_init_from_vectors(_arg0, _arg1, _arg2) + runtime.KeepAlive(box) + runtime.KeepAlive(vectors) + + var _ret *Box // out + + _ret = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _ret +} + +// Intersection intersects the two given #graphene_box_t. +// +// If the two boxes do not intersect, res will contain a degenerate box +// initialized with graphene_box_empty(). +// +// The function takes the following parameters: +// +// - b: #graphene_box_t. +// +// The function returns the following values: +// +// - res (optional): return location for the result. +// - ok: true if the two boxes intersect. +func (a *Box) Intersection(b *Box) (*Box, bool) { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_box_t // out + var _arg2 C.graphene_box_t // in + var _cret C._Bool // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_box_intersection(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Box // out + var _ok bool // out + + _res = (*Box)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + if _cret { + _ok = true + } + + return _res, _ok +} + +// Union unions the two given #graphene_box_t. +// +// The function takes the following parameters: +// +// - b: box to union to a. +// +// The function returns the following values: +// +// - res: return location for the result. +func (a *Box) Union(b *Box) *Box { + var _arg0 *C.graphene_box_t // out + var _arg1 *C.graphene_box_t // out + var _arg2 C.graphene_box_t // in + + _arg0 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_box_union(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Box // out + + _res = (*Box)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// BoxEmpty: degenerate #graphene_box_t that can only be expanded. +// +// The returned value is owned by Graphene and should not be modified or freed. +// +// The function returns the following values: +// +// - box: #graphene_box_t. +func BoxEmpty() *Box { + var _cret *C.graphene_box_t // in + + _cret = C.graphene_box_empty() + + var _box *Box // out + + _box = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _box +} + +// BoxInfinite: degenerate #graphene_box_t that cannot be expanded. +// +// The returned value is owned by Graphene and should not be modified or freed. +// +// The function returns the following values: +// +// - box: #graphene_box_t. +func BoxInfinite() *Box { + var _cret *C.graphene_box_t // in + + _cret = C.graphene_box_infinite() + + var _box *Box // out + + _box = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _box +} + +// BoxMinusOne with the minimum vertex set at (-1, -1, -1) and the maximum +// vertex set at (0, 0, 0). +// +// The returned value is owned by Graphene and should not be modified or freed. +// +// The function returns the following values: +// +// - box: #graphene_box_t. +func BoxMinusOne() *Box { + var _cret *C.graphene_box_t // in + + _cret = C.graphene_box_minus_one() + + var _box *Box // out + + _box = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _box +} + +// BoxOne with the minimum vertex set at (0, 0, 0) and the maximum vertex set at +// (1, 1, 1). +// +// The returned value is owned by Graphene and should not be modified or freed. +// +// The function returns the following values: +// +// - box: #graphene_box_t. +func BoxOne() *Box { + var _cret *C.graphene_box_t // in + + _cret = C.graphene_box_one() + + var _box *Box // out + + _box = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _box +} + +// BoxOneMinusOne with the minimum vertex set at (-1, -1, -1) and the maximum +// vertex set at (1, 1, 1). +// +// The returned value is owned by Graphene and should not be modified or freed. +// +// The function returns the following values: +// +// - box: #graphene_box_t. +func BoxOneMinusOne() *Box { + var _cret *C.graphene_box_t // in + + _cret = C.graphene_box_one_minus_one() + + var _box *Box // out + + _box = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _box +} + +// BoxZero with both the minimum and maximum vertices set at (0, 0, 0). +// +// The returned value is owned by Graphene and should not be modified or freed. +// +// The function returns the following values: +// +// - box: #graphene_box_t. +func BoxZero() *Box { + var _cret *C.graphene_box_t // in + + _cret = C.graphene_box_zero() + + var _box *Box // out + + _box = (*Box)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _box +} + +// Euler: describe a rotation using Euler angles. +// +// The contents of the #graphene_euler_t structure are private and should never +// be accessed directly. +// +// An instance of this type is always passed by reference. +type Euler struct { + *euler +} + +// euler is the struct that's finalized. +type euler struct { + native *C.graphene_euler_t +} + +func marshalEuler(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Euler{&euler{(*C.graphene_euler_t)(b)}}, nil +} + +// NewEulerAlloc constructs a struct Euler. +func NewEulerAlloc() *Euler { + var _cret *C.graphene_euler_t // in + + _cret = C.graphene_euler_alloc() + + var _euler *Euler // out + + _euler = (*Euler)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_euler)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_euler_free((*C.graphene_euler_t)(intern.C)) + }, + ) + + return _euler +} + +// Equal checks if two #graphene_euler_t are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_euler_t. +// +// The function returns the following values: +// +// - ok: true if the two #graphene_euler_t are equal. +func (a *Euler) Equal(b *Euler) bool { + var _arg0 *C.graphene_euler_t // out + var _arg1 *C.graphene_euler_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_euler_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Alpha retrieves the first component of the Euler angle vector, depending on +// the order of rotation. +// +// See also: graphene_euler_get_x(). +// +// The function returns the following values: +// +// - gfloat: first component of the Euler angle vector, in radians. +func (e *Euler) Alpha() float32 { + var _arg0 *C.graphene_euler_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + _cret = C.graphene_euler_get_alpha(_arg0) + runtime.KeepAlive(e) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Beta retrieves the second component of the Euler angle vector, depending on +// the order of rotation. +// +// See also: graphene_euler_get_y(). +// +// The function returns the following values: +// +// - gfloat: second component of the Euler angle vector, in radians. +func (e *Euler) Beta() float32 { + var _arg0 *C.graphene_euler_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + _cret = C.graphene_euler_get_beta(_arg0) + runtime.KeepAlive(e) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Gamma retrieves the third component of the Euler angle vector, depending on +// the order of rotation. +// +// See also: graphene_euler_get_z(). +// +// The function returns the following values: +// +// - gfloat: third component of the Euler angle vector, in radians. +func (e *Euler) Gamma() float32 { + var _arg0 *C.graphene_euler_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + _cret = C.graphene_euler_get_gamma(_arg0) + runtime.KeepAlive(e) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Order retrieves the order used to apply the rotations described in the +// #graphene_euler_t structure, when converting to and from other structures, +// like #graphene_quaternion_t and #graphene_matrix_t. +// +// This function does not return the GRAPHENE_EULER_ORDER_DEFAULT enumeration +// value; it will return the effective order of rotation instead. +// +// The function returns the following values: +// +// - eulerOrder: order used to apply the rotations. +func (e *Euler) Order() EulerOrder { + var _arg0 *C.graphene_euler_t // out + var _cret C.graphene_euler_order_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + _cret = C.graphene_euler_get_order(_arg0) + runtime.KeepAlive(e) + + var _eulerOrder EulerOrder // out + + _eulerOrder = EulerOrder(_cret) + + return _eulerOrder +} + +// X retrieves the rotation angle on the X axis, in degrees. +// +// The function returns the following values: +// +// - gfloat: rotation angle. +func (e *Euler) X() float32 { + var _arg0 *C.graphene_euler_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + _cret = C.graphene_euler_get_x(_arg0) + runtime.KeepAlive(e) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Y retrieves the rotation angle on the Y axis, in degrees. +// +// The function returns the following values: +// +// - gfloat: rotation angle. +func (e *Euler) Y() float32 { + var _arg0 *C.graphene_euler_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + _cret = C.graphene_euler_get_y(_arg0) + runtime.KeepAlive(e) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Z retrieves the rotation angle on the Z axis, in degrees. +// +// The function returns the following values: +// +// - gfloat: rotation angle. +func (e *Euler) Z() float32 { + var _arg0 *C.graphene_euler_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + _cret = C.graphene_euler_get_z(_arg0) + runtime.KeepAlive(e) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Init initializes a #graphene_euler_t using the given angles. +// +// The order of the rotations is GRAPHENE_EULER_ORDER_DEFAULT. +// +// The function takes the following parameters: +// +// - x: rotation angle on the X axis, in degrees. +// - y: rotation angle on the Y axis, in degrees. +// - z: rotation angle on the Z axis, in degrees. +// +// The function returns the following values: +// +// - euler: initialized #graphene_euler_t. +func (e *Euler) Init(x float32, y float32, z float32) *Euler { + var _arg0 *C.graphene_euler_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _cret *C.graphene_euler_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + _arg1 = C.float(x) + _arg2 = C.float(y) + _arg3 = C.float(z) + + _cret = C.graphene_euler_init(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(e) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(z) + + var _euler *Euler // out + + _euler = (*Euler)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _euler +} + +// InitFromEuler initializes a #graphene_euler_t using the angles and order of +// another #graphene_euler_t. +// +// If the #graphene_euler_t src is NULL, this function is equivalent to calling +// graphene_euler_init() with all angles set to 0. +// +// The function takes the following parameters: +// +// - src (optional): #graphene_euler_t. +// +// The function returns the following values: +// +// - euler: initialized #graphene_euler_t. +func (e *Euler) InitFromEuler(src *Euler) *Euler { + var _arg0 *C.graphene_euler_t // out + var _arg1 *C.graphene_euler_t // out + var _cret *C.graphene_euler_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + if src != nil { + _arg1 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(src))) + } + + _cret = C.graphene_euler_init_from_euler(_arg0, _arg1) + runtime.KeepAlive(e) + runtime.KeepAlive(src) + + var _euler *Euler // out + + _euler = (*Euler)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _euler +} + +// InitFromMatrix initializes a #graphene_euler_t using the given rotation +// matrix. +// +// If the #graphene_matrix_t m is NULL, the #graphene_euler_t will be +// initialized with all angles set to 0. +// +// The function takes the following parameters: +// +// - m (optional): rotation matrix. +// - order used to apply the rotations. +// +// The function returns the following values: +// +// - euler: initialized #graphene_euler_t. +func (e *Euler) InitFromMatrix(m *Matrix, order EulerOrder) *Euler { + var _arg0 *C.graphene_euler_t // out + var _arg1 *C.graphene_matrix_t // out + var _arg2 C.graphene_euler_order_t // out + var _cret *C.graphene_euler_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + if m != nil { + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + } + _arg2 = C.graphene_euler_order_t(order) + + _cret = C.graphene_euler_init_from_matrix(_arg0, _arg1, _arg2) + runtime.KeepAlive(e) + runtime.KeepAlive(m) + runtime.KeepAlive(order) + + var _euler *Euler // out + + _euler = (*Euler)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _euler +} + +// InitFromQuaternion initializes a #graphene_euler_t using the given normalized +// quaternion. +// +// If the #graphene_quaternion_t q is NULL, the #graphene_euler_t will be +// initialized with all angles set to 0. +// +// The function takes the following parameters: +// +// - q (optional): normalized #graphene_quaternion_t. +// - order used to apply the rotations. +// +// The function returns the following values: +// +// - euler: initialized #graphene_euler_t. +func (e *Euler) InitFromQuaternion(q *Quaternion, order EulerOrder) *Euler { + var _arg0 *C.graphene_euler_t // out + var _arg1 *C.graphene_quaternion_t // out + var _arg2 C.graphene_euler_order_t // out + var _cret *C.graphene_euler_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + if q != nil { + _arg1 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + } + _arg2 = C.graphene_euler_order_t(order) + + _cret = C.graphene_euler_init_from_quaternion(_arg0, _arg1, _arg2) + runtime.KeepAlive(e) + runtime.KeepAlive(q) + runtime.KeepAlive(order) + + var _euler *Euler // out + + _euler = (*Euler)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _euler +} + +// InitFromRadians initializes a #graphene_euler_t using the given angles and +// order of rotation. +// +// The function takes the following parameters: +// +// - x: rotation angle on the X axis, in radians. +// - y: rotation angle on the Y axis, in radians. +// - z: rotation angle on the Z axis, in radians. +// - order of rotations. +// +// The function returns the following values: +// +// - euler: initialized #graphene_euler_t. +func (e *Euler) InitFromRadians(x float32, y float32, z float32, order EulerOrder) *Euler { + var _arg0 *C.graphene_euler_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.graphene_euler_order_t // out + var _cret *C.graphene_euler_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + _arg1 = C.float(x) + _arg2 = C.float(y) + _arg3 = C.float(z) + _arg4 = C.graphene_euler_order_t(order) + + _cret = C.graphene_euler_init_from_radians(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(e) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(z) + runtime.KeepAlive(order) + + var _euler *Euler // out + + _euler = (*Euler)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _euler +} + +// InitFromVec3 initializes a #graphene_euler_t using the angles contained in a +// #graphene_vec3_t. +// +// If the #graphene_vec3_t v is NULL, the #graphene_euler_t will be initialized +// with all angles set to 0. +// +// The function takes the following parameters: +// +// - v (optional) containing the rotation angles in degrees. +// - order used to apply the rotations. +// +// The function returns the following values: +// +// - euler: initialized #graphene_euler_t. +func (e *Euler) InitFromVec3(v *Vec3, order EulerOrder) *Euler { + var _arg0 *C.graphene_euler_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_euler_order_t // out + var _cret *C.graphene_euler_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + if v != nil { + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + } + _arg2 = C.graphene_euler_order_t(order) + + _cret = C.graphene_euler_init_from_vec3(_arg0, _arg1, _arg2) + runtime.KeepAlive(e) + runtime.KeepAlive(v) + runtime.KeepAlive(order) + + var _euler *Euler // out + + _euler = (*Euler)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _euler +} + +// InitWithOrder initializes a #graphene_euler_t with the given angles and +// order. +// +// The function takes the following parameters: +// +// - x: rotation angle on the X axis, in degrees. +// - y: rotation angle on the Y axis, in degrees. +// - z: rotation angle on the Z axis, in degrees. +// - order used to apply the rotations. +// +// The function returns the following values: +// +// - euler: initialized #graphene_euler_t. +func (e *Euler) InitWithOrder(x float32, y float32, z float32, order EulerOrder) *Euler { + var _arg0 *C.graphene_euler_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.graphene_euler_order_t // out + var _cret *C.graphene_euler_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + _arg1 = C.float(x) + _arg2 = C.float(y) + _arg3 = C.float(z) + _arg4 = C.graphene_euler_order_t(order) + + _cret = C.graphene_euler_init_with_order(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(e) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(z) + runtime.KeepAlive(order) + + var _euler *Euler // out + + _euler = (*Euler)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _euler +} + +// Reorder reorders a #graphene_euler_t using order. +// +// This function is equivalent to creating a #graphene_quaternion_t from the +// given #graphene_euler_t, and then converting the quaternion into another +// #graphene_euler_t. +// +// The function takes the following parameters: +// +// - order: new order. +// +// The function returns the following values: +// +// - res: return location for the reordered #graphene_euler_t. +func (e *Euler) Reorder(order EulerOrder) *Euler { + var _arg0 *C.graphene_euler_t // out + var _arg1 C.graphene_euler_order_t // out + var _arg2 C.graphene_euler_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + _arg1 = C.graphene_euler_order_t(order) + + C.graphene_euler_reorder(_arg0, _arg1, &_arg2) + runtime.KeepAlive(e) + runtime.KeepAlive(order) + + var _res *Euler // out + + _res = (*Euler)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// ToMatrix converts a #graphene_euler_t into a transformation matrix expressing +// the extrinsic composition of rotations described by the Euler angles. +// +// The rotations are applied over the reference frame axes in the order +// associated with the #graphene_euler_t; for instance, if the order used to +// initialize e is GRAPHENE_EULER_ORDER_XYZ: +// +// - the first rotation moves the body around the X axis with an angle φ +// - the second rotation moves the body around the Y axis with an angle of ϑ +// - the third rotation moves the body around the Z axis with an angle of ψ +// +// The rotation sign convention is right-handed, to preserve compatibility +// between Euler-based, quaternion-based, and angle-axis-based rotations. +// +// The function returns the following values: +// +// - res: return location for a #graphene_matrix_t. +func (e *Euler) ToMatrix() *Matrix { + var _arg0 *C.graphene_euler_t // out + var _arg1 C.graphene_matrix_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + C.graphene_euler_to_matrix(_arg0, &_arg1) + runtime.KeepAlive(e) + + var _res *Matrix // out + + _res = (*Matrix)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// ToQuaternion converts a #graphene_euler_t into a #graphene_quaternion_t. +// +// The function returns the following values: +// +// - res: return location for a #graphene_quaternion_t. +func (e *Euler) ToQuaternion() *Quaternion { + var _arg0 *C.graphene_euler_t // out + var _arg1 C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + C.graphene_euler_to_quaternion(_arg0, &_arg1) + runtime.KeepAlive(e) + + var _res *Quaternion // out + + _res = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// ToVec3 retrieves the angles of a #graphene_euler_t and initializes a +// #graphene_vec3_t with them. +// +// The function returns the following values: +// +// - res: return location for a #graphene_vec3_t. +func (e *Euler) ToVec3() *Vec3 { + var _arg0 *C.graphene_euler_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + C.graphene_euler_to_vec3(_arg0, &_arg1) + runtime.KeepAlive(e) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Frustum: 3D volume delimited by 2D clip planes. +// +// The contents of the graphene_frustum_t are private, and should not be +// modified directly. +// +// An instance of this type is always passed by reference. +type Frustum struct { + *frustum +} + +// frustum is the struct that's finalized. +type frustum struct { + native *C.graphene_frustum_t +} + +func marshalFrustum(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Frustum{&frustum{(*C.graphene_frustum_t)(b)}}, nil +} + +// NewFrustumAlloc constructs a struct Frustum. +func NewFrustumAlloc() *Frustum { + var _cret *C.graphene_frustum_t // in + + _cret = C.graphene_frustum_alloc() + + var _frustum *Frustum // out + + _frustum = (*Frustum)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_frustum)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_frustum_free((*C.graphene_frustum_t)(intern.C)) + }, + ) + + return _frustum +} + +// ContainsPoint checks whether a point is inside the volume defined by the +// given #graphene_frustum_t. +// +// The function takes the following parameters: +// +// - point: #graphene_point3d_t. +// +// The function returns the following values: +// +// - ok: true if the point is inside the frustum. +func (f *Frustum) ContainsPoint(point *Point3D) bool { + var _arg0 *C.graphene_frustum_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(f))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.graphene_frustum_contains_point(_arg0, _arg1) + runtime.KeepAlive(f) + runtime.KeepAlive(point) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Equal checks whether the two given #graphene_frustum_t are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_frustum_t. +// +// The function returns the following values: +// +// - ok: true if the given frustums are equal. +func (a *Frustum) Equal(b *Frustum) bool { + var _arg0 *C.graphene_frustum_t // out + var _arg1 *C.graphene_frustum_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_frustum_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Planes retrieves the planes that define the given #graphene_frustum_t. +// +// The function returns the following values: +// +// - planes: return location for an array of 6 #graphene_plane_t. +func (f *Frustum) Planes() [6]Plane { + var _arg0 *C.graphene_frustum_t // out + var _arg1 [6]C.graphene_plane_t // in + + _arg0 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(f))) + + C.graphene_frustum_get_planes(_arg0, &_arg1[0]) + runtime.KeepAlive(f) + + var _planes [6]Plane // out + + { + src := &_arg1 + for i := 0; i < 6; i++ { + _planes[i] = *(*Plane)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + + return _planes +} + +// Init initializes the given #graphene_frustum_t using the provided clipping +// planes. +// +// The function takes the following parameters: +// +// - p0: clipping plane. +// - p1: clipping plane. +// - p2: clipping plane. +// - p3: clipping plane. +// - p4: clipping plane. +// - p5: clipping plane. +// +// The function returns the following values: +// +// - frustum: initialized frustum. +func (f *Frustum) Init(p0 *Plane, p1 *Plane, p2 *Plane, p3 *Plane, p4 *Plane, p5 *Plane) *Frustum { + var _arg0 *C.graphene_frustum_t // out + var _arg1 *C.graphene_plane_t // out + var _arg2 *C.graphene_plane_t // out + var _arg3 *C.graphene_plane_t // out + var _arg4 *C.graphene_plane_t // out + var _arg5 *C.graphene_plane_t // out + var _arg6 *C.graphene_plane_t // out + var _cret *C.graphene_frustum_t // in + + _arg0 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(f))) + _arg1 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p0))) + _arg2 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p1))) + _arg3 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p2))) + _arg4 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p3))) + _arg5 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p4))) + _arg6 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p5))) + + _cret = C.graphene_frustum_init(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(f) + runtime.KeepAlive(p0) + runtime.KeepAlive(p1) + runtime.KeepAlive(p2) + runtime.KeepAlive(p3) + runtime.KeepAlive(p4) + runtime.KeepAlive(p5) + + var _frustum *Frustum // out + + _frustum = (*Frustum)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _frustum +} + +// InitFromFrustum initializes the given #graphene_frustum_t using the clipping +// planes of another #graphene_frustum_t. +// +// The function takes the following parameters: +// +// - src: #graphene_frustum_t. +// +// The function returns the following values: +// +// - frustum: initialized frustum. +func (f *Frustum) InitFromFrustum(src *Frustum) *Frustum { + var _arg0 *C.graphene_frustum_t // out + var _arg1 *C.graphene_frustum_t // out + var _cret *C.graphene_frustum_t // in + + _arg0 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(f))) + _arg1 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_frustum_init_from_frustum(_arg0, _arg1) + runtime.KeepAlive(f) + runtime.KeepAlive(src) + + var _frustum *Frustum // out + + _frustum = (*Frustum)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _frustum +} + +// InitFromMatrix initializes a #graphene_frustum_t using the given matrix. +// +// The function takes the following parameters: +// +// - matrix: #graphene_matrix_t. +// +// The function returns the following values: +// +// - frustum: initialized frustum. +func (f *Frustum) InitFromMatrix(matrix *Matrix) *Frustum { + var _arg0 *C.graphene_frustum_t // out + var _arg1 *C.graphene_matrix_t // out + var _cret *C.graphene_frustum_t // in + + _arg0 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(f))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(matrix))) + + _cret = C.graphene_frustum_init_from_matrix(_arg0, _arg1) + runtime.KeepAlive(f) + runtime.KeepAlive(matrix) + + var _frustum *Frustum // out + + _frustum = (*Frustum)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _frustum +} + +// IntersectsBox checks whether the given box intersects a plane of a +// #graphene_frustum_t. +// +// The function takes the following parameters: +// +// - box: #graphene_box_t. +// +// The function returns the following values: +// +// - ok: true if the box intersects the frustum. +func (f *Frustum) IntersectsBox(box *Box) bool { + var _arg0 *C.graphene_frustum_t // out + var _arg1 *C.graphene_box_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(f))) + _arg1 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(box))) + + _cret = C.graphene_frustum_intersects_box(_arg0, _arg1) + runtime.KeepAlive(f) + runtime.KeepAlive(box) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// IntersectsSphere checks whether the given sphere intersects a plane of a +// #graphene_frustum_t. +// +// The function takes the following parameters: +// +// - sphere: #graphene_sphere_t. +// +// The function returns the following values: +// +// - ok: true if the sphere intersects the frustum. +func (f *Frustum) IntersectsSphere(sphere *Sphere) bool { + var _arg0 *C.graphene_frustum_t // out + var _arg1 *C.graphene_sphere_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_frustum_t)(gextras.StructNative(unsafe.Pointer(f))) + _arg1 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(sphere))) + + _cret = C.graphene_frustum_intersects_sphere(_arg0, _arg1) + runtime.KeepAlive(f) + runtime.KeepAlive(sphere) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Matrix: structure capable of holding a 4x4 matrix. +// +// The contents of the #graphene_matrix_t structure are private and should never +// be accessed directly. +// +// An instance of this type is always passed by reference. +type Matrix struct { + *matrix +} + +// matrix is the struct that's finalized. +type matrix struct { + native *C.graphene_matrix_t +} + +func marshalMatrix(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Matrix{&matrix{(*C.graphene_matrix_t)(b)}}, nil +} + +// NewMatrixAlloc constructs a struct Matrix. +func NewMatrixAlloc() *Matrix { + var _cret *C.graphene_matrix_t // in + + _cret = C.graphene_matrix_alloc() + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_matrix)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_matrix_free((*C.graphene_matrix_t)(intern.C)) + }, + ) + + return _matrix +} + +// Decompose decomposes a transformation matrix into its component +// transformations. +// +// The algorithm for decomposing a matrix is taken from the CSS3 Transforms +// specification (http://dev.w3.org/csswg/css-transforms/); specifically, +// the decomposition code is based on the equivalent code published +// in "Graphics Gems II", edited by Jim Arvo, and available online +// (http://web.archive.org/web/20150512160205/http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c). +// +// The function returns the following values: +// +// - translate: translation vector. +// - scale vector. +// - rotate: rotation quaternion. +// - shear vector. +// - perspective vector. +// - ok: true if the matrix could be decomposed. +func (m *Matrix) Decompose() (translate *Vec3, scale *Vec3, rotate *Quaternion, shear *Vec3, perspective *Vec4, ok bool) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.graphene_vec3_t // in + var _arg2 C.graphene_vec3_t // in + var _arg3 C.graphene_quaternion_t // in + var _arg4 C.graphene_vec3_t // in + var _arg5 C.graphene_vec4_t // in + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_decompose(_arg0, &_arg1, &_arg2, &_arg3, &_arg4, &_arg5) + runtime.KeepAlive(m) + + var _translate *Vec3 // out + var _scale *Vec3 // out + var _rotate *Quaternion // out + var _shear *Vec3 // out + var _perspective *Vec4 // out + var _ok bool // out + + _translate = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + _scale = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + _rotate = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + _shear = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg4)))) + _perspective = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg5)))) + if _cret { + _ok = true + } + + return _translate, _scale, _rotate, _shear, _perspective, _ok +} + +// Determinant computes the determinant of the given matrix. +// +// The function returns the following values: +// +// - gfloat: value of the determinant. +func (m *Matrix) Determinant() float32 { + var _arg0 *C.graphene_matrix_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_determinant(_arg0) + runtime.KeepAlive(m) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Equal checks whether the two given #graphene_matrix_t matrices are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_matrix_t. +// +// The function returns the following values: +// +// - ok: true if the two matrices are equal, and false otherwise. +func (a *Matrix) Equal(b *Matrix) bool { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_matrix_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_matrix_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// EqualFast checks whether the two given #graphene_matrix_t matrices are +// byte-by-byte equal. +// +// While this function is faster than graphene_matrix_equal(), it can also +// return false negatives, so it should be used in conjuction with either +// graphene_matrix_equal() or graphene_matrix_near(). For instance: +// +// if (graphene_matrix_equal_fast (a, b)) +// { +// // matrices are definitely the same +// } +// else +// { +// if (graphene_matrix_equal (a, b)) +// // matrices contain the same values within an epsilon of FLT_EPSILON +// else if (graphene_matrix_near (a, b, 0.0001)) +// // matrices contain the same values within an epsilon of 0.0001 +// else +// // matrices are not equal +// }. +// +// The function takes the following parameters: +// +// - b: #graphene_matrix_t. +// +// The function returns the following values: +// +// - ok: true if the matrices are equal. and false otherwise. +func (a *Matrix) EqualFast(b *Matrix) bool { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_matrix_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_matrix_equal_fast(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Row retrieves the given row vector at index_ inside a matrix. +// +// The function takes the following parameters: +// +// - index_: index of the row vector, between 0 and 3. +// +// The function returns the following values: +// +// - res: return location for the #graphene_vec4_t that is used to store the +// row vector. +func (m *Matrix) Row(index_ uint) *Vec4 { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.uint // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.uint(index_) + + C.graphene_matrix_get_row(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(index_) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Value retrieves the value at the given row and col index. +// +// The function takes the following parameters: +// +// - row index. +// - col: column index. +// +// The function returns the following values: +// +// - gfloat: value at the given indices. +func (m *Matrix) Value(row uint, col uint) float32 { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.uint // out + var _arg2 C.uint // out + var _cret C.float // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.uint(row) + _arg2 = C.uint(col) + + _cret = C.graphene_matrix_get_value(_arg0, _arg1, _arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(row) + runtime.KeepAlive(col) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// XScale retrieves the scaling factor on the X axis in m. +// +// The function returns the following values: +// +// - gfloat: value of the scaling factor. +func (m *Matrix) XScale() float32 { + var _arg0 *C.graphene_matrix_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_get_x_scale(_arg0) + runtime.KeepAlive(m) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// XTranslation retrieves the translation component on the X axis from m. +// +// The function returns the following values: +// +// - gfloat: translation component. +func (m *Matrix) XTranslation() float32 { + var _arg0 *C.graphene_matrix_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_get_x_translation(_arg0) + runtime.KeepAlive(m) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// YScale retrieves the scaling factor on the Y axis in m. +// +// The function returns the following values: +// +// - gfloat: value of the scaling factor. +func (m *Matrix) YScale() float32 { + var _arg0 *C.graphene_matrix_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_get_y_scale(_arg0) + runtime.KeepAlive(m) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// YTranslation retrieves the translation component on the Y axis from m. +// +// The function returns the following values: +// +// - gfloat: translation component. +func (m *Matrix) YTranslation() float32 { + var _arg0 *C.graphene_matrix_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_get_y_translation(_arg0) + runtime.KeepAlive(m) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// ZScale retrieves the scaling factor on the Z axis in m. +// +// The function returns the following values: +// +// - gfloat: value of the scaling factor. +func (m *Matrix) ZScale() float32 { + var _arg0 *C.graphene_matrix_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_get_z_scale(_arg0) + runtime.KeepAlive(m) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// ZTranslation retrieves the translation component on the Z axis from m. +// +// The function returns the following values: +// +// - gfloat: translation component. +func (m *Matrix) ZTranslation() float32 { + var _arg0 *C.graphene_matrix_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_get_z_translation(_arg0) + runtime.KeepAlive(m) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// InitFrom2D initializes a #graphene_matrix_t from the values of an affine +// transformation matrix. +// +// The arguments map to the following matrix layout: +// +// ⎛ xx yx ⎞ ⎛ a b 0 ⎞ +// ⎜ xy yy ⎟ = ⎜ c d 0 ⎟ +// ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠ +// +// This function can be used to convert between an affine matrix type from other +// libraries and a #graphene_matrix_t. +// +// The function takes the following parameters: +// +// - xx member. +// - yx member. +// - xy member. +// - yy member. +// - x0 member. +// - y0 member. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitFrom2D(xx float64, yx float64, xy float64, yy float64, x0 float64, y0 float64) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.double // out + var _arg2 C.double // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.double(xx) + _arg2 = C.double(yx) + _arg3 = C.double(xy) + _arg4 = C.double(yy) + _arg5 = C.double(x0) + _arg6 = C.double(y0) + + _cret = C.graphene_matrix_init_from_2d(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(m) + runtime.KeepAlive(xx) + runtime.KeepAlive(yx) + runtime.KeepAlive(xy) + runtime.KeepAlive(yy) + runtime.KeepAlive(x0) + runtime.KeepAlive(y0) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitFromFloat initializes a #graphene_matrix_t with the given array of +// floating point values. +// +// The function takes the following parameters: +// +// - v: array of at least 16 floating point values. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitFromFloat(v [16]float32) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.float // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.float)(unsafe.Pointer(&v)) + + _cret = C.graphene_matrix_init_from_float(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(v) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitFromMatrix initializes a #graphene_matrix_t using the values of the given +// matrix. +// +// The function takes the following parameters: +// +// - src: #graphene_matrix_t. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitFromMatrix(src *Matrix) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_matrix_t // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_matrix_init_from_matrix(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(src) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitFromVec4 initializes a #graphene_matrix_t with the given four row +// vectors. +// +// The function takes the following parameters: +// +// - v0: first row vector. +// - v1: second row vector. +// - v2: third row vector. +// - v3: fourth row vector. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitFromVec4(v0 *Vec4, v1 *Vec4, v2 *Vec4, v3 *Vec4) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 *C.graphene_vec4_t // out + var _arg3 *C.graphene_vec4_t // out + var _arg4 *C.graphene_vec4_t // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v0))) + _arg2 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg3 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v2))) + _arg4 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v3))) + + _cret = C.graphene_matrix_init_from_vec4(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(m) + runtime.KeepAlive(v0) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + runtime.KeepAlive(v3) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitFrustum initializes a #graphene_matrix_t compatible with +// #graphene_frustum_t. +// +// See also: graphene_frustum_init_from_matrix(). +// +// The function takes the following parameters: +// +// - left: distance of the left clipping plane. +// - right: distance of the right clipping plane. +// - bottom: distance of the bottom clipping plane. +// - top: distance of the top clipping plane. +// - zNear: distance of the near clipping plane. +// - zFar: distance of the far clipping plane. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitFrustum(left float32, right float32, bottom float32, top float32, zNear float32, zFar float32) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + var _arg6 C.float // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(left) + _arg2 = C.float(right) + _arg3 = C.float(bottom) + _arg4 = C.float(top) + _arg5 = C.float(zNear) + _arg6 = C.float(zFar) + + _cret = C.graphene_matrix_init_frustum(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(m) + runtime.KeepAlive(left) + runtime.KeepAlive(right) + runtime.KeepAlive(bottom) + runtime.KeepAlive(top) + runtime.KeepAlive(zNear) + runtime.KeepAlive(zFar) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitIdentity initializes a #graphene_matrix_t with the identity matrix. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitIdentity() *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_init_identity(_arg0) + runtime.KeepAlive(m) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitLookAt initializes a #graphene_matrix_t so that it positions the "camera" +// at the given eye coordinates towards an object at the center coordinates. +// The top of the camera is aligned to the direction of the up vector. +// +// Before the transform, the camera is assumed to be placed at the origin, +// looking towards the negative Z axis, with the top side of the camera facing +// in the direction of the Y axis and the right side in the direction of the X +// axis. +// +// In theory, one could use m to transform a model of such a camera into +// world-space. However, it is more common to use the inverse of m to transform +// another object from world coordinates to the view coordinates of the camera. +// Typically you would then apply the camera projection transform to get from +// view to screen coordinates. +// +// The function takes the following parameters: +// +// - eye: vector describing the position to look from. +// - center: vector describing the position to look at. +// - up: vector describing the world's upward direction; usually, this is the +// graphene_vec3_y_axis() vector. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitLookAt(eye *Vec3, center *Vec3, up *Vec3) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 *C.graphene_vec3_t // out + var _arg3 *C.graphene_vec3_t // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(eye))) + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(center))) + _arg3 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(up))) + + _cret = C.graphene_matrix_init_look_at(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(m) + runtime.KeepAlive(eye) + runtime.KeepAlive(center) + runtime.KeepAlive(up) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitOrtho initializes a #graphene_matrix_t with an orthographic projection. +// +// The function takes the following parameters: +// +// - left edge of the clipping plane. +// - right edge of the clipping plane. +// - top edge of the clipping plane. +// - bottom edge of the clipping plane. +// - zNear: distance of the near clipping plane. +// - zFar: distance of the far clipping plane. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitOrtho(left float32, right float32, top float32, bottom float32, zNear float32, zFar float32) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + var _arg6 C.float // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(left) + _arg2 = C.float(right) + _arg3 = C.float(top) + _arg4 = C.float(bottom) + _arg5 = C.float(zNear) + _arg6 = C.float(zFar) + + _cret = C.graphene_matrix_init_ortho(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(m) + runtime.KeepAlive(left) + runtime.KeepAlive(right) + runtime.KeepAlive(top) + runtime.KeepAlive(bottom) + runtime.KeepAlive(zNear) + runtime.KeepAlive(zFar) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitPerspective initializes a #graphene_matrix_t with a perspective +// projection. +// +// The function takes the following parameters: +// +// - fovy: field of view angle, in degrees. +// - aspect value. +// - zNear: near Z plane. +// - zFar: far Z plane. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitPerspective(fovy float32, aspect float32, zNear float32, zFar float32) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(fovy) + _arg2 = C.float(aspect) + _arg3 = C.float(zNear) + _arg4 = C.float(zFar) + + _cret = C.graphene_matrix_init_perspective(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(m) + runtime.KeepAlive(fovy) + runtime.KeepAlive(aspect) + runtime.KeepAlive(zNear) + runtime.KeepAlive(zFar) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitRotate initializes m to represent a rotation of angle degrees on the axis +// represented by the axis vector. +// +// The function takes the following parameters: +// +// - angle: rotation angle, in degrees. +// - axis vector as a #graphene_vec3_t. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitRotate(angle float32, axis *Vec3) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + var _arg2 *C.graphene_vec3_t // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(angle) + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(axis))) + + _cret = C.graphene_matrix_init_rotate(_arg0, _arg1, _arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(angle) + runtime.KeepAlive(axis) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitScale initializes a #graphene_matrix_t with the given scaling factors. +// +// The function takes the following parameters: +// +// - x: scale factor on the X axis. +// - y: scale factor on the Y axis. +// - z: scale factor on the Z axis. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitScale(x float32, y float32, z float32) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(x) + _arg2 = C.float(y) + _arg3 = C.float(z) + + _cret = C.graphene_matrix_init_scale(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(m) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(z) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitSkew initializes a #graphene_matrix_t with a skew transformation with the +// given factors. +// +// The function takes the following parameters: +// +// - xSkew: skew factor, in radians, on the X axis. +// - ySkew: skew factor, in radians, on the Y axis. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitSkew(xSkew float32, ySkew float32) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(xSkew) + _arg2 = C.float(ySkew) + + _cret = C.graphene_matrix_init_skew(_arg0, _arg1, _arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(xSkew) + runtime.KeepAlive(ySkew) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// InitTranslate initializes a #graphene_matrix_t with a translation to the +// given coordinates. +// +// The function takes the following parameters: +// +// - p: translation coordinates. +// +// The function returns the following values: +// +// - matrix: initialized matrix. +func (m *Matrix) InitTranslate(p *Point3D) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + + _cret = C.graphene_matrix_init_translate(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(p) + + var _matrix *Matrix // out + + _matrix = (*Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// Interpolate: linearly interpolates the two given #graphene_matrix_t by +// interpolating the decomposed transformations separately. +// +// If either matrix cannot be reduced to their transformations then the +// interpolation cannot be performed, and this function will return an identity +// matrix. +// +// The function takes the following parameters: +// +// - b: #graphene_matrix_t. +// - factor: linear interpolation factor. +// +// The function returns the following values: +// +// - res: return location for the interpolated matrix. +func (a *Matrix) Interpolate(b *Matrix, factor float64) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_matrix_t // out + var _arg2 C.double // out + var _arg3 C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg2 = C.double(factor) + + C.graphene_matrix_interpolate(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(factor) + + var _res *Matrix // out + + _res = (*Matrix)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Inverse inverts the given matrix. +// +// The function returns the following values: +// +// - res: return location for the inverse matrix. +// - ok: true if the matrix is invertible. +func (m *Matrix) Inverse() (*Matrix, bool) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.graphene_matrix_t // in + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_inverse(_arg0, &_arg1) + runtime.KeepAlive(m) + + var _res *Matrix // out + var _ok bool // out + + _res = (*Matrix)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret { + _ok = true + } + + return _res, _ok +} + +// Is2D checks whether the given #graphene_matrix_t is compatible with an a 2D +// affine transformation matrix. +// +// The function returns the following values: +// +// - ok: true if the matrix is compatible with an affine transformation +// matrix. +func (m *Matrix) Is2D() bool { + var _arg0 *C.graphene_matrix_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_is_2d(_arg0) + runtime.KeepAlive(m) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// IsBackfaceVisible checks whether a #graphene_matrix_t has a visible back +// face. +// +// The function returns the following values: +// +// - ok: true if the back face of the matrix is visible. +func (m *Matrix) IsBackfaceVisible() bool { + var _arg0 *C.graphene_matrix_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_is_backface_visible(_arg0) + runtime.KeepAlive(m) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// IsIdentity checks whether the given #graphene_matrix_t is the identity +// matrix. +// +// The function returns the following values: +// +// - ok: true if the matrix is the identity matrix. +func (m *Matrix) IsIdentity() bool { + var _arg0 *C.graphene_matrix_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_is_identity(_arg0) + runtime.KeepAlive(m) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// IsSingular checks whether a matrix is singular. +// +// The function returns the following values: +// +// - ok: true if the matrix is singular. +func (m *Matrix) IsSingular() bool { + var _arg0 *C.graphene_matrix_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_is_singular(_arg0) + runtime.KeepAlive(m) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Multiply multiplies two #graphene_matrix_t. +// +// Matrix multiplication is not commutative in general; the order of the factors +// matters. The product of this multiplication is (a × b). +// +// The function takes the following parameters: +// +// - b: #graphene_matrix_t. +// +// The function returns the following values: +// +// - res: return location for the matrix result. +func (a *Matrix) Multiply(b *Matrix) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_matrix_t // out + var _arg2 C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_matrix_multiply(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Matrix // out + + _res = (*Matrix)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Near compares the two given #graphene_matrix_t matrices and checks whether +// their values are within the given epsilon of each other. +// +// The function takes the following parameters: +// +// - b: #graphene_matrix_t. +// - epsilon: threshold between the two matrices. +// +// The function returns the following values: +// +// - ok: true if the two matrices are near each other, and false otherwise. +func (a *Matrix) Near(b *Matrix, epsilon float32) bool { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_matrix_t // out + var _arg2 C.float // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg2 = C.float(epsilon) + + _cret = C.graphene_matrix_near(_arg0, _arg1, _arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(epsilon) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Normalize normalizes the given #graphene_matrix_t. +// +// The function returns the following values: +// +// - res: return location for the normalized matrix. +func (m *Matrix) Normalize() *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + C.graphene_matrix_normalize(_arg0, &_arg1) + runtime.KeepAlive(m) + + var _res *Matrix // out + + _res = (*Matrix)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Perspective applies a perspective of depth to the matrix. +// +// The function takes the following parameters: +// +// - depth of the perspective. +// +// The function returns the following values: +// +// - res: return location for the perspective matrix. +func (m *Matrix) Perspective(depth float32) *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + var _arg2 C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(depth) + + C.graphene_matrix_perspective(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(depth) + + var _res *Matrix // out + + _res = (*Matrix)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Print prints the contents of a matrix to the standard error stream. +// +// This function is only useful for debugging; there are no guarantees made on +// the format of the output. +func (m *Matrix) Print() { + var _arg0 *C.graphene_matrix_t // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + C.graphene_matrix_print(_arg0) + runtime.KeepAlive(m) +} + +// ProjectPoint projects a #graphene_point_t using the matrix m. +// +// The function takes the following parameters: +// +// - p: #graphene_point_t. +// +// The function returns the following values: +// +// - res: return location for the projected point. +func (m *Matrix) ProjectPoint(p *Point) *Point { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.graphene_point_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_matrix_project_point(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(p) + + var _res *Point // out + + _res = (*Point)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// ProjectRect projects all corners of a #graphene_rect_t using the given +// matrix. +// +// See also: graphene_matrix_project_point(). +// +// The function takes the following parameters: +// +// - r: #graphene_rect_t. +// +// The function returns the following values: +// +// - res: return location for the projected rectangle. +func (m *Matrix) ProjectRect(r *Rect) *Quad { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.graphene_quad_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_matrix_project_rect(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(r) + + var _res *Quad // out + + _res = (*Quad)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// ProjectRectBounds projects a #graphene_rect_t using the given matrix. +// +// The resulting rectangle is the axis aligned bounding rectangle capable of +// fully containing the projected rectangle. +// +// The function takes the following parameters: +// +// - r: #graphene_rect_t. +// +// The function returns the following values: +// +// - res: return location for the projected rectangle. +func (m *Matrix) ProjectRectBounds(r *Rect) *Rect { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.graphene_rect_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_matrix_project_rect_bounds(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(r) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Rotate adds a rotation transformation to m, using the given angle and axis +// vector. +// +// This is the equivalent of calling graphene_matrix_init_rotate() and then +// multiplying the matrix m with the rotation matrix. +// +// The function takes the following parameters: +// +// - angle: rotation angle, in degrees. +// - axis: rotation axis, as a #graphene_vec3_t. +func (m *Matrix) Rotate(angle float32, axis *Vec3) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + var _arg2 *C.graphene_vec3_t // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(angle) + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(axis))) + + C.graphene_matrix_rotate(_arg0, _arg1, _arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(angle) + runtime.KeepAlive(axis) +} + +// RotateEuler adds a rotation transformation to m, using the given +// #graphene_euler_t. +// +// The function takes the following parameters: +// +// - e: rotation described by a #graphene_euler_t. +func (m *Matrix) RotateEuler(e *Euler) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_euler_t // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + C.graphene_matrix_rotate_euler(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(e) +} + +// RotateQuaternion adds a rotation transformation to m, using the given +// #graphene_quaternion_t. +// +// This is the equivalent of calling graphene_quaternion_to_matrix() and then +// multiplying m with the rotation matrix. +// +// The function takes the following parameters: +// +// - q: rotation described by a #graphene_quaternion_t. +func (m *Matrix) RotateQuaternion(q *Quaternion) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_quaternion_t // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + + C.graphene_matrix_rotate_quaternion(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(q) +} + +// RotateX adds a rotation transformation around the X axis to m, using the +// given angle. +// +// See also: graphene_matrix_rotate(). +// +// The function takes the following parameters: +// +// - angle: rotation angle, in degrees. +func (m *Matrix) RotateX(angle float32) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(angle) + + C.graphene_matrix_rotate_x(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(angle) +} + +// RotateY adds a rotation transformation around the Y axis to m, using the +// given angle. +// +// See also: graphene_matrix_rotate(). +// +// The function takes the following parameters: +// +// - angle: rotation angle, in degrees. +func (m *Matrix) RotateY(angle float32) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(angle) + + C.graphene_matrix_rotate_y(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(angle) +} + +// RotateZ adds a rotation transformation around the Z axis to m, using the +// given angle. +// +// See also: graphene_matrix_rotate(). +// +// The function takes the following parameters: +// +// - angle: rotation angle, in degrees. +func (m *Matrix) RotateZ(angle float32) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(angle) + + C.graphene_matrix_rotate_z(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(angle) +} + +// Scale adds a scaling transformation to m, using the three given factors. +// +// This is the equivalent of calling graphene_matrix_init_scale() and then +// multiplying the matrix m with the scale matrix. +// +// The function takes the following parameters: +// +// - factorX: scaling factor on the X axis. +// - factorY: scaling factor on the Y axis. +// - factorZ: scaling factor on the Z axis. +func (m *Matrix) Scale(factorX float32, factorY float32, factorZ float32) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(factorX) + _arg2 = C.float(factorY) + _arg3 = C.float(factorZ) + + C.graphene_matrix_scale(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(m) + runtime.KeepAlive(factorX) + runtime.KeepAlive(factorY) + runtime.KeepAlive(factorZ) +} + +// SkewXY adds a skew of factor on the X and Y axis to the given matrix. +// +// The function takes the following parameters: +// +// - factor: skew factor. +func (m *Matrix) SkewXY(factor float32) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(factor) + + C.graphene_matrix_skew_xy(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(factor) +} + +// SkewXZ adds a skew of factor on the X and Z axis to the given matrix. +// +// The function takes the following parameters: +// +// - factor: skew factor. +func (m *Matrix) SkewXZ(factor float32) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(factor) + + C.graphene_matrix_skew_xz(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(factor) +} + +// SkewYZ adds a skew of factor on the Y and Z axis to the given matrix. +// +// The function takes the following parameters: +// +// - factor: skew factor. +func (m *Matrix) SkewYZ(factor float32) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.float // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = C.float(factor) + + C.graphene_matrix_skew_yz(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(factor) +} + +// To2D converts a #graphene_matrix_t to an affine transformation matrix, +// if the given matrix is compatible. +// +// The returned values have the following layout: +// +// ⎛ xx yx ⎞ ⎛ a b 0 ⎞ +// ⎜ xy yy ⎟ = ⎜ c d 0 ⎟ +// ⎝ x0 y0 ⎠ ⎝ tx ty 1 ⎠ +// +// This function can be used to convert between a #graphene_matrix_t and an +// affine matrix type from other libraries. +// +// The function returns the following values: +// +// - xx: return location for the xx member. +// - yx: return location for the yx member. +// - xy: return location for the xy member. +// - yy: return location for the yy member. +// - x0: return location for the x0 member. +// - y0: return location for the y0 member. +// - ok: true if the matrix is compatible with an affine transformation +// matrix. +func (m *Matrix) To2D() (xx float64, yx float64, xy float64, yy float64, x0 float64, y0 float64, ok bool) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.double // in + var _arg2 C.double // in + var _arg3 C.double // in + var _arg4 C.double // in + var _arg5 C.double // in + var _arg6 C.double // in + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_matrix_to_2d(_arg0, &_arg1, &_arg2, &_arg3, &_arg4, &_arg5, &_arg6) + runtime.KeepAlive(m) + + var _xx float64 // out + var _yx float64 // out + var _xy float64 // out + var _yy float64 // out + var _x0 float64 // out + var _y0 float64 // out + var _ok bool // out + + _xx = float64(_arg1) + _yx = float64(_arg2) + _xy = float64(_arg3) + _yy = float64(_arg4) + _x0 = float64(_arg5) + _y0 = float64(_arg6) + if _cret { + _ok = true + } + + return _xx, _yx, _xy, _yy, _x0, _y0, _ok +} + +// ToFloat converts a #graphene_matrix_t to an array of floating point values. +// +// The function returns the following values: +// +// - v: return location for an array of floating point values. The array must +// be capable of holding at least 16 values. +func (m *Matrix) ToFloat() [16]float32 { + var _arg0 *C.graphene_matrix_t // out + var _arg1 [16]C.float // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + C.graphene_matrix_to_float(_arg0, &_arg1[0]) + runtime.KeepAlive(m) + + var _v [16]float32 // out + + _v = *(*[16]float32)(unsafe.Pointer(&_arg1)) + + return _v +} + +// TransformBounds transforms each corner of a #graphene_rect_t using the given +// matrix m. +// +// The result is the axis aligned bounding rectangle containing the coplanar +// quadrilateral. +// +// See also: graphene_matrix_transform_point(). +// +// The function takes the following parameters: +// +// - r: #graphene_rect_t. +// +// The function returns the following values: +// +// - res: return location for the bounds of the transformed rectangle. +func (m *Matrix) TransformBounds(r *Rect) *Rect { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.graphene_rect_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_matrix_transform_bounds(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(r) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// TransformBox transforms the vertices of a #graphene_box_t using the given +// matrix m. +// +// The result is the axis aligned bounding box containing the transformed +// vertices. +// +// The function takes the following parameters: +// +// - b: #graphene_box_t. +// +// The function returns the following values: +// +// - res: return location for the bounds of the transformed box. +func (m *Matrix) TransformBox(b *Box) *Box { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_box_t // out + var _arg2 C.graphene_box_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_matrix_transform_box(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(b) + + var _res *Box // out + + _res = (*Box)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// TransformPoint transforms the given #graphene_point_t using the matrix m. +// +// Unlike graphene_matrix_transform_vec3(), this function will take into account +// the fourth row vector of the #graphene_matrix_t when computing the dot +// product of each row vector of the matrix. +// +// See also: graphene_simd4x4f_point3_mul(). +// +// The function takes the following parameters: +// +// - p: #graphene_point_t. +// +// The function returns the following values: +// +// - res: return location for the transformed #graphene_point_t. +func (m *Matrix) TransformPoint(p *Point) *Point { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.graphene_point_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_matrix_transform_point(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(p) + + var _res *Point // out + + _res = (*Point)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// TransformPoint3D transforms the given #graphene_point3d_t using the matrix m. +// +// Unlike graphene_matrix_transform_vec3(), this function will take into account +// the fourth row vector of the #graphene_matrix_t when computing the dot +// product of each row vector of the matrix. +// +// See also: graphene_simd4x4f_point3_mul(). +// +// The function takes the following parameters: +// +// - p: #graphene_point3d_t. +// +// The function returns the following values: +// +// - res: return location for the result. +func (m *Matrix) TransformPoint3D(p *Point3D) *Point3D { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_matrix_transform_point3d(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(p) + + var _res *Point3D // out + + _res = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// TransformRay: transform a #graphene_ray_t using the given matrix m. +// +// The function takes the following parameters: +// +// - r: #graphene_ray_t. +// +// The function returns the following values: +// +// - res: return location for the transformed ray. +func (m *Matrix) TransformRay(r *Ray) *Ray { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_ray_t // out + var _arg2 C.graphene_ray_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_matrix_transform_ray(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(r) + + var _res *Ray // out + + _res = (*Ray)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// TransformRect transforms each corner of a #graphene_rect_t using the given +// matrix m. +// +// The result is a coplanar quadrilateral. +// +// See also: graphene_matrix_transform_point(). +// +// The function takes the following parameters: +// +// - r: #graphene_rect_t. +// +// The function returns the following values: +// +// - res: return location for the transformed quad. +func (m *Matrix) TransformRect(r *Rect) *Quad { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.graphene_quad_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_matrix_transform_rect(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(r) + + var _res *Quad // out + + _res = (*Quad)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// TransformSphere transforms a #graphene_sphere_t using the given matrix m. +// The result is the bounding sphere containing the transformed sphere. +// +// The function takes the following parameters: +// +// - s: #graphene_sphere_t. +// +// The function returns the following values: +// +// - res: return location for the bounds of the transformed sphere. +func (m *Matrix) TransformSphere(s *Sphere) *Sphere { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_sphere_t // out + var _arg2 C.graphene_sphere_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + + C.graphene_matrix_transform_sphere(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(s) + + var _res *Sphere // out + + _res = (*Sphere)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// TransformVec3 transforms the given #graphene_vec3_t using the matrix m. +// +// This function will multiply the X, Y, and Z row vectors of the matrix m +// with the corresponding components of the vector v. The W row vector will be +// ignored. +// +// See also: graphene_simd4x4f_vec3_mul(). +// +// The function takes the following parameters: +// +// - v: #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for a #graphene_vec3_t. +func (m *Matrix) TransformVec3(v *Vec3) *Vec3 { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_matrix_transform_vec3(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(v) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// TransformVec4 transforms the given #graphene_vec4_t using the matrix m. +// +// See also: graphene_simd4x4f_vec4_mul(). +// +// The function takes the following parameters: +// +// - v: #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for a #graphene_vec4_t. +func (m *Matrix) TransformVec4(v *Vec4) *Vec4 { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_matrix_transform_vec4(_arg0, _arg1, &_arg2) + runtime.KeepAlive(m) + runtime.KeepAlive(v) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Translate adds a translation transformation to m using the coordinates of the +// given #graphene_point3d_t. +// +// This is the equivalent of calling graphene_matrix_init_translate() and then +// multiplying m with the translation matrix. +// +// The function takes the following parameters: +// +// - pos: #graphene_point3d_t. +func (m *Matrix) Translate(pos *Point3D) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_point3d_t // out + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(pos))) + + C.graphene_matrix_translate(_arg0, _arg1) + runtime.KeepAlive(m) + runtime.KeepAlive(pos) +} + +// Transpose transposes the given matrix. +// +// The function returns the following values: +// +// - res: return location for the transposed matrix. +func (m *Matrix) Transpose() *Matrix { + var _arg0 *C.graphene_matrix_t // out + var _arg1 C.graphene_matrix_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + C.graphene_matrix_transpose(_arg0, &_arg1) + runtime.KeepAlive(m) + + var _res *Matrix // out + + _res = (*Matrix)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// UnprojectPoint3D unprojects the given point using the projection matrix and a +// modelview matrix. +// +// The function takes the following parameters: +// +// - modelview for the modelview matrix; this is the inverse of the modelview +// used when projecting the point. +// - point with the coordinates of the point. +// +// The function returns the following values: +// +// - res: return location for the unprojected point. +func (projection *Matrix) UnprojectPoint3D(modelview *Matrix, point *Point3D) *Point3D { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_matrix_t // out + var _arg2 *C.graphene_point3d_t // out + var _arg3 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(projection))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(modelview))) + _arg2 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + C.graphene_matrix_unproject_point3d(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(projection) + runtime.KeepAlive(modelview) + runtime.KeepAlive(point) + + var _res *Point3D // out + + _res = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// UntransformBounds undoes the transformation on the corners of a +// #graphene_rect_t using the given matrix, within the given axis aligned +// rectangular bounds. +// +// The function takes the following parameters: +// +// - r: #graphene_rect_t. +// - bounds of the transformation. +// +// The function returns the following values: +// +// - res: return location for the untransformed rectangle. +func (m *Matrix) UntransformBounds(r *Rect, bounds *Rect) *Rect { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_rect_t // out + var _arg2 *C.graphene_rect_t // out + var _arg3 C.graphene_rect_t // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg2 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + + C.graphene_matrix_untransform_bounds(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(m) + runtime.KeepAlive(r) + runtime.KeepAlive(bounds) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// UntransformPoint undoes the transformation of a #graphene_point_t using the +// given matrix, within the given axis aligned rectangular bounds. +// +// The function takes the following parameters: +// +// - p: #graphene_point_t. +// - bounds of the transformation. +// +// The function returns the following values: +// +// - res: return location for the untransformed point. +// - ok: true if the point was successfully untransformed. +func (m *Matrix) UntransformPoint(p *Point, bounds *Rect) (*Point, bool) { + var _arg0 *C.graphene_matrix_t // out + var _arg1 *C.graphene_point_t // out + var _arg2 *C.graphene_rect_t // out + var _arg3 C.graphene_point_t // in + var _cret C._Bool // in + + _arg0 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg2 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + + _cret = C.graphene_matrix_untransform_point(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(m) + runtime.KeepAlive(p) + runtime.KeepAlive(bounds) + + var _res *Point // out + var _ok bool // out + + _res = (*Point)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + if _cret { + _ok = true + } + + return _res, _ok +} + +// Plane: 2D plane that extends infinitely in a 3D volume. +// +// The contents of the graphene_plane_t are private, and should not be modified +// directly. +// +// An instance of this type is always passed by reference. +type Plane struct { + *plane +} + +// plane is the struct that's finalized. +type plane struct { + native *C.graphene_plane_t +} + +func marshalPlane(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Plane{&plane{(*C.graphene_plane_t)(b)}}, nil +} + +// NewPlaneAlloc constructs a struct Plane. +func NewPlaneAlloc() *Plane { + var _cret *C.graphene_plane_t // in + + _cret = C.graphene_plane_alloc() + + var _plane *Plane // out + + _plane = (*Plane)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_plane)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_plane_free((*C.graphene_plane_t)(intern.C)) + }, + ) + + return _plane +} + +// Distance computes the distance of point from a #graphene_plane_t. +// +// The function takes the following parameters: +// +// - point: #graphene_point3d_t. +// +// The function returns the following values: +// +// - gfloat: distance of the given #graphene_point3d_t from the plane. +func (p *Plane) Distance(point *Point3D) float32 { + var _arg0 *C.graphene_plane_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.graphene_plane_distance(_arg0, _arg1) + runtime.KeepAlive(p) + runtime.KeepAlive(point) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Equal checks whether the two given #graphene_plane_t are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_plane_t. +// +// The function returns the following values: +// +// - ok: true if the given planes are equal. +func (a *Plane) Equal(b *Plane) bool { + var _arg0 *C.graphene_plane_t // out + var _arg1 *C.graphene_plane_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_plane_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Constant retrieves the distance along the normal vector of the given +// #graphene_plane_t from the origin. +// +// The function returns the following values: +// +// - gfloat: constant value of the plane. +func (p *Plane) Constant() float32 { + var _arg0 *C.graphene_plane_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + + _cret = C.graphene_plane_get_constant(_arg0) + runtime.KeepAlive(p) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Normal retrieves the normal vector pointing towards the origin of the given +// #graphene_plane_t. +// +// The function returns the following values: +// +// - normal: return location for the normal vector. +func (p *Plane) Normal() *Vec3 { + var _arg0 *C.graphene_plane_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_plane_get_normal(_arg0, &_arg1) + runtime.KeepAlive(p) + + var _normal *Vec3 // out + + _normal = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _normal +} + +// Init initializes the given #graphene_plane_t using the given normal vector +// and constant values. +// +// The function takes the following parameters: +// +// - normal (optional): unit length normal vector defining the plane pointing +// towards the origin; if unset, we use the X axis by default. +// - constant: distance from the origin to the plane along the normal vector; +// the sign determines the half-space occupied by the plane. +// +// The function returns the following values: +// +// - plane: initialized plane. +func (p *Plane) Init(normal *Vec3, constant float32) *Plane { + var _arg0 *C.graphene_plane_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.float // out + var _cret *C.graphene_plane_t // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + if normal != nil { + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(normal))) + } + _arg2 = C.float(constant) + + _cret = C.graphene_plane_init(_arg0, _arg1, _arg2) + runtime.KeepAlive(p) + runtime.KeepAlive(normal) + runtime.KeepAlive(constant) + + var _plane *Plane // out + + _plane = (*Plane)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _plane +} + +// InitFromPlane initializes the given #graphene_plane_t using the normal vector +// and constant of another #graphene_plane_t. +// +// The function takes the following parameters: +// +// - src: #graphene_plane_t. +// +// The function returns the following values: +// +// - plane: initialized plane. +func (p *Plane) InitFromPlane(src *Plane) *Plane { + var _arg0 *C.graphene_plane_t // out + var _arg1 *C.graphene_plane_t // out + var _cret *C.graphene_plane_t // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_plane_init_from_plane(_arg0, _arg1) + runtime.KeepAlive(p) + runtime.KeepAlive(src) + + var _plane *Plane // out + + _plane = (*Plane)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _plane +} + +// InitFromPoint initializes the given #graphene_plane_t using the given normal +// vector and an arbitrary co-planar point. +// +// The function takes the following parameters: +// +// - normal vector defining the plane pointing towards the origin. +// - point: #graphene_point3d_t. +// +// The function returns the following values: +// +// - plane: initialized plane. +func (p *Plane) InitFromPoint(normal *Vec3, point *Point3D) *Plane { + var _arg0 *C.graphene_plane_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 *C.graphene_point3d_t // out + var _cret *C.graphene_plane_t // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(normal))) + _arg2 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.graphene_plane_init_from_point(_arg0, _arg1, _arg2) + runtime.KeepAlive(p) + runtime.KeepAlive(normal) + runtime.KeepAlive(point) + + var _plane *Plane // out + + _plane = (*Plane)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _plane +} + +// InitFromPoints initializes the given #graphene_plane_t using the 3 provided +// co-planar points. +// +// The winding order is counter-clockwise, and determines which direction the +// normal vector will point. +// +// The function takes the following parameters: +// +// - a: #graphene_point3d_t. +// - b: #graphene_point3d_t. +// - c: #graphene_point3d_t. +// +// The function returns the following values: +// +// - plane: initialized plane. +func (p *Plane) InitFromPoints(a *Point3D, b *Point3D, c *Point3D) *Plane { + var _arg0 *C.graphene_plane_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 *C.graphene_point3d_t // out + var _arg3 *C.graphene_point3d_t // out + var _cret *C.graphene_plane_t // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg2 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg3 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(c))) + + _cret = C.graphene_plane_init_from_points(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(p) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(c) + + var _plane *Plane // out + + _plane = (*Plane)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _plane +} + +// InitFromVec4 initializes the given #graphene_plane_t using the components of +// the given #graphene_vec4_t vector. +// +// The function takes the following parameters: +// +// - src containing the normal vector in its first three components, and the +// distance in its fourth component. +// +// The function returns the following values: +// +// - plane: initialized plane. +func (p *Plane) InitFromVec4(src *Vec4) *Plane { + var _arg0 *C.graphene_plane_t // out + var _arg1 *C.graphene_vec4_t // out + var _cret *C.graphene_plane_t // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_plane_init_from_vec4(_arg0, _arg1) + runtime.KeepAlive(p) + runtime.KeepAlive(src) + + var _plane *Plane // out + + _plane = (*Plane)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _plane +} + +// Negate negates the normal vector and constant of a #graphene_plane_t, +// effectively mirroring the plane across the origin. +// +// The function returns the following values: +// +// - res: return location for the negated plane. +func (p *Plane) Negate() *Plane { + var _arg0 *C.graphene_plane_t // out + var _arg1 C.graphene_plane_t // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_plane_negate(_arg0, &_arg1) + runtime.KeepAlive(p) + + var _res *Plane // out + + _res = (*Plane)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Normalize normalizes the vector of the given #graphene_plane_t, and adjusts +// the constant accordingly. +// +// The function returns the following values: +// +// - res: return location for the normalized plane. +func (p *Plane) Normalize() *Plane { + var _arg0 *C.graphene_plane_t // out + var _arg1 C.graphene_plane_t // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_plane_normalize(_arg0, &_arg1) + runtime.KeepAlive(p) + + var _res *Plane // out + + _res = (*Plane)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Transform transforms a #graphene_plane_t p using the given matrix and +// normal_matrix. +// +// If normal_matrix is NULL, a transformation matrix for the plane normal will +// be computed from matrix. If you are transforming multiple planes using the +// same matrix it's recommended to compute the normal matrix beforehand to avoid +// incurring in the cost of recomputing it every time. +// +// The function takes the following parameters: +// +// - matrix: #graphene_matrix_t. +// - normalMatrix (optional): #graphene_matrix_t. +// +// The function returns the following values: +// +// - res: transformed plane. +func (p *Plane) Transform(matrix *Matrix, normalMatrix *Matrix) *Plane { + var _arg0 *C.graphene_plane_t // out + var _arg1 *C.graphene_matrix_t // out + var _arg2 *C.graphene_matrix_t // out + var _arg3 C.graphene_plane_t // in + + _arg0 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(matrix))) + if normalMatrix != nil { + _arg2 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(normalMatrix))) + } + + C.graphene_plane_transform(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(p) + runtime.KeepAlive(matrix) + runtime.KeepAlive(normalMatrix) + + var _res *Plane // out + + _res = (*Plane)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Point: point with two coordinates. +// +// An instance of this type is always passed by reference. +type Point struct { + *point +} + +// point is the struct that's finalized. +type point struct { + native *C.graphene_point_t +} + +func marshalPoint(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Point{&point{(*C.graphene_point_t)(b)}}, nil +} + +// NewPointAlloc constructs a struct Point. +func NewPointAlloc() *Point { + var _cret *C.graphene_point_t // in + + _cret = C.graphene_point_alloc() + + var _point *Point // out + + _point = (*Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_point)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_point_free((*C.graphene_point_t)(intern.C)) + }, + ) + + return _point +} + +// X coordinate of the point. +func (p *Point) X() float32 { + valptr := &p.native.x + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Y coordinate of the point. +func (p *Point) Y() float32 { + valptr := &p.native.y + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// X coordinate of the point. +func (p *Point) SetX(x float32) { + valptr := &p.native.x + *valptr = C.float(x) +} + +// Y coordinate of the point. +func (p *Point) SetY(y float32) { + valptr := &p.native.y + *valptr = C.float(y) +} + +// Distance computes the distance between a and b. +// +// The function takes the following parameters: +// +// - b: #graphene_point_t. +// +// The function returns the following values: +// +// - dX (optional): distance component on the X axis. +// - dY (optional): distance component on the Y axis. +// - gfloat: distance between the two points. +func (a *Point) Distance(b *Point) (dX float32, dY float32, gfloat float32) { + var _arg0 *C.graphene_point_t // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.float // in + var _arg3 C.float // in + var _cret C.float // in + + _arg0 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_point_distance(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _dX float32 // out + var _dY float32 // out + var _gfloat float32 // out + + _dX = float32(_arg2) + _dY = float32(_arg3) + _gfloat = float32(_cret) + + return _dX, _dY, _gfloat +} + +// Equal checks if the two points a and b point to the same coordinates. +// +// This function accounts for floating point fluctuations; if you want to +// control the fuzziness of the match, you can use graphene_point_near() +// instead. +// +// The function takes the following parameters: +// +// - b: #graphene_point_t. +// +// The function returns the following values: +// +// - ok: true if the points have the same coordinates. +func (a *Point) Equal(b *Point) bool { + var _arg0 *C.graphene_point_t // out + var _arg1 *C.graphene_point_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_point_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Init initializes p to the given x and y coordinates. +// +// It's safe to call this function multiple times. +// +// The function takes the following parameters: +// +// - x: x coordinate. +// - y: y coordinate. +// +// The function returns the following values: +// +// - point: initialized point. +func (p *Point) Init(x float32, y float32) *Point { + var _arg0 *C.graphene_point_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = C.float(x) + _arg2 = C.float(y) + + _cret = C.graphene_point_init(_arg0, _arg1, _arg2) + runtime.KeepAlive(p) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + + var _point *Point // out + + _point = (*Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// InitFromPoint initializes p with the same coordinates of src. +// +// The function takes the following parameters: +// +// - src to use. +// +// The function returns the following values: +// +// - point: initialized point. +func (p *Point) InitFromPoint(src *Point) *Point { + var _arg0 *C.graphene_point_t // out + var _arg1 *C.graphene_point_t // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_point_init_from_point(_arg0, _arg1) + runtime.KeepAlive(p) + runtime.KeepAlive(src) + + var _point *Point // out + + _point = (*Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// InitFromVec2 initializes p with the coordinates inside the given +// #graphene_vec2_t. +// +// The function takes the following parameters: +// +// - src: #graphene_vec2_t. +// +// The function returns the following values: +// +// - point: initialized point. +func (p *Point) InitFromVec2(src *Vec2) *Point { + var _arg0 *C.graphene_point_t // out + var _arg1 *C.graphene_vec2_t // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_point_init_from_vec2(_arg0, _arg1) + runtime.KeepAlive(p) + runtime.KeepAlive(src) + + var _point *Point // out + + _point = (*Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// Interpolate: linearly interpolates the coordinates of a and b using the given +// factor. +// +// The function takes the following parameters: +// +// - b: #graphene_point_t. +// - factor: linear interpolation factor. +// +// The function returns the following values: +// +// - res: return location for the interpolated point. +func (a *Point) Interpolate(b *Point, factor float64) *Point { + var _arg0 *C.graphene_point_t // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.double // out + var _arg3 C.graphene_point_t // in + + _arg0 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg2 = C.double(factor) + + C.graphene_point_interpolate(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(factor) + + var _res *Point // out + + _res = (*Point)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Near checks whether the two points a and b are within the threshold of +// epsilon. +// +// The function takes the following parameters: +// +// - b: #graphene_point_t. +// - epsilon: threshold between the two points. +// +// The function returns the following values: +// +// - ok: true if the distance is within epsilon. +func (a *Point) Near(b *Point, epsilon float32) bool { + var _arg0 *C.graphene_point_t // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.float // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg2 = C.float(epsilon) + + _cret = C.graphene_point_near(_arg0, _arg1, _arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(epsilon) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// ToVec2 stores the coordinates of the given #graphene_point_t into a +// #graphene_vec2_t. +// +// The function returns the following values: +// +// - v: return location for the vertex. +func (p *Point) ToVec2() *Vec2 { + var _arg0 *C.graphene_point_t // out + var _arg1 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_point_to_vec2(_arg0, &_arg1) + runtime.KeepAlive(p) + + var _v *Vec2 // out + + _v = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _v +} + +// PointZero returns a point fixed at (0, 0). +// +// The function returns the following values: +// +// - point: fixed point. +func PointZero() *Point { + var _cret *C.graphene_point_t // in + + _cret = C.graphene_point_zero() + + var _point *Point // out + + _point = (*Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// Point3D: point with three components: X, Y, and Z. +// +// An instance of this type is always passed by reference. +type Point3D struct { + *point3D +} + +// point3D is the struct that's finalized. +type point3D struct { + native *C.graphene_point3d_t +} + +func marshalPoint3D(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Point3D{&point3D{(*C.graphene_point3d_t)(b)}}, nil +} + +// NewPoint3DAlloc constructs a struct Point3D. +func NewPoint3DAlloc() *Point3D { + var _cret *C.graphene_point3d_t // in + + _cret = C.graphene_point3d_alloc() + + var _point3D *Point3D // out + + _point3D = (*Point3D)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_point3D)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_point3d_free((*C.graphene_point3d_t)(intern.C)) + }, + ) + + return _point3D +} + +// X coordinate. +func (p *Point3D) X() float32 { + valptr := &p.native.x + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Y coordinate. +func (p *Point3D) Y() float32 { + valptr := &p.native.y + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Z coordinate. +func (p *Point3D) Z() float32 { + valptr := &p.native.z + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// X coordinate. +func (p *Point3D) SetX(x float32) { + valptr := &p.native.x + *valptr = C.float(x) +} + +// Y coordinate. +func (p *Point3D) SetY(y float32) { + valptr := &p.native.y + *valptr = C.float(y) +} + +// Z coordinate. +func (p *Point3D) SetZ(z float32) { + valptr := &p.native.z + *valptr = C.float(z) +} + +// Cross computes the cross product of the two given #graphene_point3d_t. +// +// The function takes the following parameters: +// +// - b: #graphene_point3d_t. +// +// The function returns the following values: +// +// - res: return location for the cross product. +func (a *Point3D) Cross(b *Point3D) *Point3D { + var _arg0 *C.graphene_point3d_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_point3d_cross(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Point3D // out + + _res = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Distance computes the distance between the two given #graphene_point3d_t. +// +// The function takes the following parameters: +// +// - b: #graphene_point3d_t. +// +// The function returns the following values: +// +// - delta (optional): return location for the distance components on the X, +// Y, and Z axis. +// - gfloat: distance between two points. +func (a *Point3D) Distance(b *Point3D) (*Vec3, float32) { + var _arg0 *C.graphene_point3d_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.graphene_vec3_t // in + var _cret C.float // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_point3d_distance(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _delta *Vec3 // out + var _gfloat float32 // out + + _delta = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + _gfloat = float32(_cret) + + return _delta, _gfloat +} + +// Dot computes the dot product of the two given #graphene_point3d_t. +// +// The function takes the following parameters: +// +// - b: #graphene_point3d_t. +// +// The function returns the following values: +// +// - gfloat: value of the dot product. +func (a *Point3D) Dot(b *Point3D) float32 { + var _arg0 *C.graphene_point3d_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_point3d_dot(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Equal checks whether two given points are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_point3d_t. +// +// The function returns the following values: +// +// - ok: true if the points are equal. +func (a *Point3D) Equal(b *Point3D) bool { + var _arg0 *C.graphene_point3d_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_point3d_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Init initializes a #graphene_point3d_t with the given coordinates. +// +// The function takes the following parameters: +// +// - x: x coordinate of the point. +// - y: y coordinate of the point. +// - z: z coordinate of the point. +// +// The function returns the following values: +// +// - point3D: initialized #graphene_point3d_t. +func (p *Point3D) Init(x float32, y float32, z float32) *Point3D { + var _arg0 *C.graphene_point3d_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _cret *C.graphene_point3d_t // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = C.float(x) + _arg2 = C.float(y) + _arg3 = C.float(z) + + _cret = C.graphene_point3d_init(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(p) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(z) + + var _point3D *Point3D // out + + _point3D = (*Point3D)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point3D +} + +// InitFromPoint initializes a #graphene_point3d_t using the coordinates of +// another #graphene_point3d_t. +// +// The function takes the following parameters: +// +// - src: #graphene_point3d_t. +// +// The function returns the following values: +// +// - point3D: initialized point. +func (p *Point3D) InitFromPoint(src *Point3D) *Point3D { + var _arg0 *C.graphene_point3d_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret *C.graphene_point3d_t // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_point3d_init_from_point(_arg0, _arg1) + runtime.KeepAlive(p) + runtime.KeepAlive(src) + + var _point3D *Point3D // out + + _point3D = (*Point3D)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point3D +} + +// InitFromVec3 initializes a #graphene_point3d_t using the components of a +// #graphene_vec3_t. +// +// The function takes the following parameters: +// +// - v: #graphene_vec3_t. +// +// The function returns the following values: +// +// - point3D: initialized #graphene_point3d_t. +func (p *Point3D) InitFromVec3(v *Vec3) *Point3D { + var _arg0 *C.graphene_point3d_t // out + var _arg1 *C.graphene_vec3_t // out + var _cret *C.graphene_point3d_t // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_point3d_init_from_vec3(_arg0, _arg1) + runtime.KeepAlive(p) + runtime.KeepAlive(v) + + var _point3D *Point3D // out + + _point3D = (*Point3D)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point3D +} + +// Interpolate: linearly interpolates each component of a and b using the +// provided factor, and places the result in res. +// +// The function takes the following parameters: +// +// - b: #graphene_point3d_t. +// - factor: interpolation factor. +// +// The function returns the following values: +// +// - res: return location for the interpolated #graphene_point3d_t. +func (a *Point3D) Interpolate(b *Point3D, factor float64) *Point3D { + var _arg0 *C.graphene_point3d_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.double // out + var _arg3 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg2 = C.double(factor) + + C.graphene_point3d_interpolate(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(factor) + + var _res *Point3D // out + + _res = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Length computes the length of the vector represented by the coordinates of +// the given #graphene_point3d_t. +// +// The function returns the following values: +// +// - gfloat: length of the vector represented by the point. +func (p *Point3D) Length() float32 { + var _arg0 *C.graphene_point3d_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + + _cret = C.graphene_point3d_length(_arg0) + runtime.KeepAlive(p) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Near checks whether the two points are near each other, within an epsilon +// factor. +// +// The function takes the following parameters: +// +// - b: #graphene_point3d_t. +// - epsilon fuzzyness factor. +// +// The function returns the following values: +// +// - ok: true if the points are near each other. +func (a *Point3D) Near(b *Point3D, epsilon float32) bool { + var _arg0 *C.graphene_point3d_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.float // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg2 = C.float(epsilon) + + _cret = C.graphene_point3d_near(_arg0, _arg1, _arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(epsilon) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Normalize computes the normalization of the vector represented by the +// coordinates of the given #graphene_point3d_t. +// +// The function returns the following values: +// +// - res: return location for the normalized #graphene_point3d_t. +func (p *Point3D) Normalize() *Point3D { + var _arg0 *C.graphene_point3d_t // out + var _arg1 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_point3d_normalize(_arg0, &_arg1) + runtime.KeepAlive(p) + + var _res *Point3D // out + + _res = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// NormalizeViewport normalizes the coordinates of a #graphene_point3d_t using +// the given viewport and clipping planes. +// +// The coordinates of the resulting #graphene_point3d_t will be in the [ -1, +// 1 ] range. +// +// The function takes the following parameters: +// +// - viewport representing a viewport. +// - zNear: coordinate of the near clipping plane, or 0 for the default near +// clipping plane. +// - zFar: coordinate of the far clipping plane, or 1 for the default far +// clipping plane. +// +// The function returns the following values: +// +// - res: return location for the normalized #graphene_point3d_t. +func (p *Point3D) NormalizeViewport(viewport *Rect, zNear float32, zFar float32) *Point3D { + var _arg0 *C.graphene_point3d_t // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(viewport))) + _arg2 = C.float(zNear) + _arg3 = C.float(zFar) + + C.graphene_point3d_normalize_viewport(_arg0, _arg1, _arg2, _arg3, &_arg4) + runtime.KeepAlive(p) + runtime.KeepAlive(viewport) + runtime.KeepAlive(zNear) + runtime.KeepAlive(zFar) + + var _res *Point3D // out + + _res = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg4)))) + + return _res +} + +// Scale scales the coordinates of the given #graphene_point3d_t by the given +// factor. +// +// The function takes the following parameters: +// +// - factor: scaling factor. +// +// The function returns the following values: +// +// - res: return location for the scaled point. +func (p *Point3D) Scale(factor float32) *Point3D { + var _arg0 *C.graphene_point3d_t // out + var _arg1 C.float // out + var _arg2 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + _arg1 = C.float(factor) + + C.graphene_point3d_scale(_arg0, _arg1, &_arg2) + runtime.KeepAlive(p) + runtime.KeepAlive(factor) + + var _res *Point3D // out + + _res = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// ToVec3 stores the coordinates of a #graphene_point3d_t into a +// #graphene_vec3_t. +// +// The function returns the following values: +// +// - v: return location for a #graphene_vec3_t. +func (p *Point3D) ToVec3() *Vec3 { + var _arg0 *C.graphene_point3d_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_point3d_to_vec3(_arg0, &_arg1) + runtime.KeepAlive(p) + + var _v *Vec3 // out + + _v = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _v +} + +// Point3DZero retrieves a constant point with all three coordinates set to 0. +// +// The function returns the following values: +// +// - point3D: zero point. +func Point3DZero() *Point3D { + var _cret *C.graphene_point3d_t // in + + _cret = C.graphene_point3d_zero() + + var _point3D *Point3D // out + + _point3D = (*Point3D)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point3D +} + +// Quad: 4 vertex quadrilateral, as represented by four #graphene_point_t. +// +// The contents of a #graphene_quad_t are private and should never be accessed +// directly. +// +// An instance of this type is always passed by reference. +type Quad struct { + *quad +} + +// quad is the struct that's finalized. +type quad struct { + native *C.graphene_quad_t +} + +func marshalQuad(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Quad{&quad{(*C.graphene_quad_t)(b)}}, nil +} + +// NewQuadAlloc constructs a struct Quad. +func NewQuadAlloc() *Quad { + var _cret *C.graphene_quad_t // in + + _cret = C.graphene_quad_alloc() + + var _quad *Quad // out + + _quad = (*Quad)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_quad)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_quad_free((*C.graphene_quad_t)(intern.C)) + }, + ) + + return _quad +} + +// Bounds computes the bounding rectangle of q and places it into r. +// +// The function returns the following values: +// +// - r: return location for a #graphene_rect_t. +func (q *Quad) Bounds() *Rect { + var _arg0 *C.graphene_quad_t // out + var _arg1 C.graphene_rect_t // in + + _arg0 = (*C.graphene_quad_t)(gextras.StructNative(unsafe.Pointer(q))) + + C.graphene_quad_bounds(_arg0, &_arg1) + runtime.KeepAlive(q) + + var _r *Rect // out + + _r = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _r +} + +// Contains checks if the given #graphene_quad_t contains the given +// #graphene_point_t. +// +// The function takes the following parameters: +// +// - p: #graphene_point_t. +// +// The function returns the following values: +// +// - ok: true if the point is inside the #graphene_quad_t. +func (q *Quad) Contains(p *Point) bool { + var _arg0 *C.graphene_quad_t // out + var _arg1 *C.graphene_point_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_quad_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + + _cret = C.graphene_quad_contains(_arg0, _arg1) + runtime.KeepAlive(q) + runtime.KeepAlive(p) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Point retrieves the point of a #graphene_quad_t at the given index. +// +// The function takes the following parameters: +// +// - index_: index of the point to retrieve. +// +// The function returns the following values: +// +// - point: #graphene_point_t. +func (q *Quad) Point(index_ uint) *Point { + var _arg0 *C.graphene_quad_t // out + var _arg1 C.uint // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.graphene_quad_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = C.uint(index_) + + _cret = C.graphene_quad_get_point(_arg0, _arg1) + runtime.KeepAlive(q) + runtime.KeepAlive(index_) + + var _point *Point // out + + _point = (*Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// Init initializes a #graphene_quad_t with the given points. +// +// The function takes the following parameters: +// +// - p1: first point of the quadrilateral. +// - p2: second point of the quadrilateral. +// - p3: third point of the quadrilateral. +// - p4: fourth point of the quadrilateral. +// +// The function returns the following values: +// +// - quad: initialized #graphene_quad_t. +func (q *Quad) Init(p1 *Point, p2 *Point, p3 *Point, p4 *Point) *Quad { + var _arg0 *C.graphene_quad_t // out + var _arg1 *C.graphene_point_t // out + var _arg2 *C.graphene_point_t // out + var _arg3 *C.graphene_point_t // out + var _arg4 *C.graphene_point_t // out + var _cret *C.graphene_quad_t // in + + _arg0 = (*C.graphene_quad_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p1))) + _arg2 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p2))) + _arg3 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p3))) + _arg4 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p4))) + + _cret = C.graphene_quad_init(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(q) + runtime.KeepAlive(p1) + runtime.KeepAlive(p2) + runtime.KeepAlive(p3) + runtime.KeepAlive(p4) + + var _quad *Quad // out + + _quad = (*Quad)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quad +} + +// InitFromPoints initializes a #graphene_quad_t using an array of points. +// +// The function takes the following parameters: +// +// - points: array of 4 #graphene_point_t. +// +// The function returns the following values: +// +// - quad: initialized #graphene_quad_t. +func (q *Quad) InitFromPoints(points [4]Point) *Quad { + var _arg0 *C.graphene_quad_t // out + var _arg1 *C.graphene_point_t // out + var _cret *C.graphene_quad_t // in + + _arg0 = (*C.graphene_quad_t)(gextras.StructNative(unsafe.Pointer(q))) + { + var out [4]C.graphene_point_t + _arg1 = &out[0] + for i := 0; i < 4; i++ { + out[i] = *(*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer((&points[i])))) + } + } + + _cret = C.graphene_quad_init_from_points(_arg0, _arg1) + runtime.KeepAlive(q) + runtime.KeepAlive(points) + + var _quad *Quad // out + + _quad = (*Quad)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quad +} + +// InitFromRect initializes a #graphene_quad_t using the four corners of the +// given #graphene_rect_t. +// +// The function takes the following parameters: +// +// - r: #graphene_rect_t. +// +// The function returns the following values: +// +// - quad: initialized #graphene_quad_t. +func (q *Quad) InitFromRect(r *Rect) *Quad { + var _arg0 *C.graphene_quad_t // out + var _arg1 *C.graphene_rect_t // out + var _cret *C.graphene_quad_t // in + + _arg0 = (*C.graphene_quad_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + _cret = C.graphene_quad_init_from_rect(_arg0, _arg1) + runtime.KeepAlive(q) + runtime.KeepAlive(r) + + var _quad *Quad // out + + _quad = (*Quad)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quad +} + +// Quaternion: quaternion. +// +// The contents of the #graphene_quaternion_t structure are private and should +// never be accessed directly. +// +// An instance of this type is always passed by reference. +type Quaternion struct { + *quaternion +} + +// quaternion is the struct that's finalized. +type quaternion struct { + native *C.graphene_quaternion_t +} + +func marshalQuaternion(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Quaternion{&quaternion{(*C.graphene_quaternion_t)(b)}}, nil +} + +// NewQuaternionAlloc constructs a struct Quaternion. +func NewQuaternionAlloc() *Quaternion { + var _cret *C.graphene_quaternion_t // in + + _cret = C.graphene_quaternion_alloc() + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_quaternion)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_quaternion_free((*C.graphene_quaternion_t)(intern.C)) + }, + ) + + return _quaternion +} + +// Add adds two #graphene_quaternion_t a and b. +// +// The function takes the following parameters: +// +// - b: #graphene_quaternion_t. +// +// The function returns the following values: +// +// - res: result of the operation. +func (a *Quaternion) Add(b *Quaternion) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 *C.graphene_quaternion_t // out + var _arg2 C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_quaternion_add(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Quaternion // out + + _res = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Dot computes the dot product of two #graphene_quaternion_t. +// +// The function takes the following parameters: +// +// - b: #graphene_quaternion_t. +// +// The function returns the following values: +// +// - gfloat: value of the dot products. +func (a *Quaternion) Dot(b *Quaternion) float32 { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 *C.graphene_quaternion_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_quaternion_dot(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Equal checks whether the given quaternions are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_quaternion_t. +// +// The function returns the following values: +// +// - ok: true if the quaternions are equal. +func (a *Quaternion) Equal(b *Quaternion) bool { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 *C.graphene_quaternion_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_quaternion_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Init initializes a #graphene_quaternion_t using the given four values. +// +// The function takes the following parameters: +// +// - x: first component of the quaternion. +// - y: second component of the quaternion. +// - z: third component of the quaternion. +// - w: fourth component of the quaternion. +// +// The function returns the following values: +// +// - quaternion: initialized quaternion. +func (q *Quaternion) Init(x float32, y float32, z float32, w float32) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _cret *C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = C.float(x) + _arg2 = C.float(y) + _arg3 = C.float(z) + _arg4 = C.float(w) + + _cret = C.graphene_quaternion_init(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(q) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(z) + runtime.KeepAlive(w) + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quaternion +} + +// InitFromAngleVec3 initializes a #graphene_quaternion_t using an angle on a +// specific axis. +// +// The function takes the following parameters: +// +// - angle: rotation on a given axis, in degrees. +// - axis of rotation, expressed as a vector. +// +// The function returns the following values: +// +// - quaternion: initialized quaternion. +func (q *Quaternion) InitFromAngleVec3(angle float32, axis *Vec3) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.float // out + var _arg2 *C.graphene_vec3_t // out + var _cret *C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = C.float(angle) + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(axis))) + + _cret = C.graphene_quaternion_init_from_angle_vec3(_arg0, _arg1, _arg2) + runtime.KeepAlive(q) + runtime.KeepAlive(angle) + runtime.KeepAlive(axis) + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quaternion +} + +// InitFromAngles initializes a #graphene_quaternion_t using the values of the +// Euler angles (http://en.wikipedia.org/wiki/Euler_angles) on each axis. +// +// See also: graphene_quaternion_init_from_euler(). +// +// The function takes the following parameters: +// +// - degX: rotation angle on the X axis (yaw), in degrees. +// - degY: rotation angle on the Y axis (pitch), in degrees. +// - degZ: rotation angle on the Z axis (roll), in degrees. +// +// The function returns the following values: +// +// - quaternion: initialized quaternion. +func (q *Quaternion) InitFromAngles(degX float32, degY float32, degZ float32) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _cret *C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = C.float(degX) + _arg2 = C.float(degY) + _arg3 = C.float(degZ) + + _cret = C.graphene_quaternion_init_from_angles(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(q) + runtime.KeepAlive(degX) + runtime.KeepAlive(degY) + runtime.KeepAlive(degZ) + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quaternion +} + +// InitFromEuler initializes a #graphene_quaternion_t using the given +// #graphene_euler_t. +// +// The function takes the following parameters: +// +// - e: #graphene_euler_t. +// +// The function returns the following values: +// +// - quaternion: initialized #graphene_quaternion_t. +func (q *Quaternion) InitFromEuler(e *Euler) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 *C.graphene_euler_t // out + var _cret *C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = (*C.graphene_euler_t)(gextras.StructNative(unsafe.Pointer(e))) + + _cret = C.graphene_quaternion_init_from_euler(_arg0, _arg1) + runtime.KeepAlive(q) + runtime.KeepAlive(e) + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quaternion +} + +// InitFromMatrix initializes a #graphene_quaternion_t using the rotation +// components of a transformation matrix. +// +// The function takes the following parameters: +// +// - m: #graphene_matrix_t. +// +// The function returns the following values: +// +// - quaternion: initialized quaternion. +func (q *Quaternion) InitFromMatrix(m *Matrix) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 *C.graphene_matrix_t // out + var _cret *C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(m))) + + _cret = C.graphene_quaternion_init_from_matrix(_arg0, _arg1) + runtime.KeepAlive(q) + runtime.KeepAlive(m) + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quaternion +} + +// InitFromQuaternion initializes a #graphene_quaternion_t with the values from +// src. +// +// The function takes the following parameters: +// +// - src: #graphene_quaternion_t. +// +// The function returns the following values: +// +// - quaternion: initialized quaternion. +func (q *Quaternion) InitFromQuaternion(src *Quaternion) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 *C.graphene_quaternion_t // out + var _cret *C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_quaternion_init_from_quaternion(_arg0, _arg1) + runtime.KeepAlive(q) + runtime.KeepAlive(src) + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quaternion +} + +// InitFromRadians initializes a #graphene_quaternion_t using the values of the +// Euler angles (http://en.wikipedia.org/wiki/Euler_angles) on each axis. +// +// See also: graphene_quaternion_init_from_euler(). +// +// The function takes the following parameters: +// +// - radX: rotation angle on the X axis (yaw), in radians. +// - radY: rotation angle on the Y axis (pitch), in radians. +// - radZ: rotation angle on the Z axis (roll), in radians. +// +// The function returns the following values: +// +// - quaternion: initialized quaternion. +func (q *Quaternion) InitFromRadians(radX float32, radY float32, radZ float32) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _cret *C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = C.float(radX) + _arg2 = C.float(radY) + _arg3 = C.float(radZ) + + _cret = C.graphene_quaternion_init_from_radians(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(q) + runtime.KeepAlive(radX) + runtime.KeepAlive(radY) + runtime.KeepAlive(radZ) + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quaternion +} + +// InitFromVec4 initializes a #graphene_quaternion_t with the values from src. +// +// The function takes the following parameters: +// +// - src: #graphene_vec4_t. +// +// The function returns the following values: +// +// - quaternion: initialized quaternion. +func (q *Quaternion) InitFromVec4(src *Vec4) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 *C.graphene_vec4_t // out + var _cret *C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_quaternion_init_from_vec4(_arg0, _arg1) + runtime.KeepAlive(q) + runtime.KeepAlive(src) + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quaternion +} + +// InitIdentity initializes a #graphene_quaternion_t using the identity +// transformation. +// +// The function returns the following values: +// +// - quaternion: initialized quaternion. +func (q *Quaternion) InitIdentity() *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _cret *C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + + _cret = C.graphene_quaternion_init_identity(_arg0) + runtime.KeepAlive(q) + + var _quaternion *Quaternion // out + + _quaternion = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _quaternion +} + +// Invert inverts a #graphene_quaternion_t, and returns the conjugate quaternion +// of q. +// +// The function returns the following values: +// +// - res: return location for the inverted quaternion. +func (q *Quaternion) Invert() *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + + C.graphene_quaternion_invert(_arg0, &_arg1) + runtime.KeepAlive(q) + + var _res *Quaternion // out + + _res = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Multiply multiplies two #graphene_quaternion_t a and b. +// +// The function takes the following parameters: +// +// - b: #graphene_quaternion_t. +// +// The function returns the following values: +// +// - res: result of the operation. +func (a *Quaternion) Multiply(b *Quaternion) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 *C.graphene_quaternion_t // out + var _arg2 C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_quaternion_multiply(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Quaternion // out + + _res = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Normalize normalizes a #graphene_quaternion_t. +// +// The function returns the following values: +// +// - res: return location for the normalized quaternion. +func (q *Quaternion) Normalize() *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + + C.graphene_quaternion_normalize(_arg0, &_arg1) + runtime.KeepAlive(q) + + var _res *Quaternion // out + + _res = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Scale scales all the elements of a #graphene_quaternion_t q using the given +// scalar factor. +// +// The function takes the following parameters: +// +// - factor: scaling factor. +// +// The function returns the following values: +// +// - res: result of the operation. +func (q *Quaternion) Scale(factor float32) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.float // out + var _arg2 C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + _arg1 = C.float(factor) + + C.graphene_quaternion_scale(_arg0, _arg1, &_arg2) + runtime.KeepAlive(q) + runtime.KeepAlive(factor) + + var _res *Quaternion // out + + _res = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Slerp interpolates between the two given quaternions using a spherical linear +// interpolation, or SLERP (http://en.wikipedia.org/wiki/Slerp), using the given +// interpolation factor. +// +// The function takes the following parameters: +// +// - b: #graphene_quaternion_t. +// - factor: linear interpolation factor. +// +// The function returns the following values: +// +// - res: return location for the interpolated quaternion. +func (a *Quaternion) Slerp(b *Quaternion, factor float32) *Quaternion { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 *C.graphene_quaternion_t // out + var _arg2 C.float // out + var _arg3 C.graphene_quaternion_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg2 = C.float(factor) + + C.graphene_quaternion_slerp(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(factor) + + var _res *Quaternion // out + + _res = (*Quaternion)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// ToAngleVec3 converts a quaternion into an angle, axis pair. +// +// The function returns the following values: +// +// - angle: return location for the angle, in degrees. +// - axis: return location for the rotation axis. +func (q *Quaternion) ToAngleVec3() (float32, *Vec3) { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.float // in + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + + C.graphene_quaternion_to_angle_vec3(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(q) + + var _angle float32 // out + var _axis *Vec3 // out + + _angle = float32(_arg1) + _axis = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _angle, _axis +} + +// ToAngles converts a #graphene_quaternion_t to its corresponding rotations on +// the Euler angles (http://en.wikipedia.org/wiki/Euler_angles) on each axis. +// +// The function returns the following values: +// +// - degX (optional): return location for the rotation angle on the X axis +// (yaw), in degrees. +// - degY (optional): return location for the rotation angle on the Y axis +// (pitch), in degrees. +// - degZ (optional): return location for the rotation angle on the Z axis +// (roll), in degrees. +func (q *Quaternion) ToAngles() (degX float32, degY float32, degZ float32) { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.float // in + var _arg2 C.float // in + var _arg3 C.float // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + + C.graphene_quaternion_to_angles(_arg0, &_arg1, &_arg2, &_arg3) + runtime.KeepAlive(q) + + var _degX float32 // out + var _degY float32 // out + var _degZ float32 // out + + _degX = float32(_arg1) + _degY = float32(_arg2) + _degZ = float32(_arg3) + + return _degX, _degY, _degZ +} + +// ToMatrix converts a quaternion into a transformation matrix expressing the +// rotation defined by the #graphene_quaternion_t. +// +// The function returns the following values: +// +// - m: #graphene_matrix_t. +func (q *Quaternion) ToMatrix() *Matrix { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.graphene_matrix_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + + C.graphene_quaternion_to_matrix(_arg0, &_arg1) + runtime.KeepAlive(q) + + var _m *Matrix // out + + _m = (*Matrix)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _m +} + +// ToRadians converts a #graphene_quaternion_t to its corresponding rotations on +// the Euler angles (http://en.wikipedia.org/wiki/Euler_angles) on each axis. +// +// The function returns the following values: +// +// - radX (optional): return location for the rotation angle on the X axis +// (yaw), in radians. +// - radY (optional): return location for the rotation angle on the Y axis +// (pitch), in radians. +// - radZ (optional): return location for the rotation angle on the Z axis +// (roll), in radians. +func (q *Quaternion) ToRadians() (radX float32, radY float32, radZ float32) { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.float // in + var _arg2 C.float // in + var _arg3 C.float // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + + C.graphene_quaternion_to_radians(_arg0, &_arg1, &_arg2, &_arg3) + runtime.KeepAlive(q) + + var _radX float32 // out + var _radY float32 // out + var _radZ float32 // out + + _radX = float32(_arg1) + _radY = float32(_arg2) + _radZ = float32(_arg3) + + return _radX, _radY, _radZ +} + +// ToVec4 copies the components of a #graphene_quaternion_t into a +// #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for a #graphene_vec4_t. +func (q *Quaternion) ToVec4() *Vec4 { + var _arg0 *C.graphene_quaternion_t // out + var _arg1 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_quaternion_t)(gextras.StructNative(unsafe.Pointer(q))) + + C.graphene_quaternion_to_vec4(_arg0, &_arg1) + runtime.KeepAlive(q) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Ray: ray emitted from an origin in a given direction. +// +// The contents of the graphene_ray_t structure are private, and should not be +// modified directly. +// +// An instance of this type is always passed by reference. +type Ray struct { + *ray +} + +// ray is the struct that's finalized. +type ray struct { + native *C.graphene_ray_t +} + +func marshalRay(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Ray{&ray{(*C.graphene_ray_t)(b)}}, nil +} + +// NewRayAlloc constructs a struct Ray. +func NewRayAlloc() *Ray { + var _cret *C.graphene_ray_t // in + + _cret = C.graphene_ray_alloc() + + var _ray *Ray // out + + _ray = (*Ray)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_ray)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_ray_free((*C.graphene_ray_t)(intern.C)) + }, + ) + + return _ray +} + +// Equal checks whether the two given #graphene_ray_t are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_ray_t. +// +// The function returns the following values: +// +// - ok: true if the given rays are equal. +func (a *Ray) Equal(b *Ray) bool { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_ray_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_ray_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// ClosestPointToPoint computes the point on the given #graphene_ray_t that is +// closest to the given point p. +// +// The function takes the following parameters: +// +// - p: #graphene_point3d_t. +// +// The function returns the following values: +// +// - res: return location for the closest point3d. +func (r *Ray) ClosestPointToPoint(p *Point3D) *Point3D { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_ray_get_closest_point_to_point(_arg0, _arg1, &_arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(p) + + var _res *Point3D // out + + _res = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Direction retrieves the direction of the given #graphene_ray_t. +// +// The function returns the following values: +// +// - direction: return location for the direction. +func (r *Ray) Direction() *Vec3 { + var _arg0 *C.graphene_ray_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_ray_get_direction(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _direction *Vec3 // out + + _direction = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _direction +} + +// DistanceToPlane computes the distance of the origin of the given +// #graphene_ray_t from the given plane. +// +// If the ray does not intersect the plane, this function returns INFINITY. +// +// The function takes the following parameters: +// +// - p: #graphene_plane_t. +// +// The function returns the following values: +// +// - gfloat: distance of the origin of the ray from the plane. +func (r *Ray) DistanceToPlane(p *Plane) float32 { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_plane_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_plane_t)(gextras.StructNative(unsafe.Pointer(p))) + + _cret = C.graphene_ray_get_distance_to_plane(_arg0, _arg1) + runtime.KeepAlive(r) + runtime.KeepAlive(p) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// DistanceToPoint computes the distance of the closest approach between the +// given #graphene_ray_t r and the point p. +// +// The closest approach to a ray from a point is the distance between the point +// and the projection of the point on the ray itself. +// +// The function takes the following parameters: +// +// - p: #graphene_point3d_t. +// +// The function returns the following values: +// +// - gfloat: distance of the point. +func (r *Ray) DistanceToPoint(p *Point3D) float32 { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + + _cret = C.graphene_ray_get_distance_to_point(_arg0, _arg1) + runtime.KeepAlive(r) + runtime.KeepAlive(p) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Origin retrieves the origin of the given #graphene_ray_t. +// +// The function returns the following values: +// +// - origin: return location for the origin. +func (r *Ray) Origin() *Point3D { + var _arg0 *C.graphene_ray_t // out + var _arg1 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_ray_get_origin(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _origin *Point3D // out + + _origin = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _origin +} + +// PositionAt retrieves the coordinates of a point at the distance t along the +// given #graphene_ray_t. +// +// The function takes the following parameters: +// +// - t: distance along the ray. +// +// The function returns the following values: +// +// - position: return location for the position. +func (r *Ray) PositionAt(t float32) *Point3D { + var _arg0 *C.graphene_ray_t // out + var _arg1 C.float // out + var _arg2 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = C.float(t) + + C.graphene_ray_get_position_at(_arg0, _arg1, &_arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(t) + + var _position *Point3D // out + + _position = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _position +} + +// Init initializes the given #graphene_ray_t using the given origin and +// direction values. +// +// The function takes the following parameters: +// +// - origin (optional) of the ray. +// - direction (optional) vector. +// +// The function returns the following values: +// +// - ray: initialized ray. +func (r *Ray) Init(origin *Point3D, direction *Vec3) *Ray { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 *C.graphene_vec3_t // out + var _cret *C.graphene_ray_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + if origin != nil { + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(origin))) + } + if direction != nil { + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(direction))) + } + + _cret = C.graphene_ray_init(_arg0, _arg1, _arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(origin) + runtime.KeepAlive(direction) + + var _ray *Ray // out + + _ray = (*Ray)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _ray +} + +// InitFromRay initializes the given #graphene_ray_t using the origin and +// direction values of another #graphene_ray_t. +// +// The function takes the following parameters: +// +// - src: #graphene_ray_t. +// +// The function returns the following values: +// +// - ray: initialized ray. +func (r *Ray) InitFromRay(src *Ray) *Ray { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_ray_t // out + var _cret *C.graphene_ray_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_ray_init_from_ray(_arg0, _arg1) + runtime.KeepAlive(r) + runtime.KeepAlive(src) + + var _ray *Ray // out + + _ray = (*Ray)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _ray +} + +// InitFromVec3 initializes the given #graphene_ray_t using the given vectors. +// +// The function takes the following parameters: +// +// - origin (optional): #graphene_vec3_t. +// - direction (optional): #graphene_vec3_t. +// +// The function returns the following values: +// +// - ray: initialized ray. +func (r *Ray) InitFromVec3(origin *Vec3, direction *Vec3) *Ray { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 *C.graphene_vec3_t // out + var _cret *C.graphene_ray_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + if origin != nil { + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(origin))) + } + if direction != nil { + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(direction))) + } + + _cret = C.graphene_ray_init_from_vec3(_arg0, _arg1, _arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(origin) + runtime.KeepAlive(direction) + + var _ray *Ray // out + + _ray = (*Ray)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _ray +} + +// IntersectBox intersects the given #graphene_ray_t r with the given +// #graphene_box_t b. +// +// The function takes the following parameters: +// +// - b: #graphene_box_t. +// +// The function returns the following values: +// +// - tOut: distance of the point on the ray that intersects the box. +// - rayIntersectionKind: type of intersection. +func (r *Ray) IntersectBox(b *Box) (float32, RayIntersectionKind) { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_box_t // out + var _arg2 C.float // in + var _cret C.graphene_ray_intersection_kind_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_ray_intersect_box(_arg0, _arg1, &_arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(b) + + var _tOut float32 // out + var _rayIntersectionKind RayIntersectionKind // out + + _tOut = float32(_arg2) + _rayIntersectionKind = RayIntersectionKind(_cret) + + return _tOut, _rayIntersectionKind +} + +// IntersectSphere intersects the given #graphene_ray_t r with the given +// #graphene_sphere_t s. +// +// The function takes the following parameters: +// +// - s: #graphene_sphere_t. +// +// The function returns the following values: +// +// - tOut: distance of the point on the ray that intersects the sphere. +// - rayIntersectionKind: type of intersection. +func (r *Ray) IntersectSphere(s *Sphere) (float32, RayIntersectionKind) { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_sphere_t // out + var _arg2 C.float // in + var _cret C.graphene_ray_intersection_kind_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + + _cret = C.graphene_ray_intersect_sphere(_arg0, _arg1, &_arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(s) + + var _tOut float32 // out + var _rayIntersectionKind RayIntersectionKind // out + + _tOut = float32(_arg2) + _rayIntersectionKind = RayIntersectionKind(_cret) + + return _tOut, _rayIntersectionKind +} + +// IntersectTriangle intersects the given #graphene_ray_t r with the given +// #graphene_triangle_t t. +// +// The function takes the following parameters: +// +// - t: #graphene_triangle_t. +// +// The function returns the following values: +// +// - tOut: distance of the point on the ray that intersects the triangle. +// - rayIntersectionKind: type of intersection. +func (r *Ray) IntersectTriangle(t *Triangle) (float32, RayIntersectionKind) { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_triangle_t // out + var _arg2 C.float // in + var _cret C.graphene_ray_intersection_kind_t // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + + _cret = C.graphene_ray_intersect_triangle(_arg0, _arg1, &_arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(t) + + var _tOut float32 // out + var _rayIntersectionKind RayIntersectionKind // out + + _tOut = float32(_arg2) + _rayIntersectionKind = RayIntersectionKind(_cret) + + return _tOut, _rayIntersectionKind +} + +// IntersectsBox checks whether the given #graphene_ray_t r intersects the given +// #graphene_box_t b. +// +// See also: graphene_ray_intersect_box(). +// +// The function takes the following parameters: +// +// - b: #graphene_box_t. +// +// The function returns the following values: +// +// - ok: true if the ray intersects the box. +func (r *Ray) IntersectsBox(b *Box) bool { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_box_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_box_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_ray_intersects_box(_arg0, _arg1) + runtime.KeepAlive(r) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// IntersectsSphere checks if the given #graphene_ray_t r intersects the given +// #graphene_sphere_t s. +// +// See also: graphene_ray_intersect_sphere(). +// +// The function takes the following parameters: +// +// - s: #graphene_sphere_t. +// +// The function returns the following values: +// +// - ok: true if the ray intersects the sphere. +func (r *Ray) IntersectsSphere(s *Sphere) bool { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_sphere_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + + _cret = C.graphene_ray_intersects_sphere(_arg0, _arg1) + runtime.KeepAlive(r) + runtime.KeepAlive(s) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// IntersectsTriangle checks whether the given #graphene_ray_t r intersects the +// given #graphene_triangle_t b. +// +// See also: graphene_ray_intersect_triangle(). +// +// The function takes the following parameters: +// +// - t: #graphene_triangle_t. +// +// The function returns the following values: +// +// - ok: true if the ray intersects the triangle. +func (r *Ray) IntersectsTriangle(t *Triangle) bool { + var _arg0 *C.graphene_ray_t // out + var _arg1 *C.graphene_triangle_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_ray_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + + _cret = C.graphene_ray_intersects_triangle(_arg0, _arg1) + runtime.KeepAlive(r) + runtime.KeepAlive(t) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Rect: location and size of a rectangle region. +// +// The width and height of a #graphene_rect_t can be negative; for instance, +// a #graphene_rect_t with an origin of [ 0, 0 ] and a size of [ 10, 10 ] is +// equivalent to a #graphene_rect_t with an origin of [ 10, 10 ] and a size of [ +// -10, -10 ]. +// +// Application code can normalize rectangles using graphene_rect_normalize(); +// this function will ensure that the width and height of a rectangle are +// positive values. All functions taking a #graphene_rect_t as an argument +// will internally operate on a normalized copy; all functions returning a +// #graphene_rect_t will always return a normalized rectangle. +// +// An instance of this type is always passed by reference. +type Rect struct { + *rect +} + +// rect is the struct that's finalized. +type rect struct { + native *C.graphene_rect_t +} + +func marshalRect(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Rect{&rect{(*C.graphene_rect_t)(b)}}, nil +} + +// Origin coordinates of the origin of the rectangle. +func (r *Rect) Origin() *Point { + valptr := &r.native.origin + var _v *Point // out + _v = (*Point)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// Size: size of the rectangle. +func (r *Rect) Size() *Size { + valptr := &r.native.size + var _v *Size // out + _v = (*Size)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// ContainsPoint checks whether a #graphene_rect_t contains the given +// coordinates. +// +// The function takes the following parameters: +// +// - p: #graphene_point_t. +// +// The function returns the following values: +// +// - ok: true if the rectangle contains the point. +func (r *Rect) ContainsPoint(p *Point) bool { + var _arg0 *C.graphene_rect_t // out + var _arg1 *C.graphene_point_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + + _cret = C.graphene_rect_contains_point(_arg0, _arg1) + runtime.KeepAlive(r) + runtime.KeepAlive(p) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// ContainsRect checks whether a #graphene_rect_t fully contains the given +// rectangle. +// +// The function takes the following parameters: +// +// - b: #graphene_rect_t. +// +// The function returns the following values: +// +// - ok: true if the rectangle a fully contains b. +func (a *Rect) ContainsRect(b *Rect) bool { + var _arg0 *C.graphene_rect_t // out + var _arg1 *C.graphene_rect_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_rect_contains_rect(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Equal checks whether the two given rectangle are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_rect_t. +// +// The function returns the following values: +// +// - ok: true if the rectangles are equal. +func (a *Rect) Equal(b *Rect) bool { + var _arg0 *C.graphene_rect_t // out + var _arg1 *C.graphene_rect_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_rect_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Expand expands a #graphene_rect_t to contain the given #graphene_point_t. +// +// The function takes the following parameters: +// +// - p: #graphene_point_t. +// +// The function returns the following values: +// +// - res: return location for the expanded rectangle. +func (r *Rect) Expand(p *Point) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(p))) + + C.graphene_rect_expand(_arg0, _arg1, &_arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(p) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Area: compute the area of given normalized rectangle. +// +// The function returns the following values: +// +// - gfloat: area of the normalized rectangle. +func (r *Rect) Area() float32 { + var _arg0 *C.graphene_rect_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + _cret = C.graphene_rect_get_area(_arg0) + runtime.KeepAlive(r) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// BottomLeft retrieves the coordinates of the bottom-left corner of the given +// rectangle. +// +// The function returns the following values: +// +// - p: return location for a #graphene_point_t. +func (r *Rect) BottomLeft() *Point { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.graphene_point_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_rect_get_bottom_left(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _p *Point // out + + _p = (*Point)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _p +} + +// BottomRight retrieves the coordinates of the bottom-right corner of the given +// rectangle. +// +// The function returns the following values: +// +// - p: return location for a #graphene_point_t. +func (r *Rect) BottomRight() *Point { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.graphene_point_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_rect_get_bottom_right(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _p *Point // out + + _p = (*Point)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _p +} + +// Center retrieves the coordinates of the center of the given rectangle. +// +// The function returns the following values: +// +// - p: return location for a #graphene_point_t. +func (r *Rect) Center() *Point { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.graphene_point_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_rect_get_center(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _p *Point // out + + _p = (*Point)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _p +} + +// Height retrieves the normalized height of the given rectangle. +// +// The function returns the following values: +// +// - gfloat: normalized height of the rectangle. +func (r *Rect) Height() float32 { + var _arg0 *C.graphene_rect_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + _cret = C.graphene_rect_get_height(_arg0) + runtime.KeepAlive(r) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// TopLeft retrieves the coordinates of the top-left corner of the given +// rectangle. +// +// The function returns the following values: +// +// - p: return location for a #graphene_point_t. +func (r *Rect) TopLeft() *Point { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.graphene_point_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_rect_get_top_left(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _p *Point // out + + _p = (*Point)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _p +} + +// TopRight retrieves the coordinates of the top-right corner of the given +// rectangle. +// +// The function returns the following values: +// +// - p: return location for a #graphene_point_t. +func (r *Rect) TopRight() *Point { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.graphene_point_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_rect_get_top_right(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _p *Point // out + + _p = (*Point)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _p +} + +// Vertices computes the four vertices of a #graphene_rect_t. +// +// The function returns the following values: +// +// - vertices: return location for an array of 4 #graphene_vec2_t. +func (r *Rect) Vertices() [4]Vec2 { + var _arg0 *C.graphene_rect_t // out + var _arg1 [4]C.graphene_vec2_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_rect_get_vertices(_arg0, &_arg1[0]) + runtime.KeepAlive(r) + + var _vertices [4]Vec2 // out + + { + src := &_arg1 + for i := 0; i < 4; i++ { + _vertices[i] = *(*Vec2)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + + return _vertices +} + +// Width retrieves the normalized width of the given rectangle. +// +// The function returns the following values: +// +// - gfloat: normalized width of the rectangle. +func (r *Rect) Width() float32 { + var _arg0 *C.graphene_rect_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + _cret = C.graphene_rect_get_width(_arg0) + runtime.KeepAlive(r) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// X retrieves the normalized X coordinate of the origin of the given rectangle. +// +// The function returns the following values: +// +// - gfloat: normalized X coordinate of the rectangle. +func (r *Rect) X() float32 { + var _arg0 *C.graphene_rect_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + _cret = C.graphene_rect_get_x(_arg0) + runtime.KeepAlive(r) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Y retrieves the normalized Y coordinate of the origin of the given rectangle. +// +// The function returns the following values: +// +// - gfloat: normalized Y coordinate of the rectangle. +func (r *Rect) Y() float32 { + var _arg0 *C.graphene_rect_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + _cret = C.graphene_rect_get_y(_arg0) + runtime.KeepAlive(r) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Init initializes the given #graphene_rect_t with the given values. +// +// This function will implicitly normalize the #graphene_rect_t before +// returning. +// +// The function takes the following parameters: +// +// - x: x coordinate of the graphene_rect_t.origin. +// - y: y coordinate of the graphene_rect_t.origin. +// - width of the graphene_rect_t.size. +// - height of the graphene_rect_t.size. +// +// The function returns the following values: +// +// - rect: initialized rectangle. +func (r *Rect) Init(x float32, y float32, width float32, height float32) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _cret *C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = C.float(x) + _arg2 = C.float(y) + _arg3 = C.float(width) + _arg4 = C.float(height) + + _cret = C.graphene_rect_init(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(r) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + + var _rect *Rect // out + + _rect = (*Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rect +} + +// InitFromRect initializes r using the given src rectangle. +// +// This function will implicitly normalize the #graphene_rect_t before +// returning. +// +// The function takes the following parameters: +// +// - src: #graphene_rect_t. +// +// The function returns the following values: +// +// - rect: initialized rectangle. +func (r *Rect) InitFromRect(src *Rect) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 *C.graphene_rect_t // out + var _cret *C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_rect_init_from_rect(_arg0, _arg1) + runtime.KeepAlive(r) + runtime.KeepAlive(src) + + var _rect *Rect // out + + _rect = (*Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rect +} + +// Inset changes the given rectangle to be smaller, or larger depending on the +// given inset parameters. +// +// To create an inset rectangle, use positive d_x or d_y values; to create a +// larger, encompassing rectangle, use negative d_x or d_y values. +// +// The origin of the rectangle is offset by d_x and d_y, while the size +// is adjusted by (2 * d_x, 2 * d_y). If d_x and d_y are positive values, +// the size of the rectangle is decreased; if d_x and d_y are negative values, +// the size of the rectangle is increased. +// +// If the size of the resulting inset rectangle has a negative width or height +// then the size will be set to zero. +// +// The function takes the following parameters: +// +// - dX: horizontal inset. +// - dY: vertical inset. +// +// The function returns the following values: +// +// - rect: inset rectangle. +func (r *Rect) Inset(dX float32, dY float32) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _cret *C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = C.float(dX) + _arg2 = C.float(dY) + + _cret = C.graphene_rect_inset(_arg0, _arg1, _arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(dX) + runtime.KeepAlive(dY) + + var _rect *Rect // out + + _rect = (*Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rect +} + +// InsetR changes the given rectangle to be smaller, or larger depending on the +// given inset parameters. +// +// To create an inset rectangle, use positive d_x or d_y values; to create a +// larger, encompassing rectangle, use negative d_x or d_y values. +// +// The origin of the rectangle is offset by d_x and d_y, while the size +// is adjusted by (2 * d_x, 2 * d_y). If d_x and d_y are positive values, +// the size of the rectangle is decreased; if d_x and d_y are negative values, +// the size of the rectangle is increased. +// +// If the size of the resulting inset rectangle has a negative width or height +// then the size will be set to zero. +// +// The function takes the following parameters: +// +// - dX: horizontal inset. +// - dY: vertical inset. +// +// The function returns the following values: +// +// - res: return location for the inset rectangle. +func (r *Rect) InsetR(dX float32, dY float32) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = C.float(dX) + _arg2 = C.float(dY) + + C.graphene_rect_inset_r(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(r) + runtime.KeepAlive(dX) + runtime.KeepAlive(dY) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Interpolate: linearly interpolates the origin and size of the two given +// rectangles. +// +// The function takes the following parameters: +// +// - b: #graphene_rect_t. +// - factor: linear interpolation factor. +// +// The function returns the following values: +// +// - res: return location for the interpolated rectangle. +func (a *Rect) Interpolate(b *Rect, factor float64) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.double // out + var _arg3 C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg2 = C.double(factor) + + C.graphene_rect_interpolate(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(factor) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Intersection computes the intersection of the two given rectangles. +// +// ! (rectangle-intersection.png) +// +// The intersection in the image above is the blue outline. +// +// If the two rectangles do not intersect, res will contain a degenerate +// rectangle with origin in (0, 0) and a size of 0. +// +// The function takes the following parameters: +// +// - b: #graphene_rect_t. +// +// The function returns the following values: +// +// - res (optional): return location for a #graphene_rect_t. +// - ok: true if the two rectangles intersect. +func (a *Rect) Intersection(b *Rect) (*Rect, bool) { + var _arg0 *C.graphene_rect_t // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.graphene_rect_t // in + var _cret C._Bool // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_rect_intersection(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Rect // out + var _ok bool // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + if _cret { + _ok = true + } + + return _res, _ok +} + +// Normalize normalizes the passed rectangle. +// +// This function ensures that the size of the rectangle is made of positive +// values, and that the origin is the top-left corner of the rectangle. +// +// The function returns the following values: +// +// - rect: normalized rectangle. +func (r *Rect) Normalize() *Rect { + var _arg0 *C.graphene_rect_t // out + var _cret *C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + _cret = C.graphene_rect_normalize(_arg0) + runtime.KeepAlive(r) + + var _rect *Rect // out + + _rect = (*Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rect +} + +// NormalizeR normalizes the passed rectangle. +// +// This function ensures that the size of the rectangle is made of positive +// values, and that the origin is in the top-left corner of the rectangle. +// +// The function returns the following values: +// +// - res: return location for the normalized rectangle. +func (r *Rect) NormalizeR() *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_rect_normalize_r(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Offset offsets the origin by d_x and d_y. +// +// The size of the rectangle is unchanged. +// +// The function takes the following parameters: +// +// - dX: horizontal offset. +// - dY: vertical offset. +// +// The function returns the following values: +// +// - rect: offset rectangle. +func (r *Rect) Offset(dX float32, dY float32) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _cret *C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = C.float(dX) + _arg2 = C.float(dY) + + _cret = C.graphene_rect_offset(_arg0, _arg1, _arg2) + runtime.KeepAlive(r) + runtime.KeepAlive(dX) + runtime.KeepAlive(dY) + + var _rect *Rect // out + + _rect = (*Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rect +} + +// OffsetR offsets the origin of the given rectangle by d_x and d_y. +// +// The size of the rectangle is left unchanged. +// +// The function takes the following parameters: +// +// - dX: horizontal offset. +// - dY: vertical offset. +// +// The function returns the following values: +// +// - res: return location for the offset rectangle. +func (r *Rect) OffsetR(dX float32, dY float32) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = C.float(dX) + _arg2 = C.float(dY) + + C.graphene_rect_offset_r(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(r) + runtime.KeepAlive(dX) + runtime.KeepAlive(dY) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Round rounds the origin and size of the given rectangle to their nearest +// integer values; the rounding is guaranteed to be large enough to have an area +// bigger or equal to the original rectangle, but might not fully contain its +// extents. Use graphene_rect_round_extents() in case you need to round to a +// rectangle that covers fully the original one. +// +// This function is the equivalent of calling floor on the coordinates of the +// origin, and ceil on the size. +// +// Deprecated: Use graphene_rect_round_extents() instead. +// +// The function returns the following values: +// +// - res: return location for the rounded rectangle. +func (r *Rect) Round() *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_rect_round(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// RoundExtents rounds the origin of the given rectangle to its nearest integer +// value and and recompute the size so that the rectangle is large enough to +// contain all the conrners of the original rectangle. +// +// This function is the equivalent of calling floor on the coordinates of +// the origin, and recomputing the size calling ceil on the bottom-right +// coordinates. +// +// If you want to be sure that the rounded rectangle completely covers the +// area that was covered by the original rectangle — i.e. you want to cover +// the area including all its corners — this function will make sure that the +// size is recomputed taking into account the ceiling of the coordinates of +// the bottom-right corner. If the difference between the original coordinates +// and the coordinates of the rounded rectangle is greater than the difference +// between the original size and and the rounded size, then the move of the +// origin would not be compensated by a move in the anti-origin, leaving the +// corners of the original rectangle outside the rounded one. +// +// The function returns the following values: +// +// - res: return location for the rectangle with rounded extents. +func (r *Rect) RoundExtents() *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + C.graphene_rect_round_extents(_arg0, &_arg1) + runtime.KeepAlive(r) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// RoundToPixel rounds the origin and the size of the given rectangle to their +// nearest integer values; the rounding is guaranteed to be large enough to +// contain the original rectangle. +// +// Deprecated: Use graphene_rect_round() instead. +// +// The function returns the following values: +// +// - rect: pixel-aligned rectangle. +func (r *Rect) RoundToPixel() *Rect { + var _arg0 *C.graphene_rect_t // out + var _cret *C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + + _cret = C.graphene_rect_round_to_pixel(_arg0) + runtime.KeepAlive(r) + + var _rect *Rect // out + + _rect = (*Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rect +} + +// Scale scales the size and origin of a rectangle horizontaly by s_h, and +// vertically by s_v. The result res is normalized. +// +// The function takes the following parameters: +// +// - sH: horizontal scale factor. +// - sV: vertical scale factor. +// +// The function returns the following values: +// +// - res: return location for the scaled rectangle. +func (r *Rect) Scale(sH float32, sV float32) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(r))) + _arg1 = C.float(sH) + _arg2 = C.float(sV) + + C.graphene_rect_scale(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(r) + runtime.KeepAlive(sH) + runtime.KeepAlive(sV) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Union computes the union of the two given rectangles. +// +// ! (rectangle-union.png) +// +// The union in the image above is the blue outline. +// +// The function takes the following parameters: +// +// - b: #graphene_rect_t. +// +// The function returns the following values: +// +// - res: return location for a #graphene_rect_t. +func (a *Rect) Union(b *Rect) *Rect { + var _arg0 *C.graphene_rect_t // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.graphene_rect_t // in + + _arg0 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_rect_union(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Rect // out + + _res = (*Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// RectAlloc allocates a new #graphene_rect_t. +// +// The contents of the returned rectangle are undefined. +// +// The function returns the following values: +// +// - rect: newly allocated rectangle. +func RectAlloc() *Rect { + var _cret *C.graphene_rect_t // in + + _cret = C.graphene_rect_alloc() + + var _rect *Rect // out + + _rect = (*Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_rect)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_rect_free((*C.graphene_rect_t)(intern.C)) + }, + ) + + return _rect +} + +// RectZero returns a degenerate rectangle with origin fixed at (0, 0) and a +// size of 0, 0. +// +// The function returns the following values: +// +// - rect: fixed rectangle. +func RectZero() *Rect { + var _cret *C.graphene_rect_t // in + + _cret = C.graphene_rect_zero() + + var _rect *Rect // out + + _rect = (*Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rect +} + +// SIMD4F: instance of this type is always passed by reference. +type SIMD4F struct { + *simD4F +} + +// simD4F is the struct that's finalized. +type simD4F struct { + native *C.graphene_simd4f_t +} + +// SIMD4X4F: instance of this type is always passed by reference. +type SIMD4X4F struct { + *simD4X4F +} + +// simD4X4F is the struct that's finalized. +type simD4X4F struct { + native *C.graphene_simd4x4f_t +} + +// Size: size. +// +// An instance of this type is always passed by reference. +type Size struct { + *size +} + +// size is the struct that's finalized. +type size struct { + native *C.graphene_size_t +} + +func marshalSize(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Size{&size{(*C.graphene_size_t)(b)}}, nil +} + +// NewSizeAlloc constructs a struct Size. +func NewSizeAlloc() *Size { + var _cret *C.graphene_size_t // in + + _cret = C.graphene_size_alloc() + + var _size *Size // out + + _size = (*Size)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_size)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_size_free((*C.graphene_size_t)(intern.C)) + }, + ) + + return _size +} + +// Width: width. +func (s *Size) Width() float32 { + valptr := &s.native.width + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Height: height. +func (s *Size) Height() float32 { + valptr := &s.native.height + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Width: width. +func (s *Size) SetWidth(width float32) { + valptr := &s.native.width + *valptr = C.float(width) +} + +// Height: height. +func (s *Size) SetHeight(height float32) { + valptr := &s.native.height + *valptr = C.float(height) +} + +// Equal checks whether the two give #graphene_size_t are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_size_t. +// +// The function returns the following values: +// +// - ok: true if the sizes are equal. +func (a *Size) Equal(b *Size) bool { + var _arg0 *C.graphene_size_t // out + var _arg1 *C.graphene_size_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_size_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Init initializes a #graphene_size_t using the given width and height. +// +// The function takes the following parameters: +// +// - width: width. +// - height: height. +// +// The function returns the following values: +// +// - size: initialized #graphene_size_t. +func (s *Size) Init(width float32, height float32) *Size { + var _arg0 *C.graphene_size_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _cret *C.graphene_size_t // in + + _arg0 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(s))) + _arg1 = C.float(width) + _arg2 = C.float(height) + + _cret = C.graphene_size_init(_arg0, _arg1, _arg2) + runtime.KeepAlive(s) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + + var _size *Size // out + + _size = (*Size)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _size +} + +// InitFromSize initializes a #graphene_size_t using the width and height of the +// given src. +// +// The function takes the following parameters: +// +// - src: #graphene_size_t. +// +// The function returns the following values: +// +// - size: initialized #graphene_size_t. +func (s *Size) InitFromSize(src *Size) *Size { + var _arg0 *C.graphene_size_t // out + var _arg1 *C.graphene_size_t // out + var _cret *C.graphene_size_t // in + + _arg0 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(s))) + _arg1 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_size_init_from_size(_arg0, _arg1) + runtime.KeepAlive(s) + runtime.KeepAlive(src) + + var _size *Size // out + + _size = (*Size)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _size +} + +// Interpolate: linearly interpolates the two given #graphene_size_t using the +// given interpolation factor. +// +// The function takes the following parameters: +// +// - b: #graphene_size_t. +// - factor: linear interpolation factor. +// +// The function returns the following values: +// +// - res: return location for the interpolated size. +func (a *Size) Interpolate(b *Size, factor float64) *Size { + var _arg0 *C.graphene_size_t // out + var _arg1 *C.graphene_size_t // out + var _arg2 C.double // out + var _arg3 C.graphene_size_t // in + + _arg0 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(b))) + _arg2 = C.double(factor) + + C.graphene_size_interpolate(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(factor) + + var _res *Size // out + + _res = (*Size)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Scale scales the components of a #graphene_size_t using the given factor. +// +// The function takes the following parameters: +// +// - factor: scaling factor. +// +// The function returns the following values: +// +// - res: return location for the scaled size. +func (s *Size) Scale(factor float32) *Size { + var _arg0 *C.graphene_size_t // out + var _arg1 C.float // out + var _arg2 C.graphene_size_t // in + + _arg0 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(s))) + _arg1 = C.float(factor) + + C.graphene_size_scale(_arg0, _arg1, &_arg2) + runtime.KeepAlive(s) + runtime.KeepAlive(factor) + + var _res *Size // out + + _res = (*Size)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// SizeZero: constant pointer to a zero #graphene_size_t, useful for equality +// checks and interpolations. +// +// The function returns the following values: +// +// - size: constant size. +func SizeZero() *Size { + var _cret *C.graphene_size_t // in + + _cret = C.graphene_size_zero() + + var _size *Size // out + + _size = (*Size)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _size +} + +// Sphere: sphere, represented by its center and radius. +// +// An instance of this type is always passed by reference. +type Sphere struct { + *sphere +} + +// sphere is the struct that's finalized. +type sphere struct { + native *C.graphene_sphere_t +} + +func marshalSphere(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Sphere{&sphere{(*C.graphene_sphere_t)(b)}}, nil +} + +// NewSphereAlloc constructs a struct Sphere. +func NewSphereAlloc() *Sphere { + var _cret *C.graphene_sphere_t // in + + _cret = C.graphene_sphere_alloc() + + var _sphere *Sphere // out + + _sphere = (*Sphere)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_sphere)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_sphere_free((*C.graphene_sphere_t)(intern.C)) + }, + ) + + return _sphere +} + +// ContainsPoint checks whether the given point is contained in the volume of a +// #graphene_sphere_t. +// +// The function takes the following parameters: +// +// - point: #graphene_point3d_t. +// +// The function returns the following values: +// +// - ok: true if the sphere contains the point. +func (s *Sphere) ContainsPoint(point *Point3D) bool { + var _arg0 *C.graphene_sphere_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.graphene_sphere_contains_point(_arg0, _arg1) + runtime.KeepAlive(s) + runtime.KeepAlive(point) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Distance computes the distance of the given point from the surface of a +// #graphene_sphere_t. +// +// The function takes the following parameters: +// +// - point: #graphene_point3d_t. +// +// The function returns the following values: +// +// - gfloat: distance of the point. +func (s *Sphere) Distance(point *Point3D) float32 { + var _arg0 *C.graphene_sphere_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.graphene_sphere_distance(_arg0, _arg1) + runtime.KeepAlive(s) + runtime.KeepAlive(point) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Equal checks whether two #graphene_sphere_t are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_sphere_t. +// +// The function returns the following values: +// +// - ok: true if the spheres are equal. +func (a *Sphere) Equal(b *Sphere) bool { + var _arg0 *C.graphene_sphere_t // out + var _arg1 *C.graphene_sphere_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_sphere_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// BoundingBox computes the bounding box capable of containing the given +// #graphene_sphere_t. +// +// The function returns the following values: +// +// - box: return location for the bounding box. +func (s *Sphere) BoundingBox() *Box { + var _arg0 *C.graphene_sphere_t // out + var _arg1 C.graphene_box_t // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + + C.graphene_sphere_get_bounding_box(_arg0, &_arg1) + runtime.KeepAlive(s) + + var _box *Box // out + + _box = (*Box)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _box +} + +// Center retrieves the coordinates of the center of a #graphene_sphere_t. +// +// The function returns the following values: +// +// - center: return location for the coordinates of the center. +func (s *Sphere) Center() *Point3D { + var _arg0 *C.graphene_sphere_t // out + var _arg1 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + + C.graphene_sphere_get_center(_arg0, &_arg1) + runtime.KeepAlive(s) + + var _center *Point3D // out + + _center = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _center +} + +// Radius retrieves the radius of a #graphene_sphere_t. +func (s *Sphere) Radius() float32 { + var _arg0 *C.graphene_sphere_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + + _cret = C.graphene_sphere_get_radius(_arg0) + runtime.KeepAlive(s) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Init initializes the given #graphene_sphere_t with the given center and +// radius. +// +// The function takes the following parameters: +// +// - center (optional) coordinates of the center of the sphere, or NULL for a +// center in (0, 0, 0). +// - radius of the sphere. +// +// The function returns the following values: +// +// - sphere: initialized #graphene_sphere_t. +func (s *Sphere) Init(center *Point3D, radius float32) *Sphere { + var _arg0 *C.graphene_sphere_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.float // out + var _cret *C.graphene_sphere_t // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + if center != nil { + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(center))) + } + _arg2 = C.float(radius) + + _cret = C.graphene_sphere_init(_arg0, _arg1, _arg2) + runtime.KeepAlive(s) + runtime.KeepAlive(center) + runtime.KeepAlive(radius) + + var _sphere *Sphere // out + + _sphere = (*Sphere)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _sphere +} + +// InitFromPoints initializes the given #graphene_sphere_t using the given array +// of 3D coordinates so that the sphere includes them. +// +// The center of the sphere can either be specified, or will be center of the 3D +// volume that encompasses all points. +// +// The function takes the following parameters: +// +// - points: array of #graphene_point3d_t. +// - center (optional) of the sphere. +// +// The function returns the following values: +// +// - sphere: initialized #graphene_sphere_t. +func (s *Sphere) InitFromPoints(points []Point3D, center *Point3D) *Sphere { + var _arg0 *C.graphene_sphere_t // out + var _arg2 *C.graphene_point3d_t // out + var _arg1 C.uint + var _arg3 *C.graphene_point3d_t // out + var _cret *C.graphene_sphere_t // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + _arg1 = (C.uint)(len(points)) + _arg2 = (*C.graphene_point3d_t)(C.calloc(C.size_t(len(points)), C.size_t(C.sizeof_graphene_point3d_t))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.graphene_point3d_t)(_arg2), len(points)) + for i := range points { + out[i] = *(*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer((&points[i])))) + } + } + if center != nil { + _arg3 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(center))) + } + + _cret = C.graphene_sphere_init_from_points(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(s) + runtime.KeepAlive(points) + runtime.KeepAlive(center) + + var _sphere *Sphere // out + + _sphere = (*Sphere)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _sphere +} + +// InitFromVectors initializes the given #graphene_sphere_t using the given +// array of 3D coordinates so that the sphere includes them. +// +// The center of the sphere can either be specified, or will be center of the 3D +// volume that encompasses all vectors. +// +// The function takes the following parameters: +// +// - vectors: array of #graphene_vec3_t. +// - center (optional) of the sphere. +// +// The function returns the following values: +// +// - sphere: initialized #graphene_sphere_t. +func (s *Sphere) InitFromVectors(vectors []Vec3, center *Point3D) *Sphere { + var _arg0 *C.graphene_sphere_t // out + var _arg2 *C.graphene_vec3_t // out + var _arg1 C.uint + var _arg3 *C.graphene_point3d_t // out + var _cret *C.graphene_sphere_t // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + _arg1 = (C.uint)(len(vectors)) + _arg2 = (*C.graphene_vec3_t)(C.calloc(C.size_t(len(vectors)), C.size_t(C.sizeof_graphene_vec3_t))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.graphene_vec3_t)(_arg2), len(vectors)) + for i := range vectors { + out[i] = *(*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer((&vectors[i])))) + } + } + if center != nil { + _arg3 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(center))) + } + + _cret = C.graphene_sphere_init_from_vectors(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(s) + runtime.KeepAlive(vectors) + runtime.KeepAlive(center) + + var _sphere *Sphere // out + + _sphere = (*Sphere)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _sphere +} + +// IsEmpty checks whether the sphere has a zero radius. +// +// The function returns the following values: +// +// - ok: true if the sphere is empty. +func (s *Sphere) IsEmpty() bool { + var _arg0 *C.graphene_sphere_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + + _cret = C.graphene_sphere_is_empty(_arg0) + runtime.KeepAlive(s) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Translate translates the center of the given #graphene_sphere_t using the +// point coordinates as the delta of the translation. +// +// The function takes the following parameters: +// +// - point coordinates of the translation. +// +// The function returns the following values: +// +// - res: return location for the translated sphere. +func (s *Sphere) Translate(point *Point3D) *Sphere { + var _arg0 *C.graphene_sphere_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.graphene_sphere_t // in + + _arg0 = (*C.graphene_sphere_t)(gextras.StructNative(unsafe.Pointer(s))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + C.graphene_sphere_translate(_arg0, _arg1, &_arg2) + runtime.KeepAlive(s) + runtime.KeepAlive(point) + + var _res *Sphere // out + + _res = (*Sphere)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Triangle: triangle. +// +// An instance of this type is always passed by reference. +type Triangle struct { + *triangle +} + +// triangle is the struct that's finalized. +type triangle struct { + native *C.graphene_triangle_t +} + +func marshalTriangle(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Triangle{&triangle{(*C.graphene_triangle_t)(b)}}, nil +} + +// NewTriangleAlloc constructs a struct Triangle. +func NewTriangleAlloc() *Triangle { + var _cret *C.graphene_triangle_t // in + + _cret = C.graphene_triangle_alloc() + + var _triangle *Triangle // out + + _triangle = (*Triangle)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_triangle)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_triangle_free((*C.graphene_triangle_t)(intern.C)) + }, + ) + + return _triangle +} + +// ContainsPoint checks whether the given triangle t contains the point p. +// +// The function takes the following parameters: +// +// - p: #graphene_point3d_t. +// +// The function returns the following values: +// +// - ok: true if the point is inside the triangle. +func (t *Triangle) ContainsPoint(p *Point3D) bool { + var _arg0 *C.graphene_triangle_t // out + var _arg1 *C.graphene_point3d_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + + _cret = C.graphene_triangle_contains_point(_arg0, _arg1) + runtime.KeepAlive(t) + runtime.KeepAlive(p) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Equal checks whether the two given #graphene_triangle_t are equal. +// +// The function takes the following parameters: +// +// - b: #graphene_triangle_t. +// +// The function returns the following values: +// +// - ok: true if the triangles are equal. +func (a *Triangle) Equal(b *Triangle) bool { + var _arg0 *C.graphene_triangle_t // out + var _arg1 *C.graphene_triangle_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_triangle_equal(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Area computes the area of the given #graphene_triangle_t. +// +// The function returns the following values: +// +// - gfloat: area of the triangle. +func (t *Triangle) Area() float32 { + var _arg0 *C.graphene_triangle_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + + _cret = C.graphene_triangle_get_area(_arg0) + runtime.KeepAlive(t) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Barycoords computes the barycentric coordinates +// (http://en.wikipedia.org/wiki/Barycentric_coordinate_system) of the given +// point p. +// +// The point p must lie on the same plane as the triangle t; if the point is not +// coplanar, the result of this function is undefined. +// +// If we place the origin in the coordinates of the triangle's A point, +// the barycentric coordinates are u, which is on the AC vector; and v which is +// on the AB vector: +// +// ! (triangle-barycentric.png) +// +// The returned #graphene_vec2_t contains the following values, in order: +// +// - res.x = u +// - res.y = v. +// +// The function takes the following parameters: +// +// - p (optional): #graphene_point3d_t. +// +// The function returns the following values: +// +// - res: return location for the vector with the barycentric coordinates. +// - ok: true if the barycentric coordinates are valid. +func (t *Triangle) Barycoords(p *Point3D) (*Vec2, bool) { + var _arg0 *C.graphene_triangle_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 C.graphene_vec2_t // in + var _cret C._Bool // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + if p != nil { + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + } + + _cret = C.graphene_triangle_get_barycoords(_arg0, _arg1, &_arg2) + runtime.KeepAlive(t) + runtime.KeepAlive(p) + + var _res *Vec2 // out + var _ok bool // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + if _cret { + _ok = true + } + + return _res, _ok +} + +// BoundingBox computes the bounding box of the given #graphene_triangle_t. +// +// The function returns the following values: +// +// - res: return location for the box. +func (t *Triangle) BoundingBox() *Box { + var _arg0 *C.graphene_triangle_t // out + var _arg1 C.graphene_box_t // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + + C.graphene_triangle_get_bounding_box(_arg0, &_arg1) + runtime.KeepAlive(t) + + var _res *Box // out + + _res = (*Box)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Midpoint computes the coordinates of the midpoint of the given +// #graphene_triangle_t. +// +// The midpoint G is the centroid +// (https://en.wikipedia.org/wiki/Centroid#Triangle_centroid) of the triangle, +// i.e. the intersection of its medians. +// +// The function returns the following values: +// +// - res: return location for the coordinates of the midpoint. +func (t *Triangle) Midpoint() *Point3D { + var _arg0 *C.graphene_triangle_t // out + var _arg1 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + + C.graphene_triangle_get_midpoint(_arg0, &_arg1) + runtime.KeepAlive(t) + + var _res *Point3D // out + + _res = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Normal computes the normal vector of the given #graphene_triangle_t. +// +// The function returns the following values: +// +// - res: return location for the normal vector. +func (t *Triangle) Normal() *Vec3 { + var _arg0 *C.graphene_triangle_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + + C.graphene_triangle_get_normal(_arg0, &_arg1) + runtime.KeepAlive(t) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Plane computes the plane based on the vertices of the given +// #graphene_triangle_t. +// +// The function returns the following values: +// +// - res: return location for the plane. +func (t *Triangle) Plane() *Plane { + var _arg0 *C.graphene_triangle_t // out + var _arg1 C.graphene_plane_t // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + + C.graphene_triangle_get_plane(_arg0, &_arg1) + runtime.KeepAlive(t) + + var _res *Plane // out + + _res = (*Plane)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Points retrieves the three vertices of the given #graphene_triangle_t and +// returns their coordinates as #graphene_point3d_t. +// +// The function returns the following values: +// +// - a (optional): return location for the coordinates of the first vertex. +// - b (optional): return location for the coordinates of the second vertex. +// - c (optional): return location for the coordinates of the third vertex. +func (t *Triangle) Points() (a *Point3D, b *Point3D, c *Point3D) { + var _arg0 *C.graphene_triangle_t // out + var _arg1 C.graphene_point3d_t // in + var _arg2 C.graphene_point3d_t // in + var _arg3 C.graphene_point3d_t // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + + C.graphene_triangle_get_points(_arg0, &_arg1, &_arg2, &_arg3) + runtime.KeepAlive(t) + + var _a *Point3D // out + var _b *Point3D // out + var _c *Point3D // out + + _a = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + _b = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + _c = (*Point3D)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _a, _b, _c +} + +// Uv computes the UV coordinates of the given point p. +// +// The point p must lie on the same plane as the triangle t; if the point is not +// coplanar, the result of this function is undefined. If p is NULL, the point +// will be set in (0, 0, 0). +// +// The UV coordinates will be placed in the res vector: +// +// - res.x = u +// - res.y = v +// +// See also: graphene_triangle_get_barycoords(). +// +// The function takes the following parameters: +// +// - p (optional): #graphene_point3d_t. +// - uvA: UV coordinates of the first point. +// - uvB: UV coordinates of the second point. +// - uvC: UV coordinates of the third point. +// +// The function returns the following values: +// +// - res: vector containing the UV coordinates of the given point p. +// - ok: true if the coordinates are valid. +func (t *Triangle) Uv(p *Point3D, uvA *Vec2, uvB *Vec2, uvC *Vec2) (*Vec2, bool) { + var _arg0 *C.graphene_triangle_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 *C.graphene_vec2_t // out + var _arg3 *C.graphene_vec2_t // out + var _arg4 *C.graphene_vec2_t // out + var _arg5 C.graphene_vec2_t // in + var _cret C._Bool // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + if p != nil { + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(p))) + } + _arg2 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(uvA))) + _arg3 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(uvB))) + _arg4 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(uvC))) + + _cret = C.graphene_triangle_get_uv(_arg0, _arg1, _arg2, _arg3, _arg4, &_arg5) + runtime.KeepAlive(t) + runtime.KeepAlive(p) + runtime.KeepAlive(uvA) + runtime.KeepAlive(uvB) + runtime.KeepAlive(uvC) + + var _res *Vec2 // out + var _ok bool // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg5)))) + if _cret { + _ok = true + } + + return _res, _ok +} + +// Vertices retrieves the three vertices of the given #graphene_triangle_t. +// +// The function returns the following values: +// +// - a (optional): return location for the first vertex. +// - b (optional): return location for the second vertex. +// - c (optional): return location for the third vertex. +func (t *Triangle) Vertices() (a *Vec3, b *Vec3, c *Vec3) { + var _arg0 *C.graphene_triangle_t // out + var _arg1 C.graphene_vec3_t // in + var _arg2 C.graphene_vec3_t // in + var _arg3 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + + C.graphene_triangle_get_vertices(_arg0, &_arg1, &_arg2, &_arg3) + runtime.KeepAlive(t) + + var _a *Vec3 // out + var _b *Vec3 // out + var _c *Vec3 // out + + _a = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + _b = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + _c = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _a, _b, _c +} + +// InitFromFloat initializes a #graphene_triangle_t using the three given arrays +// of floating point values, each representing the coordinates of a point in 3D +// space. +// +// The function takes the following parameters: +// +// - a: array of 3 floating point values. +// - b: array of 3 floating point values. +// - c: array of 3 floating point values. +// +// The function returns the following values: +// +// - triangle: initialized #graphene_triangle_t. +func (t *Triangle) InitFromFloat(a [3]float32, b [3]float32, c [3]float32) *Triangle { + var _arg0 *C.graphene_triangle_t // out + var _arg1 *C.float // out + var _arg2 *C.float // out + var _arg3 *C.float // out + var _cret *C.graphene_triangle_t // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + _arg1 = (*C.float)(unsafe.Pointer(&a)) + _arg2 = (*C.float)(unsafe.Pointer(&b)) + _arg3 = (*C.float)(unsafe.Pointer(&c)) + + _cret = C.graphene_triangle_init_from_float(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(t) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(c) + + var _triangle *Triangle // out + + _triangle = (*Triangle)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _triangle +} + +// InitFromPoint3D initializes a #graphene_triangle_t using the three given 3D +// points. +// +// The function takes the following parameters: +// +// - a (optional): #graphene_point3d_t. +// - b (optional): #graphene_point3d_t. +// - c (optional): #graphene_point3d_t. +// +// The function returns the following values: +// +// - triangle: initialized #graphene_triangle_t. +func (t *Triangle) InitFromPoint3D(a *Point3D, b *Point3D, c *Point3D) *Triangle { + var _arg0 *C.graphene_triangle_t // out + var _arg1 *C.graphene_point3d_t // out + var _arg2 *C.graphene_point3d_t // out + var _arg3 *C.graphene_point3d_t // out + var _cret *C.graphene_triangle_t // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + if a != nil { + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(a))) + } + if b != nil { + _arg2 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(b))) + } + if c != nil { + _arg3 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(c))) + } + + _cret = C.graphene_triangle_init_from_point3d(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(t) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(c) + + var _triangle *Triangle // out + + _triangle = (*Triangle)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _triangle +} + +// InitFromVec3 initializes a #graphene_triangle_t using the three given +// vectors. +// +// The function takes the following parameters: +// +// - a (optional): #graphene_vec3_t. +// - b (optional): #graphene_vec3_t. +// - c (optional): #graphene_vec3_t. +// +// The function returns the following values: +// +// - triangle: initialized #graphene_triangle_t. +func (t *Triangle) InitFromVec3(a *Vec3, b *Vec3, c *Vec3) *Triangle { + var _arg0 *C.graphene_triangle_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 *C.graphene_vec3_t // out + var _arg3 *C.graphene_vec3_t // out + var _cret *C.graphene_triangle_t // in + + _arg0 = (*C.graphene_triangle_t)(gextras.StructNative(unsafe.Pointer(t))) + if a != nil { + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(a))) + } + if b != nil { + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(b))) + } + if c != nil { + _arg3 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(c))) + } + + _cret = C.graphene_triangle_init_from_vec3(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(t) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + runtime.KeepAlive(c) + + var _triangle *Triangle // out + + _triangle = (*Triangle)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _triangle +} + +// Vec2: structure capable of holding a vector with two dimensions, x and y. +// +// The contents of the #graphene_vec2_t structure are private and should never +// be accessed directly. +// +// An instance of this type is always passed by reference. +type Vec2 struct { + *vec2 +} + +// vec2 is the struct that's finalized. +type vec2 struct { + native *C.graphene_vec2_t +} + +func marshalVec2(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Vec2{&vec2{(*C.graphene_vec2_t)(b)}}, nil +} + +// NewVec2Alloc constructs a struct Vec2. +func NewVec2Alloc() *Vec2 { + var _cret *C.graphene_vec2_t // in + + _cret = C.graphene_vec2_alloc() + + var _vec2 *Vec2 // out + + _vec2 = (*Vec2)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_vec2)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_vec2_free((*C.graphene_vec2_t)(intern.C)) + }, + ) + + return _vec2 +} + +// Add adds each component of the two passed vectors and places each result into +// the components of res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec2_t. +// +// The function returns the following values: +// +// - res: return location for the result. +func (a *Vec2) Add(b *Vec2) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _arg2 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec2_add(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Divide divides each component of the first operand a by the corresponding +// component of the second operand b, and places the results into the vector +// res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec2_t. +// +// The function returns the following values: +// +// - res: return location for the result. +func (a *Vec2) Divide(b *Vec2) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _arg2 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec2_divide(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Dot computes the dot product of the two given vectors. +// +// The function takes the following parameters: +// +// - b: #graphene_vec2_t. +// +// The function returns the following values: +// +// - gfloat: dot product of the vectors. +func (a *Vec2) Dot(b *Vec2) float32 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_vec2_dot(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Equal checks whether the two given #graphene_vec2_t are equal. +// +// The function takes the following parameters: +// +// - v2: #graphene_vec2_t. +// +// The function returns the following values: +// +// - ok: true if the two vectors are equal, and false otherwise. +func (v1 *Vec2) Equal(v2 *Vec2) bool { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v2))) + + _cret = C.graphene_vec2_equal(_arg0, _arg1) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// X retrieves the X component of the #graphene_vec2_t. +// +// The function returns the following values: +// +// - gfloat: value of the X component. +func (v *Vec2) X() float32 { + var _arg0 *C.graphene_vec2_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec2_get_x(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Y retrieves the Y component of the #graphene_vec2_t. +// +// The function returns the following values: +// +// - gfloat: value of the Y component. +func (v *Vec2) Y() float32 { + var _arg0 *C.graphene_vec2_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec2_get_y(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Init initializes a #graphene_vec2_t using the given values. +// +// This function can be called multiple times. +// +// The function takes the following parameters: +// +// - x: x field of the vector. +// - y: y field of the vector. +// +// The function returns the following values: +// +// - vec2: initialized vector. +func (v *Vec2) Init(x float32, y float32) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _cret *C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = C.float(x) + _arg2 = C.float(y) + + _cret = C.graphene_vec2_init(_arg0, _arg1, _arg2) + runtime.KeepAlive(v) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + + var _vec2 *Vec2 // out + + _vec2 = (*Vec2)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec2 +} + +// InitFromFloat initializes v with the contents of the given array. +// +// The function takes the following parameters: +// +// - src: array of floating point values with at least two elements. +// +// The function returns the following values: +// +// - vec2: initialized vector. +func (v *Vec2) InitFromFloat(src [2]float32) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.float // out + var _cret *C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = (*C.float)(unsafe.Pointer(&src)) + + _cret = C.graphene_vec2_init_from_float(_arg0, _arg1) + runtime.KeepAlive(v) + runtime.KeepAlive(src) + + var _vec2 *Vec2 // out + + _vec2 = (*Vec2)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec2 +} + +// InitFromVec2 copies the contents of src into v. +// +// The function takes the following parameters: +// +// - src: #graphene_vec2_t. +// +// The function returns the following values: +// +// - vec2: initialized vector. +func (v *Vec2) InitFromVec2(src *Vec2) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _cret *C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_vec2_init_from_vec2(_arg0, _arg1) + runtime.KeepAlive(v) + runtime.KeepAlive(src) + + var _vec2 *Vec2 // out + + _vec2 = (*Vec2)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec2 +} + +// Interpolate: linearly interpolates v1 and v2 using the given factor. +// +// The function takes the following parameters: +// +// - v2: #graphene_vec2_t. +// - factor: interpolation factor. +// +// The function returns the following values: +// +// - res: interpolated vector. +func (v1 *Vec2) Interpolate(v2 *Vec2, factor float64) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _arg2 C.double // out + var _arg3 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v2))) + _arg2 = C.double(factor) + + C.graphene_vec2_interpolate(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + runtime.KeepAlive(factor) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Length computes the length of the given vector. +// +// The function returns the following values: +// +// - gfloat: length of the vector. +func (v *Vec2) Length() float32 { + var _arg0 *C.graphene_vec2_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec2_length(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Max compares the two given vectors and places the maximum values of each +// component into res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec2_t. +// +// The function returns the following values: +// +// - res: resulting vector. +func (a *Vec2) Max(b *Vec2) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _arg2 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec2_max(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Min compares the two given vectors and places the minimum values of each +// component into res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec2_t. +// +// The function returns the following values: +// +// - res: resulting vector. +func (a *Vec2) Min(b *Vec2) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _arg2 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec2_min(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Multiply multiplies each component of the two passed vectors and places each +// result into the components of res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec2_t. +// +// The function returns the following values: +// +// - res: return location for the result. +func (a *Vec2) Multiply(b *Vec2) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _arg2 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec2_multiply(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Near compares the two given #graphene_vec2_t vectors and checks whether their +// values are within the given epsilon. +// +// The function takes the following parameters: +// +// - v2: #graphene_vec2_t. +// - epsilon: threshold between the two vectors. +// +// The function returns the following values: +// +// - ok: true if the two vectors are near each other. +func (v1 *Vec2) Near(v2 *Vec2, epsilon float32) bool { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _arg2 C.float // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v2))) + _arg2 = C.float(epsilon) + + _cret = C.graphene_vec2_near(_arg0, _arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + runtime.KeepAlive(epsilon) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Negate negates the given #graphene_vec2_t. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (v *Vec2) Negate() *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec2_negate(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Normalize computes the normalized vector for the given vector v. +// +// The function returns the following values: +// +// - res: return location for the normalized vector. +func (v *Vec2) Normalize() *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec2_normalize(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Scale multiplies all components of the given vector with the given scalar +// factor. +// +// The function takes the following parameters: +// +// - factor: scalar factor. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (v *Vec2) Scale(factor float32) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 C.float // out + var _arg2 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = C.float(factor) + + C.graphene_vec2_scale(_arg0, _arg1, &_arg2) + runtime.KeepAlive(v) + runtime.KeepAlive(factor) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Subtract subtracts from each component of the first operand a the +// corresponding component of the second operand b and places each result into +// the components of res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec2_t. +// +// The function returns the following values: +// +// - res: return location for the result. +func (a *Vec2) Subtract(b *Vec2) *Vec2 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 *C.graphene_vec2_t // out + var _arg2 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec2_subtract(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// ToFloat stores the components of v into an array. +// +// The function returns the following values: +// +// - dest: return location for an array of floating point values with at least +// 2 elements. +func (v *Vec2) ToFloat() [2]float32 { + var _arg0 *C.graphene_vec2_t // out + var _arg1 [2]C.float // in + + _arg0 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec2_to_float(_arg0, &_arg1[0]) + runtime.KeepAlive(v) + + var _dest [2]float32 // out + + _dest = *(*[2]float32)(unsafe.Pointer(&_arg1)) + + return _dest +} + +// Vec2One retrieves a constant vector with (1, 1) components. +// +// The function returns the following values: +// +// - vec2: one vector. +func Vec2One() *Vec2 { + var _cret *C.graphene_vec2_t // in + + _cret = C.graphene_vec2_one() + + var _vec2 *Vec2 // out + + _vec2 = (*Vec2)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec2 +} + +// Vec2XAxis retrieves a constant vector with (1, 0) components. +// +// The function returns the following values: +// +// - vec2: x axis vector. +func Vec2XAxis() *Vec2 { + var _cret *C.graphene_vec2_t // in + + _cret = C.graphene_vec2_x_axis() + + var _vec2 *Vec2 // out + + _vec2 = (*Vec2)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec2 +} + +// Vec2YAxis retrieves a constant vector with (0, 1) components. +// +// The function returns the following values: +// +// - vec2: y axis vector. +func Vec2YAxis() *Vec2 { + var _cret *C.graphene_vec2_t // in + + _cret = C.graphene_vec2_y_axis() + + var _vec2 *Vec2 // out + + _vec2 = (*Vec2)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec2 +} + +// Vec2Zero retrieves a constant vector with (0, 0) components. +// +// The function returns the following values: +// +// - vec2: zero vector. +func Vec2Zero() *Vec2 { + var _cret *C.graphene_vec2_t // in + + _cret = C.graphene_vec2_zero() + + var _vec2 *Vec2 // out + + _vec2 = (*Vec2)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec2 +} + +// Vec3: structure capable of holding a vector with three dimensions: x, y, +// and z. +// +// The contents of the #graphene_vec3_t structure are private and should never +// be accessed directly. +// +// An instance of this type is always passed by reference. +type Vec3 struct { + *vec3 +} + +// vec3 is the struct that's finalized. +type vec3 struct { + native *C.graphene_vec3_t +} + +func marshalVec3(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Vec3{&vec3{(*C.graphene_vec3_t)(b)}}, nil +} + +// NewVec3Alloc constructs a struct Vec3. +func NewVec3Alloc() *Vec3 { + var _cret *C.graphene_vec3_t // in + + _cret = C.graphene_vec3_alloc() + + var _vec3 *Vec3 // out + + _vec3 = (*Vec3)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_vec3)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_vec3_free((*C.graphene_vec3_t)(intern.C)) + }, + ) + + return _vec3 +} + +// Add adds each component of the two given vectors. +// +// The function takes the following parameters: +// +// - b: #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the resulting vector. +func (a *Vec3) Add(b *Vec3) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec3_add(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Cross computes the cross product of the two given vectors. +// +// The function takes the following parameters: +// +// - b: #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the resulting vector. +func (a *Vec3) Cross(b *Vec3) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec3_cross(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Divide divides each component of the first operand a by the corresponding +// component of the second operand b, and places the results into the vector +// res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the resulting vector. +func (a *Vec3) Divide(b *Vec3) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec3_divide(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Dot computes the dot product of the two given vectors. +// +// The function takes the following parameters: +// +// - b: #graphene_vec3_t. +// +// The function returns the following values: +// +// - gfloat: value of the dot product. +func (a *Vec3) Dot(b *Vec3) float32 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_vec3_dot(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Equal checks whether the two given #graphene_vec3_t are equal. +// +// The function takes the following parameters: +// +// - v2: #graphene_vec3_t. +// +// The function returns the following values: +// +// - ok: true if the two vectors are equal, and false otherwise. +func (v1 *Vec3) Equal(v2 *Vec3) bool { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v2))) + + _cret = C.graphene_vec3_equal(_arg0, _arg1) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// X retrieves the first component of the given vector v. +// +// The function returns the following values: +// +// - gfloat: value of the first component of the vector. +func (v *Vec3) X() float32 { + var _arg0 *C.graphene_vec3_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec3_get_x(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// XY creates a #graphene_vec2_t that contains the first and second components +// of the given #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for a #graphene_vec2_t. +func (v *Vec3) XY() *Vec2 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec3_get_xy(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// XY0 creates a #graphene_vec3_t that contains the first two components of the +// given #graphene_vec3_t, and the third component set to 0. +// +// The function returns the following values: +// +// - res: return location for a #graphene_vec3_t. +func (v *Vec3) XY0() *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec3_get_xy0(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// XYZ0 converts a #graphene_vec3_t in a #graphene_vec4_t using 0.0 as the value +// for the fourth component of the resulting vector. +// +// The function returns the following values: +// +// - res: return location for the vector. +func (v *Vec3) XYZ0() *Vec4 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec3_get_xyz0(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// XYZ1 converts a #graphene_vec3_t in a #graphene_vec4_t using 1.0 as the value +// for the fourth component of the resulting vector. +// +// The function returns the following values: +// +// - res: return location for the vector. +func (v *Vec3) XYZ1() *Vec4 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec3_get_xyz1(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Xyzw converts a #graphene_vec3_t in a #graphene_vec4_t using w as the value +// of the fourth component of the resulting vector. +// +// The function takes the following parameters: +// +// - w: value of the W component. +// +// The function returns the following values: +// +// - res: return location for the vector. +func (v *Vec3) Xyzw(w float32) *Vec4 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 C.float // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = C.float(w) + + C.graphene_vec3_get_xyzw(_arg0, _arg1, &_arg2) + runtime.KeepAlive(v) + runtime.KeepAlive(w) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Y retrieves the second component of the given vector v. +// +// The function returns the following values: +// +// - gfloat: value of the second component of the vector. +func (v *Vec3) Y() float32 { + var _arg0 *C.graphene_vec3_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec3_get_y(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Z retrieves the third component of the given vector v. +// +// The function returns the following values: +// +// - gfloat: value of the third component of the vector. +func (v *Vec3) Z() float32 { + var _arg0 *C.graphene_vec3_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec3_get_z(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Init initializes a #graphene_vec3_t using the given values. +// +// This function can be called multiple times. +// +// The function takes the following parameters: +// +// - x: x field of the vector. +// - y: y field of the vector. +// - z: z field of the vector. +// +// The function returns the following values: +// +// - vec3: pointer to the initialized vector. +func (v *Vec3) Init(x float32, y float32, z float32) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _cret *C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = C.float(x) + _arg2 = C.float(y) + _arg3 = C.float(z) + + _cret = C.graphene_vec3_init(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(v) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(z) + + var _vec3 *Vec3 // out + + _vec3 = (*Vec3)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec3 +} + +// InitFromFloat initializes a #graphene_vec3_t with the values from an array. +// +// The function takes the following parameters: +// +// - src: array of 3 floating point values. +// +// The function returns the following values: +// +// - vec3: initialized vector. +func (v *Vec3) InitFromFloat(src [3]float32) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.float // out + var _cret *C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = (*C.float)(unsafe.Pointer(&src)) + + _cret = C.graphene_vec3_init_from_float(_arg0, _arg1) + runtime.KeepAlive(v) + runtime.KeepAlive(src) + + var _vec3 *Vec3 // out + + _vec3 = (*Vec3)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec3 +} + +// InitFromVec3 initializes a #graphene_vec3_t with the values of another +// #graphene_vec3_t. +// +// The function takes the following parameters: +// +// - src: #graphene_vec3_t. +// +// The function returns the following values: +// +// - vec3: initialized vector. +func (v *Vec3) InitFromVec3(src *Vec3) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _cret *C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_vec3_init_from_vec3(_arg0, _arg1) + runtime.KeepAlive(v) + runtime.KeepAlive(src) + + var _vec3 *Vec3 // out + + _vec3 = (*Vec3)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec3 +} + +// Interpolate: linearly interpolates v1 and v2 using the given factor. +// +// The function takes the following parameters: +// +// - v2: #graphene_vec3_t. +// - factor: interpolation factor. +// +// The function returns the following values: +// +// - res: interpolated vector. +func (v1 *Vec3) Interpolate(v2 *Vec3, factor float64) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.double // out + var _arg3 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v2))) + _arg2 = C.double(factor) + + C.graphene_vec3_interpolate(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + runtime.KeepAlive(factor) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Length retrieves the length of the given vector v. +// +// The function returns the following values: +// +// - gfloat: value of the length of the vector. +func (v *Vec3) Length() float32 { + var _arg0 *C.graphene_vec3_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec3_length(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Max compares each component of the two given vectors and creates a vector +// that contains the maximum values. +// +// The function takes the following parameters: +// +// - b: #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (a *Vec3) Max(b *Vec3) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec3_max(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Min compares each component of the two given vectors and creates a vector +// that contains the minimum values. +// +// The function takes the following parameters: +// +// - b: #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (a *Vec3) Min(b *Vec3) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec3_min(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Multiply multiplies each component of the two given vectors. +// +// The function takes the following parameters: +// +// - b: #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the resulting vector. +func (a *Vec3) Multiply(b *Vec3) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec3_multiply(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Near compares the two given #graphene_vec3_t vectors and checks whether their +// values are within the given epsilon. +// +// The function takes the following parameters: +// +// - v2: #graphene_vec3_t. +// - epsilon: threshold between the two vectors. +// +// The function returns the following values: +// +// - ok: true if the two vectors are near each other. +func (v1 *Vec3) Near(v2 *Vec3, epsilon float32) bool { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.float // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v2))) + _arg2 = C.float(epsilon) + + _cret = C.graphene_vec3_near(_arg0, _arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + runtime.KeepAlive(epsilon) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Negate negates the given #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (v *Vec3) Negate() *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec3_negate(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Normalize normalizes the given #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the normalized vector. +func (v *Vec3) Normalize() *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec3_normalize(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Scale multiplies all components of the given vector with the given scalar +// factor. +// +// The function takes the following parameters: +// +// - factor: scalar factor. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (v *Vec3) Scale(factor float32) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 C.float // out + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = C.float(factor) + + C.graphene_vec3_scale(_arg0, _arg1, &_arg2) + runtime.KeepAlive(v) + runtime.KeepAlive(factor) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Subtract subtracts from each component of the first operand a the +// corresponding component of the second operand b and places each result into +// the components of res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec3_t. +// +// The function returns the following values: +// +// - res: return location for the resulting vector. +func (a *Vec3) Subtract(b *Vec3) *Vec3 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec3_subtract(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// ToFloat copies the components of a #graphene_vec3_t into the given array. +// +// The function returns the following values: +// +// - dest: return location for an array of floating point values. +func (v *Vec3) ToFloat() [3]float32 { + var _arg0 *C.graphene_vec3_t // out + var _arg1 [3]C.float // in + + _arg0 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec3_to_float(_arg0, &_arg1[0]) + runtime.KeepAlive(v) + + var _dest [3]float32 // out + + _dest = *(*[3]float32)(unsafe.Pointer(&_arg1)) + + return _dest +} + +// Vec3One provides a constant pointer to a vector with three components, +// all sets to 1. +// +// The function returns the following values: +// +// - vec3: constant vector. +func Vec3One() *Vec3 { + var _cret *C.graphene_vec3_t // in + + _cret = C.graphene_vec3_one() + + var _vec3 *Vec3 // out + + _vec3 = (*Vec3)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec3 +} + +// Vec3XAxis provides a constant pointer to a vector with three components with +// values set to (1, 0, 0). +// +// The function returns the following values: +// +// - vec3: constant vector. +func Vec3XAxis() *Vec3 { + var _cret *C.graphene_vec3_t // in + + _cret = C.graphene_vec3_x_axis() + + var _vec3 *Vec3 // out + + _vec3 = (*Vec3)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec3 +} + +// Vec3YAxis provides a constant pointer to a vector with three components with +// values set to (0, 1, 0). +// +// The function returns the following values: +// +// - vec3: constant vector. +func Vec3YAxis() *Vec3 { + var _cret *C.graphene_vec3_t // in + + _cret = C.graphene_vec3_y_axis() + + var _vec3 *Vec3 // out + + _vec3 = (*Vec3)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec3 +} + +// Vec3ZAxis provides a constant pointer to a vector with three components with +// values set to (0, 0, 1). +// +// The function returns the following values: +// +// - vec3: constant vector. +func Vec3ZAxis() *Vec3 { + var _cret *C.graphene_vec3_t // in + + _cret = C.graphene_vec3_z_axis() + + var _vec3 *Vec3 // out + + _vec3 = (*Vec3)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec3 +} + +// Vec3Zero provides a constant pointer to a vector with three components, +// all sets to 0. +// +// The function returns the following values: +// +// - vec3: constant vector. +func Vec3Zero() *Vec3 { + var _cret *C.graphene_vec3_t // in + + _cret = C.graphene_vec3_zero() + + var _vec3 *Vec3 // out + + _vec3 = (*Vec3)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec3 +} + +// Vec4: structure capable of holding a vector with four dimensions: x, y, z, +// and w. +// +// The contents of the #graphene_vec4_t structure are private and should never +// be accessed directly. +// +// An instance of this type is always passed by reference. +type Vec4 struct { + *vec4 +} + +// vec4 is the struct that's finalized. +type vec4 struct { + native *C.graphene_vec4_t +} + +func marshalVec4(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Vec4{&vec4{(*C.graphene_vec4_t)(b)}}, nil +} + +// NewVec4Alloc constructs a struct Vec4. +func NewVec4Alloc() *Vec4 { + var _cret *C.graphene_vec4_t // in + + _cret = C.graphene_vec4_alloc() + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_vec4)), + func(intern *struct{ C unsafe.Pointer }) { + C.graphene_vec4_free((*C.graphene_vec4_t)(intern.C)) + }, + ) + + return _vec4 +} + +// Add adds each component of the two given vectors. +// +// The function takes the following parameters: +// +// - b: #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for the resulting vector. +func (a *Vec4) Add(b *Vec4) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec4_add(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Divide divides each component of the first operand a by the corresponding +// component of the second operand b, and places the results into the vector +// res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for the resulting vector. +func (a *Vec4) Divide(b *Vec4) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec4_divide(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Dot computes the dot product of the two given vectors. +// +// The function takes the following parameters: +// +// - b: #graphene_vec4_t. +// +// The function returns the following values: +// +// - gfloat: value of the dot product. +func (a *Vec4) Dot(b *Vec4) float32 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(b))) + + _cret = C.graphene_vec4_dot(_arg0, _arg1) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Equal checks whether the two given #graphene_vec4_t are equal. +// +// The function takes the following parameters: +// +// - v2: #graphene_vec4_t. +// +// The function returns the following values: +// +// - ok: true if the two vectors are equal, and false otherwise. +func (v1 *Vec4) Equal(v2 *Vec4) bool { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v2))) + + _cret = C.graphene_vec4_equal(_arg0, _arg1) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// W retrieves the value of the fourth component of the given #graphene_vec4_t. +// +// The function returns the following values: +// +// - gfloat: value of the fourth component. +func (v *Vec4) W() float32 { + var _arg0 *C.graphene_vec4_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec4_get_w(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// X retrieves the value of the first component of the given #graphene_vec4_t. +// +// The function returns the following values: +// +// - gfloat: value of the first component. +func (v *Vec4) X() float32 { + var _arg0 *C.graphene_vec4_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec4_get_x(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// XY creates a #graphene_vec2_t that contains the first two components of the +// given #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for a #graphene_vec2_t. +func (v *Vec4) XY() *Vec2 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 C.graphene_vec2_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec4_get_xy(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec2 // out + + _res = (*Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// XYZ creates a #graphene_vec3_t that contains the first three components of +// the given #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for a graphene_vec3_t. +func (v *Vec4) XYZ() *Vec3 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 C.graphene_vec3_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec4_get_xyz(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec3 // out + + _res = (*Vec3)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Y retrieves the value of the second component of the given #graphene_vec4_t. +// +// The function returns the following values: +// +// - gfloat: value of the second component. +func (v *Vec4) Y() float32 { + var _arg0 *C.graphene_vec4_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec4_get_y(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Z retrieves the value of the third component of the given #graphene_vec4_t. +// +// The function returns the following values: +// +// - gfloat: value of the third component. +func (v *Vec4) Z() float32 { + var _arg0 *C.graphene_vec4_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec4_get_z(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Init initializes a #graphene_vec4_t using the given values. +// +// This function can be called multiple times. +// +// The function takes the following parameters: +// +// - x: x field of the vector. +// - y: y field of the vector. +// - z: z field of the vector. +// - w: w field of the vector. +// +// The function returns the following values: +// +// - vec4: pointer to the initialized vector. +func (v *Vec4) Init(x float32, y float32, z float32, w float32) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _cret *C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = C.float(x) + _arg2 = C.float(y) + _arg3 = C.float(z) + _arg4 = C.float(w) + + _cret = C.graphene_vec4_init(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(v) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(z) + runtime.KeepAlive(w) + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// InitFromFloat initializes a #graphene_vec4_t with the values inside the given +// array. +// +// The function takes the following parameters: +// +// - src: array of four floating point values. +// +// The function returns the following values: +// +// - vec4: initialized vector. +func (v *Vec4) InitFromFloat(src [4]float32) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.float // out + var _cret *C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = (*C.float)(unsafe.Pointer(&src)) + + _cret = C.graphene_vec4_init_from_float(_arg0, _arg1) + runtime.KeepAlive(v) + runtime.KeepAlive(src) + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// InitFromVec2 initializes a #graphene_vec4_t using the components of a +// #graphene_vec2_t and the values of z and w. +// +// The function takes the following parameters: +// +// - src: #graphene_vec2_t. +// - z: value for the third component of v. +// - w: value for the fourth component of v. +// +// The function returns the following values: +// +// - vec4: initialized vector. +func (v *Vec4) InitFromVec2(src *Vec2, z float32, w float32) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec2_t // out + var _arg2 C.float // out + var _arg3 C.float // out + var _cret *C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(src))) + _arg2 = C.float(z) + _arg3 = C.float(w) + + _cret = C.graphene_vec4_init_from_vec2(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(v) + runtime.KeepAlive(src) + runtime.KeepAlive(z) + runtime.KeepAlive(w) + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// InitFromVec3 initializes a #graphene_vec4_t using the components of a +// #graphene_vec3_t and the value of w. +// +// The function takes the following parameters: +// +// - src: #graphene_vec3_t. +// - w: value for the fourth component of v. +// +// The function returns the following values: +// +// - vec4: initialized vector. +func (v *Vec4) InitFromVec3(src *Vec3, w float32) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec3_t // out + var _arg2 C.float // out + var _cret *C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(src))) + _arg2 = C.float(w) + + _cret = C.graphene_vec4_init_from_vec3(_arg0, _arg1, _arg2) + runtime.KeepAlive(v) + runtime.KeepAlive(src) + runtime.KeepAlive(w) + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// InitFromVec4 initializes a #graphene_vec4_t using the components of another +// #graphene_vec4_t. +// +// The function takes the following parameters: +// +// - src: #graphene_vec4_t. +// +// The function returns the following values: +// +// - vec4: initialized vector. +func (v *Vec4) InitFromVec4(src *Vec4) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _cret *C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.graphene_vec4_init_from_vec4(_arg0, _arg1) + runtime.KeepAlive(v) + runtime.KeepAlive(src) + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// Interpolate: linearly interpolates v1 and v2 using the given factor. +// +// The function takes the following parameters: +// +// - v2: #graphene_vec4_t. +// - factor: interpolation factor. +// +// The function returns the following values: +// +// - res: interpolated vector. +func (v1 *Vec4) Interpolate(v2 *Vec4, factor float64) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 C.double // out + var _arg3 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v2))) + _arg2 = C.double(factor) + + C.graphene_vec4_interpolate(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + runtime.KeepAlive(factor) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _res +} + +// Length computes the length of the given #graphene_vec4_t. +// +// The function returns the following values: +// +// - gfloat: length of the vector. +func (v *Vec4) Length() float32 { + var _arg0 *C.graphene_vec4_t // out + var _cret C.float // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + _cret = C.graphene_vec4_length(_arg0) + runtime.KeepAlive(v) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Max compares each component of the two given vectors and creates a vector +// that contains the maximum values. +// +// The function takes the following parameters: +// +// - b: #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (a *Vec4) Max(b *Vec4) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec4_max(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Min compares each component of the two given vectors and creates a vector +// that contains the minimum values. +// +// The function takes the following parameters: +// +// - b: #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (a *Vec4) Min(b *Vec4) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec4_min(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Multiply multiplies each component of the two given vectors. +// +// The function takes the following parameters: +// +// - b: #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for the resulting vector. +func (a *Vec4) Multiply(b *Vec4) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec4_multiply(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Near compares the two given #graphene_vec4_t vectors and checks whether their +// values are within the given epsilon. +// +// The function takes the following parameters: +// +// - v2: #graphene_vec4_t. +// - epsilon: threshold between the two vectors. +// +// The function returns the following values: +// +// - ok: true if the two vectors are near each other. +func (v1 *Vec4) Near(v2 *Vec4, epsilon float32) bool { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 C.float // out + var _cret C._Bool // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v1))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v2))) + _arg2 = C.float(epsilon) + + _cret = C.graphene_vec4_near(_arg0, _arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) + runtime.KeepAlive(epsilon) + + var _ok bool // out + + if _cret { + _ok = true + } + + return _ok +} + +// Negate negates the given #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (v *Vec4) Negate() *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec4_negate(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Normalize normalizes the given #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for the normalized vector. +func (v *Vec4) Normalize() *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec4_normalize(_arg0, &_arg1) + runtime.KeepAlive(v) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _res +} + +// Scale multiplies all components of the given vector with the given scalar +// factor. +// +// The function takes the following parameters: +// +// - factor: scalar factor. +// +// The function returns the following values: +// +// - res: return location for the result vector. +func (v *Vec4) Scale(factor float32) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 C.float // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + _arg1 = C.float(factor) + + C.graphene_vec4_scale(_arg0, _arg1, &_arg2) + runtime.KeepAlive(v) + runtime.KeepAlive(factor) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// Subtract subtracts from each component of the first operand a the +// corresponding component of the second operand b and places each result into +// the components of res. +// +// The function takes the following parameters: +// +// - b: #graphene_vec4_t. +// +// The function returns the following values: +// +// - res: return location for the resulting vector. +func (a *Vec4) Subtract(b *Vec4) *Vec4 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 *C.graphene_vec4_t // out + var _arg2 C.graphene_vec4_t // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(a))) + _arg1 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(b))) + + C.graphene_vec4_subtract(_arg0, _arg1, &_arg2) + runtime.KeepAlive(a) + runtime.KeepAlive(b) + + var _res *Vec4 // out + + _res = (*Vec4)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _res +} + +// ToFloat stores the components of the given #graphene_vec4_t into an array of +// floating point values. +// +// The function returns the following values: +// +// - dest: return location for an array of floating point values. +func (v *Vec4) ToFloat() [4]float32 { + var _arg0 *C.graphene_vec4_t // out + var _arg1 [4]C.float // in + + _arg0 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(v))) + + C.graphene_vec4_to_float(_arg0, &_arg1[0]) + runtime.KeepAlive(v) + + var _dest [4]float32 // out + + _dest = *(*[4]float32)(unsafe.Pointer(&_arg1)) + + return _dest +} + +// Vec4One retrieves a pointer to a #graphene_vec4_t with all its components set +// to 1. +// +// The function returns the following values: +// +// - vec4: constant vector. +func Vec4One() *Vec4 { + var _cret *C.graphene_vec4_t // in + + _cret = C.graphene_vec4_one() + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// Vec4WAxis retrieves a pointer to a #graphene_vec4_t with its components set +// to (0, 0, 0, 1). +// +// The function returns the following values: +// +// - vec4: constant vector. +func Vec4WAxis() *Vec4 { + var _cret *C.graphene_vec4_t // in + + _cret = C.graphene_vec4_w_axis() + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// Vec4XAxis retrieves a pointer to a #graphene_vec4_t with its components set +// to (1, 0, 0, 0). +// +// The function returns the following values: +// +// - vec4: constant vector. +func Vec4XAxis() *Vec4 { + var _cret *C.graphene_vec4_t // in + + _cret = C.graphene_vec4_x_axis() + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// Vec4YAxis retrieves a pointer to a #graphene_vec4_t with its components set +// to (0, 1, 0, 0). +// +// The function returns the following values: +// +// - vec4: constant vector. +func Vec4YAxis() *Vec4 { + var _cret *C.graphene_vec4_t // in + + _cret = C.graphene_vec4_y_axis() + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// Vec4ZAxis retrieves a pointer to a #graphene_vec4_t with its components set +// to (0, 0, 1, 0). +// +// The function returns the following values: +// +// - vec4: constant vector. +func Vec4ZAxis() *Vec4 { + var _cret *C.graphene_vec4_t // in + + _cret = C.graphene_vec4_z_axis() + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// Vec4Zero retrieves a pointer to a #graphene_vec4_t with all its components +// set to 0. +// +// The function returns the following values: +// +// - vec4: constant vector. +func Vec4Zero() *Vec4 { + var _cret *C.graphene_vec4_t // in + + _cret = C.graphene_vec4_zero() + + var _vec4 *Vec4 // out + + _vec4 = (*Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/gsk/v4/gsk.go b/vendor/github.com/diamondburned/gotk4/pkg/gsk/v4/gsk.go new file mode 100644 index 00000000..89e5229f --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/gsk/v4/gsk.go @@ -0,0 +1,10463 @@ +// Code generated by girgen. DO NOT EDIT. + +package gsk + +import ( + "fmt" + "runtime" + _ "runtime/cgo" + "strings" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/cairo" + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gerror" + "github.com/diamondburned/gotk4/pkg/core/gextras" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" + "github.com/diamondburned/gotk4/pkg/gdk/v4" + "github.com/diamondburned/gotk4/pkg/glib/v2" + "github.com/diamondburned/gotk4/pkg/graphene" + "github.com/diamondburned/gotk4/pkg/pango" +) + +// #cgo pkg-config: gtk4 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// #include +// #include +// extern void _gotk4_gsk4_ParseErrorFunc(GskParseLocation*, GskParseLocation*, GError*, gpointer); +// extern gboolean _gotk4_gsk4_PathForEachFunc(GskPathOperation, graphene_point_t*, gsize, float, gpointer); +import "C" + +// GType values. +var ( + GTypeBlendMode = coreglib.Type(C.gsk_blend_mode_get_type()) + GTypeCorner = coreglib.Type(C.gsk_corner_get_type()) + GTypeFillRule = coreglib.Type(C.gsk_fill_rule_get_type()) + GTypeGLUniformType = coreglib.Type(C.gsk_gl_uniform_type_get_type()) + GTypeLineCap = coreglib.Type(C.gsk_line_cap_get_type()) + GTypeLineJoin = coreglib.Type(C.gsk_line_join_get_type()) + GTypeMaskMode = coreglib.Type(C.gsk_mask_mode_get_type()) + GTypePathDirection = coreglib.Type(C.gsk_path_direction_get_type()) + GTypePathOperation = coreglib.Type(C.gsk_path_operation_get_type()) + GTypeRenderNodeType = coreglib.Type(C.gsk_render_node_type_get_type()) + GTypeScalingFilter = coreglib.Type(C.gsk_scaling_filter_get_type()) + GTypeSerializationError = coreglib.Type(C.gsk_serialization_error_get_type()) + GTypeTransformCategory = coreglib.Type(C.gsk_transform_category_get_type()) + GTypePathForEachFlags = coreglib.Type(C.gsk_path_foreach_flags_get_type()) + GTypeBlendNode = coreglib.Type(C.gsk_blend_node_get_type()) + GTypeBlurNode = coreglib.Type(C.gsk_blur_node_get_type()) + GTypeBorderNode = coreglib.Type(C.gsk_border_node_get_type()) + GTypeCairoNode = coreglib.Type(C.gsk_cairo_node_get_type()) + GTypeCairoRenderer = coreglib.Type(C.gsk_cairo_renderer_get_type()) + GTypeClipNode = coreglib.Type(C.gsk_clip_node_get_type()) + GTypeColorMatrixNode = coreglib.Type(C.gsk_color_matrix_node_get_type()) + GTypeColorNode = coreglib.Type(C.gsk_color_node_get_type()) + GTypeConicGradientNode = coreglib.Type(C.gsk_conic_gradient_node_get_type()) + GTypeContainerNode = coreglib.Type(C.gsk_container_node_get_type()) + GTypeCrossFadeNode = coreglib.Type(C.gsk_cross_fade_node_get_type()) + GTypeDebugNode = coreglib.Type(C.gsk_debug_node_get_type()) + GTypeFillNode = coreglib.Type(C.gsk_fill_node_get_type()) + GTypeGLShader = coreglib.Type(C.gsk_gl_shader_get_type()) + GTypeGLShaderNode = coreglib.Type(C.gsk_gl_shader_node_get_type()) + GTypeInsetShadowNode = coreglib.Type(C.gsk_inset_shadow_node_get_type()) + GTypeLinearGradientNode = coreglib.Type(C.gsk_linear_gradient_node_get_type()) + GTypeMaskNode = coreglib.Type(C.gsk_mask_node_get_type()) + GTypeNGLRenderer = coreglib.Type(C.gsk_ngl_renderer_get_type()) + GTypeOpacityNode = coreglib.Type(C.gsk_opacity_node_get_type()) + GTypeOutsetShadowNode = coreglib.Type(C.gsk_outset_shadow_node_get_type()) + GTypeRadialGradientNode = coreglib.Type(C.gsk_radial_gradient_node_get_type()) + GTypeRenderNode = coreglib.Type(C.gsk_render_node_get_type()) + GTypeRenderer = coreglib.Type(C.gsk_renderer_get_type()) + GTypeRepeatNode = coreglib.Type(C.gsk_repeat_node_get_type()) + GTypeRepeatingLinearGradientNode = coreglib.Type(C.gsk_repeating_linear_gradient_node_get_type()) + GTypeRepeatingRadialGradientNode = coreglib.Type(C.gsk_repeating_radial_gradient_node_get_type()) + GTypeRoundedClipNode = coreglib.Type(C.gsk_rounded_clip_node_get_type()) + GTypeShadowNode = coreglib.Type(C.gsk_shadow_node_get_type()) + GTypeStrokeNode = coreglib.Type(C.gsk_stroke_node_get_type()) + GTypeSubsurfaceNode = coreglib.Type(C.gsk_subsurface_node_get_type()) + GTypeTextNode = coreglib.Type(C.gsk_text_node_get_type()) + GTypeTextureNode = coreglib.Type(C.gsk_texture_node_get_type()) + GTypeTextureScaleNode = coreglib.Type(C.gsk_texture_scale_node_get_type()) + GTypeTransformNode = coreglib.Type(C.gsk_transform_node_get_type()) + GTypePath = coreglib.Type(C.gsk_path_get_type()) + GTypePathBuilder = coreglib.Type(C.gsk_path_builder_get_type()) + GTypePathMeasure = coreglib.Type(C.gsk_path_measure_get_type()) + GTypePathPoint = coreglib.Type(C.gsk_path_point_get_type()) + GTypeShaderArgsBuilder = coreglib.Type(C.gsk_shader_args_builder_get_type()) + GTypeStroke = coreglib.Type(C.gsk_stroke_get_type()) + GTypeTransform = coreglib.Type(C.gsk_transform_get_type()) +) + +func init() { + coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{ + coreglib.TypeMarshaler{T: GTypeBlendMode, F: marshalBlendMode}, + coreglib.TypeMarshaler{T: GTypeCorner, F: marshalCorner}, + coreglib.TypeMarshaler{T: GTypeFillRule, F: marshalFillRule}, + coreglib.TypeMarshaler{T: GTypeGLUniformType, F: marshalGLUniformType}, + coreglib.TypeMarshaler{T: GTypeLineCap, F: marshalLineCap}, + coreglib.TypeMarshaler{T: GTypeLineJoin, F: marshalLineJoin}, + coreglib.TypeMarshaler{T: GTypeMaskMode, F: marshalMaskMode}, + coreglib.TypeMarshaler{T: GTypePathDirection, F: marshalPathDirection}, + coreglib.TypeMarshaler{T: GTypePathOperation, F: marshalPathOperation}, + coreglib.TypeMarshaler{T: GTypeRenderNodeType, F: marshalRenderNodeType}, + coreglib.TypeMarshaler{T: GTypeScalingFilter, F: marshalScalingFilter}, + coreglib.TypeMarshaler{T: GTypeSerializationError, F: marshalSerializationError}, + coreglib.TypeMarshaler{T: GTypeTransformCategory, F: marshalTransformCategory}, + coreglib.TypeMarshaler{T: GTypePathForEachFlags, F: marshalPathForEachFlags}, + coreglib.TypeMarshaler{T: GTypeBlendNode, F: marshalBlendNode}, + coreglib.TypeMarshaler{T: GTypeBlurNode, F: marshalBlurNode}, + coreglib.TypeMarshaler{T: GTypeBorderNode, F: marshalBorderNode}, + coreglib.TypeMarshaler{T: GTypeCairoNode, F: marshalCairoNode}, + coreglib.TypeMarshaler{T: GTypeCairoRenderer, F: marshalCairoRenderer}, + coreglib.TypeMarshaler{T: GTypeClipNode, F: marshalClipNode}, + coreglib.TypeMarshaler{T: GTypeColorMatrixNode, F: marshalColorMatrixNode}, + coreglib.TypeMarshaler{T: GTypeColorNode, F: marshalColorNode}, + coreglib.TypeMarshaler{T: GTypeConicGradientNode, F: marshalConicGradientNode}, + coreglib.TypeMarshaler{T: GTypeContainerNode, F: marshalContainerNode}, + coreglib.TypeMarshaler{T: GTypeCrossFadeNode, F: marshalCrossFadeNode}, + coreglib.TypeMarshaler{T: GTypeDebugNode, F: marshalDebugNode}, + coreglib.TypeMarshaler{T: GTypeFillNode, F: marshalFillNode}, + coreglib.TypeMarshaler{T: GTypeGLShader, F: marshalGLShader}, + coreglib.TypeMarshaler{T: GTypeGLShaderNode, F: marshalGLShaderNode}, + coreglib.TypeMarshaler{T: GTypeInsetShadowNode, F: marshalInsetShadowNode}, + coreglib.TypeMarshaler{T: GTypeLinearGradientNode, F: marshalLinearGradientNode}, + coreglib.TypeMarshaler{T: GTypeMaskNode, F: marshalMaskNode}, + coreglib.TypeMarshaler{T: GTypeNGLRenderer, F: marshalNGLRenderer}, + coreglib.TypeMarshaler{T: GTypeOpacityNode, F: marshalOpacityNode}, + coreglib.TypeMarshaler{T: GTypeOutsetShadowNode, F: marshalOutsetShadowNode}, + coreglib.TypeMarshaler{T: GTypeRadialGradientNode, F: marshalRadialGradientNode}, + coreglib.TypeMarshaler{T: GTypeRenderNode, F: marshalRenderNode}, + coreglib.TypeMarshaler{T: GTypeRenderer, F: marshalRenderer}, + coreglib.TypeMarshaler{T: GTypeRepeatNode, F: marshalRepeatNode}, + coreglib.TypeMarshaler{T: GTypeRepeatingLinearGradientNode, F: marshalRepeatingLinearGradientNode}, + coreglib.TypeMarshaler{T: GTypeRepeatingRadialGradientNode, F: marshalRepeatingRadialGradientNode}, + coreglib.TypeMarshaler{T: GTypeRoundedClipNode, F: marshalRoundedClipNode}, + coreglib.TypeMarshaler{T: GTypeShadowNode, F: marshalShadowNode}, + coreglib.TypeMarshaler{T: GTypeStrokeNode, F: marshalStrokeNode}, + coreglib.TypeMarshaler{T: GTypeSubsurfaceNode, F: marshalSubsurfaceNode}, + coreglib.TypeMarshaler{T: GTypeTextNode, F: marshalTextNode}, + coreglib.TypeMarshaler{T: GTypeTextureNode, F: marshalTextureNode}, + coreglib.TypeMarshaler{T: GTypeTextureScaleNode, F: marshalTextureScaleNode}, + coreglib.TypeMarshaler{T: GTypeTransformNode, F: marshalTransformNode}, + coreglib.TypeMarshaler{T: GTypePath, F: marshalPath}, + coreglib.TypeMarshaler{T: GTypePathBuilder, F: marshalPathBuilder}, + coreglib.TypeMarshaler{T: GTypePathMeasure, F: marshalPathMeasure}, + coreglib.TypeMarshaler{T: GTypePathPoint, F: marshalPathPoint}, + coreglib.TypeMarshaler{T: GTypeShaderArgsBuilder, F: marshalShaderArgsBuilder}, + coreglib.TypeMarshaler{T: GTypeStroke, F: marshalStroke}, + coreglib.TypeMarshaler{T: GTypeTransform, F: marshalTransform}, + }) +} + +// BlendMode: blend modes available for render nodes. +// +// The implementation of each blend mode is deferred to the rendering pipeline. +// +// See for more information on +// blending and blend modes. +type BlendMode C.gint + +const ( + // BlendModeDefault: default blend mode, which specifies no blending. + BlendModeDefault BlendMode = iota + // BlendModeMultiply: source color is multiplied by the destination and + // replaces the destination. + BlendModeMultiply + // BlendModeScreen multiplies the complements of the destination and source + // color values, then complements the result. + BlendModeScreen + // BlendModeOverlay multiplies or screens the colors, depending on the + // destination color value. This is the inverse of hard-list. + BlendModeOverlay + // BlendModeDarken selects the darker of the destination and source colors. + BlendModeDarken + // BlendModeLighten selects the lighter of the destination and source + // colors. + BlendModeLighten + // BlendModeColorDodge brightens the destination color to reflect the source + // color. + BlendModeColorDodge + // BlendModeColorBurn darkens the destination color to reflect the source + // color. + BlendModeColorBurn + // BlendModeHardLight multiplies or screens the colors, depending on the + // source color value. + BlendModeHardLight + // BlendModeSoftLight darkens or lightens the colors, depending on the + // source color value. + BlendModeSoftLight + // BlendModeDifference subtracts the darker of the two constituent colors + // from the lighter color. + BlendModeDifference + // BlendModeExclusion produces an effect similar to that of the difference + // mode but lower in contrast. + BlendModeExclusion + // BlendModeColor creates a color with the hue and saturation of the source + // color and the luminosity of the destination color. + BlendModeColor + // BlendModeHue creates a color with the hue of the source color and the + // saturation and luminosity of the destination color. + BlendModeHue + // BlendModeSaturation creates a color with the saturation of the source + // color and the hue and luminosity of the destination color. + BlendModeSaturation + // BlendModeLuminosity creates a color with the luminosity of the source + // color and the hue and saturation of the destination color. + BlendModeLuminosity +) + +func marshalBlendMode(p uintptr) (interface{}, error) { + return BlendMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for BlendMode. +func (b BlendMode) String() string { + switch b { + case BlendModeDefault: + return "Default" + case BlendModeMultiply: + return "Multiply" + case BlendModeScreen: + return "Screen" + case BlendModeOverlay: + return "Overlay" + case BlendModeDarken: + return "Darken" + case BlendModeLighten: + return "Lighten" + case BlendModeColorDodge: + return "ColorDodge" + case BlendModeColorBurn: + return "ColorBurn" + case BlendModeHardLight: + return "HardLight" + case BlendModeSoftLight: + return "SoftLight" + case BlendModeDifference: + return "Difference" + case BlendModeExclusion: + return "Exclusion" + case BlendModeColor: + return "Color" + case BlendModeHue: + return "Hue" + case BlendModeSaturation: + return "Saturation" + case BlendModeLuminosity: + return "Luminosity" + default: + return fmt.Sprintf("BlendMode(%d)", b) + } +} + +// Corner: corner indices used by GskRoundedRect. +type Corner C.gint + +const ( + // CornerTopLeft: top left corner. + CornerTopLeft Corner = iota + // CornerTopRight: top right corner. + CornerTopRight + // CornerBottomRight: bottom right corner. + CornerBottomRight + // CornerBottomLeft: bottom left corner. + CornerBottomLeft +) + +func marshalCorner(p uintptr) (interface{}, error) { + return Corner(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Corner. +func (c Corner) String() string { + switch c { + case CornerTopLeft: + return "TopLeft" + case CornerTopRight: + return "TopRight" + case CornerBottomRight: + return "BottomRight" + case CornerBottomLeft: + return "BottomLeft" + default: + return fmt.Sprintf("Corner(%d)", c) + } +} + +// FillRule: GskFillRule is used to select how paths are filled. +// +// Whether or not a point is included in the fill is determined by taking a +// ray from that point to infinity and looking at intersections with the path. +// The ray can be in any direction, as long as it doesn't pass through the end +// point of a segment or have a tricky intersection such as intersecting tangent +// to the path. +// +// (Note that filling is not actually implemented in this way. This is just a +// description of the rule that is applied.) +// +// New entries may be added in future versions. +type FillRule C.gint + +const ( + // FillRuleWinding: if the path crosses the ray from left-to-right, + // counts +1. If the path crosses the ray from right to left, counts -1. + // (Left and right are determined from the perspective of looking along the + // ray from the starting point.) If the total count is non-zero, the point + // will be filled. + FillRuleWinding FillRule = iota + // FillRuleEvenOdd counts the total number of intersections, without regard + // to the orientation of the contour. If the total number of intersections + // is odd, the point will be filled. + FillRuleEvenOdd +) + +func marshalFillRule(p uintptr) (interface{}, error) { + return FillRule(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FillRule. +func (f FillRule) String() string { + switch f { + case FillRuleWinding: + return "Winding" + case FillRuleEvenOdd: + return "EvenOdd" + default: + return fmt.Sprintf("FillRule(%d)", f) + } +} + +// GLUniformType: this defines the types of the uniforms that GskGLShaders +// declare. +// +// It defines both what the type is called in the GLSL shader code, and what the +// corresponding C type is on the Gtk side. +type GLUniformType C.gint + +const ( + // GLUniformTypeNone: no type, used for uninitialized or unspecified values. + GLUniformTypeNone GLUniformType = iota + // GLUniformTypeFloat: float uniform. + GLUniformTypeFloat + // GLUniformTypeInt: GLSL int / gint32 uniform. + GLUniformTypeInt + // GLUniformTypeUint: GLSL uint / guint32 uniform. + GLUniformTypeUint + // GLUniformTypeBool: GLSL bool / gboolean uniform. + GLUniformTypeBool + // GLUniformTypeVec2: GLSL vec2 / graphene_vec2_t uniform. + GLUniformTypeVec2 + // GLUniformTypeVec3: GLSL vec3 / graphene_vec3_t uniform. + GLUniformTypeVec3 + // GLUniformTypeVec4: GLSL vec4 / graphene_vec4_t uniform. + GLUniformTypeVec4 +) + +func marshalGLUniformType(p uintptr) (interface{}, error) { + return GLUniformType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for GLUniformType. +func (g GLUniformType) String() string { + switch g { + case GLUniformTypeNone: + return "None" + case GLUniformTypeFloat: + return "Float" + case GLUniformTypeInt: + return "Int" + case GLUniformTypeUint: + return "Uint" + case GLUniformTypeBool: + return "Bool" + case GLUniformTypeVec2: + return "Vec2" + case GLUniformTypeVec3: + return "Vec3" + case GLUniformTypeVec4: + return "Vec4" + default: + return fmt.Sprintf("GLUniformType(%d)", g) + } +} + +// LineCap specifies how to render the start and end points of contours or +// dashes when stroking. +// +// The default line cap style is GSK_LINE_CAP_BUTT. +// +// New entries may be added in future versions. +// +//
Line Cap Styles
GSK_LINE_CAP_BUTT, +// GSK_LINE_CAP_ROUND, GSK_LINE_CAP_SQUARE
. +type LineCap C.gint + +const ( + // LineCapButt: start and stop the line exactly at the start and end point. + LineCapButt LineCap = iota + // LineCapRound: use a round ending, the center of the circle is the start + // or end point. + LineCapRound + // LineCapSquare: use squared ending, the center of the square is the start + // or end point. + LineCapSquare +) + +func marshalLineCap(p uintptr) (interface{}, error) { + return LineCap(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for LineCap. +func (l LineCap) String() string { + switch l { + case LineCapButt: + return "Butt" + case LineCapRound: + return "Round" + case LineCapSquare: + return "Square" + default: + return fmt.Sprintf("LineCap(%d)", l) + } +} + +// LineJoin specifies how to render the junction of two lines when stroking. +// +// The default line join style is GSK_LINE_JOIN_MITER. +// +// New entries may be added in future versions. +// +//
Line Join Styles
GSK_LINE_JOINT_MITER, +// GSK_LINE_JOINT_ROUND, GSK_LINE_JOIN_BEVEL
. +type LineJoin C.gint + +const ( + // LineJoinMiter: use a sharp angled corner. + LineJoinMiter LineJoin = iota + // LineJoinRound: use a round join, the center of the circle is the join + // point. + LineJoinRound + // LineJoinBevel: use a cut-off join, the join is cut off at half the line + // width from the joint point. + LineJoinBevel +) + +func marshalLineJoin(p uintptr) (interface{}, error) { + return LineJoin(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for LineJoin. +func (l LineJoin) String() string { + switch l { + case LineJoinMiter: + return "Miter" + case LineJoinRound: + return "Round" + case LineJoinBevel: + return "Bevel" + default: + return fmt.Sprintf("LineJoin(%d)", l) + } +} + +// MaskMode: mask modes available for mask nodes. +type MaskMode C.gint + +const ( + // MaskModeAlpha: use the alpha channel of the mask. + MaskModeAlpha MaskMode = iota + // MaskModeInvertedAlpha: use the inverted alpha channel of the mask. + MaskModeInvertedAlpha + // MaskModeLuminance: use the luminance of the mask, multiplied by mask + // alpha. + MaskModeLuminance + // MaskModeInvertedLuminance: use the inverted luminance of the mask, + // multiplied by mask alpha. + MaskModeInvertedLuminance +) + +func marshalMaskMode(p uintptr) (interface{}, error) { + return MaskMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for MaskMode. +func (m MaskMode) String() string { + switch m { + case MaskModeAlpha: + return "Alpha" + case MaskModeInvertedAlpha: + return "InvertedAlpha" + case MaskModeLuminance: + return "Luminance" + case MaskModeInvertedLuminance: + return "InvertedLuminance" + default: + return fmt.Sprintf("MaskMode(%d)", m) + } +} + +// PathDirection values of the GskPathDirection enum are used to pick one of the +// four tangents at a given point on the path. +// +// Note that the directions for GSK_PATH_FROM_START/GSK_PATH_TO_END and +// GSK_PATH_TO_START/GSK_PATH_FROM_END will coincide for smooth points. Only +// sharp turns will exhibit four different directions. +// +// Path Tangents . +type PathDirection C.gint + +const ( + // PathFromStart: tangent in path direction of the incoming side of the + // path. + PathFromStart PathDirection = iota + // PathToStart: tangent against path direction of the incoming side of the + // path. + PathToStart + // PathToEnd: tangent in path direction of the outgoing side of the path. + PathToEnd + // PathFromEnd: tangent against path direction of the outgoing side of the + // path. + PathFromEnd +) + +func marshalPathDirection(p uintptr) (interface{}, error) { + return PathDirection(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PathDirection. +func (p PathDirection) String() string { + switch p { + case PathFromStart: + return "FromStart" + case PathToStart: + return "ToStart" + case PathToEnd: + return "ToEnd" + case PathFromEnd: + return "FromEnd" + default: + return fmt.Sprintf("PathDirection(%d)", p) + } +} + +// PathOperation: path operations are used to describe the segments of a +// GskPath. +// +// More values may be added in the future. +type PathOperation C.gint + +const ( + // PathMove: move-to operation, with 1 point describing the target point. + PathMove PathOperation = iota + // PathClose: close operation ending the current contour with a line back to + // the starting point. Two points describe the start and end of the line. + PathClose + // PathLine: line-to operation, with 2 points describing the start and end + // point of a straight line. + PathLine + // PathQuad: curve-to operation describing a quadratic Bézier curve with 3 + // points describing the start point, the control point and the end point of + // the curve. + PathQuad + // PathCubic: curve-to operation describing a cubic Bézier curve with 4 + // points describing the start point, the two control points and the end + // point of the curve. + PathCubic + // PathConic: rational quadratic Bézier curve with 3 points describing the + // start point, control point and end point of the curve. A weight for the + // curve will be passed, too. + PathConic +) + +func marshalPathOperation(p uintptr) (interface{}, error) { + return PathOperation(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PathOperation. +func (p PathOperation) String() string { + switch p { + case PathMove: + return "Move" + case PathClose: + return "Close" + case PathLine: + return "Line" + case PathQuad: + return "Quad" + case PathCubic: + return "Cubic" + case PathConic: + return "Conic" + default: + return fmt.Sprintf("PathOperation(%d)", p) + } +} + +// RenderNodeType: type of a node determines what the node is rendering. +type RenderNodeType C.gint + +const ( + // NotARenderNodeType: error type. No node will ever have this type. + NotARenderNodeType RenderNodeType = iota + // ContainerNodeType: node containing a stack of children. + ContainerNodeType + // CairoNodeType: node drawing a cairo_surface_t. + CairoNodeType + // ColorNodeType: node drawing a single color rectangle. + ColorNodeType + // LinearGradientNodeType: node drawing a linear gradient. + LinearGradientNodeType + // RepeatingLinearGradientNodeType: node drawing a repeating linear + // gradient. + RepeatingLinearGradientNodeType + // RadialGradientNodeType: node drawing a radial gradient. + RadialGradientNodeType + // RepeatingRadialGradientNodeType: node drawing a repeating radial + // gradient. + RepeatingRadialGradientNodeType + // ConicGradientNodeType: node drawing a conic gradient. + ConicGradientNodeType + // BorderNodeType: node stroking a border around an area. + BorderNodeType + // TextureNodeType: node drawing a GdkTexture. + TextureNodeType + // InsetShadowNodeType: node drawing an inset shadow. + InsetShadowNodeType + // OutsetShadowNodeType: node drawing an outset shadow. + OutsetShadowNodeType + // TransformNodeType: node that renders its child after applying a matrix + // transform. + TransformNodeType + // OpacityNodeType: node that changes the opacity of its child. + OpacityNodeType + // ColorMatrixNodeType: node that applies a color matrix to every pixel. + ColorMatrixNodeType + // RepeatNodeType: node that repeats the child's contents. + RepeatNodeType + // ClipNodeType: node that clips its child to a rectangular area. + ClipNodeType + // RoundedClipNodeType: node that clips its child to a rounded rectangle. + RoundedClipNodeType + // ShadowNodeType: node that draws a shadow below its child. + ShadowNodeType + // BlendNodeType: node that blends two children together. + BlendNodeType + // CrossFadeNodeType: node that cross-fades between two children. + CrossFadeNodeType + // TextNodeType: node containing a glyph string. + TextNodeType + // BlurNodeType: node that applies a blur. + BlurNodeType + // DebugNodeType: debug information that does not affect the rendering. + DebugNodeType + // GLShaderNodeType: node that uses OpenGL fragment shaders to render. + GLShaderNodeType + // TextureScaleNodeType: node drawing a GdkTexture scaled and filtered. + TextureScaleNodeType + // MaskNodeType: node that masks one child with another. + MaskNodeType + // FillNodeType: node that fills a path. + FillNodeType + // StrokeNodeType: node that strokes a path. + StrokeNodeType + // SubsurfaceNodeType: node that possibly redirects part of the scene graph + // to a subsurface. + SubsurfaceNodeType +) + +func marshalRenderNodeType(p uintptr) (interface{}, error) { + return RenderNodeType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for RenderNodeType. +func (r RenderNodeType) String() string { + switch r { + case NotARenderNodeType: + return "NotARenderNode" + case ContainerNodeType: + return "ContainerNode" + case CairoNodeType: + return "CairoNode" + case ColorNodeType: + return "ColorNode" + case LinearGradientNodeType: + return "LinearGradientNode" + case RepeatingLinearGradientNodeType: + return "RepeatingLinearGradientNode" + case RadialGradientNodeType: + return "RadialGradientNode" + case RepeatingRadialGradientNodeType: + return "RepeatingRadialGradientNode" + case ConicGradientNodeType: + return "ConicGradientNode" + case BorderNodeType: + return "BorderNode" + case TextureNodeType: + return "TextureNode" + case InsetShadowNodeType: + return "InsetShadowNode" + case OutsetShadowNodeType: + return "OutsetShadowNode" + case TransformNodeType: + return "TransformNode" + case OpacityNodeType: + return "OpacityNode" + case ColorMatrixNodeType: + return "ColorMatrixNode" + case RepeatNodeType: + return "RepeatNode" + case ClipNodeType: + return "ClipNode" + case RoundedClipNodeType: + return "RoundedClipNode" + case ShadowNodeType: + return "ShadowNode" + case BlendNodeType: + return "BlendNode" + case CrossFadeNodeType: + return "CrossFadeNode" + case TextNodeType: + return "TextNode" + case BlurNodeType: + return "BlurNode" + case DebugNodeType: + return "DebugNode" + case GLShaderNodeType: + return "GLShaderNode" + case TextureScaleNodeType: + return "TextureScaleNode" + case MaskNodeType: + return "MaskNode" + case FillNodeType: + return "FillNode" + case StrokeNodeType: + return "StrokeNode" + case SubsurfaceNodeType: + return "SubsurfaceNode" + default: + return fmt.Sprintf("RenderNodeType(%d)", r) + } +} + +// ScalingFilter filters used when scaling texture data. +// +// The actual implementation of each filter is deferred to the rendering +// pipeline. +type ScalingFilter C.gint + +const ( + // ScalingFilterLinear: linear interpolation filter. + ScalingFilterLinear ScalingFilter = iota + // ScalingFilterNearest: nearest neighbor interpolation filter. + ScalingFilterNearest + // ScalingFilterTrilinear: linear interpolation along each axis, plus mipmap + // generation, with linear interpolation along the mipmap levels. + ScalingFilterTrilinear +) + +func marshalScalingFilter(p uintptr) (interface{}, error) { + return ScalingFilter(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ScalingFilter. +func (s ScalingFilter) String() string { + switch s { + case ScalingFilterLinear: + return "Linear" + case ScalingFilterNearest: + return "Nearest" + case ScalingFilterTrilinear: + return "Trilinear" + default: + return fmt.Sprintf("ScalingFilter(%d)", s) + } +} + +// SerializationError errors that can happen during (de)serialization. +type SerializationError C.gint + +const ( + // SerializationUnsupportedFormat: format can not be identified. + SerializationUnsupportedFormat SerializationError = iota + // SerializationUnsupportedVersion: version of the data is not understood. + SerializationUnsupportedVersion + // SerializationInvalidData: given data may not exist in a proper + // serialization. + SerializationInvalidData +) + +func marshalSerializationError(p uintptr) (interface{}, error) { + return SerializationError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SerializationError. +func (s SerializationError) String() string { + switch s { + case SerializationUnsupportedFormat: + return "UnsupportedFormat" + case SerializationUnsupportedVersion: + return "UnsupportedVersion" + case SerializationInvalidData: + return "InvalidData" + default: + return fmt.Sprintf("SerializationError(%d)", s) + } +} + +func SerializationErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gsk_serialization_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// TransformCategory categories of matrices relevant for GSK and GTK. +// +// Note that any category includes matrices of all later categories. +// So if you want to for example check if a matrix is a 2D matrix, category >= +// GSK_TRANSFORM_CATEGORY_2D is the way to do this. +// +// Also keep in mind that rounding errors may cause matrices to not conform +// to their categories. Otherwise, matrix operations done via multiplication +// will not worsen categories. So for the matrix multiplication C = A * B, +// category(C) = MIN (category(A), category(B)). +type TransformCategory C.gint + +const ( + // TransformCategoryUnknown: category of the matrix has not been determined. + TransformCategoryUnknown TransformCategory = iota + // TransformCategoryAny: analyzing the matrix concluded that it does not fit + // in any other category. + TransformCategoryAny + // TransformCategory3D: matrix is a 3D matrix. This means that the w column + // (the last column) has the values (0, 0, 0, 1). + TransformCategory3D + // TransformCategory2D: matrix is a 2D matrix. This is equivalent to + // graphene_matrix_is_2d() returning TRUE. In particular, this means that + // Cairo can deal with the matrix. + TransformCategory2D + // TransformCategory2DAffine: matrix is a combination of 2D scale and 2D + // translation operations. In particular, this means that any rectangle can + // be transformed exactly using this matrix. + TransformCategory2DAffine + // TransformCategory2DTranslate: matrix is a 2D translation. + TransformCategory2DTranslate + // TransformCategoryIdentity: matrix is the identity matrix. + TransformCategoryIdentity +) + +func marshalTransformCategory(p uintptr) (interface{}, error) { + return TransformCategory(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TransformCategory. +func (t TransformCategory) String() string { + switch t { + case TransformCategoryUnknown: + return "Unknown" + case TransformCategoryAny: + return "Any" + case TransformCategory3D: + return "3D" + case TransformCategory2D: + return "2D" + case TransformCategory2DAffine: + return "2DAffine" + case TransformCategory2DTranslate: + return "2DTranslate" + case TransformCategoryIdentity: + return "Identity" + default: + return fmt.Sprintf("TransformCategory(%d)", t) + } +} + +// PathForEachFlags flags that can be passed to gsk_path_foreach() to influence +// what kinds of operations the path is decomposed into. +// +// By default, gsk.Path.ForEach() will only emit a path with all operations +// flattened to straight lines to allow for maximum compatibility. The only +// operations emitted will be GSK_PATH_MOVE, GSK_PATH_LINE and GSK_PATH_CLOSE. +type PathForEachFlags C.guint + +const ( + // PathForEachAllowOnlyLines: default behavior, only allow lines. + PathForEachAllowOnlyLines PathForEachFlags = 0b0 + // PathForEachAllowQuad: allow emission of GSK_PATH_QUAD operations. + PathForEachAllowQuad PathForEachFlags = 0b1 + // PathForEachAllowCubic: allow emission of GSK_PATH_CUBIC operations. + PathForEachAllowCubic PathForEachFlags = 0b10 + // PathForEachAllowConic: allow emission of GSK_PATH_CONIC operations. + PathForEachAllowConic PathForEachFlags = 0b100 +) + +func marshalPathForEachFlags(p uintptr) (interface{}, error) { + return PathForEachFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for PathForEachFlags. +func (p PathForEachFlags) String() string { + if p == 0 { + return "PathForEachFlags(0)" + } + + var builder strings.Builder + builder.Grow(90) + + for p != 0 { + next := p & (p - 1) + bit := p - next + + switch bit { + case PathForEachAllowOnlyLines: + builder.WriteString("OnlyLines|") + case PathForEachAllowQuad: + builder.WriteString("Quad|") + case PathForEachAllowCubic: + builder.WriteString("Cubic|") + case PathForEachAllowConic: + builder.WriteString("Conic|") + default: + builder.WriteString(fmt.Sprintf("PathForEachFlags(0b%b)|", bit)) + } + + p = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if p contains other. +func (p PathForEachFlags) Has(other PathForEachFlags) bool { + return (p & other) == other +} + +// ParseErrorFunc: type of callback that is called when an error occurs during +// node deserialization. +type ParseErrorFunc func(start, end *ParseLocation, err error) + +// PathForEachFunc: prototype of the callback to iterate through the operations +// of a path. +// +// For each operation, the callback is given the op itself, the points that +// the operation is applied to in pts, and a weight for conic curves. The n_pts +// argument is somewhat redundant, since the number of points can be inferred +// from the operation. +// +// Each contour of the path starts with a GSK_PATH_MOVE operation. Closed +// contours end with a GSK_PATH_CLOSE operation. +type PathForEachFunc func(op PathOperation, pts *graphene.Point, nPts uint, weight float32) (ok bool) + +// ValueDupRenderNode retrieves the GskRenderNode stored inside the given value, +// and acquires a reference to it. +// +// The function takes the following parameters: +// +// - value: gobject.Value initialized with type GSK_TYPE_RENDER_NODE. +// +// The function returns the following values: +// +// - renderNode (optional): GskRenderNode. +func ValueDupRenderNode(value *coreglib.Value) RenderNoder { + var _arg1 *C.GValue // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C.gsk_value_dup_render_node(_arg1) + runtime.KeepAlive(value) + + var _renderNode RenderNoder // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + } + + return _renderNode +} + +// ValueGetRenderNode retrieves the GskRenderNode stored inside the given value. +// +// The function takes the following parameters: +// +// - value: GValue initialized with type GSK_TYPE_RENDER_NODE. +// +// The function returns the following values: +// +// - renderNode (optional): GskRenderNode. +func ValueGetRenderNode(value *coreglib.Value) RenderNoder { + var _arg1 *C.GValue // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C.gsk_value_get_render_node(_arg1) + runtime.KeepAlive(value) + + var _renderNode RenderNoder // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + } + + return _renderNode +} + +// ValueSetRenderNode stores the given GskRenderNode inside value. +// +// The gobject.Value will acquire a reference to the node. +// +// The function takes the following parameters: +// +// - value: gobject.Value initialized with type GSK_TYPE_RENDER_NODE. +// - node: GskRenderNode. +func ValueSetRenderNode(value *coreglib.Value, node RenderNoder) { + var _arg1 *C.GValue // out + var _arg2 *C.GskRenderNode // out + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + _arg2 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + C.gsk_value_set_render_node(_arg1, _arg2) + runtime.KeepAlive(value) + runtime.KeepAlive(node) +} + +// ValueTakeRenderNode stores the given GskRenderNode inside value. +// +// This function transfers the ownership of the node to the GValue. +// +// The function takes the following parameters: +// +// - value: gobject.Value initialized with type GSK_TYPE_RENDER_NODE. +// - node (optional): GskRenderNode. +func ValueTakeRenderNode(value *coreglib.Value, node RenderNoder) { + var _arg1 *C.GValue // out + var _arg2 *C.GskRenderNode // out + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + if node != nil { + _arg2 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(node).Native())) + } + + C.gsk_value_take_render_node(_arg1, _arg2) + runtime.KeepAlive(value) + runtime.KeepAlive(node) +} + +// BlendNode: render node applying a blending function between its two child +// nodes. +type BlendNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*BlendNode)(nil) +) + +func wrapBlendNode(obj *coreglib.Object) *BlendNode { + return &BlendNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalBlendNode(p uintptr) (interface{}, error) { + return wrapBlendNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBlendNode creates a GskRenderNode that will use blend_mode to blend the +// top node onto the bottom node. +// +// The function takes the following parameters: +// +// - bottom node to be drawn. +// - top: node to be blended onto the bottom node. +// - blendMode: blend mode to use. +// +// The function returns the following values: +// +// - blendNode: new GskRenderNode. +func NewBlendNode(bottom, top RenderNoder, blendMode BlendMode) *BlendNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.GskRenderNode // out + var _arg3 C.GskBlendMode // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(bottom).Native())) + _arg2 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(top).Native())) + _arg3 = C.GskBlendMode(blendMode) + + _cret = C.gsk_blend_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(bottom) + runtime.KeepAlive(top) + runtime.KeepAlive(blendMode) + + var _blendNode *BlendNode // out + + _blendNode = wrapBlendNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _blendNode +} + +// BlendMode retrieves the blend mode used by node. +// +// The function returns the following values: +// +// - blendMode: blend mode. +func (node *BlendNode) BlendMode() BlendMode { + var _arg0 *C.GskRenderNode // out + var _cret C.GskBlendMode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_blend_node_get_blend_mode(_arg0) + runtime.KeepAlive(node) + + var _blendMode BlendMode // out + + _blendMode = BlendMode(_cret) + + return _blendMode +} + +// BottomChild retrieves the bottom GskRenderNode child of the node. +// +// The function returns the following values: +// +// - renderNode: bottom child node. +func (node *BlendNode) BottomChild() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_blend_node_get_bottom_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// TopChild retrieves the top GskRenderNode child of the node. +// +// The function returns the following values: +// +// - renderNode: top child node. +func (node *BlendNode) TopChild() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_blend_node_get_top_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// BlurNode: render node applying a blur effect to its single child. +type BlurNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*BlurNode)(nil) +) + +func wrapBlurNode(obj *coreglib.Object) *BlurNode { + return &BlurNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalBlurNode(p uintptr) (interface{}, error) { + return wrapBlurNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBlurNode creates a render node that blurs the child. +// +// The function takes the following parameters: +// +// - child node to blur. +// - radius: blur radius. Must be positive. +// +// The function returns the following values: +// +// - blurNode: new GskRenderNode. +func NewBlurNode(child RenderNoder, radius float32) *BlurNode { + var _arg1 *C.GskRenderNode // out + var _arg2 C.float // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = C.float(radius) + + _cret = C.gsk_blur_node_new(_arg1, _arg2) + runtime.KeepAlive(child) + runtime.KeepAlive(radius) + + var _blurNode *BlurNode // out + + _blurNode = wrapBlurNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _blurNode +} + +// Child retrieves the child GskRenderNode of the blur node. +// +// The function returns the following values: +// +// - renderNode: blurred child node. +func (node *BlurNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_blur_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// Radius retrieves the blur radius of the node. +// +// The function returns the following values: +// +// - gfloat: blur radius. +func (node *BlurNode) Radius() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_blur_node_get_radius(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// BorderNode: render node for a border. +type BorderNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*BorderNode)(nil) +) + +func wrapBorderNode(obj *coreglib.Object) *BorderNode { + return &BorderNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalBorderNode(p uintptr) (interface{}, error) { + return wrapBorderNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBorderNode creates a GskRenderNode that will stroke a border rectangle +// inside the given outline. +// +// The 4 sides of the border can have different widths and colors. +// +// The function takes the following parameters: +// +// - outline: GskRoundedRect describing the outline of the border. +// - borderWidth: stroke width of the border on the top, right, bottom and +// left side respectively. +// - borderColor: color used on the top, right, bottom and left side. +// +// The function returns the following values: +// +// - borderNode: new GskRenderNode. +func NewBorderNode(outline *RoundedRect, borderWidth [4]float32, borderColor [4]gdk.RGBA) *BorderNode { + var _arg1 *C.GskRoundedRect // out + var _arg2 *C.float // out + var _arg3 *C.GdkRGBA // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(outline))) + _arg2 = (*C.float)(unsafe.Pointer(&borderWidth)) + { + var out [4]C.GdkRGBA + _arg3 = &out[0] + for i := 0; i < 4; i++ { + out[i] = *(*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer((&borderColor[i])))) + } + } + + _cret = C.gsk_border_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(outline) + runtime.KeepAlive(borderWidth) + runtime.KeepAlive(borderColor) + + var _borderNode *BorderNode // out + + _borderNode = wrapBorderNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _borderNode +} + +// Colors retrieves the colors of the border. +// +// The function returns the following values: +// +// - rgbA: array of 4 GdkRGBA structs for the top, right, bottom and left +// color of the border. +func (node *BorderNode) Colors() *gdk.RGBA { + var _arg0 *C.GskRenderNode // out + var _cret *C.GdkRGBA // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_border_node_get_colors(_arg0) + runtime.KeepAlive(node) + + var _rgbA *gdk.RGBA // out + + _rgbA = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rgbA +} + +// Outline retrieves the outline of the border. +// +// The function returns the following values: +// +// - roundedRect: outline of the border. +func (node *BorderNode) Outline() *RoundedRect { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_border_node_get_outline(_arg0) + runtime.KeepAlive(node) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// Widths retrieves the stroke widths of the border. +// +// The function returns the following values: +// +// - gfloats: array of 4 floats for the top, right, bottom and left stroke +// width of the border, respectively. +func (node *BorderNode) Widths() [4]float32 { + var _arg0 *C.GskRenderNode // out + var _cret *C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_border_node_get_widths(_arg0) + runtime.KeepAlive(node) + + var _gfloats [4]float32 // out + + _gfloats = *(*[4]float32)(unsafe.Pointer(&_cret)) + + return _gfloats +} + +// CairoNode: render node for a Cairo surface. +type CairoNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*CairoNode)(nil) +) + +func wrapCairoNode(obj *coreglib.Object) *CairoNode { + return &CairoNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalCairoNode(p uintptr) (interface{}, error) { + return wrapCairoNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewCairoNode creates a GskRenderNode that will render a cairo surface into +// the area given by bounds. +// +// You can draw to the cairo surface using gsk.CairoNode.GetDrawContext(). +// +// The function takes the following parameters: +// +// - bounds: rectangle to render to. +// +// The function returns the following values: +// +// - cairoNode: new GskRenderNode. +func NewCairoNode(bounds *graphene.Rect) *CairoNode { + var _arg1 *C.graphene_rect_t // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + + _cret = C.gsk_cairo_node_new(_arg1) + runtime.KeepAlive(bounds) + + var _cairoNode *CairoNode // out + + _cairoNode = wrapCairoNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _cairoNode +} + +// DrawContext creates a Cairo context for drawing using the surface associated +// to the render node. +// +// If no surface exists yet, a surface will be created optimized for rendering +// to renderer. +// +// The function returns the following values: +// +// - context: cairo context used for drawing; use cairo_destroy() when done +// drawing. +func (node *CairoNode) DrawContext() *cairo.Context { + var _arg0 *C.GskRenderNode // out + var _cret *C.cairo_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_cairo_node_get_draw_context(_arg0) + runtime.KeepAlive(node) + + var _context *cairo.Context // out + + _context = cairo.WrapContext(uintptr(unsafe.Pointer(_cret))) + runtime.SetFinalizer(_context, func(v *cairo.Context) { + C.cairo_destroy((*C.cairo_t)(unsafe.Pointer(v.Native()))) + }) + + return _context +} + +// Surface retrieves the Cairo surface used by the render node. +// +// The function returns the following values: +// +// - surface: cairo surface. +func (node *CairoNode) Surface() *cairo.Surface { + var _arg0 *C.GskRenderNode // out + var _cret *C.cairo_surface_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_cairo_node_get_surface(_arg0) + runtime.KeepAlive(node) + + var _surface *cairo.Surface // out + + _surface = cairo.WrapSurface(uintptr(unsafe.Pointer(_cret))) + C.cairo_surface_reference(_cret) + runtime.SetFinalizer(_surface, func(v *cairo.Surface) { + C.cairo_surface_destroy((*C.cairo_surface_t)(unsafe.Pointer(v.Native()))) + }) + + return _surface +} + +// CairoRenderer: GSK renderer that is using cairo. +// +// Since it is using cairo, this renderer cannot support 3D transformations. +type CairoRenderer struct { + _ [0]func() // equal guard + Renderer +} + +var ( + _ Rendererer = (*CairoRenderer)(nil) +) + +func wrapCairoRenderer(obj *coreglib.Object) *CairoRenderer { + return &CairoRenderer{ + Renderer: Renderer{ + Object: obj, + }, + } +} + +func marshalCairoRenderer(p uintptr) (interface{}, error) { + return wrapCairoRenderer(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewCairoRenderer creates a new Cairo renderer. +// +// The Cairo renderer is the fallback renderer drawing in ways similar to how +// GTK 3 drew its content. Its primary use is as comparison tool. +// +// The Cairo renderer is incomplete. It cannot render 3D transformed content and +// will instead render an error marker. Its usage should be avoided. +// +// The function returns the following values: +// +// - cairoRenderer: new Cairo renderer. +func NewCairoRenderer() *CairoRenderer { + var _cret *C.GskRenderer // in + + _cret = C.gsk_cairo_renderer_new() + + var _cairoRenderer *CairoRenderer // out + + _cairoRenderer = wrapCairoRenderer(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _cairoRenderer +} + +// ClipNode: render node applying a rectangular clip to its single child node. +type ClipNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*ClipNode)(nil) +) + +func wrapClipNode(obj *coreglib.Object) *ClipNode { + return &ClipNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalClipNode(p uintptr) (interface{}, error) { + return wrapClipNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewClipNode creates a GskRenderNode that will clip the child to the area +// given by clip. +// +// The function takes the following parameters: +// +// - child: node to draw. +// - clip to apply. +// +// The function returns the following values: +// +// - clipNode: new GskRenderNode. +func NewClipNode(child RenderNoder, clip *graphene.Rect) *ClipNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.graphene_rect_t // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(clip))) + + _cret = C.gsk_clip_node_new(_arg1, _arg2) + runtime.KeepAlive(child) + runtime.KeepAlive(clip) + + var _clipNode *ClipNode // out + + _clipNode = wrapClipNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _clipNode +} + +// Child gets the child node that is getting clipped by the given node. +// +// The function returns the following values: +// +// - renderNode: child that is getting clipped. +func (node *ClipNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_clip_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// Clip retrieves the clip rectangle for node. +// +// The function returns the following values: +// +// - rect: clip rectangle. +func (node *ClipNode) Clip() *graphene.Rect { + var _arg0 *C.GskRenderNode // out + var _cret *C.graphene_rect_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_clip_node_get_clip(_arg0) + runtime.KeepAlive(node) + + var _rect *graphene.Rect // out + + _rect = (*graphene.Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rect +} + +// ColorMatrixNode: render node controlling the color matrix of its single child +// node. +type ColorMatrixNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*ColorMatrixNode)(nil) +) + +func wrapColorMatrixNode(obj *coreglib.Object) *ColorMatrixNode { + return &ColorMatrixNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalColorMatrixNode(p uintptr) (interface{}, error) { + return wrapColorMatrixNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewColorMatrixNode creates a GskRenderNode that will drawn the child with +// color_matrix. +// +// In particular, the node will transform colors by applying +// +// pixel = transpose(color_matrix) * pixel + color_offset +// +// for every pixel. The transformation operates on unpremultiplied colors, +// with color components ordered R, G, B, A. +// +// The function takes the following parameters: +// +// - child: node to draw. +// - colorMatrix: matrix to apply. +// - colorOffset values to add to the color. +// +// The function returns the following values: +// +// - colorMatrixNode: new GskRenderNode. +func NewColorMatrixNode(child RenderNoder, colorMatrix *graphene.Matrix, colorOffset *graphene.Vec4) *ColorMatrixNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.graphene_matrix_t // out + var _arg3 *C.graphene_vec4_t // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(colorMatrix))) + _arg3 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(colorOffset))) + + _cret = C.gsk_color_matrix_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(child) + runtime.KeepAlive(colorMatrix) + runtime.KeepAlive(colorOffset) + + var _colorMatrixNode *ColorMatrixNode // out + + _colorMatrixNode = wrapColorMatrixNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _colorMatrixNode +} + +// Child gets the child node that is getting its colors modified by the given +// node. +// +// The function returns the following values: +// +// - renderNode: child that is getting its colors modified. +func (node *ColorMatrixNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_color_matrix_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// ColorMatrix retrieves the color matrix used by the node. +// +// The function returns the following values: +// +// - matrix: 4x4 color matrix. +func (node *ColorMatrixNode) ColorMatrix() *graphene.Matrix { + var _arg0 *C.GskRenderNode // out + var _cret *C.graphene_matrix_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_color_matrix_node_get_color_matrix(_arg0) + runtime.KeepAlive(node) + + var _matrix *graphene.Matrix // out + + _matrix = (*graphene.Matrix)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _matrix +} + +// ColorOffset retrieves the color offset used by the node. +// +// The function returns the following values: +// +// - vec4: color vector. +func (node *ColorMatrixNode) ColorOffset() *graphene.Vec4 { + var _arg0 *C.GskRenderNode // out + var _cret *C.graphene_vec4_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_color_matrix_node_get_color_offset(_arg0) + runtime.KeepAlive(node) + + var _vec4 *graphene.Vec4 // out + + _vec4 = (*graphene.Vec4)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _vec4 +} + +// ColorNode: render node for a solid color. +type ColorNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*ColorNode)(nil) +) + +func wrapColorNode(obj *coreglib.Object) *ColorNode { + return &ColorNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalColorNode(p uintptr) (interface{}, error) { + return wrapColorNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewColorNode creates a GskRenderNode that will render the color specified by +// rgba into the area given by bounds. +// +// The function takes the following parameters: +// +// - rgba: GdkRGBA specifying a color. +// - bounds: rectangle to render the color into. +// +// The function returns the following values: +// +// - colorNode: new GskRenderNode. +func NewColorNode(rgba *gdk.RGBA, bounds *graphene.Rect) *ColorNode { + var _arg1 *C.GdkRGBA // out + var _arg2 *C.graphene_rect_t // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(rgba))) + _arg2 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + + _cret = C.gsk_color_node_new(_arg1, _arg2) + runtime.KeepAlive(rgba) + runtime.KeepAlive(bounds) + + var _colorNode *ColorNode // out + + _colorNode = wrapColorNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _colorNode +} + +// Color retrieves the color of the given node. +// +// The function returns the following values: +// +// - rgbA: color of the node. +func (node *ColorNode) Color() *gdk.RGBA { + var _arg0 *C.GskRenderNode // out + var _cret *C.GdkRGBA // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_color_node_get_color(_arg0) + runtime.KeepAlive(node) + + var _rgbA *gdk.RGBA // out + + _rgbA = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rgbA +} + +// ConicGradientNode: render node for a conic gradient. +type ConicGradientNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*ConicGradientNode)(nil) +) + +func wrapConicGradientNode(obj *coreglib.Object) *ConicGradientNode { + return &ConicGradientNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalConicGradientNode(p uintptr) (interface{}, error) { + return wrapConicGradientNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewConicGradientNode creates a GskRenderNode that draws a conic gradient. +// +// The conic gradient starts around center in the direction of rotation. +// A rotation of 0 means that the gradient points up. Color stops are then added +// clockwise. +// +// The function takes the following parameters: +// +// - bounds of the node. +// - center of the gradient. +// - rotation of the gradient in degrees. +// - colorStops: pointer to an array of GskColorStop defining the gradient. +// The offsets of all color stops must be increasing. The first stop's +// offset must be >= 0 and the last stop's offset must be <= 1. +// +// The function returns the following values: +// +// - conicGradientNode: new GskRenderNode. +func NewConicGradientNode(bounds *graphene.Rect, center *graphene.Point, rotation float32, colorStops []ColorStop) *ConicGradientNode { + var _arg1 *C.graphene_rect_t // out + var _arg2 *C.graphene_point_t // out + var _arg3 C.float // out + var _arg4 *C.GskColorStop // out + var _arg5 C.gsize + var _cret *C.GskRenderNode // in + + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg2 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(center))) + _arg3 = C.float(rotation) + _arg5 = (C.gsize)(len(colorStops)) + _arg4 = (*C.GskColorStop)(C.calloc(C.size_t(len(colorStops)), C.size_t(C.sizeof_GskColorStop))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((*C.GskColorStop)(_arg4), len(colorStops)) + for i := range colorStops { + out[i] = *(*C.GskColorStop)(gextras.StructNative(unsafe.Pointer((&colorStops[i])))) + } + } + + _cret = C.gsk_conic_gradient_node_new(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(bounds) + runtime.KeepAlive(center) + runtime.KeepAlive(rotation) + runtime.KeepAlive(colorStops) + + var _conicGradientNode *ConicGradientNode // out + + _conicGradientNode = wrapConicGradientNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _conicGradientNode +} + +// Angle retrieves the angle for the gradient in radians, normalized in [0, +// 2 * PI]. +// +// The angle is starting at the top and going clockwise, as expressed in the css +// specification: +// +// angle = 90 - gsk_conic_gradient_node_get_rotation(). +// +// The function returns the following values: +// +// - gfloat: angle for the gradient. +func (node *ConicGradientNode) Angle() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_conic_gradient_node_get_angle(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Center retrieves the center pointer for the gradient. +// +// The function returns the following values: +// +// - point: center point for the gradient. +func (node *ConicGradientNode) Center() *graphene.Point { + var _arg0 *C.GskRenderNode // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_conic_gradient_node_get_center(_arg0) + runtime.KeepAlive(node) + + var _point *graphene.Point // out + + _point = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// ColorStops retrieves the color stops in the gradient. +// +// The function returns the following values: +// +// - colorStops: color stops in the gradient. +func (node *ConicGradientNode) ColorStops() []ColorStop { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskColorStop // in + var _arg1 C.gsize // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_conic_gradient_node_get_color_stops(_arg0, &_arg1) + runtime.KeepAlive(node) + + var _colorStops []ColorStop // out + + { + src := unsafe.Slice((*C.GskColorStop)(_cret), _arg1) + _colorStops = make([]ColorStop, _arg1) + for i := 0; i < int(_arg1); i++ { + _colorStops[i] = *(*ColorStop)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + + return _colorStops +} + +// NColorStops retrieves the number of color stops in the gradient. +// +// The function returns the following values: +// +// - gsize: number of color stops. +func (node *ConicGradientNode) NColorStops() uint { + var _arg0 *C.GskRenderNode // out + var _cret C.gsize // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_conic_gradient_node_get_n_color_stops(_arg0) + runtime.KeepAlive(node) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Rotation retrieves the rotation for the gradient in degrees. +// +// The function returns the following values: +// +// - gfloat: rotation for the gradient. +func (node *ConicGradientNode) Rotation() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_conic_gradient_node_get_rotation(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// ContainerNode: render node that can contain other render nodes. +type ContainerNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*ContainerNode)(nil) +) + +func wrapContainerNode(obj *coreglib.Object) *ContainerNode { + return &ContainerNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalContainerNode(p uintptr) (interface{}, error) { + return wrapContainerNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewContainerNode creates a new GskRenderNode instance for holding the given +// children. +// +// The new node will acquire a reference to each of the children. +// +// The function takes the following parameters: +// +// - children of the node. +// +// The function returns the following values: +// +// - containerNode: new GskRenderNode. +func NewContainerNode(children []RenderNoder) *ContainerNode { + var _arg1 **C.GskRenderNode // out + var _arg2 C.guint + var _cret *C.GskRenderNode // in + + _arg2 = (C.guint)(len(children)) + _arg1 = (**C.GskRenderNode)(C.calloc(C.size_t(len(children)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice((**C.GskRenderNode)(_arg1), len(children)) + for i := range children { + out[i] = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(children[i]).Native())) + } + } + + _cret = C.gsk_container_node_new(_arg1, _arg2) + runtime.KeepAlive(children) + + var _containerNode *ContainerNode // out + + _containerNode = wrapContainerNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _containerNode +} + +// Child gets one of the children of container. +// +// The function takes the following parameters: +// +// - idx: position of the child to get. +// +// The function returns the following values: +// +// - renderNode: idx'th child of container. +func (node *ContainerNode) Child(idx uint) RenderNoder { + var _arg0 *C.GskRenderNode // out + var _arg1 C.guint // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + _arg1 = C.guint(idx) + + _cret = C.gsk_container_node_get_child(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(idx) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// NChildren retrieves the number of direct children of node. +// +// The function returns the following values: +// +// - guint: number of children of the GskRenderNode. +func (node *ContainerNode) NChildren() uint { + var _arg0 *C.GskRenderNode // out + var _cret C.guint // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_container_node_get_n_children(_arg0) + runtime.KeepAlive(node) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// CrossFadeNode: render node cross fading between two child nodes. +type CrossFadeNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*CrossFadeNode)(nil) +) + +func wrapCrossFadeNode(obj *coreglib.Object) *CrossFadeNode { + return &CrossFadeNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalCrossFadeNode(p uintptr) (interface{}, error) { + return wrapCrossFadeNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewCrossFadeNode creates a GskRenderNode that will do a cross-fade between +// start and end. +// +// The function takes the following parameters: +// +// - start node to be drawn. +// - end: node to be cross_fadeed onto the start node. +// - progress: how far the fade has progressed from start to end. The value +// will be clamped to the range [0 ... 1]. +// +// The function returns the following values: +// +// - crossFadeNode: new GskRenderNode. +func NewCrossFadeNode(start, end RenderNoder, progress float32) *CrossFadeNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.GskRenderNode // out + var _arg3 C.float // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(start).Native())) + _arg2 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(end).Native())) + _arg3 = C.float(progress) + + _cret = C.gsk_cross_fade_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(start) + runtime.KeepAlive(end) + runtime.KeepAlive(progress) + + var _crossFadeNode *CrossFadeNode // out + + _crossFadeNode = wrapCrossFadeNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _crossFadeNode +} + +// EndChild retrieves the child GskRenderNode at the end of the cross-fade. +// +// The function returns the following values: +// +// - renderNode: GskRenderNode. +func (node *CrossFadeNode) EndChild() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_cross_fade_node_get_end_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// Progress retrieves the progress value of the cross fade. +// +// The function returns the following values: +// +// - gfloat progress value, between 0 and 1. +func (node *CrossFadeNode) Progress() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_cross_fade_node_get_progress(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// StartChild retrieves the child GskRenderNode at the beginning of the +// cross-fade. +// +// The function returns the following values: +// +// - renderNode: GskRenderNode. +func (node *CrossFadeNode) StartChild() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_cross_fade_node_get_start_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// DebugNode: render node that emits a debugging message when drawing its child +// node. +type DebugNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*DebugNode)(nil) +) + +func wrapDebugNode(obj *coreglib.Object) *DebugNode { + return &DebugNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalDebugNode(p uintptr) (interface{}, error) { + return wrapDebugNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewDebugNode creates a GskRenderNode that will add debug information about +// the given child. +// +// Adding this node has no visual effect. +// +// The function takes the following parameters: +// +// - child to add debug info for. +// - message: debug message. +// +// The function returns the following values: +// +// - debugNode: new GskRenderNode. +func NewDebugNode(child RenderNoder, message string) *DebugNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.char // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(message))) + + _cret = C.gsk_debug_node_new(_arg1, _arg2) + runtime.KeepAlive(child) + runtime.KeepAlive(message) + + var _debugNode *DebugNode // out + + _debugNode = wrapDebugNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _debugNode +} + +// Child gets the child node that is getting drawn by the given node. +// +// The function returns the following values: +// +// - renderNode: child GskRenderNode. +func (node *DebugNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_debug_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// Message gets the debug message that was set on this node. +// +// The function returns the following values: +// +// - utf8: debug message. +func (node *DebugNode) Message() string { + var _arg0 *C.GskRenderNode // out + var _cret *C.char // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_debug_node_get_message(_arg0) + runtime.KeepAlive(node) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// FillNode: render node filling the area given by gsk.Path and gsk.FillRule +// with the child node. +type FillNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*FillNode)(nil) +) + +func wrapFillNode(obj *coreglib.Object) *FillNode { + return &FillNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalFillNode(p uintptr) (interface{}, error) { + return wrapFillNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewFillNode creates a GskRenderNode that will fill the child in the area +// given by path and fill_rule. +// +// The function takes the following parameters: +// +// - child: node to fill the area with. +// - path describing the area to fill. +// - fillRule: fill rule to use. +// +// The function returns the following values: +// +// - fillNode: new GskRenderNode. +func NewFillNode(child RenderNoder, path *Path, fillRule FillRule) *FillNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.GskPath // out + var _arg3 C.GskFillRule // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + _arg3 = C.GskFillRule(fillRule) + + _cret = C.gsk_fill_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(child) + runtime.KeepAlive(path) + runtime.KeepAlive(fillRule) + + var _fillNode *FillNode // out + + _fillNode = wrapFillNode(coreglib.Take(unsafe.Pointer(_cret))) + + return _fillNode +} + +// Child gets the child node that is getting drawn by the given node. +// +// The function returns the following values: +// +// - renderNode: child that is getting drawn. +func (node *FillNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_fill_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// FillRule retrieves the fill rule used to determine how the path is filled. +// +// The function returns the following values: +// +// - fillRule: GskFillRule. +func (node *FillNode) FillRule() FillRule { + var _arg0 *C.GskRenderNode // out + var _cret C.GskFillRule // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_fill_node_get_fill_rule(_arg0) + runtime.KeepAlive(node) + + var _fillRule FillRule // out + + _fillRule = FillRule(_cret) + + return _fillRule +} + +// Path retrieves the path used to describe the area filled with the contents of +// the node. +// +// The function returns the following values: +// +// - path: GskPath. +func (node *FillNode) Path() *Path { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskPath // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_fill_node_get_path(_arg0) + runtime.KeepAlive(node) + + var _path *Path // out + + _path = (*Path)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gsk_path_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_path)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_path_unref((*C.GskPath)(intern.C)) + }, + ) + + return _path +} + +// GLShaderOverrides contains methods that are overridable. +type GLShaderOverrides struct { +} + +func defaultGLShaderOverrides(v *GLShader) GLShaderOverrides { + return GLShaderOverrides{} +} + +// GLShader: GskGLShader is a snippet of GLSL that is meant to run in the +// fragment shader of the rendering pipeline. +// +// A fragment shader gets the coordinates being rendered as input and produces +// the pixel values for that particular pixel. Additionally, the shader can +// declare a set of other input arguments, called uniforms (as they are uniform +// over all the calls to your shader in each instance of use). A shader can also +// receive up to 4 textures that it can use as input when producing the pixel +// data. +// +// GskGLShader is usually used with gtk_snapshot_push_gl_shader() to produce a +// gsk.GLShaderNode in the rendering hierarchy, and then its input textures are +// constructed by rendering the child nodes to textures before rendering the +// shader node itself. (You can pass texture nodes as children if you want to +// directly use a texture as input). +// +// The actual shader code is GLSL code that gets combined with some other code +// into the fragment shader. Since the exact capabilities of the GPU driver +// differs between different OpenGL drivers and hardware, GTK adds some defines +// that you can use to ensure your GLSL code runs on as many drivers as it can. +// +// If the OpenGL driver is GLES, then the shader language version is set to 100, +// and GSK_GLES will be defined in the shader. +// +// Otherwise, if the OpenGL driver does not support the 3.2 core profile, +// then the shader will run with language version 110 for GL2 and 130 for GL3, +// and GSK_LEGACY will be defined in the shader. +// +// If the OpenGL driver supports the 3.2 code profile, it will be used, +// the shader language version is set to 150, and GSK_GL3 will be defined in the +// shader. +// +// The main function the shader must implement is: +// +// void mainImage(out vec4 fragColor, +// in vec2 fragCoord, +// in vec2 resolution, +// in vec2 uv) +// +// Where the input fragCoord is the coordinate of the pixel we're currently +// rendering, relative to the boundary rectangle that was specified in the +// GskGLShaderNode, and resolution is the width and height of that rectangle. +// This is in the typical GTK coordinate system with the origin in the top left. +// uv contains the u and v coordinates that can be used to index a texture at +// the corresponding point. These coordinates are in the [0..1]x[0..1] region, +// with 0, 0 being in the lower left corder (which is typical for OpenGL). +// +// The output fragColor should be a RGBA color (with premultiplied alpha) that +// will be used as the output for the specified pixel location. Note that this +// output will be automatically clipped to the clip region of the glshader node. +// +// In addition to the function arguments the shader can define up to 4 uniforms +// for textures which must be called u_textureN (i.e. u_texture1 to u_texture4) +// as well as any custom uniforms you want of types int, uint, bool, float, +// vec2, vec3 or vec4. +// +// All textures sources contain premultiplied alpha colors, but if some there +// are outer sources of colors there is a gsk_premultiply() helper to compute +// premultiplication when needed. +// +// Note that GTK parses the uniform declarations, so each uniform has to be on a +// line by itself with no other code, like so: +// +// uniform float u_time; +// uniform vec3 u_color; +// uniform sampler2D u_texture1; +// uniform sampler2D u_texture2; +// +// GTK uses the "gsk" namespace in the symbols it uses in the shader, so your +// code should not use any symbols with the prefix gsk or GSK. There are some +// helper functions declared that you can use: +// +// vec4 GskTexture(sampler2D sampler, vec2 texCoords); +// +// This samples a texture (e.g. u_texture1) at the specified coordinates, and +// contains some helper ifdefs to ensure that it works on all OpenGL versions. +// +// You can compile the shader yourself using gsk.GLShader.Compile(), otherwise +// the GSK renderer will do it when it handling the glshader node. If errors +// occurs, the returned error will include the glsl sources, so you can see +// what GSK was passing to the compiler. You can also set GSK_DEBUG=shaders in +// the environment to see the sources and other relevant information about all +// shaders that GSK is handling. +// +// An example shader +// +// uniform float position; +// uniform sampler2D u_texture1; +// uniform sampler2D u_texture2; +// +// void mainImage(out vec4 fragColor, +// in vec2 fragCoord, +// in vec2 resolution, +// in vec2 uv) { +// vec4 source1 = GskTexture(u_texture1, uv); +// vec4 source2 = GskTexture(u_texture2, uv); +// +// fragColor = position * source1 + (1.0 - position) * source2; +// }. +type GLShader struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*GLShader)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*GLShader, *GLShaderClass, GLShaderOverrides]( + GTypeGLShader, + initGLShaderClass, + wrapGLShader, + defaultGLShaderOverrides, + ) +} + +func initGLShaderClass(gclass unsafe.Pointer, overrides GLShaderOverrides, classInitFunc func(*GLShaderClass)) { + if classInitFunc != nil { + class := (*GLShaderClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapGLShader(obj *coreglib.Object) *GLShader { + return &GLShader{ + Object: obj, + } +} + +func marshalGLShader(p uintptr) (interface{}, error) { + return wrapGLShader(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewGLShaderFromBytes creates a GskGLShader that will render pixels using the +// specified code. +// +// The function takes the following parameters: +// +// - sourcecode: GLSL sourcecode for the shader, as a GBytes. +// +// The function returns the following values: +// +// - glShader: new GskGLShader. +func NewGLShaderFromBytes(sourcecode *glib.Bytes) *GLShader { + var _arg1 *C.GBytes // out + var _cret *C.GskGLShader // in + + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(sourcecode))) + + _cret = C.gsk_gl_shader_new_from_bytes(_arg1) + runtime.KeepAlive(sourcecode) + + var _glShader *GLShader // out + + _glShader = wrapGLShader(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _glShader +} + +// NewGLShaderFromResource creates a GskGLShader that will render pixels using +// the specified code. +// +// The function takes the following parameters: +// +// - resourcePath: path to a resource that contains the GLSL sourcecode for +// the shader. +// +// The function returns the following values: +// +// - glShader: new GskGLShader. +func NewGLShaderFromResource(resourcePath string) *GLShader { + var _arg1 *C.char // out + var _cret *C.GskGLShader // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(resourcePath))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gsk_gl_shader_new_from_resource(_arg1) + runtime.KeepAlive(resourcePath) + + var _glShader *GLShader // out + + _glShader = wrapGLShader(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _glShader +} + +// Compile tries to compile the shader for the given renderer. +// +// If there is a problem, this function returns FALSE and reports an error. +// You should use this function before relying on the shader for rendering and +// use a fallback with a simpler shader or without shaders if it fails. +// +// Note that this will modify the rendering state (for example change the +// current GL context) and requires the renderer to be set up. This means +// that the widget has to be realized. Commonly you want to call this from the +// realize signal of a widget, or during widget snapshot. +// +// The function takes the following parameters: +// +// - renderer: GskRenderer. +func (shader *GLShader) Compile(renderer Rendererer) error { + var _arg0 *C.GskGLShader // out + var _arg1 *C.GskRenderer // out + var _cerr *C.GError // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = (*C.GskRenderer)(unsafe.Pointer(coreglib.InternObject(renderer).Native())) + + C.gsk_gl_shader_compile(_arg0, _arg1, &_cerr) + runtime.KeepAlive(shader) + runtime.KeepAlive(renderer) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// FindUniformByName looks for a uniform by the name name, and returns the index +// of the uniform, or -1 if it was not found. +// +// The function takes the following parameters: +// +// - name: uniform name. +// +// The function returns the following values: +// +// - gint: index of the uniform, or -1. +func (shader *GLShader) FindUniformByName(name string) int { + var _arg0 *C.GskGLShader // out + var _arg1 *C.char // out + var _cret C.int // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gsk_gl_shader_find_uniform_by_name(_arg0, _arg1) + runtime.KeepAlive(shader) + runtime.KeepAlive(name) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// ArgBool gets the value of the uniform idx in the args block. +// +// The uniform must be of bool type. +// +// The function takes the following parameters: +// +// - args: uniform arguments. +// - idx: index of the uniform. +// +// The function returns the following values: +// +// - ok: value. +func (shader *GLShader) ArgBool(args *glib.Bytes, idx int) bool { + var _arg0 *C.GskGLShader // out + var _arg1 *C.GBytes // out + var _arg2 C.int // out + var _cret C.gboolean // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(args))) + _arg2 = C.int(idx) + + _cret = C.gsk_gl_shader_get_arg_bool(_arg0, _arg1, _arg2) + runtime.KeepAlive(shader) + runtime.KeepAlive(args) + runtime.KeepAlive(idx) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ArgFloat gets the value of the uniform idx in the args block. +// +// The uniform must be of float type. +// +// The function takes the following parameters: +// +// - args: uniform arguments. +// - idx: index of the uniform. +// +// The function returns the following values: +// +// - gfloat: value. +func (shader *GLShader) ArgFloat(args *glib.Bytes, idx int) float32 { + var _arg0 *C.GskGLShader // out + var _arg1 *C.GBytes // out + var _arg2 C.int // out + var _cret C.float // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(args))) + _arg2 = C.int(idx) + + _cret = C.gsk_gl_shader_get_arg_float(_arg0, _arg1, _arg2) + runtime.KeepAlive(shader) + runtime.KeepAlive(args) + runtime.KeepAlive(idx) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// ArgInt gets the value of the uniform idx in the args block. +// +// The uniform must be of int type. +// +// The function takes the following parameters: +// +// - args: uniform arguments. +// - idx: index of the uniform. +// +// The function returns the following values: +// +// - gint32: value. +func (shader *GLShader) ArgInt(args *glib.Bytes, idx int) int32 { + var _arg0 *C.GskGLShader // out + var _arg1 *C.GBytes // out + var _arg2 C.int // out + var _cret C.gint32 // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(args))) + _arg2 = C.int(idx) + + _cret = C.gsk_gl_shader_get_arg_int(_arg0, _arg1, _arg2) + runtime.KeepAlive(shader) + runtime.KeepAlive(args) + runtime.KeepAlive(idx) + + var _gint32 int32 // out + + _gint32 = int32(_cret) + + return _gint32 +} + +// ArgUint gets the value of the uniform idx in the args block. +// +// The uniform must be of uint type. +// +// The function takes the following parameters: +// +// - args: uniform arguments. +// - idx: index of the uniform. +// +// The function returns the following values: +// +// - guint32: value. +func (shader *GLShader) ArgUint(args *glib.Bytes, idx int) uint32 { + var _arg0 *C.GskGLShader // out + var _arg1 *C.GBytes // out + var _arg2 C.int // out + var _cret C.guint32 // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(args))) + _arg2 = C.int(idx) + + _cret = C.gsk_gl_shader_get_arg_uint(_arg0, _arg1, _arg2) + runtime.KeepAlive(shader) + runtime.KeepAlive(args) + runtime.KeepAlive(idx) + + var _guint32 uint32 // out + + _guint32 = uint32(_cret) + + return _guint32 +} + +// ArgVec2 gets the value of the uniform idx in the args block. +// +// The uniform must be of vec2 type. +// +// The function takes the following parameters: +// +// - args: uniform arguments. +// - idx: index of the uniform. +// - outValue: location to store the uniform value in. +func (shader *GLShader) ArgVec2(args *glib.Bytes, idx int, outValue *graphene.Vec2) { + var _arg0 *C.GskGLShader // out + var _arg1 *C.GBytes // out + var _arg2 C.int // out + var _arg3 *C.graphene_vec2_t // out + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(args))) + _arg2 = C.int(idx) + _arg3 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(outValue))) + + C.gsk_gl_shader_get_arg_vec2(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(shader) + runtime.KeepAlive(args) + runtime.KeepAlive(idx) + runtime.KeepAlive(outValue) +} + +// ArgVec3 gets the value of the uniform idx in the args block. +// +// The uniform must be of vec3 type. +// +// The function takes the following parameters: +// +// - args: uniform arguments. +// - idx: index of the uniform. +// - outValue: location to store the uniform value in. +func (shader *GLShader) ArgVec3(args *glib.Bytes, idx int, outValue *graphene.Vec3) { + var _arg0 *C.GskGLShader // out + var _arg1 *C.GBytes // out + var _arg2 C.int // out + var _arg3 *C.graphene_vec3_t // out + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(args))) + _arg2 = C.int(idx) + _arg3 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(outValue))) + + C.gsk_gl_shader_get_arg_vec3(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(shader) + runtime.KeepAlive(args) + runtime.KeepAlive(idx) + runtime.KeepAlive(outValue) +} + +// ArgVec4 gets the value of the uniform idx in the args block. +// +// The uniform must be of vec4 type. +// +// The function takes the following parameters: +// +// - args: uniform arguments. +// - idx: index of the uniform. +// - outValue: location to store set the uniform value in. +func (shader *GLShader) ArgVec4(args *glib.Bytes, idx int, outValue *graphene.Vec4) { + var _arg0 *C.GskGLShader // out + var _arg1 *C.GBytes // out + var _arg2 C.int // out + var _arg3 *C.graphene_vec4_t // out + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(args))) + _arg2 = C.int(idx) + _arg3 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(outValue))) + + C.gsk_gl_shader_get_arg_vec4(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(shader) + runtime.KeepAlive(args) + runtime.KeepAlive(idx) + runtime.KeepAlive(outValue) +} + +// ArgsSize: get the size of the data block used to specify arguments for this +// shader. +// +// The function returns the following values: +// +// - gsize: size of the data block. +func (shader *GLShader) ArgsSize() uint { + var _arg0 *C.GskGLShader // out + var _cret C.gsize // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + + _cret = C.gsk_gl_shader_get_args_size(_arg0) + runtime.KeepAlive(shader) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// NTextures returns the number of textures that the shader requires. +// +// This can be used to check that the a passed shader works in your usecase. +// It is determined by looking at the highest u_textureN value that the shader +// defines. +// +// The function returns the following values: +// +// - gint: number of texture inputs required by shader. +func (shader *GLShader) NTextures() int { + var _arg0 *C.GskGLShader // out + var _cret C.int // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + + _cret = C.gsk_gl_shader_get_n_textures(_arg0) + runtime.KeepAlive(shader) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// NUniforms: get the number of declared uniforms for this shader. +// +// The function returns the following values: +// +// - gint: number of declared uniforms. +func (shader *GLShader) NUniforms() int { + var _arg0 *C.GskGLShader // out + var _cret C.int // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + + _cret = C.gsk_gl_shader_get_n_uniforms(_arg0) + runtime.KeepAlive(shader) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Resource gets the resource path for the GLSL sourcecode being used to render +// this shader. +// +// The function returns the following values: +// +// - utf8 (optional): resource path for the shader. +func (shader *GLShader) Resource() string { + var _arg0 *C.GskGLShader // out + var _cret *C.char // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + + _cret = C.gsk_gl_shader_get_resource(_arg0) + runtime.KeepAlive(shader) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Source gets the GLSL sourcecode being used to render this shader. +// +// The function returns the following values: +// +// - bytes: source code for the shader. +func (shader *GLShader) Source() *glib.Bytes { + var _arg0 *C.GskGLShader // out + var _cret *C.GBytes // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + + _cret = C.gsk_gl_shader_get_source(_arg0) + runtime.KeepAlive(shader) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_bytes_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// UniformName: get the name of the declared uniform for this shader at index +// idx. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// +// The function returns the following values: +// +// - utf8: name of the declared uniform. +func (shader *GLShader) UniformName(idx int) string { + var _arg0 *C.GskGLShader // out + var _arg1 C.int // out + var _cret *C.char // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = C.int(idx) + + _cret = C.gsk_gl_shader_get_uniform_name(_arg0, _arg1) + runtime.KeepAlive(shader) + runtime.KeepAlive(idx) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// UniformOffset: get the offset into the data block where data for this +// uniforms is stored. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// +// The function returns the following values: +// +// - gint: data offset. +func (shader *GLShader) UniformOffset(idx int) int { + var _arg0 *C.GskGLShader // out + var _arg1 C.int // out + var _cret C.int // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = C.int(idx) + + _cret = C.gsk_gl_shader_get_uniform_offset(_arg0, _arg1) + runtime.KeepAlive(shader) + runtime.KeepAlive(idx) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// UniformType: get the type of the declared uniform for this shader at index +// idx. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// +// The function returns the following values: +// +// - glUniformType: type of the declared uniform. +func (shader *GLShader) UniformType(idx int) GLUniformType { + var _arg0 *C.GskGLShader // out + var _arg1 C.int // out + var _cret C.GskGLUniformType // in + + _arg0 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg1 = C.int(idx) + + _cret = C.gsk_gl_shader_get_uniform_type(_arg0, _arg1) + runtime.KeepAlive(shader) + runtime.KeepAlive(idx) + + var _glUniformType GLUniformType // out + + _glUniformType = GLUniformType(_cret) + + return _glUniformType +} + +// GLShaderNode: render node using a GL shader when drawing its children nodes. +type GLShaderNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*GLShaderNode)(nil) +) + +func wrapGLShaderNode(obj *coreglib.Object) *GLShaderNode { + return &GLShaderNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalGLShaderNode(p uintptr) (interface{}, error) { + return wrapGLShaderNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewGLShaderNode creates a GskRenderNode that will render the given shader +// into the area given by bounds. +// +// The args is a block of data to use for uniform input, as per types +// and offsets defined by the shader. Normally this is generated by +// gsk.GLShader.FormatArgs() or gsk.ShaderArgsBuilder. +// +// See gsk.GLShader for details about how the shader should be written. +// +// All the children will be rendered into textures (if they aren't already +// GskTextureNodes, which will be used directly). These textures will be sent as +// input to the shader. +// +// If the renderer doesn't support GL shaders, or if there is any problem +// when compiling the shader, then the node will draw pink. You should use +// gsk.GLShader.Compile() to ensure the shader will work for the renderer before +// using it. +// +// The function takes the following parameters: +// +// - shader: GskGLShader. +// - bounds: rectangle to render the shader into. +// - args arguments for the uniforms. +// - children (optional): array of child nodes, these will be rendered to +// textures and used as input. +// +// The function returns the following values: +// +// - glShaderNode: new GskRenderNode. +func NewGLShaderNode(shader *GLShader, bounds *graphene.Rect, args *glib.Bytes, children []RenderNoder) *GLShaderNode { + var _arg1 *C.GskGLShader // out + var _arg2 *C.graphene_rect_t // out + var _arg3 *C.GBytes // out + var _arg4 **C.GskRenderNode // out + var _arg5 C.guint + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + _arg2 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg3 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(args))) + if children != nil { + _arg5 = (C.guint)(len(children)) + _arg4 = (**C.GskRenderNode)(C.calloc(C.size_t(len(children)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((**C.GskRenderNode)(_arg4), len(children)) + for i := range children { + out[i] = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(children[i]).Native())) + } + } + } + + _cret = C.gsk_gl_shader_node_new(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(shader) + runtime.KeepAlive(bounds) + runtime.KeepAlive(args) + runtime.KeepAlive(children) + + var _glShaderNode *GLShaderNode // out + + _glShaderNode = wrapGLShaderNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _glShaderNode +} + +// Args gets args for the node. +// +// The function returns the following values: +// +// - bytes: GBytes with the uniform arguments. +func (node *GLShaderNode) Args() *glib.Bytes { + var _arg0 *C.GskRenderNode // out + var _cret *C.GBytes // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_gl_shader_node_get_args(_arg0) + runtime.KeepAlive(node) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_bytes_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// Child gets one of the children. +// +// The function takes the following parameters: +// +// - idx: position of the child to get. +// +// The function returns the following values: +// +// - renderNode: idx'th child of node. +func (node *GLShaderNode) Child(idx uint) RenderNoder { + var _arg0 *C.GskRenderNode // out + var _arg1 C.guint // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + _arg1 = C.guint(idx) + + _cret = C.gsk_gl_shader_node_get_child(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(idx) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// NChildren returns the number of children. +// +// The function returns the following values: +// +// - guint: number of children. +func (node *GLShaderNode) NChildren() uint { + var _arg0 *C.GskRenderNode // out + var _cret C.guint // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_gl_shader_node_get_n_children(_arg0) + runtime.KeepAlive(node) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Shader gets shader code for the node. +// +// The function returns the following values: +// +// - glShader: GskGLShader shader. +func (node *GLShaderNode) Shader() *GLShader { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskGLShader // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_gl_shader_node_get_shader(_arg0) + runtime.KeepAlive(node) + + var _glShader *GLShader // out + + _glShader = wrapGLShader(coreglib.Take(unsafe.Pointer(_cret))) + + return _glShader +} + +// InsetShadowNode: render node for an inset shadow. +type InsetShadowNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*InsetShadowNode)(nil) +) + +func wrapInsetShadowNode(obj *coreglib.Object) *InsetShadowNode { + return &InsetShadowNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalInsetShadowNode(p uintptr) (interface{}, error) { + return wrapInsetShadowNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewInsetShadowNode creates a GskRenderNode that will render an inset shadow +// into the box given by outline. +// +// The function takes the following parameters: +// +// - outline of the region containing the shadow. +// - color of the shadow. +// - dx: horizontal offset of shadow. +// - dy: vertical offset of shadow. +// - spread: how far the shadow spreads towards the inside. +// - blurRadius: how much blur to apply to the shadow. +// +// The function returns the following values: +// +// - insetShadowNode: new GskRenderNode. +func NewInsetShadowNode(outline *RoundedRect, color *gdk.RGBA, dx, dy, spread, blurRadius float32) *InsetShadowNode { + var _arg1 *C.GskRoundedRect // out + var _arg2 *C.GdkRGBA // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + var _arg6 C.float // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(outline))) + _arg2 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(color))) + _arg3 = C.float(dx) + _arg4 = C.float(dy) + _arg5 = C.float(spread) + _arg6 = C.float(blurRadius) + + _cret = C.gsk_inset_shadow_node_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(outline) + runtime.KeepAlive(color) + runtime.KeepAlive(dx) + runtime.KeepAlive(dy) + runtime.KeepAlive(spread) + runtime.KeepAlive(blurRadius) + + var _insetShadowNode *InsetShadowNode // out + + _insetShadowNode = wrapInsetShadowNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _insetShadowNode +} + +// BlurRadius retrieves the blur radius to apply to the shadow. +// +// The function returns the following values: +// +// - gfloat: blur radius, in pixels. +func (node *InsetShadowNode) BlurRadius() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_inset_shadow_node_get_blur_radius(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Color retrieves the color of the inset shadow. +// +// The function returns the following values: +// +// - rgbA: color of the shadow. +func (node *InsetShadowNode) Color() *gdk.RGBA { + var _arg0 *C.GskRenderNode // out + var _cret *C.GdkRGBA // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_inset_shadow_node_get_color(_arg0) + runtime.KeepAlive(node) + + var _rgbA *gdk.RGBA // out + + _rgbA = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rgbA +} + +// Dx retrieves the horizontal offset of the inset shadow. +// +// The function returns the following values: +// +// - gfloat: offset, in pixels. +func (node *InsetShadowNode) Dx() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_inset_shadow_node_get_dx(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Dy retrieves the vertical offset of the inset shadow. +// +// The function returns the following values: +// +// - gfloat: offset, in pixels. +func (node *InsetShadowNode) Dy() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_inset_shadow_node_get_dy(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Outline retrieves the outline rectangle of the inset shadow. +// +// The function returns the following values: +// +// - roundedRect: rounded rectangle. +func (node *InsetShadowNode) Outline() *RoundedRect { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_inset_shadow_node_get_outline(_arg0) + runtime.KeepAlive(node) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// Spread retrieves how much the shadow spreads inwards. +// +// The function returns the following values: +// +// - gfloat: size of the shadow, in pixels. +func (node *InsetShadowNode) Spread() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_inset_shadow_node_get_spread(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// LinearGradientNode: render node for a linear gradient. +type LinearGradientNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*LinearGradientNode)(nil) +) + +func wrapLinearGradientNode(obj *coreglib.Object) *LinearGradientNode { + return &LinearGradientNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalLinearGradientNode(p uintptr) (interface{}, error) { + return wrapLinearGradientNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewLinearGradientNode creates a GskRenderNode that will create a linear +// gradient from the given points and color stops, and render that into the area +// given by bounds. +// +// The function takes the following parameters: +// +// - bounds: rectangle to render the linear gradient into. +// - start: point at which the linear gradient will begin. +// - end: point at which the linear gradient will finish. +// - colorStops: pointer to an array of GskColorStop defining the gradient. +// The offsets of all color stops must be increasing. The first stop's +// offset must be >= 0 and the last stop's offset must be <= 1. +// +// The function returns the following values: +// +// - linearGradientNode: new GskRenderNode. +func NewLinearGradientNode(bounds *graphene.Rect, start, end *graphene.Point, colorStops []ColorStop) *LinearGradientNode { + var _arg1 *C.graphene_rect_t // out + var _arg2 *C.graphene_point_t // out + var _arg3 *C.graphene_point_t // out + var _arg4 *C.GskColorStop // out + var _arg5 C.gsize + var _cret *C.GskRenderNode // in + + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg2 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(start))) + _arg3 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(end))) + _arg5 = (C.gsize)(len(colorStops)) + _arg4 = (*C.GskColorStop)(C.calloc(C.size_t(len(colorStops)), C.size_t(C.sizeof_GskColorStop))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((*C.GskColorStop)(_arg4), len(colorStops)) + for i := range colorStops { + out[i] = *(*C.GskColorStop)(gextras.StructNative(unsafe.Pointer((&colorStops[i])))) + } + } + + _cret = C.gsk_linear_gradient_node_new(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(bounds) + runtime.KeepAlive(start) + runtime.KeepAlive(end) + runtime.KeepAlive(colorStops) + + var _linearGradientNode *LinearGradientNode // out + + _linearGradientNode = wrapLinearGradientNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _linearGradientNode +} + +// ColorStops retrieves the color stops in the gradient. +// +// The function returns the following values: +// +// - colorStops: color stops in the gradient. +func (node *LinearGradientNode) ColorStops() []ColorStop { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskColorStop // in + var _arg1 C.gsize // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_linear_gradient_node_get_color_stops(_arg0, &_arg1) + runtime.KeepAlive(node) + + var _colorStops []ColorStop // out + + { + src := unsafe.Slice((*C.GskColorStop)(_cret), _arg1) + _colorStops = make([]ColorStop, _arg1) + for i := 0; i < int(_arg1); i++ { + _colorStops[i] = *(*ColorStop)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + + return _colorStops +} + +// End retrieves the final point of the linear gradient. +// +// The function returns the following values: +// +// - point: final point. +func (node *LinearGradientNode) End() *graphene.Point { + var _arg0 *C.GskRenderNode // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_linear_gradient_node_get_end(_arg0) + runtime.KeepAlive(node) + + var _point *graphene.Point // out + + _point = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// NColorStops retrieves the number of color stops in the gradient. +// +// The function returns the following values: +// +// - gsize: number of color stops. +func (node *LinearGradientNode) NColorStops() uint { + var _arg0 *C.GskRenderNode // out + var _cret C.gsize // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_linear_gradient_node_get_n_color_stops(_arg0) + runtime.KeepAlive(node) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Start retrieves the initial point of the linear gradient. +// +// The function returns the following values: +// +// - point: initial point. +func (node *LinearGradientNode) Start() *graphene.Point { + var _arg0 *C.GskRenderNode // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_linear_gradient_node_get_start(_arg0) + runtime.KeepAlive(node) + + var _point *graphene.Point // out + + _point = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// MaskNode: render node masking one child node with another. +type MaskNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*MaskNode)(nil) +) + +func wrapMaskNode(obj *coreglib.Object) *MaskNode { + return &MaskNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalMaskNode(p uintptr) (interface{}, error) { + return wrapMaskNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewMaskNode creates a GskRenderNode that will mask a given node by another. +// +// The mask_mode determines how the 'mask values' are derived from the colors of +// the mask. Applying the mask consists of multiplying the 'mask value' with the +// alpha of the source. +// +// The function takes the following parameters: +// +// - source node to be drawn. +// - mask: node to be used as mask. +// - maskMode: mask mode to use. +// +// The function returns the following values: +// +// - maskNode: new GskRenderNode. +func NewMaskNode(source, mask RenderNoder, maskMode MaskMode) *MaskNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.GskRenderNode // out + var _arg3 C.GskMaskMode // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(source).Native())) + _arg2 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(mask).Native())) + _arg3 = C.GskMaskMode(maskMode) + + _cret = C.gsk_mask_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(source) + runtime.KeepAlive(mask) + runtime.KeepAlive(maskMode) + + var _maskNode *MaskNode // out + + _maskNode = wrapMaskNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _maskNode +} + +// Mask retrieves the mask GskRenderNode child of the node. +// +// The function returns the following values: +// +// - renderNode: mask child node. +func (node *MaskNode) Mask() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_mask_node_get_mask(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// MaskMode retrieves the mask mode used by node. +// +// The function returns the following values: +// +// - maskMode: mask mode. +func (node *MaskNode) MaskMode() MaskMode { + var _arg0 *C.GskRenderNode // out + var _cret C.GskMaskMode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_mask_node_get_mask_mode(_arg0) + runtime.KeepAlive(node) + + var _maskMode MaskMode // out + + _maskMode = MaskMode(_cret) + + return _maskMode +} + +// Source retrieves the source GskRenderNode child of the node. +// +// The function returns the following values: +// +// - renderNode: source child node. +func (node *MaskNode) Source() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_mask_node_get_source(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +type NGLRenderer struct { + _ [0]func() // equal guard + Renderer +} + +var ( + _ Rendererer = (*NGLRenderer)(nil) +) + +func wrapNGLRenderer(obj *coreglib.Object) *NGLRenderer { + return &NGLRenderer{ + Renderer: Renderer{ + Object: obj, + }, + } +} + +func marshalNGLRenderer(p uintptr) (interface{}, error) { + return wrapNGLRenderer(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func NewNGLRenderer() *NGLRenderer { + var _cret *C.GskRenderer // in + + _cret = C.gsk_ngl_renderer_new() + + var _nglRenderer *NGLRenderer // out + + _nglRenderer = wrapNGLRenderer(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _nglRenderer +} + +// OpacityNode: render node controlling the opacity of its single child node. +type OpacityNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*OpacityNode)(nil) +) + +func wrapOpacityNode(obj *coreglib.Object) *OpacityNode { + return &OpacityNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalOpacityNode(p uintptr) (interface{}, error) { + return wrapOpacityNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewOpacityNode creates a GskRenderNode that will drawn the child with reduced +// opacity. +// +// The function takes the following parameters: +// +// - child: node to draw. +// - opacity to apply. +// +// The function returns the following values: +// +// - opacityNode: new GskRenderNode. +func NewOpacityNode(child RenderNoder, opacity float32) *OpacityNode { + var _arg1 *C.GskRenderNode // out + var _arg2 C.float // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = C.float(opacity) + + _cret = C.gsk_opacity_node_new(_arg1, _arg2) + runtime.KeepAlive(child) + runtime.KeepAlive(opacity) + + var _opacityNode *OpacityNode // out + + _opacityNode = wrapOpacityNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _opacityNode +} + +// Child gets the child node that is getting opacityed by the given node. +// +// The function returns the following values: +// +// - renderNode: child that is getting opacityed. +func (node *OpacityNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_opacity_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// Opacity gets the transparency factor for an opacity node. +// +// The function returns the following values: +// +// - gfloat: opacity factor. +func (node *OpacityNode) Opacity() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_opacity_node_get_opacity(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// OutsetShadowNode: render node for an outset shadow. +type OutsetShadowNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*OutsetShadowNode)(nil) +) + +func wrapOutsetShadowNode(obj *coreglib.Object) *OutsetShadowNode { + return &OutsetShadowNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalOutsetShadowNode(p uintptr) (interface{}, error) { + return wrapOutsetShadowNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewOutsetShadowNode creates a GskRenderNode that will render an outset shadow +// around the box given by outline. +// +// The function takes the following parameters: +// +// - outline of the region surrounded by shadow. +// - color of the shadow. +// - dx: horizontal offset of shadow. +// - dy: vertical offset of shadow. +// - spread: how far the shadow spreads towards the inside. +// - blurRadius: how much blur to apply to the shadow. +// +// The function returns the following values: +// +// - outsetShadowNode: new GskRenderNode. +func NewOutsetShadowNode(outline *RoundedRect, color *gdk.RGBA, dx, dy, spread, blurRadius float32) *OutsetShadowNode { + var _arg1 *C.GskRoundedRect // out + var _arg2 *C.GdkRGBA // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + var _arg6 C.float // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(outline))) + _arg2 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(color))) + _arg3 = C.float(dx) + _arg4 = C.float(dy) + _arg5 = C.float(spread) + _arg6 = C.float(blurRadius) + + _cret = C.gsk_outset_shadow_node_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(outline) + runtime.KeepAlive(color) + runtime.KeepAlive(dx) + runtime.KeepAlive(dy) + runtime.KeepAlive(spread) + runtime.KeepAlive(blurRadius) + + var _outsetShadowNode *OutsetShadowNode // out + + _outsetShadowNode = wrapOutsetShadowNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _outsetShadowNode +} + +// BlurRadius retrieves the blur radius of the shadow. +// +// The function returns the following values: +// +// - gfloat: blur radius, in pixels. +func (node *OutsetShadowNode) BlurRadius() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_outset_shadow_node_get_blur_radius(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Color retrieves the color of the outset shadow. +// +// The function returns the following values: +// +// - rgbA: color. +func (node *OutsetShadowNode) Color() *gdk.RGBA { + var _arg0 *C.GskRenderNode // out + var _cret *C.GdkRGBA // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_outset_shadow_node_get_color(_arg0) + runtime.KeepAlive(node) + + var _rgbA *gdk.RGBA // out + + _rgbA = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rgbA +} + +// Dx retrieves the horizontal offset of the outset shadow. +// +// The function returns the following values: +// +// - gfloat: offset, in pixels. +func (node *OutsetShadowNode) Dx() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_outset_shadow_node_get_dx(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Dy retrieves the vertical offset of the outset shadow. +// +// The function returns the following values: +// +// - gfloat: offset, in pixels. +func (node *OutsetShadowNode) Dy() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_outset_shadow_node_get_dy(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Outline retrieves the outline rectangle of the outset shadow. +// +// The function returns the following values: +// +// - roundedRect: rounded rectangle. +func (node *OutsetShadowNode) Outline() *RoundedRect { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_outset_shadow_node_get_outline(_arg0) + runtime.KeepAlive(node) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// Spread retrieves how much the shadow spreads outwards. +// +// The function returns the following values: +// +// - gfloat: size of the shadow, in pixels. +func (node *OutsetShadowNode) Spread() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_outset_shadow_node_get_spread(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// RadialGradientNode: render node for a radial gradient. +type RadialGradientNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*RadialGradientNode)(nil) +) + +func wrapRadialGradientNode(obj *coreglib.Object) *RadialGradientNode { + return &RadialGradientNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalRadialGradientNode(p uintptr) (interface{}, error) { + return wrapRadialGradientNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewRadialGradientNode creates a GskRenderNode that draws a radial gradient. +// +// The radial gradient starts around center. The size of the gradient is +// dictated by hradius in horizontal orientation and by vradius in vertical +// orientation. +// +// The function takes the following parameters: +// +// - bounds of the node. +// - center of the gradient. +// - hradius: horizontal radius. +// - vradius: vertical radius. +// - start: percentage >= 0 that defines the start of the gradient around +// center. +// - end: percentage >= 0 that defines the end of the gradient around center. +// - colorStops: pointer to an array of GskColorStop defining the gradient. +// The offsets of all color stops must be increasing. The first stop's +// offset must be >= 0 and the last stop's offset must be <= 1. +// +// The function returns the following values: +// +// - radialGradientNode: new GskRenderNode. +func NewRadialGradientNode(bounds *graphene.Rect, center *graphene.Point, hradius, vradius, start, end float32, colorStops []ColorStop) *RadialGradientNode { + var _arg1 *C.graphene_rect_t // out + var _arg2 *C.graphene_point_t // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + var _arg6 C.float // out + var _arg7 *C.GskColorStop // out + var _arg8 C.gsize + var _cret *C.GskRenderNode // in + + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg2 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(center))) + _arg3 = C.float(hradius) + _arg4 = C.float(vradius) + _arg5 = C.float(start) + _arg6 = C.float(end) + _arg8 = (C.gsize)(len(colorStops)) + _arg7 = (*C.GskColorStop)(C.calloc(C.size_t(len(colorStops)), C.size_t(C.sizeof_GskColorStop))) + defer C.free(unsafe.Pointer(_arg7)) + { + out := unsafe.Slice((*C.GskColorStop)(_arg7), len(colorStops)) + for i := range colorStops { + out[i] = *(*C.GskColorStop)(gextras.StructNative(unsafe.Pointer((&colorStops[i])))) + } + } + + _cret = C.gsk_radial_gradient_node_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) + runtime.KeepAlive(bounds) + runtime.KeepAlive(center) + runtime.KeepAlive(hradius) + runtime.KeepAlive(vradius) + runtime.KeepAlive(start) + runtime.KeepAlive(end) + runtime.KeepAlive(colorStops) + + var _radialGradientNode *RadialGradientNode // out + + _radialGradientNode = wrapRadialGradientNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _radialGradientNode +} + +// Center retrieves the center pointer for the gradient. +// +// The function returns the following values: +// +// - point: center point for the gradient. +func (node *RadialGradientNode) Center() *graphene.Point { + var _arg0 *C.GskRenderNode // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_radial_gradient_node_get_center(_arg0) + runtime.KeepAlive(node) + + var _point *graphene.Point // out + + _point = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// ColorStops retrieves the color stops in the gradient. +// +// The function returns the following values: +// +// - colorStops: color stops in the gradient. +func (node *RadialGradientNode) ColorStops() []ColorStop { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskColorStop // in + var _arg1 C.gsize // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_radial_gradient_node_get_color_stops(_arg0, &_arg1) + runtime.KeepAlive(node) + + var _colorStops []ColorStop // out + + { + src := unsafe.Slice((*C.GskColorStop)(_cret), _arg1) + _colorStops = make([]ColorStop, _arg1) + for i := 0; i < int(_arg1); i++ { + _colorStops[i] = *(*ColorStop)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + + return _colorStops +} + +// End retrieves the end value for the gradient. +// +// The function returns the following values: +// +// - gfloat: end value for the gradient. +func (node *RadialGradientNode) End() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_radial_gradient_node_get_end(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Hradius retrieves the horizontal radius for the gradient. +// +// The function returns the following values: +// +// - gfloat: horizontal radius for the gradient. +func (node *RadialGradientNode) Hradius() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_radial_gradient_node_get_hradius(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// NColorStops retrieves the number of color stops in the gradient. +// +// The function returns the following values: +// +// - gsize: number of color stops. +func (node *RadialGradientNode) NColorStops() uint { + var _arg0 *C.GskRenderNode // out + var _cret C.gsize // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_radial_gradient_node_get_n_color_stops(_arg0) + runtime.KeepAlive(node) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Start retrieves the start value for the gradient. +// +// The function returns the following values: +// +// - gfloat: start value for the gradient. +func (node *RadialGradientNode) Start() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_radial_gradient_node_get_start(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Vradius retrieves the vertical radius for the gradient. +// +// The function returns the following values: +// +// - gfloat: vertical radius for the gradient. +func (node *RadialGradientNode) Vradius() float32 { + var _arg0 *C.GskRenderNode // out + var _cret C.float // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_radial_gradient_node_get_vradius(_arg0) + runtime.KeepAlive(node) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// RenderNode: GskRenderNode is the basic block in a scene graph to be rendered +// using gsk.Renderer. +// +// Each node has a parent, except the top-level node; each node may have +// children nodes. +// +// Each node has an associated drawing surface, which has the size of the +// rectangle set when creating it. +// +// Render nodes are meant to be transient; once they have been associated to +// a gsk.Renderer it's safe to release any reference you have on them. All +// gsk.RenderNodes are immutable, you can only specify their properties during +// construction. +type RenderNode struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*RenderNode)(nil) +) + +// RenderNoder describes types inherited from class RenderNode. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type RenderNoder interface { + coreglib.Objector + baseRenderNode() *RenderNode +} + +var _ RenderNoder = (*RenderNode)(nil) + +func wrapRenderNode(obj *coreglib.Object) *RenderNode { + return &RenderNode{ + Object: obj, + } +} + +func marshalRenderNode(p uintptr) (interface{}, error) { + return wrapRenderNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (node *RenderNode) baseRenderNode() *RenderNode { + return node +} + +// BaseRenderNode returns the underlying base object. +func BaseRenderNode(obj RenderNoder) *RenderNode { + return obj.baseRenderNode() +} + +// Draw the contents of node to the given cairo context. +// +// Typically, you'll use this function to implement fallback rendering of +// GskRenderNodes on an intermediate Cairo context, instead of using the drawing +// context associated to a gdk.Surface's rendering buffer. +// +// For advanced nodes that cannot be supported using Cairo, in particular for +// nodes doing 3D operations, this function may fail. +// +// The function takes the following parameters: +// +// - cr: cairo context to draw to. +func (node *RenderNode) Draw(cr *cairo.Context) { + var _arg0 *C.GskRenderNode // out + var _arg1 *C.cairo_t // out + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + _arg1 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + + C.gsk_render_node_draw(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(cr) +} + +// Bounds retrieves the boundaries of the node. +// +// The node will not draw outside of its boundaries. +// +// The function returns the following values: +// +// - bounds: return location for the boundaries. +func (node *RenderNode) Bounds() *graphene.Rect { + var _arg0 *C.GskRenderNode // out + var _arg1 C.graphene_rect_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + C.gsk_render_node_get_bounds(_arg0, &_arg1) + runtime.KeepAlive(node) + + var _bounds *graphene.Rect // out + + _bounds = (*graphene.Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _bounds +} + +// NodeType returns the type of the node. +// +// The function returns the following values: +// +// - renderNodeType: type of the GskRenderNode. +func (node *RenderNode) NodeType() RenderNodeType { + var _arg0 *C.GskRenderNode // out + var _cret C.GskRenderNodeType // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_render_node_get_node_type(_arg0) + runtime.KeepAlive(node) + + var _renderNodeType RenderNodeType // out + + _renderNodeType = RenderNodeType(_cret) + + return _renderNodeType +} + +// Serialize serializes the node for later deserialization via +// gsk_render_node_deserialize(). No guarantees are made about the +// format used other than that the same version of GTK will be able to +// deserialize the result of a call to gsk_render_node_serialize() and +// gsk_render_node_deserialize() will correctly reject files it cannot open that +// were created with previous versions of GTK. +// +// The intended use of this functions is testing, benchmarking and debugging. +// The format is not meant as a permanent storage format. +// +// The function returns the following values: +// +// - bytes: GBytes representing the node. +func (node *RenderNode) Serialize() *glib.Bytes { + var _arg0 *C.GskRenderNode // out + var _cret *C.GBytes // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_render_node_serialize(_arg0) + runtime.KeepAlive(node) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// WriteToFile: this function is equivalent to calling +// gsk.RenderNode.Serialize() followed by glib.FileSetContents(). +// +// See those two functions for details on the arguments. +// +// It is mostly intended for use inside a debugger to quickly dump a render node +// to a file for later inspection. +// +// The function takes the following parameters: +// +// - filename: file to save it to. +func (node *RenderNode) WriteToFile(filename string) error { + var _arg0 *C.GskRenderNode // out + var _arg1 *C.char // out + var _cerr *C.GError // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gsk_render_node_write_to_file(_arg0, _arg1, &_cerr) + runtime.KeepAlive(node) + runtime.KeepAlive(filename) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// RenderNodeDeserialize loads data previously created via +// gsk.RenderNode.Serialize(). +// +// For a discussion of the supported format, see that function. +// +// The function takes the following parameters: +// +// - bytes containing the data. +// - errorFunc (optional): callback on parsing errors. +// +// The function returns the following values: +// +// - renderNode (optional): new GskRenderNode. +func RenderNodeDeserialize(bytes *glib.Bytes, errorFunc ParseErrorFunc) RenderNoder { + var _arg1 *C.GBytes // out + var _arg2 C.GskParseErrorFunc // out + var _arg3 C.gpointer + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + if errorFunc != nil { + _arg2 = (*[0]byte)(C._gotk4_gsk4_ParseErrorFunc) + _arg3 = C.gpointer(gbox.Assign(errorFunc)) + defer gbox.Delete(uintptr(_arg3)) + } + + _cret = C.gsk_render_node_deserialize(_arg1, _arg2, _arg3) + runtime.KeepAlive(bytes) + runtime.KeepAlive(errorFunc) + + var _renderNode RenderNoder // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + } + + return _renderNode +} + +// Renderer: GskRenderer is a class that renders a scene graph defined via a +// tree of gsk.RenderNode instances. +// +// Typically you will use a GskRenderer instance to repeatedly call +// gsk.Renderer.Render() to update the contents of its associated gdk.Surface. +// +// It is necessary to realize a GskRenderer instance using +// gsk.Renderer.Realize() before calling gsk.Renderer.Render(), in order to +// create the appropriate windowing system resources needed to render the scene. +type Renderer struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Renderer)(nil) +) + +// Rendererer describes types inherited from class Renderer. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type Rendererer interface { + coreglib.Objector + baseRenderer() *Renderer +} + +var _ Rendererer = (*Renderer)(nil) + +func wrapRenderer(obj *coreglib.Object) *Renderer { + return &Renderer{ + Object: obj, + } +} + +func marshalRenderer(p uintptr) (interface{}, error) { + return wrapRenderer(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (renderer *Renderer) baseRenderer() *Renderer { + return renderer +} + +// BaseRenderer returns the underlying base object. +func BaseRenderer(obj Rendererer) *Renderer { + return obj.baseRenderer() +} + +// NewRendererForSurface creates an appropriate GskRenderer instance for the +// given surface. +// +// If the GSK_RENDERER environment variable is set, GSK will try that renderer +// first, before trying the backend-specific default. The ultimate fallback is +// the cairo renderer. +// +// The renderer will be realized before it is returned. +// +// The function takes the following parameters: +// +// - surface: GdkSurface. +// +// The function returns the following values: +// +// - renderer (optional): GskRenderer. +func NewRendererForSurface(surface gdk.Surfacer) *Renderer { + var _arg1 *C.GdkSurface // out + var _cret *C.GskRenderer // in + + _arg1 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gsk_renderer_new_for_surface(_arg1) + runtime.KeepAlive(surface) + + var _renderer *Renderer // out + + if _cret != nil { + _renderer = wrapRenderer(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _renderer +} + +// Surface retrieves the GdkSurface set using gsk_enderer_realize(). +// +// If the renderer has not been realized yet, NULL will be returned. +// +// The function returns the following values: +// +// - surface (optional): GdkSurface. +func (renderer *Renderer) Surface() gdk.Surfacer { + var _arg0 *C.GskRenderer // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GskRenderer)(unsafe.Pointer(coreglib.InternObject(renderer).Native())) + + _cret = C.gsk_renderer_get_surface(_arg0) + runtime.KeepAlive(renderer) + + var _surface gdk.Surfacer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gdk.Surfacer) + return ok + }) + rv, ok := casted.(gdk.Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + } + + return _surface +} + +// IsRealized checks whether the renderer is realized or not. +// +// The function returns the following values: +// +// - ok: TRUE if the GskRenderer was realized, and FALSE otherwise. +func (renderer *Renderer) IsRealized() bool { + var _arg0 *C.GskRenderer // out + var _cret C.gboolean // in + + _arg0 = (*C.GskRenderer)(unsafe.Pointer(coreglib.InternObject(renderer).Native())) + + _cret = C.gsk_renderer_is_realized(_arg0) + runtime.KeepAlive(renderer) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Realize creates the resources needed by the renderer to render the scene +// graph. +// +// Since GTK 4.6, the surface may be NULL, which allows using renderers +// without having to create a surface. Since GTK 4.14, it is recommended to use +// gsk.Renderer.RealizeForDisplay() instead. +// +// Note that it is mandatory to call gsk.Renderer.Unrealize() before destroying +// the renderer. +// +// The function takes the following parameters: +// +// - surface (optional): GdkSurface renderer will be used on. +func (renderer *Renderer) Realize(surface gdk.Surfacer) error { + var _arg0 *C.GskRenderer // out + var _arg1 *C.GdkSurface // out + var _cerr *C.GError // in + + _arg0 = (*C.GskRenderer)(unsafe.Pointer(coreglib.InternObject(renderer).Native())) + if surface != nil { + _arg1 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + } + + C.gsk_renderer_realize(_arg0, _arg1, &_cerr) + runtime.KeepAlive(renderer) + runtime.KeepAlive(surface) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// RealizeForDisplay creates the resources needed by the renderer to render the +// scene graph. +// +// Note that it is mandatory to call gsk.Renderer.Unrealize() before destroying +// the renderer. +// +// The function takes the following parameters: +// +// - display: GdkDisplay renderer will be used on. +func (renderer *Renderer) RealizeForDisplay(display *gdk.Display) error { + var _arg0 *C.GskRenderer // out + var _arg1 *C.GdkDisplay // out + var _cerr *C.GError // in + + _arg0 = (*C.GskRenderer)(unsafe.Pointer(coreglib.InternObject(renderer).Native())) + _arg1 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + C.gsk_renderer_realize_for_display(_arg0, _arg1, &_cerr) + runtime.KeepAlive(renderer) + runtime.KeepAlive(display) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Render renders the scene graph, described by a tree of GskRenderNode +// instances to the renderer's surface, ensuring that the given region gets +// redrawn. +// +// If the renderer has no associated surface, this function does nothing. +// +// Renderers must ensure that changes of the contents given by the root node +// as well as the area given by region are redrawn. They are however free to +// not redraw any pixel outside of region if they can guarantee that it didn't +// change. +// +// The renderer will acquire a reference on the GskRenderNode tree while the +// rendering is in progress. +// +// The function takes the following parameters: +// +// - root: GskRenderNode. +// - region (optional): cairo_region_t that must be redrawn or NULL for the +// whole window. +func (renderer *Renderer) Render(root RenderNoder, region *cairo.Region) { + var _arg0 *C.GskRenderer // out + var _arg1 *C.GskRenderNode // out + var _arg2 *C.cairo_region_t // out + + _arg0 = (*C.GskRenderer)(unsafe.Pointer(coreglib.InternObject(renderer).Native())) + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(root).Native())) + if region != nil { + _arg2 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) + } + + C.gsk_renderer_render(_arg0, _arg1, _arg2) + runtime.KeepAlive(renderer) + runtime.KeepAlive(root) + runtime.KeepAlive(region) +} + +// RenderTexture renders the scene graph, described by a tree of GskRenderNode +// instances, to a GdkTexture. +// +// The renderer will acquire a reference on the GskRenderNode tree while the +// rendering is in progress. +// +// If you want to apply any transformations to root, you should put it into a +// transform node and pass that node instead. +// +// The function takes the following parameters: +// +// - root: GskRenderNode. +// - viewport (optional): section to draw or NULL to use root's bounds. +// +// The function returns the following values: +// +// - texture: GdkTexture with the rendered contents of root. +func (renderer *Renderer) RenderTexture(root RenderNoder, viewport *graphene.Rect) gdk.Texturer { + var _arg0 *C.GskRenderer // out + var _arg1 *C.GskRenderNode // out + var _arg2 *C.graphene_rect_t // out + var _cret *C.GdkTexture // in + + _arg0 = (*C.GskRenderer)(unsafe.Pointer(coreglib.InternObject(renderer).Native())) + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(root).Native())) + if viewport != nil { + _arg2 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(viewport))) + } + + _cret = C.gsk_renderer_render_texture(_arg0, _arg1, _arg2) + runtime.KeepAlive(renderer) + runtime.KeepAlive(root) + runtime.KeepAlive(viewport) + + var _texture gdk.Texturer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Texturer is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gdk.Texturer) + return ok + }) + rv, ok := casted.(gdk.Texturer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") + } + _texture = rv + } + + return _texture +} + +// Unrealize releases all the resources created by gsk_renderer_realize(). +func (renderer *Renderer) Unrealize() { + var _arg0 *C.GskRenderer // out + + _arg0 = (*C.GskRenderer)(unsafe.Pointer(coreglib.InternObject(renderer).Native())) + + C.gsk_renderer_unrealize(_arg0) + runtime.KeepAlive(renderer) +} + +// RepeatNode: render node repeating its single child node. +type RepeatNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*RepeatNode)(nil) +) + +func wrapRepeatNode(obj *coreglib.Object) *RepeatNode { + return &RepeatNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalRepeatNode(p uintptr) (interface{}, error) { + return wrapRepeatNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewRepeatNode creates a GskRenderNode that will repeat the drawing of child +// across the given bounds. +// +// The function takes the following parameters: +// +// - bounds of the area to be painted. +// - child to repeat. +// - childBounds (optional): area of the child to repeat or NULL to use the +// child's bounds. +// +// The function returns the following values: +// +// - repeatNode: new GskRenderNode. +func NewRepeatNode(bounds *graphene.Rect, child RenderNoder, childBounds *graphene.Rect) *RepeatNode { + var _arg1 *C.graphene_rect_t // out + var _arg2 *C.GskRenderNode // out + var _arg3 *C.graphene_rect_t // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg2 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + if childBounds != nil { + _arg3 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(childBounds))) + } + + _cret = C.gsk_repeat_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(bounds) + runtime.KeepAlive(child) + runtime.KeepAlive(childBounds) + + var _repeatNode *RepeatNode // out + + _repeatNode = wrapRepeatNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _repeatNode +} + +// Child retrieves the child of node. +// +// The function returns the following values: +// +// - renderNode: GskRenderNode. +func (node *RepeatNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_repeat_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// ChildBounds retrieves the bounding rectangle of the child of node. +// +// The function returns the following values: +// +// - rect: bounding rectangle. +func (node *RepeatNode) ChildBounds() *graphene.Rect { + var _arg0 *C.GskRenderNode // out + var _cret *C.graphene_rect_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_repeat_node_get_child_bounds(_arg0) + runtime.KeepAlive(node) + + var _rect *graphene.Rect // out + + _rect = (*graphene.Rect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rect +} + +// RepeatingLinearGradientNode: render node for a repeating linear gradient. +type RepeatingLinearGradientNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*RepeatingLinearGradientNode)(nil) +) + +func wrapRepeatingLinearGradientNode(obj *coreglib.Object) *RepeatingLinearGradientNode { + return &RepeatingLinearGradientNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalRepeatingLinearGradientNode(p uintptr) (interface{}, error) { + return wrapRepeatingLinearGradientNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewRepeatingLinearGradientNode creates a GskRenderNode that will create a +// repeating linear gradient from the given points and color stops, and render +// that into the area given by bounds. +// +// The function takes the following parameters: +// +// - bounds: rectangle to render the linear gradient into. +// - start: point at which the linear gradient will begin. +// - end: point at which the linear gradient will finish. +// - colorStops: pointer to an array of GskColorStop defining the gradient. +// The offsets of all color stops must be increasing. The first stop's +// offset must be >= 0 and the last stop's offset must be <= 1. +// +// The function returns the following values: +// +// - repeatingLinearGradientNode: new GskRenderNode. +func NewRepeatingLinearGradientNode(bounds *graphene.Rect, start, end *graphene.Point, colorStops []ColorStop) *RepeatingLinearGradientNode { + var _arg1 *C.graphene_rect_t // out + var _arg2 *C.graphene_point_t // out + var _arg3 *C.graphene_point_t // out + var _arg4 *C.GskColorStop // out + var _arg5 C.gsize + var _cret *C.GskRenderNode // in + + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg2 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(start))) + _arg3 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(end))) + _arg5 = (C.gsize)(len(colorStops)) + _arg4 = (*C.GskColorStop)(C.calloc(C.size_t(len(colorStops)), C.size_t(C.sizeof_GskColorStop))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((*C.GskColorStop)(_arg4), len(colorStops)) + for i := range colorStops { + out[i] = *(*C.GskColorStop)(gextras.StructNative(unsafe.Pointer((&colorStops[i])))) + } + } + + _cret = C.gsk_repeating_linear_gradient_node_new(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(bounds) + runtime.KeepAlive(start) + runtime.KeepAlive(end) + runtime.KeepAlive(colorStops) + + var _repeatingLinearGradientNode *RepeatingLinearGradientNode // out + + _repeatingLinearGradientNode = wrapRepeatingLinearGradientNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _repeatingLinearGradientNode +} + +// RepeatingRadialGradientNode: render node for a repeating radial gradient. +type RepeatingRadialGradientNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*RepeatingRadialGradientNode)(nil) +) + +func wrapRepeatingRadialGradientNode(obj *coreglib.Object) *RepeatingRadialGradientNode { + return &RepeatingRadialGradientNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalRepeatingRadialGradientNode(p uintptr) (interface{}, error) { + return wrapRepeatingRadialGradientNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewRepeatingRadialGradientNode creates a GskRenderNode that draws a repeating +// radial gradient. +// +// The radial gradient starts around center. The size of the gradient is +// dictated by hradius in horizontal orientation and by vradius in vertical +// orientation. +// +// The function takes the following parameters: +// +// - bounds of the node. +// - center of the gradient. +// - hradius: horizontal radius. +// - vradius: vertical radius. +// - start: percentage >= 0 that defines the start of the gradient around +// center. +// - end: percentage >= 0 that defines the end of the gradient around center. +// - colorStops: pointer to an array of GskColorStop defining the gradient. +// The offsets of all color stops must be increasing. The first stop's +// offset must be >= 0 and the last stop's offset must be <= 1. +// +// The function returns the following values: +// +// - repeatingRadialGradientNode: new GskRenderNode. +func NewRepeatingRadialGradientNode(bounds *graphene.Rect, center *graphene.Point, hradius, vradius, start, end float32, colorStops []ColorStop) *RepeatingRadialGradientNode { + var _arg1 *C.graphene_rect_t // out + var _arg2 *C.graphene_point_t // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + var _arg6 C.float // out + var _arg7 *C.GskColorStop // out + var _arg8 C.gsize + var _cret *C.GskRenderNode // in + + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg2 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(center))) + _arg3 = C.float(hradius) + _arg4 = C.float(vradius) + _arg5 = C.float(start) + _arg6 = C.float(end) + _arg8 = (C.gsize)(len(colorStops)) + _arg7 = (*C.GskColorStop)(C.calloc(C.size_t(len(colorStops)), C.size_t(C.sizeof_GskColorStop))) + defer C.free(unsafe.Pointer(_arg7)) + { + out := unsafe.Slice((*C.GskColorStop)(_arg7), len(colorStops)) + for i := range colorStops { + out[i] = *(*C.GskColorStop)(gextras.StructNative(unsafe.Pointer((&colorStops[i])))) + } + } + + _cret = C.gsk_repeating_radial_gradient_node_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) + runtime.KeepAlive(bounds) + runtime.KeepAlive(center) + runtime.KeepAlive(hradius) + runtime.KeepAlive(vradius) + runtime.KeepAlive(start) + runtime.KeepAlive(end) + runtime.KeepAlive(colorStops) + + var _repeatingRadialGradientNode *RepeatingRadialGradientNode // out + + _repeatingRadialGradientNode = wrapRepeatingRadialGradientNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _repeatingRadialGradientNode +} + +// RoundedClipNode: render node applying a rounded rectangle clip to its single +// child. +type RoundedClipNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*RoundedClipNode)(nil) +) + +func wrapRoundedClipNode(obj *coreglib.Object) *RoundedClipNode { + return &RoundedClipNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalRoundedClipNode(p uintptr) (interface{}, error) { + return wrapRoundedClipNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewRoundedClipNode creates a GskRenderNode that will clip the child to the +// area given by clip. +// +// The function takes the following parameters: +// +// - child: node to draw. +// - clip to apply. +// +// The function returns the following values: +// +// - roundedClipNode: new GskRenderNode. +func NewRoundedClipNode(child RenderNoder, clip *RoundedRect) *RoundedClipNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.GskRoundedRect // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(clip))) + + _cret = C.gsk_rounded_clip_node_new(_arg1, _arg2) + runtime.KeepAlive(child) + runtime.KeepAlive(clip) + + var _roundedClipNode *RoundedClipNode // out + + _roundedClipNode = wrapRoundedClipNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _roundedClipNode +} + +// Child gets the child node that is getting clipped by the given node. +// +// The function returns the following values: +// +// - renderNode: child that is getting clipped. +func (node *RoundedClipNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_rounded_clip_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// Clip retrieves the rounded rectangle used to clip the contents of the node. +// +// The function returns the following values: +// +// - roundedRect: rounded rectangle. +func (node *RoundedClipNode) Clip() *RoundedRect { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_rounded_clip_node_get_clip(_arg0) + runtime.KeepAlive(node) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// ShadowNode: render node drawing one or more shadows behind its single child +// node. +type ShadowNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*ShadowNode)(nil) +) + +func wrapShadowNode(obj *coreglib.Object) *ShadowNode { + return &ShadowNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalShadowNode(p uintptr) (interface{}, error) { + return wrapShadowNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewShadowNode creates a GskRenderNode that will draw a child with the given +// shadows below it. +// +// The function takes the following parameters: +// +// - child: node to draw. +// - shadows to apply. +// +// The function returns the following values: +// +// - shadowNode: new GskRenderNode. +func NewShadowNode(child RenderNoder, shadows []Shadow) *ShadowNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.GskShadow // out + var _arg3 C.gsize + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg3 = (C.gsize)(len(shadows)) + _arg2 = (*C.GskShadow)(C.calloc(C.size_t(len(shadows)), C.size_t(C.sizeof_GskShadow))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice((*C.GskShadow)(_arg2), len(shadows)) + for i := range shadows { + out[i] = *(*C.GskShadow)(gextras.StructNative(unsafe.Pointer((&shadows[i])))) + } + } + + _cret = C.gsk_shadow_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(child) + runtime.KeepAlive(shadows) + + var _shadowNode *ShadowNode // out + + _shadowNode = wrapShadowNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _shadowNode +} + +// Child retrieves the child GskRenderNode of the shadow node. +// +// The function returns the following values: +// +// - renderNode: child render node. +func (node *ShadowNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_shadow_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// NShadows retrieves the number of shadows in the node. +// +// The function returns the following values: +// +// - gsize: number of shadows. +func (node *ShadowNode) NShadows() uint { + var _arg0 *C.GskRenderNode // out + var _cret C.gsize // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_shadow_node_get_n_shadows(_arg0) + runtime.KeepAlive(node) + + var _gsize uint // out + + _gsize = uint(_cret) + + return _gsize +} + +// Shadow retrieves the shadow data at the given index i. +// +// The function takes the following parameters: +// +// - i: given index. +// +// The function returns the following values: +// +// - shadow data. +func (node *ShadowNode) Shadow(i uint) *Shadow { + var _arg0 *C.GskRenderNode // out + var _arg1 C.gsize // out + var _cret *C.GskShadow // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + _arg1 = C.gsize(i) + + _cret = C.gsk_shadow_node_get_shadow(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(i) + + var _shadow *Shadow // out + + _shadow = (*Shadow)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _shadow +} + +// StrokeNode: render node that will fill the area determined by stroking the +// the given gsk.Path using the gsk.Stroke attributes. +type StrokeNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*StrokeNode)(nil) +) + +func wrapStrokeNode(obj *coreglib.Object) *StrokeNode { + return &StrokeNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalStrokeNode(p uintptr) (interface{}, error) { + return wrapStrokeNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewStrokeNode creates a RenderNode that will fill the outline generated by +// stroking the given path using the attributes defined in stroke. +// +// The area is filled with child. +// +// The function takes the following parameters: +// +// - child: node to stroke the area with. +// - path describing the area to stroke. +// - stroke attributes to use. +// +// The function returns the following values: +// +// - strokeNode: new RenderNode. +func NewStrokeNode(child RenderNoder, path *Path, stroke *Stroke) *StrokeNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.GskPath // out + var _arg3 *C.GskStroke // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + _arg3 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(stroke))) + + _cret = C.gsk_stroke_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(child) + runtime.KeepAlive(path) + runtime.KeepAlive(stroke) + + var _strokeNode *StrokeNode // out + + _strokeNode = wrapStrokeNode(coreglib.Take(unsafe.Pointer(_cret))) + + return _strokeNode +} + +// Child gets the child node that is getting drawn by the given node. +// +// The function returns the following values: +// +// - renderNode: child that is getting drawn. +func (node *StrokeNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_stroke_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// Path retrieves the path that will be stroked with the contents of the node. +// +// The function returns the following values: +// +// - path: Path. +func (node *StrokeNode) Path() *Path { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskPath // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_stroke_node_get_path(_arg0) + runtime.KeepAlive(node) + + var _path *Path // out + + _path = (*Path)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gsk_path_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_path)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_path_unref((*C.GskPath)(intern.C)) + }, + ) + + return _path +} + +// Stroke retrieves the stroke attributes used in this node. +// +// The function returns the following values: +// +// - stroke: Stroke. +func (node *StrokeNode) Stroke() *Stroke { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskStroke // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_stroke_node_get_stroke(_arg0) + runtime.KeepAlive(node) + + var _stroke *Stroke // out + + _stroke = (*Stroke)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _stroke +} + +// SubsurfaceNode: render node that potentially diverts a part of the scene +// graph to a subsurface. +type SubsurfaceNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*SubsurfaceNode)(nil) +) + +func wrapSubsurfaceNode(obj *coreglib.Object) *SubsurfaceNode { + return &SubsurfaceNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalSubsurfaceNode(p uintptr) (interface{}, error) { + return wrapSubsurfaceNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Child gets the child node that is getting drawn by the given node. +// +// The function returns the following values: +// +// - renderNode: child GskRenderNode. +func (node *SubsurfaceNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_subsurface_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// TextNode: render node drawing a set of glyphs. +type TextNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*TextNode)(nil) +) + +func wrapTextNode(obj *coreglib.Object) *TextNode { + return &TextNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalTextNode(p uintptr) (interface{}, error) { + return wrapTextNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewTextNode creates a render node that renders the given glyphs. +// +// Note that color may not be used if the font contains color glyphs. +// +// The function takes the following parameters: +// +// - font: PangoFont containing the glyphs. +// - glyphs: PangoGlyphString to render. +// - color: foreground color to render with. +// - offset of the baseline. +// +// The function returns the following values: +// +// - textNode (optional): new GskRenderNode. +func NewTextNode(font pango.Fonter, glyphs *pango.GlyphString, color *gdk.RGBA, offset *graphene.Point) *TextNode { + var _arg1 *C.PangoFont // out + var _arg2 *C.PangoGlyphString // out + var _arg3 *C.GdkRGBA // out + var _arg4 *C.graphene_point_t // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.PangoFont)(unsafe.Pointer(coreglib.InternObject(font).Native())) + _arg2 = (*C.PangoGlyphString)(gextras.StructNative(unsafe.Pointer(glyphs))) + _arg3 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(color))) + _arg4 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(offset))) + + _cret = C.gsk_text_node_new(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(font) + runtime.KeepAlive(glyphs) + runtime.KeepAlive(color) + runtime.KeepAlive(offset) + + var _textNode *TextNode // out + + if _cret != nil { + _textNode = wrapTextNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _textNode +} + +// Color retrieves the color used by the text node. +// +// The function returns the following values: +// +// - rgbA: text color. +func (node *TextNode) Color() *gdk.RGBA { + var _arg0 *C.GskRenderNode // out + var _cret *C.GdkRGBA // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_text_node_get_color(_arg0) + runtime.KeepAlive(node) + + var _rgbA *gdk.RGBA // out + + _rgbA = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _rgbA +} + +// Font returns the font used by the text node. +// +// The function returns the following values: +// +// - font: font. +func (node *TextNode) Font() pango.Fonter { + var _arg0 *C.GskRenderNode // out + var _cret *C.PangoFont // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_text_node_get_font(_arg0) + runtime.KeepAlive(node) + + var _font pango.Fonter // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type pango.Fonter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(pango.Fonter) + return ok + }) + rv, ok := casted.(pango.Fonter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching pango.Fonter") + } + _font = rv + } + + return _font +} + +// Glyphs retrieves the glyph information in the node. +// +// The function returns the following values: +// +// - glyphInfos: glyph information. +func (node *TextNode) Glyphs() []pango.GlyphInfo { + var _arg0 *C.GskRenderNode // out + var _cret *C.PangoGlyphInfo // in + var _arg1 C.guint // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_text_node_get_glyphs(_arg0, &_arg1) + runtime.KeepAlive(node) + + var _glyphInfos []pango.GlyphInfo // out + + { + src := unsafe.Slice((*C.PangoGlyphInfo)(_cret), _arg1) + _glyphInfos = make([]pango.GlyphInfo, _arg1) + for i := 0; i < int(_arg1); i++ { + _glyphInfos[i] = *(*pango.GlyphInfo)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + + return _glyphInfos +} + +// NumGlyphs retrieves the number of glyphs in the text node. +// +// The function returns the following values: +// +// - guint: number of glyphs. +func (node *TextNode) NumGlyphs() uint { + var _arg0 *C.GskRenderNode // out + var _cret C.guint // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_text_node_get_num_glyphs(_arg0) + runtime.KeepAlive(node) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Offset retrieves the offset applied to the text. +// +// The function returns the following values: +// +// - point with the horizontal and vertical offsets. +func (node *TextNode) Offset() *graphene.Point { + var _arg0 *C.GskRenderNode // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_text_node_get_offset(_arg0) + runtime.KeepAlive(node) + + var _point *graphene.Point // out + + _point = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// HasColorGlyphs checks whether the text node has color glyphs. +// +// The function returns the following values: +// +// - ok: TRUE if the text node has color glyphs. +func (node *TextNode) HasColorGlyphs() bool { + var _arg0 *C.GskRenderNode // out + var _cret C.gboolean // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_text_node_has_color_glyphs(_arg0) + runtime.KeepAlive(node) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TextureNode: render node for a GdkTexture. +type TextureNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*TextureNode)(nil) +) + +func wrapTextureNode(obj *coreglib.Object) *TextureNode { + return &TextureNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalTextureNode(p uintptr) (interface{}, error) { + return wrapTextureNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewTextureNode creates a GskRenderNode that will render the given texture +// into the area given by bounds. +// +// Note that GSK applies linear filtering when textures are scaled and +// transformed. See gsk.TextureScaleNode for a way to influence filtering. +// +// The function takes the following parameters: +// +// - texture: GdkTexture. +// - bounds: rectangle to render the texture into. +// +// The function returns the following values: +// +// - textureNode: new GskRenderNode. +func NewTextureNode(texture gdk.Texturer, bounds *graphene.Rect) *TextureNode { + var _arg1 *C.GdkTexture // out + var _arg2 *C.graphene_rect_t // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + _arg2 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + + _cret = C.gsk_texture_node_new(_arg1, _arg2) + runtime.KeepAlive(texture) + runtime.KeepAlive(bounds) + + var _textureNode *TextureNode // out + + _textureNode = wrapTextureNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _textureNode +} + +// Texture retrieves the GdkTexture used when creating this GskRenderNode. +// +// The function returns the following values: +// +// - texture: GdkTexture. +func (node *TextureNode) Texture() gdk.Texturer { + var _arg0 *C.GskRenderNode // out + var _cret *C.GdkTexture // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_texture_node_get_texture(_arg0) + runtime.KeepAlive(node) + + var _texture gdk.Texturer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Texturer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gdk.Texturer) + return ok + }) + rv, ok := casted.(gdk.Texturer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") + } + _texture = rv + } + + return _texture +} + +// TextureScaleNode: render node for a GdkTexture. +type TextureScaleNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*TextureScaleNode)(nil) +) + +func wrapTextureScaleNode(obj *coreglib.Object) *TextureScaleNode { + return &TextureScaleNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalTextureScaleNode(p uintptr) (interface{}, error) { + return wrapTextureScaleNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewTextureScaleNode creates a node that scales the texture to the size given +// by the bounds using the filter and then places it at the bounds' position. +// +// Note that further scaling and other transformations which are applied to the +// node will apply linear filtering to the resulting texture, as usual. +// +// This node is intended for tight control over scaling applied to a texture, +// such as in image editors and requires the application to be aware of the +// whole render tree as further transforms may be applied that conflict with the +// desired effect of this node. +// +// The function takes the following parameters: +// +// - texture to scale. +// - bounds: size of the texture to scale to. +// - filter: how to scale the texture. +// +// The function returns the following values: +// +// - textureScaleNode: new GskRenderNode. +func NewTextureScaleNode(texture gdk.Texturer, bounds *graphene.Rect, filter ScalingFilter) *TextureScaleNode { + var _arg1 *C.GdkTexture // out + var _arg2 *C.graphene_rect_t // out + var _arg3 C.GskScalingFilter // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + _arg2 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg3 = C.GskScalingFilter(filter) + + _cret = C.gsk_texture_scale_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(texture) + runtime.KeepAlive(bounds) + runtime.KeepAlive(filter) + + var _textureScaleNode *TextureScaleNode // out + + _textureScaleNode = wrapTextureScaleNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _textureScaleNode +} + +// Filter retrieves the GskScalingFilter used when creating this GskRenderNode. +// +// The function returns the following values: +// +// - scalingFilter: GskScalingFilter. +func (node *TextureScaleNode) Filter() ScalingFilter { + var _arg0 *C.GskRenderNode // out + var _cret C.GskScalingFilter // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_texture_scale_node_get_filter(_arg0) + runtime.KeepAlive(node) + + var _scalingFilter ScalingFilter // out + + _scalingFilter = ScalingFilter(_cret) + + return _scalingFilter +} + +// Texture retrieves the GdkTexture used when creating this GskRenderNode. +// +// The function returns the following values: +// +// - texture: GdkTexture. +func (node *TextureScaleNode) Texture() gdk.Texturer { + var _arg0 *C.GskRenderNode // out + var _cret *C.GdkTexture // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_texture_scale_node_get_texture(_arg0) + runtime.KeepAlive(node) + + var _texture gdk.Texturer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Texturer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gdk.Texturer) + return ok + }) + rv, ok := casted.(gdk.Texturer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") + } + _texture = rv + } + + return _texture +} + +// TransformNode: render node applying a GskTransform to its single child node. +type TransformNode struct { + _ [0]func() // equal guard + RenderNode +} + +var ( + _ RenderNoder = (*TransformNode)(nil) +) + +func wrapTransformNode(obj *coreglib.Object) *TransformNode { + return &TransformNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } +} + +func marshalTransformNode(p uintptr) (interface{}, error) { + return wrapTransformNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewTransformNode creates a GskRenderNode that will transform the given child +// with the given transform. +// +// The function takes the following parameters: +// +// - child: node to transform. +// - transform to apply. +// +// The function returns the following values: +// +// - transformNode: new GskRenderNode. +func NewTransformNode(child RenderNoder, transform *Transform) *TransformNode { + var _arg1 *C.GskRenderNode // out + var _arg2 *C.GskTransform // out + var _cret *C.GskRenderNode // in + + _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) + _arg2 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(transform))) + + _cret = C.gsk_transform_node_new(_arg1, _arg2) + runtime.KeepAlive(child) + runtime.KeepAlive(transform) + + var _transformNode *TransformNode // out + + _transformNode = wrapTransformNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _transformNode +} + +// Child gets the child node that is getting transformed by the given node. +// +// The function returns the following values: +// +// - renderNode: child that is getting transformed. +func (node *TransformNode) Child() RenderNoder { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskRenderNode // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_transform_node_get_child(_arg0) + runtime.KeepAlive(node) + + var _renderNode RenderNoder // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gsk.RenderNoder is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(RenderNoder) + return ok + }) + rv, ok := casted.(RenderNoder) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") + } + _renderNode = rv + } + + return _renderNode +} + +// Transform retrieves the GskTransform used by the node. +// +// The function returns the following values: +// +// - transform: GskTransform. +func (node *TransformNode) Transform() *Transform { + var _arg0 *C.GskRenderNode // out + var _cret *C.GskTransform // in + + _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + + _cret = C.gsk_transform_node_get_transform(_arg0) + runtime.KeepAlive(node) + + var _transform *Transform // out + + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gsk_transform_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + + return _transform +} + +// ColorStop: color stop in a gradient node. +// +// An instance of this type is always passed by reference. +type ColorStop struct { + *colorStop +} + +// colorStop is the struct that's finalized. +type colorStop struct { + native *C.GskColorStop +} + +// Offset: offset of the color stop. +func (c *ColorStop) Offset() float32 { + valptr := &c.native.offset + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Color: color at the given offset. +func (c *ColorStop) Color() *gdk.RGBA { + valptr := &c.native.color + var _v *gdk.RGBA // out + _v = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// Offset: offset of the color stop. +func (c *ColorStop) SetOffset(offset float32) { + valptr := &c.native.offset + *valptr = C.float(offset) +} + +// GLShaderClass: instance of this type is always passed by reference. +type GLShaderClass struct { + *glShaderClass +} + +// glShaderClass is the struct that's finalized. +type glShaderClass struct { + native *C.GskGLShaderClass +} + +// ParseLocation: location in a parse buffer. +// +// An instance of this type is always passed by reference. +type ParseLocation struct { + *parseLocation +} + +// parseLocation is the struct that's finalized. +type parseLocation struct { + native *C.GskParseLocation +} + +// NewParseLocation creates a new ParseLocation instance from the given +// fields. Beware that this function allocates on the Go heap; be careful +// when using it! +func NewParseLocation(bytes, chars, lines, lineBytes, lineChars uint) ParseLocation { + var f0 C.gsize // out + f0 = C.gsize(bytes) + var f1 C.gsize // out + f1 = C.gsize(chars) + var f2 C.gsize // out + f2 = C.gsize(lines) + var f3 C.gsize // out + f3 = C.gsize(lineBytes) + var f4 C.gsize // out + f4 = C.gsize(lineChars) + + v := C.GskParseLocation{ + bytes: f0, + chars: f1, + lines: f2, + line_bytes: f3, + line_chars: f4, + } + + return *(*ParseLocation)(gextras.NewStructNative(unsafe.Pointer(&v))) +} + +// Bytes: offset of the location in the parse buffer, as bytes. +func (p *ParseLocation) Bytes() uint { + valptr := &p.native.bytes + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Chars: offset of the location in the parse buffer, as characters. +func (p *ParseLocation) Chars() uint { + valptr := &p.native.chars + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Lines: line of the location in the parse buffer. +func (p *ParseLocation) Lines() uint { + valptr := &p.native.lines + var _v uint // out + _v = uint(*valptr) + return _v +} + +// LineBytes: position in the line, as bytes. +func (p *ParseLocation) LineBytes() uint { + valptr := &p.native.line_bytes + var _v uint // out + _v = uint(*valptr) + return _v +} + +// LineChars: position in the line, as characters. +func (p *ParseLocation) LineChars() uint { + valptr := &p.native.line_chars + var _v uint // out + _v = uint(*valptr) + return _v +} + +// Bytes: offset of the location in the parse buffer, as bytes. +func (p *ParseLocation) SetBytes(bytes uint) { + valptr := &p.native.bytes + *valptr = C.gsize(bytes) +} + +// Chars: offset of the location in the parse buffer, as characters. +func (p *ParseLocation) SetChars(chars uint) { + valptr := &p.native.chars + *valptr = C.gsize(chars) +} + +// Lines: line of the location in the parse buffer. +func (p *ParseLocation) SetLines(lines uint) { + valptr := &p.native.lines + *valptr = C.gsize(lines) +} + +// LineBytes: position in the line, as bytes. +func (p *ParseLocation) SetLineBytes(lineBytes uint) { + valptr := &p.native.line_bytes + *valptr = C.gsize(lineBytes) +} + +// LineChars: position in the line, as characters. +func (p *ParseLocation) SetLineChars(lineChars uint) { + valptr := &p.native.line_chars + *valptr = C.gsize(lineChars) +} + +// Path: GskPath describes lines and curves that are more complex than simple +// rectangles. +// +// Paths can used for rendering (filling or stroking) and for animations (e.g. +// as trajectories). +// +// GskPath is an immutable, opaque, reference-counted struct. After creation, +// you cannot change the types it represents. Instead, new GskPath objects +// have to be created. The gsk.PathBuilder structure is meant to help in this +// endeavor. +// +// Conceptually, a path consists of zero or more contours (continuous, connected +// curves), each of which may or may not be closed. Contours are typically +// constructed from Bézier segments. +// +// A Path +// +// An instance of this type is always passed by reference. +type Path struct { + *path +} + +// path is the struct that's finalized. +type path struct { + native *C.GskPath +} + +func marshalPath(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Path{&path{(*C.GskPath)(b)}}, nil +} + +// ForEach calls func for every operation of the path. +// +// Note that this may only approximate self, because paths can contain +// optimizations for various specialized contours, and depending on the flags, +// the path may be decomposed into simpler curves than the ones that it +// contained originally. +// +// This function serves two purposes: +// +// - When the flags allow everything, it provides access to the raw, unmodified +// data of the path. +// +// - When the flags disallow certain operations, it provides an approximation of +// the path using just the allowed operations. +// +// The function takes the following parameters: +// +// - flags to pass to the foreach function. See gsk.PathForEachFlags for +// details about flags. +// - fn: function to call for operations. +// +// The function returns the following values: +// +// - ok: FALSE if func returned FALSE, TRUE` otherwise. +func (self *Path) ForEach(flags PathForEachFlags, fn PathForEachFunc) bool { + var _arg0 *C.GskPath // out + var _arg1 C.GskPathForeachFlags // out + var _arg2 C.GskPathForeachFunc // out + var _arg3 C.gpointer + var _cret C.gboolean // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.GskPathForeachFlags(flags) + _arg2 = (*[0]byte)(C._gotk4_gsk4_PathForEachFunc) + _arg3 = C.gpointer(gbox.Assign(fn)) + defer gbox.Delete(uintptr(_arg3)) + + _cret = C.gsk_path_foreach(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(self) + runtime.KeepAlive(flags) + runtime.KeepAlive(fn) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Bounds computes the bounds of the given path. +// +// The returned bounds may be larger than necessary, because this function aims +// to be fast, not accurate. The bounds are guaranteed to contain the path. +// +// It is possible that the returned rectangle has 0 width and/or height. +// This can happen when the path only describes a point or an axis-aligned line. +// +// If the path is empty, FALSE is returned and bounds are set to +// graphene_rect_zero(). This is different from the case where the path is a +// single point at the origin, where the bounds will also be set to the zero +// rectangle but TRUE will be returned. +// +// The function returns the following values: +// +// - bounds of the given path. +// - ok: TRUE if the path has bounds, FALSE if the path is known to be empty +// and have no bounds. +func (self *Path) Bounds() (*graphene.Rect, bool) { + var _arg0 *C.GskPath // out + var _arg1 C.graphene_rect_t // in + var _cret C.gboolean // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_get_bounds(_arg0, &_arg1) + runtime.KeepAlive(self) + + var _bounds *graphene.Rect // out + var _ok bool // out + + _bounds = (*graphene.Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _bounds, _ok +} + +// ClosestPoint computes the closest point on the path to the given point and +// sets the result to it. +// +// If there is no point closer than the given threshold, FALSE is returned. +// +// The function takes the following parameters: +// +// - point: point. +// - threshold: maximum allowed distance. +// +// The function returns the following values: +// +// - result: return location for the closest point. +// - distance (optional): return location for the distance. +// - ok: TRUE if point was set to the closest point on self, FALSE if no point +// is closer than threshold. +func (self *Path) ClosestPoint(point *graphene.Point, threshold float32) (*PathPoint, float32, bool) { + var _arg0 *C.GskPath // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.float // out + var _arg3 C.GskPathPoint // in + var _arg4 C.float // in + var _cret C.gboolean // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(point))) + _arg2 = C.float(threshold) + + _cret = C.gsk_path_get_closest_point(_arg0, _arg1, _arg2, &_arg3, &_arg4) + runtime.KeepAlive(self) + runtime.KeepAlive(point) + runtime.KeepAlive(threshold) + + var _result *PathPoint // out + var _distance float32 // out + var _ok bool // out + + _result = (*PathPoint)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + _distance = float32(_arg4) + if _cret != 0 { + _ok = true + } + + return _result, _distance, _ok +} + +// EndPoint gets the end point of the path. +// +// An empty path has no points, so FALSE is returned in this case. +// +// The function returns the following values: +// +// - result: return location for point. +// - ok: TRUE if result was filled. +func (self *Path) EndPoint() (*PathPoint, bool) { + var _arg0 *C.GskPath // out + var _arg1 C.GskPathPoint // in + var _cret C.gboolean // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_get_end_point(_arg0, &_arg1) + runtime.KeepAlive(self) + + var _result *PathPoint // out + var _ok bool // out + + _result = (*PathPoint)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _result, _ok +} + +// StartPoint gets the start point of the path. +// +// An empty path has no points, so FALSE is returned in this case. +// +// The function returns the following values: +// +// - result: return location for point. +// - ok: TRUE if result was filled. +func (self *Path) StartPoint() (*PathPoint, bool) { + var _arg0 *C.GskPath // out + var _arg1 C.GskPathPoint // in + var _cret C.gboolean // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_get_start_point(_arg0, &_arg1) + runtime.KeepAlive(self) + + var _result *PathPoint // out + var _ok bool // out + + _result = (*PathPoint)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _result, _ok +} + +// StrokeBounds computes the bounds for stroking the given path with the +// parameters in stroke. +// +// The returned bounds may be larger than necessary, because this function +// aims to be fast, not accurate. The bounds are guaranteed to contain the area +// affected by the stroke, including protrusions like miters. +// +// The function takes the following parameters: +// +// - stroke parameters. +// +// The function returns the following values: +// +// - bounds to fill in. +// - ok: TRUE if the path has bounds, FALSE if the path is known to be empty +// and have no bounds. +func (self *Path) StrokeBounds(stroke *Stroke) (*graphene.Rect, bool) { + var _arg0 *C.GskPath // out + var _arg1 *C.GskStroke // out + var _arg2 C.graphene_rect_t // in + var _cret C.gboolean // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(stroke))) + + _cret = C.gsk_path_get_stroke_bounds(_arg0, _arg1, &_arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(stroke) + + var _bounds *graphene.Rect // out + var _ok bool // out + + _bounds = (*graphene.Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + if _cret != 0 { + _ok = true + } + + return _bounds, _ok +} + +// InFill returns whether the given point is inside the area that would be +// affected if the path was filled according to fill_rule. +// +// Note that this function assumes that filling a contour implicitly closes it. +// +// The function takes the following parameters: +// +// - point to test. +// - fillRule: fill rule to follow. +// +// The function returns the following values: +// +// - ok: TRUE if point is inside. +func (self *Path) InFill(point *graphene.Point, fillRule FillRule) bool { + var _arg0 *C.GskPath // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.GskFillRule // out + var _cret C.gboolean // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(point))) + _arg2 = C.GskFillRule(fillRule) + + _cret = C.gsk_path_in_fill(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(point) + runtime.KeepAlive(fillRule) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsClosed returns if the path represents a single closed contour. +// +// The function returns the following values: +// +// - ok: TRUE if the path is closed. +func (self *Path) IsClosed() bool { + var _arg0 *C.GskPath // out + var _cret C.gboolean // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_is_closed(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsEmpty checks if the path is empty, i.e. contains no lines or curves. +// +// The function returns the following values: +// +// - ok: TRUE if the path is empty. +func (self *Path) IsEmpty() bool { + var _arg0 *C.GskPath // out + var _cret C.gboolean // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_is_empty(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ToCairo appends the given path to the given cairo context for drawing with +// Cairo. +// +// This may cause some suboptimal conversions to be performed as Cairo does not +// support all features of GskPath. +// +// This function does not clear the existing Cairo path. Call cairo_new_path() +// if you want this. +// +// The function takes the following parameters: +// +// - cr: cairo context. +func (self *Path) ToCairo(cr *cairo.Context) { + var _arg0 *C.GskPath // out + var _arg1 *C.cairo_t // out + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + + C.gsk_path_to_cairo(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(cr) +} + +// String converts the path into a string that is suitable for printing. +// +// You can use this function in a debugger to get a quick overview of the path. +// +// This is a wrapper around gsk.Path.Print(), see that function for details. +// +// The function returns the following values: +// +// - utf8: new string for self. +func (self *Path) String() string { + var _arg0 *C.GskPath // out + var _cret *C.char // in + + _arg0 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_to_string(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// PathParse: this is a convenience function that constructs a GskPath from a +// serialized form. +// +// The string is expected to be in (a superset of) SVG path syntax +// (https://www.w3.org/TR/SVG11/paths.htmlData), as e.g. produced by +// gsk.Path.ToString(). +// +// A high-level summary of the syntax: +// +// - M x y Move to (x, y) +// +// - L x y Add a line from the current point to (x, y) +// +// - Q x1 y1 x2 y2 Add a quadratic Bézier from the current point to (x2, y2), +// with control point (x1, y1) +// +// - C x1 y1 x2 y2 x3 y3 Add a cubic Bézier from the current point to (x3, y3), +// with control points (x1, y1) and (x2, y2) +// +// - Z Close the contour by drawing a line back to the start point +// +// - H x Add a horizontal line from the current point to the given x value +// +// - V y Add a vertical line from the current point to the given y value +// +// - T x2 y2 Add a quadratic Bézier, using the reflection of the previous +// segments' control point as control point +// +// - S x2 y2 x3 y3 Add a cubic Bézier, using the reflection of the previous +// segments' second control point as first control point +// +// - A rx ry r l s x y Add an elliptical arc from the current point to (x, y) +// with radii rx and ry. See the SVG documentation for how the other parameters +// influence the arc. +// +// - O x1 y1 x2 y2 w Add a rational quadratic Bézier from the current point to +// (x2, y2) with control point (x1, y1) and weight w. +// +// All the commands have lowercase variants that interpret coordinates relative +// to the current point. +// +// The O command is an extension that is not supported in SVG. +// +// The function takes the following parameters: +// +// - str: string. +// +// The function returns the following values: +// +// - path (optional): new GskPath, or NULL if string could not be parsed. +func PathParse(str string) *Path { + var _arg1 *C.char // out + var _cret *C.GskPath // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gsk_path_parse(_arg1) + runtime.KeepAlive(str) + + var _path *Path // out + + if _cret != nil { + _path = (*Path)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_path)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_path_unref((*C.GskPath)(intern.C)) + }, + ) + } + + return _path +} + +// PathBuilder: GskPathBuilder is an auxiliary object for constructing GskPath +// objects. +// +// A path is constructed like this: +// +// GskPath * +// construct_path (void) +// { +// GskPathBuilder *builder; +// +// builder = gsk_path_builder_new (); +// +// // add contours to the path here +// +// return gsk_path_builder_free_to_path (builder); +// +// Adding contours to the path can be done in two ways. The easiest +// option is to use the gsk_path_builder_add_* group of functions that +// add predefined contours to the current path, either common shapes +// like gsk.PathBuilder.AddCircle() or by adding from other paths like +// gsk.PathBuilder.AddPath(). +// +// The gsk_path_builder_add_* methods always add complete contours, and do not +// use or modify the current point. +// +// The other option is to define each line and curve manually with the +// gsk_path_builder_*_to group of functions. You start with a call to +// gsk.PathBuilder.MoveTo() to set the starting point and then use multiple +// calls to any of the drawing functions to move the pen along the plane. +// Once you are done, you can call gsk.PathBuilder.Close() to close the path by +// connecting it back with a line to the starting point. +// +// This is similar to how paths are drawn in Cairo. +// +// Note that GskPathBuilder will reduce the degree of added Bézier curves as +// much as possible, to simplify rendering. +// +// An instance of this type is always passed by reference. +type PathBuilder struct { + *pathBuilder +} + +// pathBuilder is the struct that's finalized. +type pathBuilder struct { + native *C.GskPathBuilder +} + +func marshalPathBuilder(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &PathBuilder{&pathBuilder{(*C.GskPathBuilder)(b)}}, nil +} + +// NewPathBuilder constructs a struct PathBuilder. +func NewPathBuilder() *PathBuilder { + var _cret *C.GskPathBuilder // in + + _cret = C.gsk_path_builder_new() + + var _pathBuilder *PathBuilder // out + + _pathBuilder = (*PathBuilder)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_pathBuilder)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_path_builder_unref((*C.GskPathBuilder)(intern.C)) + }, + ) + + return _pathBuilder +} + +// AddCircle adds a circle with the center and radius. +// +// The path is going around the circle in clockwise direction. +// +// If radius is zero, the contour will be a closed point. +// +// The function takes the following parameters: +// +// - center of the circle. +// - radius of the circle. +func (self *PathBuilder) AddCircle(center *graphene.Point, radius float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(center))) + _arg2 = C.float(radius) + + C.gsk_path_builder_add_circle(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(center) + runtime.KeepAlive(radius) +} + +// AddLayout adds the outlines for the glyphs in layout to the builder. +// +// The function takes the following parameters: +// +// - layout: pango layout to add. +func (self *PathBuilder) AddLayout(layout *pango.Layout) { + var _arg0 *C.GskPathBuilder // out + var _arg1 *C.PangoLayout // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.PangoLayout)(unsafe.Pointer(coreglib.InternObject(layout).Native())) + + C.gsk_path_builder_add_layout(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(layout) +} + +// AddPath appends all of path to the builder. +// +// The function takes the following parameters: +// +// - path to append. +func (self *PathBuilder) AddPath(path *Path) { + var _arg0 *C.GskPathBuilder // out + var _arg1 *C.GskPath // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + + C.gsk_path_builder_add_path(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(path) +} + +// AddRect adds rect as a new contour to the path built by the builder. +// +// The path is going around the rectangle in clockwise direction. +// +// If the the width or height are 0, the path will be a closed horizontal or +// vertical line. If both are 0, it'll be a closed dot. +// +// The function takes the following parameters: +// +// - rect: rectangle to create a path for. +func (self *PathBuilder) AddRect(rect *graphene.Rect) { + var _arg0 *C.GskPathBuilder // out + var _arg1 *C.graphene_rect_t // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(rect))) + + C.gsk_path_builder_add_rect(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(rect) +} + +// AddReversePath appends all of path to the builder, in reverse order. +// +// The function takes the following parameters: +// +// - path to append. +func (self *PathBuilder) AddReversePath(path *Path) { + var _arg0 *C.GskPathBuilder // out + var _arg1 *C.GskPath // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + + C.gsk_path_builder_add_reverse_path(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(path) +} + +// AddRoundedRect adds rect as a new contour to the path built in self. +// +// The path is going around the rectangle in clockwise direction. +// +// The function takes the following parameters: +// +// - rect: rounded rect. +func (self *PathBuilder) AddRoundedRect(rect *RoundedRect) { + var _arg0 *C.GskPathBuilder // out + var _arg1 *C.GskRoundedRect // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(rect))) + + C.gsk_path_builder_add_rounded_rect(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(rect) +} + +// AddSegment adds to self the segment of path from start to end. +// +// If start is equal to or after end, the path will first add the segment from +// start to the end of the path, and then add the segment from the beginning to +// end. If the path is closed, these segments will be connected. +// +// Note that this method always adds a path with the given start point and end +// point. To add a closed path, use gsk.PathBuilder.AddPath(). +// +// The function takes the following parameters: +// +// - path: GskPath to take the segment to. +// - start: point on path to start at. +// - end: point on path to end at. +func (self *PathBuilder) AddSegment(path *Path, start *PathPoint, end *PathPoint) { + var _arg0 *C.GskPathBuilder // out + var _arg1 *C.GskPath // out + var _arg2 *C.GskPathPoint // out + var _arg3 *C.GskPathPoint // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(start))) + _arg3 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(end))) + + C.gsk_path_builder_add_segment(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(self) + runtime.KeepAlive(path) + runtime.KeepAlive(start) + runtime.KeepAlive(end) +} + +// ArcTo adds an elliptical arc from the current point to x2, y2 with x1, +// y1 determining the tangent directions. +// +// After this, x2, y2 will be the new current point. +// +// Note: Two points and their tangents do not determine a unique ellipse, +// so GSK just picks one. If you need more precise control, use +// gsk.PathBuilder.ConicTo() or gsk.PathBuilder.SVGArcTo(). +// +// Arc To . +// +// The function takes the following parameters: +// +// - x1: x coordinate of first control point. +// - y1: y coordinate of first control point. +// - x2: x coordinate of second control point. +// - y2: y coordinate of second control point. +func (self *PathBuilder) ArcTo(x1 float32, y1 float32, x2 float32, y2 float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + + C.gsk_path_builder_arc_to(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) +} + +// Close ends the current contour with a line back to the start point. +// +// Note that this is different from calling gsk.PathBuilder.LineTo() with the +// start point in that the contour will be closed. A closed contour behaves +// differently from an open one. When stroking, its start and end point are +// considered connected, so they will be joined via the line join, and not ended +// with line caps. +func (self *PathBuilder) Close() { + var _arg0 *C.GskPathBuilder // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + + C.gsk_path_builder_close(_arg0) + runtime.KeepAlive(self) +} + +// ConicTo adds a conic curve +// (https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline) from the +// current point to x2, y2 with the given weight and x1, y1 as the control +// point. +// +// The weight determines how strongly the curve is pulled towards the control +// point. A conic with weight 1 is identical to a quadratic Bézier curve with +// the same points. +// +// Conic curves can be used to draw ellipses and circles. They are also known as +// rational quadratic Bézier curves. +// +// After this, x2, y2 will be the new current point. +// +// Conic To . +// +// The function takes the following parameters: +// +// - x1: x coordinate of control point. +// - y1: y coordinate of control point. +// - x2: x coordinate of the end of the curve. +// - y2: y coordinate of the end of the curve. +// - weight of the control point, must be greater than zero. +func (self *PathBuilder) ConicTo(x1 float32, y1 float32, x2 float32, y2 float32, weight float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + _arg5 = C.float(weight) + + C.gsk_path_builder_conic_to(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) + runtime.KeepAlive(weight) +} + +// CubicTo adds a cubic Bézier curve +// (https://en.wikipedia.org/wiki/BC3A9zier_curve) from the current point to x3, +// y3 with x1, y1 and x2, y2 as the control points. +// +// After this, x3, y3 will be the new current point. +// +// Cubic To . +// +// The function takes the following parameters: +// +// - x1: x coordinate of first control point. +// - y1: y coordinate of first control point. +// - x2: x coordinate of second control point. +// - y2: y coordinate of second control point. +// - x3: x coordinate of the end of the curve. +// - y3: y coordinate of the end of the curve. +func (self *PathBuilder) CubicTo(x1 float32, y1 float32, x2 float32, y2 float32, x3 float32, y3 float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + var _arg6 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + _arg5 = C.float(x3) + _arg6 = C.float(y3) + + C.gsk_path_builder_cubic_to(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) + runtime.KeepAlive(x3) + runtime.KeepAlive(y3) +} + +// CurrentPoint gets the current point. +// +// The current point is used for relative drawing commands and updated after +// every operation. +// +// When the builder is created, the default current point is set to 0, 0. Note +// that this is different from cairo, which starts out without a current point. +// +// The function returns the following values: +// +// - point: current point. +func (self *PathBuilder) CurrentPoint() *graphene.Point { + var _arg0 *C.GskPathBuilder // out + var _cret *C.graphene_point_t // in + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_builder_get_current_point(_arg0) + runtime.KeepAlive(self) + + var _point *graphene.Point // out + + _point = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _point +} + +// HtmlArcTo implements arc-to according to the HTML Canvas spec. +// +// A convenience function that implements the HTML arc_to +// (https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-arcto-dev) +// functionality. +// +// After this, the current point will be the point where the circle with the +// given radius touches the line from x1, y1 to x2, y2. +// +// The function takes the following parameters: +// +// - x1: x coordinate of first control point. +// - y1: y coordinate of first control point. +// - x2: x coordinate of second control point. +// - y2: y coordinate of second control point. +// - radius radius of the circle. +func (self *PathBuilder) HtmlArcTo(x1 float32, y1 float32, x2 float32, y2 float32, radius float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + _arg5 = C.float(radius) + + C.gsk_path_builder_html_arc_to(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) + runtime.KeepAlive(radius) +} + +// LineTo draws a line from the current point to x, y and makes it the new +// current point. +// +// Line To . +// +// The function takes the following parameters: +// +// - x coordinate. +// - y coordinate. +func (self *PathBuilder) LineTo(x float32, y float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x) + _arg2 = C.float(y) + + C.gsk_path_builder_line_to(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(x) + runtime.KeepAlive(y) +} + +// MoveTo starts a new contour by placing the pen at x, y. +// +// If this function is called twice in succession, the first call will result +// in a contour made up of a single point. The second call will start a new +// contour. +// +// The function takes the following parameters: +// +// - x coordinate. +// - y coordinate. +func (self *PathBuilder) MoveTo(x float32, y float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x) + _arg2 = C.float(y) + + C.gsk_path_builder_move_to(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(x) + runtime.KeepAlive(y) +} + +// QuadTo adds a quadratic Bézier curve +// (https://en.wikipedia.org/wiki/BC3A9zier_curve) from the current point to x2, +// y2 with x1, y1 as the control point. +// +// After this, x2, y2 will be the new current point. +// +// Quad To . +// +// The function takes the following parameters: +// +// - x1: x coordinate of control point. +// - y1: y coordinate of control point. +// - x2: x coordinate of the end of the curve. +// - y2: y coordinate of the end of the curve. +func (self *PathBuilder) QuadTo(x1 float32, y1 float32, x2 float32, y2 float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + + C.gsk_path_builder_quad_to(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) +} + +// RelArcTo adds an elliptical arc from the current point to x2, y2 with x1, +// y1 determining the tangent directions. +// +// All coordinates are given relative to the current point. +// +// This is the relative version of gsk.PathBuilder.ArcTo(). +// +// The function takes the following parameters: +// +// - x1: x coordinate of first control point. +// - y1: y coordinate of first control point. +// - x2: x coordinate of second control point. +// - y2: y coordinate of second control point. +func (self *PathBuilder) RelArcTo(x1 float32, y1 float32, x2 float32, y2 float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + + C.gsk_path_builder_rel_arc_to(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) +} + +// RelConicTo adds a conic curve +// (https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline) from the +// current point to x2, y2 with the given weight and x1, y1 as the control +// point. +// +// All coordinates are given relative to the current point. +// +// This is the relative version of gsk.PathBuilder.ConicTo(). +// +// The function takes the following parameters: +// +// - x1: x offset of control point. +// - y1: y offset of control point. +// - x2: x offset of the end of the curve. +// - y2: y offset of the end of the curve. +// - weight of the curve, must be greater than zero. +func (self *PathBuilder) RelConicTo(x1 float32, y1 float32, x2 float32, y2 float32, weight float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + _arg5 = C.float(weight) + + C.gsk_path_builder_rel_conic_to(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) + runtime.KeepAlive(weight) +} + +// RelCubicTo adds a cubic Bézier curve +// (https://en.wikipedia.org/wiki/BC3A9zier_curve) from the current point to x3, +// y3 with x1, y1 and x2, y2 as the control points. +// +// All coordinates are given relative to the current point. +// +// This is the relative version of gsk.PathBuilder.CubicTo(). +// +// The function takes the following parameters: +// +// - x1: x offset of first control point. +// - y1: y offset of first control point. +// - x2: x offset of second control point. +// - y2: y offset of second control point. +// - x3: x offset of the end of the curve. +// - y3: y offset of the end of the curve. +func (self *PathBuilder) RelCubicTo(x1 float32, y1 float32, x2 float32, y2 float32, x3 float32, y3 float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + var _arg6 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + _arg5 = C.float(x3) + _arg6 = C.float(y3) + + C.gsk_path_builder_rel_cubic_to(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) + runtime.KeepAlive(x3) + runtime.KeepAlive(y3) +} + +// RelHtmlArcTo implements arc-to according to the HTML Canvas spec. +// +// All coordinates are given relative to the current point. +// +// This is the relative version of gsk.PathBuilder.HtmlArcTo(). +// +// The function takes the following parameters: +// +// - x1: x coordinate of first control point. +// - y1: y coordinate of first control point. +// - x2: x coordinate of second control point. +// - y2: y coordinate of second control point. +// - radius radius of the circle. +func (self *PathBuilder) RelHtmlArcTo(x1 float32, y1 float32, x2 float32, y2 float32, radius float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _arg5 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + _arg5 = C.float(radius) + + C.gsk_path_builder_rel_html_arc_to(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) + runtime.KeepAlive(radius) +} + +// RelLineTo draws a line from the current point to a point offset from it by x, +// y and makes it the new current point. +// +// This is the relative version of gsk.PathBuilder.LineTo(). +// +// The function takes the following parameters: +// +// - x offset. +// - y offset. +func (self *PathBuilder) RelLineTo(x float32, y float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x) + _arg2 = C.float(y) + + C.gsk_path_builder_rel_line_to(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(x) + runtime.KeepAlive(y) +} + +// RelMoveTo starts a new contour by placing the pen at x, y relative to the +// current point. +// +// This is the relative version of gsk.PathBuilder.MoveTo(). +// +// The function takes the following parameters: +// +// - x offset. +// - y offset. +func (self *PathBuilder) RelMoveTo(x float32, y float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x) + _arg2 = C.float(y) + + C.gsk_path_builder_rel_move_to(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(x) + runtime.KeepAlive(y) +} + +// RelQuadTo adds a quadratic Bézier curve +// (https://en.wikipedia.org/wiki/BC3A9zier_curve) from the current point to x2, +// y2 with x1, y1 the control point. +// +// All coordinates are given relative to the current point. +// +// This is the relative version of gsk.PathBuilder.QuadTo(). +// +// The function takes the following parameters: +// +// - x1: x offset of control point. +// - y1: y offset of control point. +// - x2: x offset of the end of the curve. +// - y2: y offset of the end of the curve. +func (self *PathBuilder) RelQuadTo(x1 float32, y1 float32, x2 float32, y2 float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(x1) + _arg2 = C.float(y1) + _arg3 = C.float(x2) + _arg4 = C.float(y2) + + C.gsk_path_builder_rel_quad_to(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(self) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) + runtime.KeepAlive(x2) + runtime.KeepAlive(y2) +} + +// RelSVGArcTo implements arc-to according to the SVG spec. +// +// All coordinates are given relative to the current point. +// +// This is the relative version of gsk.PathBuilder.SVGArcTo(). +// +// The function takes the following parameters: +// +// - rx: x radius. +// - ry: y radius. +// - xAxisRotation: rotation of the ellipsis. +// - largeArc: whether to add the large arc. +// - positiveSweep: whether to sweep in the positive direction. +// - x: x coordinate of the endpoint. +// - y: y coordinate of the endpoint. +func (self *PathBuilder) RelSVGArcTo(rx float32, ry float32, xAxisRotation float32, largeArc bool, positiveSweep bool, x float32, y float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.gboolean // out + var _arg5 C.gboolean // out + var _arg6 C.float // out + var _arg7 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(rx) + _arg2 = C.float(ry) + _arg3 = C.float(xAxisRotation) + if largeArc { + _arg4 = C.TRUE + } + if positiveSweep { + _arg5 = C.TRUE + } + _arg6 = C.float(x) + _arg7 = C.float(y) + + C.gsk_path_builder_rel_svg_arc_to(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(self) + runtime.KeepAlive(rx) + runtime.KeepAlive(ry) + runtime.KeepAlive(xAxisRotation) + runtime.KeepAlive(largeArc) + runtime.KeepAlive(positiveSweep) + runtime.KeepAlive(x) + runtime.KeepAlive(y) +} + +// SVGArcTo implements arc-to according to the SVG spec. +// +// A convenience function that implements the SVG arc_to +// (https://www.w3.org/TR/SVG11/paths.htmlDataEllipticalArcCommands) +// functionality. +// +// After this, x, y will be the new current point. +// +// The function takes the following parameters: +// +// - rx: x radius. +// - ry: y radius. +// - xAxisRotation: rotation of the ellipsis. +// - largeArc: whether to add the large arc. +// - positiveSweep: whether to sweep in the positive direction. +// - x: x coordinate of the endpoint. +// - y: y coordinate of the endpoint. +func (self *PathBuilder) SVGArcTo(rx float32, ry float32, xAxisRotation float32, largeArc bool, positiveSweep bool, x float32, y float32) { + var _arg0 *C.GskPathBuilder // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.gboolean // out + var _arg5 C.gboolean // out + var _arg6 C.float // out + var _arg7 C.float // out + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(rx) + _arg2 = C.float(ry) + _arg3 = C.float(xAxisRotation) + if largeArc { + _arg4 = C.TRUE + } + if positiveSweep { + _arg5 = C.TRUE + } + _arg6 = C.float(x) + _arg7 = C.float(y) + + C.gsk_path_builder_svg_arc_to(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7) + runtime.KeepAlive(self) + runtime.KeepAlive(rx) + runtime.KeepAlive(ry) + runtime.KeepAlive(xAxisRotation) + runtime.KeepAlive(largeArc) + runtime.KeepAlive(positiveSweep) + runtime.KeepAlive(x) + runtime.KeepAlive(y) +} + +// ToPath creates a new GskPath from the given builder. +// +// The given GskPathBuilder is reset once this function returns; you cannot call +// this function multiple times on the same builder instance. +// +// This function is intended primarily for language bindings. C code should use +// gsk.PathBuilder.FreeToPath(). +// +// The function returns the following values: +// +// - path: newly created GskPath with all the contours added to the builder. +func (self *PathBuilder) ToPath() *Path { + var _arg0 *C.GskPathBuilder // out + var _cret *C.GskPath // in + + _arg0 = (*C.GskPathBuilder)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_builder_to_path(_arg0) + runtime.KeepAlive(self) + + var _path *Path // out + + _path = (*Path)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_path)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_path_unref((*C.GskPath)(intern.C)) + }, + ) + + return _path +} + +// PathMeasure: GskPathMeasure is an object that allows measurements on GskPaths +// such as determining the length of the path. +// +// Many measuring operations require sampling the path length at intermediate +// points. Therefore, a GskPathMeasure has a tolerance that determines what +// precision is required for such approximations. +// +// A GskPathMeasure struct is a reference counted struct and should be treated +// as opaque. +// +// An instance of this type is always passed by reference. +type PathMeasure struct { + *pathMeasure +} + +// pathMeasure is the struct that's finalized. +type pathMeasure struct { + native *C.GskPathMeasure +} + +func marshalPathMeasure(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &PathMeasure{&pathMeasure{(*C.GskPathMeasure)(b)}}, nil +} + +// NewPathMeasure constructs a struct PathMeasure. +func NewPathMeasure(path *Path) *PathMeasure { + var _arg1 *C.GskPath // out + var _cret *C.GskPathMeasure // in + + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C.gsk_path_measure_new(_arg1) + runtime.KeepAlive(path) + + var _pathMeasure *PathMeasure // out + + _pathMeasure = (*PathMeasure)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_pathMeasure)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_path_measure_unref((*C.GskPathMeasure)(intern.C)) + }, + ) + + return _pathMeasure +} + +// NewPathMeasureWithTolerance constructs a struct PathMeasure. +func NewPathMeasureWithTolerance(path *Path, tolerance float32) *PathMeasure { + var _arg1 *C.GskPath // out + var _arg2 C.float // out + var _cret *C.GskPathMeasure // in + + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = C.float(tolerance) + + _cret = C.gsk_path_measure_new_with_tolerance(_arg1, _arg2) + runtime.KeepAlive(path) + runtime.KeepAlive(tolerance) + + var _pathMeasure *PathMeasure // out + + _pathMeasure = (*PathMeasure)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_pathMeasure)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_path_measure_unref((*C.GskPathMeasure)(intern.C)) + }, + ) + + return _pathMeasure +} + +// Length gets the length of the path being measured. +// +// The length is cached, so this function does not do any work. +// +// The function returns the following values: +// +// - gfloat: length of the path measured by self. +func (self *PathMeasure) Length() float32 { + var _arg0 *C.GskPathMeasure // out + var _cret C.float // in + + _arg0 = (*C.GskPathMeasure)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_measure_get_length(_arg0) + runtime.KeepAlive(self) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Path returns the path that the measure was created for. +// +// The function returns the following values: +// +// - path of self. +func (self *PathMeasure) Path() *Path { + var _arg0 *C.GskPathMeasure // out + var _cret *C.GskPath // in + + _arg0 = (*C.GskPathMeasure)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_measure_get_path(_arg0) + runtime.KeepAlive(self) + + var _path *Path // out + + _path = (*Path)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.gsk_path_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_path)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_path_unref((*C.GskPath)(intern.C)) + }, + ) + + return _path +} + +// Point sets result to the point at the given distance into the path. +// +// An empty path has no points, so FALSE is returned in that case. +// +// The function takes the following parameters: +// +// - distance: distance. +// +// The function returns the following values: +// +// - result: return location for the result. +// - ok: TRUE if result was set. +func (self *PathMeasure) Point(distance float32) (*PathPoint, bool) { + var _arg0 *C.GskPathMeasure // out + var _arg1 C.float // out + var _arg2 C.GskPathPoint // in + var _cret C.gboolean // in + + _arg0 = (*C.GskPathMeasure)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(distance) + + _cret = C.gsk_path_measure_get_point(_arg0, _arg1, &_arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(distance) + + var _result *PathPoint // out + var _ok bool // out + + _result = (*PathPoint)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + if _cret != 0 { + _ok = true + } + + return _result, _ok +} + +// Tolerance returns the tolerance that the measure was created with. +// +// The function returns the following values: +// +// - gfloat: tolerance of self. +func (self *PathMeasure) Tolerance() float32 { + var _arg0 *C.GskPathMeasure // out + var _cret C.float // in + + _arg0 = (*C.GskPathMeasure)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_path_measure_get_tolerance(_arg0) + runtime.KeepAlive(self) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// PathPoint: GskPathPoint is an opaque type representing a point on a path. +// +// It can be queried for properties of the path at that point, such as its +// tangent or its curvature. +// +// To obtain a GskPathPoint, use gsk.Path.GetClosestPoint(), +// gsk.Path.GetStartPoint(), gsk.Path.GetEndPoint() or +// gsk.PathMeasure.GetPoint(). +// +// Note that GskPathPoint structs are meant to be stack-allocated, and don't +// hold a reference to the path object they are obtained from. It is the callers +// responsibility to keep a reference to the path as long as the GskPathPoint is +// used. +// +// An instance of this type is always passed by reference. +type PathPoint struct { + *pathPoint +} + +// pathPoint is the struct that's finalized. +type pathPoint struct { + native *C.GskPathPoint +} + +func marshalPathPoint(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &PathPoint{&pathPoint{(*C.GskPathPoint)(b)}}, nil +} + +// Compare returns whether point1 is before or after point2. +// +// The function takes the following parameters: +// +// - point2: another GskPathPoint. +// +// The function returns the following values: +// +// - gint: -1 if point1 is before point2, 1 if point1 is after point2, +// 0 if they are equal. +func (point1 *PathPoint) Compare(point2 *PathPoint) int { + var _arg0 *C.GskPathPoint // out + var _arg1 *C.GskPathPoint // out + var _cret C.int // in + + _arg0 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point1))) + _arg1 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point2))) + + _cret = C.gsk_path_point_compare(_arg0, _arg1) + runtime.KeepAlive(point1) + runtime.KeepAlive(point2) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +func (point *PathPoint) Copy() *PathPoint { + var _arg0 *C.GskPathPoint // out + var _cret *C.GskPathPoint // in + + _arg0 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.gsk_path_point_copy(_arg0) + runtime.KeepAlive(point) + + var _pathPoint *PathPoint // out + + _pathPoint = (*PathPoint)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_pathPoint)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_path_point_free((*C.GskPathPoint)(intern.C)) + }, + ) + + return _pathPoint +} + +// Equal returns whether the two path points refer to the same location on all +// paths. +// +// Note that the start- and endpoint of a closed contour will compare nonequal +// according to this definition. Use gsk.Path.IsClosed() to find out if the +// start- and endpoint of a concrete path refer to the same location. +// +// The function takes the following parameters: +// +// - point2: another GskPathPoint. +// +// The function returns the following values: +// +// - ok: TRUE if point1 and point2 are equal. +func (point1 *PathPoint) Equal(point2 *PathPoint) bool { + var _arg0 *C.GskPathPoint // out + var _arg1 *C.GskPathPoint // out + var _cret C.gboolean // in + + _arg0 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point1))) + _arg1 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point2))) + + _cret = C.gsk_path_point_equal(_arg0, _arg1) + runtime.KeepAlive(point1) + runtime.KeepAlive(point2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Curvature calculates the curvature of the path at the point. +// +// Optionally, returns the center of the osculating circle as well. The +// curvature is the inverse of the radius of the osculating circle. +// +// Lines have a curvature of zero (indicating an osculating circle of infinite +// radius. In this case, the center is not modified. +// +// # Circles with a radius of zero have INFINITY as curvature +// +// Note that certain points on a path may not have a single curvature, such as +// sharp turns. At such points, there are two curvatures -- the (limit of) the +// curvature of the path going into the point, and the (limit of) the curvature +// of the path coming out of it. The direction argument lets you choose which +// one to get. +// +// Osculating circle . +// +// The function takes the following parameters: +// +// - path that point is on. +// - direction for which to return the curvature. +// +// The function returns the following values: +// +// - center (optional): return location for the center of the osculating +// circle. +// - gfloat: curvature of the path at the given point. +func (point *PathPoint) Curvature(path *Path, direction PathDirection) (*graphene.Point, float32) { + var _arg0 *C.GskPathPoint // out + var _arg1 *C.GskPath // out + var _arg2 C.GskPathDirection // out + var _arg3 C.graphene_point_t // in + var _cret C.float // in + + _arg0 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point))) + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = C.GskPathDirection(direction) + + _cret = C.gsk_path_point_get_curvature(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(point) + runtime.KeepAlive(path) + runtime.KeepAlive(direction) + + var _center *graphene.Point // out + var _gfloat float32 // out + + _center = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + _gfloat = float32(_cret) + + return _center, _gfloat +} + +// Distance returns the distance from the beginning of the path to point. +// +// The function takes the following parameters: +// +// - measure: GskPathMeasure for the path. +// +// The function returns the following values: +// +// - gfloat: distance of point. +func (point *PathPoint) Distance(measure *PathMeasure) float32 { + var _arg0 *C.GskPathPoint // out + var _arg1 *C.GskPathMeasure // out + var _cret C.float // in + + _arg0 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point))) + _arg1 = (*C.GskPathMeasure)(gextras.StructNative(unsafe.Pointer(measure))) + + _cret = C.gsk_path_point_get_distance(_arg0, _arg1) + runtime.KeepAlive(point) + runtime.KeepAlive(measure) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Position gets the position of the point. +// +// The function takes the following parameters: +// +// - path that point is on. +// +// The function returns the following values: +// +// - position: return location for the coordinates of the point. +func (point *PathPoint) Position(path *Path) *graphene.Point { + var _arg0 *C.GskPathPoint // out + var _arg1 *C.GskPath // out + var _arg2 C.graphene_point_t // in + + _arg0 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point))) + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + + C.gsk_path_point_get_position(_arg0, _arg1, &_arg2) + runtime.KeepAlive(point) + runtime.KeepAlive(path) + + var _position *graphene.Point // out + + _position = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _position +} + +// Rotation gets the direction of the tangent at a given point. +// +// This is a convenience variant of gsk.PathPoint.GetTangent() that returns +// the angle between the tangent and the X axis. The angle can e.g. be used in +// gtk_snapshot_rotate() (../gtk4/method.Snapshot.rotate.html). +// +// The function takes the following parameters: +// +// - path that point is on. +// - direction for which to return the rotation. +// +// The function returns the following values: +// +// - gfloat: angle between the tangent and the X axis, in degrees. +func (point *PathPoint) Rotation(path *Path, direction PathDirection) float32 { + var _arg0 *C.GskPathPoint // out + var _arg1 *C.GskPath // out + var _arg2 C.GskPathDirection // out + var _cret C.float // in + + _arg0 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point))) + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = C.GskPathDirection(direction) + + _cret = C.gsk_path_point_get_rotation(_arg0, _arg1, _arg2) + runtime.KeepAlive(point) + runtime.KeepAlive(path) + runtime.KeepAlive(direction) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Tangent gets the tangent of the path at the point. +// +// Note that certain points on a path may not have a single tangent, such as +// sharp turns. At such points, there are two tangents -- the direction of the +// path going into the point, and the direction coming out of it. The direction +// argument lets you choose which one to get. +// +// If the path is just a single point (e.g. a circle with radius zero), then +// tangent is set to 0, 0. +// +// If you want to orient something in the direction of the path, +// gsk.PathPoint.GetRotation() may be more convenient to use. +// +// The function takes the following parameters: +// +// - path that point is on. +// - direction for which to return the tangent. +// +// The function returns the following values: +// +// - tangent: return location for the tangent at the point. +func (point *PathPoint) Tangent(path *Path, direction PathDirection) *graphene.Vec2 { + var _arg0 *C.GskPathPoint // out + var _arg1 *C.GskPath // out + var _arg2 C.GskPathDirection // out + var _arg3 C.graphene_vec2_t // in + + _arg0 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point))) + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = C.GskPathDirection(direction) + + C.gsk_path_point_get_tangent(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(point) + runtime.KeepAlive(path) + runtime.KeepAlive(direction) + + var _tangent *graphene.Vec2 // out + + _tangent = (*graphene.Vec2)(gextras.NewStructNative(unsafe.Pointer((&_arg3)))) + + return _tangent +} + +// RoundedRect: rectangular region with rounded corners. +// +// Application code should normalize rectangles using +// gsk.RoundedRect.Normalize(); this function will ensure that the bounds of the +// rectangle are normalized and ensure that the corner values are positive and +// the corners do not overlap. +// +// All functions taking a GskRoundedRect as an argument will internally operate +// on a normalized copy; all functions returning a GskRoundedRect will always +// return a normalized one. +// +// The algorithm used for normalizing corner sizes is described in the CSS +// specification (https://drafts.csswg.org/css-backgrounds-3/#border-radius). +// +// An instance of this type is always passed by reference. +type RoundedRect struct { + *roundedRect +} + +// roundedRect is the struct that's finalized. +type roundedRect struct { + native *C.GskRoundedRect +} + +// Bounds bounds of the rectangle. +func (r *RoundedRect) Bounds() *graphene.Rect { + valptr := &r.native.bounds + var _v *graphene.Rect // out + _v = (*graphene.Rect)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// Corner: size of the 4 rounded corners. +func (r *RoundedRect) Corner() [4]graphene.Size { + valptr := &r.native.corner + var _v [4]graphene.Size // out + { + src := &*valptr + for i := 0; i < 4; i++ { + _v[i] = *(*graphene.Size)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + return _v +} + +// ContainsPoint checks if the given point is inside the rounded rectangle. +// +// The function takes the following parameters: +// +// - point to check. +// +// The function returns the following values: +// +// - ok: TRUE if the point is inside the rounded rectangle. +func (self *RoundedRect) ContainsPoint(point *graphene.Point) bool { + var _arg0 *C.GskRoundedRect // out + var _arg1 *C.graphene_point_t // out + var _cret C.gboolean // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.gsk_rounded_rect_contains_point(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(point) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ContainsRect checks if the given rect is contained inside the rounded +// rectangle. +// +// The function takes the following parameters: +// +// - rect: rectangle to check. +// +// The function returns the following values: +// +// - ok: TRUE if the rect is fully contained inside the rounded rectangle. +func (self *RoundedRect) ContainsRect(rect *graphene.Rect) bool { + var _arg0 *C.GskRoundedRect // out + var _arg1 *C.graphene_rect_t // out + var _cret C.gboolean // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(rect))) + + _cret = C.gsk_rounded_rect_contains_rect(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(rect) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Init initializes the given GskRoundedRect with the given values. +// +// This function will implicitly normalize the GskRoundedRect before returning. +// +// The function takes the following parameters: +// +// - bounds: graphene_rect_t describing the bounds. +// - topLeft: rounding radius of the top left corner. +// - topRight: rounding radius of the top right corner. +// - bottomRight: rounding radius of the bottom right corner. +// - bottomLeft: rounding radius of the bottom left corner. +// +// The function returns the following values: +// +// - roundedRect: initialized rectangle. +func (self *RoundedRect) Init(bounds *graphene.Rect, topLeft *graphene.Size, topRight *graphene.Size, bottomRight *graphene.Size, bottomLeft *graphene.Size) *RoundedRect { + var _arg0 *C.GskRoundedRect // out + var _arg1 *C.graphene_rect_t // out + var _arg2 *C.graphene_size_t // out + var _arg3 *C.graphene_size_t // out + var _arg4 *C.graphene_size_t // out + var _arg5 *C.graphene_size_t // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg2 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(topLeft))) + _arg3 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(topRight))) + _arg4 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(bottomRight))) + _arg5 = (*C.graphene_size_t)(gextras.StructNative(unsafe.Pointer(bottomLeft))) + + _cret = C.gsk_rounded_rect_init(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(self) + runtime.KeepAlive(bounds) + runtime.KeepAlive(topLeft) + runtime.KeepAlive(topRight) + runtime.KeepAlive(bottomRight) + runtime.KeepAlive(bottomLeft) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// InitCopy initializes self using the given src rectangle. +// +// This function will not normalize the GskRoundedRect, so make sure the source +// is normalized. +// +// The function takes the following parameters: +// +// - src: GskRoundedRect. +// +// The function returns the following values: +// +// - roundedRect: initialized rectangle. +func (self *RoundedRect) InitCopy(src *RoundedRect) *RoundedRect { + var _arg0 *C.GskRoundedRect // out + var _arg1 *C.GskRoundedRect // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(src))) + + _cret = C.gsk_rounded_rect_init_copy(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(src) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// InitFromRect initializes self to the given bounds and sets the radius of all +// four corners to radius. +// +// The function takes the following parameters: +// +// - bounds: graphene_rect_t. +// - radius: border radius. +// +// The function returns the following values: +// +// - roundedRect: initialized rectangle. +func (self *RoundedRect) InitFromRect(bounds *graphene.Rect, radius float32) *RoundedRect { + var _arg0 *C.GskRoundedRect // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.float // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(bounds))) + _arg2 = C.float(radius) + + _cret = C.gsk_rounded_rect_init_from_rect(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(bounds) + runtime.KeepAlive(radius) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// IntersectsRect checks if part of the given rect is contained inside the +// rounded rectangle. +// +// The function takes the following parameters: +// +// - rect: rectangle to check. +// +// The function returns the following values: +// +// - ok: TRUE if the rect intersects with the rounded rectangle. +func (self *RoundedRect) IntersectsRect(rect *graphene.Rect) bool { + var _arg0 *C.GskRoundedRect // out + var _arg1 *C.graphene_rect_t // out + var _cret C.gboolean // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(rect))) + + _cret = C.gsk_rounded_rect_intersects_rect(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(rect) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsRectilinear checks if all corners of self are right angles and the +// rectangle covers all of its bounds. +// +// This information can be used to decide if gsk.ClipNode.New or +// gsk.RoundedClipNode.New should be called. +// +// The function returns the following values: +// +// - ok: TRUE if the rectangle is rectilinear. +func (self *RoundedRect) IsRectilinear() bool { + var _arg0 *C.GskRoundedRect // out + var _cret C.gboolean // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_rounded_rect_is_rectilinear(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Normalize normalizes the passed rectangle. +// +// This function will ensure that the bounds of the rectangle are normalized and +// ensure that the corner values are positive and the corners do not overlap. +// +// The function returns the following values: +// +// - roundedRect: normalized rectangle. +func (self *RoundedRect) Normalize() *RoundedRect { + var _arg0 *C.GskRoundedRect // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_rounded_rect_normalize(_arg0) + runtime.KeepAlive(self) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// Offset offsets the bound's origin by dx and dy. +// +// The size and corners of the rectangle are unchanged. +// +// The function takes the following parameters: +// +// - dx: horizontal offset. +// - dy: vertical offset. +// +// The function returns the following values: +// +// - roundedRect: offset rectangle. +func (self *RoundedRect) Offset(dx float32, dy float32) *RoundedRect { + var _arg0 *C.GskRoundedRect // out + var _arg1 C.float // out + var _arg2 C.float // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(dx) + _arg2 = C.float(dy) + + _cret = C.gsk_rounded_rect_offset(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(dx) + runtime.KeepAlive(dy) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// Shrink shrinks (or grows) the given rectangle by moving the 4 sides according +// to the offsets given. +// +// The corner radii will be changed in a way that tries to keep the center of +// the corner circle intact. This emulates CSS behavior. +// +// This function also works for growing rectangles if you pass negative values +// for the top, right, bottom or left. +// +// The function takes the following parameters: +// +// - top: how far to move the top side downwards. +// - right: how far to move the right side to the left. +// - bottom: how far to move the bottom side upwards. +// - left: how far to move the left side to the right. +// +// The function returns the following values: +// +// - roundedRect: resized GskRoundedRect. +func (self *RoundedRect) Shrink(top float32, right float32, bottom float32, left float32) *RoundedRect { + var _arg0 *C.GskRoundedRect // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // out + var _cret *C.GskRoundedRect // in + + _arg0 = (*C.GskRoundedRect)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(top) + _arg2 = C.float(right) + _arg3 = C.float(bottom) + _arg4 = C.float(left) + + _cret = C.gsk_rounded_rect_shrink(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(self) + runtime.KeepAlive(top) + runtime.KeepAlive(right) + runtime.KeepAlive(bottom) + runtime.KeepAlive(left) + + var _roundedRect *RoundedRect // out + + _roundedRect = (*RoundedRect)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _roundedRect +} + +// ShaderArgsBuilder: object to build the uniforms data for a GskGLShader. +// +// An instance of this type is always passed by reference. +type ShaderArgsBuilder struct { + *shaderArgsBuilder +} + +// shaderArgsBuilder is the struct that's finalized. +type shaderArgsBuilder struct { + native *C.GskShaderArgsBuilder +} + +func marshalShaderArgsBuilder(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &ShaderArgsBuilder{&shaderArgsBuilder{(*C.GskShaderArgsBuilder)(b)}}, nil +} + +// NewShaderArgsBuilder constructs a struct ShaderArgsBuilder. +func NewShaderArgsBuilder(shader *GLShader, initialValues *glib.Bytes) *ShaderArgsBuilder { + var _arg1 *C.GskGLShader // out + var _arg2 *C.GBytes // out + var _cret *C.GskShaderArgsBuilder // in + + _arg1 = (*C.GskGLShader)(unsafe.Pointer(coreglib.InternObject(shader).Native())) + if initialValues != nil { + _arg2 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(initialValues))) + } + + _cret = C.gsk_shader_args_builder_new(_arg1, _arg2) + runtime.KeepAlive(shader) + runtime.KeepAlive(initialValues) + + var _shaderArgsBuilder *ShaderArgsBuilder // out + + _shaderArgsBuilder = (*ShaderArgsBuilder)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_shaderArgsBuilder)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_shader_args_builder_unref((*C.GskShaderArgsBuilder)(intern.C)) + }, + ) + + return _shaderArgsBuilder +} + +// SetBool sets the value of the uniform idx. +// +// The uniform must be of bool type. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// - value to set the uniform to. +func (builder *ShaderArgsBuilder) SetBool(idx int, value bool) { + var _arg0 *C.GskShaderArgsBuilder // out + var _arg1 C.int // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GskShaderArgsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = C.int(idx) + if value { + _arg2 = C.TRUE + } + + C.gsk_shader_args_builder_set_bool(_arg0, _arg1, _arg2) + runtime.KeepAlive(builder) + runtime.KeepAlive(idx) + runtime.KeepAlive(value) +} + +// SetFloat sets the value of the uniform idx. +// +// The uniform must be of float type. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// - value to set the uniform to. +func (builder *ShaderArgsBuilder) SetFloat(idx int, value float32) { + var _arg0 *C.GskShaderArgsBuilder // out + var _arg1 C.int // out + var _arg2 C.float // out + + _arg0 = (*C.GskShaderArgsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = C.int(idx) + _arg2 = C.float(value) + + C.gsk_shader_args_builder_set_float(_arg0, _arg1, _arg2) + runtime.KeepAlive(builder) + runtime.KeepAlive(idx) + runtime.KeepAlive(value) +} + +// SetInt sets the value of the uniform idx. +// +// The uniform must be of int type. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// - value to set the uniform to. +func (builder *ShaderArgsBuilder) SetInt(idx int, value int32) { + var _arg0 *C.GskShaderArgsBuilder // out + var _arg1 C.int // out + var _arg2 C.gint32 // out + + _arg0 = (*C.GskShaderArgsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = C.int(idx) + _arg2 = C.gint32(value) + + C.gsk_shader_args_builder_set_int(_arg0, _arg1, _arg2) + runtime.KeepAlive(builder) + runtime.KeepAlive(idx) + runtime.KeepAlive(value) +} + +// SetUint sets the value of the uniform idx. +// +// The uniform must be of uint type. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// - value to set the uniform to. +func (builder *ShaderArgsBuilder) SetUint(idx int, value uint32) { + var _arg0 *C.GskShaderArgsBuilder // out + var _arg1 C.int // out + var _arg2 C.guint32 // out + + _arg0 = (*C.GskShaderArgsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = C.int(idx) + _arg2 = C.guint32(value) + + C.gsk_shader_args_builder_set_uint(_arg0, _arg1, _arg2) + runtime.KeepAlive(builder) + runtime.KeepAlive(idx) + runtime.KeepAlive(value) +} + +// SetVec2 sets the value of the uniform idx. +// +// The uniform must be of vec2 type. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// - value to set the uniform too. +func (builder *ShaderArgsBuilder) SetVec2(idx int, value *graphene.Vec2) { + var _arg0 *C.GskShaderArgsBuilder // out + var _arg1 C.int // out + var _arg2 *C.graphene_vec2_t // out + + _arg0 = (*C.GskShaderArgsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = C.int(idx) + _arg2 = (*C.graphene_vec2_t)(gextras.StructNative(unsafe.Pointer(value))) + + C.gsk_shader_args_builder_set_vec2(_arg0, _arg1, _arg2) + runtime.KeepAlive(builder) + runtime.KeepAlive(idx) + runtime.KeepAlive(value) +} + +// SetVec3 sets the value of the uniform idx. +// +// The uniform must be of vec3 type. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// - value to set the uniform too. +func (builder *ShaderArgsBuilder) SetVec3(idx int, value *graphene.Vec3) { + var _arg0 *C.GskShaderArgsBuilder // out + var _arg1 C.int // out + var _arg2 *C.graphene_vec3_t // out + + _arg0 = (*C.GskShaderArgsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = C.int(idx) + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(value))) + + C.gsk_shader_args_builder_set_vec3(_arg0, _arg1, _arg2) + runtime.KeepAlive(builder) + runtime.KeepAlive(idx) + runtime.KeepAlive(value) +} + +// SetVec4 sets the value of the uniform idx. +// +// The uniform must be of vec4 type. +// +// The function takes the following parameters: +// +// - idx: index of the uniform. +// - value to set the uniform too. +func (builder *ShaderArgsBuilder) SetVec4(idx int, value *graphene.Vec4) { + var _arg0 *C.GskShaderArgsBuilder // out + var _arg1 C.int // out + var _arg2 *C.graphene_vec4_t // out + + _arg0 = (*C.GskShaderArgsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + _arg1 = C.int(idx) + _arg2 = (*C.graphene_vec4_t)(gextras.StructNative(unsafe.Pointer(value))) + + C.gsk_shader_args_builder_set_vec4(_arg0, _arg1, _arg2) + runtime.KeepAlive(builder) + runtime.KeepAlive(idx) + runtime.KeepAlive(value) +} + +// ToArgs creates a new GBytes args from the current state of the given builder. +// +// Any uniforms of the shader that have not been explicitly set on the builder +// are zero-initialized. +// +// The given GskShaderArgsBuilder is reset once this function returns; +// you cannot call this function multiple times on the same builder instance. +// +// This function is intended primarily for bindings. C code should use +// gsk.ShaderArgsBuilder.FreeToArgs(). +// +// The function returns the following values: +// +// - bytes: newly allocated buffer with all the args added to builder. +func (builder *ShaderArgsBuilder) ToArgs() *glib.Bytes { + var _arg0 *C.GskShaderArgsBuilder // out + var _cret *C.GBytes // in + + _arg0 = (*C.GskShaderArgsBuilder)(gextras.StructNative(unsafe.Pointer(builder))) + + _cret = C.gsk_shader_args_builder_to_args(_arg0) + runtime.KeepAlive(builder) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// Shadow: shadow parameters in a shadow node. +// +// An instance of this type is always passed by reference. +type Shadow struct { + *shadow +} + +// shadow is the struct that's finalized. +type shadow struct { + native *C.GskShadow +} + +// Color: color of the shadow. +func (s *Shadow) Color() *gdk.RGBA { + valptr := &s.native.color + var _v *gdk.RGBA // out + _v = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer(valptr))) + return _v +} + +// Dx: horizontal offset of the shadow. +func (s *Shadow) Dx() float32 { + valptr := &s.native.dx + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Dy: vertical offset of the shadow. +func (s *Shadow) Dy() float32 { + valptr := &s.native.dy + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Radius radius of the shadow. +func (s *Shadow) Radius() float32 { + valptr := &s.native.radius + var _v float32 // out + _v = float32(*valptr) + return _v +} + +// Dx: horizontal offset of the shadow. +func (s *Shadow) SetDx(dx float32) { + valptr := &s.native.dx + *valptr = C.float(dx) +} + +// Dy: vertical offset of the shadow. +func (s *Shadow) SetDy(dy float32) { + valptr := &s.native.dy + *valptr = C.float(dy) +} + +// Radius radius of the shadow. +func (s *Shadow) SetRadius(radius float32) { + valptr := &s.native.radius + *valptr = C.float(radius) +} + +// Stroke: GskStroke struct collects the parameters that influence the operation +// of stroking a path. +// +// An instance of this type is always passed by reference. +type Stroke struct { + *stroke +} + +// stroke is the struct that's finalized. +type stroke struct { + native *C.GskStroke +} + +func marshalStroke(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Stroke{&stroke{(*C.GskStroke)(b)}}, nil +} + +// NewStroke constructs a struct Stroke. +func NewStroke(lineWidth float32) *Stroke { + var _arg1 C.float // out + var _cret *C.GskStroke // in + + _arg1 = C.float(lineWidth) + + _cret = C.gsk_stroke_new(_arg1) + runtime.KeepAlive(lineWidth) + + var _stroke *Stroke // out + + _stroke = (*Stroke)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_stroke)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_stroke_free((*C.GskStroke)(intern.C)) + }, + ) + + return _stroke +} + +// Copy creates a copy of the given other stroke. +// +// The function returns the following values: +// +// - stroke: new GskStroke. Use gsk.Stroke.Free() to free it. +func (other *Stroke) Copy() *Stroke { + var _arg0 *C.GskStroke // out + var _cret *C.GskStroke // in + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(other))) + + _cret = C.gsk_stroke_copy(_arg0) + runtime.KeepAlive(other) + + var _stroke *Stroke // out + + _stroke = (*Stroke)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_stroke)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_stroke_free((*C.GskStroke)(intern.C)) + }, + ) + + return _stroke +} + +// Dash gets the dash array in use or NULL if dashing is disabled. +// +// The function returns the following values: +// +// - gfloats (optional): The dash array or NULL if the dash array is empty. +func (self *Stroke) Dash() []float32 { + var _arg0 *C.GskStroke // out + var _cret *C.float // in + var _arg1 C.gsize // in + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_stroke_get_dash(_arg0, &_arg1) + runtime.KeepAlive(self) + + var _gfloats []float32 // out + + if _cret != nil { + _gfloats = make([]float32, _arg1) + copy(_gfloats, unsafe.Slice((*float32)(unsafe.Pointer(_cret)), _arg1)) + } + + return _gfloats +} + +// DashOffset returns the dash_offset of a GskStroke. +func (self *Stroke) DashOffset() float32 { + var _arg0 *C.GskStroke // out + var _cret C.float // in + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_stroke_get_dash_offset(_arg0) + runtime.KeepAlive(self) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// LineCap gets the line cap used. +// +// See gsk.LineCap for details. +// +// The function returns the following values: +// +// - lineCap: line cap. +func (self *Stroke) LineCap() LineCap { + var _arg0 *C.GskStroke // out + var _cret C.GskLineCap // in + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_stroke_get_line_cap(_arg0) + runtime.KeepAlive(self) + + var _lineCap LineCap // out + + _lineCap = LineCap(_cret) + + return _lineCap +} + +// LineJoin gets the line join used. +// +// See gsk.LineJoin for details. +// +// The function returns the following values: +// +// - lineJoin: line join. +func (self *Stroke) LineJoin() LineJoin { + var _arg0 *C.GskStroke // out + var _cret C.GskLineJoin // in + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_stroke_get_line_join(_arg0) + runtime.KeepAlive(self) + + var _lineJoin LineJoin // out + + _lineJoin = LineJoin(_cret) + + return _lineJoin +} + +// LineWidth gets the line width used. +// +// The function returns the following values: +// +// - gfloat: line width. +func (self *Stroke) LineWidth() float32 { + var _arg0 *C.GskStroke // out + var _cret C.float // in + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_stroke_get_line_width(_arg0) + runtime.KeepAlive(self) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// MiterLimit returns the miter limit of a GskStroke. +func (self *Stroke) MiterLimit() float32 { + var _arg0 *C.GskStroke // out + var _cret C.float // in + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + + _cret = C.gsk_stroke_get_miter_limit(_arg0) + runtime.KeepAlive(self) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// SetDash sets the dash pattern to use by this stroke. +// +// A dash pattern is specified by an array of alternating non-negative values. +// Each value provides the length of alternate "on" and "off" portions of the +// stroke. +// +// Each "on" segment will have caps applied as if the segment were a separate +// contour. In particular, it is valid to use an "on" length of 0 with +// GSK_LINE_CAP_ROUND or GSK_LINE_CAP_SQUARE to draw dots or squares along a +// path. +// +// If n_dash is 0, if all elements in dash are 0, or if there are negative +// values in dash, then dashing is disabled. +// +// If n_dash is 1, an alternating "on" and "off" pattern with the single dash +// length provided is assumed. +// +// If n_dash is uneven, the dash array will be used with the first element in +// dash defining an "on" or "off" in alternating passes through the array. +// +// You can specify a starting offset into the dash with +// gsk.Stroke.SetDashOffset(). +// +// The function takes the following parameters: +// +// - dash (optional): the array of dashes. +func (self *Stroke) SetDash(dash []float32) { + var _arg0 *C.GskStroke // out + var _arg1 *C.float // out + var _arg2 C.gsize + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + _arg2 = (C.gsize)(len(dash)) + if len(dash) > 0 { + _arg1 = (*C.float)(unsafe.Pointer(&dash[0])) + } + + C.gsk_stroke_set_dash(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(dash) +} + +// SetDashOffset sets the offset into the dash pattern where dashing should +// begin. +// +// This is an offset into the length of the path, not an index into the array +// values of the dash array. +// +// See gsk.Stroke.SetDash() for more details on dashing. +// +// The function takes the following parameters: +// +// - offset into the dash pattern. +func (self *Stroke) SetDashOffset(offset float32) { + var _arg0 *C.GskStroke // out + var _arg1 C.float // out + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(offset) + + C.gsk_stroke_set_dash_offset(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(offset) +} + +// SetLineCap sets the line cap to be used when stroking. +// +// See gsk.LineCap for details. +// +// The function takes the following parameters: +// +// - lineCap: GskLineCap. +func (self *Stroke) SetLineCap(lineCap LineCap) { + var _arg0 *C.GskStroke // out + var _arg1 C.GskLineCap // out + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.GskLineCap(lineCap) + + C.gsk_stroke_set_line_cap(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(lineCap) +} + +// SetLineJoin sets the line join to be used when stroking. +// +// See gsk.LineJoin for details. +// +// The function takes the following parameters: +// +// - lineJoin: line join to use. +func (self *Stroke) SetLineJoin(lineJoin LineJoin) { + var _arg0 *C.GskStroke // out + var _arg1 C.GskLineJoin // out + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.GskLineJoin(lineJoin) + + C.gsk_stroke_set_line_join(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(lineJoin) +} + +// SetLineWidth sets the line width to be used when stroking. +// +// The line width must be > 0. +// +// The function takes the following parameters: +// +// - lineWidth: width of the line in pixels. +func (self *Stroke) SetLineWidth(lineWidth float32) { + var _arg0 *C.GskStroke // out + var _arg1 C.float // out + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(lineWidth) + + C.gsk_stroke_set_line_width(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(lineWidth) +} + +// SetMiterLimit sets the limit for the distance from the corner where sharp +// turns of joins get cut off. +// +// The miter limit is in units of line width and must be non-negative. +// +// For joins of type GSK_LINE_JOIN_MITER that exceed the miter limit, the join +// gets rendered as if it was of type GSK_LINE_JOIN_BEVEL. +// +// The function takes the following parameters: +// +// - limit: miter limit. +func (self *Stroke) SetMiterLimit(limit float32) { + var _arg0 *C.GskStroke // out + var _arg1 C.float // out + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = C.float(limit) + + C.gsk_stroke_set_miter_limit(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(limit) +} + +// ToCairo: helper function that sets the stroke parameters of cr from the +// values found in self. +// +// The function takes the following parameters: +// +// - cr: cairo context to configure. +func (self *Stroke) ToCairo(cr *cairo.Context) { + var _arg0 *C.GskStroke // out + var _arg1 *C.cairo_t // out + + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + + C.gsk_stroke_to_cairo(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(cr) +} + +// StrokeEqual checks if 2 strokes are identical. +// +// The function takes the following parameters: +// +// - stroke1 (optional): first GskStroke. +// - stroke2 (optional): second GskStroke. +// +// The function returns the following values: +// +// - ok: TRUE if the 2 strokes are equal, FALSE otherwise. +func StrokeEqual(stroke1, stroke2 unsafe.Pointer) bool { + var _arg1 C.gconstpointer // out + var _arg2 C.gconstpointer // out + var _cret C.gboolean // in + + _arg1 = (C.gconstpointer)(unsafe.Pointer(stroke1)) + _arg2 = (C.gconstpointer)(unsafe.Pointer(stroke2)) + + _cret = C.gsk_stroke_equal(_arg1, _arg2) + runtime.KeepAlive(stroke1) + runtime.KeepAlive(stroke2) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Transform: GskTransform is an object to describe transform matrices. +// +// Unlike graphene_matrix_t, GskTransform retains the steps in how a transform +// was constructed, and allows inspecting them. It is modeled after the way CSS +// describes transforms. +// +// GskTransform objects are immutable and cannot be changed after creation. +// This means code can safely expose them as properties of objects without +// having to worry about others changing them. +// +// An instance of this type is always passed by reference. +type Transform struct { + *transform +} + +// transform is the struct that's finalized. +type transform struct { + native *C.GskTransform +} + +func marshalTransform(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Transform{&transform{(*C.GskTransform)(b)}}, nil +} + +// NewTransform constructs a struct Transform. +func NewTransform() *Transform { + var _cret *C.GskTransform // in + + _cret = C.gsk_transform_new() + + var _transform *Transform // out + + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + + return _transform +} + +// Equal checks two transforms for equality. +// +// The function takes the following parameters: +// +// - second (optional) transform. +// +// The function returns the following values: +// +// - ok: TRUE if the two transforms perform the same operation. +func (first *Transform) Equal(second *Transform) bool { + var _arg0 *C.GskTransform // out + var _arg1 *C.GskTransform // out + var _cret C.gboolean // in + + if first != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(first))) + } + if second != nil { + _arg1 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(second))) + } + + _cret = C.gsk_transform_equal(_arg0, _arg1) + runtime.KeepAlive(first) + runtime.KeepAlive(second) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Category returns the category this transform belongs to. +// +// The function returns the following values: +// +// - transformCategory: category of the transform. +func (self *Transform) Category() TransformCategory { + var _arg0 *C.GskTransform // out + var _cret C.GskTransformCategory // in + + if self != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + } + + _cret = C.gsk_transform_get_category(_arg0) + runtime.KeepAlive(self) + + var _transformCategory TransformCategory // out + + _transformCategory = TransformCategory(_cret) + + return _transformCategory +} + +// Invert inverts the given transform. +// +// If self is not invertible, NULL is returned. Note that inverting NULL +// also returns NULL, which is the correct inverse of NULL. If you need to +// differentiate between those cases, you should check self is not NULL before +// calling this function. +// +// The function returns the following values: +// +// - transform (optional): inverted transform. +func (self *Transform) Invert() *Transform { + var _arg0 *C.GskTransform // out + var _cret *C.GskTransform // in + + if self != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + } + + _cret = C.gsk_transform_invert(_arg0) + runtime.KeepAlive(self) + + var _transform *Transform // out + + if _cret != nil { + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + } + + return _transform +} + +// Matrix multiplies next with the given matrix. +// +// The function takes the following parameters: +// +// - matrix to multiply next with. +// +// The function returns the following values: +// +// - transform: new transform. +func (next *Transform) Matrix(matrix *graphene.Matrix) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 *C.graphene_matrix_t // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + _arg1 = (*C.graphene_matrix_t)(gextras.StructNative(unsafe.Pointer(matrix))) + + _cret = C.gsk_transform_matrix(_arg0, _arg1) + runtime.KeepAlive(next) + runtime.KeepAlive(matrix) + + var _transform *Transform // out + + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + + return _transform +} + +// Perspective applies a perspective projection transform. +// +// This transform scales points in X and Y based on their Z value, scaling +// points with positive Z values away from the origin, and those with negative Z +// values towards the origin. Points on the z=0 plane are unchanged. +// +// The function takes the following parameters: +// +// - depth: distance of the z=0 plane. Lower values give a more flattened +// pyramid and therefore a more pronounced perspective effect. +// +// The function returns the following values: +// +// - transform: new transform. +func (next *Transform) Perspective(depth float32) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 C.float // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + _arg1 = C.float(depth) + + _cret = C.gsk_transform_perspective(_arg0, _arg1) + runtime.KeepAlive(next) + runtime.KeepAlive(depth) + + var _transform *Transform // out + + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + + return _transform +} + +// Rotate rotates next angle degrees in 2D - or in 3D-speak, around the Z axis. +// The rotation happens around the origin point of (0, 0). +// +// The function takes the following parameters: +// +// - angle: rotation angle, in degrees (clockwise). +// +// The function returns the following values: +// +// - transform (optional): new transform. +func (next *Transform) Rotate(angle float32) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 C.float // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + _arg1 = C.float(angle) + + _cret = C.gsk_transform_rotate(_arg0, _arg1) + runtime.KeepAlive(next) + runtime.KeepAlive(angle) + + var _transform *Transform // out + + if _cret != nil { + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + } + + return _transform +} + +// Rotate3D rotates next angle degrees around axis. +// +// For a rotation in 2D space, use gsk.Transform.Rotate(). +// +// The function takes the following parameters: +// +// - angle: rotation angle, in degrees (clockwise). +// - axis: rotation axis. +// +// The function returns the following values: +// +// - transform (optional): new transform. +func (next *Transform) Rotate3D(angle float32, axis *graphene.Vec3) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 C.float // out + var _arg2 *C.graphene_vec3_t // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + _arg1 = C.float(angle) + _arg2 = (*C.graphene_vec3_t)(gextras.StructNative(unsafe.Pointer(axis))) + + _cret = C.gsk_transform_rotate_3d(_arg0, _arg1, _arg2) + runtime.KeepAlive(next) + runtime.KeepAlive(angle) + runtime.KeepAlive(axis) + + var _transform *Transform // out + + if _cret != nil { + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + } + + return _transform +} + +// Scale scales next in 2-dimensional space by the given factors. +// +// Use gsk.Transform.Scale3D() to scale in all 3 dimensions. +// +// The function takes the following parameters: +// +// - factorX: scaling factor on the X axis. +// - factorY: scaling factor on the Y axis. +// +// The function returns the following values: +// +// - transform (optional): new transform. +func (next *Transform) Scale(factorX float32, factorY float32) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 C.float // out + var _arg2 C.float // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + _arg1 = C.float(factorX) + _arg2 = C.float(factorY) + + _cret = C.gsk_transform_scale(_arg0, _arg1, _arg2) + runtime.KeepAlive(next) + runtime.KeepAlive(factorX) + runtime.KeepAlive(factorY) + + var _transform *Transform // out + + if _cret != nil { + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + } + + return _transform +} + +// Scale3D scales next by the given factors. +// +// The function takes the following parameters: +// +// - factorX: scaling factor on the X axis. +// - factorY: scaling factor on the Y axis. +// - factorZ: scaling factor on the Z axis. +// +// The function returns the following values: +// +// - transform (optional): new transform. +func (next *Transform) Scale3D(factorX float32, factorY float32, factorZ float32) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + _arg1 = C.float(factorX) + _arg2 = C.float(factorY) + _arg3 = C.float(factorZ) + + _cret = C.gsk_transform_scale_3d(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(next) + runtime.KeepAlive(factorX) + runtime.KeepAlive(factorY) + runtime.KeepAlive(factorZ) + + var _transform *Transform // out + + if _cret != nil { + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + } + + return _transform +} + +// Skew applies a skew transform. +// +// The function takes the following parameters: +// +// - skewX: skew factor, in degrees, on the X axis. +// - skewY: skew factor, in degrees, on the Y axis. +// +// The function returns the following values: +// +// - transform (optional): new transform. +func (next *Transform) Skew(skewX float32, skewY float32) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 C.float // out + var _arg2 C.float // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + _arg1 = C.float(skewX) + _arg2 = C.float(skewY) + + _cret = C.gsk_transform_skew(_arg0, _arg1, _arg2) + runtime.KeepAlive(next) + runtime.KeepAlive(skewX) + runtime.KeepAlive(skewY) + + var _transform *Transform // out + + if _cret != nil { + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + } + + return _transform +} + +// To2D converts a GskTransform to a 2D transformation matrix. +// +// self must be a 2D transformation. If you are not sure, use +// gsk_transform_get_category() >= GSK_TRANSFORM_CATEGORY_2D to check. +// +// The returned values have the following layout: +// +// | xx yx | | a b 0 | +// | xy yy | = | c d 0 | +// | dx dy | | tx ty 1 | +// +// This function can be used to convert between a GskTransform and a matrix type +// from other 2D drawing libraries, in particular Cairo. +// +// The function returns the following values: +// +// - outXx: return location for the xx member. +// - outYx: return location for the yx member. +// - outXy: return location for the xy member. +// - outYy: return location for the yy member. +// - outDx: return location for the x0 member. +// - outDy: return location for the y0 member. +func (self *Transform) To2D() (outXx float32, outYx float32, outXy float32, outYy float32, outDx float32, outDy float32) { + var _arg0 *C.GskTransform // out + var _arg1 C.float // in + var _arg2 C.float // in + var _arg3 C.float // in + var _arg4 C.float // in + var _arg5 C.float // in + var _arg6 C.float // in + + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + + C.gsk_transform_to_2d(_arg0, &_arg1, &_arg2, &_arg3, &_arg4, &_arg5, &_arg6) + runtime.KeepAlive(self) + + var _outXx float32 // out + var _outYx float32 // out + var _outXy float32 // out + var _outYy float32 // out + var _outDx float32 // out + var _outDy float32 // out + + _outXx = float32(_arg1) + _outYx = float32(_arg2) + _outXy = float32(_arg3) + _outYy = float32(_arg4) + _outDx = float32(_arg5) + _outDy = float32(_arg6) + + return _outXx, _outYx, _outXy, _outYy, _outDx, _outDy +} + +// To2DComponents converts a GskTransform to 2D transformation factors. +// +// To recreate an equivalent transform from the factors returned by this +// function, use +// +// gsk_transform_skew ( +// gsk_transform_scale ( +// gsk_transform_rotate ( +// gsk_transform_translate (NULL, &GRAPHENE_POINT_T (dx, dy)), +// angle), +// scale_x, scale_y), +// skew_x, skew_y) +// +// self must be a 2D transformation. If you are not sure, use +// +// gsk_transform_get_category() >= GSK_TRANSFORM_CATEGORY_2D +// +// to check. +// +// The function returns the following values: +// +// - outSkewX: return location for the skew factor in the x direction. +// - outSkewY: return location for the skew factor in the y direction. +// - outScaleX: return location for the scale factor in the x direction. +// - outScaleY: return location for the scale factor in the y direction. +// - outAngle: return location for the rotation angle. +// - outDx: return location for the translation in the x direction. +// - outDy: return location for the translation in the y direction. +func (self *Transform) To2DComponents() (outSkewX float32, outSkewY float32, outScaleX float32, outScaleY float32, outAngle float32, outDx float32, outDy float32) { + var _arg0 *C.GskTransform // out + var _arg1 C.float // in + var _arg2 C.float // in + var _arg3 C.float // in + var _arg4 C.float // in + var _arg5 C.float // in + var _arg6 C.float // in + var _arg7 C.float // in + + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + + C.gsk_transform_to_2d_components(_arg0, &_arg1, &_arg2, &_arg3, &_arg4, &_arg5, &_arg6, &_arg7) + runtime.KeepAlive(self) + + var _outSkewX float32 // out + var _outSkewY float32 // out + var _outScaleX float32 // out + var _outScaleY float32 // out + var _outAngle float32 // out + var _outDx float32 // out + var _outDy float32 // out + + _outSkewX = float32(_arg1) + _outSkewY = float32(_arg2) + _outScaleX = float32(_arg3) + _outScaleY = float32(_arg4) + _outAngle = float32(_arg5) + _outDx = float32(_arg6) + _outDy = float32(_arg7) + + return _outSkewX, _outSkewY, _outScaleX, _outScaleY, _outAngle, _outDx, _outDy +} + +// ToAffine converts a GskTransform to 2D affine transformation factors. +// +// To recreate an equivalent transform from the factors returned by this +// function, use +// +// gsk_transform_scale (gsk_transform_translate (NULL, +// &GRAPHENE_POINT_T (dx, dy)), +// sx, sy) +// +// self must be a 2D affine transformation. If you are not sure, use +// +// gsk_transform_get_category() >= GSK_TRANSFORM_CATEGORY_2D_AFFINE +// +// to check. +// +// The function returns the following values: +// +// - outScaleX: return location for the scale factor in the x direction. +// - outScaleY: return location for the scale factor in the y direction. +// - outDx: return location for the translation in the x direction. +// - outDy: return location for the translation in the y direction. +func (self *Transform) ToAffine() (outScaleX float32, outScaleY float32, outDx float32, outDy float32) { + var _arg0 *C.GskTransform // out + var _arg1 C.float // in + var _arg2 C.float // in + var _arg3 C.float // in + var _arg4 C.float // in + + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + + C.gsk_transform_to_affine(_arg0, &_arg1, &_arg2, &_arg3, &_arg4) + runtime.KeepAlive(self) + + var _outScaleX float32 // out + var _outScaleY float32 // out + var _outDx float32 // out + var _outDy float32 // out + + _outScaleX = float32(_arg1) + _outScaleY = float32(_arg2) + _outDx = float32(_arg3) + _outDy = float32(_arg4) + + return _outScaleX, _outScaleY, _outDx, _outDy +} + +// ToMatrix computes the actual value of self and stores it in out_matrix. +// +// The previous value of out_matrix will be ignored. +// +// The function returns the following values: +// +// - outMatrix: matrix to set. +func (self *Transform) ToMatrix() *graphene.Matrix { + var _arg0 *C.GskTransform // out + var _arg1 C.graphene_matrix_t // in + + if self != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + } + + C.gsk_transform_to_matrix(_arg0, &_arg1) + runtime.KeepAlive(self) + + var _outMatrix *graphene.Matrix // out + + _outMatrix = (*graphene.Matrix)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _outMatrix +} + +// String converts a matrix into a string that is suitable for printing. +// +// The resulting string can be parsed with gsk.Transform().Parse. +// +// This is a wrapper around gsk.Transform.Print(). +// +// The function returns the following values: +// +// - utf8: new string for self. +func (self *Transform) String() string { + var _arg0 *C.GskTransform // out + var _cret *C.char // in + + if self != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + } + + _cret = C.gsk_transform_to_string(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// ToTranslate converts a GskTransform to a translation operation. +// +// self must be a 2D transformation. If you are not sure, use +// +// gsk_transform_get_category() >= GSK_TRANSFORM_CATEGORY_2D_TRANSLATE +// +// to check. +// +// The function returns the following values: +// +// - outDx: return location for the translation in the x direction. +// - outDy: return location for the translation in the y direction. +func (self *Transform) ToTranslate() (outDx float32, outDy float32) { + var _arg0 *C.GskTransform // out + var _arg1 C.float // in + var _arg2 C.float // in + + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + + C.gsk_transform_to_translate(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(self) + + var _outDx float32 // out + var _outDy float32 // out + + _outDx = float32(_arg1) + _outDy = float32(_arg2) + + return _outDx, _outDy +} + +// Transform applies all the operations from other to next. +// +// The function takes the following parameters: +// +// - other (optional): transform to apply. +// +// The function returns the following values: +// +// - transform (optional): new transform. +func (next *Transform) Transform(other *Transform) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 *C.GskTransform // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + if other != nil { + _arg1 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(other))) + } + + _cret = C.gsk_transform_transform(_arg0, _arg1) + runtime.KeepAlive(next) + runtime.KeepAlive(other) + + var _transform *Transform // out + + if _cret != nil { + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + } + + return _transform +} + +// TransformBounds transforms a graphene_rect_t using the given transform self. +// +// The result is the bounding box containing the coplanar quad. +// +// The function takes the following parameters: +// +// - rect: graphene_rect_t. +// +// The function returns the following values: +// +// - outRect: return location for the bounds of the transformed rectangle. +func (self *Transform) TransformBounds(rect *graphene.Rect) *graphene.Rect { + var _arg0 *C.GskTransform // out + var _arg1 *C.graphene_rect_t // out + var _arg2 C.graphene_rect_t // in + + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_rect_t)(gextras.StructNative(unsafe.Pointer(rect))) + + C.gsk_transform_transform_bounds(_arg0, _arg1, &_arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(rect) + + var _outRect *graphene.Rect // out + + _outRect = (*graphene.Rect)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _outRect +} + +// TransformPoint transforms a graphene_point_t using the given transform self. +// +// The function takes the following parameters: +// +// - point: graphene_point_t. +// +// The function returns the following values: +// +// - outPoint: return location for the transformed point. +func (self *Transform) TransformPoint(point *graphene.Point) *graphene.Point { + var _arg0 *C.GskTransform // out + var _arg1 *C.graphene_point_t // out + var _arg2 C.graphene_point_t // in + + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(point))) + + C.gsk_transform_transform_point(_arg0, _arg1, &_arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(point) + + var _outPoint *graphene.Point // out + + _outPoint = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer((&_arg2)))) + + return _outPoint +} + +// Translate translates next in 2-dimensional space by point. +// +// The function takes the following parameters: +// +// - point to translate the transform by. +// +// The function returns the following values: +// +// - transform (optional): new transform. +func (next *Transform) Translate(point *graphene.Point) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 *C.graphene_point_t // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + _arg1 = (*C.graphene_point_t)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.gsk_transform_translate(_arg0, _arg1) + runtime.KeepAlive(next) + runtime.KeepAlive(point) + + var _transform *Transform // out + + if _cret != nil { + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + } + + return _transform +} + +// Translate3D translates next by point. +// +// The function takes the following parameters: +// +// - point to translate the transform by. +// +// The function returns the following values: +// +// - transform (optional): new transform. +func (next *Transform) Translate3D(point *graphene.Point3D) *Transform { + var _arg0 *C.GskTransform // out + var _arg1 *C.graphene_point3d_t // out + var _cret *C.GskTransform // in + + if next != nil { + _arg0 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(next))) + } + _arg1 = (*C.graphene_point3d_t)(gextras.StructNative(unsafe.Pointer(point))) + + _cret = C.gsk_transform_translate_3d(_arg0, _arg1) + runtime.KeepAlive(next) + runtime.KeepAlive(point) + + var _transform *Transform // out + + if _cret != nil { + _transform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_transform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + } + + return _transform +} + +// TransformParse parses the given string into a transform and puts it in +// out_transform. +// +// Strings printed via gsk.Transform.ToString() can be read in again +// successfully using this function. +// +// If string does not describe a valid transform, FALSE is returned and NULL is +// put in out_transform. +// +// The function takes the following parameters: +// +// - str: string to parse. +// +// The function returns the following values: +// +// - outTransform: location to put the transform in. +// - ok: TRUE if string described a valid transform. +func TransformParse(str string) (*Transform, bool) { + var _arg1 *C.char // out + var _arg2 *C.GskTransform // in + var _cret C.gboolean // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(str))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gsk_transform_parse(_arg1, &_arg2) + runtime.KeepAlive(str) + + var _outTransform *Transform // out + var _ok bool // out + + _outTransform = (*Transform)(gextras.NewStructNative(unsafe.Pointer(_arg2))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_outTransform)), + func(intern *struct{ C unsafe.Pointer }) { + C.gsk_transform_unref((*C.GskTransform)(intern.C)) + }, + ) + if _cret != 0 { + _ok = true + } + + return _outTransform, _ok +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/gsk/v4/gsk_export.go b/vendor/github.com/diamondburned/gotk4/pkg/gsk/v4/gsk_export.go new file mode 100644 index 00000000..92130f98 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/gsk/v4/gsk_export.go @@ -0,0 +1,70 @@ +// Code generated by girgen. DO NOT EDIT. + +package gsk + +import ( + "unsafe" + + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gerror" + "github.com/diamondburned/gotk4/pkg/core/gextras" + "github.com/diamondburned/gotk4/pkg/graphene" +) + +// #include +// #include +import "C" + +//export _gotk4_gsk4_ParseErrorFunc +func _gotk4_gsk4_ParseErrorFunc(arg1 *C.GskParseLocation, arg2 *C.GskParseLocation, arg3 *C.GError, arg4 C.gpointer) { + var fn ParseErrorFunc + { + v := gbox.Get(uintptr(arg4)) + if v == nil { + panic(`callback not found`) + } + fn = v.(ParseErrorFunc) + } + + var _start *ParseLocation // out + var _end *ParseLocation // out + var _err error // out + + _start = (*ParseLocation)(gextras.NewStructNative(unsafe.Pointer(arg1))) + _end = (*ParseLocation)(gextras.NewStructNative(unsafe.Pointer(arg2))) + _err = gerror.Take(unsafe.Pointer(arg3)) + + fn(_start, _end, _err) +} + +//export _gotk4_gsk4_PathForEachFunc +func _gotk4_gsk4_PathForEachFunc(arg1 C.GskPathOperation, arg2 *C.graphene_point_t, arg3 C.gsize, arg4 C.float, arg5 C.gpointer) (cret C.gboolean) { + var fn PathForEachFunc + { + v := gbox.Get(uintptr(arg5)) + if v == nil { + panic(`callback not found`) + } + fn = v.(PathForEachFunc) + } + + var _op PathOperation // out + var _pts *graphene.Point // out + var _nPts uint // out + var _weight float32 // out + + _op = PathOperation(arg1) + _pts = (*graphene.Point)(gextras.NewStructNative(unsafe.Pointer(arg2))) + _nPts = uint(arg3) + _weight = float32(arg4) + + ok := fn(_op, _pts, _nPts, _weight) + + var _ bool + + if ok { + cret = C.TRUE + } + + return cret +} diff --git a/vendor/github.com/diamondburned/gotk4/pkg/gtk/v4/gtk.go b/vendor/github.com/diamondburned/gotk4/pkg/gtk/v4/gtk.go new file mode 100644 index 00000000..68322968 --- /dev/null +++ b/vendor/github.com/diamondburned/gotk4/pkg/gtk/v4/gtk.go @@ -0,0 +1,141878 @@ +// Code generated by girgen. DO NOT EDIT. + +package gtk + +import ( + "context" + "fmt" + "math" + "runtime" + _ "runtime/cgo" + "strings" + "unsafe" + + "github.com/diamondburned/gotk4/pkg/cairo" + "github.com/diamondburned/gotk4/pkg/core/gbox" + "github.com/diamondburned/gotk4/pkg/core/gcancel" + "github.com/diamondburned/gotk4/pkg/core/gerror" + "github.com/diamondburned/gotk4/pkg/core/gextras" + coreglib "github.com/diamondburned/gotk4/pkg/core/glib" + "github.com/diamondburned/gotk4/pkg/gdk/v4" + "github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2" + "github.com/diamondburned/gotk4/pkg/gio/v2" + "github.com/diamondburned/gotk4/pkg/glib/v2" + "github.com/diamondburned/gotk4/pkg/graphene" + "github.com/diamondburned/gotk4/pkg/gsk/v4" + "github.com/diamondburned/gotk4/pkg/pango" +) + +// #cgo pkg-config: gtk4 +// #cgo CFLAGS: -Wno-deprecated-declarations +// #include +// #include +// #include +// extern void callbackDelete(gpointer); +// extern void _gotk4_gtk4_Window_ConnectKeysChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_Window_ConnectActivateFocus(gpointer, guintptr); +// extern void _gotk4_gtk4_Window_ConnectActivateDefault(gpointer, guintptr); +// extern void _gotk4_gtk4_WindowClass_keys_changed(GtkWindow*); +// extern void _gotk4_gtk4_WindowClass_activate_focus(GtkWindow*); +// extern void _gotk4_gtk4_WindowClass_activate_default(GtkWindow*); +// extern void _gotk4_gtk4_Widget_ConnectUnrealize(gpointer, guintptr); +// extern void _gotk4_gtk4_Widget_ConnectUnmap(gpointer, guintptr); +// extern void _gotk4_gtk4_Widget_ConnectStateFlagsChanged(gpointer, GtkStateFlags, guintptr); +// extern void _gotk4_gtk4_Widget_ConnectShow(gpointer, guintptr); +// extern void _gotk4_gtk4_Widget_ConnectRealize(gpointer, guintptr); +// extern void _gotk4_gtk4_Widget_ConnectMoveFocus(gpointer, GtkDirectionType, guintptr); +// extern void _gotk4_gtk4_Widget_ConnectMap(gpointer, guintptr); +// extern void _gotk4_gtk4_Widget_ConnectHide(gpointer, guintptr); +// extern void _gotk4_gtk4_Widget_ConnectDirectionChanged(gpointer, GtkTextDirection, guintptr); +// extern void _gotk4_gtk4_Widget_ConnectDestroy(gpointer, guintptr); +// extern void _gotk4_gtk4_WidgetClass_unroot(GtkWidget*); +// extern void _gotk4_gtk4_WidgetClass_unrealize(GtkWidget*); +// extern void _gotk4_gtk4_WidgetClass_unmap(GtkWidget*); +// extern void _gotk4_gtk4_WidgetClass_system_setting_changed(GtkWidget*, GtkSystemSetting); +// extern void _gotk4_gtk4_WidgetClass_state_flags_changed(GtkWidget*, GtkStateFlags); +// extern void _gotk4_gtk4_WidgetClass_snapshot(GtkWidget*, GtkSnapshot*); +// extern void _gotk4_gtk4_WidgetClass_size_allocate(GtkWidget*, int, int, int); +// extern void _gotk4_gtk4_WidgetClass_show(GtkWidget*); +// extern void _gotk4_gtk4_WidgetClass_set_focus_child(GtkWidget*, GtkWidget*); +// extern void _gotk4_gtk4_WidgetClass_root(GtkWidget*); +// extern void _gotk4_gtk4_WidgetClass_realize(GtkWidget*); +// extern void _gotk4_gtk4_WidgetClass_move_focus(GtkWidget*, GtkDirectionType); +// extern void _gotk4_gtk4_WidgetClass_measure(GtkWidget*, GtkOrientation, int, int*, int*, int*, int*); +// extern void _gotk4_gtk4_WidgetClass_map(GtkWidget*); +// extern void _gotk4_gtk4_WidgetClass_hide(GtkWidget*); +// extern void _gotk4_gtk4_WidgetClass_direction_changed(GtkWidget*, GtkTextDirection); +// extern void _gotk4_gtk4_TreeView_ConnectRowExpanded(gpointer, GtkTreeIter*, GtkTreePath*, guintptr); +// extern void _gotk4_gtk4_TreeView_ConnectRowCollapsed(gpointer, GtkTreeIter*, GtkTreePath*, guintptr); +// extern void _gotk4_gtk4_TreeView_ConnectRowActivated(gpointer, GtkTreePath*, GtkTreeViewColumn*, guintptr); +// extern void _gotk4_gtk4_TreeView_ConnectCursorChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_TreeView_ConnectColumnsChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_TreeViewMappingFunc(GtkTreeView*, GtkTreePath*, gpointer); +// extern void _gotk4_gtk4_TreeViewColumn_ConnectClicked(gpointer, guintptr); +// extern void _gotk4_gtk4_TreeViewClass_row_expanded(GtkTreeView*, GtkTreeIter*, GtkTreePath*); +// extern void _gotk4_gtk4_TreeViewClass_row_collapsed(GtkTreeView*, GtkTreeIter*, GtkTreePath*); +// extern void _gotk4_gtk4_TreeViewClass_row_activated(GtkTreeView*, GtkTreePath*, GtkTreeViewColumn*); +// extern void _gotk4_gtk4_TreeViewClass_cursor_changed(GtkTreeView*); +// extern void _gotk4_gtk4_TreeViewClass_columns_changed(GtkTreeView*); +// extern void _gotk4_gtk4_TreeSortable_ConnectSortColumnChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_TreeSelection_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_TreeSelectionForEachFunc(GtkTreeModel*, GtkTreePath*, GtkTreeIter*, gpointer); +// extern void _gotk4_gtk4_TreeModel_ConnectRowsReordered(gpointer, GtkTreePath*, GtkTreeIter*, gpointer, guintptr); +// extern void _gotk4_gtk4_TreeModel_ConnectRowInserted(gpointer, GtkTreePath*, GtkTreeIter*, guintptr); +// extern void _gotk4_gtk4_TreeModel_ConnectRowHasChildToggled(gpointer, GtkTreePath*, GtkTreeIter*, guintptr); +// extern void _gotk4_gtk4_TreeModel_ConnectRowDeleted(gpointer, GtkTreePath*, guintptr); +// extern void _gotk4_gtk4_TreeModel_ConnectRowChanged(gpointer, GtkTreePath*, GtkTreeIter*, guintptr); +// extern void _gotk4_gtk4_TreeModelFilterModifyFunc(GtkTreeModel*, GtkTreeIter*, GValue*, int, gpointer); +// extern void _gotk4_gtk4_TreeModelFilterClass_modify(GtkTreeModelFilter*, GtkTreeModel*, GtkTreeIter*, GValue*, int); +// extern void _gotk4_gtk4_TreeCellDataFunc(GtkTreeViewColumn*, GtkCellRenderer*, GtkTreeModel*, GtkTreeIter*, gpointer); +// extern void _gotk4_gtk4_ToggleButton_ConnectToggled(gpointer, guintptr); +// extern void _gotk4_gtk4_ToggleButtonClass_toggled(GtkToggleButton*); +// extern void _gotk4_gtk4_Text_ConnectToggleOverwrite(gpointer, guintptr); +// extern void _gotk4_gtk4_Text_ConnectPreeditChanged(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_Text_ConnectPasteClipboard(gpointer, guintptr); +// extern void _gotk4_gtk4_Text_ConnectMoveCursor(gpointer, GtkMovementStep, gint, gboolean, guintptr); +// extern void _gotk4_gtk4_Text_ConnectInsertEmoji(gpointer, guintptr); +// extern void _gotk4_gtk4_Text_ConnectInsertAtCursor(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_Text_ConnectDeleteFromCursor(gpointer, GtkDeleteType, gint, guintptr); +// extern void _gotk4_gtk4_Text_ConnectCutClipboard(gpointer, guintptr); +// extern void _gotk4_gtk4_Text_ConnectCopyClipboard(gpointer, guintptr); +// extern void _gotk4_gtk4_Text_ConnectBackspace(gpointer, guintptr); +// extern void _gotk4_gtk4_Text_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectToggleOverwrite(gpointer, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectToggleCursorVisible(gpointer, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectSetAnchor(gpointer, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectSelectAll(gpointer, gboolean, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectPreeditChanged(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectPasteClipboard(gpointer, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectMoveViewport(gpointer, GtkScrollStep, gint, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectMoveCursor(gpointer, GtkMovementStep, gint, gboolean, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectInsertEmoji(gpointer, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectInsertAtCursor(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectDeleteFromCursor(gpointer, GtkDeleteType, gint, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectCutClipboard(gpointer, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectCopyClipboard(gpointer, guintptr); +// extern void _gotk4_gtk4_TextView_ConnectBackspace(gpointer, guintptr); +// extern void _gotk4_gtk4_TextViewClass_toggle_overwrite(GtkTextView*); +// extern void _gotk4_gtk4_TextViewClass_snapshot_layer(GtkTextView*, GtkTextViewLayer, GtkSnapshot*); +// extern void _gotk4_gtk4_TextViewClass_set_anchor(GtkTextView*); +// extern void _gotk4_gtk4_TextViewClass_paste_clipboard(GtkTextView*); +// extern void _gotk4_gtk4_TextViewClass_move_cursor(GtkTextView*, GtkMovementStep, int, gboolean); +// extern void _gotk4_gtk4_TextViewClass_insert_emoji(GtkTextView*); +// extern void _gotk4_gtk4_TextViewClass_insert_at_cursor(GtkTextView*, char*); +// extern void _gotk4_gtk4_TextViewClass_delete_from_cursor(GtkTextView*, GtkDeleteType, int); +// extern void _gotk4_gtk4_TextViewClass_cut_clipboard(GtkTextView*); +// extern void _gotk4_gtk4_TextViewClass_copy_clipboard(GtkTextView*); +// extern void _gotk4_gtk4_TextViewClass_backspace(GtkTextView*); +// extern void _gotk4_gtk4_TextTagTable_ConnectTagRemoved(gpointer, GtkTextTag*, guintptr); +// extern void _gotk4_gtk4_TextTagTable_ConnectTagChanged(gpointer, GtkTextTag*, gboolean, guintptr); +// extern void _gotk4_gtk4_TextTagTable_ConnectTagAdded(gpointer, GtkTextTag*, guintptr); +// extern void _gotk4_gtk4_TextTagTableForEach(GtkTextTag*, gpointer); +// extern void _gotk4_gtk4_TextBuffer_ConnectUndo(gpointer, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectRemoveTag(gpointer, GtkTextTag*, GtkTextIter*, GtkTextIter*, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectRedo(gpointer, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectPasteDone(gpointer, GdkClipboard*, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectModifiedChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectMarkSet(gpointer, GtkTextIter*, GtkTextMark*, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectMarkDeleted(gpointer, GtkTextMark*, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectInsertText(gpointer, GtkTextIter*, gchar*, gint, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectInsertPaintable(gpointer, GtkTextIter*, GdkPaintable*, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectInsertChildAnchor(gpointer, GtkTextIter*, GtkTextChildAnchor*, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectEndUserAction(gpointer, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectDeleteRange(gpointer, GtkTextIter*, GtkTextIter*, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectBeginUserAction(gpointer, guintptr); +// extern void _gotk4_gtk4_TextBuffer_ConnectApplyTag(gpointer, GtkTextTag*, GtkTextIter*, GtkTextIter*, guintptr); +// extern void _gotk4_gtk4_TextBufferClass_undo(GtkTextBuffer*); +// extern void _gotk4_gtk4_TextBufferClass_remove_tag(GtkTextBuffer*, GtkTextTag*, GtkTextIter*, GtkTextIter*); +// extern void _gotk4_gtk4_TextBufferClass_redo(GtkTextBuffer*); +// extern void _gotk4_gtk4_TextBufferClass_paste_done(GtkTextBuffer*, GdkClipboard*); +// extern void _gotk4_gtk4_TextBufferClass_modified_changed(GtkTextBuffer*); +// extern void _gotk4_gtk4_TextBufferClass_mark_set(GtkTextBuffer*, GtkTextIter*, GtkTextMark*); +// extern void _gotk4_gtk4_TextBufferClass_mark_deleted(GtkTextBuffer*, GtkTextMark*); +// extern void _gotk4_gtk4_TextBufferClass_insert_text(GtkTextBuffer*, GtkTextIter*, char*, int); +// extern void _gotk4_gtk4_TextBufferClass_insert_paintable(GtkTextBuffer*, GtkTextIter*, GdkPaintable*); +// extern void _gotk4_gtk4_TextBufferClass_insert_child_anchor(GtkTextBuffer*, GtkTextIter*, GtkTextChildAnchor*); +// extern void _gotk4_gtk4_TextBufferClass_end_user_action(GtkTextBuffer*); +// extern void _gotk4_gtk4_TextBufferClass_delete_range(GtkTextBuffer*, GtkTextIter*, GtkTextIter*); +// extern void _gotk4_gtk4_TextBufferClass_changed(GtkTextBuffer*); +// extern void _gotk4_gtk4_TextBufferClass_begin_user_action(GtkTextBuffer*); +// extern void _gotk4_gtk4_TextBufferClass_apply_tag(GtkTextBuffer*, GtkTextTag*, GtkTextIter*, GtkTextIter*); +// extern void _gotk4_gtk4_Switch_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_StyleProvider_ConnectGTKPrivateChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_StyleContextClass_changed(GtkStyleContext*); +// extern void _gotk4_gtk4_Statusbar_ConnectTextPushed(gpointer, guint, gchar*, guintptr); +// extern void _gotk4_gtk4_Statusbar_ConnectTextPopped(gpointer, guint, gchar*, guintptr); +// extern void _gotk4_gtk4_SpinButton_ConnectWrapped(gpointer, guintptr); +// extern void _gotk4_gtk4_SpinButton_ConnectValueChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_SpinButton_ConnectChangeValue(gpointer, GtkScrollType, guintptr); +// extern void _gotk4_gtk4_SpinButton_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_Sorter_ConnectChanged(gpointer, GtkSorterChange, guintptr); +// extern void _gotk4_gtk4_SignalListItemFactory_ConnectUnbind(gpointer, GObject*, guintptr); +// extern void _gotk4_gtk4_SignalListItemFactory_ConnectTeardown(gpointer, GObject*, guintptr); +// extern void _gotk4_gtk4_SignalListItemFactory_ConnectSetup(gpointer, GObject*, guintptr); +// extern void _gotk4_gtk4_SignalListItemFactory_ConnectBind(gpointer, GObject*, guintptr); +// extern void _gotk4_gtk4_ShortcutsWindow_ConnectSearch(gpointer, guintptr); +// extern void _gotk4_gtk4_ShortcutsWindow_ConnectClose(gpointer, guintptr); +// extern void _gotk4_gtk4_SelectionModel_ConnectSelectionChanged(gpointer, guint, guint, guintptr); +// extern void _gotk4_gtk4_SectionModel_ConnectSectionsChanged(gpointer, guint, guint, guintptr); +// extern void _gotk4_gtk4_SearchEntry_ConnectStopSearch(gpointer, guintptr); +// extern void _gotk4_gtk4_SearchEntry_ConnectSearchStarted(gpointer, guintptr); +// extern void _gotk4_gtk4_SearchEntry_ConnectSearchChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_SearchEntry_ConnectPreviousMatch(gpointer, guintptr); +// extern void _gotk4_gtk4_SearchEntry_ConnectNextMatch(gpointer, guintptr); +// extern void _gotk4_gtk4_SearchEntry_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_ScrolledWindow_ConnectMoveFocusOut(gpointer, GtkDirectionType, guintptr); +// extern void _gotk4_gtk4_ScrolledWindow_ConnectEdgeReached(gpointer, GtkPositionType, guintptr); +// extern void _gotk4_gtk4_ScrolledWindow_ConnectEdgeOvershot(gpointer, GtkPositionType, guintptr); +// extern void _gotk4_gtk4_ScaleClass_get_layout_offsets(GtkScale*, int*, int*); +// extern void _gotk4_gtk4_ScaleButton_ConnectValueChanged(gpointer, gdouble, guintptr); +// extern void _gotk4_gtk4_ScaleButton_ConnectPopup(gpointer, guintptr); +// extern void _gotk4_gtk4_ScaleButton_ConnectPopdown(gpointer, guintptr); +// extern void _gotk4_gtk4_ScaleButtonClass_value_changed(GtkScaleButton*, double); +// extern void _gotk4_gtk4_RecentManager_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_RecentManagerClass_changed(GtkRecentManager*); +// extern void _gotk4_gtk4_Range_ConnectValueChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_Range_ConnectMoveSlider(gpointer, GtkScrollType, guintptr); +// extern void _gotk4_gtk4_Range_ConnectAdjustBounds(gpointer, gdouble, guintptr); +// extern void _gotk4_gtk4_RangeClass_value_changed(GtkRange*); +// extern void _gotk4_gtk4_RangeClass_move_slider(GtkRange*, GtkScrollType); +// extern void _gotk4_gtk4_RangeClass_get_range_border(GtkRange*, GtkBorder*); +// extern void _gotk4_gtk4_RangeClass_adjust_bounds(GtkRange*, double); +// extern void _gotk4_gtk4_PrintSettingsFunc(char*, char*, gpointer); +// extern void _gotk4_gtk4_PrintOperation_ConnectUpdateCustomWidget(gpointer, GtkWidget*, GtkPageSetup*, GtkPrintSettings*, guintptr); +// extern void _gotk4_gtk4_PrintOperation_ConnectStatusChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_PrintOperation_ConnectRequestPageSetup(gpointer, GtkPrintContext*, gint, GtkPageSetup*, guintptr); +// extern void _gotk4_gtk4_PrintOperation_ConnectEndPrint(gpointer, GtkPrintContext*, guintptr); +// extern void _gotk4_gtk4_PrintOperation_ConnectDrawPage(gpointer, GtkPrintContext*, gint, guintptr); +// extern void _gotk4_gtk4_PrintOperation_ConnectDone(gpointer, GtkPrintOperationResult, guintptr); +// extern void _gotk4_gtk4_PrintOperation_ConnectCustomWidgetApply(gpointer, GtkWidget*, guintptr); +// extern void _gotk4_gtk4_PrintOperation_ConnectBeginPrint(gpointer, GtkPrintContext*, guintptr); +// extern void _gotk4_gtk4_PrintOperationPreview_ConnectReady(gpointer, GtkPrintContext*, guintptr); +// extern void _gotk4_gtk4_PrintOperationPreview_ConnectGotPageSize(gpointer, GtkPrintContext*, GtkPageSetup*, guintptr); +// extern void _gotk4_gtk4_PrintOperationClass_update_custom_widget(GtkPrintOperation*, GtkWidget*, GtkPageSetup*, GtkPrintSettings*); +// extern void _gotk4_gtk4_PrintOperationClass_status_changed(GtkPrintOperation*); +// extern void _gotk4_gtk4_PrintOperationClass_request_page_setup(GtkPrintOperation*, GtkPrintContext*, int, GtkPageSetup*); +// extern void _gotk4_gtk4_PrintOperationClass_end_print(GtkPrintOperation*, GtkPrintContext*); +// extern void _gotk4_gtk4_PrintOperationClass_draw_page(GtkPrintOperation*, GtkPrintContext*, int); +// extern void _gotk4_gtk4_PrintOperationClass_done(GtkPrintOperation*, GtkPrintOperationResult); +// extern void _gotk4_gtk4_PrintOperationClass_custom_widget_apply(GtkPrintOperation*, GtkWidget*); +// extern void _gotk4_gtk4_PrintOperationClass_begin_print(GtkPrintOperation*, GtkPrintContext*); +// extern void _gotk4_gtk4_Popover_ConnectClosed(gpointer, guintptr); +// extern void _gotk4_gtk4_Popover_ConnectActivateDefault(gpointer, guintptr); +// extern void _gotk4_gtk4_PopoverClass_closed(GtkPopover*); +// extern void _gotk4_gtk4_PopoverClass_activate_default(GtkPopover*); +// extern void _gotk4_gtk4_PasswordEntry_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_PageSetupDoneFunc(GtkPageSetup*, gpointer); +// extern void _gotk4_gtk4_Notebook_ConnectSwitchPage(gpointer, GtkWidget*, guint, guintptr); +// extern void _gotk4_gtk4_Notebook_ConnectPageReordered(gpointer, GtkWidget*, guint, guintptr); +// extern void _gotk4_gtk4_Notebook_ConnectPageRemoved(gpointer, GtkWidget*, guint, guintptr); +// extern void _gotk4_gtk4_Notebook_ConnectPageAdded(gpointer, GtkWidget*, guint, guintptr); +// extern void _gotk4_gtk4_Notebook_ConnectMoveFocusOut(gpointer, GtkDirectionType, guintptr); +// extern void _gotk4_gtk4_NativeDialog_ConnectResponse(gpointer, gint, guintptr); +// extern void _gotk4_gtk4_NativeDialogClass_show(GtkNativeDialog*); +// extern void _gotk4_gtk4_NativeDialogClass_response(GtkNativeDialog*, int); +// extern void _gotk4_gtk4_NativeDialogClass_hide(GtkNativeDialog*); +// extern void _gotk4_gtk4_MenuButton_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_MenuButtonCreatePopupFunc(GtkMenuButton*, gpointer); +// extern void _gotk4_gtk4_MediaStreamClass_update_audio(GtkMediaStream*, gboolean, double); +// extern void _gotk4_gtk4_MediaStreamClass_unrealize(GtkMediaStream*, GdkSurface*); +// extern void _gotk4_gtk4_MediaStreamClass_seek(GtkMediaStream*, gint64); +// extern void _gotk4_gtk4_MediaStreamClass_realize(GtkMediaStream*, GdkSurface*); +// extern void _gotk4_gtk4_MediaStreamClass_pause(GtkMediaStream*); +// extern void _gotk4_gtk4_MediaFileClass_open(GtkMediaFile*); +// extern void _gotk4_gtk4_MediaFileClass_close(GtkMediaFile*); +// extern void _gotk4_gtk4_ListView_ConnectActivate(gpointer, guint, guintptr); +// extern void _gotk4_gtk4_ListBox_ConnectUnselectAll(gpointer, guintptr); +// extern void _gotk4_gtk4_ListBox_ConnectToggleCursorRow(gpointer, guintptr); +// extern void _gotk4_gtk4_ListBox_ConnectSelectedRowsChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_ListBox_ConnectSelectAll(gpointer, guintptr); +// extern void _gotk4_gtk4_ListBox_ConnectRowSelected(gpointer, GtkListBoxRow*, guintptr); +// extern void _gotk4_gtk4_ListBox_ConnectRowActivated(gpointer, GtkListBoxRow*, guintptr); +// extern void _gotk4_gtk4_ListBox_ConnectMoveCursor(gpointer, GtkMovementStep, gint, gboolean, gboolean, guintptr); +// extern void _gotk4_gtk4_ListBox_ConnectActivateCursorRow(gpointer, guintptr); +// extern void _gotk4_gtk4_ListBoxUpdateHeaderFunc(GtkListBoxRow*, GtkListBoxRow*, gpointer); +// extern void _gotk4_gtk4_ListBoxRow_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_ListBoxRowClass_activate(GtkListBoxRow*); +// extern void _gotk4_gtk4_ListBoxForEachFunc(GtkListBox*, GtkListBoxRow*, gpointer); +// extern void _gotk4_gtk4_LevelBar_ConnectOffsetChanged(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_LayoutManagerClass_unroot(GtkLayoutManager*); +// extern void _gotk4_gtk4_LayoutManagerClass_root(GtkLayoutManager*); +// extern void _gotk4_gtk4_LayoutManagerClass_measure(GtkLayoutManager*, GtkWidget*, GtkOrientation, int, int*, int*, int*, int*); +// extern void _gotk4_gtk4_LayoutManagerClass_allocate(GtkLayoutManager*, GtkWidget*, int, int, int); +// extern void _gotk4_gtk4_Label_ConnectMoveCursor(gpointer, GtkMovementStep, gint, gboolean, guintptr); +// extern void _gotk4_gtk4_Label_ConnectCopyClipboard(gpointer, guintptr); +// extern void _gotk4_gtk4_Label_ConnectActivateCurrentLink(gpointer, guintptr); +// extern void _gotk4_gtk4_InfoBar_ConnectResponse(gpointer, gint, guintptr); +// extern void _gotk4_gtk4_InfoBar_ConnectClose(gpointer, guintptr); +// extern void _gotk4_gtk4_IconView_ConnectUnselectAll(gpointer, guintptr); +// extern void _gotk4_gtk4_IconView_ConnectToggleCursorItem(gpointer, guintptr); +// extern void _gotk4_gtk4_IconView_ConnectSelectionChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_IconView_ConnectSelectCursorItem(gpointer, guintptr); +// extern void _gotk4_gtk4_IconView_ConnectSelectAll(gpointer, guintptr); +// extern void _gotk4_gtk4_IconView_ConnectItemActivated(gpointer, GtkTreePath*, guintptr); +// extern void _gotk4_gtk4_IconViewForEachFunc(GtkIconView*, GtkTreePath*, gpointer); +// extern void _gotk4_gtk4_IconTheme_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_IMContext_ConnectPreeditStart(gpointer, guintptr); +// extern void _gotk4_gtk4_IMContext_ConnectPreeditEnd(gpointer, guintptr); +// extern void _gotk4_gtk4_IMContext_ConnectPreeditChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_IMContext_ConnectCommit(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_IMContextClass_set_use_preedit(GtkIMContext*, gboolean); +// extern void _gotk4_gtk4_IMContextClass_set_surrounding_with_selection(GtkIMContext*, char*, int, int, int); +// extern void _gotk4_gtk4_IMContextClass_set_surrounding(GtkIMContext*, char*, int, int); +// extern void _gotk4_gtk4_IMContextClass_set_cursor_location(GtkIMContext*, GdkRectangle*); +// extern void _gotk4_gtk4_IMContextClass_set_client_widget(GtkIMContext*, GtkWidget*); +// extern void _gotk4_gtk4_IMContextClass_reset(GtkIMContext*); +// extern void _gotk4_gtk4_IMContextClass_preedit_start(GtkIMContext*); +// extern void _gotk4_gtk4_IMContextClass_preedit_end(GtkIMContext*); +// extern void _gotk4_gtk4_IMContextClass_preedit_changed(GtkIMContext*); +// extern void _gotk4_gtk4_IMContextClass_get_preedit_string(GtkIMContext*, char**, PangoAttrList**, int*); +// extern void _gotk4_gtk4_IMContextClass_focus_out(GtkIMContext*); +// extern void _gotk4_gtk4_IMContextClass_focus_in(GtkIMContext*); +// extern void _gotk4_gtk4_IMContextClass_commit(GtkIMContext*, char*); +// extern void _gotk4_gtk4_IMContextClass_activate_osk(GtkIMContext*); +// extern void _gotk4_gtk4_GridView_ConnectActivate(gpointer, guint, guintptr); +// extern void _gotk4_gtk4_Gesture_ConnectUpdate(gpointer, GdkEventSequence*, guintptr); +// extern void _gotk4_gtk4_Gesture_ConnectSequenceStateChanged(gpointer, GdkEventSequence*, GtkEventSequenceState, guintptr); +// extern void _gotk4_gtk4_Gesture_ConnectEnd(gpointer, GdkEventSequence*, guintptr); +// extern void _gotk4_gtk4_Gesture_ConnectCancel(gpointer, GdkEventSequence*, guintptr); +// extern void _gotk4_gtk4_Gesture_ConnectBegin(gpointer, GdkEventSequence*, guintptr); +// extern void _gotk4_gtk4_GestureZoom_ConnectScaleChanged(gpointer, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureSwipe_ConnectSwipe(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureStylus_ConnectUp(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureStylus_ConnectProximity(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureStylus_ConnectMotion(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureStylus_ConnectDown(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureRotate_ConnectAngleChanged(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GesturePan_ConnectPan(gpointer, GtkPanDirection, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureLongPress_ConnectPressed(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureLongPress_ConnectCancelled(gpointer, guintptr); +// extern void _gotk4_gtk4_GestureDrag_ConnectDragUpdate(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureDrag_ConnectDragEnd(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureDrag_ConnectDragBegin(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureClick_ConnectUnpairedRelease(gpointer, gdouble, gdouble, guint, GdkEventSequence*, guintptr); +// extern void _gotk4_gtk4_GestureClick_ConnectStopped(gpointer, guintptr); +// extern void _gotk4_gtk4_GestureClick_ConnectReleased(gpointer, gint, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GestureClick_ConnectPressed(gpointer, gint, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_GLArea_ConnectResize(gpointer, gint, gint, guintptr); +// extern void _gotk4_gtk4_GLAreaClass_resize(GtkGLArea*, int, int); +// extern void _gotk4_gtk4_FrameClass_compute_child_allocation(GtkFrame*, GtkAllocation*); +// extern void _gotk4_gtk4_FontDialogButton_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_FontChooser_ConnectFontActivated(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_FontButton_ConnectFontSet(gpointer, guintptr); +// extern void _gotk4_gtk4_FontButton_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_FlowBox_ConnectUnselectAll(gpointer, guintptr); +// extern void _gotk4_gtk4_FlowBox_ConnectToggleCursorChild(gpointer, guintptr); +// extern void _gotk4_gtk4_FlowBox_ConnectSelectedChildrenChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_FlowBox_ConnectSelectAll(gpointer, guintptr); +// extern void _gotk4_gtk4_FlowBox_ConnectChildActivated(gpointer, GtkFlowBoxChild*, guintptr); +// extern void _gotk4_gtk4_FlowBox_ConnectActivateCursorChild(gpointer, guintptr); +// extern void _gotk4_gtk4_FlowBoxForEachFunc(GtkFlowBox*, GtkFlowBoxChild*, gpointer); +// extern void _gotk4_gtk4_FlowBoxChild_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_FlowBoxChildClass_activate(GtkFlowBoxChild*); +// extern void _gotk4_gtk4_Filter_ConnectChanged(gpointer, GtkFilterChange, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectUpFolder(gpointer, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectShowHidden(gpointer, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectSearchShortcut(gpointer, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectRecentShortcut(gpointer, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectQuickBookmark(gpointer, gint, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectPlacesShortcut(gpointer, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectLocationTogglePopup(gpointer, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectLocationPopupOnPaste(gpointer, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectLocationPopup(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectHomeFolder(gpointer, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectDownFolder(gpointer, guintptr); +// extern void _gotk4_gtk4_FileChooserWidget_ConnectDesktopFolder(gpointer, guintptr); +// extern void _gotk4_gtk4_ExpressionNotify(gpointer); +// extern void _gotk4_gtk4_Expander_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_EventControllerScroll_ConnectScrollEnd(gpointer, guintptr); +// extern void _gotk4_gtk4_EventControllerScroll_ConnectScrollBegin(gpointer, guintptr); +// extern void _gotk4_gtk4_EventControllerScroll_ConnectDecelerate(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_EventControllerMotion_ConnectMotion(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_EventControllerMotion_ConnectLeave(gpointer, guintptr); +// extern void _gotk4_gtk4_EventControllerMotion_ConnectEnter(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_EventControllerKey_ConnectKeyReleased(gpointer, guint, guint, GdkModifierType, guintptr); +// extern void _gotk4_gtk4_EventControllerKey_ConnectIMUpdate(gpointer, guintptr); +// extern void _gotk4_gtk4_EventControllerFocus_ConnectLeave(gpointer, guintptr); +// extern void _gotk4_gtk4_EventControllerFocus_ConnectEnter(gpointer, guintptr); +// extern void _gotk4_gtk4_Entry_ConnectIconRelease(gpointer, GtkEntryIconPosition, guintptr); +// extern void _gotk4_gtk4_Entry_ConnectIconPress(gpointer, GtkEntryIconPosition, guintptr); +// extern void _gotk4_gtk4_Entry_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_EntryCompletion_ConnectNoMatches(gpointer, guintptr); +// extern void _gotk4_gtk4_EntryClass_activate(GtkEntry*); +// extern void _gotk4_gtk4_EntryBuffer_ConnectInsertedText(gpointer, guint, gchar*, guint, guintptr); +// extern void _gotk4_gtk4_EntryBuffer_ConnectDeletedText(gpointer, guint, guint, guintptr); +// extern void _gotk4_gtk4_EntryBufferClass_inserted_text(GtkEntryBuffer*, guint, char*, guint); +// extern void _gotk4_gtk4_EntryBufferClass_deleted_text(GtkEntryBuffer*, guint, guint); +// extern void _gotk4_gtk4_EmojiChooser_ConnectEmojiPicked(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_EditableTextWidget_ConnectDeleteText(gpointer, gint, gint, guintptr); +// extern void _gotk4_gtk4_EditableTextWidget_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_DropTarget_ConnectLeave(gpointer, guintptr); +// extern void _gotk4_gtk4_DropTargetAsync_ConnectDragLeave(gpointer, GdkDrop*, guintptr); +// extern void _gotk4_gtk4_DropDown_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_DropControllerMotion_ConnectMotion(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_DropControllerMotion_ConnectLeave(gpointer, guintptr); +// extern void _gotk4_gtk4_DropControllerMotion_ConnectEnter(gpointer, gdouble, gdouble, guintptr); +// extern void _gotk4_gtk4_DrawingArea_ConnectResize(gpointer, gint, gint, guintptr); +// extern void _gotk4_gtk4_DrawingAreaDrawFunc(GtkDrawingArea*, cairo_t*, int, int, gpointer); +// extern void _gotk4_gtk4_DrawingAreaClass_resize(GtkDrawingArea*, int, int); +// extern void _gotk4_gtk4_DragSource_ConnectDragEnd(gpointer, GdkDrag*, gboolean, guintptr); +// extern void _gotk4_gtk4_DragSource_ConnectDragBegin(gpointer, GdkDrag*, guintptr); +// extern void _gotk4_gtk4_Dialog_ConnectResponse(gpointer, gint, guintptr); +// extern void _gotk4_gtk4_Dialog_ConnectClose(gpointer, guintptr); +// extern void _gotk4_gtk4_DialogClass_response(GtkDialog*, int); +// extern void _gotk4_gtk4_DialogClass_close(GtkDialog*); +// extern void _gotk4_gtk4_CssProvider_ConnectParsingError(gpointer, GtkCssSection*, GError*, guintptr); +// extern void _gotk4_gtk4_ComboBox_ConnectPopup(gpointer, guintptr); +// extern void _gotk4_gtk4_ComboBox_ConnectMoveActive(gpointer, GtkScrollType, guintptr); +// extern void _gotk4_gtk4_ComboBox_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_ComboBox_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_ComboBoxClass_changed(GtkComboBox*); +// extern void _gotk4_gtk4_ComboBoxClass_activate(GtkComboBox*); +// extern void _gotk4_gtk4_ColumnView_ConnectActivate(gpointer, guint, guintptr); +// extern void _gotk4_gtk4_ColorDialogButton_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_ColorChooser_ConnectColorActivated(gpointer, GdkRGBA*, guintptr); +// extern void _gotk4_gtk4_ColorButton_ConnectColorSet(gpointer, guintptr); +// extern void _gotk4_gtk4_ColorButton_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_CheckButton_ConnectToggled(gpointer, guintptr); +// extern void _gotk4_gtk4_CheckButton_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_CheckButtonClass_toggled(GtkCheckButton*); +// extern void _gotk4_gtk4_CheckButtonClass_activate(GtkCheckButton*); +// extern void _gotk4_gtk4_CellRenderer_ConnectEditingStarted(gpointer, GtkCellEditable*, gchar*, guintptr); +// extern void _gotk4_gtk4_CellRenderer_ConnectEditingCanceled(gpointer, guintptr); +// extern void _gotk4_gtk4_CellRendererToggle_ConnectToggled(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_CellRendererText_ConnectEdited(gpointer, gchar*, gchar*, guintptr); +// extern void _gotk4_gtk4_CellRendererTextClass_edited(GtkCellRendererText*, char*, char*); +// extern void _gotk4_gtk4_CellRendererCombo_ConnectChanged(gpointer, gchar*, GtkTreeIter*, guintptr); +// extern void _gotk4_gtk4_CellRendererClass_snapshot(GtkCellRenderer*, GtkSnapshot*, GtkWidget*, GdkRectangle*, GdkRectangle*, GtkCellRendererState); +// extern void _gotk4_gtk4_CellRendererClass_get_preferred_width_for_height(GtkCellRenderer*, GtkWidget*, int, int*, int*); +// extern void _gotk4_gtk4_CellRendererClass_get_preferred_width(GtkCellRenderer*, GtkWidget*, int*, int*); +// extern void _gotk4_gtk4_CellRendererClass_get_preferred_height_for_width(GtkCellRenderer*, GtkWidget*, int, int*, int*); +// extern void _gotk4_gtk4_CellRendererClass_get_preferred_height(GtkCellRenderer*, GtkWidget*, int*, int*); +// extern void _gotk4_gtk4_CellRendererClass_get_aligned_area(GtkCellRenderer*, GtkWidget*, GtkCellRendererState, GdkRectangle*, GdkRectangle*); +// extern void _gotk4_gtk4_CellRendererClass_editing_started(GtkCellRenderer*, GtkCellEditable*, char*); +// extern void _gotk4_gtk4_CellRendererClass_editing_canceled(GtkCellRenderer*); +// extern void _gotk4_gtk4_CellRendererAccel_ConnectAccelEdited(gpointer, gchar*, guint, GdkModifierType, guint, guintptr); +// extern void _gotk4_gtk4_CellRendererAccel_ConnectAccelCleared(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_CellLayoutDataFunc(GtkCellLayout*, GtkCellRenderer*, GtkTreeModel*, GtkTreeIter*, gpointer); +// extern void _gotk4_gtk4_CellEditable_ConnectRemoveWidget(gpointer, guintptr); +// extern void _gotk4_gtk4_CellEditable_ConnectEditingDone(gpointer, guintptr); +// extern void _gotk4_gtk4_CellArea_ConnectRemoveEditable(gpointer, GtkCellRenderer*, GtkCellEditable*, guintptr); +// extern void _gotk4_gtk4_CellArea_ConnectFocusChanged(gpointer, GtkCellRenderer*, gchar*, guintptr); +// extern void _gotk4_gtk4_CellArea_ConnectApplyAttributes(gpointer, GtkTreeModel*, GtkTreeIter*, gboolean, gboolean, guintptr); +// extern void _gotk4_gtk4_CellArea_ConnectAddEditable(gpointer, GtkCellRenderer*, GtkCellEditable*, GdkRectangle*, gchar*, guintptr); +// extern void _gotk4_gtk4_CellAreaContextClass_reset(GtkCellAreaContext*); +// extern void _gotk4_gtk4_CellAreaContextClass_get_preferred_width_for_height(GtkCellAreaContext*, int, int*, int*); +// extern void _gotk4_gtk4_CellAreaContextClass_get_preferred_height_for_width(GtkCellAreaContext*, int, int*, int*); +// extern void _gotk4_gtk4_CellAreaContextClass_allocate(GtkCellAreaContext*, int, int); +// extern void _gotk4_gtk4_CellAreaClass_snapshot(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, GtkSnapshot*, GdkRectangle*, GdkRectangle*, GtkCellRendererState, gboolean); +// extern void _gotk4_gtk4_CellAreaClass_remove(GtkCellArea*, GtkCellRenderer*); +// extern void _gotk4_gtk4_CellAreaClass_get_preferred_width_for_height(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, int, int*, int*); +// extern void _gotk4_gtk4_CellAreaClass_get_preferred_width(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, int*, int*); +// extern void _gotk4_gtk4_CellAreaClass_get_preferred_height_for_width(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, int, int*, int*); +// extern void _gotk4_gtk4_CellAreaClass_get_preferred_height(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, int*, int*); +// extern void _gotk4_gtk4_CellAreaClass_apply_attributes(GtkCellArea*, GtkTreeModel*, GtkTreeIter*, gboolean, gboolean); +// extern void _gotk4_gtk4_CellAreaClass_add(GtkCellArea*, GtkCellRenderer*); +// extern void _gotk4_gtk4_Calendar_ConnectPrevYear(gpointer, guintptr); +// extern void _gotk4_gtk4_Calendar_ConnectPrevMonth(gpointer, guintptr); +// extern void _gotk4_gtk4_Calendar_ConnectNextYear(gpointer, guintptr); +// extern void _gotk4_gtk4_Calendar_ConnectNextMonth(gpointer, guintptr); +// extern void _gotk4_gtk4_Calendar_ConnectDaySelected(gpointer, guintptr); +// extern void _gotk4_gtk4_Button_ConnectClicked(gpointer, guintptr); +// extern void _gotk4_gtk4_Button_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_ButtonClass_clicked(GtkButton*); +// extern void _gotk4_gtk4_ButtonClass_activate(GtkButton*); +// extern void _gotk4_gtk4_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer); +// extern void _gotk4_gtk4_Assistant_ConnectPrepare(gpointer, GtkWidget*, guintptr); +// extern void _gotk4_gtk4_Assistant_ConnectEscape(gpointer, guintptr); +// extern void _gotk4_gtk4_Assistant_ConnectClose(gpointer, guintptr); +// extern void _gotk4_gtk4_Assistant_ConnectCancel(gpointer, guintptr); +// extern void _gotk4_gtk4_Assistant_ConnectApply(gpointer, guintptr); +// extern void _gotk4_gtk4_Application_ConnectWindowRemoved(gpointer, GtkWindow*, guintptr); +// extern void _gotk4_gtk4_Application_ConnectWindowAdded(gpointer, GtkWindow*, guintptr); +// extern void _gotk4_gtk4_Application_ConnectQueryEnd(gpointer, guintptr); +// extern void _gotk4_gtk4_ApplicationClass_window_removed(GtkApplication*, GtkWindow*); +// extern void _gotk4_gtk4_ApplicationClass_window_added(GtkApplication*, GtkWindow*); +// extern void _gotk4_gtk4_AppChooserWidget_ConnectApplicationSelected(gpointer, GAppInfo*, guintptr); +// extern void _gotk4_gtk4_AppChooserWidget_ConnectApplicationActivated(gpointer, GAppInfo*, guintptr); +// extern void _gotk4_gtk4_AppChooserButton_ConnectCustomItemActivated(gpointer, gchar*, guintptr); +// extern void _gotk4_gtk4_AppChooserButton_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_AppChooserButton_ConnectActivate(gpointer, guintptr); +// extern void _gotk4_gtk4_Adjustment_ConnectValueChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_Adjustment_ConnectChanged(gpointer, guintptr); +// extern void _gotk4_gtk4_AdjustmentClass_value_changed(GtkAdjustment*); +// extern void _gotk4_gtk4_AdjustmentClass_changed(GtkAdjustment*); +// extern void _gotk4_gtk4_ATContext_ConnectStateChange(gpointer, guintptr); +// extern void _gotk4_gio2_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer); +// extern int _gotk4_gtk4_TreeIterCompareFunc(GtkTreeModel*, GtkTreeIter*, GtkTreeIter*, gpointer); +// extern int _gotk4_gtk4_ListBoxSortFunc(GtkListBoxRow*, GtkListBoxRow*, gpointer); +// extern int _gotk4_gtk4_FlowBoxSortFunc(GtkFlowBoxChild*, GtkFlowBoxChild*, gpointer); +// extern int _gotk4_gtk4_CellAreaClass_event(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, GdkEvent*, GdkRectangle*, GtkCellRendererState); +// extern int _gotk4_gtk4_AssistantPageFunc(int, gpointer); +// extern guint _gotk4_gtk4_EntryBufferClass_insert_text(GtkEntryBuffer*, guint, char*, guint); +// extern guint _gotk4_gtk4_EntryBufferClass_get_length(GtkEntryBuffer*); +// extern guint _gotk4_gtk4_EntryBufferClass_delete_text(GtkEntryBuffer*, guint, guint); +// extern gpointer _gotk4_gtk4_MapListModelMapFunc(gpointer, gpointer); +// extern gint _gotk4_gtk4_CompareDataFunc(gconstpointer, gconstpointer, gpointer); +// extern gint _gotk4_glib2_CompareDataFunc(gconstpointer, gconstpointer, gpointer); +// extern gchar* _gotk4_gtk4_ComboBox_ConnectFormatEntryText(gpointer, gchar*, guintptr); +// extern gboolean _gotk4_gtk4_Window_ConnectEnableDebugging(gpointer, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_Window_ConnectCloseRequest(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_WindowClass_enable_debugging(GtkWindow*, gboolean); +// extern gboolean _gotk4_gtk4_WindowClass_close_request(GtkWindow*); +// extern gboolean _gotk4_gtk4_Widget_ConnectQueryTooltip(gpointer, gint, gint, gboolean, GtkTooltip*, guintptr); +// extern gboolean _gotk4_gtk4_Widget_ConnectMnemonicActivate(gpointer, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_Widget_ConnectKeynavFailed(gpointer, GtkDirectionType, guintptr); +// extern gboolean _gotk4_gtk4_WidgetClass_query_tooltip(GtkWidget*, int, int, gboolean, GtkTooltip*); +// extern gboolean _gotk4_gtk4_WidgetClass_mnemonic_activate(GtkWidget*, gboolean); +// extern gboolean _gotk4_gtk4_WidgetClass_keynav_failed(GtkWidget*, GtkDirectionType); +// extern gboolean _gotk4_gtk4_WidgetClass_grab_focus(GtkWidget*); +// extern gboolean _gotk4_gtk4_WidgetClass_focus(GtkWidget*, GtkDirectionType); +// extern gboolean _gotk4_gtk4_WidgetClass_contains(GtkWidget*, double, double); +// extern gboolean _gotk4_gtk4_TreeView_ConnectUnselectAll(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_TreeView_ConnectToggleCursorRow(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_TreeView_ConnectTestExpandRow(gpointer, GtkTreeIter*, GtkTreePath*, guintptr); +// extern gboolean _gotk4_gtk4_TreeView_ConnectTestCollapseRow(gpointer, GtkTreeIter*, GtkTreePath*, guintptr); +// extern gboolean _gotk4_gtk4_TreeView_ConnectStartInteractiveSearch(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_TreeView_ConnectSelectCursorRow(gpointer, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_TreeView_ConnectSelectCursorParent(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_TreeView_ConnectSelectAll(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_TreeView_ConnectMoveCursor(gpointer, GtkMovementStep, gint, gboolean, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_TreeView_ConnectExpandCollapseCursorRow(gpointer, gboolean, gboolean, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_TreeViewSearchEqualFunc(GtkTreeModel*, int, char*, GtkTreeIter*, gpointer); +// extern gboolean _gotk4_gtk4_TreeViewRowSeparatorFunc(GtkTreeModel*, GtkTreeIter*, gpointer); +// extern gboolean _gotk4_gtk4_TreeViewColumnDropFunc(GtkTreeView*, GtkTreeViewColumn*, GtkTreeViewColumn*, GtkTreeViewColumn*, gpointer); +// extern gboolean _gotk4_gtk4_TreeViewClass_unselect_all(GtkTreeView*); +// extern gboolean _gotk4_gtk4_TreeViewClass_toggle_cursor_row(GtkTreeView*); +// extern gboolean _gotk4_gtk4_TreeViewClass_test_expand_row(GtkTreeView*, GtkTreeIter*, GtkTreePath*); +// extern gboolean _gotk4_gtk4_TreeViewClass_test_collapse_row(GtkTreeView*, GtkTreeIter*, GtkTreePath*); +// extern gboolean _gotk4_gtk4_TreeViewClass_start_interactive_search(GtkTreeView*); +// extern gboolean _gotk4_gtk4_TreeViewClass_select_cursor_row(GtkTreeView*, gboolean); +// extern gboolean _gotk4_gtk4_TreeViewClass_select_cursor_parent(GtkTreeView*); +// extern gboolean _gotk4_gtk4_TreeViewClass_select_all(GtkTreeView*); +// extern gboolean _gotk4_gtk4_TreeViewClass_move_cursor(GtkTreeView*, GtkMovementStep, int, gboolean, gboolean); +// extern gboolean _gotk4_gtk4_TreeViewClass_expand_collapse_cursor_row(GtkTreeView*, gboolean, gboolean, gboolean); +// extern gboolean _gotk4_gtk4_TreeSelectionFunc(GtkTreeSelection*, GtkTreeModel*, GtkTreePath*, gboolean, gpointer); +// extern gboolean _gotk4_gtk4_TreeModelForEachFunc(GtkTreeModel*, GtkTreePath*, GtkTreeIter*, gpointer); +// extern gboolean _gotk4_gtk4_TreeModelFilterVisibleFunc(GtkTreeModel*, GtkTreeIter*, gpointer); +// extern gboolean _gotk4_gtk4_TreeModelFilterClass_visible(GtkTreeModelFilter*, GtkTreeModel*, GtkTreeIter*); +// extern gboolean _gotk4_gtk4_TickCallback(GtkWidget*, GdkFrameClock*, gpointer); +// extern gboolean _gotk4_gtk4_TextView_ConnectExtendSelection(gpointer, GtkTextExtendSelection, GtkTextIter*, GtkTextIter*, GtkTextIter*, guintptr); +// extern gboolean _gotk4_gtk4_TextViewClass_extend_selection(GtkTextView*, GtkTextExtendSelection, GtkTextIter*, GtkTextIter*, GtkTextIter*); +// extern gboolean _gotk4_gtk4_TextCharPredicate(gunichar, gpointer); +// extern gboolean _gotk4_gtk4_Switch_ConnectStateSet(gpointer, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_SpinButton_ConnectOutput(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_ShortcutsSection_ConnectChangeCurrentPage(gpointer, gint, guintptr); +// extern gboolean _gotk4_gtk4_ShortcutFunc(GtkWidget*, GVariant*, gpointer); +// extern gboolean _gotk4_gtk4_ScrolledWindow_ConnectScrollChild(gpointer, GtkScrollType, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_Range_ConnectChangeValue(gpointer, GtkScrollType, gdouble, guintptr); +// extern gboolean _gotk4_gtk4_RangeClass_change_value(GtkRange*, GtkScrollType, double); +// extern gboolean _gotk4_gtk4_PrintOperation_ConnectPreview(gpointer, GtkPrintOperationPreview*, GtkPrintContext*, GtkWindow*, guintptr); +// extern gboolean _gotk4_gtk4_PrintOperation_ConnectPaginate(gpointer, GtkPrintContext*, guintptr); +// extern gboolean _gotk4_gtk4_PrintOperationClass_preview(GtkPrintOperation*, GtkPrintOperationPreview*, GtkPrintContext*, GtkWindow*); +// extern gboolean _gotk4_gtk4_PrintOperationClass_paginate(GtkPrintOperation*, GtkPrintContext*); +// extern gboolean _gotk4_gtk4_Paned_ConnectToggleHandleFocus(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_Paned_ConnectMoveHandle(gpointer, GtkScrollType, guintptr); +// extern gboolean _gotk4_gtk4_Paned_ConnectCycleHandleFocus(gpointer, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_Paned_ConnectCycleChildFocus(gpointer, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_Paned_ConnectCancelPosition(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_Paned_ConnectAcceptPosition(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_Overlay_ConnectGetChildPosition(gpointer, GtkWidget*, GdkRectangle*, guintptr); +// extern gboolean _gotk4_gtk4_Notebook_ConnectSelectPage(gpointer, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_Notebook_ConnectReorderTab(gpointer, GtkDirectionType, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_Notebook_ConnectFocusTab(gpointer, GtkNotebookTab, guintptr); +// extern gboolean _gotk4_gtk4_Notebook_ConnectChangeCurrentPage(gpointer, gint, guintptr); +// extern gboolean _gotk4_gtk4_MediaStreamClass_play(GtkMediaStream*); +// extern gboolean _gotk4_gtk4_ListBoxFilterFunc(GtkListBoxRow*, gpointer); +// extern gboolean _gotk4_gtk4_LinkButton_ConnectActivateLink(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_Label_ConnectActivateLink(gpointer, gchar*, guintptr); +// extern gboolean _gotk4_gtk4_IconView_ConnectMoveCursor(gpointer, GtkMovementStep, gint, gboolean, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_IconView_ConnectActivateCursorItem(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_IMContext_ConnectRetrieveSurrounding(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_IMContext_ConnectDeleteSurrounding(gpointer, gint, gint, guintptr); +// extern gboolean _gotk4_gtk4_IMContextClass_retrieve_surrounding(GtkIMContext*); +// extern gboolean _gotk4_gtk4_IMContextClass_get_surrounding_with_selection(GtkIMContext*, char**, int*, int*); +// extern gboolean _gotk4_gtk4_IMContextClass_get_surrounding(GtkIMContext*, char**, int*); +// extern gboolean _gotk4_gtk4_IMContextClass_filter_keypress(GtkIMContext*, GdkEvent*); +// extern gboolean _gotk4_gtk4_IMContextClass_delete_surrounding(GtkIMContext*, int, int); +// extern gboolean _gotk4_gtk4_IMContextClass_activate_osk_with_event(GtkIMContext*, GdkEvent*); +// extern gboolean _gotk4_gtk4_GLArea_ConnectRender(gpointer, GdkGLContext*, guintptr); +// extern gboolean _gotk4_gtk4_GLAreaClass_render(GtkGLArea*, GdkGLContext*); +// extern gboolean _gotk4_gtk4_FontFilterFunc(PangoFontFamily*, PangoFontFace*, gpointer); +// extern gboolean _gotk4_gtk4_FlowBox_ConnectMoveCursor(gpointer, GtkMovementStep, gint, gboolean, gboolean, guintptr); +// extern gboolean _gotk4_gtk4_FlowBoxFilterFunc(GtkFlowBoxChild*, gpointer); +// extern gboolean _gotk4_gtk4_FilterClass_match(GtkFilter*, gpointer); +// extern gboolean _gotk4_gtk4_EventControllerScroll_ConnectScroll(gpointer, gdouble, gdouble, guintptr); +// extern gboolean _gotk4_gtk4_EventControllerLegacy_ConnectEvent(gpointer, GdkEvent*, guintptr); +// extern gboolean _gotk4_gtk4_EventControllerKey_ConnectModifiers(gpointer, GdkModifierType, guintptr); +// extern gboolean _gotk4_gtk4_EventControllerKey_ConnectKeyPressed(gpointer, guint, guint, GdkModifierType, guintptr); +// extern gboolean _gotk4_gtk4_EntryCompletion_ConnectMatchSelected(gpointer, GtkTreeModel*, GtkTreeIter*, guintptr); +// extern gboolean _gotk4_gtk4_EntryCompletion_ConnectInsertPrefix(gpointer, gchar*, guintptr); +// extern gboolean _gotk4_gtk4_EntryCompletion_ConnectCursorOnMatch(gpointer, GtkTreeModel*, GtkTreeIter*, guintptr); +// extern gboolean _gotk4_gtk4_EntryCompletionMatchFunc(GtkEntryCompletion*, char*, GtkTreeIter*, gpointer); +// extern gboolean _gotk4_gtk4_DropTarget_ConnectDrop(gpointer, GValue*, gdouble, gdouble, guintptr); +// extern gboolean _gotk4_gtk4_DropTarget_ConnectAccept(gpointer, GdkDrop*, guintptr); +// extern gboolean _gotk4_gtk4_DropTargetAsync_ConnectDrop(gpointer, GdkDrop*, gdouble, gdouble, guintptr); +// extern gboolean _gotk4_gtk4_DropTargetAsync_ConnectAccept(gpointer, GdkDrop*, guintptr); +// extern gboolean _gotk4_gtk4_DragSource_ConnectDragCancel(gpointer, GdkDrag*, GdkDragCancelReason, guintptr); +// extern gboolean _gotk4_gtk4_CustomFilterFunc(gpointer, gpointer); +// extern gboolean _gotk4_gtk4_ComboBox_ConnectPopdown(gpointer, guintptr); +// extern gboolean _gotk4_gtk4_CellRendererClass_activate(GtkCellRenderer*, GdkEvent*, GtkWidget*, char*, GdkRectangle*, GdkRectangle*, GtkCellRendererState); +// extern gboolean _gotk4_gtk4_CellCallback(GtkCellRenderer*, gpointer); +// extern gboolean _gotk4_gtk4_CellAreaClass_is_activatable(GtkCellArea*); +// extern gboolean _gotk4_gtk4_CellAreaClass_focus(GtkCellArea*, GtkDirectionType); +// extern gboolean _gotk4_gtk4_CellAreaClass_activate(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, GdkRectangle*, GtkCellRendererState, gboolean); +// extern gboolean _gotk4_gtk4_CellAllocCallback(GtkCellRenderer*, GdkRectangle*, GdkRectangle*, gpointer); +// extern gboolean _gotk4_gtk4_AboutDialog_ConnectActivateLink(gpointer, gchar*, guintptr); +// extern char* _gotk4_gtk4_ScaleFormatValueFunc(GtkScale*, double, gpointer); +// extern char* _gotk4_gtk4_EntryBufferClass_get_text(GtkEntryBuffer*, gsize*); +// extern char* _gotk4_gtk4_ComboBoxClass_format_entry_text(GtkComboBox*, char*); +// extern GtkWidget* _gotk4_gtk4_ListBoxCreateWidgetFunc(gpointer, gpointer); +// extern GtkWidget* _gotk4_gtk4_FlowBoxCreateWidgetFunc(gpointer, gpointer); +// extern GtkSorterOrder _gotk4_gtk4_SorterClass_get_order(GtkSorter*); +// extern GtkSizeRequestMode _gotk4_gtk4_WidgetClass_get_request_mode(GtkWidget*); +// extern GtkSizeRequestMode _gotk4_gtk4_LayoutManagerClass_get_request_mode(GtkLayoutManager*, GtkWidget*); +// extern GtkSizeRequestMode _gotk4_gtk4_CellRendererClass_get_request_mode(GtkCellRenderer*); +// extern GtkSizeRequestMode _gotk4_gtk4_CellAreaClass_get_request_mode(GtkCellArea*); +// extern GtkOrdering _gotk4_gtk4_SorterClass_compare(GtkSorter*, gpointer, gpointer); +// extern GtkNotebook* _gotk4_gtk4_Notebook_ConnectCreateWindow(gpointer, GtkWidget*, guintptr); +// extern GtkLayoutChild* _gotk4_gtk4_LayoutManagerClass_create_layout_child(GtkLayoutManager*, GtkWidget*, GtkWidget*); +// extern GtkFilterMatch _gotk4_gtk4_FilterClass_get_strictness(GtkFilter*); +// extern GtkCellEditable* _gotk4_gtk4_CellRendererClass_start_editing(GtkCellRenderer*, GdkEvent*, GtkWidget*, char*, GdkRectangle*, GdkRectangle*, GtkCellRendererState); +// extern GtkCellAreaContext* _gotk4_gtk4_CellAreaClass_create_context(GtkCellArea*); +// extern GtkCellAreaContext* _gotk4_gtk4_CellAreaClass_copy_context(GtkCellArea*, GtkCellAreaContext*); +// extern GdkGLContext* _gotk4_gtk4_GLArea_ConnectCreateContext(gpointer, guintptr); +// extern GdkDragAction _gotk4_gtk4_DropTarget_ConnectMotion(gpointer, gdouble, gdouble, guintptr); +// extern GdkDragAction _gotk4_gtk4_DropTarget_ConnectEnter(gpointer, gdouble, gdouble, guintptr); +// extern GdkDragAction _gotk4_gtk4_DropTargetAsync_ConnectDragMotion(gpointer, GdkDrop*, gdouble, gdouble, guintptr); +// extern GdkDragAction _gotk4_gtk4_DropTargetAsync_ConnectDragEnter(gpointer, GdkDrop*, gdouble, gdouble, guintptr); +// extern GdkContentProvider* _gotk4_gtk4_DragSource_ConnectPrepare(gpointer, gdouble, gdouble, guintptr); +// extern GObject* _gotk4_gtk4_PrintOperation_ConnectCreateCustomWidget(gpointer, guintptr); +// extern GListModel* _gotk4_gtk4_TreeListModelCreateModelFunc(gpointer, gpointer); +// GBytes* _gotk4_gtk4_AccessibleText_virtual_get_contents(void* fnptr, GtkAccessibleText* arg0, unsigned int arg1, unsigned int arg2) { +// return ((GBytes* (*)(GtkAccessibleText*, unsigned int, unsigned int))(fnptr))(arg0, arg1, arg2); +// }; +// GBytes* _gotk4_gtk4_AccessibleText_virtual_get_contents_at(void* fnptr, GtkAccessibleText* arg0, unsigned int arg1, GtkAccessibleTextGranularity arg2, unsigned int* arg3, unsigned int* arg4) { +// return ((GBytes* (*)(GtkAccessibleText*, unsigned int, GtkAccessibleTextGranularity, unsigned int*, unsigned int*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// GList* _gotk4_gtk4_CellLayout_virtual_get_cells(void* fnptr, GtkCellLayout* arg0) { +// return ((GList* (*)(GtkCellLayout*))(fnptr))(arg0); +// }; +// GObject* _gotk4_gtk4_Buildable_virtual_get_internal_child(void* fnptr, GtkBuildable* arg0, GtkBuilder* arg1, char* arg2) { +// return ((GObject* (*)(GtkBuildable*, GtkBuilder*, char*))(fnptr))(arg0, arg1, arg2); +// }; +// GType _gotk4_gtk4_BuilderScope_virtual_get_type_from_function(void* fnptr, GtkBuilderScope* arg0, GtkBuilder* arg1, char* arg2) { +// return ((GType (*)(GtkBuilderScope*, GtkBuilder*, char*))(fnptr))(arg0, arg1, arg2); +// }; +// GType _gotk4_gtk4_BuilderScope_virtual_get_type_from_name(void* fnptr, GtkBuilderScope* arg0, GtkBuilder* arg1, char* arg2) { +// return ((GType (*)(GtkBuilderScope*, GtkBuilder*, char*))(fnptr))(arg0, arg1, arg2); +// }; +// GType _gotk4_gtk4_TreeModel_virtual_get_column_type(void* fnptr, GtkTreeModel* arg0, int arg1) { +// return ((GType (*)(GtkTreeModel*, int))(fnptr))(arg0, arg1); +// }; +// GVariant* _gotk4_gtk4_Actionable_virtual_get_action_target_value(void* fnptr, GtkActionable* arg0) { +// return ((GVariant* (*)(GtkActionable*))(fnptr))(arg0); +// }; +// GdkContentProvider* _gotk4_gtk4_TreeDragSource_virtual_drag_data_get(void* fnptr, GtkTreeDragSource* arg0, GtkTreePath* arg1) { +// return ((GdkContentProvider* (*)(GtkTreeDragSource*, GtkTreePath*))(fnptr))(arg0, arg1); +// }; +// GtkATContext* _gotk4_gtk4_Accessible_virtual_get_at_context(void* fnptr, GtkAccessible* arg0) { +// return ((GtkATContext* (*)(GtkAccessible*))(fnptr))(arg0); +// }; +// GtkAccessible* _gotk4_gtk4_Accessible_virtual_get_accessible_parent(void* fnptr, GtkAccessible* arg0) { +// return ((GtkAccessible* (*)(GtkAccessible*))(fnptr))(arg0); +// }; +// GtkAccessible* _gotk4_gtk4_Accessible_virtual_get_first_accessible_child(void* fnptr, GtkAccessible* arg0) { +// return ((GtkAccessible* (*)(GtkAccessible*))(fnptr))(arg0); +// }; +// GtkAccessible* _gotk4_gtk4_Accessible_virtual_get_next_accessible_sibling(void* fnptr, GtkAccessible* arg0) { +// return ((GtkAccessible* (*)(GtkAccessible*))(fnptr))(arg0); +// }; +// GtkBitset* _gotk4_gtk4_SelectionModel_virtual_get_selection_in_range(void* fnptr, GtkSelectionModel* arg0, guint arg1, guint arg2) { +// return ((GtkBitset* (*)(GtkSelectionModel*, guint, guint))(fnptr))(arg0, arg1, arg2); +// }; +// GtkCellArea* _gotk4_gtk4_CellLayout_virtual_get_area(void* fnptr, GtkCellLayout* arg0) { +// return ((GtkCellArea* (*)(GtkCellLayout*))(fnptr))(arg0); +// }; +// GtkCellAreaContext* _gotk4_gtk4_CellArea_virtual_copy_context(void* fnptr, GtkCellArea* arg0, GtkCellAreaContext* arg1) { +// return ((GtkCellAreaContext* (*)(GtkCellArea*, GtkCellAreaContext*))(fnptr))(arg0, arg1); +// }; +// GtkCellAreaContext* _gotk4_gtk4_CellArea_virtual_create_context(void* fnptr, GtkCellArea* arg0) { +// return ((GtkCellAreaContext* (*)(GtkCellArea*))(fnptr))(arg0); +// }; +// GtkCellEditable* _gotk4_gtk4_CellRenderer_virtual_start_editing(void* fnptr, GtkCellRenderer* arg0, GdkEvent* arg1, GtkWidget* arg2, char* arg3, GdkRectangle* arg4, GdkRectangle* arg5, GtkCellRendererState arg6) { +// return ((GtkCellEditable* (*)(GtkCellRenderer*, GdkEvent*, GtkWidget*, char*, GdkRectangle*, GdkRectangle*, GtkCellRendererState))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// GtkEditable* _gotk4_gtk4_EditableTextWidget_virtual_get_delegate(void* fnptr, GtkEditable* arg0) { +// return ((GtkEditable* (*)(GtkEditable*))(fnptr))(arg0); +// }; +// GtkFilterMatch _gotk4_gtk4_Filter_virtual_get_strictness(void* fnptr, GtkFilter* arg0) { +// return ((GtkFilterMatch (*)(GtkFilter*))(fnptr))(arg0); +// }; +// GtkLayoutChild* _gotk4_gtk4_LayoutManager_virtual_create_layout_child(void* fnptr, GtkLayoutManager* arg0, GtkWidget* arg1, GtkWidget* arg2) { +// return ((GtkLayoutChild* (*)(GtkLayoutManager*, GtkWidget*, GtkWidget*))(fnptr))(arg0, arg1, arg2); +// }; +// GtkOrdering _gotk4_gtk4_Sorter_virtual_compare(void* fnptr, GtkSorter* arg0, gpointer arg1, gpointer arg2) { +// return ((GtkOrdering (*)(GtkSorter*, gpointer, gpointer))(fnptr))(arg0, arg1, arg2); +// }; +// GtkSizeRequestMode _gotk4_gtk4_CellArea_virtual_get_request_mode(void* fnptr, GtkCellArea* arg0) { +// return ((GtkSizeRequestMode (*)(GtkCellArea*))(fnptr))(arg0); +// }; +// GtkSizeRequestMode _gotk4_gtk4_CellRenderer_virtual_get_request_mode(void* fnptr, GtkCellRenderer* arg0) { +// return ((GtkSizeRequestMode (*)(GtkCellRenderer*))(fnptr))(arg0); +// }; +// GtkSizeRequestMode _gotk4_gtk4_LayoutManager_virtual_get_request_mode(void* fnptr, GtkLayoutManager* arg0, GtkWidget* arg1) { +// return ((GtkSizeRequestMode (*)(GtkLayoutManager*, GtkWidget*))(fnptr))(arg0, arg1); +// }; +// GtkSizeRequestMode _gotk4_gtk4_Widget_virtual_get_request_mode(void* fnptr, GtkWidget* arg0) { +// return ((GtkSizeRequestMode (*)(GtkWidget*))(fnptr))(arg0); +// }; +// GtkSorterOrder _gotk4_gtk4_Sorter_virtual_get_order(void* fnptr, GtkSorter* arg0) { +// return ((GtkSorterOrder (*)(GtkSorter*))(fnptr))(arg0); +// }; +// GtkTreeModelFlags _gotk4_gtk4_TreeModel_virtual_get_flags(void* fnptr, GtkTreeModel* arg0) { +// return ((GtkTreeModelFlags (*)(GtkTreeModel*))(fnptr))(arg0); +// }; +// GtkTreePath* _gotk4_gtk4_TreeModel_virtual_get_path(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1) { +// return ((GtkTreePath* (*)(GtkTreeModel*, GtkTreeIter*))(fnptr))(arg0, arg1); +// }; +// GtkWidget* _gotk4_gtk4_dialog_new2(const gchar* title, GtkWindow* parent, GtkDialogFlags flags) { +// return gtk_dialog_new_with_buttons(title, parent, flags, NULL, NULL); +// } +// GtkWidget* _gotk4_gtk_message_dialog_new2(GtkWindow* parent, GtkDialogFlags flags, GtkMessageType type, GtkButtonsType buttons) { +// return gtk_message_dialog_new_with_markup(parent, flags, type, buttons, NULL); +// } +// PangoFontFace* _gotk4_gtk4_FontChooser_virtual_get_font_face(void* fnptr, GtkFontChooser* arg0) { +// return ((PangoFontFace* (*)(GtkFontChooser*))(fnptr))(arg0); +// }; +// PangoFontFamily* _gotk4_gtk4_FontChooser_virtual_get_font_family(void* fnptr, GtkFontChooser* arg0) { +// return ((PangoFontFamily* (*)(GtkFontChooser*))(fnptr))(arg0); +// }; +// PangoFontMap* _gotk4_gtk4_FontChooser_virtual_get_font_map(void* fnptr, GtkFontChooser* arg0) { +// return ((PangoFontMap* (*)(GtkFontChooser*))(fnptr))(arg0); +// }; +// char* _gotk4_gtk4_Actionable_virtual_get_action_name(void* fnptr, GtkActionable* arg0) { +// return ((char* (*)(GtkActionable*))(fnptr))(arg0); +// }; +// char* _gotk4_gtk4_Buildable_virtual_get_id(void* fnptr, GtkBuildable* arg0) { +// return ((char* (*)(GtkBuildable*))(fnptr))(arg0); +// }; +// char* _gotk4_gtk4_ComboBox_virtual_format_entry_text(void* fnptr, GtkComboBox* arg0, char* arg1) { +// return ((char* (*)(GtkComboBox*, char*))(fnptr))(arg0, arg1); +// }; +// char* _gotk4_gtk4_EditableTextWidget_virtual_get_text(void* fnptr, GtkEditable* arg0) { +// return ((char* (*)(GtkEditable*))(fnptr))(arg0); +// }; +// char* _gotk4_gtk4_EntryBuffer_virtual_get_text(void* fnptr, GtkEntryBuffer* arg0, gsize* arg1) { +// return ((char* (*)(GtkEntryBuffer*, gsize*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_AccessibleRange_virtual_set_current_value(void* fnptr, GtkAccessibleRange* arg0, double arg1) { +// return ((gboolean (*)(GtkAccessibleRange*, double))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_AccessibleText_virtual_get_attributes(void* fnptr, GtkAccessibleText* arg0, unsigned int arg1, gsize* arg2, GtkAccessibleTextRange** arg3, char*** arg4, char*** arg5) { +// return ((gboolean (*)(GtkAccessibleText*, unsigned int, gsize*, GtkAccessibleTextRange**, char***, char***))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// gboolean _gotk4_gtk4_AccessibleText_virtual_get_selection(void* fnptr, GtkAccessibleText* arg0, gsize* arg1, GtkAccessibleTextRange** arg2) { +// return ((gboolean (*)(GtkAccessibleText*, gsize*, GtkAccessibleTextRange**))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_Accessible_virtual_get_bounds(void* fnptr, GtkAccessible* arg0, int* arg1, int* arg2, int* arg3, int* arg4) { +// return ((gboolean (*)(GtkAccessible*, int*, int*, int*, int*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gtk4_Accessible_virtual_get_platform_state(void* fnptr, GtkAccessible* arg0, GtkAccessiblePlatformState arg1) { +// return ((gboolean (*)(GtkAccessible*, GtkAccessiblePlatformState))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_Buildable_virtual_custom_tag_start(void* fnptr, GtkBuildable* arg0, GtkBuilder* arg1, GObject* arg2, char* arg3, GtkBuildableParser* arg4, gpointer* arg5) { +// return ((gboolean (*)(GtkBuildable*, GtkBuilder*, GObject*, char*, GtkBuildableParser*, gpointer*))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// gboolean _gotk4_gtk4_CellArea_virtual_activate(void* fnptr, GtkCellArea* arg0, GtkCellAreaContext* arg1, GtkWidget* arg2, GdkRectangle* arg3, GtkCellRendererState arg4, gboolean arg5) { +// return ((gboolean (*)(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, GdkRectangle*, GtkCellRendererState, gboolean))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// gboolean _gotk4_gtk4_CellArea_virtual_focus(void* fnptr, GtkCellArea* arg0, GtkDirectionType arg1) { +// return ((gboolean (*)(GtkCellArea*, GtkDirectionType))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_CellArea_virtual_is_activatable(void* fnptr, GtkCellArea* arg0) { +// return ((gboolean (*)(GtkCellArea*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_CellRenderer_virtual_activate(void* fnptr, GtkCellRenderer* arg0, GdkEvent* arg1, GtkWidget* arg2, char* arg3, GdkRectangle* arg4, GdkRectangle* arg5, GtkCellRendererState arg6) { +// return ((gboolean (*)(GtkCellRenderer*, GdkEvent*, GtkWidget*, char*, GdkRectangle*, GdkRectangle*, GtkCellRendererState))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// gboolean _gotk4_gtk4_EditableTextWidget_virtual_get_selection_bounds(void* fnptr, GtkEditable* arg0, int* arg1, int* arg2) { +// return ((gboolean (*)(GtkEditable*, int*, int*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_Filter_virtual_match(void* fnptr, GtkFilter* arg0, gpointer arg1) { +// return ((gboolean (*)(GtkFilter*, gpointer))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_GLArea_virtual_render(void* fnptr, GtkGLArea* arg0, GdkGLContext* arg1) { +// return ((gboolean (*)(GtkGLArea*, GdkGLContext*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_IMContext_virtual_activate_osk_with_event(void* fnptr, GtkIMContext* arg0, GdkEvent* arg1) { +// return ((gboolean (*)(GtkIMContext*, GdkEvent*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_IMContext_virtual_delete_surrounding(void* fnptr, GtkIMContext* arg0, int arg1, int arg2) { +// return ((gboolean (*)(GtkIMContext*, int, int))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_IMContext_virtual_filter_keypress(void* fnptr, GtkIMContext* arg0, GdkEvent* arg1) { +// return ((gboolean (*)(GtkIMContext*, GdkEvent*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_IMContext_virtual_get_surrounding(void* fnptr, GtkIMContext* arg0, char** arg1, int* arg2) { +// return ((gboolean (*)(GtkIMContext*, char**, int*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_IMContext_virtual_get_surrounding_with_selection(void* fnptr, GtkIMContext* arg0, char** arg1, int* arg2, int* arg3) { +// return ((gboolean (*)(GtkIMContext*, char**, int*, int*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gtk4_IMContext_virtual_retrieve_surrounding(void* fnptr, GtkIMContext* arg0) { +// return ((gboolean (*)(GtkIMContext*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_MediaStream_virtual_play(void* fnptr, GtkMediaStream* arg0) { +// return ((gboolean (*)(GtkMediaStream*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_PrintOperationPreview_virtual_is_selected(void* fnptr, GtkPrintOperationPreview* arg0, int arg1) { +// return ((gboolean (*)(GtkPrintOperationPreview*, int))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_PrintOperation_virtual_paginate(void* fnptr, GtkPrintOperation* arg0, GtkPrintContext* arg1) { +// return ((gboolean (*)(GtkPrintOperation*, GtkPrintContext*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_PrintOperation_virtual_preview(void* fnptr, GtkPrintOperation* arg0, GtkPrintOperationPreview* arg1, GtkPrintContext* arg2, GtkWindow* arg3) { +// return ((gboolean (*)(GtkPrintOperation*, GtkPrintOperationPreview*, GtkPrintContext*, GtkWindow*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gtk4_Range_virtual_change_value(void* fnptr, GtkRange* arg0, GtkScrollType arg1, double arg2) { +// return ((gboolean (*)(GtkRange*, GtkScrollType, double))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_Scrollable_virtual_get_border(void* fnptr, GtkScrollable* arg0, GtkBorder* arg1) { +// return ((gboolean (*)(GtkScrollable*, GtkBorder*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_SelectionModel_virtual_is_selected(void* fnptr, GtkSelectionModel* arg0, guint arg1) { +// return ((gboolean (*)(GtkSelectionModel*, guint))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_SelectionModel_virtual_select_all(void* fnptr, GtkSelectionModel* arg0) { +// return ((gboolean (*)(GtkSelectionModel*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_SelectionModel_virtual_select_item(void* fnptr, GtkSelectionModel* arg0, guint arg1, gboolean arg2) { +// return ((gboolean (*)(GtkSelectionModel*, guint, gboolean))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_SelectionModel_virtual_select_range(void* fnptr, GtkSelectionModel* arg0, guint arg1, guint arg2, gboolean arg3) { +// return ((gboolean (*)(GtkSelectionModel*, guint, guint, gboolean))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gtk4_SelectionModel_virtual_set_selection(void* fnptr, GtkSelectionModel* arg0, GtkBitset* arg1, GtkBitset* arg2) { +// return ((gboolean (*)(GtkSelectionModel*, GtkBitset*, GtkBitset*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_SelectionModel_virtual_unselect_all(void* fnptr, GtkSelectionModel* arg0) { +// return ((gboolean (*)(GtkSelectionModel*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_SelectionModel_virtual_unselect_item(void* fnptr, GtkSelectionModel* arg0, guint arg1) { +// return ((gboolean (*)(GtkSelectionModel*, guint))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_SelectionModel_virtual_unselect_range(void* fnptr, GtkSelectionModel* arg0, guint arg1, guint arg2) { +// return ((gboolean (*)(GtkSelectionModel*, guint, guint))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TextView_virtual_extend_selection(void* fnptr, GtkTextView* arg0, GtkTextExtendSelection arg1, GtkTextIter* arg2, GtkTextIter* arg3, GtkTextIter* arg4) { +// return ((gboolean (*)(GtkTextView*, GtkTextExtendSelection, GtkTextIter*, GtkTextIter*, GtkTextIter*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gtk4_TreeDragDest_virtual_drag_data_received(void* fnptr, GtkTreeDragDest* arg0, GtkTreePath* arg1, GValue* arg2) { +// return ((gboolean (*)(GtkTreeDragDest*, GtkTreePath*, GValue*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TreeDragDest_virtual_row_drop_possible(void* fnptr, GtkTreeDragDest* arg0, GtkTreePath* arg1, GValue* arg2) { +// return ((gboolean (*)(GtkTreeDragDest*, GtkTreePath*, GValue*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TreeDragSource_virtual_drag_data_delete(void* fnptr, GtkTreeDragSource* arg0, GtkTreePath* arg1) { +// return ((gboolean (*)(GtkTreeDragSource*, GtkTreePath*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_TreeDragSource_virtual_row_draggable(void* fnptr, GtkTreeDragSource* arg0, GtkTreePath* arg1) { +// return ((gboolean (*)(GtkTreeDragSource*, GtkTreePath*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_TreeModelFilter_virtual_visible(void* fnptr, GtkTreeModelFilter* arg0, GtkTreeModel* arg1, GtkTreeIter* arg2) { +// return ((gboolean (*)(GtkTreeModelFilter*, GtkTreeModel*, GtkTreeIter*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TreeModel_virtual_get_iter(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1, GtkTreePath* arg2) { +// return ((gboolean (*)(GtkTreeModel*, GtkTreeIter*, GtkTreePath*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TreeModel_virtual_iter_children(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1, GtkTreeIter* arg2) { +// return ((gboolean (*)(GtkTreeModel*, GtkTreeIter*, GtkTreeIter*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TreeModel_virtual_iter_has_child(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1) { +// return ((gboolean (*)(GtkTreeModel*, GtkTreeIter*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_TreeModel_virtual_iter_next(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1) { +// return ((gboolean (*)(GtkTreeModel*, GtkTreeIter*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_TreeModel_virtual_iter_nth_child(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1, GtkTreeIter* arg2, int arg3) { +// return ((gboolean (*)(GtkTreeModel*, GtkTreeIter*, GtkTreeIter*, int))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gtk4_TreeModel_virtual_iter_parent(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1, GtkTreeIter* arg2) { +// return ((gboolean (*)(GtkTreeModel*, GtkTreeIter*, GtkTreeIter*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TreeModel_virtual_iter_previous(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1) { +// return ((gboolean (*)(GtkTreeModel*, GtkTreeIter*))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_TreeSortable_virtual_get_sort_column_id(void* fnptr, GtkTreeSortable* arg0, int* arg1, GtkSortType* arg2) { +// return ((gboolean (*)(GtkTreeSortable*, int*, GtkSortType*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TreeSortable_virtual_has_default_sort_func(void* fnptr, GtkTreeSortable* arg0) { +// return ((gboolean (*)(GtkTreeSortable*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_expand_collapse_cursor_row(void* fnptr, GtkTreeView* arg0, gboolean arg1, gboolean arg2, gboolean arg3) { +// return ((gboolean (*)(GtkTreeView*, gboolean, gboolean, gboolean))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_move_cursor(void* fnptr, GtkTreeView* arg0, GtkMovementStep arg1, int arg2, gboolean arg3, gboolean arg4) { +// return ((gboolean (*)(GtkTreeView*, GtkMovementStep, int, gboolean, gboolean))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_select_all(void* fnptr, GtkTreeView* arg0) { +// return ((gboolean (*)(GtkTreeView*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_select_cursor_parent(void* fnptr, GtkTreeView* arg0) { +// return ((gboolean (*)(GtkTreeView*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_select_cursor_row(void* fnptr, GtkTreeView* arg0, gboolean arg1) { +// return ((gboolean (*)(GtkTreeView*, gboolean))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_start_interactive_search(void* fnptr, GtkTreeView* arg0) { +// return ((gboolean (*)(GtkTreeView*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_test_collapse_row(void* fnptr, GtkTreeView* arg0, GtkTreeIter* arg1, GtkTreePath* arg2) { +// return ((gboolean (*)(GtkTreeView*, GtkTreeIter*, GtkTreePath*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_test_expand_row(void* fnptr, GtkTreeView* arg0, GtkTreeIter* arg1, GtkTreePath* arg2) { +// return ((gboolean (*)(GtkTreeView*, GtkTreeIter*, GtkTreePath*))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_toggle_cursor_row(void* fnptr, GtkTreeView* arg0) { +// return ((gboolean (*)(GtkTreeView*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_TreeView_virtual_unselect_all(void* fnptr, GtkTreeView* arg0) { +// return ((gboolean (*)(GtkTreeView*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_Widget_virtual_contains(void* fnptr, GtkWidget* arg0, double arg1, double arg2) { +// return ((gboolean (*)(GtkWidget*, double, double))(fnptr))(arg0, arg1, arg2); +// }; +// gboolean _gotk4_gtk4_Widget_virtual_focus(void* fnptr, GtkWidget* arg0, GtkDirectionType arg1) { +// return ((gboolean (*)(GtkWidget*, GtkDirectionType))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_Widget_virtual_grab_focus(void* fnptr, GtkWidget* arg0) { +// return ((gboolean (*)(GtkWidget*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_Widget_virtual_keynav_failed(void* fnptr, GtkWidget* arg0, GtkDirectionType arg1) { +// return ((gboolean (*)(GtkWidget*, GtkDirectionType))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_Widget_virtual_mnemonic_activate(void* fnptr, GtkWidget* arg0, gboolean arg1) { +// return ((gboolean (*)(GtkWidget*, gboolean))(fnptr))(arg0, arg1); +// }; +// gboolean _gotk4_gtk4_Widget_virtual_query_tooltip(void* fnptr, GtkWidget* arg0, int arg1, int arg2, gboolean arg3, GtkTooltip* arg4) { +// return ((gboolean (*)(GtkWidget*, int, int, gboolean, GtkTooltip*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// gboolean _gotk4_gtk4_Window_virtual_close_request(void* fnptr, GtkWindow* arg0) { +// return ((gboolean (*)(GtkWindow*))(fnptr))(arg0); +// }; +// gboolean _gotk4_gtk4_Window_virtual_enable_debugging(void* fnptr, GtkWindow* arg0, gboolean arg1) { +// return ((gboolean (*)(GtkWindow*, gboolean))(fnptr))(arg0, arg1); +// }; +// guint _gotk4_gtk4_EntryBuffer_virtual_delete_text(void* fnptr, GtkEntryBuffer* arg0, guint arg1, guint arg2) { +// return ((guint (*)(GtkEntryBuffer*, guint, guint))(fnptr))(arg0, arg1, arg2); +// }; +// guint _gotk4_gtk4_EntryBuffer_virtual_get_length(void* fnptr, GtkEntryBuffer* arg0) { +// return ((guint (*)(GtkEntryBuffer*))(fnptr))(arg0); +// }; +// guint _gotk4_gtk4_EntryBuffer_virtual_insert_text(void* fnptr, GtkEntryBuffer* arg0, guint arg1, char* arg2, guint arg3) { +// return ((guint (*)(GtkEntryBuffer*, guint, char*, guint))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// int _gotk4_gtk4_CellArea_virtual_event(void* fnptr, GtkCellArea* arg0, GtkCellAreaContext* arg1, GtkWidget* arg2, GdkEvent* arg3, GdkRectangle* arg4, GtkCellRendererState arg5) { +// return ((int (*)(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, GdkEvent*, GdkRectangle*, GtkCellRendererState))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// int _gotk4_gtk4_FontChooser_virtual_get_font_size(void* fnptr, GtkFontChooser* arg0) { +// return ((int (*)(GtkFontChooser*))(fnptr))(arg0); +// }; +// int _gotk4_gtk4_TreeModel_virtual_get_n_columns(void* fnptr, GtkTreeModel* arg0) { +// return ((int (*)(GtkTreeModel*))(fnptr))(arg0); +// }; +// int _gotk4_gtk4_TreeModel_virtual_iter_n_children(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1) { +// return ((int (*)(GtkTreeModel*, GtkTreeIter*))(fnptr))(arg0, arg1); +// }; +// unsigned int _gotk4_gtk4_AccessibleText_virtual_get_caret_position(void* fnptr, GtkAccessibleText* arg0) { +// return ((unsigned int (*)(GtkAccessibleText*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_AccessibleText_virtual_get_default_attributes(void* fnptr, GtkAccessibleText* arg0, char*** arg1, char*** arg2) { +// ((void (*)(GtkAccessibleText*, char***, char***))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_Actionable_virtual_set_action_name(void* fnptr, GtkActionable* arg0, char* arg1) { +// ((void (*)(GtkActionable*, char*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Actionable_virtual_set_action_target_value(void* fnptr, GtkActionable* arg0, GVariant* arg1) { +// ((void (*)(GtkActionable*, GVariant*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Adjustment_virtual_changed(void* fnptr, GtkAdjustment* arg0) { +// ((void (*)(GtkAdjustment*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Adjustment_virtual_value_changed(void* fnptr, GtkAdjustment* arg0) { +// ((void (*)(GtkAdjustment*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Application_virtual_window_added(void* fnptr, GtkApplication* arg0, GtkWindow* arg1) { +// ((void (*)(GtkApplication*, GtkWindow*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Application_virtual_window_removed(void* fnptr, GtkApplication* arg0, GtkWindow* arg1) { +// ((void (*)(GtkApplication*, GtkWindow*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Buildable_virtual_add_child(void* fnptr, GtkBuildable* arg0, GtkBuilder* arg1, GObject* arg2, char* arg3) { +// ((void (*)(GtkBuildable*, GtkBuilder*, GObject*, char*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_Buildable_virtual_custom_finished(void* fnptr, GtkBuildable* arg0, GtkBuilder* arg1, GObject* arg2, char* arg3, gpointer arg4) { +// ((void (*)(GtkBuildable*, GtkBuilder*, GObject*, char*, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_Buildable_virtual_custom_tag_end(void* fnptr, GtkBuildable* arg0, GtkBuilder* arg1, GObject* arg2, char* arg3, gpointer arg4) { +// ((void (*)(GtkBuildable*, GtkBuilder*, GObject*, char*, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_Buildable_virtual_parser_finished(void* fnptr, GtkBuildable* arg0, GtkBuilder* arg1) { +// ((void (*)(GtkBuildable*, GtkBuilder*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Buildable_virtual_set_buildable_property(void* fnptr, GtkBuildable* arg0, GtkBuilder* arg1, char* arg2, GValue* arg3) { +// ((void (*)(GtkBuildable*, GtkBuilder*, char*, GValue*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_Buildable_virtual_set_id(void* fnptr, GtkBuildable* arg0, char* arg1) { +// ((void (*)(GtkBuildable*, char*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Button_virtual_activate(void* fnptr, GtkButton* arg0) { +// ((void (*)(GtkButton*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Button_virtual_clicked(void* fnptr, GtkButton* arg0) { +// ((void (*)(GtkButton*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_CellAreaContext_virtual_allocate(void* fnptr, GtkCellAreaContext* arg0, int arg1, int arg2) { +// ((void (*)(GtkCellAreaContext*, int, int))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_CellAreaContext_virtual_get_preferred_height_for_width(void* fnptr, GtkCellAreaContext* arg0, int arg1, int* arg2, int* arg3) { +// ((void (*)(GtkCellAreaContext*, int, int*, int*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_CellAreaContext_virtual_get_preferred_width_for_height(void* fnptr, GtkCellAreaContext* arg0, int arg1, int* arg2, int* arg3) { +// ((void (*)(GtkCellAreaContext*, int, int*, int*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_CellAreaContext_virtual_reset(void* fnptr, GtkCellAreaContext* arg0) { +// ((void (*)(GtkCellAreaContext*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_CellArea_virtual_add(void* fnptr, GtkCellArea* arg0, GtkCellRenderer* arg1) { +// ((void (*)(GtkCellArea*, GtkCellRenderer*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_CellArea_virtual_apply_attributes(void* fnptr, GtkCellArea* arg0, GtkTreeModel* arg1, GtkTreeIter* arg2, gboolean arg3, gboolean arg4) { +// ((void (*)(GtkCellArea*, GtkTreeModel*, GtkTreeIter*, gboolean, gboolean))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_CellArea_virtual_foreach(void* fnptr, GtkCellArea* arg0, GtkCellCallback arg1, gpointer arg2) { +// ((void (*)(GtkCellArea*, GtkCellCallback, gpointer))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_CellArea_virtual_foreach_alloc(void* fnptr, GtkCellArea* arg0, GtkCellAreaContext* arg1, GtkWidget* arg2, GdkRectangle* arg3, GdkRectangle* arg4, GtkCellAllocCallback arg5, gpointer arg6) { +// ((void (*)(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, GdkRectangle*, GdkRectangle*, GtkCellAllocCallback, gpointer))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gtk4_CellArea_virtual_get_preferred_height(void* fnptr, GtkCellArea* arg0, GtkCellAreaContext* arg1, GtkWidget* arg2, int* arg3, int* arg4) { +// ((void (*)(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, int*, int*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_CellArea_virtual_get_preferred_height_for_width(void* fnptr, GtkCellArea* arg0, GtkCellAreaContext* arg1, GtkWidget* arg2, int arg3, int* arg4, int* arg5) { +// ((void (*)(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, int, int*, int*))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gtk4_CellArea_virtual_get_preferred_width(void* fnptr, GtkCellArea* arg0, GtkCellAreaContext* arg1, GtkWidget* arg2, int* arg3, int* arg4) { +// ((void (*)(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, int*, int*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_CellArea_virtual_get_preferred_width_for_height(void* fnptr, GtkCellArea* arg0, GtkCellAreaContext* arg1, GtkWidget* arg2, int arg3, int* arg4, int* arg5) { +// ((void (*)(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, int, int*, int*))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gtk4_CellArea_virtual_remove(void* fnptr, GtkCellArea* arg0, GtkCellRenderer* arg1) { +// ((void (*)(GtkCellArea*, GtkCellRenderer*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_CellArea_virtual_snapshot(void* fnptr, GtkCellArea* arg0, GtkCellAreaContext* arg1, GtkWidget* arg2, GtkSnapshot* arg3, GdkRectangle* arg4, GdkRectangle* arg5, GtkCellRendererState arg6, gboolean arg7) { +// ((void (*)(GtkCellArea*, GtkCellAreaContext*, GtkWidget*, GtkSnapshot*, GdkRectangle*, GdkRectangle*, GtkCellRendererState, gboolean))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); +// }; +// void _gotk4_gtk4_CellEditable_virtual_editing_done(void* fnptr, GtkCellEditable* arg0) { +// ((void (*)(GtkCellEditable*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_CellEditable_virtual_remove_widget(void* fnptr, GtkCellEditable* arg0) { +// ((void (*)(GtkCellEditable*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_CellEditable_virtual_start_editing(void* fnptr, GtkCellEditable* arg0, GdkEvent* arg1) { +// ((void (*)(GtkCellEditable*, GdkEvent*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_CellLayout_virtual_add_attribute(void* fnptr, GtkCellLayout* arg0, GtkCellRenderer* arg1, char* arg2, int arg3) { +// ((void (*)(GtkCellLayout*, GtkCellRenderer*, char*, int))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_CellLayout_virtual_clear(void* fnptr, GtkCellLayout* arg0) { +// ((void (*)(GtkCellLayout*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_CellLayout_virtual_clear_attributes(void* fnptr, GtkCellLayout* arg0, GtkCellRenderer* arg1) { +// ((void (*)(GtkCellLayout*, GtkCellRenderer*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_CellLayout_virtual_pack_end(void* fnptr, GtkCellLayout* arg0, GtkCellRenderer* arg1, gboolean arg2) { +// ((void (*)(GtkCellLayout*, GtkCellRenderer*, gboolean))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_CellLayout_virtual_pack_start(void* fnptr, GtkCellLayout* arg0, GtkCellRenderer* arg1, gboolean arg2) { +// ((void (*)(GtkCellLayout*, GtkCellRenderer*, gboolean))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_CellLayout_virtual_reorder(void* fnptr, GtkCellLayout* arg0, GtkCellRenderer* arg1, int arg2) { +// ((void (*)(GtkCellLayout*, GtkCellRenderer*, int))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_CellLayout_virtual_set_cell_data_func(void* fnptr, GtkCellLayout* arg0, GtkCellRenderer* arg1, GtkCellLayoutDataFunc arg2, gpointer arg3, GDestroyNotify arg4) { +// ((void (*)(GtkCellLayout*, GtkCellRenderer*, GtkCellLayoutDataFunc, gpointer, GDestroyNotify))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_CellRendererText_virtual_edited(void* fnptr, GtkCellRendererText* arg0, char* arg1, char* arg2) { +// ((void (*)(GtkCellRendererText*, char*, char*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_CellRenderer_virtual_editing_canceled(void* fnptr, GtkCellRenderer* arg0) { +// ((void (*)(GtkCellRenderer*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_CellRenderer_virtual_editing_started(void* fnptr, GtkCellRenderer* arg0, GtkCellEditable* arg1, char* arg2) { +// ((void (*)(GtkCellRenderer*, GtkCellEditable*, char*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_CellRenderer_virtual_get_aligned_area(void* fnptr, GtkCellRenderer* arg0, GtkWidget* arg1, GtkCellRendererState arg2, GdkRectangle* arg3, GdkRectangle* arg4) { +// ((void (*)(GtkCellRenderer*, GtkWidget*, GtkCellRendererState, GdkRectangle*, GdkRectangle*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_CellRenderer_virtual_get_preferred_height(void* fnptr, GtkCellRenderer* arg0, GtkWidget* arg1, int* arg2, int* arg3) { +// ((void (*)(GtkCellRenderer*, GtkWidget*, int*, int*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_CellRenderer_virtual_get_preferred_height_for_width(void* fnptr, GtkCellRenderer* arg0, GtkWidget* arg1, int arg2, int* arg3, int* arg4) { +// ((void (*)(GtkCellRenderer*, GtkWidget*, int, int*, int*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_CellRenderer_virtual_get_preferred_width(void* fnptr, GtkCellRenderer* arg0, GtkWidget* arg1, int* arg2, int* arg3) { +// ((void (*)(GtkCellRenderer*, GtkWidget*, int*, int*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_CellRenderer_virtual_get_preferred_width_for_height(void* fnptr, GtkCellRenderer* arg0, GtkWidget* arg1, int arg2, int* arg3, int* arg4) { +// ((void (*)(GtkCellRenderer*, GtkWidget*, int, int*, int*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_CellRenderer_virtual_snapshot(void* fnptr, GtkCellRenderer* arg0, GtkSnapshot* arg1, GtkWidget* arg2, GdkRectangle* arg3, GdkRectangle* arg4, GtkCellRendererState arg5) { +// ((void (*)(GtkCellRenderer*, GtkSnapshot*, GtkWidget*, GdkRectangle*, GdkRectangle*, GtkCellRendererState))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gtk4_CheckButton_virtual_activate(void* fnptr, GtkCheckButton* arg0) { +// ((void (*)(GtkCheckButton*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_CheckButton_virtual_toggled(void* fnptr, GtkCheckButton* arg0) { +// ((void (*)(GtkCheckButton*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_ColorChooser_virtual_add_palette(void* fnptr, GtkColorChooser* arg0, GtkOrientation arg1, int arg2, int arg3, GdkRGBA* arg4) { +// ((void (*)(GtkColorChooser*, GtkOrientation, int, int, GdkRGBA*))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_ColorChooser_virtual_color_activated(void* fnptr, GtkColorChooser* arg0, GdkRGBA* arg1) { +// ((void (*)(GtkColorChooser*, GdkRGBA*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_ColorChooser_virtual_get_rgba(void* fnptr, GtkColorChooser* arg0, GdkRGBA* arg1) { +// ((void (*)(GtkColorChooser*, GdkRGBA*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_ColorChooser_virtual_set_rgba(void* fnptr, GtkColorChooser* arg0, GdkRGBA* arg1) { +// ((void (*)(GtkColorChooser*, GdkRGBA*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_ComboBox_virtual_activate(void* fnptr, GtkComboBox* arg0) { +// ((void (*)(GtkComboBox*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_ComboBox_virtual_changed(void* fnptr, GtkComboBox* arg0) { +// ((void (*)(GtkComboBox*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Dialog_virtual_close(void* fnptr, GtkDialog* arg0) { +// ((void (*)(GtkDialog*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Dialog_virtual_response(void* fnptr, GtkDialog* arg0, int arg1) { +// ((void (*)(GtkDialog*, int))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_DrawingArea_virtual_resize(void* fnptr, GtkDrawingArea* arg0, int arg1, int arg2) { +// ((void (*)(GtkDrawingArea*, int, int))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_EditableTextWidget_virtual_changed(void* fnptr, GtkEditable* arg0) { +// ((void (*)(GtkEditable*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_EditableTextWidget_virtual_delete_text(void* fnptr, GtkEditable* arg0, int arg1, int arg2) { +// ((void (*)(GtkEditable*, int, int))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_EditableTextWidget_virtual_do_delete_text(void* fnptr, GtkEditable* arg0, int arg1, int arg2) { +// ((void (*)(GtkEditable*, int, int))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_EditableTextWidget_virtual_set_selection_bounds(void* fnptr, GtkEditable* arg0, int arg1, int arg2) { +// ((void (*)(GtkEditable*, int, int))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_EntryBuffer_virtual_deleted_text(void* fnptr, GtkEntryBuffer* arg0, guint arg1, guint arg2) { +// ((void (*)(GtkEntryBuffer*, guint, guint))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_EntryBuffer_virtual_inserted_text(void* fnptr, GtkEntryBuffer* arg0, guint arg1, char* arg2, guint arg3) { +// ((void (*)(GtkEntryBuffer*, guint, char*, guint))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_Entry_virtual_activate(void* fnptr, GtkEntry* arg0) { +// ((void (*)(GtkEntry*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_FlowBoxChild_virtual_activate(void* fnptr, GtkFlowBoxChild* arg0) { +// ((void (*)(GtkFlowBoxChild*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_FontChooser_virtual_font_activated(void* fnptr, GtkFontChooser* arg0, char* arg1) { +// ((void (*)(GtkFontChooser*, char*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_FontChooser_virtual_set_filter_func(void* fnptr, GtkFontChooser* arg0, GtkFontFilterFunc arg1, gpointer arg2, GDestroyNotify arg3) { +// ((void (*)(GtkFontChooser*, GtkFontFilterFunc, gpointer, GDestroyNotify))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_FontChooser_virtual_set_font_map(void* fnptr, GtkFontChooser* arg0, PangoFontMap* arg1) { +// ((void (*)(GtkFontChooser*, PangoFontMap*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Frame_virtual_compute_child_allocation(void* fnptr, GtkFrame* arg0, GtkAllocation* arg1) { +// ((void (*)(GtkFrame*, GtkAllocation*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_GLArea_virtual_resize(void* fnptr, GtkGLArea* arg0, int arg1, int arg2) { +// ((void (*)(GtkGLArea*, int, int))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_IMContext_virtual_activate_osk(void* fnptr, GtkIMContext* arg0) { +// ((void (*)(GtkIMContext*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_IMContext_virtual_commit(void* fnptr, GtkIMContext* arg0, char* arg1) { +// ((void (*)(GtkIMContext*, char*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_IMContext_virtual_focus_in(void* fnptr, GtkIMContext* arg0) { +// ((void (*)(GtkIMContext*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_IMContext_virtual_focus_out(void* fnptr, GtkIMContext* arg0) { +// ((void (*)(GtkIMContext*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_IMContext_virtual_get_preedit_string(void* fnptr, GtkIMContext* arg0, char** arg1, PangoAttrList** arg2, int* arg3) { +// ((void (*)(GtkIMContext*, char**, PangoAttrList**, int*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_IMContext_virtual_preedit_changed(void* fnptr, GtkIMContext* arg0) { +// ((void (*)(GtkIMContext*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_IMContext_virtual_preedit_end(void* fnptr, GtkIMContext* arg0) { +// ((void (*)(GtkIMContext*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_IMContext_virtual_preedit_start(void* fnptr, GtkIMContext* arg0) { +// ((void (*)(GtkIMContext*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_IMContext_virtual_reset(void* fnptr, GtkIMContext* arg0) { +// ((void (*)(GtkIMContext*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_IMContext_virtual_set_client_widget(void* fnptr, GtkIMContext* arg0, GtkWidget* arg1) { +// ((void (*)(GtkIMContext*, GtkWidget*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_IMContext_virtual_set_cursor_location(void* fnptr, GtkIMContext* arg0, GdkRectangle* arg1) { +// ((void (*)(GtkIMContext*, GdkRectangle*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_IMContext_virtual_set_surrounding(void* fnptr, GtkIMContext* arg0, char* arg1, int arg2, int arg3) { +// ((void (*)(GtkIMContext*, char*, int, int))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_IMContext_virtual_set_surrounding_with_selection(void* fnptr, GtkIMContext* arg0, char* arg1, int arg2, int arg3, int arg4) { +// ((void (*)(GtkIMContext*, char*, int, int, int))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_IMContext_virtual_set_use_preedit(void* fnptr, GtkIMContext* arg0, gboolean arg1) { +// ((void (*)(GtkIMContext*, gboolean))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_LayoutManager_virtual_allocate(void* fnptr, GtkLayoutManager* arg0, GtkWidget* arg1, int arg2, int arg3, int arg4) { +// ((void (*)(GtkLayoutManager*, GtkWidget*, int, int, int))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_LayoutManager_virtual_measure(void* fnptr, GtkLayoutManager* arg0, GtkWidget* arg1, GtkOrientation arg2, int arg3, int* arg4, int* arg5, int* arg6, int* arg7) { +// ((void (*)(GtkLayoutManager*, GtkWidget*, GtkOrientation, int, int*, int*, int*, int*))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); +// }; +// void _gotk4_gtk4_LayoutManager_virtual_root(void* fnptr, GtkLayoutManager* arg0) { +// ((void (*)(GtkLayoutManager*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_LayoutManager_virtual_unroot(void* fnptr, GtkLayoutManager* arg0) { +// ((void (*)(GtkLayoutManager*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_ListBoxRow_virtual_activate(void* fnptr, GtkListBoxRow* arg0) { +// ((void (*)(GtkListBoxRow*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_MediaFile_virtual_close(void* fnptr, GtkMediaFile* arg0) { +// ((void (*)(GtkMediaFile*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_MediaFile_virtual_open(void* fnptr, GtkMediaFile* arg0) { +// ((void (*)(GtkMediaFile*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_MediaStream_virtual_pause(void* fnptr, GtkMediaStream* arg0) { +// ((void (*)(GtkMediaStream*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_MediaStream_virtual_realize(void* fnptr, GtkMediaStream* arg0, GdkSurface* arg1) { +// ((void (*)(GtkMediaStream*, GdkSurface*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_MediaStream_virtual_seek(void* fnptr, GtkMediaStream* arg0, gint64 arg1) { +// ((void (*)(GtkMediaStream*, gint64))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_MediaStream_virtual_unrealize(void* fnptr, GtkMediaStream* arg0, GdkSurface* arg1) { +// ((void (*)(GtkMediaStream*, GdkSurface*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_MediaStream_virtual_update_audio(void* fnptr, GtkMediaStream* arg0, gboolean arg1, double arg2) { +// ((void (*)(GtkMediaStream*, gboolean, double))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_NativeDialog_virtual_hide(void* fnptr, GtkNativeDialog* arg0) { +// ((void (*)(GtkNativeDialog*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_NativeDialog_virtual_response(void* fnptr, GtkNativeDialog* arg0, int arg1) { +// ((void (*)(GtkNativeDialog*, int))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_NativeDialog_virtual_show(void* fnptr, GtkNativeDialog* arg0) { +// ((void (*)(GtkNativeDialog*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Popover_virtual_activate_default(void* fnptr, GtkPopover* arg0) { +// ((void (*)(GtkPopover*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Popover_virtual_closed(void* fnptr, GtkPopover* arg0) { +// ((void (*)(GtkPopover*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_PrintOperationPreview_virtual_end_preview(void* fnptr, GtkPrintOperationPreview* arg0) { +// ((void (*)(GtkPrintOperationPreview*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_PrintOperationPreview_virtual_got_page_size(void* fnptr, GtkPrintOperationPreview* arg0, GtkPrintContext* arg1, GtkPageSetup* arg2) { +// ((void (*)(GtkPrintOperationPreview*, GtkPrintContext*, GtkPageSetup*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_PrintOperationPreview_virtual_ready(void* fnptr, GtkPrintOperationPreview* arg0, GtkPrintContext* arg1) { +// ((void (*)(GtkPrintOperationPreview*, GtkPrintContext*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_PrintOperationPreview_virtual_render_page(void* fnptr, GtkPrintOperationPreview* arg0, int arg1) { +// ((void (*)(GtkPrintOperationPreview*, int))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_PrintOperation_virtual_begin_print(void* fnptr, GtkPrintOperation* arg0, GtkPrintContext* arg1) { +// ((void (*)(GtkPrintOperation*, GtkPrintContext*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_PrintOperation_virtual_custom_widget_apply(void* fnptr, GtkPrintOperation* arg0, GtkWidget* arg1) { +// ((void (*)(GtkPrintOperation*, GtkWidget*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_PrintOperation_virtual_done(void* fnptr, GtkPrintOperation* arg0, GtkPrintOperationResult arg1) { +// ((void (*)(GtkPrintOperation*, GtkPrintOperationResult))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_PrintOperation_virtual_draw_page(void* fnptr, GtkPrintOperation* arg0, GtkPrintContext* arg1, int arg2) { +// ((void (*)(GtkPrintOperation*, GtkPrintContext*, int))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_PrintOperation_virtual_end_print(void* fnptr, GtkPrintOperation* arg0, GtkPrintContext* arg1) { +// ((void (*)(GtkPrintOperation*, GtkPrintContext*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_PrintOperation_virtual_request_page_setup(void* fnptr, GtkPrintOperation* arg0, GtkPrintContext* arg1, int arg2, GtkPageSetup* arg3) { +// ((void (*)(GtkPrintOperation*, GtkPrintContext*, int, GtkPageSetup*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_PrintOperation_virtual_status_changed(void* fnptr, GtkPrintOperation* arg0) { +// ((void (*)(GtkPrintOperation*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_PrintOperation_virtual_update_custom_widget(void* fnptr, GtkPrintOperation* arg0, GtkWidget* arg1, GtkPageSetup* arg2, GtkPrintSettings* arg3) { +// ((void (*)(GtkPrintOperation*, GtkWidget*, GtkPageSetup*, GtkPrintSettings*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_Range_virtual_adjust_bounds(void* fnptr, GtkRange* arg0, double arg1) { +// ((void (*)(GtkRange*, double))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Range_virtual_get_range_border(void* fnptr, GtkRange* arg0, GtkBorder* arg1) { +// ((void (*)(GtkRange*, GtkBorder*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Range_virtual_move_slider(void* fnptr, GtkRange* arg0, GtkScrollType arg1) { +// ((void (*)(GtkRange*, GtkScrollType))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Range_virtual_value_changed(void* fnptr, GtkRange* arg0) { +// ((void (*)(GtkRange*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_RecentManager_virtual_changed(void* fnptr, GtkRecentManager* arg0) { +// ((void (*)(GtkRecentManager*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_ScaleButton_virtual_value_changed(void* fnptr, GtkScaleButton* arg0, double arg1) { +// ((void (*)(GtkScaleButton*, double))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Scale_virtual_get_layout_offsets(void* fnptr, GtkScale* arg0, int* arg1, int* arg2) { +// ((void (*)(GtkScale*, int*, int*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_SectionModel_virtual_get_section(void* fnptr, GtkSectionModel* arg0, guint arg1, guint* arg2, guint* arg3) { +// ((void (*)(GtkSectionModel*, guint, guint*, guint*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_ShortcutManager_virtual_add_controller(void* fnptr, GtkShortcutManager* arg0, GtkShortcutController* arg1) { +// ((void (*)(GtkShortcutManager*, GtkShortcutController*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_ShortcutManager_virtual_remove_controller(void* fnptr, GtkShortcutManager* arg0, GtkShortcutController* arg1) { +// ((void (*)(GtkShortcutManager*, GtkShortcutController*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_StyleContext_virtual_changed(void* fnptr, GtkStyleContext* arg0) { +// ((void (*)(GtkStyleContext*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_SymbolicPaintable_virtual_snapshot_symbolic(void* fnptr, GtkSymbolicPaintable* arg0, GdkSnapshot* arg1, double arg2, double arg3, GdkRGBA* arg4, gsize arg5) { +// ((void (*)(GtkSymbolicPaintable*, GdkSnapshot*, double, double, GdkRGBA*, gsize))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_apply_tag(void* fnptr, GtkTextBuffer* arg0, GtkTextTag* arg1, GtkTextIter* arg2, GtkTextIter* arg3) { +// ((void (*)(GtkTextBuffer*, GtkTextTag*, GtkTextIter*, GtkTextIter*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_begin_user_action(void* fnptr, GtkTextBuffer* arg0) { +// ((void (*)(GtkTextBuffer*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_changed(void* fnptr, GtkTextBuffer* arg0) { +// ((void (*)(GtkTextBuffer*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_delete_range(void* fnptr, GtkTextBuffer* arg0, GtkTextIter* arg1, GtkTextIter* arg2) { +// ((void (*)(GtkTextBuffer*, GtkTextIter*, GtkTextIter*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_end_user_action(void* fnptr, GtkTextBuffer* arg0) { +// ((void (*)(GtkTextBuffer*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_insert_child_anchor(void* fnptr, GtkTextBuffer* arg0, GtkTextIter* arg1, GtkTextChildAnchor* arg2) { +// ((void (*)(GtkTextBuffer*, GtkTextIter*, GtkTextChildAnchor*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_insert_paintable(void* fnptr, GtkTextBuffer* arg0, GtkTextIter* arg1, GdkPaintable* arg2) { +// ((void (*)(GtkTextBuffer*, GtkTextIter*, GdkPaintable*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_insert_text(void* fnptr, GtkTextBuffer* arg0, GtkTextIter* arg1, char* arg2, int arg3) { +// ((void (*)(GtkTextBuffer*, GtkTextIter*, char*, int))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_mark_deleted(void* fnptr, GtkTextBuffer* arg0, GtkTextMark* arg1) { +// ((void (*)(GtkTextBuffer*, GtkTextMark*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_mark_set(void* fnptr, GtkTextBuffer* arg0, GtkTextIter* arg1, GtkTextMark* arg2) { +// ((void (*)(GtkTextBuffer*, GtkTextIter*, GtkTextMark*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_modified_changed(void* fnptr, GtkTextBuffer* arg0) { +// ((void (*)(GtkTextBuffer*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_paste_done(void* fnptr, GtkTextBuffer* arg0, GdkClipboard* arg1) { +// ((void (*)(GtkTextBuffer*, GdkClipboard*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_redo(void* fnptr, GtkTextBuffer* arg0) { +// ((void (*)(GtkTextBuffer*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_remove_tag(void* fnptr, GtkTextBuffer* arg0, GtkTextTag* arg1, GtkTextIter* arg2, GtkTextIter* arg3) { +// ((void (*)(GtkTextBuffer*, GtkTextTag*, GtkTextIter*, GtkTextIter*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_TextBuffer_virtual_undo(void* fnptr, GtkTextBuffer* arg0) { +// ((void (*)(GtkTextBuffer*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextView_virtual_backspace(void* fnptr, GtkTextView* arg0) { +// ((void (*)(GtkTextView*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextView_virtual_copy_clipboard(void* fnptr, GtkTextView* arg0) { +// ((void (*)(GtkTextView*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextView_virtual_cut_clipboard(void* fnptr, GtkTextView* arg0) { +// ((void (*)(GtkTextView*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextView_virtual_delete_from_cursor(void* fnptr, GtkTextView* arg0, GtkDeleteType arg1, int arg2) { +// ((void (*)(GtkTextView*, GtkDeleteType, int))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TextView_virtual_insert_at_cursor(void* fnptr, GtkTextView* arg0, char* arg1) { +// ((void (*)(GtkTextView*, char*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_TextView_virtual_insert_emoji(void* fnptr, GtkTextView* arg0) { +// ((void (*)(GtkTextView*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextView_virtual_move_cursor(void* fnptr, GtkTextView* arg0, GtkMovementStep arg1, int arg2, gboolean arg3) { +// ((void (*)(GtkTextView*, GtkMovementStep, int, gboolean))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_TextView_virtual_paste_clipboard(void* fnptr, GtkTextView* arg0) { +// ((void (*)(GtkTextView*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextView_virtual_set_anchor(void* fnptr, GtkTextView* arg0) { +// ((void (*)(GtkTextView*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TextView_virtual_snapshot_layer(void* fnptr, GtkTextView* arg0, GtkTextViewLayer arg1, GtkSnapshot* arg2) { +// ((void (*)(GtkTextView*, GtkTextViewLayer, GtkSnapshot*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TextView_virtual_toggle_overwrite(void* fnptr, GtkTextView* arg0) { +// ((void (*)(GtkTextView*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_ToggleButton_virtual_toggled(void* fnptr, GtkToggleButton* arg0) { +// ((void (*)(GtkToggleButton*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TreeModelFilter_virtual_modify(void* fnptr, GtkTreeModelFilter* arg0, GtkTreeModel* arg1, GtkTreeIter* arg2, GValue* arg3, int arg4) { +// ((void (*)(GtkTreeModelFilter*, GtkTreeModel*, GtkTreeIter*, GValue*, int))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_TreeModel_virtual_get_value(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1, int arg2, GValue* arg3) { +// ((void (*)(GtkTreeModel*, GtkTreeIter*, int, GValue*))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_TreeModel_virtual_ref_node(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1) { +// ((void (*)(GtkTreeModel*, GtkTreeIter*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_TreeModel_virtual_row_changed(void* fnptr, GtkTreeModel* arg0, GtkTreePath* arg1, GtkTreeIter* arg2) { +// ((void (*)(GtkTreeModel*, GtkTreePath*, GtkTreeIter*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TreeModel_virtual_row_deleted(void* fnptr, GtkTreeModel* arg0, GtkTreePath* arg1) { +// ((void (*)(GtkTreeModel*, GtkTreePath*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_TreeModel_virtual_row_has_child_toggled(void* fnptr, GtkTreeModel* arg0, GtkTreePath* arg1, GtkTreeIter* arg2) { +// ((void (*)(GtkTreeModel*, GtkTreePath*, GtkTreeIter*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TreeModel_virtual_row_inserted(void* fnptr, GtkTreeModel* arg0, GtkTreePath* arg1, GtkTreeIter* arg2) { +// ((void (*)(GtkTreeModel*, GtkTreePath*, GtkTreeIter*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TreeModel_virtual_unref_node(void* fnptr, GtkTreeModel* arg0, GtkTreeIter* arg1) { +// ((void (*)(GtkTreeModel*, GtkTreeIter*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_TreeSortable_virtual_set_default_sort_func(void* fnptr, GtkTreeSortable* arg0, GtkTreeIterCompareFunc arg1, gpointer arg2, GDestroyNotify arg3) { +// ((void (*)(GtkTreeSortable*, GtkTreeIterCompareFunc, gpointer, GDestroyNotify))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_TreeSortable_virtual_set_sort_column_id(void* fnptr, GtkTreeSortable* arg0, int arg1, GtkSortType arg2) { +// ((void (*)(GtkTreeSortable*, int, GtkSortType))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TreeSortable_virtual_set_sort_func(void* fnptr, GtkTreeSortable* arg0, int arg1, GtkTreeIterCompareFunc arg2, gpointer arg3, GDestroyNotify arg4) { +// ((void (*)(GtkTreeSortable*, int, GtkTreeIterCompareFunc, gpointer, GDestroyNotify))(fnptr))(arg0, arg1, arg2, arg3, arg4); +// }; +// void _gotk4_gtk4_TreeSortable_virtual_sort_column_changed(void* fnptr, GtkTreeSortable* arg0) { +// ((void (*)(GtkTreeSortable*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TreeView_virtual_columns_changed(void* fnptr, GtkTreeView* arg0) { +// ((void (*)(GtkTreeView*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TreeView_virtual_cursor_changed(void* fnptr, GtkTreeView* arg0) { +// ((void (*)(GtkTreeView*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_TreeView_virtual_row_activated(void* fnptr, GtkTreeView* arg0, GtkTreePath* arg1, GtkTreeViewColumn* arg2) { +// ((void (*)(GtkTreeView*, GtkTreePath*, GtkTreeViewColumn*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TreeView_virtual_row_collapsed(void* fnptr, GtkTreeView* arg0, GtkTreeIter* arg1, GtkTreePath* arg2) { +// ((void (*)(GtkTreeView*, GtkTreeIter*, GtkTreePath*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_TreeView_virtual_row_expanded(void* fnptr, GtkTreeView* arg0, GtkTreeIter* arg1, GtkTreePath* arg2) { +// ((void (*)(GtkTreeView*, GtkTreeIter*, GtkTreePath*))(fnptr))(arg0, arg1, arg2); +// }; +// void _gotk4_gtk4_Widget_virtual_direction_changed(void* fnptr, GtkWidget* arg0, GtkTextDirection arg1) { +// ((void (*)(GtkWidget*, GtkTextDirection))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Widget_virtual_hide(void* fnptr, GtkWidget* arg0) { +// ((void (*)(GtkWidget*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Widget_virtual_map(void* fnptr, GtkWidget* arg0) { +// ((void (*)(GtkWidget*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Widget_virtual_measure(void* fnptr, GtkWidget* arg0, GtkOrientation arg1, int arg2, int* arg3, int* arg4, int* arg5, int* arg6) { +// ((void (*)(GtkWidget*, GtkOrientation, int, int*, int*, int*, int*))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// }; +// void _gotk4_gtk4_Widget_virtual_move_focus(void* fnptr, GtkWidget* arg0, GtkDirectionType arg1) { +// ((void (*)(GtkWidget*, GtkDirectionType))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Widget_virtual_realize(void* fnptr, GtkWidget* arg0) { +// ((void (*)(GtkWidget*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Widget_virtual_root(void* fnptr, GtkWidget* arg0) { +// ((void (*)(GtkWidget*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Widget_virtual_set_focus_child(void* fnptr, GtkWidget* arg0, GtkWidget* arg1) { +// ((void (*)(GtkWidget*, GtkWidget*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Widget_virtual_show(void* fnptr, GtkWidget* arg0) { +// ((void (*)(GtkWidget*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Widget_virtual_size_allocate(void* fnptr, GtkWidget* arg0, int arg1, int arg2, int arg3) { +// ((void (*)(GtkWidget*, int, int, int))(fnptr))(arg0, arg1, arg2, arg3); +// }; +// void _gotk4_gtk4_Widget_virtual_snapshot(void* fnptr, GtkWidget* arg0, GtkSnapshot* arg1) { +// ((void (*)(GtkWidget*, GtkSnapshot*))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Widget_virtual_state_flags_changed(void* fnptr, GtkWidget* arg0, GtkStateFlags arg1) { +// ((void (*)(GtkWidget*, GtkStateFlags))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Widget_virtual_system_setting_changed(void* fnptr, GtkWidget* arg0, GtkSystemSetting arg1) { +// ((void (*)(GtkWidget*, GtkSystemSetting))(fnptr))(arg0, arg1); +// }; +// void _gotk4_gtk4_Widget_virtual_unmap(void* fnptr, GtkWidget* arg0) { +// ((void (*)(GtkWidget*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Widget_virtual_unrealize(void* fnptr, GtkWidget* arg0) { +// ((void (*)(GtkWidget*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Widget_virtual_unroot(void* fnptr, GtkWidget* arg0) { +// ((void (*)(GtkWidget*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Window_virtual_activate_default(void* fnptr, GtkWindow* arg0) { +// ((void (*)(GtkWindow*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Window_virtual_activate_focus(void* fnptr, GtkWindow* arg0) { +// ((void (*)(GtkWindow*))(fnptr))(arg0); +// }; +// void _gotk4_gtk4_Window_virtual_keys_changed(void* fnptr, GtkWindow* arg0) { +// ((void (*)(GtkWindow*))(fnptr))(arg0); +// }; +import "C" + +// GType values. +var ( + GTypeAccessibleAnnouncementPriority = coreglib.Type(C.gtk_accessible_announcement_priority_get_type()) + GTypeAccessibleAutocomplete = coreglib.Type(C.gtk_accessible_autocomplete_get_type()) + GTypeAccessibleInvalidState = coreglib.Type(C.gtk_accessible_invalid_state_get_type()) + GTypeAccessiblePlatformState = coreglib.Type(C.gtk_accessible_platform_state_get_type()) + GTypeAccessibleProperty = coreglib.Type(C.gtk_accessible_property_get_type()) + GTypeAccessibleRelation = coreglib.Type(C.gtk_accessible_relation_get_type()) + GTypeAccessibleRole = coreglib.Type(C.gtk_accessible_role_get_type()) + GTypeAccessibleSort = coreglib.Type(C.gtk_accessible_sort_get_type()) + GTypeAccessibleState = coreglib.Type(C.gtk_accessible_state_get_type()) + GTypeAccessibleTextContentChange = coreglib.Type(C.gtk_accessible_text_content_change_get_type()) + GTypeAccessibleTextGranularity = coreglib.Type(C.gtk_accessible_text_granularity_get_type()) + GTypeAccessibleTristate = coreglib.Type(C.gtk_accessible_tristate_get_type()) + GTypeAlign = coreglib.Type(C.gtk_align_get_type()) + GTypeArrowType = coreglib.Type(C.gtk_arrow_type_get_type()) + GTypeAssistantPageType = coreglib.Type(C.gtk_assistant_page_type_get_type()) + GTypeBaselinePosition = coreglib.Type(C.gtk_baseline_position_get_type()) + GTypeBorderStyle = coreglib.Type(C.gtk_border_style_get_type()) + GTypeBuilderError = coreglib.Type(C.gtk_builder_error_get_type()) + GTypeButtonsType = coreglib.Type(C.gtk_buttons_type_get_type()) + GTypeCellRendererAccelMode = coreglib.Type(C.gtk_cell_renderer_accel_mode_get_type()) + GTypeCellRendererMode = coreglib.Type(C.gtk_cell_renderer_mode_get_type()) + GTypeCollation = coreglib.Type(C.gtk_collation_get_type()) + GTypeConstraintAttribute = coreglib.Type(C.gtk_constraint_attribute_get_type()) + GTypeConstraintRelation = coreglib.Type(C.gtk_constraint_relation_get_type()) + GTypeConstraintStrength = coreglib.Type(C.gtk_constraint_strength_get_type()) + GTypeConstraintVflParserError = coreglib.Type(C.gtk_constraint_vfl_parser_error_get_type()) + GTypeContentFit = coreglib.Type(C.gtk_content_fit_get_type()) + GTypeCornerType = coreglib.Type(C.gtk_corner_type_get_type()) + GTypeDeleteType = coreglib.Type(C.gtk_delete_type_get_type()) + GTypeDialogError = coreglib.Type(C.gtk_dialog_error_get_type()) + GTypeDirectionType = coreglib.Type(C.gtk_direction_type_get_type()) + GTypeEditableProperties = coreglib.Type(C.gtk_editable_properties_get_type()) + GTypeEntryIconPosition = coreglib.Type(C.gtk_entry_icon_position_get_type()) + GTypeEventSequenceState = coreglib.Type(C.gtk_event_sequence_state_get_type()) + GTypeFileChooserAction = coreglib.Type(C.gtk_file_chooser_action_get_type()) + GTypeFileChooserError = coreglib.Type(C.gtk_file_chooser_error_get_type()) + GTypeFilterChange = coreglib.Type(C.gtk_filter_change_get_type()) + GTypeFilterMatch = coreglib.Type(C.gtk_filter_match_get_type()) + GTypeFontLevel = coreglib.Type(C.gtk_font_level_get_type()) + GTypeGraphicsOffloadEnabled = coreglib.Type(C.gtk_graphics_offload_enabled_get_type()) + GTypeIconSize = coreglib.Type(C.gtk_icon_size_get_type()) + GTypeIconThemeError = coreglib.Type(C.gtk_icon_theme_error_get_type()) + GTypeIconViewDropPosition = coreglib.Type(C.gtk_icon_view_drop_position_get_type()) + GTypeImageType = coreglib.Type(C.gtk_image_type_get_type()) + GTypeInputPurpose = coreglib.Type(C.gtk_input_purpose_get_type()) + GTypeInscriptionOverflow = coreglib.Type(C.gtk_inscription_overflow_get_type()) + GTypeJustification = coreglib.Type(C.gtk_justification_get_type()) + GTypeLevelBarMode = coreglib.Type(C.gtk_level_bar_mode_get_type()) + GTypeLicense = coreglib.Type(C.gtk_license_get_type()) + GTypeListTabBehavior = coreglib.Type(C.gtk_list_tab_behavior_get_type()) + GTypeMessageType = coreglib.Type(C.gtk_message_type_get_type()) + GTypeMovementStep = coreglib.Type(C.gtk_movement_step_get_type()) + GTypeNaturalWrapMode = coreglib.Type(C.gtk_natural_wrap_mode_get_type()) + GTypeNotebookTab = coreglib.Type(C.gtk_notebook_tab_get_type()) + GTypeNumberUpLayout = coreglib.Type(C.gtk_number_up_layout_get_type()) + GTypeOrdering = coreglib.Type(C.gtk_ordering_get_type()) + GTypeOrientation = coreglib.Type(C.gtk_orientation_get_type()) + GTypeOverflow = coreglib.Type(C.gtk_overflow_get_type()) + GTypePackType = coreglib.Type(C.gtk_pack_type_get_type()) + GTypePadActionType = coreglib.Type(C.gtk_pad_action_type_get_type()) + GTypePageOrientation = coreglib.Type(C.gtk_page_orientation_get_type()) + GTypePageSet = coreglib.Type(C.gtk_page_set_get_type()) + GTypePanDirection = coreglib.Type(C.gtk_pan_direction_get_type()) + GTypePolicyType = coreglib.Type(C.gtk_policy_type_get_type()) + GTypePositionType = coreglib.Type(C.gtk_position_type_get_type()) + GTypePrintDuplex = coreglib.Type(C.gtk_print_duplex_get_type()) + GTypePrintError = coreglib.Type(C.gtk_print_error_get_type()) + GTypePrintOperationAction = coreglib.Type(C.gtk_print_operation_action_get_type()) + GTypePrintOperationResult = coreglib.Type(C.gtk_print_operation_result_get_type()) + GTypePrintPages = coreglib.Type(C.gtk_print_pages_get_type()) + GTypePrintQuality = coreglib.Type(C.gtk_print_quality_get_type()) + GTypePrintStatus = coreglib.Type(C.gtk_print_status_get_type()) + GTypePropagationLimit = coreglib.Type(C.gtk_propagation_limit_get_type()) + GTypePropagationPhase = coreglib.Type(C.gtk_propagation_phase_get_type()) + GTypeRecentManagerError = coreglib.Type(C.gtk_recent_manager_error_get_type()) + GTypeResponseType = coreglib.Type(C.gtk_response_type_get_type()) + GTypeRevealerTransitionType = coreglib.Type(C.gtk_revealer_transition_type_get_type()) + GTypeScrollStep = coreglib.Type(C.gtk_scroll_step_get_type()) + GTypeScrollType = coreglib.Type(C.gtk_scroll_type_get_type()) + GTypeScrollablePolicy = coreglib.Type(C.gtk_scrollable_policy_get_type()) + GTypeSelectionMode = coreglib.Type(C.gtk_selection_mode_get_type()) + GTypeSensitivityType = coreglib.Type(C.gtk_sensitivity_type_get_type()) + GTypeShortcutScope = coreglib.Type(C.gtk_shortcut_scope_get_type()) + GTypeShortcutType = coreglib.Type(C.gtk_shortcut_type_get_type()) + GTypeSizeGroupMode = coreglib.Type(C.gtk_size_group_mode_get_type()) + GTypeSizeRequestMode = coreglib.Type(C.gtk_size_request_mode_get_type()) + GTypeSortType = coreglib.Type(C.gtk_sort_type_get_type()) + GTypeSorterChange = coreglib.Type(C.gtk_sorter_change_get_type()) + GTypeSorterOrder = coreglib.Type(C.gtk_sorter_order_get_type()) + GTypeSpinButtonUpdatePolicy = coreglib.Type(C.gtk_spin_button_update_policy_get_type()) + GTypeSpinType = coreglib.Type(C.gtk_spin_type_get_type()) + GTypeStackTransitionType = coreglib.Type(C.gtk_stack_transition_type_get_type()) + GTypeStringFilterMatchMode = coreglib.Type(C.gtk_string_filter_match_mode_get_type()) + GTypeSymbolicColor = coreglib.Type(C.gtk_symbolic_color_get_type()) + GTypeSystemSetting = coreglib.Type(C.gtk_system_setting_get_type()) + GTypeTextDirection = coreglib.Type(C.gtk_text_direction_get_type()) + GTypeTextExtendSelection = coreglib.Type(C.gtk_text_extend_selection_get_type()) + GTypeTextViewLayer = coreglib.Type(C.gtk_text_view_layer_get_type()) + GTypeTextWindowType = coreglib.Type(C.gtk_text_window_type_get_type()) + GTypeTreeViewColumnSizing = coreglib.Type(C.gtk_tree_view_column_sizing_get_type()) + GTypeTreeViewDropPosition = coreglib.Type(C.gtk_tree_view_drop_position_get_type()) + GTypeTreeViewGridLines = coreglib.Type(C.gtk_tree_view_grid_lines_get_type()) + GTypeUnit = coreglib.Type(C.gtk_unit_get_type()) + GTypeWrapMode = coreglib.Type(C.gtk_wrap_mode_get_type()) + GTypeApplicationInhibitFlags = coreglib.Type(C.gtk_application_inhibit_flags_get_type()) + GTypeBuilderClosureFlags = coreglib.Type(C.gtk_builder_closure_flags_get_type()) + GTypeCellRendererState = coreglib.Type(C.gtk_cell_renderer_state_get_type()) + GTypeDebugFlags = coreglib.Type(C.gtk_debug_flags_get_type()) + GTypeDialogFlags = coreglib.Type(C.gtk_dialog_flags_get_type()) + GTypeEventControllerScrollFlags = coreglib.Type(C.gtk_event_controller_scroll_flags_get_type()) + GTypeFontChooserLevel = coreglib.Type(C.gtk_font_chooser_level_get_type()) + GTypeIconLookupFlags = coreglib.Type(C.gtk_icon_lookup_flags_get_type()) + GTypeInputHints = coreglib.Type(C.gtk_input_hints_get_type()) + GTypeListScrollFlags = coreglib.Type(C.gtk_list_scroll_flags_get_type()) + GTypePickFlags = coreglib.Type(C.gtk_pick_flags_get_type()) + GTypePopoverMenuFlags = coreglib.Type(C.gtk_popover_menu_flags_get_type()) + GTypeShortcutActionFlags = coreglib.Type(C.gtk_shortcut_action_flags_get_type()) + GTypeStateFlags = coreglib.Type(C.gtk_state_flags_get_type()) + GTypeStyleContextPrintFlags = coreglib.Type(C.gtk_style_context_print_flags_get_type()) + GTypeTextSearchFlags = coreglib.Type(C.gtk_text_search_flags_get_type()) + GTypeTreeModelFlags = coreglib.Type(C.gtk_tree_model_flags_get_type()) + GTypeAccessible = coreglib.Type(C.gtk_accessible_get_type()) + GTypeAccessibleRange = coreglib.Type(C.gtk_accessible_range_get_type()) + GTypeAccessibleText = coreglib.Type(C.gtk_accessible_text_get_type()) + GTypeActionable = coreglib.Type(C.gtk_actionable_get_type()) + GTypeAppChooser = coreglib.Type(C.gtk_app_chooser_get_type()) + GTypeBuildable = coreglib.Type(C.gtk_buildable_get_type()) + GTypeBuilderScope = coreglib.Type(C.gtk_builder_scope_get_type()) + GTypeCellEditable = coreglib.Type(C.gtk_cell_editable_get_type()) + GTypeCellLayout = coreglib.Type(C.gtk_cell_layout_get_type()) + GTypeColorChooser = coreglib.Type(C.gtk_color_chooser_get_type()) + GTypeConstraintTarget = coreglib.Type(C.gtk_constraint_target_get_type()) + GTypeEditableTextWidget = coreglib.Type(C.gtk_editable_get_type()) + GTypeFileChooser = coreglib.Type(C.gtk_file_chooser_get_type()) + GTypeFontChooser = coreglib.Type(C.gtk_font_chooser_get_type()) + GTypeNativeSurface = coreglib.Type(C.gtk_native_get_type()) + GTypeOrientable = coreglib.Type(C.gtk_orientable_get_type()) + GTypePrintOperationPreview = coreglib.Type(C.gtk_print_operation_preview_get_type()) + GTypeRoot = coreglib.Type(C.gtk_root_get_type()) + GTypeScrollable = coreglib.Type(C.gtk_scrollable_get_type()) + GTypeSectionModel = coreglib.Type(C.gtk_section_model_get_type()) + GTypeSelectionModel = coreglib.Type(C.gtk_selection_model_get_type()) + GTypeShortcutManager = coreglib.Type(C.gtk_shortcut_manager_get_type()) + GTypeStyleProvider = coreglib.Type(C.gtk_style_provider_get_type()) + GTypeSymbolicPaintable = coreglib.Type(C.gtk_symbolic_paintable_get_type()) + GTypeTreeDragDest = coreglib.Type(C.gtk_tree_drag_dest_get_type()) + GTypeTreeDragSource = coreglib.Type(C.gtk_tree_drag_source_get_type()) + GTypeTreeModel = coreglib.Type(C.gtk_tree_model_get_type()) + GTypeTreeSortable = coreglib.Type(C.gtk_tree_sortable_get_type()) + GTypeATContext = coreglib.Type(C.gtk_at_context_get_type()) + GTypeAboutDialog = coreglib.Type(C.gtk_about_dialog_get_type()) + GTypeActionBar = coreglib.Type(C.gtk_action_bar_get_type()) + GTypeActivateAction = coreglib.Type(C.gtk_activate_action_get_type()) + GTypeAdjustment = coreglib.Type(C.gtk_adjustment_get_type()) + GTypeAlertDialog = coreglib.Type(C.gtk_alert_dialog_get_type()) + GTypeAlternativeTrigger = coreglib.Type(C.gtk_alternative_trigger_get_type()) + GTypeAnyFilter = coreglib.Type(C.gtk_any_filter_get_type()) + GTypeAppChooserButton = coreglib.Type(C.gtk_app_chooser_button_get_type()) + GTypeAppChooserDialog = coreglib.Type(C.gtk_app_chooser_dialog_get_type()) + GTypeAppChooserWidget = coreglib.Type(C.gtk_app_chooser_widget_get_type()) + GTypeApplication = coreglib.Type(C.gtk_application_get_type()) + GTypeApplicationWindow = coreglib.Type(C.gtk_application_window_get_type()) + GTypeAspectFrame = coreglib.Type(C.gtk_aspect_frame_get_type()) + GTypeAssistant = coreglib.Type(C.gtk_assistant_get_type()) + GTypeAssistantPage = coreglib.Type(C.gtk_assistant_page_get_type()) + GTypeBinLayout = coreglib.Type(C.gtk_bin_layout_get_type()) + GTypeBookmarkList = coreglib.Type(C.gtk_bookmark_list_get_type()) + GTypeBoolFilter = coreglib.Type(C.gtk_bool_filter_get_type()) + GTypeBox = coreglib.Type(C.gtk_box_get_type()) + GTypeBoxLayout = coreglib.Type(C.gtk_box_layout_get_type()) + GTypeBuilder = coreglib.Type(C.gtk_builder_get_type()) + GTypeBuilderCScope = coreglib.Type(C.gtk_builder_cscope_get_type()) + GTypeBuilderListItemFactory = coreglib.Type(C.gtk_builder_list_item_factory_get_type()) + GTypeButton = coreglib.Type(C.gtk_button_get_type()) + GTypeCClosureExpression = coreglib.Type(C.gtk_cclosure_expression_get_type()) + GTypeCalendar = coreglib.Type(C.gtk_calendar_get_type()) + GTypeCallbackAction = coreglib.Type(C.gtk_callback_action_get_type()) + GTypeCellArea = coreglib.Type(C.gtk_cell_area_get_type()) + GTypeCellAreaBox = coreglib.Type(C.gtk_cell_area_box_get_type()) + GTypeCellAreaContext = coreglib.Type(C.gtk_cell_area_context_get_type()) + GTypeCellRenderer = coreglib.Type(C.gtk_cell_renderer_get_type()) + GTypeCellRendererAccel = coreglib.Type(C.gtk_cell_renderer_accel_get_type()) + GTypeCellRendererCombo = coreglib.Type(C.gtk_cell_renderer_combo_get_type()) + GTypeCellRendererPixbuf = coreglib.Type(C.gtk_cell_renderer_pixbuf_get_type()) + GTypeCellRendererProgress = coreglib.Type(C.gtk_cell_renderer_progress_get_type()) + GTypeCellRendererSpin = coreglib.Type(C.gtk_cell_renderer_spin_get_type()) + GTypeCellRendererSpinner = coreglib.Type(C.gtk_cell_renderer_spinner_get_type()) + GTypeCellRendererText = coreglib.Type(C.gtk_cell_renderer_text_get_type()) + GTypeCellRendererToggle = coreglib.Type(C.gtk_cell_renderer_toggle_get_type()) + GTypeCellView = coreglib.Type(C.gtk_cell_view_get_type()) + GTypeCenterBox = coreglib.Type(C.gtk_center_box_get_type()) + GTypeCenterLayout = coreglib.Type(C.gtk_center_layout_get_type()) + GTypeCheckButton = coreglib.Type(C.gtk_check_button_get_type()) + GTypeClosureExpression = coreglib.Type(C.gtk_closure_expression_get_type()) + GTypeColorButton = coreglib.Type(C.gtk_color_button_get_type()) + GTypeColorChooserDialog = coreglib.Type(C.gtk_color_chooser_dialog_get_type()) + GTypeColorChooserWidget = coreglib.Type(C.gtk_color_chooser_widget_get_type()) + GTypeColorDialog = coreglib.Type(C.gtk_color_dialog_get_type()) + GTypeColorDialogButton = coreglib.Type(C.gtk_color_dialog_button_get_type()) + GTypeColumnView = coreglib.Type(C.gtk_column_view_get_type()) + GTypeColumnViewCell = coreglib.Type(C.gtk_column_view_cell_get_type()) + GTypeColumnViewColumn = coreglib.Type(C.gtk_column_view_column_get_type()) + GTypeColumnViewRow = coreglib.Type(C.gtk_column_view_row_get_type()) + GTypeColumnViewSorter = coreglib.Type(C.gtk_column_view_sorter_get_type()) + GTypeComboBox = coreglib.Type(C.gtk_combo_box_get_type()) + GTypeComboBoxText = coreglib.Type(C.gtk_combo_box_text_get_type()) + GTypeConstantExpression = coreglib.Type(C.gtk_constant_expression_get_type()) + GTypeConstraint = coreglib.Type(C.gtk_constraint_get_type()) + GTypeConstraintGuide = coreglib.Type(C.gtk_constraint_guide_get_type()) + GTypeConstraintLayout = coreglib.Type(C.gtk_constraint_layout_get_type()) + GTypeConstraintLayoutChild = coreglib.Type(C.gtk_constraint_layout_child_get_type()) + GTypeCSSProvider = coreglib.Type(C.gtk_css_provider_get_type()) + GTypeCustomFilter = coreglib.Type(C.gtk_custom_filter_get_type()) + GTypeCustomLayout = coreglib.Type(C.gtk_custom_layout_get_type()) + GTypeCustomSorter = coreglib.Type(C.gtk_custom_sorter_get_type()) + GTypeDialog = coreglib.Type(C.gtk_dialog_get_type()) + GTypeDirectoryList = coreglib.Type(C.gtk_directory_list_get_type()) + GTypeDragIcon = coreglib.Type(C.gtk_drag_icon_get_type()) + GTypeDragSource = coreglib.Type(C.gtk_drag_source_get_type()) + GTypeDrawingArea = coreglib.Type(C.gtk_drawing_area_get_type()) + GTypeDropControllerMotion = coreglib.Type(C.gtk_drop_controller_motion_get_type()) + GTypeDropDown = coreglib.Type(C.gtk_drop_down_get_type()) + GTypeDropTarget = coreglib.Type(C.gtk_drop_target_get_type()) + GTypeDropTargetAsync = coreglib.Type(C.gtk_drop_target_async_get_type()) + GTypeEditableLabel = coreglib.Type(C.gtk_editable_label_get_type()) + GTypeEmojiChooser = coreglib.Type(C.gtk_emoji_chooser_get_type()) + GTypeEntry = coreglib.Type(C.gtk_entry_get_type()) + GTypeEntryBuffer = coreglib.Type(C.gtk_entry_buffer_get_type()) + GTypeEntryCompletion = coreglib.Type(C.gtk_entry_completion_get_type()) + GTypeEventController = coreglib.Type(C.gtk_event_controller_get_type()) + GTypeEventControllerFocus = coreglib.Type(C.gtk_event_controller_focus_get_type()) + GTypeEventControllerKey = coreglib.Type(C.gtk_event_controller_key_get_type()) + GTypeEventControllerLegacy = coreglib.Type(C.gtk_event_controller_legacy_get_type()) + GTypeEventControllerMotion = coreglib.Type(C.gtk_event_controller_motion_get_type()) + GTypeEventControllerScroll = coreglib.Type(C.gtk_event_controller_scroll_get_type()) + GTypeEveryFilter = coreglib.Type(C.gtk_every_filter_get_type()) + GTypeExpander = coreglib.Type(C.gtk_expander_get_type()) + GTypeExpression = coreglib.Type(C.gtk_expression_get_type()) + GTypeFileChooserDialog = coreglib.Type(C.gtk_file_chooser_dialog_get_type()) + GTypeFileChooserNative = coreglib.Type(C.gtk_file_chooser_native_get_type()) + GTypeFileChooserWidget = coreglib.Type(C.gtk_file_chooser_widget_get_type()) + GTypeFileDialog = coreglib.Type(C.gtk_file_dialog_get_type()) + GTypeFileFilter = coreglib.Type(C.gtk_file_filter_get_type()) + GTypeFileLauncher = coreglib.Type(C.gtk_file_launcher_get_type()) + GTypeFilter = coreglib.Type(C.gtk_filter_get_type()) + GTypeFilterListModel = coreglib.Type(C.gtk_filter_list_model_get_type()) + GTypeFixed = coreglib.Type(C.gtk_fixed_get_type()) + GTypeFixedLayout = coreglib.Type(C.gtk_fixed_layout_get_type()) + GTypeFixedLayoutChild = coreglib.Type(C.gtk_fixed_layout_child_get_type()) + GTypeFlattenListModel = coreglib.Type(C.gtk_flatten_list_model_get_type()) + GTypeFlowBox = coreglib.Type(C.gtk_flow_box_get_type()) + GTypeFlowBoxChild = coreglib.Type(C.gtk_flow_box_child_get_type()) + GTypeFontButton = coreglib.Type(C.gtk_font_button_get_type()) + GTypeFontChooserDialog = coreglib.Type(C.gtk_font_chooser_dialog_get_type()) + GTypeFontChooserWidget = coreglib.Type(C.gtk_font_chooser_widget_get_type()) + GTypeFontDialog = coreglib.Type(C.gtk_font_dialog_get_type()) + GTypeFontDialogButton = coreglib.Type(C.gtk_font_dialog_button_get_type()) + GTypeFrame = coreglib.Type(C.gtk_frame_get_type()) + GTypeGLArea = coreglib.Type(C.gtk_gl_area_get_type()) + GTypeGesture = coreglib.Type(C.gtk_gesture_get_type()) + GTypeGestureClick = coreglib.Type(C.gtk_gesture_click_get_type()) + GTypeGestureDrag = coreglib.Type(C.gtk_gesture_drag_get_type()) + GTypeGestureLongPress = coreglib.Type(C.gtk_gesture_long_press_get_type()) + GTypeGesturePan = coreglib.Type(C.gtk_gesture_pan_get_type()) + GTypeGestureRotate = coreglib.Type(C.gtk_gesture_rotate_get_type()) + GTypeGestureSingle = coreglib.Type(C.gtk_gesture_single_get_type()) + GTypeGestureStylus = coreglib.Type(C.gtk_gesture_stylus_get_type()) + GTypeGestureSwipe = coreglib.Type(C.gtk_gesture_swipe_get_type()) + GTypeGestureZoom = coreglib.Type(C.gtk_gesture_zoom_get_type()) + GTypeGraphicsOffload = coreglib.Type(C.gtk_graphics_offload_get_type()) + GTypeGrid = coreglib.Type(C.gtk_grid_get_type()) + GTypeGridLayout = coreglib.Type(C.gtk_grid_layout_get_type()) + GTypeGridLayoutChild = coreglib.Type(C.gtk_grid_layout_child_get_type()) + GTypeGridView = coreglib.Type(C.gtk_grid_view_get_type()) + GTypeHeaderBar = coreglib.Type(C.gtk_header_bar_get_type()) + GTypeIMContext = coreglib.Type(C.gtk_im_context_get_type()) + GTypeIMContextSimple = coreglib.Type(C.gtk_im_context_simple_get_type()) + GTypeIMMulticontext = coreglib.Type(C.gtk_im_multicontext_get_type()) + GTypeIconPaintable = coreglib.Type(C.gtk_icon_paintable_get_type()) + GTypeIconTheme = coreglib.Type(C.gtk_icon_theme_get_type()) + GTypeIconView = coreglib.Type(C.gtk_icon_view_get_type()) + GTypeImage = coreglib.Type(C.gtk_image_get_type()) + GTypeInfoBar = coreglib.Type(C.gtk_info_bar_get_type()) + GTypeInscription = coreglib.Type(C.gtk_inscription_get_type()) + GTypeKeyvalTrigger = coreglib.Type(C.gtk_keyval_trigger_get_type()) + GTypeLabel = coreglib.Type(C.gtk_label_get_type()) + GTypeLayoutChild = coreglib.Type(C.gtk_layout_child_get_type()) + GTypeLayoutManager = coreglib.Type(C.gtk_layout_manager_get_type()) + GTypeLevelBar = coreglib.Type(C.gtk_level_bar_get_type()) + GTypeLinkButton = coreglib.Type(C.gtk_link_button_get_type()) + GTypeListBase = coreglib.Type(C.gtk_list_base_get_type()) + GTypeListBox = coreglib.Type(C.gtk_list_box_get_type()) + GTypeListBoxRow = coreglib.Type(C.gtk_list_box_row_get_type()) + GTypeListHeader = coreglib.Type(C.gtk_list_header_get_type()) + GTypeListItem = coreglib.Type(C.gtk_list_item_get_type()) + GTypeListItemFactory = coreglib.Type(C.gtk_list_item_factory_get_type()) + GTypeListStore = coreglib.Type(C.gtk_list_store_get_type()) + GTypeListView = coreglib.Type(C.gtk_list_view_get_type()) + GTypeLockButton = coreglib.Type(C.gtk_lock_button_get_type()) + GTypeMapListModel = coreglib.Type(C.gtk_map_list_model_get_type()) + GTypeMediaControls = coreglib.Type(C.gtk_media_controls_get_type()) + GTypeMediaFile = coreglib.Type(C.gtk_media_file_get_type()) + GTypeMediaStream = coreglib.Type(C.gtk_media_stream_get_type()) + GTypeMenuButton = coreglib.Type(C.gtk_menu_button_get_type()) + GTypeMessageDialog = coreglib.Type(C.gtk_message_dialog_get_type()) + GTypeMnemonicAction = coreglib.Type(C.gtk_mnemonic_action_get_type()) + GTypeMnemonicTrigger = coreglib.Type(C.gtk_mnemonic_trigger_get_type()) + GTypeMountOperation = coreglib.Type(C.gtk_mount_operation_get_type()) + GTypeMultiFilter = coreglib.Type(C.gtk_multi_filter_get_type()) + GTypeMultiSelection = coreglib.Type(C.gtk_multi_selection_get_type()) + GTypeMultiSorter = coreglib.Type(C.gtk_multi_sorter_get_type()) + GTypeNamedAction = coreglib.Type(C.gtk_named_action_get_type()) + GTypeNativeDialog = coreglib.Type(C.gtk_native_dialog_get_type()) + GTypeNeverTrigger = coreglib.Type(C.gtk_never_trigger_get_type()) + GTypeNoSelection = coreglib.Type(C.gtk_no_selection_get_type()) + GTypeNotebook = coreglib.Type(C.gtk_notebook_get_type()) + GTypeNotebookPage = coreglib.Type(C.gtk_notebook_page_get_type()) + GTypeNothingAction = coreglib.Type(C.gtk_nothing_action_get_type()) + GTypeNumericSorter = coreglib.Type(C.gtk_numeric_sorter_get_type()) + GTypeObjectExpression = coreglib.Type(C.gtk_object_expression_get_type()) + GTypeOverlay = coreglib.Type(C.gtk_overlay_get_type()) + GTypeOverlayLayout = coreglib.Type(C.gtk_overlay_layout_get_type()) + GTypeOverlayLayoutChild = coreglib.Type(C.gtk_overlay_layout_child_get_type()) + GTypePadController = coreglib.Type(C.gtk_pad_controller_get_type()) + GTypePageSetup = coreglib.Type(C.gtk_page_setup_get_type()) + GTypePaned = coreglib.Type(C.gtk_paned_get_type()) + GTypePasswordEntry = coreglib.Type(C.gtk_password_entry_get_type()) + GTypePasswordEntryBuffer = coreglib.Type(C.gtk_password_entry_buffer_get_type()) + GTypePicture = coreglib.Type(C.gtk_picture_get_type()) + GTypePopover = coreglib.Type(C.gtk_popover_get_type()) + GTypePopoverMenu = coreglib.Type(C.gtk_popover_menu_get_type()) + GTypePopoverMenuBar = coreglib.Type(C.gtk_popover_menu_bar_get_type()) + GTypePrintContext = coreglib.Type(C.gtk_print_context_get_type()) + GTypePrintDialog = coreglib.Type(C.gtk_print_dialog_get_type()) + GTypePrintOperation = coreglib.Type(C.gtk_print_operation_get_type()) + GTypePrintSettings = coreglib.Type(C.gtk_print_settings_get_type()) + GTypeProgressBar = coreglib.Type(C.gtk_progress_bar_get_type()) + GTypePropertyExpression = coreglib.Type(C.gtk_property_expression_get_type()) + GTypeRange = coreglib.Type(C.gtk_range_get_type()) + GTypeRecentManager = coreglib.Type(C.gtk_recent_manager_get_type()) + GTypeRevealer = coreglib.Type(C.gtk_revealer_get_type()) + GTypeScale = coreglib.Type(C.gtk_scale_get_type()) + GTypeScaleButton = coreglib.Type(C.gtk_scale_button_get_type()) + GTypeScrollbar = coreglib.Type(C.gtk_scrollbar_get_type()) + GTypeScrolledWindow = coreglib.Type(C.gtk_scrolled_window_get_type()) + GTypeSearchBar = coreglib.Type(C.gtk_search_bar_get_type()) + GTypeSearchEntry = coreglib.Type(C.gtk_search_entry_get_type()) + GTypeSelectionFilterModel = coreglib.Type(C.gtk_selection_filter_model_get_type()) + GTypeSeparator = coreglib.Type(C.gtk_separator_get_type()) + GTypeSettings = coreglib.Type(C.gtk_settings_get_type()) + GTypeShortcut = coreglib.Type(C.gtk_shortcut_get_type()) + GTypeShortcutAction = coreglib.Type(C.gtk_shortcut_action_get_type()) + GTypeShortcutController = coreglib.Type(C.gtk_shortcut_controller_get_type()) + GTypeShortcutLabel = coreglib.Type(C.gtk_shortcut_label_get_type()) + GTypeShortcutTrigger = coreglib.Type(C.gtk_shortcut_trigger_get_type()) + GTypeShortcutsGroup = coreglib.Type(C.gtk_shortcuts_group_get_type()) + GTypeShortcutsSection = coreglib.Type(C.gtk_shortcuts_section_get_type()) + GTypeShortcutsShortcut = coreglib.Type(C.gtk_shortcuts_shortcut_get_type()) + GTypeShortcutsWindow = coreglib.Type(C.gtk_shortcuts_window_get_type()) + GTypeSignalAction = coreglib.Type(C.gtk_signal_action_get_type()) + GTypeSignalListItemFactory = coreglib.Type(C.gtk_signal_list_item_factory_get_type()) + GTypeSingleSelection = coreglib.Type(C.gtk_single_selection_get_type()) + GTypeSizeGroup = coreglib.Type(C.gtk_size_group_get_type()) + GTypeSliceListModel = coreglib.Type(C.gtk_slice_list_model_get_type()) + GTypeSnapshot = coreglib.Type(C.gtk_snapshot_get_type()) + GTypeSortListModel = coreglib.Type(C.gtk_sort_list_model_get_type()) + GTypeSorter = coreglib.Type(C.gtk_sorter_get_type()) + GTypeSpinButton = coreglib.Type(C.gtk_spin_button_get_type()) + GTypeSpinner = coreglib.Type(C.gtk_spinner_get_type()) + GTypeStack = coreglib.Type(C.gtk_stack_get_type()) + GTypeStackPage = coreglib.Type(C.gtk_stack_page_get_type()) + GTypeStackSidebar = coreglib.Type(C.gtk_stack_sidebar_get_type()) + GTypeStackSwitcher = coreglib.Type(C.gtk_stack_switcher_get_type()) + GTypeStatusbar = coreglib.Type(C.gtk_statusbar_get_type()) + GTypeStringFilter = coreglib.Type(C.gtk_string_filter_get_type()) + GTypeStringList = coreglib.Type(C.gtk_string_list_get_type()) + GTypeStringObject = coreglib.Type(C.gtk_string_object_get_type()) + GTypeStringSorter = coreglib.Type(C.gtk_string_sorter_get_type()) + GTypeStyleContext = coreglib.Type(C.gtk_style_context_get_type()) + GTypeSwitch = coreglib.Type(C.gtk_switch_get_type()) + GTypeText = coreglib.Type(C.gtk_text_get_type()) + GTypeTextBuffer = coreglib.Type(C.gtk_text_buffer_get_type()) + GTypeTextChildAnchor = coreglib.Type(C.gtk_text_child_anchor_get_type()) + GTypeTextMark = coreglib.Type(C.gtk_text_mark_get_type()) + GTypeTextTag = coreglib.Type(C.gtk_text_tag_get_type()) + GTypeTextTagTable = coreglib.Type(C.gtk_text_tag_table_get_type()) + GTypeTextView = coreglib.Type(C.gtk_text_view_get_type()) + GTypeToggleButton = coreglib.Type(C.gtk_toggle_button_get_type()) + GTypeTooltip = coreglib.Type(C.gtk_tooltip_get_type()) + GTypeTreeExpander = coreglib.Type(C.gtk_tree_expander_get_type()) + GTypeTreeListModel = coreglib.Type(C.gtk_tree_list_model_get_type()) + GTypeTreeListRow = coreglib.Type(C.gtk_tree_list_row_get_type()) + GTypeTreeListRowSorter = coreglib.Type(C.gtk_tree_list_row_sorter_get_type()) + GTypeTreeModelFilter = coreglib.Type(C.gtk_tree_model_filter_get_type()) + GTypeTreeModelSort = coreglib.Type(C.gtk_tree_model_sort_get_type()) + GTypeTreeSelection = coreglib.Type(C.gtk_tree_selection_get_type()) + GTypeTreeStore = coreglib.Type(C.gtk_tree_store_get_type()) + GTypeTreeView = coreglib.Type(C.gtk_tree_view_get_type()) + GTypeTreeViewColumn = coreglib.Type(C.gtk_tree_view_column_get_type()) + GTypeURILauncher = coreglib.Type(C.gtk_uri_launcher_get_type()) + GTypeVideo = coreglib.Type(C.gtk_video_get_type()) + GTypeViewport = coreglib.Type(C.gtk_viewport_get_type()) + GTypeVolumeButton = coreglib.Type(C.gtk_volume_button_get_type()) + GTypeWidget = coreglib.Type(C.gtk_widget_get_type()) + GTypeWidgetPaintable = coreglib.Type(C.gtk_widget_paintable_get_type()) + GTypeWindow = coreglib.Type(C.gtk_window_get_type()) + GTypeWindowControls = coreglib.Type(C.gtk_window_controls_get_type()) + GTypeWindowGroup = coreglib.Type(C.gtk_window_group_get_type()) + GTypeWindowHandle = coreglib.Type(C.gtk_window_handle_get_type()) + GTypeAccessibleList = coreglib.Type(C.gtk_accessible_list_get_type()) + GTypeBitset = coreglib.Type(C.gtk_bitset_get_type()) + GTypeBitsetIter = coreglib.Type(C.gtk_bitset_iter_get_type()) + GTypeBorder = coreglib.Type(C.gtk_border_get_type()) + GTypeCSSSection = coreglib.Type(C.gtk_css_section_get_type()) + GTypeExpressionWatch = coreglib.Type(C.gtk_expression_watch_get_type()) + GTypePaperSize = coreglib.Type(C.gtk_paper_size_get_type()) + GTypePrintSetup = coreglib.Type(C.gtk_print_setup_get_type()) + GTypeRecentInfo = coreglib.Type(C.gtk_recent_info_get_type()) + GTypeRequisition = coreglib.Type(C.gtk_requisition_get_type()) + GTypeScrollInfo = coreglib.Type(C.gtk_scroll_info_get_type()) + GTypeTextIter = coreglib.Type(C.gtk_text_iter_get_type()) + GTypeTreeIter = coreglib.Type(C.gtk_tree_iter_get_type()) + GTypeTreePath = coreglib.Type(C.gtk_tree_path_get_type()) + GTypeTreeRowReference = coreglib.Type(C.gtk_tree_row_reference_get_type()) +) + +func init() { + coreglib.RegisterGValueMarshalers([]coreglib.TypeMarshaler{ + coreglib.TypeMarshaler{T: GTypeAccessibleAnnouncementPriority, F: marshalAccessibleAnnouncementPriority}, + coreglib.TypeMarshaler{T: GTypeAccessibleAutocomplete, F: marshalAccessibleAutocomplete}, + coreglib.TypeMarshaler{T: GTypeAccessibleInvalidState, F: marshalAccessibleInvalidState}, + coreglib.TypeMarshaler{T: GTypeAccessiblePlatformState, F: marshalAccessiblePlatformState}, + coreglib.TypeMarshaler{T: GTypeAccessibleProperty, F: marshalAccessibleProperty}, + coreglib.TypeMarshaler{T: GTypeAccessibleRelation, F: marshalAccessibleRelation}, + coreglib.TypeMarshaler{T: GTypeAccessibleRole, F: marshalAccessibleRole}, + coreglib.TypeMarshaler{T: GTypeAccessibleSort, F: marshalAccessibleSort}, + coreglib.TypeMarshaler{T: GTypeAccessibleState, F: marshalAccessibleState}, + coreglib.TypeMarshaler{T: GTypeAccessibleTextContentChange, F: marshalAccessibleTextContentChange}, + coreglib.TypeMarshaler{T: GTypeAccessibleTextGranularity, F: marshalAccessibleTextGranularity}, + coreglib.TypeMarshaler{T: GTypeAccessibleTristate, F: marshalAccessibleTristate}, + coreglib.TypeMarshaler{T: GTypeAlign, F: marshalAlign}, + coreglib.TypeMarshaler{T: GTypeArrowType, F: marshalArrowType}, + coreglib.TypeMarshaler{T: GTypeAssistantPageType, F: marshalAssistantPageType}, + coreglib.TypeMarshaler{T: GTypeBaselinePosition, F: marshalBaselinePosition}, + coreglib.TypeMarshaler{T: GTypeBorderStyle, F: marshalBorderStyle}, + coreglib.TypeMarshaler{T: GTypeBuilderError, F: marshalBuilderError}, + coreglib.TypeMarshaler{T: GTypeButtonsType, F: marshalButtonsType}, + coreglib.TypeMarshaler{T: GTypeCellRendererAccelMode, F: marshalCellRendererAccelMode}, + coreglib.TypeMarshaler{T: GTypeCellRendererMode, F: marshalCellRendererMode}, + coreglib.TypeMarshaler{T: GTypeCollation, F: marshalCollation}, + coreglib.TypeMarshaler{T: GTypeConstraintAttribute, F: marshalConstraintAttribute}, + coreglib.TypeMarshaler{T: GTypeConstraintRelation, F: marshalConstraintRelation}, + coreglib.TypeMarshaler{T: GTypeConstraintStrength, F: marshalConstraintStrength}, + coreglib.TypeMarshaler{T: GTypeConstraintVflParserError, F: marshalConstraintVflParserError}, + coreglib.TypeMarshaler{T: GTypeContentFit, F: marshalContentFit}, + coreglib.TypeMarshaler{T: GTypeCornerType, F: marshalCornerType}, + coreglib.TypeMarshaler{T: GTypeDeleteType, F: marshalDeleteType}, + coreglib.TypeMarshaler{T: GTypeDialogError, F: marshalDialogError}, + coreglib.TypeMarshaler{T: GTypeDirectionType, F: marshalDirectionType}, + coreglib.TypeMarshaler{T: GTypeEditableProperties, F: marshalEditableProperties}, + coreglib.TypeMarshaler{T: GTypeEntryIconPosition, F: marshalEntryIconPosition}, + coreglib.TypeMarshaler{T: GTypeEventSequenceState, F: marshalEventSequenceState}, + coreglib.TypeMarshaler{T: GTypeFileChooserAction, F: marshalFileChooserAction}, + coreglib.TypeMarshaler{T: GTypeFileChooserError, F: marshalFileChooserError}, + coreglib.TypeMarshaler{T: GTypeFilterChange, F: marshalFilterChange}, + coreglib.TypeMarshaler{T: GTypeFilterMatch, F: marshalFilterMatch}, + coreglib.TypeMarshaler{T: GTypeFontLevel, F: marshalFontLevel}, + coreglib.TypeMarshaler{T: GTypeGraphicsOffloadEnabled, F: marshalGraphicsOffloadEnabled}, + coreglib.TypeMarshaler{T: GTypeIconSize, F: marshalIconSize}, + coreglib.TypeMarshaler{T: GTypeIconThemeError, F: marshalIconThemeError}, + coreglib.TypeMarshaler{T: GTypeIconViewDropPosition, F: marshalIconViewDropPosition}, + coreglib.TypeMarshaler{T: GTypeImageType, F: marshalImageType}, + coreglib.TypeMarshaler{T: GTypeInputPurpose, F: marshalInputPurpose}, + coreglib.TypeMarshaler{T: GTypeInscriptionOverflow, F: marshalInscriptionOverflow}, + coreglib.TypeMarshaler{T: GTypeJustification, F: marshalJustification}, + coreglib.TypeMarshaler{T: GTypeLevelBarMode, F: marshalLevelBarMode}, + coreglib.TypeMarshaler{T: GTypeLicense, F: marshalLicense}, + coreglib.TypeMarshaler{T: GTypeListTabBehavior, F: marshalListTabBehavior}, + coreglib.TypeMarshaler{T: GTypeMessageType, F: marshalMessageType}, + coreglib.TypeMarshaler{T: GTypeMovementStep, F: marshalMovementStep}, + coreglib.TypeMarshaler{T: GTypeNaturalWrapMode, F: marshalNaturalWrapMode}, + coreglib.TypeMarshaler{T: GTypeNotebookTab, F: marshalNotebookTab}, + coreglib.TypeMarshaler{T: GTypeNumberUpLayout, F: marshalNumberUpLayout}, + coreglib.TypeMarshaler{T: GTypeOrdering, F: marshalOrdering}, + coreglib.TypeMarshaler{T: GTypeOrientation, F: marshalOrientation}, + coreglib.TypeMarshaler{T: GTypeOverflow, F: marshalOverflow}, + coreglib.TypeMarshaler{T: GTypePackType, F: marshalPackType}, + coreglib.TypeMarshaler{T: GTypePadActionType, F: marshalPadActionType}, + coreglib.TypeMarshaler{T: GTypePageOrientation, F: marshalPageOrientation}, + coreglib.TypeMarshaler{T: GTypePageSet, F: marshalPageSet}, + coreglib.TypeMarshaler{T: GTypePanDirection, F: marshalPanDirection}, + coreglib.TypeMarshaler{T: GTypePolicyType, F: marshalPolicyType}, + coreglib.TypeMarshaler{T: GTypePositionType, F: marshalPositionType}, + coreglib.TypeMarshaler{T: GTypePrintDuplex, F: marshalPrintDuplex}, + coreglib.TypeMarshaler{T: GTypePrintError, F: marshalPrintError}, + coreglib.TypeMarshaler{T: GTypePrintOperationAction, F: marshalPrintOperationAction}, + coreglib.TypeMarshaler{T: GTypePrintOperationResult, F: marshalPrintOperationResult}, + coreglib.TypeMarshaler{T: GTypePrintPages, F: marshalPrintPages}, + coreglib.TypeMarshaler{T: GTypePrintQuality, F: marshalPrintQuality}, + coreglib.TypeMarshaler{T: GTypePrintStatus, F: marshalPrintStatus}, + coreglib.TypeMarshaler{T: GTypePropagationLimit, F: marshalPropagationLimit}, + coreglib.TypeMarshaler{T: GTypePropagationPhase, F: marshalPropagationPhase}, + coreglib.TypeMarshaler{T: GTypeRecentManagerError, F: marshalRecentManagerError}, + coreglib.TypeMarshaler{T: GTypeResponseType, F: marshalResponseType}, + coreglib.TypeMarshaler{T: GTypeRevealerTransitionType, F: marshalRevealerTransitionType}, + coreglib.TypeMarshaler{T: GTypeScrollStep, F: marshalScrollStep}, + coreglib.TypeMarshaler{T: GTypeScrollType, F: marshalScrollType}, + coreglib.TypeMarshaler{T: GTypeScrollablePolicy, F: marshalScrollablePolicy}, + coreglib.TypeMarshaler{T: GTypeSelectionMode, F: marshalSelectionMode}, + coreglib.TypeMarshaler{T: GTypeSensitivityType, F: marshalSensitivityType}, + coreglib.TypeMarshaler{T: GTypeShortcutScope, F: marshalShortcutScope}, + coreglib.TypeMarshaler{T: GTypeShortcutType, F: marshalShortcutType}, + coreglib.TypeMarshaler{T: GTypeSizeGroupMode, F: marshalSizeGroupMode}, + coreglib.TypeMarshaler{T: GTypeSizeRequestMode, F: marshalSizeRequestMode}, + coreglib.TypeMarshaler{T: GTypeSortType, F: marshalSortType}, + coreglib.TypeMarshaler{T: GTypeSorterChange, F: marshalSorterChange}, + coreglib.TypeMarshaler{T: GTypeSorterOrder, F: marshalSorterOrder}, + coreglib.TypeMarshaler{T: GTypeSpinButtonUpdatePolicy, F: marshalSpinButtonUpdatePolicy}, + coreglib.TypeMarshaler{T: GTypeSpinType, F: marshalSpinType}, + coreglib.TypeMarshaler{T: GTypeStackTransitionType, F: marshalStackTransitionType}, + coreglib.TypeMarshaler{T: GTypeStringFilterMatchMode, F: marshalStringFilterMatchMode}, + coreglib.TypeMarshaler{T: GTypeSymbolicColor, F: marshalSymbolicColor}, + coreglib.TypeMarshaler{T: GTypeSystemSetting, F: marshalSystemSetting}, + coreglib.TypeMarshaler{T: GTypeTextDirection, F: marshalTextDirection}, + coreglib.TypeMarshaler{T: GTypeTextExtendSelection, F: marshalTextExtendSelection}, + coreglib.TypeMarshaler{T: GTypeTextViewLayer, F: marshalTextViewLayer}, + coreglib.TypeMarshaler{T: GTypeTextWindowType, F: marshalTextWindowType}, + coreglib.TypeMarshaler{T: GTypeTreeViewColumnSizing, F: marshalTreeViewColumnSizing}, + coreglib.TypeMarshaler{T: GTypeTreeViewDropPosition, F: marshalTreeViewDropPosition}, + coreglib.TypeMarshaler{T: GTypeTreeViewGridLines, F: marshalTreeViewGridLines}, + coreglib.TypeMarshaler{T: GTypeUnit, F: marshalUnit}, + coreglib.TypeMarshaler{T: GTypeWrapMode, F: marshalWrapMode}, + coreglib.TypeMarshaler{T: GTypeApplicationInhibitFlags, F: marshalApplicationInhibitFlags}, + coreglib.TypeMarshaler{T: GTypeBuilderClosureFlags, F: marshalBuilderClosureFlags}, + coreglib.TypeMarshaler{T: GTypeCellRendererState, F: marshalCellRendererState}, + coreglib.TypeMarshaler{T: GTypeDebugFlags, F: marshalDebugFlags}, + coreglib.TypeMarshaler{T: GTypeDialogFlags, F: marshalDialogFlags}, + coreglib.TypeMarshaler{T: GTypeEventControllerScrollFlags, F: marshalEventControllerScrollFlags}, + coreglib.TypeMarshaler{T: GTypeFontChooserLevel, F: marshalFontChooserLevel}, + coreglib.TypeMarshaler{T: GTypeIconLookupFlags, F: marshalIconLookupFlags}, + coreglib.TypeMarshaler{T: GTypeInputHints, F: marshalInputHints}, + coreglib.TypeMarshaler{T: GTypeListScrollFlags, F: marshalListScrollFlags}, + coreglib.TypeMarshaler{T: GTypePickFlags, F: marshalPickFlags}, + coreglib.TypeMarshaler{T: GTypePopoverMenuFlags, F: marshalPopoverMenuFlags}, + coreglib.TypeMarshaler{T: GTypeShortcutActionFlags, F: marshalShortcutActionFlags}, + coreglib.TypeMarshaler{T: GTypeStateFlags, F: marshalStateFlags}, + coreglib.TypeMarshaler{T: GTypeStyleContextPrintFlags, F: marshalStyleContextPrintFlags}, + coreglib.TypeMarshaler{T: GTypeTextSearchFlags, F: marshalTextSearchFlags}, + coreglib.TypeMarshaler{T: GTypeTreeModelFlags, F: marshalTreeModelFlags}, + coreglib.TypeMarshaler{T: GTypeAccessible, F: marshalAccessible}, + coreglib.TypeMarshaler{T: GTypeAccessibleRange, F: marshalAccessibleRange}, + coreglib.TypeMarshaler{T: GTypeAccessibleText, F: marshalAccessibleText}, + coreglib.TypeMarshaler{T: GTypeActionable, F: marshalActionable}, + coreglib.TypeMarshaler{T: GTypeAppChooser, F: marshalAppChooser}, + coreglib.TypeMarshaler{T: GTypeBuildable, F: marshalBuildable}, + coreglib.TypeMarshaler{T: GTypeBuilderScope, F: marshalBuilderScope}, + coreglib.TypeMarshaler{T: GTypeCellEditable, F: marshalCellEditable}, + coreglib.TypeMarshaler{T: GTypeCellLayout, F: marshalCellLayout}, + coreglib.TypeMarshaler{T: GTypeColorChooser, F: marshalColorChooser}, + coreglib.TypeMarshaler{T: GTypeConstraintTarget, F: marshalConstraintTarget}, + coreglib.TypeMarshaler{T: GTypeEditableTextWidget, F: marshalEditableTextWidget}, + coreglib.TypeMarshaler{T: GTypeFileChooser, F: marshalFileChooser}, + coreglib.TypeMarshaler{T: GTypeFontChooser, F: marshalFontChooser}, + coreglib.TypeMarshaler{T: GTypeNativeSurface, F: marshalNativeSurface}, + coreglib.TypeMarshaler{T: GTypeOrientable, F: marshalOrientable}, + coreglib.TypeMarshaler{T: GTypePrintOperationPreview, F: marshalPrintOperationPreview}, + coreglib.TypeMarshaler{T: GTypeRoot, F: marshalRoot}, + coreglib.TypeMarshaler{T: GTypeScrollable, F: marshalScrollable}, + coreglib.TypeMarshaler{T: GTypeSectionModel, F: marshalSectionModel}, + coreglib.TypeMarshaler{T: GTypeSelectionModel, F: marshalSelectionModel}, + coreglib.TypeMarshaler{T: GTypeShortcutManager, F: marshalShortcutManager}, + coreglib.TypeMarshaler{T: GTypeStyleProvider, F: marshalStyleProvider}, + coreglib.TypeMarshaler{T: GTypeSymbolicPaintable, F: marshalSymbolicPaintable}, + coreglib.TypeMarshaler{T: GTypeTreeDragDest, F: marshalTreeDragDest}, + coreglib.TypeMarshaler{T: GTypeTreeDragSource, F: marshalTreeDragSource}, + coreglib.TypeMarshaler{T: GTypeTreeModel, F: marshalTreeModel}, + coreglib.TypeMarshaler{T: GTypeTreeSortable, F: marshalTreeSortable}, + coreglib.TypeMarshaler{T: GTypeATContext, F: marshalATContext}, + coreglib.TypeMarshaler{T: GTypeAboutDialog, F: marshalAboutDialog}, + coreglib.TypeMarshaler{T: GTypeActionBar, F: marshalActionBar}, + coreglib.TypeMarshaler{T: GTypeActivateAction, F: marshalActivateAction}, + coreglib.TypeMarshaler{T: GTypeAdjustment, F: marshalAdjustment}, + coreglib.TypeMarshaler{T: GTypeAlertDialog, F: marshalAlertDialog}, + coreglib.TypeMarshaler{T: GTypeAlternativeTrigger, F: marshalAlternativeTrigger}, + coreglib.TypeMarshaler{T: GTypeAnyFilter, F: marshalAnyFilter}, + coreglib.TypeMarshaler{T: GTypeAppChooserButton, F: marshalAppChooserButton}, + coreglib.TypeMarshaler{T: GTypeAppChooserDialog, F: marshalAppChooserDialog}, + coreglib.TypeMarshaler{T: GTypeAppChooserWidget, F: marshalAppChooserWidget}, + coreglib.TypeMarshaler{T: GTypeApplication, F: marshalApplication}, + coreglib.TypeMarshaler{T: GTypeApplicationWindow, F: marshalApplicationWindow}, + coreglib.TypeMarshaler{T: GTypeAspectFrame, F: marshalAspectFrame}, + coreglib.TypeMarshaler{T: GTypeAssistant, F: marshalAssistant}, + coreglib.TypeMarshaler{T: GTypeAssistantPage, F: marshalAssistantPage}, + coreglib.TypeMarshaler{T: GTypeBinLayout, F: marshalBinLayout}, + coreglib.TypeMarshaler{T: GTypeBookmarkList, F: marshalBookmarkList}, + coreglib.TypeMarshaler{T: GTypeBoolFilter, F: marshalBoolFilter}, + coreglib.TypeMarshaler{T: GTypeBox, F: marshalBox}, + coreglib.TypeMarshaler{T: GTypeBoxLayout, F: marshalBoxLayout}, + coreglib.TypeMarshaler{T: GTypeBuilder, F: marshalBuilder}, + coreglib.TypeMarshaler{T: GTypeBuilderCScope, F: marshalBuilderCScope}, + coreglib.TypeMarshaler{T: GTypeBuilderListItemFactory, F: marshalBuilderListItemFactory}, + coreglib.TypeMarshaler{T: GTypeButton, F: marshalButton}, + coreglib.TypeMarshaler{T: GTypeCClosureExpression, F: marshalCClosureExpression}, + coreglib.TypeMarshaler{T: GTypeCalendar, F: marshalCalendar}, + coreglib.TypeMarshaler{T: GTypeCallbackAction, F: marshalCallbackAction}, + coreglib.TypeMarshaler{T: GTypeCellArea, F: marshalCellArea}, + coreglib.TypeMarshaler{T: GTypeCellAreaBox, F: marshalCellAreaBox}, + coreglib.TypeMarshaler{T: GTypeCellAreaContext, F: marshalCellAreaContext}, + coreglib.TypeMarshaler{T: GTypeCellRenderer, F: marshalCellRenderer}, + coreglib.TypeMarshaler{T: GTypeCellRendererAccel, F: marshalCellRendererAccel}, + coreglib.TypeMarshaler{T: GTypeCellRendererCombo, F: marshalCellRendererCombo}, + coreglib.TypeMarshaler{T: GTypeCellRendererPixbuf, F: marshalCellRendererPixbuf}, + coreglib.TypeMarshaler{T: GTypeCellRendererProgress, F: marshalCellRendererProgress}, + coreglib.TypeMarshaler{T: GTypeCellRendererSpin, F: marshalCellRendererSpin}, + coreglib.TypeMarshaler{T: GTypeCellRendererSpinner, F: marshalCellRendererSpinner}, + coreglib.TypeMarshaler{T: GTypeCellRendererText, F: marshalCellRendererText}, + coreglib.TypeMarshaler{T: GTypeCellRendererToggle, F: marshalCellRendererToggle}, + coreglib.TypeMarshaler{T: GTypeCellView, F: marshalCellView}, + coreglib.TypeMarshaler{T: GTypeCenterBox, F: marshalCenterBox}, + coreglib.TypeMarshaler{T: GTypeCenterLayout, F: marshalCenterLayout}, + coreglib.TypeMarshaler{T: GTypeCheckButton, F: marshalCheckButton}, + coreglib.TypeMarshaler{T: GTypeClosureExpression, F: marshalClosureExpression}, + coreglib.TypeMarshaler{T: GTypeColorButton, F: marshalColorButton}, + coreglib.TypeMarshaler{T: GTypeColorChooserDialog, F: marshalColorChooserDialog}, + coreglib.TypeMarshaler{T: GTypeColorChooserWidget, F: marshalColorChooserWidget}, + coreglib.TypeMarshaler{T: GTypeColorDialog, F: marshalColorDialog}, + coreglib.TypeMarshaler{T: GTypeColorDialogButton, F: marshalColorDialogButton}, + coreglib.TypeMarshaler{T: GTypeColumnView, F: marshalColumnView}, + coreglib.TypeMarshaler{T: GTypeColumnViewCell, F: marshalColumnViewCell}, + coreglib.TypeMarshaler{T: GTypeColumnViewColumn, F: marshalColumnViewColumn}, + coreglib.TypeMarshaler{T: GTypeColumnViewRow, F: marshalColumnViewRow}, + coreglib.TypeMarshaler{T: GTypeColumnViewSorter, F: marshalColumnViewSorter}, + coreglib.TypeMarshaler{T: GTypeComboBox, F: marshalComboBox}, + coreglib.TypeMarshaler{T: GTypeComboBoxText, F: marshalComboBoxText}, + coreglib.TypeMarshaler{T: GTypeConstantExpression, F: marshalConstantExpression}, + coreglib.TypeMarshaler{T: GTypeConstraint, F: marshalConstraint}, + coreglib.TypeMarshaler{T: GTypeConstraintGuide, F: marshalConstraintGuide}, + coreglib.TypeMarshaler{T: GTypeConstraintLayout, F: marshalConstraintLayout}, + coreglib.TypeMarshaler{T: GTypeConstraintLayoutChild, F: marshalConstraintLayoutChild}, + coreglib.TypeMarshaler{T: GTypeCSSProvider, F: marshalCSSProvider}, + coreglib.TypeMarshaler{T: GTypeCustomFilter, F: marshalCustomFilter}, + coreglib.TypeMarshaler{T: GTypeCustomLayout, F: marshalCustomLayout}, + coreglib.TypeMarshaler{T: GTypeCustomSorter, F: marshalCustomSorter}, + coreglib.TypeMarshaler{T: GTypeDialog, F: marshalDialog}, + coreglib.TypeMarshaler{T: GTypeDirectoryList, F: marshalDirectoryList}, + coreglib.TypeMarshaler{T: GTypeDragIcon, F: marshalDragIcon}, + coreglib.TypeMarshaler{T: GTypeDragSource, F: marshalDragSource}, + coreglib.TypeMarshaler{T: GTypeDrawingArea, F: marshalDrawingArea}, + coreglib.TypeMarshaler{T: GTypeDropControllerMotion, F: marshalDropControllerMotion}, + coreglib.TypeMarshaler{T: GTypeDropDown, F: marshalDropDown}, + coreglib.TypeMarshaler{T: GTypeDropTarget, F: marshalDropTarget}, + coreglib.TypeMarshaler{T: GTypeDropTargetAsync, F: marshalDropTargetAsync}, + coreglib.TypeMarshaler{T: GTypeEditableLabel, F: marshalEditableLabel}, + coreglib.TypeMarshaler{T: GTypeEmojiChooser, F: marshalEmojiChooser}, + coreglib.TypeMarshaler{T: GTypeEntry, F: marshalEntry}, + coreglib.TypeMarshaler{T: GTypeEntryBuffer, F: marshalEntryBuffer}, + coreglib.TypeMarshaler{T: GTypeEntryCompletion, F: marshalEntryCompletion}, + coreglib.TypeMarshaler{T: GTypeEventController, F: marshalEventController}, + coreglib.TypeMarshaler{T: GTypeEventControllerFocus, F: marshalEventControllerFocus}, + coreglib.TypeMarshaler{T: GTypeEventControllerKey, F: marshalEventControllerKey}, + coreglib.TypeMarshaler{T: GTypeEventControllerLegacy, F: marshalEventControllerLegacy}, + coreglib.TypeMarshaler{T: GTypeEventControllerMotion, F: marshalEventControllerMotion}, + coreglib.TypeMarshaler{T: GTypeEventControllerScroll, F: marshalEventControllerScroll}, + coreglib.TypeMarshaler{T: GTypeEveryFilter, F: marshalEveryFilter}, + coreglib.TypeMarshaler{T: GTypeExpander, F: marshalExpander}, + coreglib.TypeMarshaler{T: GTypeExpression, F: marshalExpression}, + coreglib.TypeMarshaler{T: GTypeFileChooserDialog, F: marshalFileChooserDialog}, + coreglib.TypeMarshaler{T: GTypeFileChooserNative, F: marshalFileChooserNative}, + coreglib.TypeMarshaler{T: GTypeFileChooserWidget, F: marshalFileChooserWidget}, + coreglib.TypeMarshaler{T: GTypeFileDialog, F: marshalFileDialog}, + coreglib.TypeMarshaler{T: GTypeFileFilter, F: marshalFileFilter}, + coreglib.TypeMarshaler{T: GTypeFileLauncher, F: marshalFileLauncher}, + coreglib.TypeMarshaler{T: GTypeFilter, F: marshalFilter}, + coreglib.TypeMarshaler{T: GTypeFilterListModel, F: marshalFilterListModel}, + coreglib.TypeMarshaler{T: GTypeFixed, F: marshalFixed}, + coreglib.TypeMarshaler{T: GTypeFixedLayout, F: marshalFixedLayout}, + coreglib.TypeMarshaler{T: GTypeFixedLayoutChild, F: marshalFixedLayoutChild}, + coreglib.TypeMarshaler{T: GTypeFlattenListModel, F: marshalFlattenListModel}, + coreglib.TypeMarshaler{T: GTypeFlowBox, F: marshalFlowBox}, + coreglib.TypeMarshaler{T: GTypeFlowBoxChild, F: marshalFlowBoxChild}, + coreglib.TypeMarshaler{T: GTypeFontButton, F: marshalFontButton}, + coreglib.TypeMarshaler{T: GTypeFontChooserDialog, F: marshalFontChooserDialog}, + coreglib.TypeMarshaler{T: GTypeFontChooserWidget, F: marshalFontChooserWidget}, + coreglib.TypeMarshaler{T: GTypeFontDialog, F: marshalFontDialog}, + coreglib.TypeMarshaler{T: GTypeFontDialogButton, F: marshalFontDialogButton}, + coreglib.TypeMarshaler{T: GTypeFrame, F: marshalFrame}, + coreglib.TypeMarshaler{T: GTypeGLArea, F: marshalGLArea}, + coreglib.TypeMarshaler{T: GTypeGesture, F: marshalGesture}, + coreglib.TypeMarshaler{T: GTypeGestureClick, F: marshalGestureClick}, + coreglib.TypeMarshaler{T: GTypeGestureDrag, F: marshalGestureDrag}, + coreglib.TypeMarshaler{T: GTypeGestureLongPress, F: marshalGestureLongPress}, + coreglib.TypeMarshaler{T: GTypeGesturePan, F: marshalGesturePan}, + coreglib.TypeMarshaler{T: GTypeGestureRotate, F: marshalGestureRotate}, + coreglib.TypeMarshaler{T: GTypeGestureSingle, F: marshalGestureSingle}, + coreglib.TypeMarshaler{T: GTypeGestureStylus, F: marshalGestureStylus}, + coreglib.TypeMarshaler{T: GTypeGestureSwipe, F: marshalGestureSwipe}, + coreglib.TypeMarshaler{T: GTypeGestureZoom, F: marshalGestureZoom}, + coreglib.TypeMarshaler{T: GTypeGraphicsOffload, F: marshalGraphicsOffload}, + coreglib.TypeMarshaler{T: GTypeGrid, F: marshalGrid}, + coreglib.TypeMarshaler{T: GTypeGridLayout, F: marshalGridLayout}, + coreglib.TypeMarshaler{T: GTypeGridLayoutChild, F: marshalGridLayoutChild}, + coreglib.TypeMarshaler{T: GTypeGridView, F: marshalGridView}, + coreglib.TypeMarshaler{T: GTypeHeaderBar, F: marshalHeaderBar}, + coreglib.TypeMarshaler{T: GTypeIMContext, F: marshalIMContext}, + coreglib.TypeMarshaler{T: GTypeIMContextSimple, F: marshalIMContextSimple}, + coreglib.TypeMarshaler{T: GTypeIMMulticontext, F: marshalIMMulticontext}, + coreglib.TypeMarshaler{T: GTypeIconPaintable, F: marshalIconPaintable}, + coreglib.TypeMarshaler{T: GTypeIconTheme, F: marshalIconTheme}, + coreglib.TypeMarshaler{T: GTypeIconView, F: marshalIconView}, + coreglib.TypeMarshaler{T: GTypeImage, F: marshalImage}, + coreglib.TypeMarshaler{T: GTypeInfoBar, F: marshalInfoBar}, + coreglib.TypeMarshaler{T: GTypeInscription, F: marshalInscription}, + coreglib.TypeMarshaler{T: GTypeKeyvalTrigger, F: marshalKeyvalTrigger}, + coreglib.TypeMarshaler{T: GTypeLabel, F: marshalLabel}, + coreglib.TypeMarshaler{T: GTypeLayoutChild, F: marshalLayoutChild}, + coreglib.TypeMarshaler{T: GTypeLayoutManager, F: marshalLayoutManager}, + coreglib.TypeMarshaler{T: GTypeLevelBar, F: marshalLevelBar}, + coreglib.TypeMarshaler{T: GTypeLinkButton, F: marshalLinkButton}, + coreglib.TypeMarshaler{T: GTypeListBase, F: marshalListBase}, + coreglib.TypeMarshaler{T: GTypeListBox, F: marshalListBox}, + coreglib.TypeMarshaler{T: GTypeListBoxRow, F: marshalListBoxRow}, + coreglib.TypeMarshaler{T: GTypeListHeader, F: marshalListHeader}, + coreglib.TypeMarshaler{T: GTypeListItem, F: marshalListItem}, + coreglib.TypeMarshaler{T: GTypeListItemFactory, F: marshalListItemFactory}, + coreglib.TypeMarshaler{T: GTypeListStore, F: marshalListStore}, + coreglib.TypeMarshaler{T: GTypeListView, F: marshalListView}, + coreglib.TypeMarshaler{T: GTypeLockButton, F: marshalLockButton}, + coreglib.TypeMarshaler{T: GTypeMapListModel, F: marshalMapListModel}, + coreglib.TypeMarshaler{T: GTypeMediaControls, F: marshalMediaControls}, + coreglib.TypeMarshaler{T: GTypeMediaFile, F: marshalMediaFile}, + coreglib.TypeMarshaler{T: GTypeMediaStream, F: marshalMediaStream}, + coreglib.TypeMarshaler{T: GTypeMenuButton, F: marshalMenuButton}, + coreglib.TypeMarshaler{T: GTypeMessageDialog, F: marshalMessageDialog}, + coreglib.TypeMarshaler{T: GTypeMnemonicAction, F: marshalMnemonicAction}, + coreglib.TypeMarshaler{T: GTypeMnemonicTrigger, F: marshalMnemonicTrigger}, + coreglib.TypeMarshaler{T: GTypeMountOperation, F: marshalMountOperation}, + coreglib.TypeMarshaler{T: GTypeMultiFilter, F: marshalMultiFilter}, + coreglib.TypeMarshaler{T: GTypeMultiSelection, F: marshalMultiSelection}, + coreglib.TypeMarshaler{T: GTypeMultiSorter, F: marshalMultiSorter}, + coreglib.TypeMarshaler{T: GTypeNamedAction, F: marshalNamedAction}, + coreglib.TypeMarshaler{T: GTypeNativeDialog, F: marshalNativeDialog}, + coreglib.TypeMarshaler{T: GTypeNeverTrigger, F: marshalNeverTrigger}, + coreglib.TypeMarshaler{T: GTypeNoSelection, F: marshalNoSelection}, + coreglib.TypeMarshaler{T: GTypeNotebook, F: marshalNotebook}, + coreglib.TypeMarshaler{T: GTypeNotebookPage, F: marshalNotebookPage}, + coreglib.TypeMarshaler{T: GTypeNothingAction, F: marshalNothingAction}, + coreglib.TypeMarshaler{T: GTypeNumericSorter, F: marshalNumericSorter}, + coreglib.TypeMarshaler{T: GTypeObjectExpression, F: marshalObjectExpression}, + coreglib.TypeMarshaler{T: GTypeOverlay, F: marshalOverlay}, + coreglib.TypeMarshaler{T: GTypeOverlayLayout, F: marshalOverlayLayout}, + coreglib.TypeMarshaler{T: GTypeOverlayLayoutChild, F: marshalOverlayLayoutChild}, + coreglib.TypeMarshaler{T: GTypePadController, F: marshalPadController}, + coreglib.TypeMarshaler{T: GTypePageSetup, F: marshalPageSetup}, + coreglib.TypeMarshaler{T: GTypePaned, F: marshalPaned}, + coreglib.TypeMarshaler{T: GTypePasswordEntry, F: marshalPasswordEntry}, + coreglib.TypeMarshaler{T: GTypePasswordEntryBuffer, F: marshalPasswordEntryBuffer}, + coreglib.TypeMarshaler{T: GTypePicture, F: marshalPicture}, + coreglib.TypeMarshaler{T: GTypePopover, F: marshalPopover}, + coreglib.TypeMarshaler{T: GTypePopoverMenu, F: marshalPopoverMenu}, + coreglib.TypeMarshaler{T: GTypePopoverMenuBar, F: marshalPopoverMenuBar}, + coreglib.TypeMarshaler{T: GTypePrintContext, F: marshalPrintContext}, + coreglib.TypeMarshaler{T: GTypePrintDialog, F: marshalPrintDialog}, + coreglib.TypeMarshaler{T: GTypePrintOperation, F: marshalPrintOperation}, + coreglib.TypeMarshaler{T: GTypePrintSettings, F: marshalPrintSettings}, + coreglib.TypeMarshaler{T: GTypeProgressBar, F: marshalProgressBar}, + coreglib.TypeMarshaler{T: GTypePropertyExpression, F: marshalPropertyExpression}, + coreglib.TypeMarshaler{T: GTypeRange, F: marshalRange}, + coreglib.TypeMarshaler{T: GTypeRecentManager, F: marshalRecentManager}, + coreglib.TypeMarshaler{T: GTypeRevealer, F: marshalRevealer}, + coreglib.TypeMarshaler{T: GTypeScale, F: marshalScale}, + coreglib.TypeMarshaler{T: GTypeScaleButton, F: marshalScaleButton}, + coreglib.TypeMarshaler{T: GTypeScrollbar, F: marshalScrollbar}, + coreglib.TypeMarshaler{T: GTypeScrolledWindow, F: marshalScrolledWindow}, + coreglib.TypeMarshaler{T: GTypeSearchBar, F: marshalSearchBar}, + coreglib.TypeMarshaler{T: GTypeSearchEntry, F: marshalSearchEntry}, + coreglib.TypeMarshaler{T: GTypeSelectionFilterModel, F: marshalSelectionFilterModel}, + coreglib.TypeMarshaler{T: GTypeSeparator, F: marshalSeparator}, + coreglib.TypeMarshaler{T: GTypeSettings, F: marshalSettings}, + coreglib.TypeMarshaler{T: GTypeShortcut, F: marshalShortcut}, + coreglib.TypeMarshaler{T: GTypeShortcutAction, F: marshalShortcutAction}, + coreglib.TypeMarshaler{T: GTypeShortcutController, F: marshalShortcutController}, + coreglib.TypeMarshaler{T: GTypeShortcutLabel, F: marshalShortcutLabel}, + coreglib.TypeMarshaler{T: GTypeShortcutTrigger, F: marshalShortcutTrigger}, + coreglib.TypeMarshaler{T: GTypeShortcutsGroup, F: marshalShortcutsGroup}, + coreglib.TypeMarshaler{T: GTypeShortcutsSection, F: marshalShortcutsSection}, + coreglib.TypeMarshaler{T: GTypeShortcutsShortcut, F: marshalShortcutsShortcut}, + coreglib.TypeMarshaler{T: GTypeShortcutsWindow, F: marshalShortcutsWindow}, + coreglib.TypeMarshaler{T: GTypeSignalAction, F: marshalSignalAction}, + coreglib.TypeMarshaler{T: GTypeSignalListItemFactory, F: marshalSignalListItemFactory}, + coreglib.TypeMarshaler{T: GTypeSingleSelection, F: marshalSingleSelection}, + coreglib.TypeMarshaler{T: GTypeSizeGroup, F: marshalSizeGroup}, + coreglib.TypeMarshaler{T: GTypeSliceListModel, F: marshalSliceListModel}, + coreglib.TypeMarshaler{T: GTypeSnapshot, F: marshalSnapshot}, + coreglib.TypeMarshaler{T: GTypeSortListModel, F: marshalSortListModel}, + coreglib.TypeMarshaler{T: GTypeSorter, F: marshalSorter}, + coreglib.TypeMarshaler{T: GTypeSpinButton, F: marshalSpinButton}, + coreglib.TypeMarshaler{T: GTypeSpinner, F: marshalSpinner}, + coreglib.TypeMarshaler{T: GTypeStack, F: marshalStack}, + coreglib.TypeMarshaler{T: GTypeStackPage, F: marshalStackPage}, + coreglib.TypeMarshaler{T: GTypeStackSidebar, F: marshalStackSidebar}, + coreglib.TypeMarshaler{T: GTypeStackSwitcher, F: marshalStackSwitcher}, + coreglib.TypeMarshaler{T: GTypeStatusbar, F: marshalStatusbar}, + coreglib.TypeMarshaler{T: GTypeStringFilter, F: marshalStringFilter}, + coreglib.TypeMarshaler{T: GTypeStringList, F: marshalStringList}, + coreglib.TypeMarshaler{T: GTypeStringObject, F: marshalStringObject}, + coreglib.TypeMarshaler{T: GTypeStringSorter, F: marshalStringSorter}, + coreglib.TypeMarshaler{T: GTypeStyleContext, F: marshalStyleContext}, + coreglib.TypeMarshaler{T: GTypeSwitch, F: marshalSwitch}, + coreglib.TypeMarshaler{T: GTypeText, F: marshalText}, + coreglib.TypeMarshaler{T: GTypeTextBuffer, F: marshalTextBuffer}, + coreglib.TypeMarshaler{T: GTypeTextChildAnchor, F: marshalTextChildAnchor}, + coreglib.TypeMarshaler{T: GTypeTextMark, F: marshalTextMark}, + coreglib.TypeMarshaler{T: GTypeTextTag, F: marshalTextTag}, + coreglib.TypeMarshaler{T: GTypeTextTagTable, F: marshalTextTagTable}, + coreglib.TypeMarshaler{T: GTypeTextView, F: marshalTextView}, + coreglib.TypeMarshaler{T: GTypeToggleButton, F: marshalToggleButton}, + coreglib.TypeMarshaler{T: GTypeTooltip, F: marshalTooltip}, + coreglib.TypeMarshaler{T: GTypeTreeExpander, F: marshalTreeExpander}, + coreglib.TypeMarshaler{T: GTypeTreeListModel, F: marshalTreeListModel}, + coreglib.TypeMarshaler{T: GTypeTreeListRow, F: marshalTreeListRow}, + coreglib.TypeMarshaler{T: GTypeTreeListRowSorter, F: marshalTreeListRowSorter}, + coreglib.TypeMarshaler{T: GTypeTreeModelFilter, F: marshalTreeModelFilter}, + coreglib.TypeMarshaler{T: GTypeTreeModelSort, F: marshalTreeModelSort}, + coreglib.TypeMarshaler{T: GTypeTreeSelection, F: marshalTreeSelection}, + coreglib.TypeMarshaler{T: GTypeTreeStore, F: marshalTreeStore}, + coreglib.TypeMarshaler{T: GTypeTreeView, F: marshalTreeView}, + coreglib.TypeMarshaler{T: GTypeTreeViewColumn, F: marshalTreeViewColumn}, + coreglib.TypeMarshaler{T: GTypeURILauncher, F: marshalURILauncher}, + coreglib.TypeMarshaler{T: GTypeVideo, F: marshalVideo}, + coreglib.TypeMarshaler{T: GTypeViewport, F: marshalViewport}, + coreglib.TypeMarshaler{T: GTypeVolumeButton, F: marshalVolumeButton}, + coreglib.TypeMarshaler{T: GTypeWidget, F: marshalWidget}, + coreglib.TypeMarshaler{T: GTypeWidgetPaintable, F: marshalWidgetPaintable}, + coreglib.TypeMarshaler{T: GTypeWindow, F: marshalWindow}, + coreglib.TypeMarshaler{T: GTypeWindowControls, F: marshalWindowControls}, + coreglib.TypeMarshaler{T: GTypeWindowGroup, F: marshalWindowGroup}, + coreglib.TypeMarshaler{T: GTypeWindowHandle, F: marshalWindowHandle}, + coreglib.TypeMarshaler{T: GTypeAccessibleList, F: marshalAccessibleList}, + coreglib.TypeMarshaler{T: GTypeBitset, F: marshalBitset}, + coreglib.TypeMarshaler{T: GTypeBitsetIter, F: marshalBitsetIter}, + coreglib.TypeMarshaler{T: GTypeBorder, F: marshalBorder}, + coreglib.TypeMarshaler{T: GTypeCSSSection, F: marshalCSSSection}, + coreglib.TypeMarshaler{T: GTypeExpressionWatch, F: marshalExpressionWatch}, + coreglib.TypeMarshaler{T: GTypePaperSize, F: marshalPaperSize}, + coreglib.TypeMarshaler{T: GTypePrintSetup, F: marshalPrintSetup}, + coreglib.TypeMarshaler{T: GTypeRecentInfo, F: marshalRecentInfo}, + coreglib.TypeMarshaler{T: GTypeRequisition, F: marshalRequisition}, + coreglib.TypeMarshaler{T: GTypeScrollInfo, F: marshalScrollInfo}, + coreglib.TypeMarshaler{T: GTypeTextIter, F: marshalTextIter}, + coreglib.TypeMarshaler{T: GTypeTreeIter, F: marshalTreeIter}, + coreglib.TypeMarshaler{T: GTypeTreePath, F: marshalTreePath}, + coreglib.TypeMarshaler{T: GTypeTreeRowReference, F: marshalTreeRowReference}, + }) +} + +// ACCESSIBLE_ATTRIBUTE_BACKGROUND: attribute for the background color, +// expressed as an RGB value encoded in a string using the format: +// {r8},{g8},{b8}. +const ACCESSIBLE_ATTRIBUTE_BACKGROUND = "bg-color" + +// ACCESSIBLE_ATTRIBUTE_FAMILY: attribute for the font family name. +const ACCESSIBLE_ATTRIBUTE_FAMILY = "family-name" + +// ACCESSIBLE_ATTRIBUTE_FOREGROUND: attribute for the foreground color, +// expressed as an RGB value encoded in a string using the format: +// {r8},{g8},{b8}. +const ACCESSIBLE_ATTRIBUTE_FOREGROUND = "fg-color" + +// ACCESSIBLE_ATTRIBUTE_OVERLINE: attribute for the overline style. +// +// Possible values are: +// +// - gtk.ACCESSIBLEATTRIBUTEOVERLINENONE +// +// - gtk.ACCESSIBLEATTRIBUTEOVERLINESINGLE. +const ACCESSIBLE_ATTRIBUTE_OVERLINE = "overline" + +// ACCESSIBLE_ATTRIBUTE_OVERLINE_NONE: "none" overline value for +// gtk.ACCESSIBLEATTRIBUTEOVERLINE. +const ACCESSIBLE_ATTRIBUTE_OVERLINE_NONE = "none" + +// ACCESSIBLE_ATTRIBUTE_OVERLINE_SINGLE: "single" overline value for +// gtk.ACCESSIBLEATTRIBUTEOVERLINE. +const ACCESSIBLE_ATTRIBUTE_OVERLINE_SINGLE = "single" + +// ACCESSIBLE_ATTRIBUTE_SIZE: attribute for the font size, expressed in points. +const ACCESSIBLE_ATTRIBUTE_SIZE = "size" + +// ACCESSIBLE_ATTRIBUTE_STRETCH: attribute for the font stretch type. +// +// Possible values are: +// +// - gtk.ACCESSIBLEATTRIBUTESTRETCHULTRACONDENSED +// +// - gtk.ACCESSIBLEATTRIBUTESTRETCHEXTRACONDENSED +// +// - gtk.ACCESSIBLEATTRIBUTESTRETCHCONDENSED +// +// - gtk.ACCESSIBLEATTRIBUTESTRETCHSEMICONDENSED. +const ACCESSIBLE_ATTRIBUTE_STRETCH = "stretch" + +// ACCESSIBLE_ATTRIBUTE_STRETCH_CONDENSED: "condensed" stretch value for +// gtk.ACCESSIBLEATTRIBUTESTRETCH. +const ACCESSIBLE_ATTRIBUTE_STRETCH_CONDENSED = "condensed" + +// ACCESSIBLE_ATTRIBUTE_STRETCH_EXPANDED: "expanded" stretch value for +// gtk.ACCESSIBLEATTRIBUTESTRETCH. +const ACCESSIBLE_ATTRIBUTE_STRETCH_EXPANDED = "expanded" + +// ACCESSIBLE_ATTRIBUTE_STRETCH_EXTRA_CONDENSED: "extra condensed" stretch value +// for gtk.ACCESSIBLEATTRIBUTESTRETCH. +const ACCESSIBLE_ATTRIBUTE_STRETCH_EXTRA_CONDENSED = "extra_condensed" + +// ACCESSIBLE_ATTRIBUTE_STRETCH_EXTRA_EXPANDED: "extra expanded" stretch value +// for gtk.ACCESSIBLEATTRIBUTESTRETCH. +const ACCESSIBLE_ATTRIBUTE_STRETCH_EXTRA_EXPANDED = "extra_expanded" + +// ACCESSIBLE_ATTRIBUTE_STRETCH_NORMAL: "normal" stretch value for +// gtk.ACCESSIBLEATTRIBUTESTRETCH. +const ACCESSIBLE_ATTRIBUTE_STRETCH_NORMAL = "normal" + +// ACCESSIBLE_ATTRIBUTE_STRETCH_SEMI_CONDENSED: "semi condensed" stretch value +// for gtk.ACCESSIBLEATTRIBUTESTRETCH. +const ACCESSIBLE_ATTRIBUTE_STRETCH_SEMI_CONDENSED = "semi_condensed" + +// ACCESSIBLE_ATTRIBUTE_STRETCH_SEMI_EXPANDED: "semi expanded" stretch value for +// gtk.ACCESSIBLEATTRIBUTESTRETCH. +const ACCESSIBLE_ATTRIBUTE_STRETCH_SEMI_EXPANDED = "semi_expanded" + +// ACCESSIBLE_ATTRIBUTE_STRETCH_ULTRA_CONDENSED: "ultra condensed" stretch value +// for gtk.ACCESSIBLEATTRIBUTESTRETCH. +const ACCESSIBLE_ATTRIBUTE_STRETCH_ULTRA_CONDENSED = "ultra_condensed" + +// ACCESSIBLE_ATTRIBUTE_STRETCH_ULTRA_EXPANDED: "ultra expanded" stretch value +// for gtk.ACCESSIBLEATTRIBUTESTRETCH. +const ACCESSIBLE_ATTRIBUTE_STRETCH_ULTRA_EXPANDED = "ultra_expanded" + +// ACCESSIBLE_ATTRIBUTE_STRIKETHROUGH: attribute for strikethrough text. +// +// Possible values are true or false. +const ACCESSIBLE_ATTRIBUTE_STRIKETHROUGH = "strikethrough" + +// ACCESSIBLE_ATTRIBUTE_STYLE: attribute for the font style. +// +// Possible values are: +// +// - gtk.ACCESSIBLEATTRIBUTESTYLENORMAL +// +// - gtk.ACCESSIBLEATTRIBUTESTYLEOBLIQUE +// +// - gtk.ACCESSIBLEATTRIBUTESTYLEITALIC. +const ACCESSIBLE_ATTRIBUTE_STYLE = "style" + +// ACCESSIBLE_ATTRIBUTE_STYLE_ITALIC: "italic" style value for +// gtk.ACCESSIBLEATTRIBUTESTYLE. +const ACCESSIBLE_ATTRIBUTE_STYLE_ITALIC = "italic" + +// ACCESSIBLE_ATTRIBUTE_STYLE_NORMAL: "normal" style value for +// gtk.ACCESSIBLEATTRIBUTESTYLE. +const ACCESSIBLE_ATTRIBUTE_STYLE_NORMAL = "normal" + +// ACCESSIBLE_ATTRIBUTE_STYLE_OBLIQUE: "oblique" style value for +// gtk.ACCESSIBLEATTRIBUTESTYLE. +const ACCESSIBLE_ATTRIBUTE_STYLE_OBLIQUE = "oblique" + +// ACCESSIBLE_ATTRIBUTE_UNDERLINE: attribute for the underline style. +// +// Possible values are: +// +// - gtk.ACCESSIBLEATTRIBUTEUNDERLINENONE +// +// - gtk.ACCESSIBLEATTRIBUTEUNDERLINESINGLE +// +// - gtk.ACCESSIBLEATTRIBUTEUNDERLINEDOUBLE +// +// - gtk.ACCESSIBLEATTRIBUTEUNDERLINEERROR. +const ACCESSIBLE_ATTRIBUTE_UNDERLINE = "underline" + +// ACCESSIBLE_ATTRIBUTE_UNDERLINE_DOUBLE: "double" underline value for +// gtk.ACCESSIBLEATTRIBUTEUNDERLINE. +const ACCESSIBLE_ATTRIBUTE_UNDERLINE_DOUBLE = "double" + +// ACCESSIBLE_ATTRIBUTE_UNDERLINE_ERROR: "error" underline value for +// gtk.ACCESSIBLEATTRIBUTEUNDERLINE. +const ACCESSIBLE_ATTRIBUTE_UNDERLINE_ERROR = "error" + +// ACCESSIBLE_ATTRIBUTE_UNDERLINE_NONE: "none" underline value for +// gtk.ACCESSIBLEATTRIBUTEUNDERLINE. +const ACCESSIBLE_ATTRIBUTE_UNDERLINE_NONE = "none" + +// ACCESSIBLE_ATTRIBUTE_UNDERLINE_SINGLE: "single" underline value for +// gtk.ACCESSIBLEATTRIBUTEUNDERLINE. +const ACCESSIBLE_ATTRIBUTE_UNDERLINE_SINGLE = "single" + +// ACCESSIBLE_ATTRIBUTE_VARIANT: attribute for the font variant. +// +// Possible values are: +// +// - gtk.ACCESSIBLEATTRIBUTEVARIANTSMALLCAPS +// +// - gtk.ACCESSIBLEATTRIBUTEVARIANTALLSMALLCAPS +// +// - gtk.ACCESSIBLEATTRIBUTEVARIANTPETITECAPS +// +// - gtk.ACCESSIBLEATTRIBUTEVARIANTALLPETITECAPS +// +// - gtk.ACCESSIBLEATTRIBUTEVARIANTUNICASE +// +// - gtk.ACCESSIBLEATTRIBUTEVARIANTTITLECAPS. +const ACCESSIBLE_ATTRIBUTE_VARIANT = "variant" + +// ACCESSIBLE_ATTRIBUTE_VARIANT_ALL_PETITE_CAPS: "all petite caps" variant value +// for gtk.ACCESSIBLEATTRIBUTEVARIANT. +const ACCESSIBLE_ATTRIBUTE_VARIANT_ALL_PETITE_CAPS = "all-petite-caps" + +// ACCESSIBLE_ATTRIBUTE_VARIANT_ALL_SMALL_CAPS: "all small caps" variant value +// for gtk.ACCESSIBLEATTRIBUTEVARIANT. +const ACCESSIBLE_ATTRIBUTE_VARIANT_ALL_SMALL_CAPS = "all-small-caps" + +// ACCESSIBLE_ATTRIBUTE_VARIANT_PETITE_CAPS: "petite caps" variant value for +// gtk.ACCESSIBLEATTRIBUTEVARIANT. +const ACCESSIBLE_ATTRIBUTE_VARIANT_PETITE_CAPS = "petite-caps" + +// ACCESSIBLE_ATTRIBUTE_VARIANT_SMALL_CAPS: "small caps" variant value for +// gtk.ACCESSIBLEATTRIBUTEVARIANT. +const ACCESSIBLE_ATTRIBUTE_VARIANT_SMALL_CAPS = "small-caps" + +// ACCESSIBLE_ATTRIBUTE_VARIANT_TITLE_CAPS: "title caps" variant value for +// gtk.ACCESSIBLEATTRIBUTEVARIANT. +const ACCESSIBLE_ATTRIBUTE_VARIANT_TITLE_CAPS = "title-caps" + +// ACCESSIBLE_ATTRIBUTE_VARIANT_UNICASE: "unicase" variant value for +// gtk.ACCESSIBLEATTRIBUTEVARIANT. +const ACCESSIBLE_ATTRIBUTE_VARIANT_UNICASE = "unicase" + +// ACCESSIBLE_ATTRIBUTE_WEIGHT: attribute for the font weight. +const ACCESSIBLE_ATTRIBUTE_WEIGHT = "weight" + +// ACCESSIBLE_VALUE_UNDEFINED: undefined value. The accessible attribute is +// either unset, or its value is undefined. +const ACCESSIBLE_VALUE_UNDEFINED = -1 + +// BINARY_AGE: like get_binary_age, but from the headers used at application +// compile time, rather than from the library linked against at application run +// time. +const BINARY_AGE = 1404 +const IM_MODULE_EXTENSION_POINT_NAME = "gtk-im-module" + +// INPUT_ERROR: constant to return from a signal handler for the ::input signal +// in case of conversion failure. +// +// See gtk.SpinButton::input. +const INPUT_ERROR = -1 + +// INTERFACE_AGE: like get_interface_age, but from the headers used at +// application compile time, rather than from the library linked against at +// application run time. +const INTERFACE_AGE = 4 + +// INVALID_LIST_POSITION: value used to refer to a guaranteed invalid position +// in a GListModel. +// +// This value may be returned from some functions, others may accept it as +// input. Its interpretation may differ for different functions. +// +// Refer to each function's documentation for if this value is allowed and what +// it does. +const INVALID_LIST_POSITION = 4294967295 + +// LEVEL_BAR_OFFSET_FULL: name used for the stock full offset included by +// GtkLevelBar. +const LEVEL_BAR_OFFSET_FULL = "full" + +// LEVEL_BAR_OFFSET_HIGH: name used for the stock high offset included by +// GtkLevelBar. +const LEVEL_BAR_OFFSET_HIGH = "high" + +// LEVEL_BAR_OFFSET_LOW: name used for the stock low offset included by +// GtkLevelBar. +const LEVEL_BAR_OFFSET_LOW = "low" + +// MAJOR_VERSION: like get_major_version, but from the headers used at +// application compile time, rather than from the library linked against at +// application run time. +const MAJOR_VERSION = 4 +const MAX_COMPOSE_LEN = 7 +const MEDIA_FILE_EXTENSION_POINT_NAME = "gtk-media-file" + +// MICRO_VERSION: like get_micro_version, but from the headers used at +// application compile time, rather than from the library linked against at +// application run time. +const MICRO_VERSION = 4 + +// MINOR_VERSION: like get_minor_version, but from the headers used at +// application compile time, rather than from the library linked against at +// application run time. +const MINOR_VERSION = 14 + +// PAPER_NAME_A3: name for the A3 paper size. +const PAPER_NAME_A3 = "iso_a3" + +// PAPER_NAME_A4: name for the A4 paper size. +const PAPER_NAME_A4 = "iso_a4" + +// PAPER_NAME_A5: name for the A5 paper size. +const PAPER_NAME_A5 = "iso_a5" + +// PAPER_NAME_B5: name for the B5 paper size. +const PAPER_NAME_B5 = "iso_b5" + +// PAPER_NAME_EXECUTIVE: name for the Executive paper size. +const PAPER_NAME_EXECUTIVE = "na_executive" + +// PAPER_NAME_LEGAL: name for the Legal paper size. +const PAPER_NAME_LEGAL = "na_legal" + +// PAPER_NAME_LETTER: name for the Letter paper size. +const PAPER_NAME_LETTER = "na_letter" +const PRINT_SETTINGS_COLLATE = "collate" +const PRINT_SETTINGS_DEFAULT_SOURCE = "default-source" +const PRINT_SETTINGS_DITHER = "dither" +const PRINT_SETTINGS_DUPLEX = "duplex" +const PRINT_SETTINGS_FINISHINGS = "finishings" +const PRINT_SETTINGS_MEDIA_TYPE = "media-type" +const PRINT_SETTINGS_NUMBER_UP = "number-up" +const PRINT_SETTINGS_NUMBER_UP_LAYOUT = "number-up-layout" +const PRINT_SETTINGS_N_COPIES = "n-copies" +const PRINT_SETTINGS_ORIENTATION = "orientation" + +// PRINT_SETTINGS_OUTPUT_BASENAME: key used by the “Print to file” printer to +// store the file name of the output without the path to the directory and the +// file extension. +const PRINT_SETTINGS_OUTPUT_BASENAME = "output-basename" +const PRINT_SETTINGS_OUTPUT_BIN = "output-bin" + +// PRINT_SETTINGS_OUTPUT_DIR: key used by the “Print to file” printer to store +// the directory to which the output should be written. +const PRINT_SETTINGS_OUTPUT_DIR = "output-dir" + +// PRINT_SETTINGS_OUTPUT_FILE_FORMAT: key used by the “Print to file” printer to +// store the format of the output. The supported values are “PS” and “PDF”. +const PRINT_SETTINGS_OUTPUT_FILE_FORMAT = "output-file-format" + +// PRINT_SETTINGS_OUTPUT_URI: key used by the “Print to file” printer to store +// the URI to which the output should be written. GTK itself supports only +// “file://” URIs. +const PRINT_SETTINGS_OUTPUT_URI = "output-uri" +const PRINT_SETTINGS_PAGE_RANGES = "page-ranges" +const PRINT_SETTINGS_PAGE_SET = "page-set" +const PRINT_SETTINGS_PAPER_FORMAT = "paper-format" +const PRINT_SETTINGS_PAPER_HEIGHT = "paper-height" +const PRINT_SETTINGS_PAPER_WIDTH = "paper-width" +const PRINT_SETTINGS_PRINTER = "printer" +const PRINT_SETTINGS_PRINTER_LPI = "printer-lpi" +const PRINT_SETTINGS_PRINT_PAGES = "print-pages" +const PRINT_SETTINGS_QUALITY = "quality" +const PRINT_SETTINGS_RESOLUTION = "resolution" +const PRINT_SETTINGS_RESOLUTION_X = "resolution-x" +const PRINT_SETTINGS_RESOLUTION_Y = "resolution-y" +const PRINT_SETTINGS_REVERSE = "reverse" +const PRINT_SETTINGS_SCALE = "scale" +const PRINT_SETTINGS_USE_COLOR = "use-color" +const PRINT_SETTINGS_WIN32_DRIVER_EXTRA = "win32-driver-extra" +const PRINT_SETTINGS_WIN32_DRIVER_VERSION = "win32-driver-version" + +// PRIORITY_RESIZE: use this priority for functionality related to size +// allocation. +// +// It is used internally by GTK+ to compute the sizes of widgets. This priority +// is higher than GDK_PRIORITY_REDRAW to avoid resizing a widget which was just +// redrawn. +const PRIORITY_RESIZE = 110 + +// STYLE_PROVIDER_PRIORITY_APPLICATION: priority that can be used when adding a +// GtkStyleProvider for application-specific style information. +const STYLE_PROVIDER_PRIORITY_APPLICATION = 600 + +// STYLE_PROVIDER_PRIORITY_FALLBACK: priority used for default style information +// that is used in the absence of themes. +// +// Note that this is not very useful for providing default styling for custom +// style classes - themes are likely to override styling provided at this +// priority with catch-all * {...} rules. +const STYLE_PROVIDER_PRIORITY_FALLBACK = 1 + +// STYLE_PROVIDER_PRIORITY_SETTINGS: priority used for style information +// provided via GtkSettings. +// +// This priority is higher than GTK_STYLE_PROVIDER_PRIORITY_THEME to let +// settings override themes. +const STYLE_PROVIDER_PRIORITY_SETTINGS = 400 + +// STYLE_PROVIDER_PRIORITY_THEME: priority used for style information provided +// by themes. +const STYLE_PROVIDER_PRIORITY_THEME = 200 + +// STYLE_PROVIDER_PRIORITY_USER: priority used for the style information from +// $XDG_CONFIG_HOME/gtk-4.0/gtk.css. +// +// You should not use priorities higher than this, to give the user the last +// word. +const STYLE_PROVIDER_PRIORITY_USER = 800 + +// TEXT_VIEW_PRIORITY_VALIDATE: priority at which the text view validates +// onscreen lines in an idle job in the background. +const TEXT_VIEW_PRIORITY_VALIDATE = 125 + +// TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID uses the default sort function in a +// gtk.TreeSortable. +// +// See also: gtk.TreeSortable.SetSortColumnID(). +const TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID = -1 + +// TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID disables sorting in a gtk.TreeSortable. +// +// See also: gtk.TreeSortable.SetSortColumnID(). +const TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID = -2 + +// Allocation: rectangle representing the area allocated for a widget by its +// parent. +type Allocation = gdk.Rectangle + +// AccessibleAnnouncementPriority: priority of an accessibility announcement. +type AccessibleAnnouncementPriority C.gint + +const ( + AccessibleAnnouncementPriorityLow AccessibleAnnouncementPriority = iota + AccessibleAnnouncementPriorityMedium + AccessibleAnnouncementPriorityHigh +) + +func marshalAccessibleAnnouncementPriority(p uintptr) (interface{}, error) { + return AccessibleAnnouncementPriority(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleAnnouncementPriority. +func (a AccessibleAnnouncementPriority) String() string { + switch a { + case AccessibleAnnouncementPriorityLow: + return "Low" + case AccessibleAnnouncementPriorityMedium: + return "Medium" + case AccessibleAnnouncementPriorityHigh: + return "High" + default: + return fmt.Sprintf("AccessibleAnnouncementPriority(%d)", a) + } +} + +// AccessibleAutocomplete: possible values for the +// GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE accessible property. +type AccessibleAutocomplete C.gint + +const ( + // AccessibleAutocompleteNone: automatic suggestions are not displayed. + AccessibleAutocompleteNone AccessibleAutocomplete = iota + // AccessibleAutocompleteInline: when a user is providing input, text + // suggesting one way to complete the provided input may be dynamically + // inserted after the caret. + AccessibleAutocompleteInline + // AccessibleAutocompleteList: when a user is providing input, an element + // containing a collection of values that could complete the provided input + // may be displayed. + AccessibleAutocompleteList + // AccessibleAutocompleteBoth: when a user is providing input, an element + // containing a collection of values that could complete the provided + // input may be displayed. If displayed, one value in the collection is + // automatically selected, and the text needed to complete the automatically + // selected value appears after the caret in the input. + AccessibleAutocompleteBoth +) + +func marshalAccessibleAutocomplete(p uintptr) (interface{}, error) { + return AccessibleAutocomplete(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleAutocomplete. +func (a AccessibleAutocomplete) String() string { + switch a { + case AccessibleAutocompleteNone: + return "None" + case AccessibleAutocompleteInline: + return "Inline" + case AccessibleAutocompleteList: + return "List" + case AccessibleAutocompleteBoth: + return "Both" + default: + return fmt.Sprintf("AccessibleAutocomplete(%d)", a) + } +} + +// AccessibleInvalidState: possible values for the GTK_ACCESSIBLE_STATE_INVALID +// accessible state. +// +// Note that the GTK_ACCESSIBLE_INVALID_FALSE and GTK_ACCESSIBLE_INVALID_TRUE +// have the same values as FALSE and TRUE. +type AccessibleInvalidState C.gint + +const ( + // AccessibleInvalidFalse: there are no detected errors in the value. + AccessibleInvalidFalse AccessibleInvalidState = iota + // AccessibleInvalidTrue: value entered by the user has failed validation. + AccessibleInvalidTrue + // AccessibleInvalidGrammar: grammatical error was detected. + AccessibleInvalidGrammar + // AccessibleInvalidSpelling: spelling error was detected. + AccessibleInvalidSpelling +) + +func marshalAccessibleInvalidState(p uintptr) (interface{}, error) { + return AccessibleInvalidState(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleInvalidState. +func (a AccessibleInvalidState) String() string { + switch a { + case AccessibleInvalidFalse: + return "False" + case AccessibleInvalidTrue: + return "True" + case AccessibleInvalidGrammar: + return "Grammar" + case AccessibleInvalidSpelling: + return "Spelling" + default: + return fmt.Sprintf("AccessibleInvalidState(%d)", a) + } +} + +// AccessiblePlatformState various platform states which can be queried using +// gtk.Accessible.GetPlatformState(). +type AccessiblePlatformState C.gint + +const ( + // AccessiblePlatformStateFocusable: whether the accessible can be focused. + AccessiblePlatformStateFocusable AccessiblePlatformState = iota + // AccessiblePlatformStateFocused: whether the accessible has focus. + AccessiblePlatformStateFocused + // AccessiblePlatformStateActive: whether the accessible is active. + AccessiblePlatformStateActive +) + +func marshalAccessiblePlatformState(p uintptr) (interface{}, error) { + return AccessiblePlatformState(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessiblePlatformState. +func (a AccessiblePlatformState) String() string { + switch a { + case AccessiblePlatformStateFocusable: + return "Focusable" + case AccessiblePlatformStateFocused: + return "Focused" + case AccessiblePlatformStateActive: + return "Active" + default: + return fmt.Sprintf("AccessiblePlatformState(%d)", a) + } +} + +// AccessibleProperty: possible accessible properties of a accessible. +type AccessibleProperty C.gint + +const ( + // AccessiblePropertyAutocomplete indicates whether inputting text could + // trigger display of one or more predictions of the user's intended value + // for a combobox, searchbox, or textbox and specifies how predictions would + // be presented if they were made. Value type: accessibleautocomplete. + AccessiblePropertyAutocomplete AccessibleProperty = iota + // AccessiblePropertyDescription defines a string value that describes or + // annotates the current element. Value type: string. + AccessiblePropertyDescription + // AccessiblePropertyHasPopup indicates the availability and type of + // interactive popup element, such as menu or dialog, that can be triggered + // by an element. + AccessiblePropertyHasPopup + // AccessiblePropertyKeyShortcuts indicates keyboard shortcuts that an + // author has implemented to activate or give focus to an element. Value + // type: string. + AccessiblePropertyKeyShortcuts + // AccessiblePropertyLabel defines a string value that labels the current + // element. Value type: string. + AccessiblePropertyLabel + // AccessiblePropertyLevel defines the hierarchical level of an element + // within a structure. Value type: integer. + AccessiblePropertyLevel + // AccessiblePropertyModal indicates whether an element is modal when + // displayed. Value type: boolean. + AccessiblePropertyModal + // AccessiblePropertyMultiLine indicates whether a text box accepts multiple + // lines of input or only a single line. Value type: boolean. + AccessiblePropertyMultiLine + // AccessiblePropertyMultiSelectable indicates that the user may select + // more than one item from the current selectable descendants. Value type: + // boolean. + AccessiblePropertyMultiSelectable + // AccessiblePropertyOrientation indicates whether the element's orientation + // is horizontal, vertical, or unknown/ambiguous. Value type: orientation. + AccessiblePropertyOrientation + // AccessiblePropertyPlaceholder defines a short hint (a word or short + // phrase) intended to aid the user with data entry when the control has + // no value. A hint could be a sample value or a brief description of the + // expected format. Value type: string. + AccessiblePropertyPlaceholder + // AccessiblePropertyReadOnly indicates that the element is not editable, + // but is otherwise operable. Value type: boolean. + AccessiblePropertyReadOnly + // AccessiblePropertyRequired indicates that user input is required on the + // element before a form may be submitted. Value type: boolean. + AccessiblePropertyRequired + // AccessiblePropertyRoleDescription defines a human-readable, + // author-localized description for the role of an element. Value type: + // string. + AccessiblePropertyRoleDescription + // AccessiblePropertySort indicates if items in a table or grid are sorted + // in ascending or descending order. Value type: accessiblesort. + AccessiblePropertySort + // AccessiblePropertyValueMax defines the maximum allowed value for a range + // widget. Value type: double. + AccessiblePropertyValueMax + // AccessiblePropertyValueMin defines the minimum allowed value for a range + // widget. Value type: double. + AccessiblePropertyValueMin + // AccessiblePropertyValueNow defines the current value for a range widget. + // Value type: double. + AccessiblePropertyValueNow + // AccessiblePropertyValueText defines the human readable text alternative + // of aria-valuenow for a range widget. Value type: string. + AccessiblePropertyValueText +) + +func marshalAccessibleProperty(p uintptr) (interface{}, error) { + return AccessibleProperty(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleProperty. +func (a AccessibleProperty) String() string { + switch a { + case AccessiblePropertyAutocomplete: + return "Autocomplete" + case AccessiblePropertyDescription: + return "Description" + case AccessiblePropertyHasPopup: + return "HasPopup" + case AccessiblePropertyKeyShortcuts: + return "KeyShortcuts" + case AccessiblePropertyLabel: + return "Label" + case AccessiblePropertyLevel: + return "Level" + case AccessiblePropertyModal: + return "Modal" + case AccessiblePropertyMultiLine: + return "MultiLine" + case AccessiblePropertyMultiSelectable: + return "MultiSelectable" + case AccessiblePropertyOrientation: + return "Orientation" + case AccessiblePropertyPlaceholder: + return "Placeholder" + case AccessiblePropertyReadOnly: + return "ReadOnly" + case AccessiblePropertyRequired: + return "Required" + case AccessiblePropertyRoleDescription: + return "RoleDescription" + case AccessiblePropertySort: + return "Sort" + case AccessiblePropertyValueMax: + return "ValueMax" + case AccessiblePropertyValueMin: + return "ValueMin" + case AccessiblePropertyValueNow: + return "ValueNow" + case AccessiblePropertyValueText: + return "ValueText" + default: + return fmt.Sprintf("AccessibleProperty(%d)", a) + } +} + +// The function takes the following parameters: +// +// - property +// - value +func AccessiblePropertyInitValue(property AccessibleProperty, value *coreglib.Value) { + var _arg1 C.GtkAccessibleProperty // out + var _arg2 *C.GValue // out + + _arg1 = C.GtkAccessibleProperty(property) + _arg2 = (*C.GValue)(unsafe.Pointer(value.Native())) + + C.gtk_accessible_property_init_value(_arg1, _arg2) + runtime.KeepAlive(property) + runtime.KeepAlive(value) +} + +// AccessibleRelation: possible accessible relations of a accessible. +// +// Accessible relations can be references to other widgets, integers or strings. +type AccessibleRelation C.gint + +const ( + // AccessibleRelationActiveDescendant identifies the currently active + // element when focus is on a composite widget, combobox, textbox, group, + // or application. Value type: reference. + AccessibleRelationActiveDescendant AccessibleRelation = iota + // AccessibleRelationColCount defines the total number of columns in a + // table, grid, or treegrid. Value type: integer. + AccessibleRelationColCount + // AccessibleRelationColIndex defines an element's column index or position + // with respect to the total number of columns within a table, grid, + // or treegrid. Value type: integer. + AccessibleRelationColIndex + // AccessibleRelationColIndexText defines a human readable text alternative + // of GTK_ACCESSIBLE_RELATION_COL_INDEX. Value type: string. + AccessibleRelationColIndexText + // AccessibleRelationColSpan defines the number of columns spanned by a cell + // or gridcell within a table, grid, or treegrid. Value type: integer. + AccessibleRelationColSpan + // AccessibleRelationControls identifies the element (or elements) whose + // contents or presence are controlled by the current element. Value type: + // reference. + AccessibleRelationControls + // AccessibleRelationDescribedBy identifies the element (or elements) that + // describes the object. Value type: reference. + AccessibleRelationDescribedBy + // AccessibleRelationDetails identifies the element (or elements) that + // provide additional information related to the object. Value type: + // reference. + AccessibleRelationDetails + // AccessibleRelationErrorMessage identifies the element that provides an + // error message for an object. Value type: reference. + AccessibleRelationErrorMessage + // AccessibleRelationFlowTo identifies the next element (or elements) in + // an alternate reading order of content which, at the user's discretion, + // allows assistive technology to override the general default of reading in + // document source order. Value type: reference. + AccessibleRelationFlowTo + // AccessibleRelationLabelledBy identifies the element (or elements) that + // labels the current element. Value type: reference. + AccessibleRelationLabelledBy + // AccessibleRelationOwns identifies an element (or elements) in order to + // define a visual, functional, or contextual parent/child relationship + // between elements where the widget hierarchy cannot be used to represent + // the relationship. Value type: reference. + AccessibleRelationOwns + // AccessibleRelationPosInSet defines an element's number or position in the + // current set of listitems or treeitems. Value type: integer. + AccessibleRelationPosInSet + // AccessibleRelationRowCount defines the total number of rows in a table, + // grid, or treegrid. Value type: integer. + AccessibleRelationRowCount + // AccessibleRelationRowIndex defines an element's row index or position + // with respect to the total number of rows within a table, grid, + // or treegrid. Value type: integer. + AccessibleRelationRowIndex + // AccessibleRelationRowIndexText defines a human readable text alternative + // of aria-rowindex. Value type: string. + AccessibleRelationRowIndexText + // AccessibleRelationRowSpan defines the number of rows spanned by a cell or + // gridcell within a table, grid, or treegrid. Value type: integer. + AccessibleRelationRowSpan + // AccessibleRelationSetSize defines the number of items in the current set + // of listitems or treeitems. Value type: integer. + AccessibleRelationSetSize +) + +func marshalAccessibleRelation(p uintptr) (interface{}, error) { + return AccessibleRelation(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleRelation. +func (a AccessibleRelation) String() string { + switch a { + case AccessibleRelationActiveDescendant: + return "ActiveDescendant" + case AccessibleRelationColCount: + return "ColCount" + case AccessibleRelationColIndex: + return "ColIndex" + case AccessibleRelationColIndexText: + return "ColIndexText" + case AccessibleRelationColSpan: + return "ColSpan" + case AccessibleRelationControls: + return "Controls" + case AccessibleRelationDescribedBy: + return "DescribedBy" + case AccessibleRelationDetails: + return "Details" + case AccessibleRelationErrorMessage: + return "ErrorMessage" + case AccessibleRelationFlowTo: + return "FlowTo" + case AccessibleRelationLabelledBy: + return "LabelledBy" + case AccessibleRelationOwns: + return "Owns" + case AccessibleRelationPosInSet: + return "PosInSet" + case AccessibleRelationRowCount: + return "RowCount" + case AccessibleRelationRowIndex: + return "RowIndex" + case AccessibleRelationRowIndexText: + return "RowIndexText" + case AccessibleRelationRowSpan: + return "RowSpan" + case AccessibleRelationSetSize: + return "SetSize" + default: + return fmt.Sprintf("AccessibleRelation(%d)", a) + } +} + +// The function takes the following parameters: +// +// - relation +// - value +func AccessibleRelationInitValue(relation AccessibleRelation, value *coreglib.Value) { + var _arg1 C.GtkAccessibleRelation // out + var _arg2 *C.GValue // out + + _arg1 = C.GtkAccessibleRelation(relation) + _arg2 = (*C.GValue)(unsafe.Pointer(value.Native())) + + C.gtk_accessible_relation_init_value(_arg1, _arg2) + runtime.KeepAlive(relation) + runtime.KeepAlive(value) +} + +// AccessibleRole: accessible role for a accessible implementation. +// +// Abstract roles are only used as part of the ontology; application developers +// must not use abstract roles in their code. +type AccessibleRole C.gint + +const ( + // AccessibleRoleAlert: element with important, and usually time-sensitive, + // information. + AccessibleRoleAlert AccessibleRole = iota + // AccessibleRoleAlertDialog: type of dialog that contains an alert message. + AccessibleRoleAlertDialog + // AccessibleRoleBanner: unused. + AccessibleRoleBanner + // AccessibleRoleButton: input element that allows for user-triggered + // actions when clicked or pressed. + AccessibleRoleButton + // AccessibleRoleCaption: unused. + AccessibleRoleCaption + // AccessibleRoleCell: unused. + AccessibleRoleCell + // AccessibleRoleCheckbox: checkable input element that has three possible + // values: true, false, or mixed. + AccessibleRoleCheckbox + // AccessibleRoleColumnHeader: header in a columned list. + AccessibleRoleColumnHeader + // AccessibleRoleComboBox: input that controls another element, such as + // a list or a grid, that can dynamically pop up to help the user set the + // value of the input. + AccessibleRoleComboBox + // AccessibleRoleCommand: abstract role. + AccessibleRoleCommand + // AccessibleRoleComposite: abstract role. + AccessibleRoleComposite + // AccessibleRoleDialog: dialog is a window that is designed to interrupt + // the current processing of an application in order to prompt the user to + // enter information or require a response. + AccessibleRoleDialog + // AccessibleRoleDocument: content that assistive technology users may want + // to browse in a reading mode. + AccessibleRoleDocument + // AccessibleRoleFeed: unused. + AccessibleRoleFeed + // AccessibleRoleForm: unused. + AccessibleRoleForm + // AccessibleRoleGeneric nameless container that has no semantic meaning of + // its own. This is the role that GTK uses by default for widgets. + AccessibleRoleGeneric + // AccessibleRoleGrid: grid of items. + AccessibleRoleGrid + // AccessibleRoleGridCell: item in a grid or tree grid. + AccessibleRoleGridCell + // AccessibleRoleGroup: element that groups multiple related widgets. + // GTK uses this role for various containers, like gtk.HeaderBar or + // gtk.Notebook. + AccessibleRoleGroup + // AccessibleRoleHeading: unused. + AccessibleRoleHeading + // AccessibleRoleImg: image. + AccessibleRoleImg + // AccessibleRoleInput: abstract role. + AccessibleRoleInput + // AccessibleRoleLabel: visible name or caption for a user interface + // component. + AccessibleRoleLabel + // AccessibleRoleLandmark: abstract role. + AccessibleRoleLandmark + // AccessibleRoleLegend: unused. + AccessibleRoleLegend + // AccessibleRoleLink: clickable link. + AccessibleRoleLink + // AccessibleRoleList: list of items. + AccessibleRoleList + // AccessibleRoleListBox: unused. + AccessibleRoleListBox + // AccessibleRoleListItem: item in a list. + AccessibleRoleListItem + // AccessibleRoleLog: unused. + AccessibleRoleLog + // AccessibleRoleMain: unused. + AccessibleRoleMain + // AccessibleRoleMarquee: unused. + AccessibleRoleMarquee + // AccessibleRoleMath: unused. + AccessibleRoleMath + // AccessibleRoleMeter: element that represents a value within a known + // range. + AccessibleRoleMeter + // AccessibleRoleMenu: menu. + AccessibleRoleMenu + // AccessibleRoleMenuBar: menubar. + AccessibleRoleMenuBar + // AccessibleRoleMenuItem: item in a menu. + AccessibleRoleMenuItem + // AccessibleRoleMenuItemCheckbox: check item in a menu. + AccessibleRoleMenuItemCheckbox + // AccessibleRoleMenuItemRadio: radio item in a menu. + AccessibleRoleMenuItemRadio + // AccessibleRoleNavigation: unused. + AccessibleRoleNavigation + // AccessibleRoleNone: element that is not represented to + // accessibility technologies. This role is synonymous to + // GTK_ACCESSIBLE_ROLE_PRESENTATION. + AccessibleRoleNone + // AccessibleRoleNote: unused. + AccessibleRoleNote + // AccessibleRoleOption: unused. + AccessibleRoleOption + // AccessibleRolePresentation: element that is not represented + // to accessibility technologies. This role is synonymous to + // GTK_ACCESSIBLE_ROLE_NONE. + AccessibleRolePresentation + // AccessibleRoleProgressBar: element that displays the progress status for + // tasks that take a long time. + AccessibleRoleProgressBar + // AccessibleRoleRadio: checkable input in a group of radio roles, only one + // of which can be checked at a time. + AccessibleRoleRadio + // AccessibleRoleRadioGroup: unused. + AccessibleRoleRadioGroup + // AccessibleRoleRange: abstract role. + AccessibleRoleRange + // AccessibleRoleRegion: unused. + AccessibleRoleRegion + // AccessibleRoleRow: row in a columned list. + AccessibleRoleRow + // AccessibleRoleRowGroup: unused. + AccessibleRoleRowGroup + // AccessibleRoleRowHeader: unused. + AccessibleRoleRowHeader + // AccessibleRoleScrollbar: graphical object that controls the scrolling of + // content within a viewing area, regardless of whether the content is fully + // displayed within the viewing area. + AccessibleRoleScrollbar + // AccessibleRoleSearch: unused. + AccessibleRoleSearch + // AccessibleRoleSearchBox: type of textbox intended for specifying search + // criteria. + AccessibleRoleSearchBox + // AccessibleRoleSection: abstract role. + AccessibleRoleSection + // AccessibleRoleSectionHead: abstract role. + AccessibleRoleSectionHead + // AccessibleRoleSelect: abstract role. + AccessibleRoleSelect + // AccessibleRoleSeparator: divider that separates and distinguishes + // sections of content or groups of menuitems. + AccessibleRoleSeparator + // AccessibleRoleSlider: user input where the user selects a value from + // within a given range. + AccessibleRoleSlider + // AccessibleRoleSpinButton: form of range that expects the user to select + // from among discrete choices. + AccessibleRoleSpinButton + // AccessibleRoleStatus: unused. + AccessibleRoleStatus + // AccessibleRoleStructure: abstract role. + AccessibleRoleStructure + // AccessibleRoleSwitch: type of checkbox that represents on/off values, + // as opposed to checked/unchecked values. + AccessibleRoleSwitch + // AccessibleRoleTab: item in a list of tab used for switching pages. + AccessibleRoleTab + // AccessibleRoleTable: unused. + AccessibleRoleTable + // AccessibleRoleTabList: list of tabs for switching pages. + AccessibleRoleTabList + // AccessibleRoleTabPanel: page in a notebook or stack. + AccessibleRoleTabPanel + // AccessibleRoleTextBox: type of input that allows free-form text as its + // value. + AccessibleRoleTextBox + // AccessibleRoleTime: unused. + AccessibleRoleTime + // AccessibleRoleTimer: unused. + AccessibleRoleTimer + // AccessibleRoleToolbar: unused. + AccessibleRoleToolbar + // AccessibleRoleTooltip: unused. + AccessibleRoleTooltip + // AccessibleRoleTree: unused. + AccessibleRoleTree + // AccessibleRoleTreeGrid: treeview-like, columned list. + AccessibleRoleTreeGrid + // AccessibleRoleTreeItem: unused. + AccessibleRoleTreeItem + // AccessibleRoleWidget: abstract role for interactive components of a + // graphical user interface. + AccessibleRoleWidget + // AccessibleRoleWindow: abstract role for windows. + AccessibleRoleWindow + // AccessibleRoleToggleButton: type of push button which stays pressed until + // depressed by a second activation. + AccessibleRoleToggleButton + // AccessibleRoleApplication: toplevel element of a graphical user + // interface. + // + // This is the role that GTK uses by default for windows. + AccessibleRoleApplication + // AccessibleRoleParagraph: paragraph of content. + AccessibleRoleParagraph + // AccessibleRoleBlockQuote: section of content that is quoted from another + // source. + AccessibleRoleBlockQuote + // AccessibleRoleArticle: section of a page that consists of a composition + // that forms an independent part of a document, page, or site. + AccessibleRoleArticle + // AccessibleRoleComment: comment contains content expressing reaction to + // other content. + AccessibleRoleComment + // AccessibleRoleTerminal: virtual terminal. + AccessibleRoleTerminal +) + +func marshalAccessibleRole(p uintptr) (interface{}, error) { + return AccessibleRole(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleRole. +func (a AccessibleRole) String() string { + switch a { + case AccessibleRoleAlert: + return "Alert" + case AccessibleRoleAlertDialog: + return "AlertDialog" + case AccessibleRoleBanner: + return "Banner" + case AccessibleRoleButton: + return "Button" + case AccessibleRoleCaption: + return "Caption" + case AccessibleRoleCell: + return "Cell" + case AccessibleRoleCheckbox: + return "Checkbox" + case AccessibleRoleColumnHeader: + return "ColumnHeader" + case AccessibleRoleComboBox: + return "ComboBox" + case AccessibleRoleCommand: + return "Command" + case AccessibleRoleComposite: + return "Composite" + case AccessibleRoleDialog: + return "Dialog" + case AccessibleRoleDocument: + return "Document" + case AccessibleRoleFeed: + return "Feed" + case AccessibleRoleForm: + return "Form" + case AccessibleRoleGeneric: + return "Generic" + case AccessibleRoleGrid: + return "Grid" + case AccessibleRoleGridCell: + return "GridCell" + case AccessibleRoleGroup: + return "Group" + case AccessibleRoleHeading: + return "Heading" + case AccessibleRoleImg: + return "Img" + case AccessibleRoleInput: + return "Input" + case AccessibleRoleLabel: + return "Label" + case AccessibleRoleLandmark: + return "Landmark" + case AccessibleRoleLegend: + return "Legend" + case AccessibleRoleLink: + return "Link" + case AccessibleRoleList: + return "List" + case AccessibleRoleListBox: + return "ListBox" + case AccessibleRoleListItem: + return "ListItem" + case AccessibleRoleLog: + return "Log" + case AccessibleRoleMain: + return "Main" + case AccessibleRoleMarquee: + return "Marquee" + case AccessibleRoleMath: + return "Math" + case AccessibleRoleMeter: + return "Meter" + case AccessibleRoleMenu: + return "Menu" + case AccessibleRoleMenuBar: + return "MenuBar" + case AccessibleRoleMenuItem: + return "MenuItem" + case AccessibleRoleMenuItemCheckbox: + return "MenuItemCheckbox" + case AccessibleRoleMenuItemRadio: + return "MenuItemRadio" + case AccessibleRoleNavigation: + return "Navigation" + case AccessibleRoleNone: + return "None" + case AccessibleRoleNote: + return "Note" + case AccessibleRoleOption: + return "Option" + case AccessibleRolePresentation: + return "Presentation" + case AccessibleRoleProgressBar: + return "ProgressBar" + case AccessibleRoleRadio: + return "Radio" + case AccessibleRoleRadioGroup: + return "RadioGroup" + case AccessibleRoleRange: + return "Range" + case AccessibleRoleRegion: + return "Region" + case AccessibleRoleRow: + return "Row" + case AccessibleRoleRowGroup: + return "RowGroup" + case AccessibleRoleRowHeader: + return "RowHeader" + case AccessibleRoleScrollbar: + return "Scrollbar" + case AccessibleRoleSearch: + return "Search" + case AccessibleRoleSearchBox: + return "SearchBox" + case AccessibleRoleSection: + return "Section" + case AccessibleRoleSectionHead: + return "SectionHead" + case AccessibleRoleSelect: + return "Select" + case AccessibleRoleSeparator: + return "Separator" + case AccessibleRoleSlider: + return "Slider" + case AccessibleRoleSpinButton: + return "SpinButton" + case AccessibleRoleStatus: + return "Status" + case AccessibleRoleStructure: + return "Structure" + case AccessibleRoleSwitch: + return "Switch" + case AccessibleRoleTab: + return "Tab" + case AccessibleRoleTable: + return "Table" + case AccessibleRoleTabList: + return "TabList" + case AccessibleRoleTabPanel: + return "TabPanel" + case AccessibleRoleTextBox: + return "TextBox" + case AccessibleRoleTime: + return "Time" + case AccessibleRoleTimer: + return "Timer" + case AccessibleRoleToolbar: + return "Toolbar" + case AccessibleRoleTooltip: + return "Tooltip" + case AccessibleRoleTree: + return "Tree" + case AccessibleRoleTreeGrid: + return "TreeGrid" + case AccessibleRoleTreeItem: + return "TreeItem" + case AccessibleRoleWidget: + return "Widget" + case AccessibleRoleWindow: + return "Window" + case AccessibleRoleToggleButton: + return "ToggleButton" + case AccessibleRoleApplication: + return "Application" + case AccessibleRoleParagraph: + return "Paragraph" + case AccessibleRoleBlockQuote: + return "BlockQuote" + case AccessibleRoleArticle: + return "Article" + case AccessibleRoleComment: + return "Comment" + case AccessibleRoleTerminal: + return "Terminal" + default: + return fmt.Sprintf("AccessibleRole(%d)", a) + } +} + +// AccessibleSort: possible values for the GTK_ACCESSIBLE_PROPERTY_SORT +// accessible property. +type AccessibleSort C.gint + +const ( + // AccessibleSortNone: there is no defined sort applied to the column. + AccessibleSortNone AccessibleSort = iota + // AccessibleSortAscending items are sorted in ascending order by this + // column. + AccessibleSortAscending + // AccessibleSortDescending items are sorted in descending order by this + // column. + AccessibleSortDescending + // AccessibleSortOther: sort algorithm other than ascending or descending + // has been applied. + AccessibleSortOther +) + +func marshalAccessibleSort(p uintptr) (interface{}, error) { + return AccessibleSort(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleSort. +func (a AccessibleSort) String() string { + switch a { + case AccessibleSortNone: + return "None" + case AccessibleSortAscending: + return "Ascending" + case AccessibleSortDescending: + return "Descending" + case AccessibleSortOther: + return "Other" + default: + return fmt.Sprintf("AccessibleSort(%d)", a) + } +} + +// AccessibleState: possible accessible states of a accessible. +type AccessibleState C.gint + +const ( + // AccessibleStateBusy: “busy” state. This state has boolean values. + AccessibleStateBusy AccessibleState = iota + // AccessibleStateChecked: “checked” state; indicates the current state of a + // checkbutton. Value type: accessibletristate. + AccessibleStateChecked + // AccessibleStateDisabled: “disabled” state; corresponds to the + // widget:sensitive property. It indicates a UI element that is perceivable, + // but not editable or operable. Value type: boolean. + AccessibleStateDisabled + // AccessibleStateExpanded: “expanded” state; corresponds to the + // expander:expanded property. Value type: boolean or undefined. + AccessibleStateExpanded + // AccessibleStateHidden: “hidden” state; corresponds to the widget:visible + // property. You can use this state explicitly on UI elements that should + // not be exposed to an assistive technology. Value type: boolean See also: + // GTK_ACCESSIBLE_STATE_DISABLED. + AccessibleStateHidden + // AccessibleStateInvalid: “invalid” state; set when a widget is showing an + // error. Value type: accessibleinvalidstate. + AccessibleStateInvalid + // AccessibleStatePressed: “pressed” state; indicates the current state of a + // togglebutton. Value type: accessibletristate enumeration. + AccessibleStatePressed + // AccessibleStateSelected: “selected” state; set when a widget is selected. + // Value type: boolean or undefined. + AccessibleStateSelected + // AccessibleStateVisited indicates that a widget with the + // GTK_ACCESSIBLE_ROLE_LINK has been visited. Value type: boolean. + AccessibleStateVisited +) + +func marshalAccessibleState(p uintptr) (interface{}, error) { + return AccessibleState(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleState. +func (a AccessibleState) String() string { + switch a { + case AccessibleStateBusy: + return "Busy" + case AccessibleStateChecked: + return "Checked" + case AccessibleStateDisabled: + return "Disabled" + case AccessibleStateExpanded: + return "Expanded" + case AccessibleStateHidden: + return "Hidden" + case AccessibleStateInvalid: + return "Invalid" + case AccessibleStatePressed: + return "Pressed" + case AccessibleStateSelected: + return "Selected" + case AccessibleStateVisited: + return "Visited" + default: + return fmt.Sprintf("AccessibleState(%d)", a) + } +} + +// The function takes the following parameters: +// +// - state +// - value +func AccessibleStateInitValue(state AccessibleState, value *coreglib.Value) { + var _arg1 C.GtkAccessibleState // out + var _arg2 *C.GValue // out + + _arg1 = C.GtkAccessibleState(state) + _arg2 = (*C.GValue)(unsafe.Pointer(value.Native())) + + C.gtk_accessible_state_init_value(_arg1, _arg2) + runtime.KeepAlive(state) + runtime.KeepAlive(value) +} + +// AccessibleTextContentChange: type of contents change operation. +type AccessibleTextContentChange C.gint + +const ( + // AccessibleTextContentChangeInsert contents change as the result of an + // insert operation. + AccessibleTextContentChangeInsert AccessibleTextContentChange = iota + // AccessibleTextContentChangeRemove contents change as the result of a + // remove operation. + AccessibleTextContentChangeRemove +) + +func marshalAccessibleTextContentChange(p uintptr) (interface{}, error) { + return AccessibleTextContentChange(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleTextContentChange. +func (a AccessibleTextContentChange) String() string { + switch a { + case AccessibleTextContentChangeInsert: + return "Insert" + case AccessibleTextContentChangeRemove: + return "Remove" + default: + return fmt.Sprintf("AccessibleTextContentChange(%d)", a) + } +} + +// AccessibleTextGranularity: granularity for queries about the text contents of +// a gtk.AccessibleText implementation. +type AccessibleTextGranularity C.gint + +const ( + // AccessibleTextGranularityCharacter: use the boundary between characters + // (including non-printing characters). + AccessibleTextGranularityCharacter AccessibleTextGranularity = iota + // AccessibleTextGranularityWord: use the boundary between words, starting + // from the beginning of the current word and ending at the beginning of the + // next word. + AccessibleTextGranularityWord + // AccessibleTextGranularitySentence: use the boundary between sentences, + // starting from the beginning of the current sentence and ending at the + // beginning of the next sentence. + AccessibleTextGranularitySentence + // AccessibleTextGranularityLine: use the boundary between lines, starting + // from the beginning of the current line and ending at the beginning of the + // next line. + AccessibleTextGranularityLine + // AccessibleTextGranularityParagraph: use the boundary between paragraphs, + // starting from the beginning of the current paragraph and ending at the + // beginning of the next paragraph. + AccessibleTextGranularityParagraph +) + +func marshalAccessibleTextGranularity(p uintptr) (interface{}, error) { + return AccessibleTextGranularity(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleTextGranularity. +func (a AccessibleTextGranularity) String() string { + switch a { + case AccessibleTextGranularityCharacter: + return "Character" + case AccessibleTextGranularityWord: + return "Word" + case AccessibleTextGranularitySentence: + return "Sentence" + case AccessibleTextGranularityLine: + return "Line" + case AccessibleTextGranularityParagraph: + return "Paragraph" + default: + return fmt.Sprintf("AccessibleTextGranularity(%d)", a) + } +} + +// AccessibleTristate: possible values for the GTK_ACCESSIBLE_STATE_PRESSED +// accessible state. +// +// Note that the GTK_ACCESSIBLE_TRISTATE_FALSE and GTK_ACCESSIBLE_TRISTATE_TRUE +// have the same values as FALSE and TRUE. +type AccessibleTristate C.gint + +const ( + // AccessibleTristateFalse: state is false. + AccessibleTristateFalse AccessibleTristate = iota + // AccessibleTristateTrue: state is true. + AccessibleTristateTrue + // AccessibleTristateMixed: state is mixed. + AccessibleTristateMixed +) + +func marshalAccessibleTristate(p uintptr) (interface{}, error) { + return AccessibleTristate(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AccessibleTristate. +func (a AccessibleTristate) String() string { + switch a { + case AccessibleTristateFalse: + return "False" + case AccessibleTristateTrue: + return "True" + case AccessibleTristateMixed: + return "Mixed" + default: + return fmt.Sprintf("AccessibleTristate(%d)", a) + } +} + +// Align controls how a widget deals with extra space in a single dimension. +// +// Alignment only matters if the widget receives a “too large” allocation, +// for example if you packed the widget with the gtk.Widget:hexpand property +// inside a box, then the widget might get extra space. If you have for example +// a 16x16 icon inside a 32x32 space, the icon could be scaled and stretched, +// it could be centered, or it could be positioned to one side of the space. +// +// Note that in horizontal context GTK_ALIGN_START and GTK_ALIGN_END are +// interpreted relative to text direction. +// +// Baseline support is optional for containers and widgets, and is +// only available for vertical alignment. GTK_ALIGN_BASELINE_CENTER and +// GTK_ALIGN_BASELINE_FILL are treated similar to GTK_ALIGN_CENTER and +// GTK_ALIGN_FILL`, except that it positions the widget to line up the +// baselines, where that is supported. +type Align C.gint + +const ( + // AlignFill: stretch to fill all space if possible, center if no meaningful + // way to stretch. + AlignFill Align = 0 + // AlignStart: snap to left or top side, leaving space on right or bottom. + AlignStart Align = 1 + // AlignEnd: snap to right or bottom side, leaving space on left or top. + AlignEnd Align = 2 + // AlignCenter: center natural width of widget inside the allocation. + AlignCenter Align = 3 + // AlignBaselineFill: different name for GTK_ALIGN_BASELINE. + AlignBaselineFill Align = 4 + // AlignBaseline: align the widget according to the baseline. + AlignBaseline Align = 4 + // AlignBaselineCenter: stretch to fill all space, but align the baseline. + AlignBaselineCenter Align = 5 +) + +func marshalAlign(p uintptr) (interface{}, error) { + return Align(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Align. +func (a Align) String() string { + switch a { + case AlignFill: + return "Fill" + case AlignStart: + return "Start" + case AlignEnd: + return "End" + case AlignCenter: + return "Center" + case AlignBaselineFill: + return "BaselineFill" + case AlignBaselineCenter: + return "BaselineCenter" + default: + return fmt.Sprintf("Align(%d)", a) + } +} + +// ArrowType: used to indicate the direction in which an arrow should point. +type ArrowType C.gint + +const ( + // ArrowUp represents an upward pointing arrow. + ArrowUp ArrowType = iota + // ArrowDown represents a downward pointing arrow. + ArrowDown + // ArrowLeft represents a left pointing arrow. + ArrowLeft + // ArrowRight represents a right pointing arrow. + ArrowRight + // ArrowNone: no arrow. + ArrowNone +) + +func marshalArrowType(p uintptr) (interface{}, error) { + return ArrowType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ArrowType. +func (a ArrowType) String() string { + switch a { + case ArrowUp: + return "Up" + case ArrowDown: + return "Down" + case ArrowLeft: + return "Left" + case ArrowRight: + return "Right" + case ArrowNone: + return "None" + default: + return fmt.Sprintf("ArrowType(%d)", a) + } +} + +// AssistantPageType determines the page role inside a GtkAssistant. +// +// The role is used to handle buttons sensitivity and visibility. +// +// Note that an assistant needs to end its page flow with a page of +// type GTK_ASSISTANT_PAGE_CONFIRM, GTK_ASSISTANT_PAGE_SUMMARY or +// GTK_ASSISTANT_PAGE_PROGRESS to be correct. +// +// The Cancel button will only be shown if the page isn’t “committed”. See +// gtk_assistant_commit() for details. +type AssistantPageType C.gint + +const ( + // AssistantPageContent: page has regular contents. Both the Back and + // forward buttons will be shown. + AssistantPageContent AssistantPageType = iota + // AssistantPageIntro: page contains an introduction to the assistant task. + // Only the Forward button will be shown if there is a next page. + AssistantPageIntro + // AssistantPageConfirm: page lets the user confirm or deny the changes. + // The Back and Apply buttons will be shown. + AssistantPageConfirm + // AssistantPageSummary: page informs the user of the changes done. Only the + // Close button will be shown. + AssistantPageSummary + // AssistantPageProgress: used for tasks that take a long time to complete, + // blocks the assistant until the page is marked as complete. Only the back + // button will be shown. + AssistantPageProgress + // AssistantPageCustom: used for when other page types are not appropriate. + // No buttons will be shown, and the application must add its own buttons + // through gtk_assistant_add_action_widget(). + AssistantPageCustom +) + +func marshalAssistantPageType(p uintptr) (interface{}, error) { + return AssistantPageType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for AssistantPageType. +func (a AssistantPageType) String() string { + switch a { + case AssistantPageContent: + return "Content" + case AssistantPageIntro: + return "Intro" + case AssistantPageConfirm: + return "Confirm" + case AssistantPageSummary: + return "Summary" + case AssistantPageProgress: + return "Progress" + case AssistantPageCustom: + return "Custom" + default: + return fmt.Sprintf("AssistantPageType(%d)", a) + } +} + +// BaselinePosition: baseline position in a row of widgets. +// +// Whenever a container has some form of natural row it may align children +// in that row along a common typographical baseline. If the amount of +// vertical space in the row is taller than the total requested height of the +// baseline-aligned children then it can use a GtkBaselinePosition to select +// where to put the baseline inside the extra available space. +type BaselinePosition C.gint + +const ( + // BaselinePositionTop: align the baseline at the top. + BaselinePositionTop BaselinePosition = iota + // BaselinePositionCenter: center the baseline. + BaselinePositionCenter + // BaselinePositionBottom: align the baseline at the bottom. + BaselinePositionBottom +) + +func marshalBaselinePosition(p uintptr) (interface{}, error) { + return BaselinePosition(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for BaselinePosition. +func (b BaselinePosition) String() string { + switch b { + case BaselinePositionTop: + return "Top" + case BaselinePositionCenter: + return "Center" + case BaselinePositionBottom: + return "Bottom" + default: + return fmt.Sprintf("BaselinePosition(%d)", b) + } +} + +// BorderStyle describes how the border of a UI element should be rendered. +type BorderStyle C.gint + +const ( + // BorderStyleNone: no visible border. + BorderStyleNone BorderStyle = iota + // BorderStyleHidden: same as GTK_BORDER_STYLE_NONE. + BorderStyleHidden + // BorderStyleSolid: single line segment. + BorderStyleSolid + // BorderStyleInset looks as if the content is sunken into the canvas. + BorderStyleInset + // BorderStyleOutset looks as if the content is coming out of the canvas. + BorderStyleOutset + // BorderStyleDotted series of round dots. + BorderStyleDotted + // BorderStyleDashed series of square-ended dashes. + BorderStyleDashed + // BorderStyleDouble: two parallel lines with some space between them. + BorderStyleDouble + // BorderStyleGroove looks as if it were carved in the canvas. + BorderStyleGroove + // BorderStyleRidge looks as if it were coming out of the canvas. + BorderStyleRidge +) + +func marshalBorderStyle(p uintptr) (interface{}, error) { + return BorderStyle(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for BorderStyle. +func (b BorderStyle) String() string { + switch b { + case BorderStyleNone: + return "None" + case BorderStyleHidden: + return "Hidden" + case BorderStyleSolid: + return "Solid" + case BorderStyleInset: + return "Inset" + case BorderStyleOutset: + return "Outset" + case BorderStyleDotted: + return "Dotted" + case BorderStyleDashed: + return "Dashed" + case BorderStyleDouble: + return "Double" + case BorderStyleGroove: + return "Groove" + case BorderStyleRidge: + return "Ridge" + default: + return fmt.Sprintf("BorderStyle(%d)", b) + } +} + +// BuilderError: error codes that identify various errors that can occur while +// using GtkBuilder. +type BuilderError C.gint + +const ( + // BuilderErrorInvalidTypeFunction: type-func attribute didn’t name a + // function that returns a GType. + BuilderErrorInvalidTypeFunction BuilderError = iota + // BuilderErrorUnhandledTag: input contained a tag that GtkBuilder can’t + // handle. + BuilderErrorUnhandledTag + // BuilderErrorMissingAttribute: attribute that is required by GtkBuilder + // was missing. + BuilderErrorMissingAttribute + // BuilderErrorInvalidAttribute: GtkBuilder found an attribute that it + // doesn’t understand. + BuilderErrorInvalidAttribute + // BuilderErrorInvalidTag: GtkBuilder found a tag that it doesn’t + // understand. + BuilderErrorInvalidTag + // BuilderErrorMissingPropertyValue: required property value was missing. + BuilderErrorMissingPropertyValue + // BuilderErrorInvalidValue: GtkBuilder couldn’t parse some attribute value. + BuilderErrorInvalidValue + // BuilderErrorVersionMismatch: input file requires a newer version of GTK. + BuilderErrorVersionMismatch + // BuilderErrorDuplicateID: object id occurred twice. + BuilderErrorDuplicateID + // BuilderErrorObjectTypeRefused: specified object type is of the same + // type or derived from the type of the composite class being extended with + // builder XML. + BuilderErrorObjectTypeRefused + // BuilderErrorTemplateMismatch: wrong type was specified in a composite + // class’s template XML. + BuilderErrorTemplateMismatch + // BuilderErrorInvalidProperty: specified property is unknown for the object + // class. + BuilderErrorInvalidProperty + // BuilderErrorInvalidSignal: specified signal is unknown for the object + // class. + BuilderErrorInvalidSignal + // BuilderErrorInvalidID: object id is unknown. + BuilderErrorInvalidID + // BuilderErrorInvalidFunction: function could not be found. This often + // happens when symbols are set to be kept private. Compiling code with + // -rdynamic or using the gmodule-export-2.0 pkgconfig module can fix this + // problem. + BuilderErrorInvalidFunction +) + +func marshalBuilderError(p uintptr) (interface{}, error) { + return BuilderError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for BuilderError. +func (b BuilderError) String() string { + switch b { + case BuilderErrorInvalidTypeFunction: + return "InvalidTypeFunction" + case BuilderErrorUnhandledTag: + return "UnhandledTag" + case BuilderErrorMissingAttribute: + return "MissingAttribute" + case BuilderErrorInvalidAttribute: + return "InvalidAttribute" + case BuilderErrorInvalidTag: + return "InvalidTag" + case BuilderErrorMissingPropertyValue: + return "MissingPropertyValue" + case BuilderErrorInvalidValue: + return "InvalidValue" + case BuilderErrorVersionMismatch: + return "VersionMismatch" + case BuilderErrorDuplicateID: + return "DuplicateID" + case BuilderErrorObjectTypeRefused: + return "ObjectTypeRefused" + case BuilderErrorTemplateMismatch: + return "TemplateMismatch" + case BuilderErrorInvalidProperty: + return "InvalidProperty" + case BuilderErrorInvalidSignal: + return "InvalidSignal" + case BuilderErrorInvalidID: + return "InvalidID" + case BuilderErrorInvalidFunction: + return "InvalidFunction" + default: + return fmt.Sprintf("BuilderError(%d)", b) + } +} + +func BuilderErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gtk_builder_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// ButtonsType: prebuilt sets of buttons for GtkDialog. +// +// If none of these choices are appropriate, simply use GTK_BUTTONS_NONE and +// call gtk.Dialog.AddButtons(). +// +// > Please note that GTK_BUTTONS_OK, GTK_BUTTONS_YES_NO > and +// GTK_BUTTONS_OK_CANCEL are discouraged by the > GNOME Human Interface +// Guidelines (http://library.gnome.org/devel/hig-book/stable/). +type ButtonsType C.gint + +const ( + // ButtonsNone: no buttons at all. + ButtonsNone ButtonsType = iota + // ButtonsOK: OK button. + ButtonsOK + // ButtonsClose: close button. + ButtonsClose + // ButtonsCancel: cancel button. + ButtonsCancel + // ButtonsYesNo yes and No buttons. + ButtonsYesNo + // ButtonsOKCancel: OK and Cancel buttons. + ButtonsOKCancel +) + +func marshalButtonsType(p uintptr) (interface{}, error) { + return ButtonsType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ButtonsType. +func (b ButtonsType) String() string { + switch b { + case ButtonsNone: + return "None" + case ButtonsOK: + return "OK" + case ButtonsClose: + return "Close" + case ButtonsCancel: + return "Cancel" + case ButtonsYesNo: + return "YesNo" + case ButtonsOKCancel: + return "OKCancel" + default: + return fmt.Sprintf("ButtonsType(%d)", b) + } +} + +// CellRendererAccelMode: available modes for gtk.CellRendererAccel:accel-mode. +type CellRendererAccelMode C.gint + +const ( + // CellRendererAccelModeGTK: GTK accelerators mode. + CellRendererAccelModeGTK CellRendererAccelMode = iota + // CellRendererAccelModeOther: other accelerator mode. + CellRendererAccelModeOther +) + +func marshalCellRendererAccelMode(p uintptr) (interface{}, error) { + return CellRendererAccelMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for CellRendererAccelMode. +func (c CellRendererAccelMode) String() string { + switch c { + case CellRendererAccelModeGTK: + return "GTK" + case CellRendererAccelModeOther: + return "Other" + default: + return fmt.Sprintf("CellRendererAccelMode(%d)", c) + } +} + +// CellRendererMode identifies how the user can interact with a particular cell. +type CellRendererMode C.gint + +const ( + // CellRendererModeInert: cell is just for display and cannot be interacted + // with. Note that this doesn’t mean that eg. the row being drawn can’t be + // selected -- just that a particular element of it cannot be individually + // modified. + CellRendererModeInert CellRendererMode = iota + // CellRendererModeActivatable: cell can be clicked. + CellRendererModeActivatable + // CellRendererModeEditable: cell can be edited or otherwise modified. + CellRendererModeEditable +) + +func marshalCellRendererMode(p uintptr) (interface{}, error) { + return CellRendererMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for CellRendererMode. +func (c CellRendererMode) String() string { + switch c { + case CellRendererModeInert: + return "Inert" + case CellRendererModeActivatable: + return "Activatable" + case CellRendererModeEditable: + return "Editable" + default: + return fmt.Sprintf("CellRendererMode(%d)", c) + } +} + +// Collation describes how a gtk.StringSorter turns strings into sort keys to +// compare them. +// +// Note that the result of sorting will in general depend on the current locale +// unless the mode is GTK_COLLATION_NONE. +type Collation C.gint + +const ( + // CollationNone: don't do any collation. + CollationNone Collation = iota + // CollationUnicode: use glib.UTF8CollateKey(). + CollationUnicode + // CollationFilename: use glib.UTF8CollateKeyForFilename(). + CollationFilename +) + +func marshalCollation(p uintptr) (interface{}, error) { + return Collation(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Collation. +func (c Collation) String() string { + switch c { + case CollationNone: + return "None" + case CollationUnicode: + return "Unicode" + case CollationFilename: + return "Filename" + default: + return fmt.Sprintf("Collation(%d)", c) + } +} + +// ConstraintAttribute: widget attributes that can be used when creating a +// constraint. +type ConstraintAttribute C.gint + +const ( + // ConstraintAttributeNone: no attribute, used for constant relations. + ConstraintAttributeNone ConstraintAttribute = iota + // ConstraintAttributeLeft: left edge of a widget, regardless of text + // direction. + ConstraintAttributeLeft + // ConstraintAttributeRight: right edge of a widget, regardless of text + // direction. + ConstraintAttributeRight + // ConstraintAttributeTop: top edge of a widget. + ConstraintAttributeTop + // ConstraintAttributeBottom: bottom edge of a widget. + ConstraintAttributeBottom + // ConstraintAttributeStart: leading edge of a widget, depending on text + // direction; equivalent to GTK_CONSTRAINT_ATTRIBUTE_LEFT for LTR languages, + // and GTK_CONSTRAINT_ATTRIBUTE_RIGHT for RTL ones. + ConstraintAttributeStart + // ConstraintAttributeEnd: trailing edge of a widget, depending on + // text direction; equivalent to GTK_CONSTRAINT_ATTRIBUTE_RIGHT for LTR + // languages, and GTK_CONSTRAINT_ATTRIBUTE_LEFT for RTL ones. + ConstraintAttributeEnd + // ConstraintAttributeWidth: width of a widget. + ConstraintAttributeWidth + // ConstraintAttributeHeight: height of a widget. + ConstraintAttributeHeight + // ConstraintAttributeCenterX: center of a widget, on the horizontal axis. + ConstraintAttributeCenterX + // ConstraintAttributeCenterY: center of a widget, on the vertical axis. + ConstraintAttributeCenterY + // ConstraintAttributeBaseline: baseline of a widget. + ConstraintAttributeBaseline +) + +func marshalConstraintAttribute(p uintptr) (interface{}, error) { + return ConstraintAttribute(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ConstraintAttribute. +func (c ConstraintAttribute) String() string { + switch c { + case ConstraintAttributeNone: + return "None" + case ConstraintAttributeLeft: + return "Left" + case ConstraintAttributeRight: + return "Right" + case ConstraintAttributeTop: + return "Top" + case ConstraintAttributeBottom: + return "Bottom" + case ConstraintAttributeStart: + return "Start" + case ConstraintAttributeEnd: + return "End" + case ConstraintAttributeWidth: + return "Width" + case ConstraintAttributeHeight: + return "Height" + case ConstraintAttributeCenterX: + return "CenterX" + case ConstraintAttributeCenterY: + return "CenterY" + case ConstraintAttributeBaseline: + return "Baseline" + default: + return fmt.Sprintf("ConstraintAttribute(%d)", c) + } +} + +// ConstraintRelation: relation between two terms of a constraint. +type ConstraintRelation C.gint + +const ( + // ConstraintRelationLE less than, or equal. + ConstraintRelationLE ConstraintRelation = -1 + // ConstraintRelationEq: equal. + ConstraintRelationEq ConstraintRelation = 0 + // ConstraintRelationGE: greater than, or equal. + ConstraintRelationGE ConstraintRelation = 1 +) + +func marshalConstraintRelation(p uintptr) (interface{}, error) { + return ConstraintRelation(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ConstraintRelation. +func (c ConstraintRelation) String() string { + switch c { + case ConstraintRelationLE: + return "LE" + case ConstraintRelationEq: + return "Eq" + case ConstraintRelationGE: + return "GE" + default: + return fmt.Sprintf("ConstraintRelation(%d)", c) + } +} + +// ConstraintStrength: strength of a constraint, expressed as a symbolic +// constant. +// +// The strength of a constraint can be expressed with any positive integer; +// the values of this enumeration can be used for readability. +type ConstraintStrength C.gint + +const ( + // ConstraintStrengthRequired: constraint is required towards solving the + // layout. + ConstraintStrengthRequired ConstraintStrength = 1001001000 + // ConstraintStrengthStrong: strong constraint. + ConstraintStrengthStrong ConstraintStrength = 1000000000 + // ConstraintStrengthMedium: medium constraint. + ConstraintStrengthMedium ConstraintStrength = 1000 + // ConstraintStrengthWeak: weak constraint. + ConstraintStrengthWeak ConstraintStrength = 1 +) + +func marshalConstraintStrength(p uintptr) (interface{}, error) { + return ConstraintStrength(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ConstraintStrength. +func (c ConstraintStrength) String() string { + switch c { + case ConstraintStrengthRequired: + return "Required" + case ConstraintStrengthStrong: + return "Strong" + case ConstraintStrengthMedium: + return "Medium" + case ConstraintStrengthWeak: + return "Weak" + default: + return fmt.Sprintf("ConstraintStrength(%d)", c) + } +} + +// ConstraintVflParserError: domain for VFL parsing errors. +type ConstraintVflParserError C.gint + +const ( + // ConstraintVflParserErrorInvalidSymbol: invalid or unknown symbol. + ConstraintVflParserErrorInvalidSymbol ConstraintVflParserError = iota + // ConstraintVflParserErrorInvalidAttribute: invalid or unknown attribute. + ConstraintVflParserErrorInvalidAttribute + // ConstraintVflParserErrorInvalidView: invalid or unknown view. + ConstraintVflParserErrorInvalidView + // ConstraintVflParserErrorInvalidMetric: invalid or unknown metric. + ConstraintVflParserErrorInvalidMetric + // ConstraintVflParserErrorInvalidPriority: invalid or unknown priority. + ConstraintVflParserErrorInvalidPriority + // ConstraintVflParserErrorInvalidRelation: invalid or unknown relation. + ConstraintVflParserErrorInvalidRelation +) + +func marshalConstraintVflParserError(p uintptr) (interface{}, error) { + return ConstraintVflParserError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ConstraintVflParserError. +func (c ConstraintVflParserError) String() string { + switch c { + case ConstraintVflParserErrorInvalidSymbol: + return "Symbol" + case ConstraintVflParserErrorInvalidAttribute: + return "Attribute" + case ConstraintVflParserErrorInvalidView: + return "View" + case ConstraintVflParserErrorInvalidMetric: + return "Metric" + case ConstraintVflParserErrorInvalidPriority: + return "Priority" + case ConstraintVflParserErrorInvalidRelation: + return "Relation" + default: + return fmt.Sprintf("ConstraintVflParserError(%d)", c) + } +} + +func ConstraintVflParserErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gtk_constraint_vfl_parser_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// ContentFit controls how a content should be made to fit inside an allocation. +type ContentFit C.gint + +const ( + // ContentFitFill: make the content fill the entire allocation, without + // taking its aspect ratio in consideration. The resulting content will + // appear as stretched if its aspect ratio is different from the allocation + // aspect ratio. + ContentFitFill ContentFit = iota + // ContentFitContain: scale the content to fit the allocation, while taking + // its aspect ratio in consideration. The resulting content will appear as + // letterboxed if its aspect ratio is different from the allocation aspect + // ratio. + ContentFitContain + // ContentFitCover: cover the entire allocation, while taking the content + // aspect ratio in consideration. The resulting content will appear as + // clipped if its aspect ratio is different from the allocation aspect + // ratio. + ContentFitCover + // ContentFitScaleDown: content is scaled down to fit the allocation, + // if needed, otherwise its original size is used. + ContentFitScaleDown +) + +func marshalContentFit(p uintptr) (interface{}, error) { + return ContentFit(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ContentFit. +func (c ContentFit) String() string { + switch c { + case ContentFitFill: + return "Fill" + case ContentFitContain: + return "Contain" + case ContentFitCover: + return "Cover" + case ContentFitScaleDown: + return "ScaleDown" + default: + return fmt.Sprintf("ContentFit(%d)", c) + } +} + +// CornerType specifies which corner a child widget should be placed in when +// packed into a GtkScrolledWindow. +// +// This is effectively the opposite of where the scroll bars are placed. +type CornerType C.gint + +const ( + // CornerTopLeft: place the scrollbars on the right and bottom of the widget + // (default behaviour). + CornerTopLeft CornerType = iota + // CornerBottomLeft: place the scrollbars on the top and right of the + // widget. + CornerBottomLeft + // CornerTopRight: place the scrollbars on the left and bottom of the + // widget. + CornerTopRight + // CornerBottomRight: place the scrollbars on the top and left of the + // widget. + CornerBottomRight +) + +func marshalCornerType(p uintptr) (interface{}, error) { + return CornerType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for CornerType. +func (c CornerType) String() string { + switch c { + case CornerTopLeft: + return "TopLeft" + case CornerBottomLeft: + return "BottomLeft" + case CornerTopRight: + return "TopRight" + case CornerBottomRight: + return "BottomRight" + default: + return fmt.Sprintf("CornerType(%d)", c) + } +} + +// CSSParserError errors that can occur while parsing CSS. +// +// These errors are unexpected and will cause parts of the given CSS to be +// ignored. +type CSSParserError C.gint + +const ( + // CSSParserErrorFailed: unknown failure. + CSSParserErrorFailed CSSParserError = iota + // CSSParserErrorSyntax: given text does not form valid syntax. + CSSParserErrorSyntax + // CSSParserErrorImport: failed to import a resource. + CSSParserErrorImport + // CSSParserErrorName: given name has not been defined. + CSSParserErrorName + // CSSParserErrorUnknownValue: given value is not correct. + CSSParserErrorUnknownValue +) + +// String returns the name in string for CSSParserError. +func (c CSSParserError) String() string { + switch c { + case CSSParserErrorFailed: + return "Failed" + case CSSParserErrorSyntax: + return "Syntax" + case CSSParserErrorImport: + return "Import" + case CSSParserErrorName: + return "Name" + case CSSParserErrorUnknownValue: + return "UnknownValue" + default: + return fmt.Sprintf("CSSParserError(%d)", c) + } +} + +// CSSParserWarning warnings that can occur while parsing CSS. +// +// Unlike GtkCssParserErrors, warnings do not cause the parser to skip any +// input, but they indicate issues that should be fixed. +type CSSParserWarning C.gint + +const ( + // CSSParserWarningDeprecated: given construct is deprecated and will be + // removed in a future version. + CSSParserWarningDeprecated CSSParserWarning = iota + // CSSParserWarningSyntax: syntax construct was used that should be avoided. + CSSParserWarningSyntax + // CSSParserWarningUnimplemented: feature is not implemented. + CSSParserWarningUnimplemented +) + +// String returns the name in string for CSSParserWarning. +func (c CSSParserWarning) String() string { + switch c { + case CSSParserWarningDeprecated: + return "Deprecated" + case CSSParserWarningSyntax: + return "Syntax" + case CSSParserWarningUnimplemented: + return "Unimplemented" + default: + return fmt.Sprintf("CSSParserWarning(%d)", c) + } +} + +// DeleteType: passed to various keybinding signals for deleting text. +type DeleteType C.gint + +const ( + // DeleteChars: delete characters. + DeleteChars DeleteType = iota + // DeleteWordEnds: delete only the portion of the word to the left/right of + // cursor if we’re in the middle of a word. + DeleteWordEnds + // DeleteWords: delete words. + DeleteWords + // DeleteDisplayLines: delete display-lines. Display-lines refers to the + // visible lines, with respect to the current line breaks. As opposed to + // paragraphs, which are defined by line breaks in the input. + DeleteDisplayLines + // DeleteDisplayLineEnds: delete only the portion of the display-line to the + // left/right of cursor. + DeleteDisplayLineEnds + // DeleteParagraphEnds: delete to the end of the paragraph. Like C-k in + // Emacs (or its reverse). + DeleteParagraphEnds + // DeleteParagraphs: delete entire line. Like C-k in pico. + DeleteParagraphs + // DeleteWhitespace: delete only whitespace. Like M-\ in Emacs. + DeleteWhitespace +) + +func marshalDeleteType(p uintptr) (interface{}, error) { + return DeleteType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DeleteType. +func (d DeleteType) String() string { + switch d { + case DeleteChars: + return "Chars" + case DeleteWordEnds: + return "WordEnds" + case DeleteWords: + return "Words" + case DeleteDisplayLines: + return "DisplayLines" + case DeleteDisplayLineEnds: + return "DisplayLineEnds" + case DeleteParagraphEnds: + return "ParagraphEnds" + case DeleteParagraphs: + return "Paragraphs" + case DeleteWhitespace: + return "Whitespace" + default: + return fmt.Sprintf("DeleteType(%d)", d) + } +} + +// DialogError: error codes in the GTK_DIALOG_ERROR domain that can be returned +// by async dialog functions. +type DialogError C.gint + +const ( + // DialogErrorFailed: generic error condition for when an operation fails + // and no more specific code is applicable. + DialogErrorFailed DialogError = iota + // DialogErrorCancelled: async function call was cancelled via its + // GCancellable. + DialogErrorCancelled + // DialogErrorDismissed: operation was cancelled by the user (via a Cancel + // or Close button). + DialogErrorDismissed +) + +func marshalDialogError(p uintptr) (interface{}, error) { + return DialogError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DialogError. +func (d DialogError) String() string { + switch d { + case DialogErrorFailed: + return "Failed" + case DialogErrorCancelled: + return "Cancelled" + case DialogErrorDismissed: + return "Dismissed" + default: + return fmt.Sprintf("DialogError(%d)", d) + } +} + +func DialogErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gtk_dialog_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// DirectionType focus movement types. +type DirectionType C.gint + +const ( + // DirTabForward: move forward. + DirTabForward DirectionType = iota + // DirTabBackward: move backward. + DirTabBackward + // DirUp: move up. + DirUp + // DirDown: move down. + DirDown + // DirLeft: move left. + DirLeft + // DirRight: move right. + DirRight +) + +func marshalDirectionType(p uintptr) (interface{}, error) { + return DirectionType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for DirectionType. +func (d DirectionType) String() string { + switch d { + case DirTabForward: + return "TabForward" + case DirTabBackward: + return "TabBackward" + case DirUp: + return "Up" + case DirDown: + return "Down" + case DirLeft: + return "Left" + case DirRight: + return "Right" + default: + return fmt.Sprintf("DirectionType(%d)", d) + } +} + +// EditableProperties identifiers for gtk.Editable properties. +// +// See gtk.Editable().InstallProperties for details on how to implement the +// GtkEditable interface. +type EditableProperties C.gint + +const ( + // EditablePropText: property id for gtk.Editable:text. + EditablePropText EditableProperties = iota + // EditablePropCursorPosition: property id for gtk.Editable:cursor-position. + EditablePropCursorPosition + // EditablePropSelectionBound: property id for gtk.Editable:selection-bound. + EditablePropSelectionBound + // EditablePropEditable: property id for gtk.Editable:editable. + EditablePropEditable + // EditablePropWidthChars: property id for gtk.Editable:width-chars. + EditablePropWidthChars + // EditablePropMaxWidthChars: property id for gtk.Editable:max-width-chars. + EditablePropMaxWidthChars + // EditablePropXAlign: property id for gtk.Editable:xalign. + EditablePropXAlign + // EditablePropEnableUndo: property id for gtk.Editable:enable-undo. + EditablePropEnableUndo + // EditableNumProperties: number of properties. + EditableNumProperties +) + +func marshalEditableProperties(p uintptr) (interface{}, error) { + return EditableProperties(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for EditableProperties. +func (e EditableProperties) String() string { + switch e { + case EditablePropText: + return "PropText" + case EditablePropCursorPosition: + return "PropCursorPosition" + case EditablePropSelectionBound: + return "PropSelectionBound" + case EditablePropEditable: + return "PropEditable" + case EditablePropWidthChars: + return "PropWidthChars" + case EditablePropMaxWidthChars: + return "PropMaxWidthChars" + case EditablePropXAlign: + return "PropXAlign" + case EditablePropEnableUndo: + return "PropEnableUndo" + case EditableNumProperties: + return "NumProperties" + default: + return fmt.Sprintf("EditableProperties(%d)", e) + } +} + +// EntryIconPosition specifies the side of the entry at which an icon is placed. +type EntryIconPosition C.gint + +const ( + // EntryIconPrimary: at the beginning of the entry (depending on the text + // direction). + EntryIconPrimary EntryIconPosition = iota + // EntryIconSecondary: at the end of the entry (depending on the text + // direction). + EntryIconSecondary +) + +func marshalEntryIconPosition(p uintptr) (interface{}, error) { + return EntryIconPosition(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for EntryIconPosition. +func (e EntryIconPosition) String() string { + switch e { + case EntryIconPrimary: + return "Primary" + case EntryIconSecondary: + return "Secondary" + default: + return fmt.Sprintf("EntryIconPosition(%d)", e) + } +} + +// EventSequenceState describes the state of a gdk.EventSequence in a gesture. +type EventSequenceState C.gint + +const ( + // EventSequenceNone: sequence is handled, but not grabbed. + EventSequenceNone EventSequenceState = iota + // EventSequenceClaimed: sequence is handled and grabbed. + EventSequenceClaimed + // EventSequenceDenied: sequence is denied. + EventSequenceDenied +) + +func marshalEventSequenceState(p uintptr) (interface{}, error) { + return EventSequenceState(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for EventSequenceState. +func (e EventSequenceState) String() string { + switch e { + case EventSequenceNone: + return "None" + case EventSequenceClaimed: + return "Claimed" + case EventSequenceDenied: + return "Denied" + default: + return fmt.Sprintf("EventSequenceState(%d)", e) + } +} + +// FileChooserAction describes whether a GtkFileChooser is being used to open +// existing files or to save to a possibly new file. +type FileChooserAction C.gint + +const ( + // FileChooserActionOpen indicates open mode. The file chooser will only let + // the user pick an existing file. + FileChooserActionOpen FileChooserAction = iota + // FileChooserActionSave indicates save mode. The file chooser will let the + // user pick an existing file, or type in a new filename. + FileChooserActionSave + // FileChooserActionSelectFolder indicates an Open mode for selecting + // folders. The file chooser will let the user pick an existing folder. + FileChooserActionSelectFolder +) + +func marshalFileChooserAction(p uintptr) (interface{}, error) { + return FileChooserAction(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FileChooserAction. +func (f FileChooserAction) String() string { + switch f { + case FileChooserActionOpen: + return "Open" + case FileChooserActionSave: + return "Save" + case FileChooserActionSelectFolder: + return "SelectFolder" + default: + return fmt.Sprintf("FileChooserAction(%d)", f) + } +} + +// FileChooserError: these identify the various errors that can occur while +// calling GtkFileChooser functions. +type FileChooserError C.gint + +const ( + // FileChooserErrorNonexistent indicates that a file does not exist. + FileChooserErrorNonexistent FileChooserError = iota + // FileChooserErrorBadFilename indicates a malformed filename. + FileChooserErrorBadFilename + // FileChooserErrorAlreadyExists indicates a duplicate path (e.g. when + // adding a bookmark). + FileChooserErrorAlreadyExists + // FileChooserErrorIncompleteHostname indicates an incomplete hostname (e.g. + // "http://foo" without a slash after that). + FileChooserErrorIncompleteHostname +) + +func marshalFileChooserError(p uintptr) (interface{}, error) { + return FileChooserError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FileChooserError. +func (f FileChooserError) String() string { + switch f { + case FileChooserErrorNonexistent: + return "Nonexistent" + case FileChooserErrorBadFilename: + return "BadFilename" + case FileChooserErrorAlreadyExists: + return "AlreadyExists" + case FileChooserErrorIncompleteHostname: + return "IncompleteHostname" + default: + return fmt.Sprintf("FileChooserError(%d)", f) + } +} + +// FileChooserErrorQuark registers an error quark for GtkFileChooser errors. +// +// The function returns the following values: +// +// - quark: error quark used for GtkFileChooser errors. +func FileChooserErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gtk_file_chooser_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// FilterChange describes changes in a filter in more detail and allows objects +// using the filter to optimize refiltering items. +// +// If you are writing an implementation and are not sure which value to pass, +// GTK_FILTER_CHANGE_DIFFERENT is always a correct choice. +type FilterChange C.gint + +const ( + // FilterChangeDifferent: filter change cannot be described with any of the + // other enumeration values. + FilterChangeDifferent FilterChange = iota + // FilterChangeLessStrict: filter is less strict than it was before: All + // items that it used to return TRUE for still return TRUE, others now may, + // too. + FilterChangeLessStrict + // FilterChangeMoreStrict: filter is more strict than it was before: + // All items that it used to return FALSE for still return FALSE, others now + // may, too. + FilterChangeMoreStrict +) + +func marshalFilterChange(p uintptr) (interface{}, error) { + return FilterChange(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FilterChange. +func (f FilterChange) String() string { + switch f { + case FilterChangeDifferent: + return "Different" + case FilterChangeLessStrict: + return "LessStrict" + case FilterChangeMoreStrict: + return "MoreStrict" + default: + return fmt.Sprintf("FilterChange(%d)", f) + } +} + +// FilterMatch describes the known strictness of a filter. +// +// Note that for filters where the strictness is not known, +// GTK_FILTER_MATCH_SOME is always an acceptable value, even if a filter does +// match all or no items. +type FilterMatch C.gint + +const ( + // FilterMatchSome: filter matches some items, gtk_filter_match() may return + // TRUE or FALSE. + FilterMatchSome FilterMatch = iota + // FilterMatchNone: filter does not match any item, gtk_filter_match() will + // always return FALSE. + FilterMatchNone + // FilterMatchAll: filter matches all items, gtk_filter_match() will alays + // return TRUE. + FilterMatchAll +) + +func marshalFilterMatch(p uintptr) (interface{}, error) { + return FilterMatch(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FilterMatch. +func (f FilterMatch) String() string { + switch f { + case FilterMatchSome: + return "Some" + case FilterMatchNone: + return "None" + case FilterMatchAll: + return "All" + default: + return fmt.Sprintf("FilterMatch(%d)", f) + } +} + +// FontLevel: level of granularity for the font selection. +// +// Depending on this value, the PangoFontDescription that is returned by +// gtk.FontDialogButton.GetFontDesc() will have more or less fields set. +type FontLevel C.gint + +const ( + // FontLevelFamily: select a font family. + FontLevelFamily FontLevel = iota + // FontLevelFace: select a font face (i.e. a family and a style). + FontLevelFace + // FontLevelFont: select a font (i.e. a face with a size, and possibly font + // variations). + FontLevelFont + // FontLevelFeatures: select a font and font features. + FontLevelFeatures +) + +func marshalFontLevel(p uintptr) (interface{}, error) { + return FontLevel(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for FontLevel. +func (f FontLevel) String() string { + switch f { + case FontLevelFamily: + return "Family" + case FontLevelFace: + return "Face" + case FontLevelFont: + return "Font" + case FontLevelFeatures: + return "Features" + default: + return fmt.Sprintf("FontLevel(%d)", f) + } +} + +// GraphicsOffloadEnabled represents the state of graphics offlodading. +type GraphicsOffloadEnabled C.gint + +const ( + // GraphicsOffloadEnabledType graphics offloading is enabled. + GraphicsOffloadEnabledType GraphicsOffloadEnabled = iota + // GraphicsOffloadDisabledType graphics offloading is disabled. + GraphicsOffloadDisabledType +) + +func marshalGraphicsOffloadEnabled(p uintptr) (interface{}, error) { + return GraphicsOffloadEnabled(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for GraphicsOffloadEnabled. +func (g GraphicsOffloadEnabled) String() string { + switch g { + case GraphicsOffloadEnabledType: + return "Enabled" + case GraphicsOffloadDisabledType: + return "Disabled" + default: + return fmt.Sprintf("GraphicsOffloadEnabled(%d)", g) + } +} + +// IconSize: built-in icon sizes. +// +// Icon sizes default to being inherited. Where they cannot be inherited, +// text size is the default. +// +// All widgets which use GtkIconSize set the normal-icons or large-icons style +// classes correspondingly, and let themes determine the actual size to be used +// with the -gtk-icon-size CSS property. +type IconSize C.gint + +const ( + // IconSizeInherit: keep the size of the parent element. + IconSizeInherit IconSize = iota + // IconSizeNormal: size similar to text size. + IconSizeNormal + // IconSizeLarge: large size, for example in an icon view. + IconSizeLarge +) + +func marshalIconSize(p uintptr) (interface{}, error) { + return IconSize(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for IconSize. +func (i IconSize) String() string { + switch i { + case IconSizeInherit: + return "Inherit" + case IconSizeNormal: + return "Normal" + case IconSizeLarge: + return "Large" + default: + return fmt.Sprintf("IconSize(%d)", i) + } +} + +// IconThemeError: error codes for GtkIconTheme operations. +type IconThemeError C.gint + +const ( + // IconThemeNotFound: icon specified does not exist in the theme. + IconThemeNotFound IconThemeError = iota + // IconThemeFailed: unspecified error occurred. + IconThemeFailed +) + +func marshalIconThemeError(p uintptr) (interface{}, error) { + return IconThemeError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for IconThemeError. +func (i IconThemeError) String() string { + switch i { + case IconThemeNotFound: + return "NotFound" + case IconThemeFailed: + return "Failed" + default: + return fmt.Sprintf("IconThemeError(%d)", i) + } +} + +func IconThemeErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gtk_icon_theme_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// IconViewDropPosition: enum for determining where a dropped item goes. +type IconViewDropPosition C.gint + +const ( + // IconViewNoDrop: no drop possible. + IconViewNoDrop IconViewDropPosition = iota + // IconViewDropInto: dropped item replaces the item. + IconViewDropInto + // IconViewDropLeft: dropped item is inserted to the left. + IconViewDropLeft + // IconViewDropRight: dropped item is inserted to the right. + IconViewDropRight + // IconViewDropAbove: dropped item is inserted above. + IconViewDropAbove + // IconViewDropBelow: dropped item is inserted below. + IconViewDropBelow +) + +func marshalIconViewDropPosition(p uintptr) (interface{}, error) { + return IconViewDropPosition(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for IconViewDropPosition. +func (i IconViewDropPosition) String() string { + switch i { + case IconViewNoDrop: + return "NoDrop" + case IconViewDropInto: + return "DropInto" + case IconViewDropLeft: + return "DropLeft" + case IconViewDropRight: + return "DropRight" + case IconViewDropAbove: + return "DropAbove" + case IconViewDropBelow: + return "DropBelow" + default: + return fmt.Sprintf("IconViewDropPosition(%d)", i) + } +} + +// ImageType describes the image data representation used by a gtk.Image. +// +// If you want to get the image from the widget, you can only +// get the currently-stored representation; for instance, if the +// gtk_image_get_storage_type() returns GTK_IMAGE_PAINTABLE, then you can call +// gtk_image_get_paintable(). +// +// For empty images, you can request any storage type (call any of the "get" +// functions), but they will all return NULL values. +type ImageType C.gint + +const ( + // ImageEmpty: there is no image displayed by the widget. + ImageEmpty ImageType = iota + // ImageIconName: widget contains a named icon. + ImageIconName + // ImageGIcon: widget contains a GIcon. + ImageGIcon + // ImagePaintable: widget contains a GdkPaintable. + ImagePaintable +) + +func marshalImageType(p uintptr) (interface{}, error) { + return ImageType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ImageType. +func (i ImageType) String() string { + switch i { + case ImageEmpty: + return "Empty" + case ImageIconName: + return "IconName" + case ImageGIcon: + return "GIcon" + case ImagePaintable: + return "Paintable" + default: + return fmt.Sprintf("ImageType(%d)", i) + } +} + +// InputPurpose describes primary purpose of the input widget. +// +// This information is useful for on-screen keyboards and similar input methods +// to decide which keys should be presented to the user. +// +// Note that the purpose is not meant to impose a totally strict rule about +// allowed characters, and does not replace input validation. It is fine for an +// on-screen keyboard to let the user override the character set restriction +// that is expressed by the purpose. The application is expected to validate the +// entry contents, even if it specified a purpose. +// +// The difference between GTK_INPUT_PURPOSE_DIGITS and GTK_INPUT_PURPOSE_NUMBER +// is that the former accepts only digits while the latter also some punctuation +// (like commas or points, plus, minus) and “e” or “E” as in 3.14E+000. +// +// This enumeration may be extended in the future; input methods should +// interpret unknown values as “free form”. +type InputPurpose C.gint + +const ( + // InputPurposeFreeForm: allow any character. + InputPurposeFreeForm InputPurpose = iota + // InputPurposeAlpha: allow only alphabetic characters. + InputPurposeAlpha + // InputPurposeDigits: allow only digits. + InputPurposeDigits + // InputPurposeNumber: edited field expects numbers. + InputPurposeNumber + // InputPurposePhone: edited field expects phone number. + InputPurposePhone + // InputPurposeURL: edited field expects URL. + InputPurposeURL + // InputPurposeEmail: edited field expects email address. + InputPurposeEmail + // InputPurposeName: edited field expects the name of a person. + InputPurposeName + // InputPurposePassword: like GTK_INPUT_PURPOSE_FREE_FORM, but characters + // are hidden. + InputPurposePassword + // InputPurposePIN: like GTK_INPUT_PURPOSE_DIGITS, but characters are + // hidden. + InputPurposePIN + // InputPurposeTerminal: allow any character, in addition to control codes. + InputPurposeTerminal +) + +func marshalInputPurpose(p uintptr) (interface{}, error) { + return InputPurpose(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for InputPurpose. +func (i InputPurpose) String() string { + switch i { + case InputPurposeFreeForm: + return "FreeForm" + case InputPurposeAlpha: + return "Alpha" + case InputPurposeDigits: + return "Digits" + case InputPurposeNumber: + return "Number" + case InputPurposePhone: + return "Phone" + case InputPurposeURL: + return "URL" + case InputPurposeEmail: + return "Email" + case InputPurposeName: + return "Name" + case InputPurposePassword: + return "Password" + case InputPurposePIN: + return "PIN" + case InputPurposeTerminal: + return "Terminal" + default: + return fmt.Sprintf("InputPurpose(%d)", i) + } +} + +// InscriptionOverflow: different methods to handle text in Inscription when it +// doesn't fit the available space. +type InscriptionOverflow C.gint + +const ( + // InscriptionOverflowClip: clip the remaining text. + InscriptionOverflowClip InscriptionOverflow = iota + // InscriptionOverflowEllipsizeStart: omit characters at the start of the + // text. + InscriptionOverflowEllipsizeStart + // InscriptionOverflowEllipsizeMiddle: omit characters at the middle of the + // text. + InscriptionOverflowEllipsizeMiddle + // InscriptionOverflowEllipsizeEnd: omit characters at the end of the text. + InscriptionOverflowEllipsizeEnd +) + +func marshalInscriptionOverflow(p uintptr) (interface{}, error) { + return InscriptionOverflow(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for InscriptionOverflow. +func (i InscriptionOverflow) String() string { + switch i { + case InscriptionOverflowClip: + return "Clip" + case InscriptionOverflowEllipsizeStart: + return "EllipsizeStart" + case InscriptionOverflowEllipsizeMiddle: + return "EllipsizeMiddle" + case InscriptionOverflowEllipsizeEnd: + return "EllipsizeEnd" + default: + return fmt.Sprintf("InscriptionOverflow(%d)", i) + } +} + +// Justification: used for justifying the text inside a label widget. +type Justification C.gint + +const ( + // JustifyLeft: text is placed at the left edge of the label. + JustifyLeft Justification = iota + // JustifyRight: text is placed at the right edge of the label. + JustifyRight + // JustifyCenter: text is placed in the center of the label. + JustifyCenter + // JustifyFill: text is placed is distributed across the label. + JustifyFill +) + +func marshalJustification(p uintptr) (interface{}, error) { + return Justification(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Justification. +func (j Justification) String() string { + switch j { + case JustifyLeft: + return "Left" + case JustifyRight: + return "Right" + case JustifyCenter: + return "Center" + case JustifyFill: + return "Fill" + default: + return fmt.Sprintf("Justification(%d)", j) + } +} + +// LevelBarMode describes how levelbar contents should be rendered. +// +// Note that this enumeration could be extended with additional modes in the +// future. +type LevelBarMode C.gint + +const ( + // LevelBarModeContinuous: bar has a continuous mode. + LevelBarModeContinuous LevelBarMode = iota + // LevelBarModeDiscrete: bar has a discrete mode. + LevelBarModeDiscrete +) + +func marshalLevelBarMode(p uintptr) (interface{}, error) { + return LevelBarMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for LevelBarMode. +func (l LevelBarMode) String() string { + switch l { + case LevelBarModeContinuous: + return "Continuous" + case LevelBarModeDiscrete: + return "Discrete" + default: + return fmt.Sprintf("LevelBarMode(%d)", l) + } +} + +// License: type of license for an application. +// +// This enumeration can be expanded at later date. +type License C.gint + +const ( + // LicenseUnknown: no license specified. + LicenseUnknown License = iota + // LicenseCustom: license text is going to be specified by the developer. + LicenseCustom + // LicenseGPL20: GNU General Public License, version 2.0 or later. + LicenseGPL20 + // LicenseGPL30: GNU General Public License, version 3.0 or later. + LicenseGPL30 + // LicenseLGPL21: GNU Lesser General Public License, version 2.1 or later. + LicenseLGPL21 + // LicenseLGPL30: GNU Lesser General Public License, version 3.0 or later. + LicenseLGPL30 + // LicenseBSD: BSD standard license. + LicenseBSD + // LicenseMITX11: MIT/X11 standard license. + LicenseMITX11 + // LicenseArtistic: artistic License, version 2.0. + LicenseArtistic + // LicenseGPL20_Only: GNU General Public License, version 2.0 only. + LicenseGPL20_Only + // LicenseGPL30_Only: GNU General Public License, version 3.0 only. + LicenseGPL30_Only + // LicenseLGPL21_Only: GNU Lesser General Public License, version 2.1 only. + LicenseLGPL21_Only + // LicenseLGPL30_Only: GNU Lesser General Public License, version 3.0 only. + LicenseLGPL30_Only + // LicenseAGPL30: GNU Affero General Public License, version 3.0 or later. + LicenseAGPL30 + // LicenseAGPL30_Only: GNU Affero General Public License, version 3.0 only. + LicenseAGPL30_Only + // LicenseBSD3: 3-clause BSD licence. + LicenseBSD3 + // LicenseApache20: apache License, version 2.0. + LicenseApache20 + // LicenseMPL20: mozilla Public License, version 2.0. + LicenseMPL20 + // License0BSD: zero-Clause BSD license. + License0BSD +) + +func marshalLicense(p uintptr) (interface{}, error) { + return License(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for License. +func (l License) String() string { + switch l { + case LicenseUnknown: + return "Unknown" + case LicenseCustom: + return "Custom" + case LicenseGPL20: + return "GPL20" + case LicenseGPL30: + return "GPL30" + case LicenseLGPL21: + return "LGPL21" + case LicenseLGPL30: + return "LGPL30" + case LicenseBSD: + return "BSD" + case LicenseMITX11: + return "MITX11" + case LicenseArtistic: + return "Artistic" + case LicenseGPL20_Only: + return "GPL20_Only" + case LicenseGPL30_Only: + return "GPL30_Only" + case LicenseLGPL21_Only: + return "LGPL21_Only" + case LicenseLGPL30_Only: + return "LGPL30_Only" + case LicenseAGPL30: + return "AGPL30" + case LicenseAGPL30_Only: + return "AGPL30_Only" + case LicenseBSD3: + return "BSD3" + case LicenseApache20: + return "Apache20" + case LicenseMPL20: + return "MPL20" + case License0BSD: + return "0BSD" + default: + return fmt.Sprintf("License(%d)", l) + } +} + +// ListTabBehavior: used to configure the focus behavior in the +// GTK_DIR_TAB_FORWARD and GTK_DIR_TAB_BACKWARD direction, like the +// Tab key in a gtk.ListView. +type ListTabBehavior C.gint + +const ( + // ListTabAll: cycle through all focusable items of the list. + ListTabAll ListTabBehavior = iota + // ListTabItem: cycle through a single list element, then move focus out + // of the list. Moving focus between items needs to be done with the arrow + // keys. + ListTabItem + // ListTabCell: cycle only through a single cell, then move focus out of the + // list. Moving focus between cells needs to be done with the arrow keys. + // This is only relevant for cell-based widgets like ColumnView, otherwise + // it behaves like GTK_LIST_TAB_ITEM. + ListTabCell +) + +func marshalListTabBehavior(p uintptr) (interface{}, error) { + return ListTabBehavior(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ListTabBehavior. +func (l ListTabBehavior) String() string { + switch l { + case ListTabAll: + return "All" + case ListTabItem: + return "Item" + case ListTabCell: + return "Cell" + default: + return fmt.Sprintf("ListTabBehavior(%d)", l) + } +} + +// MessageType: type of message being displayed in a messagedialog. +type MessageType C.gint + +const ( + // MessageInfo: informational message. + MessageInfo MessageType = iota + // MessageWarning: non-fatal warning message. + MessageWarning + // MessageQuestion: question requiring a choice. + MessageQuestion + // MessageError: fatal error message. + MessageError + // MessageOther: none of the above. + MessageOther +) + +func marshalMessageType(p uintptr) (interface{}, error) { + return MessageType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for MessageType. +func (m MessageType) String() string { + switch m { + case MessageInfo: + return "Info" + case MessageWarning: + return "Warning" + case MessageQuestion: + return "Question" + case MessageError: + return "Error" + case MessageOther: + return "Other" + default: + return fmt.Sprintf("MessageType(%d)", m) + } +} + +// MovementStep: passed as argument to various keybinding signals for moving the +// cursor position. +type MovementStep C.gint + +const ( + // MovementLogicalPositions: move forward or back by graphemes. + MovementLogicalPositions MovementStep = iota + // MovementVisualPositions: move left or right by graphemes. + MovementVisualPositions + // MovementWords: move forward or back by words. + MovementWords + // MovementDisplayLines: move up or down lines (wrapped lines). + MovementDisplayLines + // MovementDisplayLineEnds: move to either end of a line. + MovementDisplayLineEnds + // MovementParagraphs: move up or down paragraphs (newline-ended lines). + MovementParagraphs + // MovementParagraphEnds: move to either end of a paragraph. + MovementParagraphEnds + // MovementPages: move by pages. + MovementPages + // MovementBufferEnds: move to ends of the buffer. + MovementBufferEnds + // MovementHorizontalPages: move horizontally by pages. + MovementHorizontalPages +) + +func marshalMovementStep(p uintptr) (interface{}, error) { + return MovementStep(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for MovementStep. +func (m MovementStep) String() string { + switch m { + case MovementLogicalPositions: + return "LogicalPositions" + case MovementVisualPositions: + return "VisualPositions" + case MovementWords: + return "Words" + case MovementDisplayLines: + return "DisplayLines" + case MovementDisplayLineEnds: + return "DisplayLineEnds" + case MovementParagraphs: + return "Paragraphs" + case MovementParagraphEnds: + return "ParagraphEnds" + case MovementPages: + return "Pages" + case MovementBufferEnds: + return "BufferEnds" + case MovementHorizontalPages: + return "HorizontalPages" + default: + return fmt.Sprintf("MovementStep(%d)", m) + } +} + +// NaturalWrapMode options for selecting a different wrap mode for natural size +// requests. +// +// See for example the gtk.Label:natural-wrap-mode property. +type NaturalWrapMode C.gint + +const ( + // NaturalWrapInherit: inherit the minimum size request. In particular, + // this should be used with PANGO_WRAP_CHAR. + NaturalWrapInherit NaturalWrapMode = iota + // NaturalWrapNone: try not to wrap the text. This mode is the closest to + // GTK3's behavior but can lead to a wide label leaving lots of empty space + // below the text. + NaturalWrapNone + // NaturalWrapWord: attempt to wrap at word boundaries. This is useful in + // particular when using PANGO_WRAP_WORD_CHAR as the wrap mode. + NaturalWrapWord +) + +func marshalNaturalWrapMode(p uintptr) (interface{}, error) { + return NaturalWrapMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for NaturalWrapMode. +func (n NaturalWrapMode) String() string { + switch n { + case NaturalWrapInherit: + return "Inherit" + case NaturalWrapNone: + return "None" + case NaturalWrapWord: + return "Word" + default: + return fmt.Sprintf("NaturalWrapMode(%d)", n) + } +} + +// NotebookTab: parameter used in the action signals of GtkNotebook. +type NotebookTab C.gint + +const ( + // NotebookTabFirst: first tab in the notebook. + NotebookTabFirst NotebookTab = iota + // NotebookTabLast: last tab in the notebook. + NotebookTabLast +) + +func marshalNotebookTab(p uintptr) (interface{}, error) { + return NotebookTab(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for NotebookTab. +func (n NotebookTab) String() string { + switch n { + case NotebookTabFirst: + return "First" + case NotebookTabLast: + return "Last" + default: + return fmt.Sprintf("NotebookTab(%d)", n) + } +} + +// NumberUpLayout: used to determine the layout of pages on a sheet when +// printing multiple pages per sheet. +type NumberUpLayout C.gint + +const ( + // NumberUpLayoutLeftToRightTopToBottom: ! (layout-lrtb.png). + NumberUpLayoutLeftToRightTopToBottom NumberUpLayout = iota + // NumberUpLayoutLeftToRightBottomToTop: ! (layout-lrbt.png). + NumberUpLayoutLeftToRightBottomToTop + // NumberUpLayoutRightToLeftTopToBottom: ! (layout-rltb.png). + NumberUpLayoutRightToLeftTopToBottom + // NumberUpLayoutRightToLeftBottomToTop: ! (layout-rlbt.png). + NumberUpLayoutRightToLeftBottomToTop + // NumberUpLayoutTopToBottomLeftToRight: ! (layout-tblr.png). + NumberUpLayoutTopToBottomLeftToRight + // NumberUpLayoutTopToBottomRightToLeft: ! (layout-tbrl.png). + NumberUpLayoutTopToBottomRightToLeft + // NumberUpLayoutBottomToTopLeftToRight: ! (layout-btlr.png). + NumberUpLayoutBottomToTopLeftToRight + // NumberUpLayoutBottomToTopRightToLeft: ! (layout-btrl.png). + NumberUpLayoutBottomToTopRightToLeft +) + +func marshalNumberUpLayout(p uintptr) (interface{}, error) { + return NumberUpLayout(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for NumberUpLayout. +func (n NumberUpLayout) String() string { + switch n { + case NumberUpLayoutLeftToRightTopToBottom: + return "Lrtb" + case NumberUpLayoutLeftToRightBottomToTop: + return "Lrbt" + case NumberUpLayoutRightToLeftTopToBottom: + return "Rltb" + case NumberUpLayoutRightToLeftBottomToTop: + return "Rlbt" + case NumberUpLayoutTopToBottomLeftToRight: + return "Tblr" + case NumberUpLayoutTopToBottomRightToLeft: + return "Tbrl" + case NumberUpLayoutBottomToTopLeftToRight: + return "Btlr" + case NumberUpLayoutBottomToTopRightToLeft: + return "Btrl" + default: + return fmt.Sprintf("NumberUpLayout(%d)", n) + } +} + +// Ordering describes the way two values can be compared. +// +// These values can be used with a glib.CompareFunc. However, a GCompareFunc +// is allowed to return any integer values. For converting such a value to a +// GtkOrdering value, use gtk.Ordering().FromCmpfunc. +type Ordering C.gint + +const ( + // OrderingSmaller: first value is smaller than the second. + OrderingSmaller Ordering = -1 + // OrderingEqual: two values are equal. + OrderingEqual Ordering = 0 + // OrderingLarger: first value is larger than the second. + OrderingLarger Ordering = 1 +) + +func marshalOrdering(p uintptr) (interface{}, error) { + return Ordering(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Ordering. +func (o Ordering) String() string { + switch o { + case OrderingSmaller: + return "Smaller" + case OrderingEqual: + return "Equal" + case OrderingLarger: + return "Larger" + default: + return fmt.Sprintf("Ordering(%d)", o) + } +} + +// Orientation represents the orientation of widgets and other objects. +// +// Typical examples are box or gesturepan. +type Orientation C.gint + +const ( + // OrientationHorizontal: element is in horizontal orientation. + OrientationHorizontal Orientation = iota + // OrientationVertical: element is in vertical orientation. + OrientationVertical +) + +func marshalOrientation(p uintptr) (interface{}, error) { + return Orientation(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Orientation. +func (o Orientation) String() string { + switch o { + case OrientationHorizontal: + return "Horizontal" + case OrientationVertical: + return "Vertical" + default: + return fmt.Sprintf("Orientation(%d)", o) + } +} + +// Overflow defines how content overflowing a given area should be handled. +// +// This is used in gtk.Widget.SetOverflow(). The gtk.Widget:overflow property is +// modeled after the CSS overflow property, but implements it only partially. +type Overflow C.gint + +const ( + // OverflowVisible: no change is applied. Content is drawn at the specified + // position. + OverflowVisible Overflow = iota + // OverflowHidden: content is clipped to the bounds of the area. Content + // outside the area is not drawn and cannot be interacted with. + OverflowHidden +) + +func marshalOverflow(p uintptr) (interface{}, error) { + return Overflow(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Overflow. +func (o Overflow) String() string { + switch o { + case OverflowVisible: + return "Visible" + case OverflowHidden: + return "Hidden" + default: + return fmt.Sprintf("Overflow(%d)", o) + } +} + +// PackType represents the packing location of a children in its parent. +// +// See windowcontrols for example. +type PackType C.gint + +const ( + // PackStart: child is packed into the start of the widget. + PackStart PackType = iota + // PackEnd: child is packed into the end of the widget. + PackEnd +) + +func marshalPackType(p uintptr) (interface{}, error) { + return PackType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PackType. +func (p PackType) String() string { + switch p { + case PackStart: + return "Start" + case PackEnd: + return "End" + default: + return fmt.Sprintf("PackType(%d)", p) + } +} + +// PadActionType: type of a pad action. +type PadActionType C.gint + +const ( + // PadActionButton: action is triggered by a pad button. + PadActionButton PadActionType = iota + // PadActionRing: action is triggered by a pad ring. + PadActionRing + // PadActionStrip: action is triggered by a pad strip. + PadActionStrip +) + +func marshalPadActionType(p uintptr) (interface{}, error) { + return PadActionType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PadActionType. +func (p PadActionType) String() string { + switch p { + case PadActionButton: + return "Button" + case PadActionRing: + return "Ring" + case PadActionStrip: + return "Strip" + default: + return fmt.Sprintf("PadActionType(%d)", p) + } +} + +// PageOrientation: see also gtk_print_settings_set_orientation(). +type PageOrientation C.gint + +const ( + // PageOrientationPortrait: portrait mode. + PageOrientationPortrait PageOrientation = iota + // PageOrientationLandscape: landscape mode. + PageOrientationLandscape + // PageOrientationReversePortrait: reverse portrait mode. + PageOrientationReversePortrait + // PageOrientationReverseLandscape: reverse landscape mode. + PageOrientationReverseLandscape +) + +func marshalPageOrientation(p uintptr) (interface{}, error) { + return PageOrientation(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PageOrientation. +func (p PageOrientation) String() string { + switch p { + case PageOrientationPortrait: + return "Portrait" + case PageOrientationLandscape: + return "Landscape" + case PageOrientationReversePortrait: + return "ReversePortrait" + case PageOrientationReverseLandscape: + return "ReverseLandscape" + default: + return fmt.Sprintf("PageOrientation(%d)", p) + } +} + +// PageSet: see also gtk_print_job_set_page_set(). +type PageSet C.gint + +const ( + // PageSetAll: all pages. + PageSetAll PageSet = iota + // PageSetEven: even pages. + PageSetEven + // PageSetOdd: odd pages. + PageSetOdd +) + +func marshalPageSet(p uintptr) (interface{}, error) { + return PageSet(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PageSet. +func (p PageSet) String() string { + switch p { + case PageSetAll: + return "All" + case PageSetEven: + return "Even" + case PageSetOdd: + return "Odd" + default: + return fmt.Sprintf("PageSet(%d)", p) + } +} + +// PanDirection describes the panning direction of a gesturepan. +type PanDirection C.gint + +const ( + // PanDirectionLeft: panned towards the left. + PanDirectionLeft PanDirection = iota + // PanDirectionRight: panned towards the right. + PanDirectionRight + // PanDirectionUp: panned upwards. + PanDirectionUp + // PanDirectionDown: panned downwards. + PanDirectionDown +) + +func marshalPanDirection(p uintptr) (interface{}, error) { + return PanDirection(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PanDirection. +func (p PanDirection) String() string { + switch p { + case PanDirectionLeft: + return "Left" + case PanDirectionRight: + return "Right" + case PanDirectionUp: + return "Up" + case PanDirectionDown: + return "Down" + default: + return fmt.Sprintf("PanDirection(%d)", p) + } +} + +// PolicyType determines how the size should be computed to achieve the one of +// the visibility mode for the scrollbars. +type PolicyType C.gint + +const ( + // PolicyAlways: scrollbar is always visible. The view size is independent + // of the content. + PolicyAlways PolicyType = iota + // PolicyAutomatic: scrollbar will appear and disappear as necessary. + // For example, when all of a GtkTreeView can not be seen. + PolicyAutomatic + // PolicyNever: scrollbar should never appear. In this mode the content + // determines the size. + PolicyNever + // PolicyExternal: don't show a scrollbar, but don't force the size to + // follow the content. This can be used e.g. to make multiple scrolled + // windows share a scrollbar. + PolicyExternal +) + +func marshalPolicyType(p uintptr) (interface{}, error) { + return PolicyType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PolicyType. +func (p PolicyType) String() string { + switch p { + case PolicyAlways: + return "Always" + case PolicyAutomatic: + return "Automatic" + case PolicyNever: + return "Never" + case PolicyExternal: + return "External" + default: + return fmt.Sprintf("PolicyType(%d)", p) + } +} + +// PositionType describes which edge of a widget a certain feature is positioned +// at. +// +// For examples, see the tabs of a notebook, or the label of a scale. +type PositionType C.gint + +const ( + // PosLeft: feature is at the left edge. + PosLeft PositionType = iota + // PosRight: feature is at the right edge. + PosRight + // PosTop: feature is at the top edge. + PosTop + // PosBottom: feature is at the bottom edge. + PosBottom +) + +func marshalPositionType(p uintptr) (interface{}, error) { + return PositionType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PositionType. +func (p PositionType) String() string { + switch p { + case PosLeft: + return "Left" + case PosRight: + return "Right" + case PosTop: + return "Top" + case PosBottom: + return "Bottom" + default: + return fmt.Sprintf("PositionType(%d)", p) + } +} + +// PrintDuplex: see also gtk_print_settings_set_duplex(). +type PrintDuplex C.gint + +const ( + // PrintDuplexSimplex: no duplex. + PrintDuplexSimplex PrintDuplex = iota + // PrintDuplexHorizontal: horizontal duplex. + PrintDuplexHorizontal + // PrintDuplexVertical: vertical duplex. + PrintDuplexVertical +) + +func marshalPrintDuplex(p uintptr) (interface{}, error) { + return PrintDuplex(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PrintDuplex. +func (p PrintDuplex) String() string { + switch p { + case PrintDuplexSimplex: + return "Simplex" + case PrintDuplexHorizontal: + return "Horizontal" + case PrintDuplexVertical: + return "Vertical" + default: + return fmt.Sprintf("PrintDuplex(%d)", p) + } +} + +// PrintError: error codes that identify various errors that can occur while +// using the GTK printing support. +type PrintError C.gint + +const ( + // PrintErrorGeneral: unspecified error occurred. + PrintErrorGeneral PrintError = iota + // PrintErrorInternalError: internal error occurred. + PrintErrorInternalError + // PrintErrorNOMEM: memory allocation failed. + PrintErrorNOMEM + // PrintErrorInvalidFile: error occurred while loading a page setup or paper + // size from a key file. + PrintErrorInvalidFile +) + +func marshalPrintError(p uintptr) (interface{}, error) { + return PrintError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PrintError. +func (p PrintError) String() string { + switch p { + case PrintErrorGeneral: + return "General" + case PrintErrorInternalError: + return "InternalError" + case PrintErrorNOMEM: + return "NOMEM" + case PrintErrorInvalidFile: + return "InvalidFile" + default: + return fmt.Sprintf("PrintError(%d)", p) + } +} + +// PrintErrorQuark registers an error quark for GtkPrintOperation if necessary. +// +// The function returns the following values: +// +// - quark: error quark used for GtkPrintOperation errors. +func PrintErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gtk_print_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// PrintOperationAction determines what action the print operation should +// perform. +// +// A parameter of this typs is passed to gtk.PrintOperation.Run(). +type PrintOperationAction C.gint + +const ( + // PrintOperationActionPrintDialog: show the print dialog. + PrintOperationActionPrintDialog PrintOperationAction = iota + // PrintOperationActionPrint: start to print without showing the print + // dialog, based on the current print settings. + PrintOperationActionPrint + // PrintOperationActionPreview: show the print preview. + PrintOperationActionPreview + // PrintOperationActionExport: export to a file. This requires the + // export-filename property to be set. + PrintOperationActionExport +) + +func marshalPrintOperationAction(p uintptr) (interface{}, error) { + return PrintOperationAction(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PrintOperationAction. +func (p PrintOperationAction) String() string { + switch p { + case PrintOperationActionPrintDialog: + return "PrintDialog" + case PrintOperationActionPrint: + return "Print" + case PrintOperationActionPreview: + return "Preview" + case PrintOperationActionExport: + return "Export" + default: + return fmt.Sprintf("PrintOperationAction(%d)", p) + } +} + +// PrintOperationResult: result of a print operation. +// +// A value of this type is returned by gtk.PrintOperation.Run(). +type PrintOperationResult C.gint + +const ( + // PrintOperationResultError: error has occurred. + PrintOperationResultError PrintOperationResult = iota + // PrintOperationResultApply: print settings should be stored. + PrintOperationResultApply + // PrintOperationResultCancel: print operation has been canceled, the print + // settings should not be stored. + PrintOperationResultCancel + // PrintOperationResultInProgress: print operation is not complete yet. + // This value will only be returned when running asynchronously. + PrintOperationResultInProgress +) + +func marshalPrintOperationResult(p uintptr) (interface{}, error) { + return PrintOperationResult(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PrintOperationResult. +func (p PrintOperationResult) String() string { + switch p { + case PrintOperationResultError: + return "Error" + case PrintOperationResultApply: + return "Apply" + case PrintOperationResultCancel: + return "Cancel" + case PrintOperationResultInProgress: + return "InProgress" + default: + return fmt.Sprintf("PrintOperationResult(%d)", p) + } +} + +// PrintPages: see also gtk_print_job_set_pages(). +type PrintPages C.gint + +const ( + // PrintPagesAll: all pages. + PrintPagesAll PrintPages = iota + // PrintPagesCurrent: current page. + PrintPagesCurrent + // PrintPagesRanges: range of pages. + PrintPagesRanges + // PrintPagesSelection: selected pages. + PrintPagesSelection +) + +func marshalPrintPages(p uintptr) (interface{}, error) { + return PrintPages(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PrintPages. +func (p PrintPages) String() string { + switch p { + case PrintPagesAll: + return "All" + case PrintPagesCurrent: + return "Current" + case PrintPagesRanges: + return "Ranges" + case PrintPagesSelection: + return "Selection" + default: + return fmt.Sprintf("PrintPages(%d)", p) + } +} + +// PrintQuality: see also gtk_print_settings_set_quality(). +type PrintQuality C.gint + +const ( + // PrintQualityLow: low quality. + PrintQualityLow PrintQuality = iota + // PrintQualityNormal: normal quality. + PrintQualityNormal + // PrintQualityHigh: high quality. + PrintQualityHigh + // PrintQualityDraft: draft quality. + PrintQualityDraft +) + +func marshalPrintQuality(p uintptr) (interface{}, error) { + return PrintQuality(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PrintQuality. +func (p PrintQuality) String() string { + switch p { + case PrintQualityLow: + return "Low" + case PrintQualityNormal: + return "Normal" + case PrintQualityHigh: + return "High" + case PrintQualityDraft: + return "Draft" + default: + return fmt.Sprintf("PrintQuality(%d)", p) + } +} + +// PrintStatus status gives a rough indication of the completion of a running +// print operation. +type PrintStatus C.gint + +const ( + // PrintStatusInitial: printing has not started yet; this status is set + // initially, and while the print dialog is shown. + PrintStatusInitial PrintStatus = iota + // PrintStatusPreparing: this status is set while the begin-print signal is + // emitted and during pagination. + PrintStatusPreparing + // PrintStatusGeneratingData: this status is set while the pages are being + // rendered. + PrintStatusGeneratingData + // PrintStatusSendingData: print job is being sent off to the printer. + PrintStatusSendingData + // PrintStatusPending: print job has been sent to the printer, but is not + // printed for some reason, e.g. the printer may be stopped. + PrintStatusPending + // PrintStatusPendingIssue: some problem has occurred during printing, e.g. + // a paper jam. + PrintStatusPendingIssue + // PrintStatusPrinting: printer is processing the print job. + PrintStatusPrinting + // PrintStatusFinished: printing has been completed successfully. + PrintStatusFinished + // PrintStatusFinishedAborted: printing has been aborted. + PrintStatusFinishedAborted +) + +func marshalPrintStatus(p uintptr) (interface{}, error) { + return PrintStatus(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PrintStatus. +func (p PrintStatus) String() string { + switch p { + case PrintStatusInitial: + return "Initial" + case PrintStatusPreparing: + return "Preparing" + case PrintStatusGeneratingData: + return "GeneratingData" + case PrintStatusSendingData: + return "SendingData" + case PrintStatusPending: + return "Pending" + case PrintStatusPendingIssue: + return "PendingIssue" + case PrintStatusPrinting: + return "Printing" + case PrintStatusFinished: + return "Finished" + case PrintStatusFinishedAborted: + return "FinishedAborted" + default: + return fmt.Sprintf("PrintStatus(%d)", p) + } +} + +// PropagationLimit describes limits of a eventcontroller for handling events +// targeting other widgets. +type PropagationLimit C.gint + +const ( + // LimitNone events are handled regardless of what their target is. + LimitNone PropagationLimit = iota + // LimitSameNative events are only handled if their target is in the same + // native as the event controllers widget. Note that some event types have + // two targets (origin and destination). + LimitSameNative +) + +func marshalPropagationLimit(p uintptr) (interface{}, error) { + return PropagationLimit(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PropagationLimit. +func (p PropagationLimit) String() string { + switch p { + case LimitNone: + return "None" + case LimitSameNative: + return "SameNative" + default: + return fmt.Sprintf("PropagationLimit(%d)", p) + } +} + +// PropagationPhase describes the stage at which events are fed into a +// eventcontroller. +type PropagationPhase C.gint + +const ( + // PhaseNone events are not delivered. + PhaseNone PropagationPhase = iota + // PhaseCapture events are delivered in the capture phase. The capture phase + // happens before the bubble phase, runs from the toplevel down to the event + // widget. This option should only be used on containers that might possibly + // handle events before their children do. + PhaseCapture + // PhaseBubble events are delivered in the bubble phase. The bubble phase + // happens after the capture phase, and before the default handlers are run. + // This phase runs from the event widget, up to the toplevel. + PhaseBubble + // PhaseTarget events are delivered in the default widget event handlers, + // note that widget implementations must chain up on button, motion, + // touch and grab broken handlers for controllers in this phase to be run. + PhaseTarget +) + +func marshalPropagationPhase(p uintptr) (interface{}, error) { + return PropagationPhase(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for PropagationPhase. +func (p PropagationPhase) String() string { + switch p { + case PhaseNone: + return "None" + case PhaseCapture: + return "Capture" + case PhaseBubble: + return "Bubble" + case PhaseTarget: + return "Target" + default: + return fmt.Sprintf("PropagationPhase(%d)", p) + } +} + +// RecentManagerError: error codes for GtkRecentManager operations. +type RecentManagerError C.gint + +const ( + // RecentManagerErrorNotFound: URI specified does not exists in the recently + // used resources list. + RecentManagerErrorNotFound RecentManagerError = iota + // RecentManagerErrorInvalidURI: URI specified is not valid. + RecentManagerErrorInvalidURI + // RecentManagerErrorInvalidEncoding: supplied string is not UTF-8 encoded. + RecentManagerErrorInvalidEncoding + // RecentManagerErrorNotRegistered: no application has registered the + // specified item. + RecentManagerErrorNotRegistered + // RecentManagerErrorRead: failure while reading the recently used resources + // file. + RecentManagerErrorRead + // RecentManagerErrorWrite: failure while writing the recently used + // resources file. + RecentManagerErrorWrite + // RecentManagerErrorUnknown: unspecified error. + RecentManagerErrorUnknown +) + +func marshalRecentManagerError(p uintptr) (interface{}, error) { + return RecentManagerError(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for RecentManagerError. +func (r RecentManagerError) String() string { + switch r { + case RecentManagerErrorNotFound: + return "NotFound" + case RecentManagerErrorInvalidURI: + return "InvalidURI" + case RecentManagerErrorInvalidEncoding: + return "InvalidEncoding" + case RecentManagerErrorNotRegistered: + return "NotRegistered" + case RecentManagerErrorRead: + return "Read" + case RecentManagerErrorWrite: + return "Write" + case RecentManagerErrorUnknown: + return "Unknown" + default: + return fmt.Sprintf("RecentManagerError(%d)", r) + } +} + +func RecentManagerErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gtk_recent_manager_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// ResponseType: predefined values for use as response ids in +// gtk_dialog_add_button(). +// +// All predefined values are negative; GTK leaves values of 0 or greater for +// application-defined response ids. +type ResponseType C.gint + +const ( + // ResponseNone: returned if an action widget has no response id, or if the + // dialog gets programmatically hidden or destroyed. + ResponseNone ResponseType = -1 + // ResponseReject: generic response id, not used by GTK dialogs. + ResponseReject ResponseType = -2 + // ResponseAccept: generic response id, not used by GTK dialogs. + ResponseAccept ResponseType = -3 + // ResponseDeleteEvent: returned if the dialog is deleted. + ResponseDeleteEvent ResponseType = -4 + // ResponseOK: returned by OK buttons in GTK dialogs. + ResponseOK ResponseType = -5 + // ResponseCancel: returned by Cancel buttons in GTK dialogs. + ResponseCancel ResponseType = -6 + // ResponseClose: returned by Close buttons in GTK dialogs. + ResponseClose ResponseType = -7 + // ResponseYes: returned by Yes buttons in GTK dialogs. + ResponseYes ResponseType = -8 + // ResponseNo: returned by No buttons in GTK dialogs. + ResponseNo ResponseType = -9 + // ResponseApply: returned by Apply buttons in GTK dialogs. + ResponseApply ResponseType = -10 + // ResponseHelp: returned by Help buttons in GTK dialogs. + ResponseHelp ResponseType = -11 +) + +func marshalResponseType(p uintptr) (interface{}, error) { + return ResponseType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ResponseType. +func (r ResponseType) String() string { + switch r { + case ResponseNone: + return "None" + case ResponseReject: + return "Reject" + case ResponseAccept: + return "Accept" + case ResponseDeleteEvent: + return "DeleteEvent" + case ResponseOK: + return "OK" + case ResponseCancel: + return "Cancel" + case ResponseClose: + return "Close" + case ResponseYes: + return "Yes" + case ResponseNo: + return "No" + case ResponseApply: + return "Apply" + case ResponseHelp: + return "Help" + default: + return fmt.Sprintf("ResponseType(%d)", r) + } +} + +// RevealerTransitionType: these enumeration values describe the possible +// transitions when the child of a GtkRevealer widget is shown or hidden. +type RevealerTransitionType C.gint + +const ( + // RevealerTransitionTypeNone: no transition. + RevealerTransitionTypeNone RevealerTransitionType = iota + // RevealerTransitionTypeCrossfade: fade in. + RevealerTransitionTypeCrossfade + // RevealerTransitionTypeSlideRight: slide in from the left. + RevealerTransitionTypeSlideRight + // RevealerTransitionTypeSlideLeft: slide in from the right. + RevealerTransitionTypeSlideLeft + // RevealerTransitionTypeSlideUp: slide in from the bottom. + RevealerTransitionTypeSlideUp + // RevealerTransitionTypeSlideDown: slide in from the top. + RevealerTransitionTypeSlideDown + // RevealerTransitionTypeSwingRight: floop in from the left. + RevealerTransitionTypeSwingRight + // RevealerTransitionTypeSwingLeft: floop in from the right. + RevealerTransitionTypeSwingLeft + // RevealerTransitionTypeSwingUp: floop in from the bottom. + RevealerTransitionTypeSwingUp + // RevealerTransitionTypeSwingDown: floop in from the top. + RevealerTransitionTypeSwingDown +) + +func marshalRevealerTransitionType(p uintptr) (interface{}, error) { + return RevealerTransitionType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for RevealerTransitionType. +func (r RevealerTransitionType) String() string { + switch r { + case RevealerTransitionTypeNone: + return "None" + case RevealerTransitionTypeCrossfade: + return "Crossfade" + case RevealerTransitionTypeSlideRight: + return "SlideRight" + case RevealerTransitionTypeSlideLeft: + return "SlideLeft" + case RevealerTransitionTypeSlideUp: + return "SlideUp" + case RevealerTransitionTypeSlideDown: + return "SlideDown" + case RevealerTransitionTypeSwingRight: + return "SwingRight" + case RevealerTransitionTypeSwingLeft: + return "SwingLeft" + case RevealerTransitionTypeSwingUp: + return "SwingUp" + case RevealerTransitionTypeSwingDown: + return "SwingDown" + default: + return fmt.Sprintf("RevealerTransitionType(%d)", r) + } +} + +// ScrollStep: passed as argument to various keybinding signals. +type ScrollStep C.gint + +const ( + // ScrollSteps: scroll in steps. + ScrollSteps ScrollStep = iota + // ScrollPages: scroll by pages. + ScrollPages + // ScrollEnds: scroll to ends. + ScrollEnds + // ScrollHorizontalSteps: scroll in horizontal steps. + ScrollHorizontalSteps + // ScrollHorizontalPages: scroll by horizontal pages. + ScrollHorizontalPages + // ScrollHorizontalEnds: scroll to the horizontal ends. + ScrollHorizontalEnds +) + +func marshalScrollStep(p uintptr) (interface{}, error) { + return ScrollStep(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ScrollStep. +func (s ScrollStep) String() string { + switch s { + case ScrollSteps: + return "Steps" + case ScrollPages: + return "Pages" + case ScrollEnds: + return "Ends" + case ScrollHorizontalSteps: + return "HorizontalSteps" + case ScrollHorizontalPages: + return "HorizontalPages" + case ScrollHorizontalEnds: + return "HorizontalEnds" + default: + return fmt.Sprintf("ScrollStep(%d)", s) + } +} + +// ScrollType: scrolling types. +type ScrollType C.gint + +const ( + // ScrollNone: no scrolling. + ScrollNone ScrollType = iota + // ScrollJump: jump to new location. + ScrollJump + // ScrollStepBackward: step backward. + ScrollStepBackward + // ScrollStepForward: step forward. + ScrollStepForward + // ScrollPageBackward: page backward. + ScrollPageBackward + // ScrollPageForward: page forward. + ScrollPageForward + // ScrollStepUp: step up. + ScrollStepUp + // ScrollStepDown: step down. + ScrollStepDown + // ScrollPageUp: page up. + ScrollPageUp + // ScrollPageDown: page down. + ScrollPageDown + // ScrollStepLeft: step to the left. + ScrollStepLeft + // ScrollStepRight: step to the right. + ScrollStepRight + // ScrollPageLeft: page to the left. + ScrollPageLeft + // ScrollPageRight: page to the right. + ScrollPageRight + // ScrollStart: scroll to start. + ScrollStart + // ScrollEnd: scroll to end. + ScrollEnd +) + +func marshalScrollType(p uintptr) (interface{}, error) { + return ScrollType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ScrollType. +func (s ScrollType) String() string { + switch s { + case ScrollNone: + return "None" + case ScrollJump: + return "Jump" + case ScrollStepBackward: + return "StepBackward" + case ScrollStepForward: + return "StepForward" + case ScrollPageBackward: + return "PageBackward" + case ScrollPageForward: + return "PageForward" + case ScrollStepUp: + return "StepUp" + case ScrollStepDown: + return "StepDown" + case ScrollPageUp: + return "PageUp" + case ScrollPageDown: + return "PageDown" + case ScrollStepLeft: + return "StepLeft" + case ScrollStepRight: + return "StepRight" + case ScrollPageLeft: + return "PageLeft" + case ScrollPageRight: + return "PageRight" + case ScrollStart: + return "Start" + case ScrollEnd: + return "End" + default: + return fmt.Sprintf("ScrollType(%d)", s) + } +} + +// ScrollablePolicy defines the policy to be used in a scrollable widget when +// updating the scrolled window adjustments in a given orientation. +type ScrollablePolicy C.gint + +const ( + // ScrollMinimum: scrollable adjustments are based on the minimum size. + ScrollMinimum ScrollablePolicy = iota + // ScrollNatural: scrollable adjustments are based on the natural size. + ScrollNatural +) + +func marshalScrollablePolicy(p uintptr) (interface{}, error) { + return ScrollablePolicy(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ScrollablePolicy. +func (s ScrollablePolicy) String() string { + switch s { + case ScrollMinimum: + return "Minimum" + case ScrollNatural: + return "Natural" + default: + return fmt.Sprintf("ScrollablePolicy(%d)", s) + } +} + +// SelectionMode: used to control what selections users are allowed to make. +type SelectionMode C.gint + +const ( + // SelectionNone: no selection is possible. + SelectionNone SelectionMode = iota + // SelectionSingle: zero or one element may be selected. + SelectionSingle + // SelectionBrowse: exactly one element is selected. In some circumstances, + // such as initially or during a search operation, it’s possible for no + // element to be selected with GTK_SELECTION_BROWSE. What is really enforced + // is that the user can’t deselect a currently selected element except by + // selecting another element. + SelectionBrowse + // SelectionMultiple: any number of elements may be selected. The Ctrl key + // may be used to enlarge the selection, and Shift key to select between the + // focus and the child pointed to. Some widgets may also allow Click-drag to + // select a range of elements. + SelectionMultiple +) + +func marshalSelectionMode(p uintptr) (interface{}, error) { + return SelectionMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SelectionMode. +func (s SelectionMode) String() string { + switch s { + case SelectionNone: + return "None" + case SelectionSingle: + return "Single" + case SelectionBrowse: + return "Browse" + case SelectionMultiple: + return "Multiple" + default: + return fmt.Sprintf("SelectionMode(%d)", s) + } +} + +// SensitivityType determines how GTK handles the sensitivity of various +// controls, such as combo box buttons. +type SensitivityType C.gint + +const ( + // SensitivityAuto: control is made insensitive if no action can be + // triggered. + SensitivityAuto SensitivityType = iota + // SensitivityOn: control is always sensitive. + SensitivityOn + // SensitivityOff: control is always insensitive. + SensitivityOff +) + +func marshalSensitivityType(p uintptr) (interface{}, error) { + return SensitivityType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SensitivityType. +func (s SensitivityType) String() string { + switch s { + case SensitivityAuto: + return "Auto" + case SensitivityOn: + return "On" + case SensitivityOff: + return "Off" + default: + return fmt.Sprintf("SensitivityType(%d)", s) + } +} + +// ShortcutScope describes where shortcuts added to a shortcutcontroller get +// handled. +type ShortcutScope C.gint + +const ( + // ShortcutScopeLocal shortcuts are handled inside the widget the controller + // belongs to. + ShortcutScopeLocal ShortcutScope = iota + // ShortcutScopeManaged shortcuts are handled by the first ancestor that is + // a shortcutmanager. + ShortcutScopeManaged + // ShortcutScopeGlobal shortcuts are handled by the root widget. + ShortcutScopeGlobal +) + +func marshalShortcutScope(p uintptr) (interface{}, error) { + return ShortcutScope(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ShortcutScope. +func (s ShortcutScope) String() string { + switch s { + case ShortcutScopeLocal: + return "Local" + case ShortcutScopeManaged: + return "Managed" + case ShortcutScopeGlobal: + return "Global" + default: + return fmt.Sprintf("ShortcutScope(%d)", s) + } +} + +// ShortcutType specifies the kind of shortcut that is being described. +// +// More values may be added to this enumeration over time. +type ShortcutType C.gint + +const ( + // ShortcutAccelerator: shortcut is a keyboard accelerator. The + // GtkShortcutsShortcut:accelerator property will be used. + ShortcutAccelerator ShortcutType = iota + // ShortcutGesturePinch: shortcut is a pinch gesture. GTK provides an icon + // and subtitle. + ShortcutGesturePinch + // ShortcutGestureStretch: shortcut is a stretch gesture. GTK provides an + // icon and subtitle. + ShortcutGestureStretch + // ShortcutGestureRotateClockwise: shortcut is a clockwise rotation gesture. + // GTK provides an icon and subtitle. + ShortcutGestureRotateClockwise + // ShortcutGestureRotateCounterclockwise: shortcut is a counterclockwise + // rotation gesture. GTK provides an icon and subtitle. + ShortcutGestureRotateCounterclockwise + // ShortcutGestureTwoFingerSwipeLeft: shortcut is a two-finger swipe + // gesture. GTK provides an icon and subtitle. + ShortcutGestureTwoFingerSwipeLeft + // ShortcutGestureTwoFingerSwipeRight: shortcut is a two-finger swipe + // gesture. GTK provides an icon and subtitle. + ShortcutGestureTwoFingerSwipeRight + // ShortcutGesture: shortcut is a gesture. The GtkShortcutsShortcut:icon + // property will be used. + ShortcutGesture + // ShortcutGestureSwipeLeft: shortcut is a swipe gesture. GTK provides an + // icon and subtitle. + ShortcutGestureSwipeLeft + // ShortcutGestureSwipeRight: shortcut is a swipe gesture. GTK provides an + // icon and subtitle. + ShortcutGestureSwipeRight +) + +func marshalShortcutType(p uintptr) (interface{}, error) { + return ShortcutType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for ShortcutType. +func (s ShortcutType) String() string { + switch s { + case ShortcutAccelerator: + return "Accelerator" + case ShortcutGesturePinch: + return "GesturePinch" + case ShortcutGestureStretch: + return "GestureStretch" + case ShortcutGestureRotateClockwise: + return "GestureRotateClockwise" + case ShortcutGestureRotateCounterclockwise: + return "GestureRotateCounterclockwise" + case ShortcutGestureTwoFingerSwipeLeft: + return "GestureTwoFingerSwipeLeft" + case ShortcutGestureTwoFingerSwipeRight: + return "GestureTwoFingerSwipeRight" + case ShortcutGesture: + return "Gesture" + case ShortcutGestureSwipeLeft: + return "GestureSwipeLeft" + case ShortcutGestureSwipeRight: + return "GestureSwipeRight" + default: + return fmt.Sprintf("ShortcutType(%d)", s) + } +} + +// SizeGroupMode: mode of the size group determines the directions in which the +// size group affects the requested sizes of its component widgets. +type SizeGroupMode C.gint + +const ( + // SizeGroupNone: group has no effect. + SizeGroupNone SizeGroupMode = iota + // SizeGroupHorizontal: group affects horizontal requisition. + SizeGroupHorizontal + // SizeGroupVertical: group affects vertical requisition. + SizeGroupVertical + // SizeGroupBoth: group affects both horizontal and vertical requisition. + SizeGroupBoth +) + +func marshalSizeGroupMode(p uintptr) (interface{}, error) { + return SizeGroupMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SizeGroupMode. +func (s SizeGroupMode) String() string { + switch s { + case SizeGroupNone: + return "None" + case SizeGroupHorizontal: + return "Horizontal" + case SizeGroupVertical: + return "Vertical" + case SizeGroupBoth: + return "Both" + default: + return fmt.Sprintf("SizeGroupMode(%d)", s) + } +} + +// SizeRequestMode specifies a preference for height-for-width or +// width-for-height geometry management. +type SizeRequestMode C.gint + +const ( + // SizeRequestHeightForWidth: prefer height-for-width geometry management. + SizeRequestHeightForWidth SizeRequestMode = iota + // SizeRequestWidthForHeight: prefer width-for-height geometry management. + SizeRequestWidthForHeight + // SizeRequestConstantSize: don’t trade height-for-width or + // width-for-height. + SizeRequestConstantSize +) + +func marshalSizeRequestMode(p uintptr) (interface{}, error) { + return SizeRequestMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SizeRequestMode. +func (s SizeRequestMode) String() string { + switch s { + case SizeRequestHeightForWidth: + return "HeightForWidth" + case SizeRequestWidthForHeight: + return "WidthForHeight" + case SizeRequestConstantSize: + return "ConstantSize" + default: + return fmt.Sprintf("SizeRequestMode(%d)", s) + } +} + +// SortType determines the direction of a sort. +type SortType C.gint + +const ( + // SortAscending: sorting is in ascending order. + SortAscending SortType = iota + // SortDescending: sorting is in descending order. + SortDescending +) + +func marshalSortType(p uintptr) (interface{}, error) { + return SortType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SortType. +func (s SortType) String() string { + switch s { + case SortAscending: + return "Ascending" + case SortDescending: + return "Descending" + default: + return fmt.Sprintf("SortType(%d)", s) + } +} + +// SorterChange describes changes in a sorter in more detail and allows users to +// optimize resorting. +type SorterChange C.gint + +const ( + // SorterChangeDifferent: sorter change cannot be described by any of the + // other enumeration values. + SorterChangeDifferent SorterChange = iota + // SorterChangeInverted: sort order was inverted. Comparisons that returned + // GTK_ORDERING_SMALLER now return GTK_ORDERING_LARGER and vice versa. + // Other comparisons return the same values as before. + SorterChangeInverted + // SorterChangeLessStrict: sorter is less strict: Comparisons may now return + // GTK_ORDERING_EQUAL that did not do so before. + SorterChangeLessStrict + // SorterChangeMoreStrict: sorter is more strict: Comparisons that did + // return GTK_ORDERING_EQUAL may not do so anymore. + SorterChangeMoreStrict +) + +func marshalSorterChange(p uintptr) (interface{}, error) { + return SorterChange(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SorterChange. +func (s SorterChange) String() string { + switch s { + case SorterChangeDifferent: + return "Different" + case SorterChangeInverted: + return "Inverted" + case SorterChangeLessStrict: + return "LessStrict" + case SorterChangeMoreStrict: + return "MoreStrict" + default: + return fmt.Sprintf("SorterChange(%d)", s) + } +} + +// SorterOrder describes the type of order that a GtkSorter may produce. +type SorterOrder C.gint + +const ( + // SorterOrderPartial: partial order. Any GtkOrdering is possible. + SorterOrderPartial SorterOrder = iota + // SorterOrderNone: no order, all elements are considered equal. + // gtk_sorter_compare() will only return GTK_ORDERING_EQUAL. + SorterOrderNone + // SorterOrderTotal: total order. gtk_sorter_compare() will only return + // GTK_ORDERING_EQUAL if an item is compared with itself. Two different + // items will never cause this value to be returned. + SorterOrderTotal +) + +func marshalSorterOrder(p uintptr) (interface{}, error) { + return SorterOrder(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SorterOrder. +func (s SorterOrder) String() string { + switch s { + case SorterOrderPartial: + return "Partial" + case SorterOrderNone: + return "None" + case SorterOrderTotal: + return "Total" + default: + return fmt.Sprintf("SorterOrder(%d)", s) + } +} + +// SpinButtonUpdatePolicy determines whether the spin button displays values +// outside the adjustment bounds. +// +// See gtk.SpinButton.SetUpdatePolicy(). +type SpinButtonUpdatePolicy C.gint + +const ( + // UpdateAlways: when refreshing your GtkSpinButton, the value is always + // displayed. + UpdateAlways SpinButtonUpdatePolicy = iota + // UpdateIfValid: when refreshing your GtkSpinButton, the value is only + // displayed if it is valid within the bounds of the spin button's + // adjustment. + UpdateIfValid +) + +func marshalSpinButtonUpdatePolicy(p uintptr) (interface{}, error) { + return SpinButtonUpdatePolicy(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SpinButtonUpdatePolicy. +func (s SpinButtonUpdatePolicy) String() string { + switch s { + case UpdateAlways: + return "Always" + case UpdateIfValid: + return "IfValid" + default: + return fmt.Sprintf("SpinButtonUpdatePolicy(%d)", s) + } +} + +// SpinType values of the GtkSpinType enumeration are used to specify the change +// to make in gtk_spin_button_spin(). +type SpinType C.gint + +const ( + // SpinStepForward: increment by the adjustments step increment. + SpinStepForward SpinType = iota + // SpinStepBackward: decrement by the adjustments step increment. + SpinStepBackward + // SpinPageForward: increment by the adjustments page increment. + SpinPageForward + // SpinPageBackward: decrement by the adjustments page increment. + SpinPageBackward + // SpinHome: go to the adjustments lower bound. + SpinHome + // SpinEnd: go to the adjustments upper bound. + SpinEnd + // SpinUserDefined: change by a specified amount. + SpinUserDefined +) + +func marshalSpinType(p uintptr) (interface{}, error) { + return SpinType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SpinType. +func (s SpinType) String() string { + switch s { + case SpinStepForward: + return "StepForward" + case SpinStepBackward: + return "StepBackward" + case SpinPageForward: + return "PageForward" + case SpinPageBackward: + return "PageBackward" + case SpinHome: + return "Home" + case SpinEnd: + return "End" + case SpinUserDefined: + return "UserDefined" + default: + return fmt.Sprintf("SpinType(%d)", s) + } +} + +// StackTransitionType: possible transitions between pages in a GtkStack widget. +// +// New values may be added to this enumeration over time. +type StackTransitionType C.gint + +const ( + // StackTransitionTypeNone: no transition. + StackTransitionTypeNone StackTransitionType = iota + // StackTransitionTypeCrossfade: cross-fade. + StackTransitionTypeCrossfade + // StackTransitionTypeSlideRight: slide from left to right. + StackTransitionTypeSlideRight + // StackTransitionTypeSlideLeft: slide from right to left. + StackTransitionTypeSlideLeft + // StackTransitionTypeSlideUp: slide from bottom up. + StackTransitionTypeSlideUp + // StackTransitionTypeSlideDown: slide from top down. + StackTransitionTypeSlideDown + // StackTransitionTypeSlideLeftRight: slide from left or right according to + // the children order. + StackTransitionTypeSlideLeftRight + // StackTransitionTypeSlideUpDown: slide from top down or bottom up + // according to the order. + StackTransitionTypeSlideUpDown + // StackTransitionTypeOverUp: cover the old page by sliding up. + StackTransitionTypeOverUp + // StackTransitionTypeOverDown: cover the old page by sliding down. + StackTransitionTypeOverDown + // StackTransitionTypeOverLeft: cover the old page by sliding to the left. + StackTransitionTypeOverLeft + // StackTransitionTypeOverRight: cover the old page by sliding to the right. + StackTransitionTypeOverRight + // StackTransitionTypeUnderUp: uncover the new page by sliding up. + StackTransitionTypeUnderUp + // StackTransitionTypeUnderDown: uncover the new page by sliding down. + StackTransitionTypeUnderDown + // StackTransitionTypeUnderLeft: uncover the new page by sliding to the + // left. + StackTransitionTypeUnderLeft + // StackTransitionTypeUnderRight: uncover the new page by sliding to the + // right. + StackTransitionTypeUnderRight + // StackTransitionTypeOverUpDown: cover the old page sliding up or uncover + // the new page sliding down, according to order. + StackTransitionTypeOverUpDown + // StackTransitionTypeOverDownUp: cover the old page sliding down or uncover + // the new page sliding up, according to order. + StackTransitionTypeOverDownUp + // StackTransitionTypeOverLeftRight: cover the old page sliding left or + // uncover the new page sliding right, according to order. + StackTransitionTypeOverLeftRight + // StackTransitionTypeOverRightLeft: cover the old page sliding right or + // uncover the new page sliding left, according to order. + StackTransitionTypeOverRightLeft + // StackTransitionTypeRotateLeft: pretend the pages are sides of a cube and + // rotate that cube to the left. + StackTransitionTypeRotateLeft + // StackTransitionTypeRotateRight: pretend the pages are sides of a cube and + // rotate that cube to the right. + StackTransitionTypeRotateRight + // StackTransitionTypeRotateLeftRight: pretend the pages are sides of a + // cube and rotate that cube to the left or right according to the children + // order. + StackTransitionTypeRotateLeftRight +) + +func marshalStackTransitionType(p uintptr) (interface{}, error) { + return StackTransitionType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for StackTransitionType. +func (s StackTransitionType) String() string { + switch s { + case StackTransitionTypeNone: + return "None" + case StackTransitionTypeCrossfade: + return "Crossfade" + case StackTransitionTypeSlideRight: + return "SlideRight" + case StackTransitionTypeSlideLeft: + return "SlideLeft" + case StackTransitionTypeSlideUp: + return "SlideUp" + case StackTransitionTypeSlideDown: + return "SlideDown" + case StackTransitionTypeSlideLeftRight: + return "SlideLeftRight" + case StackTransitionTypeSlideUpDown: + return "SlideUpDown" + case StackTransitionTypeOverUp: + return "OverUp" + case StackTransitionTypeOverDown: + return "OverDown" + case StackTransitionTypeOverLeft: + return "OverLeft" + case StackTransitionTypeOverRight: + return "OverRight" + case StackTransitionTypeUnderUp: + return "UnderUp" + case StackTransitionTypeUnderDown: + return "UnderDown" + case StackTransitionTypeUnderLeft: + return "UnderLeft" + case StackTransitionTypeUnderRight: + return "UnderRight" + case StackTransitionTypeOverUpDown: + return "OverUpDown" + case StackTransitionTypeOverDownUp: + return "OverDownUp" + case StackTransitionTypeOverLeftRight: + return "OverLeftRight" + case StackTransitionTypeOverRightLeft: + return "OverRightLeft" + case StackTransitionTypeRotateLeft: + return "RotateLeft" + case StackTransitionTypeRotateRight: + return "RotateRight" + case StackTransitionTypeRotateLeftRight: + return "RotateLeftRight" + default: + return fmt.Sprintf("StackTransitionType(%d)", s) + } +} + +// StringFilterMatchMode specifies how search strings are matched inside text. +type StringFilterMatchMode C.gint + +const ( + // StringFilterMatchModeExact: search string and text must match exactly. + StringFilterMatchModeExact StringFilterMatchMode = iota + // StringFilterMatchModeSubstring: search string must be contained as a + // substring inside the text. + StringFilterMatchModeSubstring + // StringFilterMatchModePrefix: text must begin with the search string. + StringFilterMatchModePrefix +) + +func marshalStringFilterMatchMode(p uintptr) (interface{}, error) { + return StringFilterMatchMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for StringFilterMatchMode. +func (s StringFilterMatchMode) String() string { + switch s { + case StringFilterMatchModeExact: + return "Exact" + case StringFilterMatchModeSubstring: + return "Substring" + case StringFilterMatchModePrefix: + return "Prefix" + default: + return fmt.Sprintf("StringFilterMatchMode(%d)", s) + } +} + +// SymbolicColor indexes of colors passed to symbolic color rendering, such as +// gtk.SymbolicPaintable.SnapshotSymbolic(). +// +// More values may be added over time. +type SymbolicColor C.gint + +const ( + // SymbolicColorForeground: default foreground color. + SymbolicColorForeground SymbolicColor = iota + // SymbolicColorError: indication color for errors. + SymbolicColorError + // SymbolicColorWarning: indication color for warnings. + SymbolicColorWarning + // SymbolicColorSuccess: indication color for success. + SymbolicColorSuccess +) + +func marshalSymbolicColor(p uintptr) (interface{}, error) { + return SymbolicColor(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SymbolicColor. +func (s SymbolicColor) String() string { + switch s { + case SymbolicColorForeground: + return "Foreground" + case SymbolicColorError: + return "Error" + case SymbolicColorWarning: + return "Warning" + case SymbolicColorSuccess: + return "Success" + default: + return fmt.Sprintf("SymbolicColor(%d)", s) + } +} + +// SystemSetting values that can be passed to the +// gtk.Widget.SystemSettingChanged() vfunc. +// +// The values indicate which system setting has changed. Widgets may need to +// drop caches, or react otherwise. +// +// Most of the values correspond to settings properties. +// +// More values may be added over time. +type SystemSetting C.gint + +const ( + // SystemSettingDPI: gtk.Settings:gtk-xft-dpi setting has changed. + SystemSettingDPI SystemSetting = iota + // SystemSettingFontName: gtk.Settings:gtk-font-name setting has changed. + SystemSettingFontName + // SystemSettingFontConfig: font configuration has changed in a + // way that requires text to be redrawn. This can be any of the + // gtk.Settings:gtk-xft-antialias, gtk.Settings:gtk-xft-hinting, + // gtk.Settings:gtk-xft-hintstyle, gtk.Settings:gtk-xft-rgba or + // gtk.Settings:gtk-fontconfig-timestamp settings. + SystemSettingFontConfig + // SystemSettingDisplay: display has changed. + SystemSettingDisplay + // SystemSettingIconTheme: icon theme has changed in a way that requires + // icons to be looked up again. + SystemSettingIconTheme +) + +func marshalSystemSetting(p uintptr) (interface{}, error) { + return SystemSetting(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for SystemSetting. +func (s SystemSetting) String() string { + switch s { + case SystemSettingDPI: + return "DPI" + case SystemSettingFontName: + return "FontName" + case SystemSettingFontConfig: + return "FontConfig" + case SystemSettingDisplay: + return "Display" + case SystemSettingIconTheme: + return "IconTheme" + default: + return fmt.Sprintf("SystemSetting(%d)", s) + } +} + +// TextDirection: reading directions for text. +type TextDirection C.gint + +const ( + // TextDirNone: no direction. + TextDirNone TextDirection = iota + // TextDirLTR: left to right text direction. + TextDirLTR + // TextDirRTL: right to left text direction. + TextDirRTL +) + +func marshalTextDirection(p uintptr) (interface{}, error) { + return TextDirection(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TextDirection. +func (t TextDirection) String() string { + switch t { + case TextDirNone: + return "None" + case TextDirLTR: + return "LTR" + case TextDirRTL: + return "RTL" + default: + return fmt.Sprintf("TextDirection(%d)", t) + } +} + +// TextExtendSelection: granularity types that extend the text selection. +// Use the GtkTextView::extend-selection signal to customize the selection. +type TextExtendSelection C.gint + +const ( + // TextExtendSelectionWord selects the current word. It is triggered by a + // double-click for example. + TextExtendSelectionWord TextExtendSelection = iota + // TextExtendSelectionLine selects the current line. It is triggered by a + // triple-click for example. + TextExtendSelectionLine +) + +func marshalTextExtendSelection(p uintptr) (interface{}, error) { + return TextExtendSelection(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TextExtendSelection. +func (t TextExtendSelection) String() string { + switch t { + case TextExtendSelectionWord: + return "Word" + case TextExtendSelectionLine: + return "Line" + default: + return fmt.Sprintf("TextExtendSelection(%d)", t) + } +} + +// TextViewLayer: used to reference the layers of GtkTextView for the purpose of +// customized drawing with the ::snapshot_layer vfunc. +type TextViewLayer C.gint + +const ( + // TextViewLayerBelowText: layer rendered below the text (but above the + // background). + TextViewLayerBelowText TextViewLayer = iota + // TextViewLayerAboveText: layer rendered above the text. + TextViewLayerAboveText +) + +func marshalTextViewLayer(p uintptr) (interface{}, error) { + return TextViewLayer(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TextViewLayer. +func (t TextViewLayer) String() string { + switch t { + case TextViewLayerBelowText: + return "BelowText" + case TextViewLayerAboveText: + return "AboveText" + default: + return fmt.Sprintf("TextViewLayer(%d)", t) + } +} + +// TextWindowType: used to reference the parts of GtkTextView. +type TextWindowType C.gint + +const ( + // TextWindowWidget: window that floats over scrolling areas. + TextWindowWidget TextWindowType = 1 + // TextWindowText: scrollable text window. + TextWindowText TextWindowType = 2 + // TextWindowLeft: left side border window. + TextWindowLeft TextWindowType = 3 + // TextWindowRight: right side border window. + TextWindowRight TextWindowType = 4 + // TextWindowTop: top border window. + TextWindowTop TextWindowType = 5 + // TextWindowBottom: bottom border window. + TextWindowBottom TextWindowType = 6 +) + +func marshalTextWindowType(p uintptr) (interface{}, error) { + return TextWindowType(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TextWindowType. +func (t TextWindowType) String() string { + switch t { + case TextWindowWidget: + return "Widget" + case TextWindowText: + return "Text" + case TextWindowLeft: + return "Left" + case TextWindowRight: + return "Right" + case TextWindowTop: + return "Top" + case TextWindowBottom: + return "Bottom" + default: + return fmt.Sprintf("TextWindowType(%d)", t) + } +} + +// TreeViewColumnSizing: sizing method the column uses to determine its width. +// Please note that GTK_TREE_VIEW_COLUMN_AUTOSIZE are inefficient for large +// views, and can make columns appear choppy. +type TreeViewColumnSizing C.gint + +const ( + // TreeViewColumnGrowOnly columns only get bigger in reaction to changes in + // the model. + TreeViewColumnGrowOnly TreeViewColumnSizing = iota + // TreeViewColumnAutosize columns resize to be the optimal size every time + // the model changes. + TreeViewColumnAutosize + // TreeViewColumnFixed columns are a fixed numbers of pixels wide. + TreeViewColumnFixed +) + +func marshalTreeViewColumnSizing(p uintptr) (interface{}, error) { + return TreeViewColumnSizing(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TreeViewColumnSizing. +func (t TreeViewColumnSizing) String() string { + switch t { + case TreeViewColumnGrowOnly: + return "GrowOnly" + case TreeViewColumnAutosize: + return "Autosize" + case TreeViewColumnFixed: + return "Fixed" + default: + return fmt.Sprintf("TreeViewColumnSizing(%d)", t) + } +} + +// TreeViewDropPosition: enum for determining where a dropped row goes. +type TreeViewDropPosition C.gint + +const ( + // TreeViewDropBefore: dropped row is inserted before. + TreeViewDropBefore TreeViewDropPosition = iota + // TreeViewDropAfter: dropped row is inserted after. + TreeViewDropAfter + // TreeViewDropIntoOrBefore: dropped row becomes a child or is inserted + // before. + TreeViewDropIntoOrBefore + // TreeViewDropIntoOrAfter: dropped row becomes a child or is inserted + // after. + TreeViewDropIntoOrAfter +) + +func marshalTreeViewDropPosition(p uintptr) (interface{}, error) { + return TreeViewDropPosition(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TreeViewDropPosition. +func (t TreeViewDropPosition) String() string { + switch t { + case TreeViewDropBefore: + return "Before" + case TreeViewDropAfter: + return "After" + case TreeViewDropIntoOrBefore: + return "IntoOrBefore" + case TreeViewDropIntoOrAfter: + return "IntoOrAfter" + default: + return fmt.Sprintf("TreeViewDropPosition(%d)", t) + } +} + +// TreeViewGridLines: used to indicate which grid lines to draw in a tree view. +type TreeViewGridLines C.gint + +const ( + // TreeViewGridLinesNone: no grid lines. + TreeViewGridLinesNone TreeViewGridLines = iota + // TreeViewGridLinesHorizontal: horizontal grid lines. + TreeViewGridLinesHorizontal + // TreeViewGridLinesVertical: vertical grid lines. + TreeViewGridLinesVertical + // TreeViewGridLinesBoth: horizontal and vertical grid lines. + TreeViewGridLinesBoth +) + +func marshalTreeViewGridLines(p uintptr) (interface{}, error) { + return TreeViewGridLines(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for TreeViewGridLines. +func (t TreeViewGridLines) String() string { + switch t { + case TreeViewGridLinesNone: + return "None" + case TreeViewGridLinesHorizontal: + return "Horizontal" + case TreeViewGridLinesVertical: + return "Vertical" + case TreeViewGridLinesBoth: + return "Both" + default: + return fmt.Sprintf("TreeViewGridLines(%d)", t) + } +} + +// Unit: see also gtk_print_settings_set_paper_width(). +type Unit C.gint + +const ( + // UnitNone: no units. + UnitNone Unit = iota + // UnitPoints dimensions in points. + UnitPoints + // UnitInch dimensions in inches. + UnitInch + // UnitMm dimensions in millimeters. + UnitMm +) + +func marshalUnit(p uintptr) (interface{}, error) { + return Unit(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Unit. +func (u Unit) String() string { + switch u { + case UnitNone: + return "None" + case UnitPoints: + return "Points" + case UnitInch: + return "Inch" + case UnitMm: + return "Mm" + default: + return fmt.Sprintf("Unit(%d)", u) + } +} + +// WrapMode describes a type of line wrapping. +type WrapMode C.gint + +const ( + // WrapNone: do not wrap lines; just make the text area wider. + WrapNone WrapMode = iota + // WrapChar: wrap text, breaking lines anywhere the cursor can appear + // (between characters, usually - if you want to be technical, between + // graphemes, see pango_get_log_attrs()). + WrapChar + // WrapWord: wrap text, breaking lines in between words. + WrapWord + // WrapWordChar: wrap text, breaking lines in between words, or if that is + // not enough, also between graphemes. + WrapWordChar +) + +func marshalWrapMode(p uintptr) (interface{}, error) { + return WrapMode(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for WrapMode. +func (w WrapMode) String() string { + switch w { + case WrapNone: + return "None" + case WrapChar: + return "Char" + case WrapWord: + return "Word" + case WrapWordChar: + return "WordChar" + default: + return fmt.Sprintf("WrapMode(%d)", w) + } +} + +// ApplicationInhibitFlags types of user actions that may be blocked by +// GtkApplication. +// +// See gtk.Application.Inhibit(). +type ApplicationInhibitFlags C.guint + +const ( + // ApplicationInhibitLogout: inhibit ending the user session by logging out + // or by shutting down the computer. + ApplicationInhibitLogout ApplicationInhibitFlags = 0b1 + // ApplicationInhibitSwitch: inhibit user switching. + ApplicationInhibitSwitch ApplicationInhibitFlags = 0b10 + // ApplicationInhibitSuspend: inhibit suspending the session or computer. + ApplicationInhibitSuspend ApplicationInhibitFlags = 0b100 + // ApplicationInhibitIdle: inhibit the session being marked as idle (and + // possibly locked). + ApplicationInhibitIdle ApplicationInhibitFlags = 0b1000 +) + +func marshalApplicationInhibitFlags(p uintptr) (interface{}, error) { + return ApplicationInhibitFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ApplicationInhibitFlags. +func (a ApplicationInhibitFlags) String() string { + if a == 0 { + return "ApplicationInhibitFlags(0)" + } + + var builder strings.Builder + builder.Grow(98) + + for a != 0 { + next := a & (a - 1) + bit := a - next + + switch bit { + case ApplicationInhibitLogout: + builder.WriteString("Logout|") + case ApplicationInhibitSwitch: + builder.WriteString("Switch|") + case ApplicationInhibitSuspend: + builder.WriteString("Suspend|") + case ApplicationInhibitIdle: + builder.WriteString("Idle|") + default: + builder.WriteString(fmt.Sprintf("ApplicationInhibitFlags(0b%b)|", bit)) + } + + a = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if a contains other. +func (a ApplicationInhibitFlags) Has(other ApplicationInhibitFlags) bool { + return (a & other) == other +} + +// BuilderClosureFlags: list of flags that can be passed to +// gtk_builder_create_closure(). +// +// New values may be added in the future for new features, so external +// implementations of gtk.BuilderScope should test the flags for unknown values +// and raise a GTK_BUILDER_ERROR_INVALID_ATTRIBUTE error when they encounter +// one. +type BuilderClosureFlags C.guint + +const ( + // BuilderClosureSwapped: closure should be created swapped. See + // g_cclosure_new_swap() for details. + BuilderClosureSwapped BuilderClosureFlags = 0b1 +) + +func marshalBuilderClosureFlags(p uintptr) (interface{}, error) { + return BuilderClosureFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for BuilderClosureFlags. +func (b BuilderClosureFlags) String() string { + if b == 0 { + return "BuilderClosureFlags(0)" + } + + var builder strings.Builder + builder.Grow(21) + + for b != 0 { + next := b & (b - 1) + bit := b - next + + switch bit { + case BuilderClosureSwapped: + builder.WriteString("Swapped|") + default: + builder.WriteString(fmt.Sprintf("BuilderClosureFlags(0b%b)|", bit)) + } + + b = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if b contains other. +func (b BuilderClosureFlags) Has(other BuilderClosureFlags) bool { + return (b & other) == other +} + +// CellRendererState tells how a cell is to be rendered. +type CellRendererState C.guint + +const ( + // CellRendererSelected: cell is currently selected, and probably has a + // selection colored background to render to. + CellRendererSelected CellRendererState = 0b1 + // CellRendererPrelit: mouse is hovering over the cell. + CellRendererPrelit CellRendererState = 0b10 + // CellRendererInsensitive: cell is drawn in an insensitive manner. + CellRendererInsensitive CellRendererState = 0b100 + // CellRendererSorted: cell is in a sorted row. + CellRendererSorted CellRendererState = 0b1000 + // CellRendererFocused: cell is in the focus row. + CellRendererFocused CellRendererState = 0b10000 + // CellRendererExpandable: cell is in a row that can be expanded. + CellRendererExpandable CellRendererState = 0b100000 + // CellRendererExpanded: cell is in a row that is expanded. + CellRendererExpanded CellRendererState = 0b1000000 +) + +func marshalCellRendererState(p uintptr) (interface{}, error) { + return CellRendererState(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for CellRendererState. +func (c CellRendererState) String() string { + if c == 0 { + return "CellRendererState(0)" + } + + var builder strings.Builder + builder.Grow(146) + + for c != 0 { + next := c & (c - 1) + bit := c - next + + switch bit { + case CellRendererSelected: + builder.WriteString("Selected|") + case CellRendererPrelit: + builder.WriteString("Prelit|") + case CellRendererInsensitive: + builder.WriteString("Insensitive|") + case CellRendererSorted: + builder.WriteString("Sorted|") + case CellRendererFocused: + builder.WriteString("Focused|") + case CellRendererExpandable: + builder.WriteString("Expandable|") + case CellRendererExpanded: + builder.WriteString("Expanded|") + default: + builder.WriteString(fmt.Sprintf("CellRendererState(0b%b)|", bit)) + } + + c = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if c contains other. +func (c CellRendererState) Has(other CellRendererState) bool { + return (c & other) == other +} + +// DebugFlags flags to use with gtk_set_debug_flags(). +// +// Settings these flags causes GTK to print out different types of debugging +// information. Some of these flags are only available when GTK has been +// configured with -Ddebug=true. +type DebugFlags C.guint + +const ( + // DebugText: information about GtkTextView. + DebugText DebugFlags = 0b1 + // DebugTree: information about GtkTreeView. + DebugTree DebugFlags = 0b10 + // DebugKeybindings: information about keyboard shortcuts. + DebugKeybindings DebugFlags = 0b100 + // DebugModules: information about modules and extensions. + DebugModules DebugFlags = 0b1000 + // DebugGeometry: information about size allocation. + DebugGeometry DebugFlags = 0b10000 + // DebugIcontheme: information about icon themes. + DebugIcontheme DebugFlags = 0b100000 + // DebugPrinting: information about printing. + DebugPrinting DebugFlags = 0b1000000 + // DebugBuilder: trace GtkBuilder operation. + DebugBuilder DebugFlags = 0b10000000 + // DebugSizeRequest: information about size requests. + DebugSizeRequest DebugFlags = 0b100000000 + // DebugNoCSSCache: disable the style property cache. + DebugNoCSSCache DebugFlags = 0b1000000000 + // DebugInteractive: open the GTK inspector. + DebugInteractive DebugFlags = 0b10000000000 + // DebugActions: information about actions and menu models. + DebugActions DebugFlags = 0b1000000000000 + // DebugLayout: information from layout managers. + DebugLayout DebugFlags = 0b10000000000000 + // DebugSnapshot: include debug render nodes in the generated snapshots. + DebugSnapshot DebugFlags = 0b100000000000000 + // DebugConstraints: information from the constraints solver. + DebugConstraints DebugFlags = 0b1000000000000000 + // DebugBuilderObjects: log unused GtkBuilder objects. + DebugBuilderObjects DebugFlags = 0b10000000000000000 + // DebugA11Y: information about accessibility state changes. + DebugA11Y DebugFlags = 0b100000000000000000 + // DebugIconfallback: information about icon fallback. + DebugIconfallback DebugFlags = 0b1000000000000000000 + // DebugInvertTextDir inverts the default text-direction. + DebugInvertTextDir DebugFlags = 0b10000000000000000000 +) + +func marshalDebugFlags(p uintptr) (interface{}, error) { + return DebugFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DebugFlags. +func (d DebugFlags) String() string { + if d == 0 { + return "DebugFlags(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DebugText: + builder.WriteString("Text|") + case DebugTree: + builder.WriteString("Tree|") + case DebugKeybindings: + builder.WriteString("Keybindings|") + case DebugModules: + builder.WriteString("Modules|") + case DebugGeometry: + builder.WriteString("Geometry|") + case DebugIcontheme: + builder.WriteString("Icontheme|") + case DebugPrinting: + builder.WriteString("Printing|") + case DebugBuilder: + builder.WriteString("Builder|") + case DebugSizeRequest: + builder.WriteString("SizeRequest|") + case DebugNoCSSCache: + builder.WriteString("NoCSSCache|") + case DebugInteractive: + builder.WriteString("Interactive|") + case DebugActions: + builder.WriteString("Actions|") + case DebugLayout: + builder.WriteString("Layout|") + case DebugSnapshot: + builder.WriteString("Snapshot|") + case DebugConstraints: + builder.WriteString("Constraints|") + case DebugBuilderObjects: + builder.WriteString("BuilderObjects|") + case DebugA11Y: + builder.WriteString("A11Y|") + case DebugIconfallback: + builder.WriteString("Iconfallback|") + case DebugInvertTextDir: + builder.WriteString("InvertTextDir|") + default: + builder.WriteString(fmt.Sprintf("DebugFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DebugFlags) Has(other DebugFlags) bool { + return (d & other) == other +} + +// DialogFlags flags used to influence dialog construction. +type DialogFlags C.guint + +const ( + // DialogModal: make the constructed dialog modal. + DialogModal DialogFlags = 0b1 + // DialogDestroyWithParent: destroy the dialog when its parent is destroyed. + DialogDestroyWithParent DialogFlags = 0b10 + // DialogUseHeaderBar: create dialog with actions in header bar instead of + // action area. + DialogUseHeaderBar DialogFlags = 0b100 +) + +func marshalDialogFlags(p uintptr) (interface{}, error) { + return DialogFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for DialogFlags. +func (d DialogFlags) String() string { + if d == 0 { + return "DialogFlags(0)" + } + + var builder strings.Builder + builder.Grow(54) + + for d != 0 { + next := d & (d - 1) + bit := d - next + + switch bit { + case DialogModal: + builder.WriteString("Modal|") + case DialogDestroyWithParent: + builder.WriteString("DestroyWithParent|") + case DialogUseHeaderBar: + builder.WriteString("UseHeaderBar|") + default: + builder.WriteString(fmt.Sprintf("DialogFlags(0b%b)|", bit)) + } + + d = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if d contains other. +func (d DialogFlags) Has(other DialogFlags) bool { + return (d & other) == other +} + +// EventControllerScrollFlags describes the behavior of a +// GtkEventControllerScroll. +type EventControllerScrollFlags C.guint + +const ( + // EventControllerScrollNone: don't emit scroll. + EventControllerScrollNone EventControllerScrollFlags = 0b0 + // EventControllerScrollVertical: emit scroll with vertical deltas. + EventControllerScrollVertical EventControllerScrollFlags = 0b1 + // EventControllerScrollHorizontal: emit scroll with horizontal deltas. + EventControllerScrollHorizontal EventControllerScrollFlags = 0b10 + // EventControllerScrollDiscrete: only emit deltas that are multiples of 1. + EventControllerScrollDiscrete EventControllerScrollFlags = 0b100 + // EventControllerScrollKinetic: emit ::decelerate after continuous scroll + // finishes. + EventControllerScrollKinetic EventControllerScrollFlags = 0b1000 + // EventControllerScrollBothAxes: emit scroll on both axes. + EventControllerScrollBothAxes EventControllerScrollFlags = 0b11 +) + +func marshalEventControllerScrollFlags(p uintptr) (interface{}, error) { + return EventControllerScrollFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for EventControllerScrollFlags. +func (e EventControllerScrollFlags) String() string { + if e == 0 { + return "EventControllerScrollFlags(0)" + } + + var builder strings.Builder + builder.Grow(176) + + for e != 0 { + next := e & (e - 1) + bit := e - next + + switch bit { + case EventControllerScrollNone: + builder.WriteString("None|") + case EventControllerScrollVertical: + builder.WriteString("Vertical|") + case EventControllerScrollHorizontal: + builder.WriteString("Horizontal|") + case EventControllerScrollDiscrete: + builder.WriteString("Discrete|") + case EventControllerScrollKinetic: + builder.WriteString("Kinetic|") + case EventControllerScrollBothAxes: + builder.WriteString("BothAxes|") + default: + builder.WriteString(fmt.Sprintf("EventControllerScrollFlags(0b%b)|", bit)) + } + + e = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if e contains other. +func (e EventControllerScrollFlags) Has(other EventControllerScrollFlags) bool { + return (e & other) == other +} + +// FontChooserLevel specifies the granularity of font selection that is desired +// in a GtkFontChooser. +// +// This enumeration may be extended in the future; applications should ignore +// unknown values. +type FontChooserLevel C.guint + +const ( + // FontChooserLevelFamily: allow selecting a font family. + FontChooserLevelFamily FontChooserLevel = 0b0 + // FontChooserLevelStyle: allow selecting a specific font face. + FontChooserLevelStyle FontChooserLevel = 0b1 + // FontChooserLevelSize: allow selecting a specific font size. + FontChooserLevelSize FontChooserLevel = 0b10 + // FontChooserLevelVariations: allow changing OpenType font variation axes. + FontChooserLevelVariations FontChooserLevel = 0b100 + // FontChooserLevelFeatures: allow selecting specific OpenType font + // features. + FontChooserLevelFeatures FontChooserLevel = 0b1000 +) + +func marshalFontChooserLevel(p uintptr) (interface{}, error) { + return FontChooserLevel(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for FontChooserLevel. +func (f FontChooserLevel) String() string { + if f == 0 { + return "FontChooserLevel(0)" + } + + var builder strings.Builder + builder.Grow(117) + + for f != 0 { + next := f & (f - 1) + bit := f - next + + switch bit { + case FontChooserLevelFamily: + builder.WriteString("Family|") + case FontChooserLevelStyle: + builder.WriteString("Style|") + case FontChooserLevelSize: + builder.WriteString("Size|") + case FontChooserLevelVariations: + builder.WriteString("Variations|") + case FontChooserLevelFeatures: + builder.WriteString("Features|") + default: + builder.WriteString(fmt.Sprintf("FontChooserLevel(0b%b)|", bit)) + } + + f = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if f contains other. +func (f FontChooserLevel) Has(other FontChooserLevel) bool { + return (f & other) == other +} + +// IconLookupFlags: used to specify options for gtk_icon_theme_lookup_icon(). +type IconLookupFlags C.guint + +const ( + // IconLookupForceRegular: try to always load regular icons, even when + // symbolic icon names are given. + IconLookupForceRegular IconLookupFlags = 0b1 + // IconLookupForceSymbolic: try to always load symbolic icons, even when + // regular icon names are given. + IconLookupForceSymbolic IconLookupFlags = 0b10 + // IconLookupPreload starts loading the texture in the background so it is + // ready when later needed. + IconLookupPreload IconLookupFlags = 0b100 +) + +func marshalIconLookupFlags(p uintptr) (interface{}, error) { + return IconLookupFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for IconLookupFlags. +func (i IconLookupFlags) String() string { + if i == 0 { + return "IconLookupFlags(0)" + } + + var builder strings.Builder + builder.Grow(64) + + for i != 0 { + next := i & (i - 1) + bit := i - next + + switch bit { + case IconLookupForceRegular: + builder.WriteString("ForceRegular|") + case IconLookupForceSymbolic: + builder.WriteString("ForceSymbolic|") + case IconLookupPreload: + builder.WriteString("Preload|") + default: + builder.WriteString(fmt.Sprintf("IconLookupFlags(0b%b)|", bit)) + } + + i = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if i contains other. +func (i IconLookupFlags) Has(other IconLookupFlags) bool { + return (i & other) == other +} + +// InputHints describes hints that might be taken into account by input methods +// or applications. +// +// Note that input methods may already tailor their behaviour according to the +// inputpurpose of the entry. +// +// Some common sense is expected when using these flags - mixing +// GTK_INPUT_HINT_LOWERCASE with any of the uppercase hints makes no sense. +// +// This enumeration may be extended in the future; input methods should ignore +// unknown values. +type InputHints C.guint + +const ( + // InputHintNone: no special behaviour suggested. + InputHintNone InputHints = 0b0 + // InputHintSpellcheck: suggest checking for typos. + InputHintSpellcheck InputHints = 0b1 + // InputHintNoSpellcheck: suggest not checking for typos. + InputHintNoSpellcheck InputHints = 0b10 + // InputHintWordCompletion: suggest word completion. + InputHintWordCompletion InputHints = 0b100 + // InputHintLowercase: suggest to convert all text to lowercase. + InputHintLowercase InputHints = 0b1000 + // InputHintUppercaseChars: suggest to capitalize all text. + InputHintUppercaseChars InputHints = 0b10000 + // InputHintUppercaseWords: suggest to capitalize the first character of + // each word. + InputHintUppercaseWords InputHints = 0b100000 + // InputHintUppercaseSentences: suggest to capitalize the first word of each + // sentence. + InputHintUppercaseSentences InputHints = 0b1000000 + // InputHintInhibitOSK: suggest to not show an onscreen keyboard (e.g for a + // calculator that already has all the keys). + InputHintInhibitOSK InputHints = 0b10000000 + // InputHintVerticalWriting: text is vertical. + InputHintVerticalWriting InputHints = 0b100000000 + // InputHintEmoji: suggest offering Emoji support. + InputHintEmoji InputHints = 0b1000000000 + // InputHintNoEmoji: suggest not offering Emoji support. + InputHintNoEmoji InputHints = 0b10000000000 + // InputHintPrivate: request that the input method should not update + // personalized data (like typing history). + InputHintPrivate InputHints = 0b100000000000 +) + +func marshalInputHints(p uintptr) (interface{}, error) { + return InputHints(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for InputHints. +func (i InputHints) String() string { + if i == 0 { + return "InputHints(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for i != 0 { + next := i & (i - 1) + bit := i - next + + switch bit { + case InputHintNone: + builder.WriteString("None|") + case InputHintSpellcheck: + builder.WriteString("Spellcheck|") + case InputHintNoSpellcheck: + builder.WriteString("NoSpellcheck|") + case InputHintWordCompletion: + builder.WriteString("WordCompletion|") + case InputHintLowercase: + builder.WriteString("Lowercase|") + case InputHintUppercaseChars: + builder.WriteString("UppercaseChars|") + case InputHintUppercaseWords: + builder.WriteString("UppercaseWords|") + case InputHintUppercaseSentences: + builder.WriteString("UppercaseSentences|") + case InputHintInhibitOSK: + builder.WriteString("InhibitOSK|") + case InputHintVerticalWriting: + builder.WriteString("VerticalWriting|") + case InputHintEmoji: + builder.WriteString("Emoji|") + case InputHintNoEmoji: + builder.WriteString("NoEmoji|") + case InputHintPrivate: + builder.WriteString("Private|") + default: + builder.WriteString(fmt.Sprintf("InputHints(0b%b)|", bit)) + } + + i = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if i contains other. +func (i InputHints) Has(other InputHints) bool { + return (i & other) == other +} + +// ListScrollFlags: list of actions to perform when scrolling to items in a list +// widget. +type ListScrollFlags C.guint + +const ( + // ListScrollNone: don't do anything extra. + ListScrollNone ListScrollFlags = 0b0 + // ListScrollFocus focus the target item. + ListScrollFocus ListScrollFlags = 0b1 + // ListScrollSelect: select the target item and unselect all other items. + ListScrollSelect ListScrollFlags = 0b10 +) + +func marshalListScrollFlags(p uintptr) (interface{}, error) { + return ListScrollFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ListScrollFlags. +func (l ListScrollFlags) String() string { + if l == 0 { + return "ListScrollFlags(0)" + } + + var builder strings.Builder + builder.Grow(47) + + for l != 0 { + next := l & (l - 1) + bit := l - next + + switch bit { + case ListScrollNone: + builder.WriteString("None|") + case ListScrollFocus: + builder.WriteString("Focus|") + case ListScrollSelect: + builder.WriteString("Select|") + default: + builder.WriteString(fmt.Sprintf("ListScrollFlags(0b%b)|", bit)) + } + + l = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if l contains other. +func (l ListScrollFlags) Has(other ListScrollFlags) bool { + return (l & other) == other +} + +// PickFlags flags that influence the behavior of widget.Pick. +type PickFlags C.guint + +const ( + // PickDefault: default behavior, include widgets that are receiving events. + PickDefault PickFlags = 0b0 + // PickInsensitive: include widgets that are insensitive. + PickInsensitive PickFlags = 0b1 + // PickNonTargetable: include widgets that are marked as non-targetable. + // See widget:can-target. + PickNonTargetable PickFlags = 0b10 +) + +func marshalPickFlags(p uintptr) (interface{}, error) { + return PickFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for PickFlags. +func (p PickFlags) String() string { + if p == 0 { + return "PickFlags(0)" + } + + var builder strings.Builder + builder.Grow(45) + + for p != 0 { + next := p & (p - 1) + bit := p - next + + switch bit { + case PickDefault: + builder.WriteString("Default|") + case PickInsensitive: + builder.WriteString("Insensitive|") + case PickNonTargetable: + builder.WriteString("NonTargetable|") + default: + builder.WriteString(fmt.Sprintf("PickFlags(0b%b)|", bit)) + } + + p = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if p contains other. +func (p PickFlags) Has(other PickFlags) bool { + return (p & other) == other +} + +// PopoverMenuFlags flags that affect how gtk.PopoverMenu widgets built from a +// gio.MenuModel are created and displayed. +type PopoverMenuFlags C.guint + +const ( + // PopoverMenuSliding submenus are presented as sliding submenus that + // replace the main menu. + PopoverMenuSliding PopoverMenuFlags = 0b0 + // PopoverMenuNested submenus are presented as traditional, nested popovers. + PopoverMenuNested PopoverMenuFlags = 0b1 +) + +func marshalPopoverMenuFlags(p uintptr) (interface{}, error) { + return PopoverMenuFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for PopoverMenuFlags. +func (p PopoverMenuFlags) String() string { + if p == 0 { + return "PopoverMenuFlags(0)" + } + + var builder strings.Builder + builder.Grow(36) + + for p != 0 { + next := p & (p - 1) + bit := p - next + + switch bit { + case PopoverMenuSliding: + builder.WriteString("Sliding|") + case PopoverMenuNested: + builder.WriteString("Nested|") + default: + builder.WriteString(fmt.Sprintf("PopoverMenuFlags(0b%b)|", bit)) + } + + p = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if p contains other. +func (p PopoverMenuFlags) Has(other PopoverMenuFlags) bool { + return (p & other) == other +} + +// ShortcutActionFlags: list of flags that can be passed to action activation. +// +// More flags may be added in the future. +type ShortcutActionFlags C.guint + +const ( + // ShortcutActionExclusive: action is the only action that can be activated. + // If this flag is not set, a future activation may select a different + // action. + ShortcutActionExclusive ShortcutActionFlags = 0b1 +) + +func marshalShortcutActionFlags(p uintptr) (interface{}, error) { + return ShortcutActionFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for ShortcutActionFlags. +func (s ShortcutActionFlags) String() string { + if s == 0 { + return "ShortcutActionFlags(0)" + } + + var builder strings.Builder + builder.Grow(23) + + for s != 0 { + next := s & (s - 1) + bit := s - next + + switch bit { + case ShortcutActionExclusive: + builder.WriteString("Exclusive|") + default: + builder.WriteString(fmt.Sprintf("ShortcutActionFlags(0b%b)|", bit)) + } + + s = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if s contains other. +func (s ShortcutActionFlags) Has(other ShortcutActionFlags) bool { + return (s & other) == other +} + +// StateFlags describes a widget state. +// +// Widget states are used to match the widget against CSS pseudo-classes. Note +// that GTK extends the regular CSS classes and sometimes uses different names. +type StateFlags C.guint + +const ( + // StateFlagNormal: state during normal operation. + StateFlagNormal StateFlags = 0b0 + // StateFlagActive: widget is active. + StateFlagActive StateFlags = 0b1 + // StateFlagPrelight: widget has a mouse pointer over it. + StateFlagPrelight StateFlags = 0b10 + // StateFlagSelected: widget is selected. + StateFlagSelected StateFlags = 0b100 + // StateFlagInsensitive: widget is insensitive. + StateFlagInsensitive StateFlags = 0b1000 + // StateFlagInconsistent: widget is inconsistent. + StateFlagInconsistent StateFlags = 0b10000 + // StateFlagFocused: widget has the keyboard focus. + StateFlagFocused StateFlags = 0b100000 + // StateFlagBackdrop: widget is in a background toplevel window. + StateFlagBackdrop StateFlags = 0b1000000 + // StateFlagDirLTR: widget is in left-to-right text direction. + StateFlagDirLTR StateFlags = 0b10000000 + // StateFlagDirRTL: widget is in right-to-left text direction. + StateFlagDirRTL StateFlags = 0b100000000 + // StateFlagLink: widget is a link. + StateFlagLink StateFlags = 0b1000000000 + // StateFlagVisited: location the widget points to has already been visited. + StateFlagVisited StateFlags = 0b10000000000 + // StateFlagChecked: widget is checked. + StateFlagChecked StateFlags = 0b100000000000 + // StateFlagDropActive: widget is highlighted as a drop target for DND. + StateFlagDropActive StateFlags = 0b1000000000000 + // StateFlagFocusVisible: widget has the visible focus. + StateFlagFocusVisible StateFlags = 0b10000000000000 + // StateFlagFocusWithin: widget contains the keyboard focus. + StateFlagFocusWithin StateFlags = 0b100000000000000 +) + +func marshalStateFlags(p uintptr) (interface{}, error) { + return StateFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for StateFlags. +func (s StateFlags) String() string { + if s == 0 { + return "StateFlags(0)" + } + + var builder strings.Builder + builder.Grow(256) + + for s != 0 { + next := s & (s - 1) + bit := s - next + + switch bit { + case StateFlagNormal: + builder.WriteString("Normal|") + case StateFlagActive: + builder.WriteString("Active|") + case StateFlagPrelight: + builder.WriteString("Prelight|") + case StateFlagSelected: + builder.WriteString("Selected|") + case StateFlagInsensitive: + builder.WriteString("Insensitive|") + case StateFlagInconsistent: + builder.WriteString("Inconsistent|") + case StateFlagFocused: + builder.WriteString("Focused|") + case StateFlagBackdrop: + builder.WriteString("Backdrop|") + case StateFlagDirLTR: + builder.WriteString("DirLTR|") + case StateFlagDirRTL: + builder.WriteString("DirRTL|") + case StateFlagLink: + builder.WriteString("Link|") + case StateFlagVisited: + builder.WriteString("Visited|") + case StateFlagChecked: + builder.WriteString("Checked|") + case StateFlagDropActive: + builder.WriteString("DropActive|") + case StateFlagFocusVisible: + builder.WriteString("FocusVisible|") + case StateFlagFocusWithin: + builder.WriteString("FocusWithin|") + default: + builder.WriteString(fmt.Sprintf("StateFlags(0b%b)|", bit)) + } + + s = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if s contains other. +func (s StateFlags) Has(other StateFlags) bool { + return (s & other) == other +} + +// StyleContextPrintFlags flags that modify the behavior of +// gtk_style_context_to_string(). +// +// New values may be added to this enumeration. +type StyleContextPrintFlags C.guint + +const ( + // StyleContextPrintNone: default value. + StyleContextPrintNone StyleContextPrintFlags = 0b0 + // StyleContextPrintRecurse: print the entire tree of CSS nodes starting at + // the style context's node. + StyleContextPrintRecurse StyleContextPrintFlags = 0b1 + // StyleContextPrintShowStyle: show the values of the CSS properties for + // each node. + StyleContextPrintShowStyle StyleContextPrintFlags = 0b10 + // StyleContextPrintShowChange: show information about what changes affect + // the styles. + StyleContextPrintShowChange StyleContextPrintFlags = 0b100 +) + +func marshalStyleContextPrintFlags(p uintptr) (interface{}, error) { + return StyleContextPrintFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for StyleContextPrintFlags. +func (s StyleContextPrintFlags) String() string { + if s == 0 { + return "StyleContextPrintFlags(0)" + } + + var builder strings.Builder + builder.Grow(101) + + for s != 0 { + next := s & (s - 1) + bit := s - next + + switch bit { + case StyleContextPrintNone: + builder.WriteString("None|") + case StyleContextPrintRecurse: + builder.WriteString("Recurse|") + case StyleContextPrintShowStyle: + builder.WriteString("ShowStyle|") + case StyleContextPrintShowChange: + builder.WriteString("ShowChange|") + default: + builder.WriteString(fmt.Sprintf("StyleContextPrintFlags(0b%b)|", bit)) + } + + s = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if s contains other. +func (s StyleContextPrintFlags) Has(other StyleContextPrintFlags) bool { + return (s & other) == other +} + +// TextSearchFlags flags affecting how a search is done. +// +// If neither GTK_TEXT_SEARCH_VISIBLE_ONLY nor GTK_TEXT_SEARCH_TEXT_ONLY are +// enabled, the match must be exact; the special 0xFFFC character will match +// embedded paintables or child widgets. +type TextSearchFlags C.guint + +const ( + // TextSearchVisibleOnly: search only visible data. A search match may have + // invisible text interspersed. + TextSearchVisibleOnly TextSearchFlags = 0b1 + // TextSearchTextOnly: search only text. A match may have paintables or + // child widgets mixed inside the matched range. + TextSearchTextOnly TextSearchFlags = 0b10 + // TextSearchCaseInsensitive: text will be matched regardless of what case + // it is in. + TextSearchCaseInsensitive TextSearchFlags = 0b100 +) + +func marshalTextSearchFlags(p uintptr) (interface{}, error) { + return TextSearchFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for TextSearchFlags. +func (t TextSearchFlags) String() string { + if t == 0 { + return "TextSearchFlags(0)" + } + + var builder strings.Builder + builder.Grow(66) + + for t != 0 { + next := t & (t - 1) + bit := t - next + + switch bit { + case TextSearchVisibleOnly: + builder.WriteString("VisibleOnly|") + case TextSearchTextOnly: + builder.WriteString("TextOnly|") + case TextSearchCaseInsensitive: + builder.WriteString("CaseInsensitive|") + default: + builder.WriteString(fmt.Sprintf("TextSearchFlags(0b%b)|", bit)) + } + + t = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if t contains other. +func (t TextSearchFlags) Has(other TextSearchFlags) bool { + return (t & other) == other +} + +// TreeModelFlags: these flags indicate various properties of a GtkTreeModel. +// +// They are returned by gtk.TreeModel.GetFlags(), and must be static +// for the lifetime of the object. A more complete description of +// GTK_TREE_MODEL_ITERS_PERSIST can be found in the overview of this section. +// +// Deprecated: since version 4.10. +type TreeModelFlags C.guint + +const ( + // TreeModelItersPersist iterators survive all signals emitted by the tree. + TreeModelItersPersist TreeModelFlags = 0b1 + // TreeModelListOnly: model is a list only, and never has children. + TreeModelListOnly TreeModelFlags = 0b10 +) + +func marshalTreeModelFlags(p uintptr) (interface{}, error) { + return TreeModelFlags(coreglib.ValueFromNative(unsafe.Pointer(p)).Flags()), nil +} + +// String returns the names in string for TreeModelFlags. +func (t TreeModelFlags) String() string { + if t == 0 { + return "TreeModelFlags(0)" + } + + var builder strings.Builder + builder.Grow(39) + + for t != 0 { + next := t & (t - 1) + bit := t - next + + switch bit { + case TreeModelItersPersist: + builder.WriteString("ItersPersist|") + case TreeModelListOnly: + builder.WriteString("ListOnly|") + default: + builder.WriteString(fmt.Sprintf("TreeModelFlags(0b%b)|", bit)) + } + + t = next + } + + return strings.TrimSuffix(builder.String(), "|") +} + +// Has returns true if t contains other. +func (t TreeModelFlags) Has(other TreeModelFlags) bool { + return (t & other) == other +} + +// AssistantPageFunc: type of callback used to calculate the next page in a +// GtkAssistant. +// +// It’s called both for computing the next page when the user presses the +// “forward” button and for handling the behavior of the “last” button. +// +// See gtk.Assistant.SetForwardPageFunc(). +type AssistantPageFunc func(currentPage int) (gint int) + +// CellAllocCallback: type of the callback functions used for iterating +// over the cell renderers and their allocated areas inside a GtkCellArea, +// see gtk_cell_area_foreach_alloc(). +type CellAllocCallback func(renderer CellRendererer, cellArea, cellBackground *gdk.Rectangle) (ok bool) + +// CellCallback: type of the callback functions used for iterating over the cell +// renderers of a GtkCellArea, see gtk_cell_area_foreach(). +type CellCallback func(renderer CellRendererer) (ok bool) + +// CellLayoutDataFunc: function which should set the value of cell_layout’s cell +// renderer(s) as appropriate. +type CellLayoutDataFunc func(cellLayout CellLayouter, cell CellRendererer, treeModel TreeModeller, iter *TreeIter) + +// CustomFilterFunc: user function that is called to determine if the item +// should be matched. +// +// If the filter matches the item, this function must return TRUE. If the item +// should be filtered out, FALSE must be returned. +type CustomFilterFunc func(item *coreglib.Object) (ok bool) + +// DrawingAreaDrawFunc: whenever drawing_area needs to redraw, this function +// will be called. +// +// This function should exclusively redraw the contents of the drawing area and +// must not call any widget functions that cause changes. +type DrawingAreaDrawFunc func(drawingArea *DrawingArea, cr *cairo.Context, width, height int) + +// EntryCompletionMatchFunc: function which decides whether the row indicated +// by iter matches a given key, and should be displayed as a possible completion +// for key. +// +// Note that key is normalized and case-folded (see g_utf8_normalize() and +// g_utf8_casefold()). If this is not appropriate, match functions have +// access to the unmodified key via gtk_editable_get_text (GTK_EDITABLE +// (gtk_entry_completion_get_entry ())). +type EntryCompletionMatchFunc func(completion *EntryCompletion, key string, iter *TreeIter) (ok bool) + +// ExpressionNotify: callback called by gtk_expression_watch() when the +// expression value changes. +type ExpressionNotify func() + +// FlowBoxCreateWidgetFunc: called for flow boxes that are bound to a +// GListModel. +// +// This function is called for each item that gets added to the model. +type FlowBoxCreateWidgetFunc func(item *coreglib.Object) (widget Widgetter) + +// FlowBoxFilterFunc: function that will be called whenever a child changes or +// is added. +// +// It lets you control if the child should be visible or not. +type FlowBoxFilterFunc func(child *FlowBoxChild) (ok bool) + +// FlowBoxForEachFunc: function used by gtk_flow_box_selected_foreach(). +// +// It will be called on every selected child of the box. +type FlowBoxForEachFunc func(box *FlowBox, child *FlowBoxChild) + +// FlowBoxSortFunc: function to compare two children to determine which should +// come first. +type FlowBoxSortFunc func(child1, child2 *FlowBoxChild) (gint int) + +// FontFilterFunc: type of function that is used for deciding what fonts get +// shown in a GtkFontChooser. +// +// See gtk.FontChooser.SetFilterFunc(). +type FontFilterFunc func(family pango.FontFamilier, face pango.FontFacer) (ok bool) + +// IconViewForEachFunc: function used by gtk_icon_view_selected_foreach() to map +// all selected rows. +// +// It will be called on every selected row in the view. +type IconViewForEachFunc func(iconView *IconView, path *TreePath) + +// ListBoxCreateWidgetFunc: called for list boxes that are bound to a GListModel +// with gtk_list_box_bind_model() for each item that gets added to the model. +// +// If the widget returned is not a ListBoxRow widget, then the widget will be +// inserted as the child of an intermediate ListBoxRow. +type ListBoxCreateWidgetFunc func(item *coreglib.Object) (widget Widgetter) + +// ListBoxFilterFunc will be called whenever the row changes or is added and +// lets you control if the row should be visible or not. +type ListBoxFilterFunc func(row *ListBoxRow) (ok bool) + +// ListBoxForEachFunc: function used by gtk_list_box_selected_foreach(). +// +// It will be called on every selected child of the box. +type ListBoxForEachFunc func(box *ListBox, row *ListBoxRow) + +// ListBoxSortFunc: compare two rows to determine which should be first. +type ListBoxSortFunc func(row1, row2 *ListBoxRow) (gint int) + +// ListBoxUpdateHeaderFunc: whenever row changes or which row is before row +// changes this is called, which lets you update the header on row. +// +// You may remove or set a new one via gtk.ListBoxRow.SetHeader() or just change +// the state of the current header widget. +type ListBoxUpdateHeaderFunc func(row, before *ListBoxRow) + +// MapListModelMapFunc: user function that is called to map an item of the +// original model to an item expected by the map model. +// +// The returned items must conform to the item type of the model they are used +// with. +type MapListModelMapFunc func(item *coreglib.Object) (object *coreglib.Object) + +// MenuButtonCreatePopupFunc: user-provided callback function to create a popup +// for a GtkMenuButton on demand. +// +// This function is called when the popup of menu_button is shown, +// but none has been provided via gtk.MenuButton.SetPopover() or +// gtk.MenuButton.SetMenuModel(). +type MenuButtonCreatePopupFunc func(menuButton *MenuButton) + +// PageSetupDoneFunc: type of function that is passed to +// gtk_print_run_page_setup_dialog_async(). +// +// This function will be called when the page setup dialog is dismissed, +// and also serves as destroy notify for data. +type PageSetupDoneFunc func(pageSetup *PageSetup) + +type PrintSettingsFunc func(key, value string) + +type ScaleFormatValueFunc func(scale *Scale, value float64) (utf8 string) + +// ShortcutFunc: prototype for shortcuts based on user callbacks. +type ShortcutFunc func(widget Widgetter, args *glib.Variant) (ok bool) + +// TextCharPredicate: predicate function used by +// gtk_text_iter_forward_find_char() and gtk_text_iter_backward_find_char(). +type TextCharPredicate func(ch uint32) (ok bool) + +// TextTagTableForEach: function used with gtk_text_tag_table_foreach(), +// to iterate over every GtkTextTag inside a GtkTextTagTable. +type TextTagTableForEach func(tag *TextTag) + +// TickCallback: callback type for adding a function to update animations. +// See gtk_widget_add_tick_callback(). +type TickCallback func(widget Widgetter, frameClock gdk.FrameClocker) (ok bool) + +// TreeCellDataFunc: function to set the properties of a cell instead of just +// using the straight mapping between the cell and the model. +// +// This function is useful for customizing the cell renderer. For example, +// a function might get an* integer from the tree_model, and render it to the +// “text” attribute of “cell” by converting it to its written equivalent. +// +// See also: gtk_tree_view_column_set_cell_data_func(). +type TreeCellDataFunc func(treeColumn *TreeViewColumn, cell CellRendererer, treeModel TreeModeller, iter *TreeIter) + +// TreeIterCompareFunc should return a negative integer, zero, or a positive +// integer if a sorts before b, a sorts with b, or a sorts after b respectively. +// +// If two iters compare as equal, their order in the sorted model is undefined. +// In order to ensure that the GtkTreeSortable behaves as expected, +// the GtkTreeIterCompareFunc must define a partial order on the model, i.e. +// it must be reflexive, antisymmetric and transitive. +// +// For example, if model is a product catalogue, then a compare function for the +// “price” column could be one which returns price_of(a) - price_of(b). +type TreeIterCompareFunc func(model TreeModeller, a, b *TreeIter) (gint int) + +// TreeListModelCreateModelFunc: prototype of the function called to create new +// child models when gtk_tree_list_row_set_expanded() is called. +// +// This function can return NULL to indicate that item is guaranteed to be a +// leaf node and will never have children. If it does not have children but +// may get children later, it should return an empty model that is filled once +// children arrive. +type TreeListModelCreateModelFunc func(item *coreglib.Object) (listModel *gio.ListModel) + +// TreeModelFilterModifyFunc: function which calculates display values from raw +// values in the model. It must fill value with the display value for the column +// column in the row indicated by iter. +// +// Since this function is called for each data access, it’s not a particularly +// efficient operation. +type TreeModelFilterModifyFunc func(model TreeModeller, iter *TreeIter, column int) (value coreglib.Value) + +// TreeModelFilterVisibleFunc: function which decides whether the row indicated +// by iter is visible. +type TreeModelFilterVisibleFunc func(model TreeModeller, iter *TreeIter) (ok bool) + +// TreeModelForEachFunc: type of the callback passed to gtk_tree_model_foreach() +// to iterate over the rows in a tree model. +type TreeModelForEachFunc func(model TreeModeller, path *TreePath, iter *TreeIter) (ok bool) + +// TreeSelectionForEachFunc: function used by +// gtk_tree_selection_selected_foreach() to map all selected rows. It will be +// called on every selected row in the view. +type TreeSelectionForEachFunc func(model TreeModeller, path *TreePath, iter *TreeIter) + +// TreeSelectionFunc: function used by gtk_tree_selection_set_select_function() +// to filter whether or not a row may be selected. It is called whenever a row's +// state might change. +// +// A return value of TRUE indicates to selection that it is okay to change the +// selection. +type TreeSelectionFunc func(selection *TreeSelection, model TreeModeller, path *TreePath, pathCurrentlySelected bool) (ok bool) + +// TreeViewColumnDropFunc: function type for determining whether column can be +// dropped in a particular spot (as determined by prev_column and next_column). +// In left to right locales, prev_column is on the left of the potential +// drop spot, and next_column is on the right. In right to left mode, this is +// reversed. This function should return TRUE if the spot is a valid drop spot. +// Please note that returning TRUE does not actually indicate that the column +// drop was made, but is meant only to indicate a possible drop spot to the +// user. +type TreeViewColumnDropFunc func(treeView *TreeView, column, prevColumn, nextColumn *TreeViewColumn) (ok bool) + +// TreeViewMappingFunc: function used for gtk_tree_view_map_expanded_rows(). +type TreeViewMappingFunc func(treeView *TreeView, path *TreePath) + +// TreeViewRowSeparatorFunc: function type for determining whether the row +// pointed to by iter should be rendered as a separator. A common way to +// implement this is to have a boolean column in the model, whose values the +// GtkTreeViewRowSeparatorFunc returns. +type TreeViewRowSeparatorFunc func(model TreeModeller, iter *TreeIter) (ok bool) + +// TreeViewSearchEqualFunc: function used for checking whether a row in model +// matches a search key string entered by the user. Note the return value is +// reversed from what you would normally expect, though it has some similarity +// to strcmp() returning 0 for equal strings. +type TreeViewSearchEqualFunc func(model TreeModeller, column int, key string, iter *TreeIter) (ok bool) + +// AcceleratorGetDefaultModMask gets the modifier mask. +// +// The modifier mask determines which modifiers are considered significant +// for keyboard accelerators. This includes all keyboard modifiers except for +// GDK_LOCK_MASK. +// +// The function returns the following values: +// +// - modifierType: modifier mask for accelerators. +func AcceleratorGetDefaultModMask() gdk.ModifierType { + var _cret C.GdkModifierType // in + + _cret = C.gtk_accelerator_get_default_mod_mask() + + var _modifierType gdk.ModifierType // out + + _modifierType = gdk.ModifierType(_cret) + + return _modifierType +} + +// AcceleratorGetLabel converts an accelerator keyval and modifier mask into a +// string which can be used to represent the accelerator to the user. +// +// The function takes the following parameters: +// +// - acceleratorKey: accelerator keyval. +// - acceleratorMods: accelerator modifier mask. +// +// The function returns the following values: +// +// - utf8: newly-allocated string representing the accelerator. +func AcceleratorGetLabel(acceleratorKey uint, acceleratorMods gdk.ModifierType) string { + var _arg1 C.guint // out + var _arg2 C.GdkModifierType // out + var _cret *C.char // in + + _arg1 = C.guint(acceleratorKey) + _arg2 = C.GdkModifierType(acceleratorMods) + + _cret = C.gtk_accelerator_get_label(_arg1, _arg2) + runtime.KeepAlive(acceleratorKey) + runtime.KeepAlive(acceleratorMods) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// AcceleratorGetLabelWithKeycode converts an accelerator keyval and modifier +// mask into a string that can be displayed to the user. +// +// The string may be translated. +// +// This function is similar to gtk.AcceleratorGetLabel(), but handling keycodes. +// This is only useful for system-level components, applications should use +// gtk.AcceleratorGetLabel() instead. +// +// The function takes the following parameters: +// +// - display (optional): GdkDisplay or NULL to use the default display. +// - acceleratorKey: accelerator keyval. +// - keycode: accelerator keycode. +// - acceleratorMods: accelerator modifier mask. +// +// The function returns the following values: +// +// - utf8: newly-allocated string representing the accelerator. +func AcceleratorGetLabelWithKeycode(display *gdk.Display, acceleratorKey, keycode uint, acceleratorMods gdk.ModifierType) string { + var _arg1 *C.GdkDisplay // out + var _arg2 C.guint // out + var _arg3 C.guint // out + var _arg4 C.GdkModifierType // out + var _cret *C.char // in + + if display != nil { + _arg1 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + } + _arg2 = C.guint(acceleratorKey) + _arg3 = C.guint(keycode) + _arg4 = C.GdkModifierType(acceleratorMods) + + _cret = C.gtk_accelerator_get_label_with_keycode(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(display) + runtime.KeepAlive(acceleratorKey) + runtime.KeepAlive(keycode) + runtime.KeepAlive(acceleratorMods) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// AcceleratorName converts an accelerator keyval and modifier mask into a +// string parseable by gtk_accelerator_parse(). +// +// For example, if you pass in GDK_KEY_q and GDK_CONTROL_MASK, this function +// returns q. +// +// If you need to display accelerators in the user interface, see +// gtk.AcceleratorGetLabel(). +// +// The function takes the following parameters: +// +// - acceleratorKey: accelerator keyval. +// - acceleratorMods: accelerator modifier mask. +// +// The function returns the following values: +// +// - utf8: newly-allocated accelerator name. +func AcceleratorName(acceleratorKey uint, acceleratorMods gdk.ModifierType) string { + var _arg1 C.guint // out + var _arg2 C.GdkModifierType // out + var _cret *C.char // in + + _arg1 = C.guint(acceleratorKey) + _arg2 = C.GdkModifierType(acceleratorMods) + + _cret = C.gtk_accelerator_name(_arg1, _arg2) + runtime.KeepAlive(acceleratorKey) + runtime.KeepAlive(acceleratorMods) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// AcceleratorNameWithKeycode converts an accelerator keyval and modifier mask +// into a string parseable by gtk_accelerator_parse_with_keycode(). +// +// This is similar to gtk.AcceleratorName() but handling keycodes. +// This is only useful for system-level components, applications should use +// gtk.AcceleratorName() instead. +// +// The function takes the following parameters: +// +// - display (optional): GdkDisplay or NULL to use the default display. +// - acceleratorKey: accelerator keyval. +// - keycode: accelerator keycode. +// - acceleratorMods: accelerator modifier mask. +// +// The function returns the following values: +// +// - utf8: newly allocated accelerator name. +func AcceleratorNameWithKeycode(display *gdk.Display, acceleratorKey, keycode uint, acceleratorMods gdk.ModifierType) string { + var _arg1 *C.GdkDisplay // out + var _arg2 C.guint // out + var _arg3 C.guint // out + var _arg4 C.GdkModifierType // out + var _cret *C.char // in + + if display != nil { + _arg1 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + } + _arg2 = C.guint(acceleratorKey) + _arg3 = C.guint(keycode) + _arg4 = C.GdkModifierType(acceleratorMods) + + _cret = C.gtk_accelerator_name_with_keycode(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(display) + runtime.KeepAlive(acceleratorKey) + runtime.KeepAlive(keycode) + runtime.KeepAlive(acceleratorMods) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// AcceleratorParse parses a string representing an accelerator. +// +// The format looks like “a” or “F1”. +// +// The parser is fairly liberal and allows lower or upper case, and also +// abbreviations such as “” and “”. +// +// Key names are parsed using gdk.KeyvalFromName(). For character keys the name +// is not the symbol, but the lowercase name, e.g. one would use “minus” +// instead of “-”. +// +// Modifiers are enclosed in angular brackets <>, and match the gdk.ModifierType +// mask: +// +// - for GDK_SHIFT_MASK +// +// - for GDK_CONTROL_MASK +// +// - for GDK_ALT_MASK +// +// - for GDK_META_MASK +// +// - for GDK_SUPER_MASK +// +// - for GDK_HYPER_MASK +// +// If the parse operation fails, accelerator_key and accelerator_mods will be +// set to 0 (zero). +// +// The function takes the following parameters: +// +// - accelerator: string representing an accelerator. +// +// The function returns the following values: +// +// - acceleratorKey (optional): return location for accelerator keyval. +// - acceleratorMods (optional): return location for accelerator modifier +// mask. +// - ok +func AcceleratorParse(accelerator string) (uint, gdk.ModifierType, bool) { + var _arg1 *C.char // out + var _arg2 C.guint // in + var _arg3 C.GdkModifierType // in + var _cret C.gboolean // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(accelerator))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gtk_accelerator_parse(_arg1, &_arg2, &_arg3) + runtime.KeepAlive(accelerator) + + var _acceleratorKey uint // out + var _acceleratorMods gdk.ModifierType // out + var _ok bool // out + + _acceleratorKey = uint(_arg2) + _acceleratorMods = gdk.ModifierType(_arg3) + if _cret != 0 { + _ok = true + } + + return _acceleratorKey, _acceleratorMods, _ok +} + +// AcceleratorParseWithKeycode parses a string representing an accelerator. +// +// This is similar to gtk.AcceleratorParse() but handles keycodes as well. +// This is only useful for system-level components, applications should use +// gtk.AcceleratorParse() instead. +// +// If accelerator_codes is given and the result stored in it is non-NULL, +// the result must be freed with g_free(). +// +// If a keycode is present in the accelerator and no accelerator_codes is given, +// the parse will fail. +// +// If the parse fails, accelerator_key, accelerator_mods and accelerator_codes +// will be set to 0 (zero). +// +// The function takes the following parameters: +// +// - accelerator: string representing an accelerator. +// - display (optional): GdkDisplay to look up accelerator_codes in. +// +// The function returns the following values: +// +// - acceleratorKey (optional): return location for accelerator keyval. +// - acceleratorCodes (optional): return location for accelerator keycodes. +// - acceleratorMods (optional): return location for accelerator modifier +// mask. +// - ok: TRUE if parsing succeeded. +func AcceleratorParseWithKeycode(accelerator string, display *gdk.Display) (uint, []uint, gdk.ModifierType, bool) { + var _arg1 *C.char // out + var _arg2 *C.GdkDisplay // out + var _arg3 C.guint // in + var _arg4 *C.guint // in + var _arg5 C.GdkModifierType // in + var _cret C.gboolean // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(accelerator))) + defer C.free(unsafe.Pointer(_arg1)) + if display != nil { + _arg2 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + } + + _cret = C.gtk_accelerator_parse_with_keycode(_arg1, _arg2, &_arg3, &_arg4, &_arg5) + runtime.KeepAlive(accelerator) + runtime.KeepAlive(display) + + var _acceleratorKey uint // out + var _acceleratorCodes []uint // out + var _acceleratorMods gdk.ModifierType // out + var _ok bool // out + + _acceleratorKey = uint(_arg3) + if _arg4 != nil { + defer C.free(unsafe.Pointer(_arg4)) + { + var i int + var z C.guint + for p := _arg4; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg4, i) + _acceleratorCodes = make([]uint, i) + for i := range src { + _acceleratorCodes[i] = uint(src[i]) + } + } + } + _acceleratorMods = gdk.ModifierType(_arg5) + if _cret != 0 { + _ok = true + } + + return _acceleratorKey, _acceleratorCodes, _acceleratorMods, _ok +} + +// AcceleratorValid determines whether a given keyval and modifier mask +// constitute a valid keyboard accelerator. +// +// For example, the GDK_KEY_a keyval plus GDK_CONTROL_MASK mark is valid, +// and matches the “Ctrl+a” accelerator. But, you can't, for instance, use the +// GDK_KEY_Control_L keyval as an accelerator. +// +// The function takes the following parameters: +// +// - keyval: GDK keyval. +// - modifiers: modifier mask. +// +// The function returns the following values: +// +// - ok: TRUE if the accelerator is valid. +func AcceleratorValid(keyval uint, modifiers gdk.ModifierType) bool { + var _arg1 C.guint // out + var _arg2 C.GdkModifierType // out + var _cret C.gboolean // in + + _arg1 = C.guint(keyval) + _arg2 = C.GdkModifierType(modifiers) + + _cret = C.gtk_accelerator_valid(_arg1, _arg2) + runtime.KeepAlive(keyval) + runtime.KeepAlive(modifiers) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CheckVersion checks that the GTK library in use is compatible with the given +// version. +// +// Generally you would pass in the constants GTK_MAJOR_VERSION, +// GTK_MINOR_VERSION, GTK_MICRO_VERSION as the three arguments to this function; +// that produces a check that the library in use is compatible with the version +// of GTK the application or module was compiled against. +// +// Compatibility is defined by two things: first the +// version of the running library is newer than the version +// required_major.required_minor.required_micro. Second the +// running library must be binary compatible with the version +// required_major.required_minor.required_micro (same major version.) +// +// This function is primarily for GTK modules; the module can call this +// function to check that it wasn’t loaded into an incompatible version of GTK. +// However, such a check isn’t completely reliable, since the module may +// be linked against an old version of GTK and calling the old version of +// gtk_check_version(), but still get loaded into an application using a newer +// version of GTK. +// +// The function takes the following parameters: +// +// - requiredMajor: required major version. +// - requiredMinor: required minor version. +// - requiredMicro: required micro version. +// +// The function returns the following values: +// +// - utf8 (optional): NULL if the GTK library is compatible with the given +// version, or a string describing the version mismatch. The returned string +// is owned by GTK and should not be modified or freed. +func CheckVersion(requiredMajor, requiredMinor, requiredMicro uint) string { + var _arg1 C.guint // out + var _arg2 C.guint // out + var _arg3 C.guint // out + var _cret *C.char // in + + _arg1 = C.guint(requiredMajor) + _arg2 = C.guint(requiredMinor) + _arg3 = C.guint(requiredMicro) + + _cret = C.gtk_check_version(_arg1, _arg2, _arg3) + runtime.KeepAlive(requiredMajor) + runtime.KeepAlive(requiredMinor) + runtime.KeepAlive(requiredMicro) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +func CSSParserErrorQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gtk_css_parser_error_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +func CSSParserWarningQuark() glib.Quark { + var _cret C.GQuark // in + + _cret = C.gtk_css_parser_warning_quark() + + var _quark glib.Quark // out + + _quark = glib.Quark(_cret) + + return _quark +} + +// DisableSetlocale prevents gtk.Init() and gtk.InitCheck() from automatically +// calling setlocale (LC_ALL, ""). +// +// You would want to use this function if you wanted to set the locale for your +// program to something other than the user’s locale, or if you wanted to set +// different values for different locale categories. +// +// Most programs should not need to call this function. +func DisableSetlocale() { + C.gtk_disable_setlocale() +} + +// DistributeNaturalAllocation distributes extra_space to child sizes by +// bringing smaller children up to natural size first. +// +// The remaining space will be added to the minimum_size member of the +// GtkRequestedSize struct. If all sizes reach their natural size then the +// remaining space is returned. +// +// The function takes the following parameters: +// +// - extraSpace: extra space to redistribute among children after subtracting +// minimum sizes and any child padding from the overall allocation. +// - sizes: array of structs with a client pointer and a minimum/natural size +// in the orientation of the allocation. +// +// The function returns the following values: +// +// - gint: remainder of extra_space after redistributing space to sizes. +func DistributeNaturalAllocation(extraSpace int, sizes []RequestedSize) int { + var _arg1 C.int // out + var _arg3 *C.GtkRequestedSize // out + var _arg2 C.guint + var _cret C.int // in + + _arg1 = C.int(extraSpace) + _arg2 = (C.guint)(len(sizes)) + _arg3 = (*C.GtkRequestedSize)(C.calloc(C.size_t(len(sizes)), C.size_t(C.sizeof_GtkRequestedSize))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice((*C.GtkRequestedSize)(_arg3), len(sizes)) + for i := range sizes { + out[i] = *(*C.GtkRequestedSize)(gextras.StructNative(unsafe.Pointer((&sizes[i])))) + } + } + + _cret = C.gtk_distribute_natural_allocation(_arg1, _arg2, _arg3) + runtime.KeepAlive(extraSpace) + runtime.KeepAlive(sizes) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// GetBinaryAge returns the binary age as passed to libtool. +// +// If libtool means nothing to you, don't worry about it. +// +// The function returns the following values: +// +// - guint: binary age of the GTK library. +func GetBinaryAge() uint { + var _cret C.guint // in + + _cret = C.gtk_get_binary_age() + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// GetDebugFlags returns the GTK debug flags that are currently active. +// +// This function is intended for GTK modules that want to adjust their debug +// output based on GTK debug flags. +// +// The function returns the following values: +// +// - debugFlags: GTK debug flags. +func GetDebugFlags() DebugFlags { + var _cret C.GtkDebugFlags // in + + _cret = C.gtk_get_debug_flags() + + var _debugFlags DebugFlags // out + + _debugFlags = DebugFlags(_cret) + + return _debugFlags +} + +// GetDefaultLanguage returns the PangoLanguage for the default language +// currently in effect. +// +// Note that this can change over the life of an application. +// +// The default language is derived from the current locale. It determines, for +// example, whether GTK uses the right-to-left or left-to-right text direction. +// +// This function is equivalent to pango.Language().GetDefault. See that function +// for details. +// +// The function returns the following values: +// +// - language: default language. +func GetDefaultLanguage() *pango.Language { + var _cret *C.PangoLanguage // in + + _cret = C.gtk_get_default_language() + + var _language *pango.Language // out + + _language = (*pango.Language)(gextras.NewStructNative(unsafe.Pointer(_cret))) + + return _language +} + +// GetInterfaceAge returns the interface age as passed to libtool. +// +// If libtool means nothing to you, don't worry about it. +// +// The function returns the following values: +// +// - guint: interface age of the GTK library. +func GetInterfaceAge() uint { + var _cret C.guint // in + + _cret = C.gtk_get_interface_age() + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// GetLocaleDirection: get the direction of the current locale. This is the +// expected reading direction for text and UI. +// +// This function depends on the current locale being set with setlocale() +// and will default to setting the GTK_TEXT_DIR_LTR direction otherwise. +// GTK_TEXT_DIR_NONE will never be returned. +// +// GTK sets the default text direction according to the locale during +// gtk_init(), and you should normally use gtk_widget_get_direction() or +// gtk_widget_get_default_direction() to obtain the current direction. +// +// This function is only needed rare cases when the locale is changed after +// GTK has already been initialized. In this case, you can use it to update the +// default text direction as follows: +// +// #include +// +// static void +// update_locale (const char *new_locale) +// { +// setlocale (LC_ALL, new_locale); +// gtk_widget_set_default_direction (gtk_get_locale_direction ()); +// }. +// +// The function returns the following values: +// +// - textDirection: direction of the current locale. +func GetLocaleDirection() TextDirection { + var _cret C.GtkTextDirection // in + + _cret = C.gtk_get_locale_direction() + + var _textDirection TextDirection // out + + _textDirection = TextDirection(_cret) + + return _textDirection +} + +// GetMajorVersion returns the major version number of the GTK library. +// +// For example, in GTK version 3.1.5 this is 3. +// +// This function is in the library, so it represents the GTK library your +// code is running against. Contrast with the GTK_MAJOR_VERSION macro, +// which represents the major version of the GTK headers you have included when +// compiling your code. +// +// The function returns the following values: +// +// - guint: major version number of the GTK library. +func GetMajorVersion() uint { + var _cret C.guint // in + + _cret = C.gtk_get_major_version() + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// GetMicroVersion returns the micro version number of the GTK library. +// +// For example, in GTK version 3.1.5 this is 5. +// +// This function is in the library, so it represents the GTK library your +// code is are running against. Contrast with the GTK_MICRO_VERSION macro, +// which represents the micro version of the GTK headers you have included when +// compiling your code. +// +// The function returns the following values: +// +// - guint: micro version number of the GTK library. +func GetMicroVersion() uint { + var _cret C.guint // in + + _cret = C.gtk_get_micro_version() + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// GetMinorVersion returns the minor version number of the GTK library. +// +// For example, in GTK version 3.1.5 this is 1. +// +// This function is in the library, so it represents the GTK library your +// code is are running against. Contrast with the GTK_MINOR_VERSION macro, +// which represents the minor version of the GTK headers you have included when +// compiling your code. +// +// The function returns the following values: +// +// - guint: minor version number of the GTK library. +func GetMinorVersion() uint { + var _cret C.guint // in + + _cret = C.gtk_get_minor_version() + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// HSVToRGB converts a color from HSV space to RGB. +// +// Input values must be in the [0.0, 1.0] range; output values will be in the +// same range. +// +// The function takes the following parameters: +// +// - h: hue. +// - s: saturation. +// - v: value. +// +// The function returns the following values: +// +// - r: return value for the red component. +// - g: return value for the green component. +// - b: return value for the blue component. +func HSVToRGB(h, s, v float32) (r, g, b float32) { + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // in + var _arg5 C.float // in + var _arg6 C.float // in + + _arg1 = C.float(h) + _arg2 = C.float(s) + _arg3 = C.float(v) + + C.gtk_hsv_to_rgb(_arg1, _arg2, _arg3, &_arg4, &_arg5, &_arg6) + runtime.KeepAlive(h) + runtime.KeepAlive(s) + runtime.KeepAlive(v) + + var _r float32 // out + var _g float32 // out + var _b float32 // out + + _r = float32(_arg4) + _g = float32(_arg5) + _b = float32(_arg6) + + return _r, _g, _b +} + +// Init: call this function before using any other GTK functions in your GUI +// applications. It will initialize everything needed to operate the toolkit. +// +// If you are using GtkApplication, you usually don't have to call this +// function; the GApplication::startup handler does it for you. Though, +// if you are using GApplication methods that will be invoked before startup, +// such as local_command_line, you may need to initialize stuff explicitly. +// +// This function will terminate your program if it was unable to initialize the +// windowing system for some reason. If you want your program to fall back to a +// textual interface, call gtk.InitCheck() instead. +// +// GTK calls signal (SIGPIPE, SIG_IGN) during initialization, to ignore SIGPIPE +// signals, since these are almost never wanted in graphical applications. +// If you do need to handle SIGPIPE for some reason, reset the handler after +// gtk_init(), but notice that other libraries (e.g. libdbus or gvfs) might do +// similar things. +func Init() { + C.gtk_init() +} + +// InitCheck: this function does the same work as gtk_init() with only a single +// change: It does not terminate the program if the windowing system can’t be +// initialized. Instead it returns FALSE on failure. +// +// This way the application can fall back to some other means of communication +// with the user - for example a curses or command line interface. +// +// The function returns the following values: +// +// - ok: TRUE if the windowing system has been successfully initialized, +// FALSE otherwise. +func InitCheck() bool { + var _cret C.gboolean // in + + _cret = C.gtk_init_check() + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IsInitialized: use this function to check if GTK has been initialized. +// +// See gtk.Init(). +// +// The function returns the following values: +// +// - ok: initialization status. +func IsInitialized() bool { + var _cret C.gboolean // in + + _cret = C.gtk_is_initialized() + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PrintRunPageSetupDialog runs a page setup dialog, letting the user modify +// the values from page_setup. If the user cancels the dialog, the returned +// GtkPageSetup is identical to the passed in page_setup, otherwise it contains +// the modifications done in the dialog. +// +// Note that this function may use a recursive mainloop to show the page setup +// dialog. See gtk_print_run_page_setup_dialog_async() if this is a problem. +// +// The function takes the following parameters: +// +// - parent (optional): transient parent. +// - pageSetup (optional): existing GtkPageSetup. +// - settings: GtkPrintSettings. +// +// The function returns the following values: +// +// - pageSetup: new GtkPageSetup. +func PrintRunPageSetupDialog(parent *Window, pageSetup *PageSetup, settings *PrintSettings) *PageSetup { + var _arg1 *C.GtkWindow // out + var _arg2 *C.GtkPageSetup // out + var _arg3 *C.GtkPrintSettings // out + var _cret *C.GtkPageSetup // in + + if parent != nil { + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + if pageSetup != nil { + _arg2 = (*C.GtkPageSetup)(unsafe.Pointer(coreglib.InternObject(pageSetup).Native())) + } + _arg3 = (*C.GtkPrintSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + + _cret = C.gtk_print_run_page_setup_dialog(_arg1, _arg2, _arg3) + runtime.KeepAlive(parent) + runtime.KeepAlive(pageSetup) + runtime.KeepAlive(settings) + + var _pageSetup *PageSetup // out + + _pageSetup = wrapPageSetup(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _pageSetup +} + +// PrintRunPageSetupDialogAsync runs a page setup dialog, letting the user +// modify the values from page_setup. +// +// In contrast to gtk_print_run_page_setup_dialog(), this function returns +// after showing the page setup dialog on platforms that support this, and calls +// done_cb from a signal handler for the ::response signal of the dialog. +// +// The function takes the following parameters: +// +// - parent (optional): transient parent. +// - pageSetup (optional): existing GtkPageSetup. +// - settings: GtkPrintSettings. +// - doneCb: function to call when the user saves the modified page setup. +func PrintRunPageSetupDialogAsync(parent *Window, pageSetup *PageSetup, settings *PrintSettings, doneCb PageSetupDoneFunc) { + var _arg1 *C.GtkWindow // out + var _arg2 *C.GtkPageSetup // out + var _arg3 *C.GtkPrintSettings // out + var _arg4 C.GtkPageSetupDoneFunc // out + var _arg5 C.gpointer + + if parent != nil { + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + if pageSetup != nil { + _arg2 = (*C.GtkPageSetup)(unsafe.Pointer(coreglib.InternObject(pageSetup).Native())) + } + _arg3 = (*C.GtkPrintSettings)(unsafe.Pointer(coreglib.InternObject(settings).Native())) + _arg4 = (*[0]byte)(C._gotk4_gtk4_PageSetupDoneFunc) + _arg5 = C.gpointer(gbox.AssignOnce(doneCb)) + + C.gtk_print_run_page_setup_dialog_async(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(parent) + runtime.KeepAlive(pageSetup) + runtime.KeepAlive(settings) + runtime.KeepAlive(doneCb) +} + +// RenderActivity renders an activity indicator (such as in GtkSpinner). The +// state GTK_STATE_FLAG_CHECKED determines whether there is activity going on. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x: x origin of the rectangle. +// - y: y origin of the rectangle. +// - width: rectangle width. +// - height: rectangle height. +func RenderActivity(context *StyleContext, cr *cairo.Context, x, y, width, height float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = C.double(width) + _arg6 = C.double(height) + + C.gtk_render_activity(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// RenderArrow renders an arrow pointing to angle. +// +// Typical arrow rendering at 0, 1⁄2 π;, π; and 3⁄2 π: +// +// ! (arrows.png) +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - angle: arrow angle from 0 to 2 * G_PI, being 0 the arrow pointing to the +// north. +// - x: x origin of the render area. +// - y: y origin of the render area. +// - size: square side for render area. +func RenderArrow(context *StyleContext, cr *cairo.Context, angle, x, y, size float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(angle) + _arg4 = C.double(x) + _arg5 = C.double(y) + _arg6 = C.double(size) + + C.gtk_render_arrow(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(angle) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(size) +} + +// RenderBackground renders the background of an element. +// +// Typical background rendering, showing the effect of background-image, +// border-width and border-radius: +// +// ! (background.png) +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x: x origin of the rectangle. +// - y: y origin of the rectangle. +// - width: rectangle width. +// - height: rectangle height. +func RenderBackground(context *StyleContext, cr *cairo.Context, x, y, width, height float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = C.double(width) + _arg6 = C.double(height) + + C.gtk_render_background(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// RenderCheck renders a checkmark (as in a GtkCheckButton). +// +// The GTK_STATE_FLAG_CHECKED state determines whether the check is on or off, +// and GTK_STATE_FLAG_INCONSISTENT determines whether it should be marked as +// undefined. +// +// Typical checkmark rendering: +// +// ! (checks.png) +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x: x origin of the rectangle. +// - y: y origin of the rectangle. +// - width: rectangle width. +// - height: rectangle height. +func RenderCheck(context *StyleContext, cr *cairo.Context, x, y, width, height float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = C.double(width) + _arg6 = C.double(height) + + C.gtk_render_check(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// RenderExpander renders an expander (as used in GtkTreeView and GtkExpander) +// in the area defined by x, y, width, height. The state GTK_STATE_FLAG_CHECKED +// determines whether the expander is collapsed or expanded. +// +// Typical expander rendering: +// +// ! (expanders.png) +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x: x origin of the rectangle. +// - y: y origin of the rectangle. +// - width: rectangle width. +// - height: rectangle height. +func RenderExpander(context *StyleContext, cr *cairo.Context, x, y, width, height float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = C.double(width) + _arg6 = C.double(height) + + C.gtk_render_expander(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// RenderFocus renders a focus indicator on the rectangle determined by x, y, +// width, height. +// +// Typical focus rendering: +// +// ! (focus.png) +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x: x origin of the rectangle. +// - y: y origin of the rectangle. +// - width: rectangle width. +// - height: rectangle height. +func RenderFocus(context *StyleContext, cr *cairo.Context, x, y, width, height float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = C.double(width) + _arg6 = C.double(height) + + C.gtk_render_focus(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// RenderFrame renders a frame around the rectangle defined by x, y, width, +// height. +// +// Examples of frame rendering, showing the effect of border-image, +// border-color, border-width, border-radius and junctions: +// +// ! (frames.png) +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x: x origin of the rectangle. +// - y: y origin of the rectangle. +// - width: rectangle width. +// - height: rectangle height. +func RenderFrame(context *StyleContext, cr *cairo.Context, x, y, width, height float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = C.double(width) + _arg6 = C.double(height) + + C.gtk_render_frame(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// RenderHandle renders a handle (as in GtkPaned and GtkWindow’s resize grip), +// in the rectangle determined by x, y, width, height. +// +// Handles rendered for the paned and grip classes: +// +// ! (handles.png) +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x: x origin of the rectangle. +// - y: y origin of the rectangle. +// - width: rectangle width. +// - height: rectangle height. +func RenderHandle(context *StyleContext, cr *cairo.Context, x, y, width, height float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = C.double(width) + _arg6 = C.double(height) + + C.gtk_render_handle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// RenderIcon renders the icon in texture at the specified x and y coordinates. +// +// This function will render the icon in texture at exactly its size, regardless +// of scaling factors, which may not be appropriate when drawing on displays +// with high pixel densities. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - texture: GdkTexture containing the icon to draw. +// - x: x position for the texture. +// - y: y position for the texture. +func RenderIcon(context *StyleContext, cr *cairo.Context, texture gdk.Texturer, x, y float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 *C.GdkTexture // out + var _arg4 C.double // out + var _arg5 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + _arg4 = C.double(x) + _arg5 = C.double(y) + + C.gtk_render_icon(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(texture) + runtime.KeepAlive(x) + runtime.KeepAlive(y) +} + +// RenderLayout renders layout on the coordinates x, y +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x: x origin. +// - y: y origin. +// - layout: PangoLayout to render. +func RenderLayout(context *StyleContext, cr *cairo.Context, x, y float64, layout *pango.Layout) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 *C.PangoLayout // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = (*C.PangoLayout)(unsafe.Pointer(coreglib.InternObject(layout).Native())) + + C.gtk_render_layout(_arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(layout) +} + +// RenderLine renders a line from (x0, y0) to (x1, y1). +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x0: x coordinate for the origin of the line. +// - y0: y coordinate for the origin of the line. +// - x1: x coordinate for the end of the line. +// - y1: y coordinate for the end of the line. +func RenderLine(context *StyleContext, cr *cairo.Context, x0, y0, x1, y1 float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x0) + _arg4 = C.double(y0) + _arg5 = C.double(x1) + _arg6 = C.double(y1) + + C.gtk_render_line(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x0) + runtime.KeepAlive(y0) + runtime.KeepAlive(x1) + runtime.KeepAlive(y1) +} + +// RenderOption renders an option mark (as in a radio button), the +// GTK_STATE_FLAG_CHECKED state will determine whether the option is on or off, +// and GTK_STATE_FLAG_INCONSISTENT whether it should be marked as undefined. +// +// Typical option mark rendering: +// +// ! (options.png) +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - context: GtkStyleContext. +// - cr: cairo_t. +// - x: x origin of the rectangle. +// - y: y origin of the rectangle. +// - width: rectangle width. +// - height: rectangle height. +func RenderOption(context *StyleContext, cr *cairo.Context, x, y, width, height float64) { + var _arg1 *C.GtkStyleContext // out + var _arg2 *C.cairo_t // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg1 = (*C.GtkStyleContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) + _arg3 = C.double(x) + _arg4 = C.double(y) + _arg5 = C.double(width) + _arg6 = C.double(height) + + C.gtk_render_option(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(context) + runtime.KeepAlive(cr) + runtime.KeepAlive(x) + runtime.KeepAlive(y) + runtime.KeepAlive(width) + runtime.KeepAlive(height) +} + +// RGBToHSV converts a color from RGB space to HSV. +// +// Input values must be in the [0.0, 1.0] range; output values will be in the +// same range. +// +// The function takes the following parameters: +// +// - r: red. +// - g: green. +// - b: blue. +// +// The function returns the following values: +// +// - h: return value for the hue component. +// - s: return value for the saturation component. +// - v: return value for the value component. +func RGBToHSV(r, g, b float32) (h, s, v float32) { + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.float // in + var _arg5 C.float // in + var _arg6 C.float // in + + _arg1 = C.float(r) + _arg2 = C.float(g) + _arg3 = C.float(b) + + C.gtk_rgb_to_hsv(_arg1, _arg2, _arg3, &_arg4, &_arg5, &_arg6) + runtime.KeepAlive(r) + runtime.KeepAlive(g) + runtime.KeepAlive(b) + + var _h float32 // out + var _s float32 // out + var _v float32 // out + + _h = float32(_arg4) + _s = float32(_arg5) + _v = float32(_arg6) + + return _h, _s, _v +} + +// SetDebugFlags sets the GTK debug flags. +// +// The function takes the following parameters: +// +// - flags: debug flags to set. +func SetDebugFlags(flags DebugFlags) { + var _arg1 C.GtkDebugFlags // out + + _arg1 = C.GtkDebugFlags(flags) + + C.gtk_set_debug_flags(_arg1) + runtime.KeepAlive(flags) +} + +// ShowURI: this function launches the default application for showing a given +// uri, or shows an error dialog if that fails. +// +// Deprecated: Use gtk.FileLauncher.Launch() or gtk.URILauncher.Launch() +// instead. +// +// The function takes the following parameters: +// +// - parent (optional) window. +// - uri to show. +// - timestamp from the event that triggered this call, or GDK_CURRENT_TIME. +func ShowURI(parent *Window, uri string, timestamp uint32) { + var _arg1 *C.GtkWindow // out + var _arg2 *C.char // out + var _arg3 C.guint32 // out + + if parent != nil { + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + _arg2 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.guint32(timestamp) + + C.gtk_show_uri(_arg1, _arg2, _arg3) + runtime.KeepAlive(parent) + runtime.KeepAlive(uri) + runtime.KeepAlive(timestamp) +} + +// ShowURIFull: this function launches the default application for showing a +// given uri. +// +// The callback will be called when the launch is completed. It should call +// gtk_show_uri_full_finish() to obtain the result. +// +// This is the recommended call to be used as it passes information necessary +// for sandbox helpers to parent their dialogs properly. +// +// Deprecated: Use gtk.FileLauncher.Launch() or gtk.URILauncher.Launch() +// instead. +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable to cancel the launch. +// - parent (optional) window. +// - uri to show. +// - timestamp from the event that triggered this call, or GDK_CURRENT_TIME. +// - callback (optional) to call when the action is complete. +func ShowURIFull(ctx context.Context, parent *Window, uri string, timestamp uint32, callback gio.AsyncReadyCallback) { + var _arg4 *C.GCancellable // out + var _arg1 *C.GtkWindow // out + var _arg2 *C.char // out + var _arg3 C.guint32 // out + var _arg5 C.GAsyncReadyCallback // out + var _arg6 C.gpointer + + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if parent != nil { + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + _arg2 = (*C.char)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.guint32(timestamp) + if callback != nil { + _arg5 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg6 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gtk_show_uri_full(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(ctx) + runtime.KeepAlive(parent) + runtime.KeepAlive(uri) + runtime.KeepAlive(timestamp) + runtime.KeepAlive(callback) +} + +// ShowURIFullFinish finishes the gtk_show_uri() call and returns the result of +// the operation. +// +// Deprecated: Use gtk.FileLauncher.LaunchFinish() or +// gtk.URILauncher.LaunchFinish() instead. +// +// The function takes the following parameters: +// +// - parent: GtkWindow passed to gtk_show_uri(). +// - result: GAsyncResult that was passed to callback. +func ShowURIFullFinish(parent *Window, result gio.AsyncResulter) error { + var _arg1 *C.GtkWindow // out + var _arg2 *C.GAsyncResult // out + var _cerr *C.GError // in + + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + _arg2 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + C.gtk_show_uri_full_finish(_arg1, _arg2, &_cerr) + runtime.KeepAlive(parent) + runtime.KeepAlive(result) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// The function takes the following parameters: +// +// - domain +// - file +// - line +// - fn +// - expr +// - accessible +// - expectedRole +// - actualRole +func TestAccessibleAssertionMessageRole(domain, file string, line int, fn, expr string, accessible Accessibler, expectedRole, actualRole AccessibleRole) { + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 C.int // out + var _arg4 *C.char // out + var _arg5 *C.char // out + var _arg6 *C.GtkAccessible // out + var _arg7 C.GtkAccessibleRole // out + var _arg8 C.GtkAccessibleRole // out + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.int(line) + _arg4 = (*C.char)(unsafe.Pointer(C.CString(fn))) + defer C.free(unsafe.Pointer(_arg4)) + _arg5 = (*C.char)(unsafe.Pointer(C.CString(expr))) + defer C.free(unsafe.Pointer(_arg5)) + _arg6 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(accessible).Native())) + _arg7 = C.GtkAccessibleRole(expectedRole) + _arg8 = C.GtkAccessibleRole(actualRole) + + C.gtk_test_accessible_assertion_message_role(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8) + runtime.KeepAlive(domain) + runtime.KeepAlive(file) + runtime.KeepAlive(line) + runtime.KeepAlive(fn) + runtime.KeepAlive(expr) + runtime.KeepAlive(accessible) + runtime.KeepAlive(expectedRole) + runtime.KeepAlive(actualRole) +} + +// TestAccessibleHasProperty checks whether the GtkAccessible has property set. +// +// The function takes the following parameters: +// +// - accessible: GtkAccessible. +// - property: GtkAccessibleProperty. +// +// The function returns the following values: +// +// - ok: TRUE if the property is set in the accessible. +func TestAccessibleHasProperty(accessible Accessibler, property AccessibleProperty) bool { + var _arg1 *C.GtkAccessible // out + var _arg2 C.GtkAccessibleProperty // out + var _cret C.gboolean // in + + _arg1 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(accessible).Native())) + _arg2 = C.GtkAccessibleProperty(property) + + _cret = C.gtk_test_accessible_has_property(_arg1, _arg2) + runtime.KeepAlive(accessible) + runtime.KeepAlive(property) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TestAccessibleHasRelation checks whether the GtkAccessible has relation set. +// +// The function takes the following parameters: +// +// - accessible: GtkAccessible. +// - relation: GtkAccessibleRelation. +// +// The function returns the following values: +// +// - ok: TRUE if the relation is set in the accessible. +func TestAccessibleHasRelation(accessible Accessibler, relation AccessibleRelation) bool { + var _arg1 *C.GtkAccessible // out + var _arg2 C.GtkAccessibleRelation // out + var _cret C.gboolean // in + + _arg1 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(accessible).Native())) + _arg2 = C.GtkAccessibleRelation(relation) + + _cret = C.gtk_test_accessible_has_relation(_arg1, _arg2) + runtime.KeepAlive(accessible) + runtime.KeepAlive(relation) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TestAccessibleHasRole checks whether the GtkAccessible:accessible-role of the +// accessible is role. +// +// The function takes the following parameters: +// +// - accessible: GtkAccessible. +// - role: GtkAccessibleRole. +// +// The function returns the following values: +// +// - ok: TRUE if the role matches. +func TestAccessibleHasRole(accessible Accessibler, role AccessibleRole) bool { + var _arg1 *C.GtkAccessible // out + var _arg2 C.GtkAccessibleRole // out + var _cret C.gboolean // in + + _arg1 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(accessible).Native())) + _arg2 = C.GtkAccessibleRole(role) + + _cret = C.gtk_test_accessible_has_role(_arg1, _arg2) + runtime.KeepAlive(accessible) + runtime.KeepAlive(role) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TestAccessibleHasState checks whether the GtkAccessible has state set. +// +// The function takes the following parameters: +// +// - accessible: GtkAccessible. +// - state: GtkAccessibleState. +// +// The function returns the following values: +// +// - ok: TRUE if the state is set in the accessible. +func TestAccessibleHasState(accessible Accessibler, state AccessibleState) bool { + var _arg1 *C.GtkAccessible // out + var _arg2 C.GtkAccessibleState // out + var _cret C.gboolean // in + + _arg1 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(accessible).Native())) + _arg2 = C.GtkAccessibleState(state) + + _cret = C.gtk_test_accessible_has_state(_arg1, _arg2) + runtime.KeepAlive(accessible) + runtime.KeepAlive(state) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TestListAllTypes: return the type ids that have been registered after calling +// gtk_test_register_all_types(). +// +// The function returns the following values: +// +// - gTypes: 0-terminated array of type ids. +func TestListAllTypes() []coreglib.Type { + var _cret *C.GType // in + var _arg1 C.guint // in + + _cret = C.gtk_test_list_all_types(&_arg1) + + var _gTypes []coreglib.Type // out + + { + src := unsafe.Slice((*C.GType)(_cret), _arg1) + _gTypes = make([]coreglib.Type, _arg1) + for i := 0; i < int(_arg1); i++ { + _gTypes[i] = coreglib.Type(src[i]) + } + } + + return _gTypes +} + +// TestRegisterAllTypes: force registration of all core GTK object types. +// +// This allows to refer to any of those object types via g_type_from_name() +// after calling this function. +func TestRegisterAllTypes() { + C.gtk_test_register_all_types() +} + +// TestWidgetWaitForDraw enters the main loop and waits for widget to be +// “drawn”. +// +// In this context that means it waits for the frame clock of widget to have run +// a full styling, layout and drawing cycle. +// +// This function is intended to be used for syncing with actions that depend on +// widget relayouting or on interaction with the display server. +// +// The function takes the following parameters: +// +// - widget to wait for. +func TestWidgetWaitForDraw(widget Widgetter) { + var _arg1 *C.GtkWidget // out + + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(widget).Native())) + + C.gtk_test_widget_wait_for_draw(_arg1) + runtime.KeepAlive(widget) +} + +// TreeCreateRowDragContent creates a content provider for dragging path from +// tree_model. +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - treeModel: GtkTreeModel. +// - path: row in tree_model. +// +// The function returns the following values: +// +// - contentProvider: new GdkContentProvider. +func TreeCreateRowDragContent(treeModel TreeModeller, path *TreePath) *gdk.ContentProvider { + var _arg1 *C.GtkTreeModel // out + var _arg2 *C.GtkTreePath // out + var _cret *C.GdkContentProvider // in + + _arg1 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg2 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C.gtk_tree_create_row_drag_content(_arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + + var _contentProvider *gdk.ContentProvider // out + + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _contentProvider = &gdk.ContentProvider{ + Object: obj, + } + } + + return _contentProvider +} + +// TreeGetRowDragData obtains a tree_model and path from value of target type +// GTK_TYPE_TREE_ROW_DATA. +// +// The returned path must be freed with gtk_tree_path_free(). +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - value: GValue. +// +// The function returns the following values: +// +// - treeModel (optional): GtkTreeModel. +// - path (optional): row in tree_model. +// - ok: TRUE if selection_data had target type GTK_TYPE_TREE_ROW_DATA is +// otherwise valid. +func TreeGetRowDragData(value *coreglib.Value) (*TreeModel, *TreePath, bool) { + var _arg1 *C.GValue // out + var _arg2 *C.GtkTreeModel // in + var _arg3 *C.GtkTreePath // in + var _cret C.gboolean // in + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C.gtk_tree_get_row_drag_data(_arg1, &_arg2, &_arg3) + runtime.KeepAlive(value) + + var _treeModel *TreeModel // out + var _path *TreePath // out + var _ok bool // out + + if _arg2 != nil { + _treeModel = wrapTreeModel(coreglib.Take(unsafe.Pointer(_arg2))) + } + if _arg3 != nil { + _path = (*TreePath)(gextras.NewStructNative(unsafe.Pointer(_arg3))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_path)), + func(intern *struct{ C unsafe.Pointer }) { + C.gtk_tree_path_free((*C.GtkTreePath)(intern.C)) + }, + ) + } + if _cret != 0 { + _ok = true + } + + return _treeModel, _path, _ok +} + +// ValueDupExpression retrieves the GtkExpression stored inside the given value, +// and acquires a reference to it. +// +// The function takes the following parameters: +// +// - value: GValue initialized with type GTK_TYPE_EXPRESSION. +// +// The function returns the following values: +// +// - expression (optional): GtkExpression. +func ValueDupExpression(value *coreglib.Value) Expressioner { + var _arg1 *C.GValue // out + var _cret *C.GtkExpression // in + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C.gtk_value_dup_expression(_arg1) + runtime.KeepAlive(value) + + var _expression Expressioner // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Expressioner) + return ok + }) + rv, ok := casted.(Expressioner) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Expressioner") + } + _expression = rv + } + } + + return _expression +} + +// ValueGetExpression retrieves the GtkExpression stored inside the given value. +// +// The function takes the following parameters: +// +// - value: GValue initialized with type GTK_TYPE_EXPRESSION. +// +// The function returns the following values: +// +// - expression (optional): GtkExpression. +func ValueGetExpression(value *coreglib.Value) Expressioner { + var _arg1 *C.GValue // out + var _cret *C.GtkExpression // in + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C.gtk_value_get_expression(_arg1) + runtime.KeepAlive(value) + + var _expression Expressioner // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Expressioner) + return ok + }) + rv, ok := casted.(Expressioner) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Expressioner") + } + _expression = rv + } + } + + return _expression +} + +// ValueSetExpression stores the given GtkExpression inside value. +// +// The GValue will acquire a reference to the expression. +// +// The function takes the following parameters: +// +// - value: GValue initialized with type GTK_TYPE_EXPRESSION. +// - expression: GtkExpression. +func ValueSetExpression(value *coreglib.Value, expression Expressioner) { + var _arg1 *C.GValue // out + var _arg2 *C.GtkExpression // out + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + _arg2 = (*C.GtkExpression)(unsafe.Pointer(coreglib.InternObject(expression).Native())) + + C.gtk_value_set_expression(_arg1, _arg2) + runtime.KeepAlive(value) + runtime.KeepAlive(expression) +} + +// ValueTakeExpression stores the given GtkExpression inside value. +// +// This function transfers the ownership of the expression to the GValue. +// +// The function takes the following parameters: +// +// - value: GValue initialized with type GTK_TYPE_EXPRESSION. +// - expression (optional): GtkExpression. +func ValueTakeExpression(value *coreglib.Value, expression Expressioner) { + var _arg1 *C.GValue // out + var _arg2 *C.GtkExpression // out + + _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) + if expression != nil { + _arg2 = (*C.GtkExpression)(unsafe.Pointer(coreglib.InternObject(expression).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(expression).Native())) + } + + C.gtk_value_take_expression(_arg1, _arg2) + runtime.KeepAlive(value) + runtime.KeepAlive(expression) +} + +// Accessible: GtkAccessible is an interface for describing UI elements for +// Assistive Technologies. +// +// Every accessible implementation has: +// +// - a “role”, represented by a value of the gtk.AccessibleRole enumeration +// - an “attribute”, represented by a set of gtk.AccessibleState, +// gtk.AccessibleProperty and gtk.AccessibleRelation values +// +// The role cannot be changed after instantiating a GtkAccessible +// implementation. +// +// The attributes are updated every time a UI element's state changes in a +// way that should be reflected by assistive technologies. For instance, +// if a GtkWidget visibility changes, the GTK_ACCESSIBLE_STATE_HIDDEN state will +// also change to reflect the gtk.Widget:visible property. +// +// Every accessible implementation is part of a tree of accessible objects. +// Normally, this tree corresponds to the widget tree, but can be +// customized by reimplementing the gtk.Accessible.GetAccessibleParent(), +// gtk.Accessible.GetFirstAccessibleChild() and +// gtk.Accessible.GetNextAccessibleSibling() virtual functions. Note that you +// can not create a top-level accessible object as of now, which means that +// you must always have a parent accessible object. Also note that when an +// accessible object does not correspond to a widget, and it has children, +// whose implementation you don't control, it is necessary to ensure the correct +// shape of the a11y tree by calling gtk.Accessible.SetAccessibleParent() and +// updating the sibling by gtk.Accessible.UpdateNextAccessibleSibling(). +// +// Accessible wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Accessible struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Accessible)(nil) +) + +// Accessibler describes Accessible's interface methods. +type Accessibler interface { + coreglib.Objector + + // Announce requests the user's screen reader to announce the given message. + Announce(message string, priority AccessibleAnnouncementPriority) + // AccessibleParent retrieves the accessible parent for an accessible + // object. + AccessibleParent() *Accessible + // AccessibleRole retrieves the accessible role of an accessible object. + AccessibleRole() AccessibleRole + // AtContext retrieves the accessible implementation for the given + // GtkAccessible. + AtContext() ATContexter + // Bounds queries the coordinates and dimensions of this accessible. + Bounds() (x, y, width, height int, ok bool) + // FirstAccessibleChild retrieves the first accessible child of an + // accessible object. + FirstAccessibleChild() *Accessible + // NextAccessibleSibling retrieves the next accessible sibling of an + // accessible object. + NextAccessibleSibling() *Accessible + // PlatformState: query a platform state, such as focus. + PlatformState(state AccessiblePlatformState) bool + // ResetProperty resets the accessible property to its default value. + ResetProperty(property AccessibleProperty) + // ResetRelation resets the accessible relation to its default value. + ResetRelation(relation AccessibleRelation) + // ResetState resets the accessible state to its default value. + ResetState(state AccessibleState) + // SetAccessibleParent sets the parent and sibling of an accessible object. + SetAccessibleParent(parent, nextSibling Accessibler) + // UpdateNextAccessibleSibling updates the next accessible sibling of self. + UpdateNextAccessibleSibling(newSibling Accessibler) + // UpdateProperty updates an array of accessible properties. + UpdateProperty(properties []AccessibleProperty, values []coreglib.Value) + // UpdateRelation updates an array of accessible relations. + UpdateRelation(relations []AccessibleRelation, values []coreglib.Value) + // UpdateState updates an array of accessible states. + UpdateState(states []AccessibleState, values []coreglib.Value) +} + +var _ Accessibler = (*Accessible)(nil) + +func wrapAccessible(obj *coreglib.Object) *Accessible { + return &Accessible{ + Object: obj, + } +} + +func marshalAccessible(p uintptr) (interface{}, error) { + return wrapAccessible(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Announce requests the user's screen reader to announce the given message. +// +// This kind of notification is useful for messages that either have only +// a visual representation or that are not exposed visually at all, e.g. +// a notification about a successful operation. +// +// Also, by using this API, you can ensure that the message does not interrupts +// the user's current screen reader output. +// +// The function takes the following parameters: +// +// - message: string to announce. +// - priority of the announcement. +func (self *Accessible) Announce(message string, priority AccessibleAnnouncementPriority) { + var _arg0 *C.GtkAccessible // out + var _arg1 *C.char // out + var _arg2 C.GtkAccessibleAnnouncementPriority // out + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = C.GtkAccessibleAnnouncementPriority(priority) + + C.gtk_accessible_announce(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(message) + runtime.KeepAlive(priority) +} + +// AccessibleParent retrieves the accessible parent for an accessible object. +// +// This function returns NULL for top level widgets. +// +// The function returns the following values: +// +// - accessible (optional) parent. +func (self *Accessible) AccessibleParent() *Accessible { + var _arg0 *C.GtkAccessible // out + var _cret *C.GtkAccessible // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_accessible_get_accessible_parent(_arg0) + runtime.KeepAlive(self) + + var _accessible *Accessible // out + + if _cret != nil { + _accessible = wrapAccessible(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _accessible +} + +// AccessibleRole retrieves the accessible role of an accessible object. +// +// The function returns the following values: +// +// - accessibleRole: accessible role. +func (self *Accessible) AccessibleRole() AccessibleRole { + var _arg0 *C.GtkAccessible // out + var _cret C.GtkAccessibleRole // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_accessible_get_accessible_role(_arg0) + runtime.KeepAlive(self) + + var _accessibleRole AccessibleRole // out + + _accessibleRole = AccessibleRole(_cret) + + return _accessibleRole +} + +// AtContext retrieves the accessible implementation for the given +// GtkAccessible. +// +// The function returns the following values: +// +// - atContext: accessible implementation object. +func (self *Accessible) AtContext() ATContexter { + var _arg0 *C.GtkAccessible // out + var _cret *C.GtkATContext // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_accessible_get_at_context(_arg0) + runtime.KeepAlive(self) + + var _atContext ATContexter // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gtk.ATContexter is nil") + } + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(ATContexter) + return ok + }) + rv, ok := casted.(ATContexter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.ATContexter") + } + _atContext = rv + } + + return _atContext +} + +// Bounds queries the coordinates and dimensions of this accessible +// +// This functionality can be overridden by GtkAccessible implementations, e.g. +// to get the bounds from an ignored child widget. +// +// The function returns the following values: +// +// - x coordinate of the top left corner of the accessible. +// - y coordinate of the top left corner of the widget. +// - width of the accessible object. +// - height of the accessible object. +// - ok: true if the bounds are valid, and false otherwise. +func (self *Accessible) Bounds() (x, y, width, height int, ok bool) { + var _arg0 *C.GtkAccessible // out + var _arg1 C.int // in + var _arg2 C.int // in + var _arg3 C.int // in + var _arg4 C.int // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_accessible_get_bounds(_arg0, &_arg1, &_arg2, &_arg3, &_arg4) + runtime.KeepAlive(self) + + var _x int // out + var _y int // out + var _width int // out + var _height int // out + var _ok bool // out + + _x = int(_arg1) + _y = int(_arg2) + _width = int(_arg3) + _height = int(_arg4) + if _cret != 0 { + _ok = true + } + + return _x, _y, _width, _height, _ok +} + +// FirstAccessibleChild retrieves the first accessible child of an accessible +// object. +// +// The function returns the following values: +// +// - accessible (optional): first accessible child. +func (self *Accessible) FirstAccessibleChild() *Accessible { + var _arg0 *C.GtkAccessible // out + var _cret *C.GtkAccessible // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_accessible_get_first_accessible_child(_arg0) + runtime.KeepAlive(self) + + var _accessible *Accessible // out + + if _cret != nil { + _accessible = wrapAccessible(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _accessible +} + +// NextAccessibleSibling retrieves the next accessible sibling of an accessible +// object. +// +// The function returns the following values: +// +// - accessible (optional): next accessible sibling. +func (self *Accessible) NextAccessibleSibling() *Accessible { + var _arg0 *C.GtkAccessible // out + var _cret *C.GtkAccessible // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_accessible_get_next_accessible_sibling(_arg0) + runtime.KeepAlive(self) + + var _accessible *Accessible // out + + if _cret != nil { + _accessible = wrapAccessible(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _accessible +} + +// PlatformState: query a platform state, such as focus. +// +// See gtk_accessible_platform_changed(). +// +// This functionality can be overridden by GtkAccessible implementations, +// e.g. to get platform state from an ignored child widget, as is the case for +// GtkText wrappers. +// +// The function takes the following parameters: +// +// - state: platform state to query. +// +// The function returns the following values: +// +// - ok: value of state for the accessible. +func (self *Accessible) PlatformState(state AccessiblePlatformState) bool { + var _arg0 *C.GtkAccessible // out + var _arg1 C.GtkAccessiblePlatformState // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GtkAccessiblePlatformState(state) + + _cret = C.gtk_accessible_get_platform_state(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(state) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ResetProperty resets the accessible property to its default value. +// +// The function takes the following parameters: +// +// - property: GtkAccessibleProperty. +func (self *Accessible) ResetProperty(property AccessibleProperty) { + var _arg0 *C.GtkAccessible // out + var _arg1 C.GtkAccessibleProperty // out + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GtkAccessibleProperty(property) + + C.gtk_accessible_reset_property(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(property) +} + +// ResetRelation resets the accessible relation to its default value. +// +// The function takes the following parameters: +// +// - relation: GtkAccessibleRelation. +func (self *Accessible) ResetRelation(relation AccessibleRelation) { + var _arg0 *C.GtkAccessible // out + var _arg1 C.GtkAccessibleRelation // out + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GtkAccessibleRelation(relation) + + C.gtk_accessible_reset_relation(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(relation) +} + +// ResetState resets the accessible state to its default value. +// +// The function takes the following parameters: +// +// - state: GtkAccessibleState. +func (self *Accessible) ResetState(state AccessibleState) { + var _arg0 *C.GtkAccessible // out + var _arg1 C.GtkAccessibleState // out + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GtkAccessibleState(state) + + C.gtk_accessible_reset_state(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(state) +} + +// SetAccessibleParent sets the parent and sibling of an accessible object. +// +// This function is meant to be used by accessible implementations that are +// not part of the widget hierarchy, and but act as a logical bridge between +// widgets. For instance, if a widget creates an object that holds metadata +// for each child, and you want that object to implement the GtkAccessible +// interface, you will use this function to ensure that the parent of each child +// widget is the metadata object, and the parent of each metadata object is the +// container widget. +// +// The function takes the following parameters: +// +// - parent (optional) accessible object. +// - nextSibling (optional): sibling accessible object. +func (self *Accessible) SetAccessibleParent(parent, nextSibling Accessibler) { + var _arg0 *C.GtkAccessible // out + var _arg1 *C.GtkAccessible // out + var _arg2 *C.GtkAccessible // out + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if parent != nil { + _arg1 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + if nextSibling != nil { + _arg2 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(nextSibling).Native())) + } + + C.gtk_accessible_set_accessible_parent(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(parent) + runtime.KeepAlive(nextSibling) +} + +// UpdateNextAccessibleSibling updates the next accessible sibling of self. +// +// That might be useful when a new child of a custom GtkAccessible is created, +// and it needs to be linked to a previous child. +// +// The function takes the following parameters: +// +// - newSibling (optional): new next accessible sibling to set. +func (self *Accessible) UpdateNextAccessibleSibling(newSibling Accessibler) { + var _arg0 *C.GtkAccessible // out + var _arg1 *C.GtkAccessible // out + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if newSibling != nil { + _arg1 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(newSibling).Native())) + } + + C.gtk_accessible_update_next_accessible_sibling(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(newSibling) +} + +// UpdateProperty updates an array of accessible properties. +// +// This function should be called by GtkWidget types whenever an accessible +// property change must be communicated to assistive technologies. +// +// This function is meant to be used by language bindings. +// +// The function takes the following parameters: +// +// - properties: array of GtkAccessibleProperty. +// - values: array of GValues, one for each property. +func (self *Accessible) UpdateProperty(properties []AccessibleProperty, values []coreglib.Value) { + var _arg0 *C.GtkAccessible // out + var _arg2 *C.GtkAccessibleProperty // out + var _arg1 C.int + var _arg3 *C.GValue // out + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (C.int)(len(properties)) + if len(properties) > 0 { + _arg2 = (*C.GtkAccessibleProperty)(unsafe.Pointer(&properties[0])) + } + _arg1 = (C.int)(len(values)) + _arg3 = (*C.GValue)(C.calloc(C.size_t(len(values)), C.size_t(C.sizeof_GValue))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice((*C.GValue)(_arg3), len(values)) + for i := range values { + out[i] = *(*C.GValue)(unsafe.Pointer((&values[i]).Native())) + } + } + + C.gtk_accessible_update_property_value(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(self) + runtime.KeepAlive(properties) + runtime.KeepAlive(values) +} + +// UpdateRelation updates an array of accessible relations. +// +// This function should be called by GtkWidget types whenever an accessible +// relation change must be communicated to assistive technologies. +// +// This function is meant to be used by language bindings. +// +// The function takes the following parameters: +// +// - relations: array of GtkAccessibleRelation. +// - values: array of GValues, one for each relation. +func (self *Accessible) UpdateRelation(relations []AccessibleRelation, values []coreglib.Value) { + var _arg0 *C.GtkAccessible // out + var _arg2 *C.GtkAccessibleRelation // out + var _arg1 C.int + var _arg3 *C.GValue // out + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (C.int)(len(relations)) + if len(relations) > 0 { + _arg2 = (*C.GtkAccessibleRelation)(unsafe.Pointer(&relations[0])) + } + _arg1 = (C.int)(len(values)) + _arg3 = (*C.GValue)(C.calloc(C.size_t(len(values)), C.size_t(C.sizeof_GValue))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice((*C.GValue)(_arg3), len(values)) + for i := range values { + out[i] = *(*C.GValue)(unsafe.Pointer((&values[i]).Native())) + } + } + + C.gtk_accessible_update_relation_value(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(self) + runtime.KeepAlive(relations) + runtime.KeepAlive(values) +} + +// UpdateState updates an array of accessible states. +// +// This function should be called by GtkWidget types whenever an accessible +// state change must be communicated to assistive technologies. +// +// This function is meant to be used by language bindings. +// +// The function takes the following parameters: +// +// - states: array of GtkAccessibleState. +// - values: array of GValues, one for each state. +func (self *Accessible) UpdateState(states []AccessibleState, values []coreglib.Value) { + var _arg0 *C.GtkAccessible // out + var _arg2 *C.GtkAccessibleState // out + var _arg1 C.int + var _arg3 *C.GValue // out + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (C.int)(len(states)) + if len(states) > 0 { + _arg2 = (*C.GtkAccessibleState)(unsafe.Pointer(&states[0])) + } + _arg1 = (C.int)(len(values)) + _arg3 = (*C.GValue)(C.calloc(C.size_t(len(values)), C.size_t(C.sizeof_GValue))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice((*C.GValue)(_arg3), len(values)) + for i := range values { + out[i] = *(*C.GValue)(unsafe.Pointer((&values[i]).Native())) + } + } + + C.gtk_accessible_update_state_value(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(self) + runtime.KeepAlive(states) + runtime.KeepAlive(values) +} + +// accessibleParent retrieves the accessible parent for an accessible object. +// +// This function returns NULL for top level widgets. +// +// The function returns the following values: +// +// - accessible (optional) parent. +func (self *Accessible) accessibleParent() *Accessible { + gclass := (*C.GtkAccessibleInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_accessible_parent + + var _arg0 *C.GtkAccessible // out + var _cret *C.GtkAccessible // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C._gotk4_gtk4_Accessible_virtual_get_accessible_parent(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(self) + + var _accessible *Accessible // out + + if _cret != nil { + _accessible = wrapAccessible(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _accessible +} + +// atContext retrieves the accessible implementation for the given +// GtkAccessible. +// +// The function returns the following values: +// +// - atContext (optional): accessible implementation object. +func (self *Accessible) atContext() ATContexter { + gclass := (*C.GtkAccessibleInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_at_context + + var _arg0 *C.GtkAccessible // out + var _cret *C.GtkATContext // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C._gotk4_gtk4_Accessible_virtual_get_at_context(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(self) + + var _atContext ATContexter // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(ATContexter) + return ok + }) + rv, ok := casted.(ATContexter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.ATContexter") + } + _atContext = rv + } + } + + return _atContext +} + +// Bounds queries the coordinates and dimensions of this accessible +// +// This functionality can be overridden by GtkAccessible implementations, e.g. +// to get the bounds from an ignored child widget. +// +// The function returns the following values: +// +// - x coordinate of the top left corner of the accessible. +// - y coordinate of the top left corner of the widget. +// - width of the accessible object. +// - height of the accessible object. +// - ok: true if the bounds are valid, and false otherwise. +func (self *Accessible) bounds() (x, y, width, height int, ok bool) { + gclass := (*C.GtkAccessibleInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_bounds + + var _arg0 *C.GtkAccessible // out + var _arg1 C.int // in + var _arg2 C.int // in + var _arg3 C.int // in + var _arg4 C.int // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C._gotk4_gtk4_Accessible_virtual_get_bounds(unsafe.Pointer(fnarg), _arg0, &_arg1, &_arg2, &_arg3, &_arg4) + runtime.KeepAlive(self) + + var _x int // out + var _y int // out + var _width int // out + var _height int // out + var _ok bool // out + + _x = int(_arg1) + _y = int(_arg2) + _width = int(_arg3) + _height = int(_arg4) + if _cret != 0 { + _ok = true + } + + return _x, _y, _width, _height, _ok +} + +// firstAccessibleChild retrieves the first accessible child of an accessible +// object. +// +// The function returns the following values: +// +// - accessible (optional): first accessible child. +func (self *Accessible) firstAccessibleChild() *Accessible { + gclass := (*C.GtkAccessibleInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_first_accessible_child + + var _arg0 *C.GtkAccessible // out + var _cret *C.GtkAccessible // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C._gotk4_gtk4_Accessible_virtual_get_first_accessible_child(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(self) + + var _accessible *Accessible // out + + if _cret != nil { + _accessible = wrapAccessible(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _accessible +} + +// nextAccessibleSibling retrieves the next accessible sibling of an accessible +// object. +// +// The function returns the following values: +// +// - accessible (optional): next accessible sibling. +func (self *Accessible) nextAccessibleSibling() *Accessible { + gclass := (*C.GtkAccessibleInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_next_accessible_sibling + + var _arg0 *C.GtkAccessible // out + var _cret *C.GtkAccessible // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C._gotk4_gtk4_Accessible_virtual_get_next_accessible_sibling(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(self) + + var _accessible *Accessible // out + + if _cret != nil { + _accessible = wrapAccessible(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _accessible +} + +// platformState: query a platform state, such as focus. +// +// See gtk_accessible_platform_changed(). +// +// This functionality can be overridden by GtkAccessible implementations, +// e.g. to get platform state from an ignored child widget, as is the case for +// GtkText wrappers. +// +// The function takes the following parameters: +// +// - state: platform state to query. +// +// The function returns the following values: +// +// - ok: value of state for the accessible. +func (self *Accessible) platformState(state AccessiblePlatformState) bool { + gclass := (*C.GtkAccessibleInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_platform_state + + var _arg0 *C.GtkAccessible // out + var _arg1 C.GtkAccessiblePlatformState // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GtkAccessiblePlatformState(state) + + _cret = C._gotk4_gtk4_Accessible_virtual_get_platform_state(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(state) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// AccessibleRange: this interface describes ranged controls, e.g. controls +// which have a single value within an allowed range and that can optionally be +// changed by the user. +// +// This interface is expected to be implemented by controls using the following +// roles: +// +// - GTK_ACCESSIBLE_ROLE_METER +// +// - GTK_ACCESSIBLE_ROLE_PROGRESS_BAR +// +// - GTK_ACCESSIBLE_ROLE_SCROLLBAR +// +// - GTK_ACCESSIBLE_ROLE_SLIDER +// +// - GTK_ACCESSIBLE_ROLE_SPIN_BUTTON +// +// If that is not the case, a warning will be issued at run time. +// +// In addition to this interface, its implementers are expected to provide the +// correct values for the following properties: +// +// - GTK_ACCESSIBLE_PROPERTY_VALUE_MAX +// +// - GTK_ACCESSIBLE_PROPERTY_VALUE_MIN +// +// - GTK_ACCESSIBLE_PROPERTY_VALUE_NOW +// +// - GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT. +// +// AccessibleRange wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type AccessibleRange struct { + _ [0]func() // equal guard + Accessible +} + +var () + +// AccessibleRanger describes AccessibleRange's interface methods. +type AccessibleRanger interface { + coreglib.Objector + + baseAccessibleRange() *AccessibleRange +} + +var _ AccessibleRanger = (*AccessibleRange)(nil) + +func wrapAccessibleRange(obj *coreglib.Object) *AccessibleRange { + return &AccessibleRange{ + Accessible: Accessible{ + Object: obj, + }, + } +} + +func marshalAccessibleRange(p uintptr) (interface{}, error) { + return wrapAccessibleRange(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *AccessibleRange) baseAccessibleRange() *AccessibleRange { + return v +} + +// BaseAccessibleRange returns the underlying base object. +func BaseAccessibleRange(obj AccessibleRanger) *AccessibleRange { + return obj.baseAccessibleRange() +} + +// setCurrentValue sets the current value of the accessible range. +// +// This operation should behave similarly as if the user performed the action. +// +// The function takes the following parameters: +// +// - value to set. +// +// The function returns the following values: +// +// - ok: true if the operation was performed, false otherwise. +func (self *AccessibleRange) setCurrentValue(value float64) bool { + gclass := (*C.GtkAccessibleRangeInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.set_current_value + + var _arg0 *C.GtkAccessibleRange // out + var _arg1 C.double // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAccessibleRange)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.double(value) + + _cret = C._gotk4_gtk4_AccessibleRange_virtual_set_current_value(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// AccessibleText: interface for accessible objects containing formatted text. +// +// The GtkAccessibleText interfaces is meant to be implemented by accessible +// objects that have text formatted with attributes, or non-trivial text +// contents. +// +// You should use the gtk.AccessibleProperty.LABEL or the +// gtk.AccessibleProperty.DESCRIPTION properties for accessible objects +// containing simple, unformatted text. +// +// AccessibleText wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type AccessibleText struct { + _ [0]func() // equal guard + Accessible +} + +var () + +// AccessibleTexter describes AccessibleText's interface methods. +type AccessibleTexter interface { + coreglib.Objector + + // UpdateCaretPosition updates the position of the caret. + UpdateCaretPosition() + // UpdateContents notifies assistive technologies of a change in contents. + UpdateContents(change AccessibleTextContentChange, start, end uint) + // UpdateSelectionBound updates the boundary of the selection. + UpdateSelectionBound() +} + +var _ AccessibleTexter = (*AccessibleText)(nil) + +func wrapAccessibleText(obj *coreglib.Object) *AccessibleText { + return &AccessibleText{ + Accessible: Accessible{ + Object: obj, + }, + } +} + +func marshalAccessibleText(p uintptr) (interface{}, error) { + return wrapAccessibleText(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// UpdateCaretPosition updates the position of the caret. +// +// Implementations of the GtkAccessibleText interface should call this function +// every time the caret has moved, in order to notify assistive technologies. +func (self *AccessibleText) UpdateCaretPosition() { + var _arg0 *C.GtkAccessibleText // out + + _arg0 = (*C.GtkAccessibleText)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.gtk_accessible_text_update_caret_position(_arg0) + runtime.KeepAlive(self) +} + +// UpdateContents notifies assistive technologies of a change in contents. +// +// Implementations of the GtkAccessibleText interface should call this function +// every time their contents change as the result of an operation, like an +// insertion or a removal. +// +// Note: If the change is a deletion, this function must be called *before* +// removing the contents, if it is an insertion, it must be called *after* +// inserting the new contents. +// +// The function takes the following parameters: +// +// - change: type of change in the contents. +// - start: starting offset of the change, in characters. +// - end offset of the change, in characters. +func (self *AccessibleText) UpdateContents(change AccessibleTextContentChange, start, end uint) { + var _arg0 *C.GtkAccessibleText // out + var _arg1 C.GtkAccessibleTextContentChange // out + var _arg2 C.uint // out + var _arg3 C.uint // out + + _arg0 = (*C.GtkAccessibleText)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GtkAccessibleTextContentChange(change) + _arg2 = C.uint(start) + _arg3 = C.uint(end) + + C.gtk_accessible_text_update_contents(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(self) + runtime.KeepAlive(change) + runtime.KeepAlive(start) + runtime.KeepAlive(end) +} + +// UpdateSelectionBound updates the boundary of the selection. +// +// Implementations of the GtkAccessibleText interface should call this +// function every time the selection has moved, in order to notify assistive +// technologies. +func (self *AccessibleText) UpdateSelectionBound() { + var _arg0 *C.GtkAccessibleText // out + + _arg0 = (*C.GtkAccessibleText)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.gtk_accessible_text_update_selection_bound(_arg0) + runtime.KeepAlive(self) +} + +// Attributes retrieves the text attributes inside the accessible object. +// +// Each attribute is composed by: +// +// - a range +// +// - a name +// +// - a value +// +// It is left to the implementation to determine the serialization format of the +// value to a string. +// +// GTK provides support for various text attribute names and values, but +// implementations of this interface are free to add their own attributes. +// +// If this function returns true, n_ranges will be set to a value greater +// than or equal to one, ranges will be set to a newly allocated array of +// [struct#Gtk.AccessibleTextRange]. +// +// The function takes the following parameters: +// +// - offset: offset, in characters. +// +// The function returns the following values: +// +// - ranges (optional) of the attributes inside the accessible object. +// - attributeNames (optional): the names of the attributes inside the +// accessible object. +// - attributeValues (optional): the values of the attributes inside the +// accessible object. +// - ok: true if the accessible object has at least an attribute, and false +// otherwise. +func (self *AccessibleText) attributes(offset uint) (ranges []AccessibleTextRange, attributeNames, attributeValues []string, ok bool) { + gclass := (*C.GtkAccessibleTextInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_attributes + + var _arg0 *C.GtkAccessibleText // out + var _arg1 C.uint // out + var _arg3 *C.GtkAccessibleTextRange // in + var _arg2 C.gsize // in + var _arg4 **C.char // in + var _arg5 **C.char // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkAccessibleText)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(offset) + + _cret = C._gotk4_gtk4_AccessibleText_virtual_get_attributes(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2, &_arg3, &_arg4, &_arg5) + runtime.KeepAlive(self) + runtime.KeepAlive(offset) + + var _ranges []AccessibleTextRange // out + var _attributeNames []string // out + var _attributeValues []string // out + var _ok bool // out + + if _arg3 != nil { + defer C.free(unsafe.Pointer(_arg3)) + { + src := unsafe.Slice((*C.GtkAccessibleTextRange)(_arg3), _arg2) + _ranges = make([]AccessibleTextRange, _arg2) + for i := 0; i < int(_arg2); i++ { + _ranges[i] = *(*AccessibleTextRange)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + } + if _arg4 != nil { + defer C.free(unsafe.Pointer(_arg4)) + { + var i int + var z *C.char + for p := _arg4; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg4, i) + _attributeNames = make([]string, i) + for i := range src { + _attributeNames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + } + if _arg5 != nil { + defer C.free(unsafe.Pointer(_arg5)) + { + var i int + var z *C.char + for p := _arg5; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg5, i) + _attributeValues = make([]string, i) + for i := range src { + _attributeValues[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + } + if _cret != 0 { + _ok = true + } + + return _ranges, _attributeNames, _attributeValues, _ok +} + +// caretPosition retrieves the position of the caret inside the accessible +// object. +// +// The function returns the following values: +// +// - guint: position of the caret, in characters. +func (self *AccessibleText) caretPosition() uint { + gclass := (*C.GtkAccessibleTextInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_caret_position + + var _arg0 *C.GtkAccessibleText // out + var _cret C.uint // in + + _arg0 = (*C.GtkAccessibleText)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C._gotk4_gtk4_AccessibleText_virtual_get_caret_position(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(self) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// Contents: retrieve the current contents of the accessible object within the +// given range. +// +// If end is G_MAXUINT, the end of the range is the full content of the +// accessible object. +// +// The function takes the following parameters: +// +// - start: beginning of the range, in characters. +// - end of the range, in characters. +// +// The function returns the following values: +// +// - bytes: requested slice of the contents of the accessible object, +// as UTF-8. Note that the slice does not have to be NUL-terminated. +func (self *AccessibleText) contents(start, end uint) *glib.Bytes { + gclass := (*C.GtkAccessibleTextInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_contents + + var _arg0 *C.GtkAccessibleText // out + var _arg1 C.uint // out + var _arg2 C.uint // out + var _cret *C.GBytes // in + + _arg0 = (*C.GtkAccessibleText)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(start) + _arg2 = C.uint(end) + + _cret = C._gotk4_gtk4_AccessibleText_virtual_get_contents(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(start) + runtime.KeepAlive(end) + + var _bytes *glib.Bytes // out + + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _bytes +} + +// contentsAt: retrieve the current contents of the accessible object starting +// from the given offset, and using the given granularity. +// +// The start and end values contain the boundaries of the text. +// +// The function takes the following parameters: +// +// - offset: offset, in characters. +// - granularity of the query. +// +// The function returns the following values: +// +// - start of the range, in characters. +// - end of the range, in characters. +// - bytes: requested slice of the contents of the accessible object, +// as UTF-8. Note that the slice does not have to be NUL-terminated. +func (self *AccessibleText) contentsAt(offset uint, granularity AccessibleTextGranularity) (start, end uint, bytes *glib.Bytes) { + gclass := (*C.GtkAccessibleTextInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_contents_at + + var _arg0 *C.GtkAccessibleText // out + var _arg1 C.uint // out + var _arg2 C.GtkAccessibleTextGranularity // out + var _arg3 C.uint // in + var _arg4 C.uint // in + var _cret *C.GBytes // in + + _arg0 = (*C.GtkAccessibleText)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(offset) + _arg2 = C.GtkAccessibleTextGranularity(granularity) + + _cret = C._gotk4_gtk4_AccessibleText_virtual_get_contents_at(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_arg3, &_arg4) + runtime.KeepAlive(self) + runtime.KeepAlive(offset) + runtime.KeepAlive(granularity) + + var _start uint // out + var _end uint // out + var _bytes *glib.Bytes // out + + _start = uint(_arg3) + _end = uint(_arg4) + _bytes = (*glib.Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bytes)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_bytes_unref((*C.GBytes)(intern.C)) + }, + ) + + return _start, _end, _bytes +} + +// defaultAttributes retrieves the default text attributes inside the accessible +// object. +// +// Each attribute is composed by: +// +// - a name +// +// - a value +// +// It is left to the implementation to determine the serialization format of the +// value to a string. +// +// GTK provides support for various text attribute names and values, but +// implementations of this interface are free to add their own attributes. +// +// The function returns the following values: +// +// - attributeNames (optional): the names of the default attributes inside the +// accessible object. +// - attributeValues (optional): the values of the default attributes inside +// the accessible object. +func (self *AccessibleText) defaultAttributes() (attributeNames, attributeValues []string) { + gclass := (*C.GtkAccessibleTextInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_default_attributes + + var _arg0 *C.GtkAccessibleText // out + var _arg1 **C.char // in + var _arg2 **C.char // in + + _arg0 = (*C.GtkAccessibleText)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C._gotk4_gtk4_AccessibleText_virtual_get_default_attributes(unsafe.Pointer(fnarg), _arg0, &_arg1, &_arg2) + runtime.KeepAlive(self) + + var _attributeNames []string // out + var _attributeValues []string // out + + if _arg1 != nil { + defer C.free(unsafe.Pointer(_arg1)) + { + var i int + var z *C.char + for p := _arg1; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg1, i) + _attributeNames = make([]string, i) + for i := range src { + _attributeNames[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + } + if _arg2 != nil { + defer C.free(unsafe.Pointer(_arg2)) + { + var i int + var z *C.char + for p := _arg2; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_arg2, i) + _attributeValues = make([]string, i) + for i := range src { + _attributeValues[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + } + + return _attributeNames, _attributeValues +} + +// Selection retrieves the selection ranges in the accessible object. +// +// If this function returns true, n_ranges will be set to a value greater +// than or equal to one, and ranges will be set to a newly allocated array of +// [struct#Gtk.AccessibleTextRange]. +// +// The function returns the following values: +// +// - ranges (optional): selection ranges. +// - ok: true if there is at least a selection inside the accessible object, +// and false otherwise. +func (self *AccessibleText) selection() ([]AccessibleTextRange, bool) { + gclass := (*C.GtkAccessibleTextInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_selection + + var _arg0 *C.GtkAccessibleText // out + var _arg2 *C.GtkAccessibleTextRange // in + var _arg1 C.gsize // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkAccessibleText)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C._gotk4_gtk4_AccessibleText_virtual_get_selection(unsafe.Pointer(fnarg), _arg0, &_arg1, &_arg2) + runtime.KeepAlive(self) + + var _ranges []AccessibleTextRange // out + var _ok bool // out + + if _arg2 != nil { + defer C.free(unsafe.Pointer(_arg2)) + { + src := unsafe.Slice((*C.GtkAccessibleTextRange)(_arg2), _arg1) + _ranges = make([]AccessibleTextRange, _arg1) + for i := 0; i < int(_arg1); i++ { + _ranges[i] = *(*AccessibleTextRange)(gextras.NewStructNative(unsafe.Pointer((&src[i])))) + } + } + } + if _cret != 0 { + _ok = true + } + + return _ranges, _ok +} + +// Actionable: GtkActionable interface provides a convenient way of associating +// widgets with actions. +// +// It primarily consists of two properties: gtk.Actionable:action-name and +// gtk.Actionable:action-target. There are also some convenience APIs for +// setting these properties. +// +// The action will be looked up in action groups that are found among the +// widgets ancestors. Most commonly, these will be the actions with the +// “win.” or “app.” prefix that are associated with the GtkApplicationWindow +// or GtkApplication, but other action groups that are added with +// gtk.Widget.InsertActionGroup() will be consulted as well. +// +// Actionable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Actionable struct { + _ [0]func() // equal guard + Widget +} + +var ( + _ Widgetter = (*Actionable)(nil) +) + +// Actionabler describes Actionable's interface methods. +type Actionabler interface { + coreglib.Objector + + // ActionName gets the action name for actionable. + ActionName() string + // ActionTargetValue gets the current target value of actionable. + ActionTargetValue() *glib.Variant + // SetActionName specifies the name of the action with which this widget + // should be associated. + SetActionName(actionName string) + // SetActionTargetValue sets the target value of an actionable widget. + SetActionTargetValue(targetValue *glib.Variant) + // SetDetailedActionName sets the action-name and associated string target + // value of an actionable widget. + SetDetailedActionName(detailedActionName string) +} + +var _ Actionabler = (*Actionable)(nil) + +func wrapActionable(obj *coreglib.Object) *Actionable { + return &Actionable{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + } +} + +func marshalActionable(p uintptr) (interface{}, error) { + return wrapActionable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ActionName gets the action name for actionable. +// +// The function returns the following values: +// +// - utf8 (optional): action name. +func (actionable *Actionable) ActionName() string { + var _arg0 *C.GtkActionable // out + var _cret *C.char // in + + _arg0 = (*C.GtkActionable)(unsafe.Pointer(coreglib.InternObject(actionable).Native())) + + _cret = C.gtk_actionable_get_action_name(_arg0) + runtime.KeepAlive(actionable) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ActionTargetValue gets the current target value of actionable. +// +// The function returns the following values: +// +// - variant (optional): current target value. +func (actionable *Actionable) ActionTargetValue() *glib.Variant { + var _arg0 *C.GtkActionable // out + var _cret *C.GVariant // in + + _arg0 = (*C.GtkActionable)(unsafe.Pointer(coreglib.InternObject(actionable).Native())) + + _cret = C.gtk_actionable_get_action_target_value(_arg0) + runtime.KeepAlive(actionable) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// SetActionName specifies the name of the action with which this widget should +// be associated. +// +// If action_name is NULL then the widget will be unassociated from any previous +// action. +// +// Usually this function is used when the widget is located (or will be located) +// within the hierarchy of a GtkApplicationWindow. +// +// Names are of the form “win.save” or “app.quit” for actions on the containing +// applicationwindow or its associated application, respectively. This is the +// same form used for actions in the gio.Menu associated with the window. +// +// The function takes the following parameters: +// +// - actionName (optional): action name. +func (actionable *Actionable) SetActionName(actionName string) { + var _arg0 *C.GtkActionable // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkActionable)(unsafe.Pointer(coreglib.InternObject(actionable).Native())) + if actionName != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_actionable_set_action_name(_arg0, _arg1) + runtime.KeepAlive(actionable) + runtime.KeepAlive(actionName) +} + +// SetActionTargetValue sets the target value of an actionable widget. +// +// If target_value is NULL then the target value is unset. +// +// The target value has two purposes. First, it is used as the parameter to +// activation of the action associated with the GtkActionable widget. Second, +// it is used to determine if the widget should be rendered as “active” — the +// widget is active if the state is equal to the given target. +// +// Consider the example of associating a set of buttons with a gio.Action +// with string state in a typical “radio button” situation. Each button will +// be associated with the same action, but with a different target value for +// that action. Clicking on a particular button will activate the action with +// the target of that button, which will typically cause the action’s state to +// change to that value. Since the action’s state is now equal to the target +// value of the button, the button will now be rendered as active (and the other +// buttons, with different targets, rendered inactive). +// +// The function takes the following parameters: +// +// - targetValue (optional): glib.Variant to set as the target value. +func (actionable *Actionable) SetActionTargetValue(targetValue *glib.Variant) { + var _arg0 *C.GtkActionable // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GtkActionable)(unsafe.Pointer(coreglib.InternObject(actionable).Native())) + if targetValue != nil { + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(targetValue))) + } + + C.gtk_actionable_set_action_target_value(_arg0, _arg1) + runtime.KeepAlive(actionable) + runtime.KeepAlive(targetValue) +} + +// SetDetailedActionName sets the action-name and associated string target value +// of an actionable widget. +// +// detailed_action_name is a string in the format accepted by +// gio.Action().ParseDetailedName. +// +// The function takes the following parameters: +// +// - detailedActionName: detailed action name. +func (actionable *Actionable) SetDetailedActionName(detailedActionName string) { + var _arg0 *C.GtkActionable // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkActionable)(unsafe.Pointer(coreglib.InternObject(actionable).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(detailedActionName))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_actionable_set_detailed_action_name(_arg0, _arg1) + runtime.KeepAlive(actionable) + runtime.KeepAlive(detailedActionName) +} + +// actionName gets the action name for actionable. +// +// The function returns the following values: +// +// - utf8 (optional): action name. +func (actionable *Actionable) actionName() string { + gclass := (*C.GtkActionableInterface)(coreglib.PeekParentClass(actionable)) + fnarg := gclass.get_action_name + + var _arg0 *C.GtkActionable // out + var _cret *C.char // in + + _arg0 = (*C.GtkActionable)(unsafe.Pointer(coreglib.InternObject(actionable).Native())) + + _cret = C._gotk4_gtk4_Actionable_virtual_get_action_name(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(actionable) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// actionTargetValue gets the current target value of actionable. +// +// The function returns the following values: +// +// - variant (optional): current target value. +func (actionable *Actionable) actionTargetValue() *glib.Variant { + gclass := (*C.GtkActionableInterface)(coreglib.PeekParentClass(actionable)) + fnarg := gclass.get_action_target_value + + var _arg0 *C.GtkActionable // out + var _cret *C.GVariant // in + + _arg0 = (*C.GtkActionable)(unsafe.Pointer(coreglib.InternObject(actionable).Native())) + + _cret = C._gotk4_gtk4_Actionable_virtual_get_action_target_value(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(actionable) + + var _variant *glib.Variant // out + + if _cret != nil { + _variant = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_variant_ref(_cret) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_variant)), + func(intern *struct{ C unsafe.Pointer }) { + C.g_variant_unref((*C.GVariant)(intern.C)) + }, + ) + } + + return _variant +} + +// setActionName specifies the name of the action with which this widget should +// be associated. +// +// If action_name is NULL then the widget will be unassociated from any previous +// action. +// +// Usually this function is used when the widget is located (or will be located) +// within the hierarchy of a GtkApplicationWindow. +// +// Names are of the form “win.save” or “app.quit” for actions on the containing +// applicationwindow or its associated application, respectively. This is the +// same form used for actions in the gio.Menu associated with the window. +// +// The function takes the following parameters: +// +// - actionName (optional): action name. +func (actionable *Actionable) setActionName(actionName string) { + gclass := (*C.GtkActionableInterface)(coreglib.PeekParentClass(actionable)) + fnarg := gclass.set_action_name + + var _arg0 *C.GtkActionable // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkActionable)(unsafe.Pointer(coreglib.InternObject(actionable).Native())) + if actionName != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(actionName))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C._gotk4_gtk4_Actionable_virtual_set_action_name(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionable) + runtime.KeepAlive(actionName) +} + +// setActionTargetValue sets the target value of an actionable widget. +// +// If target_value is NULL then the target value is unset. +// +// The target value has two purposes. First, it is used as the parameter to +// activation of the action associated with the GtkActionable widget. Second, +// it is used to determine if the widget should be rendered as “active” — the +// widget is active if the state is equal to the given target. +// +// Consider the example of associating a set of buttons with a gio.Action +// with string state in a typical “radio button” situation. Each button will +// be associated with the same action, but with a different target value for +// that action. Clicking on a particular button will activate the action with +// the target of that button, which will typically cause the action’s state to +// change to that value. Since the action’s state is now equal to the target +// value of the button, the button will now be rendered as active (and the other +// buttons, with different targets, rendered inactive). +// +// The function takes the following parameters: +// +// - targetValue (optional): glib.Variant to set as the target value. +func (actionable *Actionable) setActionTargetValue(targetValue *glib.Variant) { + gclass := (*C.GtkActionableInterface)(coreglib.PeekParentClass(actionable)) + fnarg := gclass.set_action_target_value + + var _arg0 *C.GtkActionable // out + var _arg1 *C.GVariant // out + + _arg0 = (*C.GtkActionable)(unsafe.Pointer(coreglib.InternObject(actionable).Native())) + if targetValue != nil { + _arg1 = (*C.GVariant)(gextras.StructNative(unsafe.Pointer(targetValue))) + } + + C._gotk4_gtk4_Actionable_virtual_set_action_target_value(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(actionable) + runtime.KeepAlive(targetValue) +} + +// AppChooser: GtkAppChooser is an interface for widgets which allow the user to +// choose an application. +// +// The main objects that implement this interface are gtk.AppChooserWidget, +// gtk.AppChooserDialog and gtk.AppChooserButton. +// +// Applications are represented by GIO GAppInfo objects here. GIO has a +// concept of recommended and fallback applications for a given content type. +// Recommended applications are those that claim to handle the content type +// itself, while fallback also includes applications that handle a more generic +// content type. GIO also knows the default and last-used application for a +// given content type. The GtkAppChooserWidget provides detailed control over +// whether the shown list of applications should include default, recommended or +// fallback applications. +// +// To obtain the application that has been selected in a GtkAppChooser, +// use gtk.AppChooser.GetAppInfo(). +// +// Deprecated: The application selection widgets should be implemented according +// to the design of each platform and/or application requiring them. +// +// AppChooser wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type AppChooser struct { + _ [0]func() // equal guard + Widget +} + +var ( + _ Widgetter = (*AppChooser)(nil) +) + +// AppChooserer describes AppChooser's interface methods. +type AppChooserer interface { + coreglib.Objector + + // AppInfo returns the currently selected application. + AppInfo() *gio.AppInfo + // ContentType returns the content type for which the GtkAppChooser shows + // applications. + ContentType() string + // Refresh reloads the list of applications. + Refresh() +} + +var _ AppChooserer = (*AppChooser)(nil) + +func wrapAppChooser(obj *coreglib.Object) *AppChooser { + return &AppChooser{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + } +} + +func marshalAppChooser(p uintptr) (interface{}, error) { + return wrapAppChooser(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// AppInfo returns the currently selected application. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - appInfo (optional): GAppInfo for the currently selected application. +func (self *AppChooser) AppInfo() *gio.AppInfo { + var _arg0 *C.GtkAppChooser // out + var _cret *C.GAppInfo // in + + _arg0 = (*C.GtkAppChooser)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_get_app_info(_arg0) + runtime.KeepAlive(self) + + var _appInfo *gio.AppInfo // out + + if _cret != nil { + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _appInfo = &gio.AppInfo{ + Object: obj, + } + } + } + + return _appInfo +} + +// ContentType returns the content type for which the GtkAppChooser shows +// applications. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - utf8: content type of self. Free with g_free(). +func (self *AppChooser) ContentType() string { + var _arg0 *C.GtkAppChooser // out + var _cret *C.char // in + + _arg0 = (*C.GtkAppChooser)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_get_content_type(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Refresh reloads the list of applications. +// +// Deprecated: This widget will be removed in GTK 5. +func (self *AppChooser) Refresh() { + var _arg0 *C.GtkAppChooser // out + + _arg0 = (*C.GtkAppChooser)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.gtk_app_chooser_refresh(_arg0) + runtime.KeepAlive(self) +} + +// Buildable: GtkBuildable allows objects to extend and customize their +// deserialization from ui files. +// +// The interface includes methods for setting names and properties of objects, +// parsing custom tags and constructing child objects. +// +// The GtkBuildable interface is implemented by all widgets and many of the +// non-widget objects that are provided by GTK. The main user of this interface +// is gtk.Builder. There should be very little need for applications to call any +// of these functions directly. +// +// An object only needs to implement this interface if it needs to extend the +// GtkBuilder XML format or run any extra routines at deserialization time. +// +// Buildable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Buildable struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Buildable)(nil) +) + +// Buildabler describes Buildable's interface methods. +type Buildabler interface { + coreglib.Objector + + // BuildableID gets the ID of the buildable object. + BuildableID() string +} + +var _ Buildabler = (*Buildable)(nil) + +func wrapBuildable(obj *coreglib.Object) *Buildable { + return &Buildable{ + Object: obj, + } +} + +func marshalBuildable(p uintptr) (interface{}, error) { + return wrapBuildable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// BuildableID gets the ID of the buildable object. +// +// GtkBuilder sets the name based on the ID attribute of the tag used +// to construct the buildable. +// +// The function returns the following values: +// +// - utf8 (optional): ID of the buildable object. +func (buildable *Buildable) BuildableID() string { + var _arg0 *C.GtkBuildable // out + var _cret *C.char // in + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + + _cret = C.gtk_buildable_get_buildable_id(_arg0) + runtime.KeepAlive(buildable) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// addChild adds a child to buildable. type is an optional string describing how +// the child should be added. +// +// The function takes the following parameters: +// +// - builder: GtkBuilder. +// - child to add. +// - typ (optional): kind of child or NULL. +func (buildable *Buildable) addChild(builder *Builder, child *coreglib.Object, typ string) { + gclass := (*C.GtkBuildableIface)(coreglib.PeekParentClass(buildable)) + fnarg := gclass.add_child + + var _arg0 *C.GtkBuildable // out + var _arg1 *C.GtkBuilder // out + var _arg2 *C.GObject // out + var _arg3 *C.char // out + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + _arg1 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) + _arg2 = (*C.GObject)(unsafe.Pointer(child.Native())) + if typ != "" { + _arg3 = (*C.char)(unsafe.Pointer(C.CString(typ))) + defer C.free(unsafe.Pointer(_arg3)) + } + + C._gotk4_gtk4_Buildable_virtual_add_child(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(buildable) + runtime.KeepAlive(builder) + runtime.KeepAlive(child) + runtime.KeepAlive(typ) +} + +// customFinished: similar to gtk_buildable_parser_finished() but is called once +// for each custom tag handled by the buildable. +// +// The function takes the following parameters: +// +// - builder: GtkBuilder. +// - child (optional) object or NULL for non-child tags. +// - tagname: name of the tag. +// - data (optional): user data created in custom_tag_start. +func (buildable *Buildable) customFinished(builder *Builder, child *coreglib.Object, tagname string, data unsafe.Pointer) { + gclass := (*C.GtkBuildableIface)(coreglib.PeekParentClass(buildable)) + fnarg := gclass.custom_finished + + var _arg0 *C.GtkBuildable // out + var _arg1 *C.GtkBuilder // out + var _arg2 *C.GObject // out + var _arg3 *C.char // out + var _arg4 C.gpointer // out + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + _arg1 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) + if child != nil { + _arg2 = (*C.GObject)(unsafe.Pointer(child.Native())) + } + _arg3 = (*C.char)(unsafe.Pointer(C.CString(tagname))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (C.gpointer)(unsafe.Pointer(data)) + + C._gotk4_gtk4_Buildable_virtual_custom_finished(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(buildable) + runtime.KeepAlive(builder) + runtime.KeepAlive(child) + runtime.KeepAlive(tagname) + runtime.KeepAlive(data) +} + +// customTagEnd: called at the end of each custom element handled by the +// buildable. +// +// The function takes the following parameters: +// +// - builder: GtkBuilder used to construct this object. +// - child (optional) object or NULL for non-child tags. +// - tagname: name of tag. +// - data (optional): user data that will be passed in to parser functions. +func (buildable *Buildable) customTagEnd(builder *Builder, child *coreglib.Object, tagname string, data unsafe.Pointer) { + gclass := (*C.GtkBuildableIface)(coreglib.PeekParentClass(buildable)) + fnarg := gclass.custom_tag_end + + var _arg0 *C.GtkBuildable // out + var _arg1 *C.GtkBuilder // out + var _arg2 *C.GObject // out + var _arg3 *C.char // out + var _arg4 C.gpointer // out + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + _arg1 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) + if child != nil { + _arg2 = (*C.GObject)(unsafe.Pointer(child.Native())) + } + _arg3 = (*C.char)(unsafe.Pointer(C.CString(tagname))) + defer C.free(unsafe.Pointer(_arg3)) + _arg4 = (C.gpointer)(unsafe.Pointer(data)) + + C._gotk4_gtk4_Buildable_virtual_custom_tag_end(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(buildable) + runtime.KeepAlive(builder) + runtime.KeepAlive(child) + runtime.KeepAlive(tagname) + runtime.KeepAlive(data) +} + +// customTagStart: called for each unknown element under . +// +// The function takes the following parameters: +// +// - builder: GtkBuilder used to construct this object. +// - child (optional) object or NULL for non-child tags. +// - tagname: name of tag. +// +// The function returns the following values: +// +// - parser: GtkBuildableParser to fill in. +// - data (optional): return location for user data that will be passed in to +// parser functions. +// - ok: TRUE if an object has a custom implementation, FALSE if it doesn't. +func (buildable *Buildable) customTagStart(builder *Builder, child *coreglib.Object, tagname string) (*BuildableParser, unsafe.Pointer, bool) { + gclass := (*C.GtkBuildableIface)(coreglib.PeekParentClass(buildable)) + fnarg := gclass.custom_tag_start + + var _arg0 *C.GtkBuildable // out + var _arg1 *C.GtkBuilder // out + var _arg2 *C.GObject // out + var _arg3 *C.char // out + var _arg4 C.GtkBuildableParser // in + var _arg5 C.gpointer // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + _arg1 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) + if child != nil { + _arg2 = (*C.GObject)(unsafe.Pointer(child.Native())) + } + _arg3 = (*C.char)(unsafe.Pointer(C.CString(tagname))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C._gotk4_gtk4_Buildable_virtual_custom_tag_start(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, &_arg4, &_arg5) + runtime.KeepAlive(buildable) + runtime.KeepAlive(builder) + runtime.KeepAlive(child) + runtime.KeepAlive(tagname) + + var _parser *BuildableParser // out + var _data unsafe.Pointer // out + var _ok bool // out + + _parser = (*BuildableParser)(gextras.NewStructNative(unsafe.Pointer((&_arg4)))) + _data = (unsafe.Pointer)(unsafe.Pointer(_arg5)) + if _cret != 0 { + _ok = true + } + + return _parser, _data, _ok +} + +// iD: getter corresponding to set_id. Implement this if you implement set_id. +func (buildable *Buildable) iD() string { + gclass := (*C.GtkBuildableIface)(coreglib.PeekParentClass(buildable)) + fnarg := gclass.get_id + + var _arg0 *C.GtkBuildable // out + var _cret *C.char // in + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + + _cret = C._gotk4_gtk4_Buildable_virtual_get_id(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(buildable) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// internalChild retrieves the internal child called childname of the buildable +// object. +// +// The function takes the following parameters: +// +// - builder: GtkBuilder. +// - childname: name of child. +// +// The function returns the following values: +// +// - object: internal child of the buildable object. +func (buildable *Buildable) internalChild(builder *Builder, childname string) *coreglib.Object { + gclass := (*C.GtkBuildableIface)(coreglib.PeekParentClass(buildable)) + fnarg := gclass.get_internal_child + + var _arg0 *C.GtkBuildable // out + var _arg1 *C.GtkBuilder // out + var _arg2 *C.char // out + var _cret *C.GObject // in + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + _arg1 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(childname))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C._gotk4_gtk4_Buildable_virtual_get_internal_child(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(buildable) + runtime.KeepAlive(builder) + runtime.KeepAlive(childname) + + var _object *coreglib.Object // out + + _object = coreglib.Take(unsafe.Pointer(_cret)) + + return _object +} + +// parserFinished: called when a builder finishes the parsing of a UI +// definition. It is normally not necessary to implement this, unless you need +// to perform special cleanup actions. GtkWindow sets the GtkWidget:visible +// property here. +func (buildable *Buildable) parserFinished(builder *Builder) { + gclass := (*C.GtkBuildableIface)(coreglib.PeekParentClass(buildable)) + fnarg := gclass.parser_finished + + var _arg0 *C.GtkBuildable // out + var _arg1 *C.GtkBuilder // out + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + _arg1 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) + + C._gotk4_gtk4_Buildable_virtual_parser_finished(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(buildable) + runtime.KeepAlive(builder) +} + +// setBuildableProperty sets a property of a buildable object. It is normally +// not necessary to implement this, g_object_set_property() is used by default. +// GtkWindow implements this to delay showing itself (i.e. setting the +// gtk.Widget:visible property) until the whole interface is created. +// +// The function takes the following parameters: +// +// - builder +// - name +// - value +func (buildable *Buildable) setBuildableProperty(builder *Builder, name string, value *coreglib.Value) { + gclass := (*C.GtkBuildableIface)(coreglib.PeekParentClass(buildable)) + fnarg := gclass.set_buildable_property + + var _arg0 *C.GtkBuildable // out + var _arg1 *C.GtkBuilder // out + var _arg2 *C.char // out + var _arg3 *C.GValue // out + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + _arg1 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.GValue)(unsafe.Pointer(value.Native())) + + C._gotk4_gtk4_Buildable_virtual_set_buildable_property(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(buildable) + runtime.KeepAlive(builder) + runtime.KeepAlive(name) + runtime.KeepAlive(value) +} + +// setID stores the id attribute given in the GtkBuilder UI definition. +// GtkWidget stores the name as object data. Implement this method if your +// object has some notion of “ID” and it makes sense to map the XML id attribute +// to it. +func (buildable *Buildable) setID(id string) { + gclass := (*C.GtkBuildableIface)(coreglib.PeekParentClass(buildable)) + fnarg := gclass.set_id + + var _arg0 *C.GtkBuildable // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkBuildable)(unsafe.Pointer(coreglib.InternObject(buildable).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(id))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gtk4_Buildable_virtual_set_id(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(buildable) + runtime.KeepAlive(id) +} + +// BuilderScope: GtkBuilderScope is an interface to provide language binding +// support to GtkBuilder. +// +// The goal of GtkBuilderScope is to look up programming-language-specific +// values for strings that are given in a GtkBuilder UI file. +// +// The primary intended audience is bindings that want to provide deeper +// integration of GtkBuilder into the language. +// +// A GtkBuilderScope instance may be used with multiple GtkBuilder objects, +// even at once. +// +// By default, GTK will use its own implementation of GtkBuilderScope for the C +// language which can be created via gtk.BuilderCScope.New. +// +// If you implement GtkBuilderScope for a language binding, you may want to +// (partially) derive from or fall back to a gtk.BuilderCScope, as that class +// implements support for automatic lookups from C symbols. +// +// BuilderScope wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type BuilderScope struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*BuilderScope)(nil) +) + +// BuilderScoper describes BuilderScope's interface methods. +type BuilderScoper interface { + coreglib.Objector + + baseBuilderScope() *BuilderScope +} + +var _ BuilderScoper = (*BuilderScope)(nil) + +func wrapBuilderScope(obj *coreglib.Object) *BuilderScope { + return &BuilderScope{ + Object: obj, + } +} + +func marshalBuilderScope(p uintptr) (interface{}, error) { + return wrapBuilderScope(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *BuilderScope) baseBuilderScope() *BuilderScope { + return v +} + +// BaseBuilderScope returns the underlying base object. +func BaseBuilderScope(obj BuilderScoper) *BuilderScope { + return obj.baseBuilderScope() +} + +// typeFromFunction: try to lookup a GType via the given function name, +// specified explicitly in a GtkBuilder file, like via the "type-func" attribute +// in the tag. This function is very rarely used. The C implementation +// will use dlsym() and call the resulting function as a GTypeFunc. The default +// implementation will fail and just return G_TYPE_INVALID. +// +// The function takes the following parameters: +// +// - builder +// - functionName +func (self *BuilderScope) typeFromFunction(builder *Builder, functionName string) coreglib.Type { + gclass := (*C.GtkBuilderScopeInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_type_from_function + + var _arg0 *C.GtkBuilderScope // out + var _arg1 *C.GtkBuilder // out + var _arg2 *C.char // out + var _cret C.GType // in + + _arg0 = (*C.GtkBuilderScope)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(functionName))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C._gotk4_gtk4_BuilderScope_virtual_get_type_from_function(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(builder) + runtime.KeepAlive(functionName) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// typeFromName: try to lookup a GType via the its name. See +// gtk_builder_get_type_from_name() for more details. The C implementation will +// use g_type_from_name() and if that fails try to guess the correct function +// name for registering the type and then use dlsym() to load it. The default +// implementation just tries g_type_from_name() and otherwise fails. +// +// The function takes the following parameters: +// +// - builder +// - typeName +func (self *BuilderScope) typeFromName(builder *Builder, typeName string) coreglib.Type { + gclass := (*C.GtkBuilderScopeInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_type_from_name + + var _arg0 *C.GtkBuilderScope // out + var _arg1 *C.GtkBuilder // out + var _arg2 *C.char // out + var _cret C.GType // in + + _arg0 = (*C.GtkBuilderScope)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(typeName))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C._gotk4_gtk4_BuilderScope_virtual_get_type_from_name(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(builder) + runtime.KeepAlive(typeName) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// CellEditable: interface for widgets that can be used for editing cells +// +// The GtkCellEditable interface must be implemented for widgets to be usable +// to edit the contents of a GtkTreeView cell. It provides a way to specify how +// temporary widgets should be configured for editing, get the new value, etc. +// +// Deprecated: List views use widgets for displaying their contents. See +// gtk.Editable for editable text widgets. +// +// CellEditable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type CellEditable struct { + _ [0]func() // equal guard + Widget +} + +var ( + _ Widgetter = (*CellEditable)(nil) +) + +// CellEditabler describes CellEditable's interface methods. +type CellEditabler interface { + coreglib.Objector + + // EditingDone emits the GtkCellEditable::editing-done signal. + EditingDone() + // RemoveWidget emits the GtkCellEditable::remove-widget signal. + RemoveWidget() + // StartEditing begins editing on a cell_editable. + StartEditing(event gdk.Eventer) + + // Editing-done: this signal is a sign for the cell renderer to update its + // value from the cell_editable. + ConnectEditingDone(func()) coreglib.SignalHandle + // Remove-widget: this signal is meant to indicate that the cell is + // finished editing, and the cell_editable widget is being removed and may + // subsequently be destroyed. + ConnectRemoveWidget(func()) coreglib.SignalHandle +} + +var _ CellEditabler = (*CellEditable)(nil) + +func wrapCellEditable(obj *coreglib.Object) *CellEditable { + return &CellEditable{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + } +} + +func marshalCellEditable(p uintptr) (interface{}, error) { + return wrapCellEditable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectEditingDone: this signal is a sign for the cell renderer to update its +// value from the cell_editable. +// +// Implementations of GtkCellEditable are responsible for emitting this signal +// when they are done editing, e.g. GtkEntry emits this signal when the user +// presses Enter. Typical things to do in a handler for ::editing-done are to +// capture the edited value, disconnect the cell_editable from signals on the +// GtkCellRenderer, etc. +// +// gtk_cell_editable_editing_done() is a convenience method for emitting +// GtkCellEditable::editing-done. +func (cellEditable *CellEditable) ConnectEditingDone(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(cellEditable, "editing-done", false, unsafe.Pointer(C._gotk4_gtk4_CellEditable_ConnectEditingDone), f) +} + +// ConnectRemoveWidget: this signal is meant to indicate that the cell is +// finished editing, and the cell_editable widget is being removed and may +// subsequently be destroyed. +// +// Implementations of GtkCellEditable are responsible for emitting +// this signal when they are done editing. It must be emitted after the +// GtkCellEditable::editing-done signal, to give the cell renderer a chance to +// update the cell's value before the widget is removed. +// +// gtk_cell_editable_remove_widget() is a convenience method for emitting +// GtkCellEditable::remove-widget. +func (cellEditable *CellEditable) ConnectRemoveWidget(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(cellEditable, "remove-widget", false, unsafe.Pointer(C._gotk4_gtk4_CellEditable_ConnectRemoveWidget), f) +} + +// EditingDone emits the GtkCellEditable::editing-done signal. +// +// Deprecated: since version 4.10. +func (cellEditable *CellEditable) EditingDone() { + var _arg0 *C.GtkCellEditable // out + + _arg0 = (*C.GtkCellEditable)(unsafe.Pointer(coreglib.InternObject(cellEditable).Native())) + + C.gtk_cell_editable_editing_done(_arg0) + runtime.KeepAlive(cellEditable) +} + +// RemoveWidget emits the GtkCellEditable::remove-widget signal. +// +// Deprecated: since version 4.10. +func (cellEditable *CellEditable) RemoveWidget() { + var _arg0 *C.GtkCellEditable // out + + _arg0 = (*C.GtkCellEditable)(unsafe.Pointer(coreglib.InternObject(cellEditable).Native())) + + C.gtk_cell_editable_remove_widget(_arg0) + runtime.KeepAlive(cellEditable) +} + +// StartEditing begins editing on a cell_editable. +// +// The GtkCellRenderer for the cell creates and returns a GtkCellEditable from +// gtk_cell_renderer_start_editing(), configured for the GtkCellRenderer type. +// +// gtk_cell_editable_start_editing() can then set up cell_editable suitably for +// editing a cell, e.g. making the Esc key emit GtkCellEditable::editing-done. +// +// Note that the cell_editable is created on-demand for the current edit; its +// lifetime is temporary and does not persist across other edits and/or cells. +// +// The function takes the following parameters: +// +// - event (optional): GdkEvent that began the editing process, or NULL if +// editing was initiated programmatically. +func (cellEditable *CellEditable) StartEditing(event gdk.Eventer) { + var _arg0 *C.GtkCellEditable // out + var _arg1 *C.GdkEvent // out + + _arg0 = (*C.GtkCellEditable)(unsafe.Pointer(coreglib.InternObject(cellEditable).Native())) + if event != nil { + _arg1 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + } + + C.gtk_cell_editable_start_editing(_arg0, _arg1) + runtime.KeepAlive(cellEditable) + runtime.KeepAlive(event) +} + +// editingDone emits the GtkCellEditable::editing-done signal. +// +// Deprecated: since version 4.10. +func (cellEditable *CellEditable) editingDone() { + gclass := (*C.GtkCellEditableIface)(coreglib.PeekParentClass(cellEditable)) + fnarg := gclass.editing_done + + var _arg0 *C.GtkCellEditable // out + + _arg0 = (*C.GtkCellEditable)(unsafe.Pointer(coreglib.InternObject(cellEditable).Native())) + + C._gotk4_gtk4_CellEditable_virtual_editing_done(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(cellEditable) +} + +// removeWidget emits the GtkCellEditable::remove-widget signal. +// +// Deprecated: since version 4.10. +func (cellEditable *CellEditable) removeWidget() { + gclass := (*C.GtkCellEditableIface)(coreglib.PeekParentClass(cellEditable)) + fnarg := gclass.remove_widget + + var _arg0 *C.GtkCellEditable // out + + _arg0 = (*C.GtkCellEditable)(unsafe.Pointer(coreglib.InternObject(cellEditable).Native())) + + C._gotk4_gtk4_CellEditable_virtual_remove_widget(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(cellEditable) +} + +// startEditing begins editing on a cell_editable. +// +// The GtkCellRenderer for the cell creates and returns a GtkCellEditable from +// gtk_cell_renderer_start_editing(), configured for the GtkCellRenderer type. +// +// gtk_cell_editable_start_editing() can then set up cell_editable suitably for +// editing a cell, e.g. making the Esc key emit GtkCellEditable::editing-done. +// +// Note that the cell_editable is created on-demand for the current edit; its +// lifetime is temporary and does not persist across other edits and/or cells. +// +// The function takes the following parameters: +// +// - event (optional): GdkEvent that began the editing process, or NULL if +// editing was initiated programmatically. +func (cellEditable *CellEditable) startEditing(event gdk.Eventer) { + gclass := (*C.GtkCellEditableIface)(coreglib.PeekParentClass(cellEditable)) + fnarg := gclass.start_editing + + var _arg0 *C.GtkCellEditable // out + var _arg1 *C.GdkEvent // out + + _arg0 = (*C.GtkCellEditable)(unsafe.Pointer(coreglib.InternObject(cellEditable).Native())) + if event != nil { + _arg1 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + } + + C._gotk4_gtk4_CellEditable_virtual_start_editing(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(cellEditable) + runtime.KeepAlive(event) +} + +// CellLayout: interface for packing cells +// +// GtkCellLayout is an interface to be implemented by all objects which want to +// provide a GtkTreeViewColumn like API for packing cells, setting attributes +// and data funcs. +// +// One of the notable features provided by implementations of GtkCellLayout +// are attributes. Attributes let you set the properties in flexible ways. +// They can just be set to constant values like regular properties. +// But they can also be mapped to a column of the underlying tree model +// with gtk_cell_layout_set_attributes(), which means that the value of +// the attribute can change from cell to cell as they are rendered by +// the cell renderer. Finally, it is possible to specify a function with +// gtk_cell_layout_set_cell_data_func() that is called to determine the value of +// the attribute for each cell that is rendered. +// +// # GtkCellLayouts as GtkBuildable +// +// Implementations of GtkCellLayout which also implement the GtkBuildable +// interface (GtkCellView, GtkIconView, GtkComboBox, GtkEntryCompletion, +// GtkTreeViewColumn) accept GtkCellRenderer objects as elements in UI +// definitions. They support a custom element for their children, +// which can contain multiple elements. Each element has +// a name attribute which specifies a property of the cell renderer; the content +// of the element is the attribute value. +// +// This is an example of a UI definition fragment specifying attributes: +// +// +// +// +// +// 0 +// +// +// +// +// Furthermore for implementations of GtkCellLayout that use a GtkCellArea to +// lay out cells (all GtkCellLayouts in GTK use a GtkCellArea) cell properties +// (class.CellArea.html#cell-properties) can also be defined in the format by +// specifying the custom attribute which can contain multiple +// elements. +// +// Here is a UI definition fragment specifying cell properties: +// +// +// +// +// +// True +// False +// +// +// +// +// # Subclassing GtkCellLayout implementations +// +// When subclassing a widget that implements GtkCellLayout like GtkIconView +// or GtkComboBox, there are some considerations related to the fact that +// these widgets internally use a GtkCellArea. The cell area is exposed as a +// construct-only property by these widgets. This means that it is possible to +// e.g. do +// +// GtkWIdget *combo = +// g_object_new (GTK_TYPE_COMBO_BOX, "cell-area", my_cell_area, NULL); +// +// to use a custom cell area with a combo box. But construct properties are +// only initialized after instance init() functions have run, which means that +// using functions which rely on the existence of the cell area in your subclass +// init() function will cause the default cell area to be instantiated. In this +// case, a provided construct property value will be ignored (with a warning, +// to alert you to the problem). +// +// static void +// my_combo_box_init (MyComboBox *b) +// { +// GtkCellRenderer *cell; +// +// cell = gtk_cell_renderer_pixbuf_new (); +// +// // The following call causes the default cell area for combo boxes, +// // a GtkCellAreaBox, to be instantiated +// gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (b), cell, FALSE); +// ... +// } +// +// GtkWidget * +// my_combo_box_new (GtkCellArea *area) +// { +// // This call is going to cause a warning about area being ignored +// return g_object_new (MY_TYPE_COMBO_BOX, "cell-area", area, NULL); +// } +// +// If supporting alternative cell areas with your derived widget is not +// important, then this does not have to concern you. If you want to support +// alternative cell areas, you can do so by moving the problematic calls out of +// init() and into a constructor() for your class. +// +// Deprecated: List views use widgets to display their contents. See +// gtk.LayoutManager for layout manager delegate objects. +// +// CellLayout wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type CellLayout struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*CellLayout)(nil) +) + +// CellLayouter describes CellLayout's interface methods. +type CellLayouter interface { + coreglib.Objector + + // AddAttribute adds an attribute mapping to the list in cell_layout. + AddAttribute(cell CellRendererer, attribute string, column int) + // Clear unsets all the mappings on all renderers on cell_layout and removes + // all renderers from cell_layout. + Clear() + // ClearAttributes clears all existing attributes previously set with + // gtk_cell_layout_set_attributes(). + ClearAttributes(cell CellRendererer) + // Area returns the underlying GtkCellArea which might be cell_layout if + // called on a GtkCellArea or might be NULL if no GtkCellArea is used by + // cell_layout. + Area() CellAreaer + // Cells returns the cell renderers which have been added to cell_layout. + Cells() []CellRendererer + // PackEnd adds the cell to the end of cell_layout. + PackEnd(cell CellRendererer, expand bool) + // PackStart packs the cell into the beginning of cell_layout. + PackStart(cell CellRendererer, expand bool) + // Reorder re-inserts cell at position. + Reorder(cell CellRendererer, position int) + // SetCellDataFunc sets the GtkCellLayoutDataFunc to use for cell_layout. + SetCellDataFunc(cell CellRendererer, fn CellLayoutDataFunc) +} + +var _ CellLayouter = (*CellLayout)(nil) + +func wrapCellLayout(obj *coreglib.Object) *CellLayout { + return &CellLayout{ + Object: obj, + } +} + +func marshalCellLayout(p uintptr) (interface{}, error) { + return wrapCellLayout(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// AddAttribute adds an attribute mapping to the list in cell_layout. +// +// The column is the column of the model to get a value from, and the attribute +// is the property on cell to be set from that value. So for example if column +// 2 of the model contains strings, you could have the “text” attribute of a +// GtkCellRendererText get its values from column 2. In this context "attribute" +// and "property" are used interchangeably. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer. +// - attribute: property on the renderer. +// - column position on the model to get the attribute from. +func (cellLayout *CellLayout) AddAttribute(cell CellRendererer, attribute string, column int) { + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 *C.char // out + var _arg3 C.int // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.int(column) + + C.gtk_cell_layout_add_attribute(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(attribute) + runtime.KeepAlive(column) +} + +// Clear unsets all the mappings on all renderers on cell_layout and removes all +// renderers from cell_layout. +// +// Deprecated: since version 4.10. +func (cellLayout *CellLayout) Clear() { + var _arg0 *C.GtkCellLayout // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + + C.gtk_cell_layout_clear(_arg0) + runtime.KeepAlive(cellLayout) +} + +// ClearAttributes clears all existing attributes previously set with +// gtk_cell_layout_set_attributes(). +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer to clear the attribute mapping on. +func (cellLayout *CellLayout) ClearAttributes(cell CellRendererer) { + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + + C.gtk_cell_layout_clear_attributes(_arg0, _arg1) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) +} + +// Area returns the underlying GtkCellArea which might be cell_layout if called +// on a GtkCellArea or might be NULL if no GtkCellArea is used by cell_layout. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - cellArea (optional): cell area used by cell_layout. +func (cellLayout *CellLayout) Area() CellAreaer { + var _arg0 *C.GtkCellLayout // out + var _cret *C.GtkCellArea // in + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + + _cret = C.gtk_cell_layout_get_area(_arg0) + runtime.KeepAlive(cellLayout) + + var _cellArea CellAreaer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(CellAreaer) + return ok + }) + rv, ok := casted.(CellAreaer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.CellAreaer") + } + _cellArea = rv + } + } + + return _cellArea +} + +// Cells returns the cell renderers which have been added to cell_layout. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - list: a list of cell renderers. The list, but not the renderers has been +// newly allocated and should be freed with g_list_free() when no longer +// needed. +func (cellLayout *CellLayout) Cells() []CellRendererer { + var _arg0 *C.GtkCellLayout // out + var _cret *C.GList // in + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + + _cret = C.gtk_cell_layout_get_cells(_arg0) + runtime.KeepAlive(cellLayout) + + var _list []CellRendererer // out + + _list = make([]CellRendererer, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GtkCellRenderer)(v) + var dst CellRendererer // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gtk.CellRendererer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(CellRendererer) + return ok + }) + rv, ok := casted.(CellRendererer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.CellRendererer") + } + dst = rv + } + _list = append(_list, dst) + }) + + return _list +} + +// PackEnd adds the cell to the end of cell_layout. If expand is FALSE, then the +// cell is allocated no more space than it needs. Any unused space is divided +// evenly between cells for which expand is TRUE. +// +// Note that reusing the same cell renderer is not supported. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer. +// - expand: TRUE if cell is to be given extra space allocated to cell_layout. +func (cellLayout *CellLayout) PackEnd(cell CellRendererer, expand bool) { + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + if expand { + _arg2 = C.TRUE + } + + C.gtk_cell_layout_pack_end(_arg0, _arg1, _arg2) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(expand) +} + +// PackStart packs the cell into the beginning of cell_layout. If expand is +// FALSE, then the cell is allocated no more space than it needs. Any unused +// space is divided evenly between cells for which expand is TRUE. +// +// Note that reusing the same cell renderer is not supported. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer. +// - expand: TRUE if cell is to be given extra space allocated to cell_layout. +func (cellLayout *CellLayout) PackStart(cell CellRendererer, expand bool) { + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + if expand { + _arg2 = C.TRUE + } + + C.gtk_cell_layout_pack_start(_arg0, _arg1, _arg2) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(expand) +} + +// Reorder re-inserts cell at position. +// +// Note that cell has already to be packed into cell_layout for this to function +// properly. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer to reorder. +// - position: new position to insert cell at. +func (cellLayout *CellLayout) Reorder(cell CellRendererer, position int) { + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 C.int // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + _arg2 = C.int(position) + + C.gtk_cell_layout_reorder(_arg0, _arg1, _arg2) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(position) +} + +// SetCellDataFunc sets the GtkCellLayoutDataFunc to use for cell_layout. +// +// This function is used instead of the standard attributes mapping for setting +// the column value, and should set the value of cell_layout’s cell renderer(s) +// as appropriate. +// +// func may be NULL to remove a previously set function. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer. +// - fn (optional): GtkCellLayoutDataFunc to use. +func (cellLayout *CellLayout) SetCellDataFunc(cell CellRendererer, fn CellLayoutDataFunc) { + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 C.GtkCellLayoutDataFunc // out + var _arg3 C.gpointer + var _arg4 C.GDestroyNotify + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + if fn != nil { + _arg2 = (*[0]byte)(C._gotk4_gtk4_CellLayoutDataFunc) + _arg3 = C.gpointer(gbox.Assign(fn)) + _arg4 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + } + + C.gtk_cell_layout_set_cell_data_func(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(fn) +} + +// addAttribute adds an attribute mapping to the list in cell_layout. +// +// The column is the column of the model to get a value from, and the attribute +// is the property on cell to be set from that value. So for example if column +// 2 of the model contains strings, you could have the “text” attribute of a +// GtkCellRendererText get its values from column 2. In this context "attribute" +// and "property" are used interchangeably. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer. +// - attribute: property on the renderer. +// - column position on the model to get the attribute from. +func (cellLayout *CellLayout) addAttribute(cell CellRendererer, attribute string, column int) { + gclass := (*C.GtkCellLayoutIface)(coreglib.PeekParentClass(cellLayout)) + fnarg := gclass.add_attribute + + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 *C.char // out + var _arg3 C.int // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(attribute))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = C.int(column) + + C._gotk4_gtk4_CellLayout_virtual_add_attribute(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(attribute) + runtime.KeepAlive(column) +} + +// Clear unsets all the mappings on all renderers on cell_layout and removes all +// renderers from cell_layout. +// +// Deprecated: since version 4.10. +func (cellLayout *CellLayout) clear() { + gclass := (*C.GtkCellLayoutIface)(coreglib.PeekParentClass(cellLayout)) + fnarg := gclass.clear + + var _arg0 *C.GtkCellLayout // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + + C._gotk4_gtk4_CellLayout_virtual_clear(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(cellLayout) +} + +// clearAttributes clears all existing attributes previously set with +// gtk_cell_layout_set_attributes(). +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer to clear the attribute mapping on. +func (cellLayout *CellLayout) clearAttributes(cell CellRendererer) { + gclass := (*C.GtkCellLayoutIface)(coreglib.PeekParentClass(cellLayout)) + fnarg := gclass.clear_attributes + + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + + C._gotk4_gtk4_CellLayout_virtual_clear_attributes(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) +} + +// Area returns the underlying GtkCellArea which might be cell_layout if called +// on a GtkCellArea or might be NULL if no GtkCellArea is used by cell_layout. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - cellArea (optional): cell area used by cell_layout. +func (cellLayout *CellLayout) area() CellAreaer { + gclass := (*C.GtkCellLayoutIface)(coreglib.PeekParentClass(cellLayout)) + fnarg := gclass.get_area + + var _arg0 *C.GtkCellLayout // out + var _cret *C.GtkCellArea // in + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + + _cret = C._gotk4_gtk4_CellLayout_virtual_get_area(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(cellLayout) + + var _cellArea CellAreaer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(CellAreaer) + return ok + }) + rv, ok := casted.(CellAreaer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.CellAreaer") + } + _cellArea = rv + } + } + + return _cellArea +} + +// Cells returns the cell renderers which have been added to cell_layout. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - list: a list of cell renderers. The list, but not the renderers has been +// newly allocated and should be freed with g_list_free() when no longer +// needed. +func (cellLayout *CellLayout) cells() []CellRendererer { + gclass := (*C.GtkCellLayoutIface)(coreglib.PeekParentClass(cellLayout)) + fnarg := gclass.get_cells + + var _arg0 *C.GtkCellLayout // out + var _cret *C.GList // in + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + + _cret = C._gotk4_gtk4_CellLayout_virtual_get_cells(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(cellLayout) + + var _list []CellRendererer // out + + _list = make([]CellRendererer, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), true, func(v unsafe.Pointer) { + src := (*C.GtkCellRenderer)(v) + var dst CellRendererer // out + { + objptr := unsafe.Pointer(src) + if objptr == nil { + panic("object of type gtk.CellRendererer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(CellRendererer) + return ok + }) + rv, ok := casted.(CellRendererer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.CellRendererer") + } + dst = rv + } + _list = append(_list, dst) + }) + + return _list +} + +// packEnd adds the cell to the end of cell_layout. If expand is FALSE, then the +// cell is allocated no more space than it needs. Any unused space is divided +// evenly between cells for which expand is TRUE. +// +// Note that reusing the same cell renderer is not supported. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer. +// - expand: TRUE if cell is to be given extra space allocated to cell_layout. +func (cellLayout *CellLayout) packEnd(cell CellRendererer, expand bool) { + gclass := (*C.GtkCellLayoutIface)(coreglib.PeekParentClass(cellLayout)) + fnarg := gclass.pack_end + + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + if expand { + _arg2 = C.TRUE + } + + C._gotk4_gtk4_CellLayout_virtual_pack_end(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(expand) +} + +// packStart packs the cell into the beginning of cell_layout. If expand is +// FALSE, then the cell is allocated no more space than it needs. Any unused +// space is divided evenly between cells for which expand is TRUE. +// +// Note that reusing the same cell renderer is not supported. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer. +// - expand: TRUE if cell is to be given extra space allocated to cell_layout. +func (cellLayout *CellLayout) packStart(cell CellRendererer, expand bool) { + gclass := (*C.GtkCellLayoutIface)(coreglib.PeekParentClass(cellLayout)) + fnarg := gclass.pack_start + + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + if expand { + _arg2 = C.TRUE + } + + C._gotk4_gtk4_CellLayout_virtual_pack_start(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(expand) +} + +// Reorder re-inserts cell at position. +// +// Note that cell has already to be packed into cell_layout for this to function +// properly. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer to reorder. +// - position: new position to insert cell at. +func (cellLayout *CellLayout) reorder(cell CellRendererer, position int) { + gclass := (*C.GtkCellLayoutIface)(coreglib.PeekParentClass(cellLayout)) + fnarg := gclass.reorder + + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 C.int // out + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + _arg2 = C.int(position) + + C._gotk4_gtk4_CellLayout_virtual_reorder(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(position) +} + +// setCellDataFunc sets the GtkCellLayoutDataFunc to use for cell_layout. +// +// This function is used instead of the standard attributes mapping for setting +// the column value, and should set the value of cell_layout’s cell renderer(s) +// as appropriate. +// +// func may be NULL to remove a previously set function. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - cell: GtkCellRenderer. +// - fn (optional): GtkCellLayoutDataFunc to use. +func (cellLayout *CellLayout) setCellDataFunc(cell CellRendererer, fn CellLayoutDataFunc) { + gclass := (*C.GtkCellLayoutIface)(coreglib.PeekParentClass(cellLayout)) + fnarg := gclass.set_cell_data_func + + var _arg0 *C.GtkCellLayout // out + var _arg1 *C.GtkCellRenderer // out + var _arg2 C.GtkCellLayoutDataFunc // out + var _arg3 C.gpointer + var _arg4 C.GDestroyNotify + + _arg0 = (*C.GtkCellLayout)(unsafe.Pointer(coreglib.InternObject(cellLayout).Native())) + _arg1 = (*C.GtkCellRenderer)(unsafe.Pointer(coreglib.InternObject(cell).Native())) + if fn != nil { + _arg2 = (*[0]byte)(C._gotk4_gtk4_CellLayoutDataFunc) + _arg3 = C.gpointer(gbox.Assign(fn)) + _arg4 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + } + + C._gotk4_gtk4_CellLayout_virtual_set_cell_data_func(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(cellLayout) + runtime.KeepAlive(cell) + runtime.KeepAlive(fn) +} + +// ColorChooser: GtkColorChooser is an interface that is implemented by widgets +// for choosing colors. +// +// Depending on the situation, colors may be allowed to have alpha +// (translucency). +// +// In GTK, the main widgets that implement this interface are +// gtk.ColorChooserWidget, gtk.ColorChooserDialog and gtk.ColorButton. +// +// Deprecated: Use gtk.ColorDialog and gtk.ColorDialogButton instead of widgets +// implementing GtkColorChooser. +// +// ColorChooser wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type ColorChooser struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ColorChooser)(nil) +) + +// ColorChooserer describes ColorChooser's interface methods. +type ColorChooserer interface { + coreglib.Objector + + // AddPalette adds a palette to the color chooser. + AddPalette(orientation Orientation, colorsPerLine int, colors []gdk.RGBA) + // RGBA gets the currently-selected color. + RGBA() *gdk.RGBA + // UseAlpha returns whether the color chooser shows the alpha channel. + UseAlpha() bool + // SetRGBA sets the color. + SetRGBA(color *gdk.RGBA) + // SetUseAlpha sets whether or not the color chooser should use the alpha + // channel. + SetUseAlpha(useAlpha bool) + + // Color-activated is emitted when a color is activated from the color + // chooser. + ConnectColorActivated(func(color *gdk.RGBA)) coreglib.SignalHandle +} + +var _ ColorChooserer = (*ColorChooser)(nil) + +func wrapColorChooser(obj *coreglib.Object) *ColorChooser { + return &ColorChooser{ + Object: obj, + } +} + +func marshalColorChooser(p uintptr) (interface{}, error) { + return wrapColorChooser(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectColorActivated is emitted when a color is activated from the color +// chooser. +// +// This usually happens when the user clicks a color swatch, or a color is +// selected and the user presses one of the keys Space, Shift+Space, Return or +// Enter. +func (chooser *ColorChooser) ConnectColorActivated(f func(color *gdk.RGBA)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(chooser, "color-activated", false, unsafe.Pointer(C._gotk4_gtk4_ColorChooser_ConnectColorActivated), f) +} + +// AddPalette adds a palette to the color chooser. +// +// If orientation is horizontal, the colors are grouped in rows, with +// colors_per_line colors in each row. If horizontal is FALSE, the colors are +// grouped in columns instead. +// +// The default color palette of gtk.ColorChooserWidget has 45 colors, organized +// in columns of 5 colors (this includes some grays). +// +// The layout of the color chooser widget works best when the palettes have 9-10 +// columns. +// +// Calling this function for the first time has the side effect of removing the +// default color palette from the color chooser. +// +// If colors is NULL, removes all previously added palettes. +// +// Deprecated: Use gtk.ColorDialog instead. +// +// The function takes the following parameters: +// +// - orientation: GTK_ORIENTATION_HORIZONTAL if the palette should be +// displayed in rows, GTK_ORIENTATION_VERTICAL for columns. +// - colorsPerLine: number of colors to show in each row/column. +// - colors (optional) of the palette. +func (chooser *ColorChooser) AddPalette(orientation Orientation, colorsPerLine int, colors []gdk.RGBA) { + var _arg0 *C.GtkColorChooser // out + var _arg1 C.GtkOrientation // out + var _arg2 C.int // out + var _arg4 *C.GdkRGBA // out + var _arg3 C.int + + _arg0 = (*C.GtkColorChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = C.GtkOrientation(orientation) + _arg2 = C.int(colorsPerLine) + _arg3 = (C.int)(len(colors)) + _arg4 = (*C.GdkRGBA)(C.calloc(C.size_t(len(colors)), C.size_t(C.sizeof_GdkRGBA))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((*C.GdkRGBA)(_arg4), len(colors)) + for i := range colors { + out[i] = *(*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer((&colors[i])))) + } + } + + C.gtk_color_chooser_add_palette(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(chooser) + runtime.KeepAlive(orientation) + runtime.KeepAlive(colorsPerLine) + runtime.KeepAlive(colors) +} + +// RGBA gets the currently-selected color. +// +// Deprecated: Use gtk.ColorDialog instead. +// +// The function returns the following values: +// +// - color: GdkRGBA to fill in with the current color. +func (chooser *ColorChooser) RGBA() *gdk.RGBA { + var _arg0 *C.GtkColorChooser // out + var _arg1 C.GdkRGBA // in + + _arg0 = (*C.GtkColorChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + C.gtk_color_chooser_get_rgba(_arg0, &_arg1) + runtime.KeepAlive(chooser) + + var _color *gdk.RGBA // out + + _color = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _color +} + +// UseAlpha returns whether the color chooser shows the alpha channel. +// +// Deprecated: Use gtk.ColorDialog instead. +// +// The function returns the following values: +// +// - ok: TRUE if the color chooser uses the alpha channel, FALSE if not. +func (chooser *ColorChooser) UseAlpha() bool { + var _arg0 *C.GtkColorChooser // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkColorChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_color_chooser_get_use_alpha(_arg0) + runtime.KeepAlive(chooser) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetRGBA sets the color. +// +// Deprecated: Use gtk.ColorDialog instead. +// +// The function takes the following parameters: +// +// - color: new color. +func (chooser *ColorChooser) SetRGBA(color *gdk.RGBA) { + var _arg0 *C.GtkColorChooser // out + var _arg1 *C.GdkRGBA // out + + _arg0 = (*C.GtkColorChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(color))) + + C.gtk_color_chooser_set_rgba(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(color) +} + +// SetUseAlpha sets whether or not the color chooser should use the alpha +// channel. +// +// Deprecated: Use gtk.ColorDialog instead. +// +// The function takes the following parameters: +// +// - useAlpha: TRUE if color chooser should use alpha channel, FALSE if not. +func (chooser *ColorChooser) SetUseAlpha(useAlpha bool) { + var _arg0 *C.GtkColorChooser // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkColorChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + if useAlpha { + _arg1 = C.TRUE + } + + C.gtk_color_chooser_set_use_alpha(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(useAlpha) +} + +// addPalette adds a palette to the color chooser. +// +// If orientation is horizontal, the colors are grouped in rows, with +// colors_per_line colors in each row. If horizontal is FALSE, the colors are +// grouped in columns instead. +// +// The default color palette of gtk.ColorChooserWidget has 45 colors, organized +// in columns of 5 colors (this includes some grays). +// +// The layout of the color chooser widget works best when the palettes have 9-10 +// columns. +// +// Calling this function for the first time has the side effect of removing the +// default color palette from the color chooser. +// +// If colors is NULL, removes all previously added palettes. +// +// Deprecated: Use gtk.ColorDialog instead. +// +// The function takes the following parameters: +// +// - orientation: GTK_ORIENTATION_HORIZONTAL if the palette should be +// displayed in rows, GTK_ORIENTATION_VERTICAL for columns. +// - colorsPerLine: number of colors to show in each row/column. +// - colors (optional) of the palette. +func (chooser *ColorChooser) addPalette(orientation Orientation, colorsPerLine int, colors []gdk.RGBA) { + gclass := (*C.GtkColorChooserInterface)(coreglib.PeekParentClass(chooser)) + fnarg := gclass.add_palette + + var _arg0 *C.GtkColorChooser // out + var _arg1 C.GtkOrientation // out + var _arg2 C.int // out + var _arg4 *C.GdkRGBA // out + var _arg3 C.int + + _arg0 = (*C.GtkColorChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = C.GtkOrientation(orientation) + _arg2 = C.int(colorsPerLine) + _arg3 = (C.int)(len(colors)) + _arg4 = (*C.GdkRGBA)(C.calloc(C.size_t(len(colors)), C.size_t(C.sizeof_GdkRGBA))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((*C.GdkRGBA)(_arg4), len(colors)) + for i := range colors { + out[i] = *(*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer((&colors[i])))) + } + } + + C._gotk4_gtk4_ColorChooser_virtual_add_palette(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(chooser) + runtime.KeepAlive(orientation) + runtime.KeepAlive(colorsPerLine) + runtime.KeepAlive(colors) +} + +func (chooser *ColorChooser) colorActivated(color *gdk.RGBA) { + gclass := (*C.GtkColorChooserInterface)(coreglib.PeekParentClass(chooser)) + fnarg := gclass.color_activated + + var _arg0 *C.GtkColorChooser // out + var _arg1 *C.GdkRGBA // out + + _arg0 = (*C.GtkColorChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(color))) + + C._gotk4_gtk4_ColorChooser_virtual_color_activated(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(color) +} + +// rgbA gets the currently-selected color. +// +// Deprecated: Use gtk.ColorDialog instead. +// +// The function returns the following values: +// +// - color: GdkRGBA to fill in with the current color. +func (chooser *ColorChooser) rgbA() *gdk.RGBA { + gclass := (*C.GtkColorChooserInterface)(coreglib.PeekParentClass(chooser)) + fnarg := gclass.get_rgba + + var _arg0 *C.GtkColorChooser // out + var _arg1 C.GdkRGBA // in + + _arg0 = (*C.GtkColorChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + C._gotk4_gtk4_ColorChooser_virtual_get_rgba(unsafe.Pointer(fnarg), _arg0, &_arg1) + runtime.KeepAlive(chooser) + + var _color *gdk.RGBA // out + + _color = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + + return _color +} + +// setRGBA sets the color. +// +// Deprecated: Use gtk.ColorDialog instead. +// +// The function takes the following parameters: +// +// - color: new color. +func (chooser *ColorChooser) setRGBA(color *gdk.RGBA) { + gclass := (*C.GtkColorChooserInterface)(coreglib.PeekParentClass(chooser)) + fnarg := gclass.set_rgba + + var _arg0 *C.GtkColorChooser // out + var _arg1 *C.GdkRGBA // out + + _arg0 = (*C.GtkColorChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer(color))) + + C._gotk4_gtk4_ColorChooser_virtual_set_rgba(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(color) +} + +// ConstraintTarget: GtkConstraintTarget interface is implemented by objects +// that can be used as source or target in GtkConstraints. +// +// Besides GtkWidget, it is also implemented by GtkConstraintGuide. +// +// ConstraintTarget wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type ConstraintTarget struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ConstraintTarget)(nil) +) + +// ConstraintTargetter describes ConstraintTarget's interface methods. +type ConstraintTargetter interface { + coreglib.Objector + + baseConstraintTarget() *ConstraintTarget +} + +var _ ConstraintTargetter = (*ConstraintTarget)(nil) + +func wrapConstraintTarget(obj *coreglib.Object) *ConstraintTarget { + return &ConstraintTarget{ + Object: obj, + } +} + +func marshalConstraintTarget(p uintptr) (interface{}, error) { + return wrapConstraintTarget(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *ConstraintTarget) baseConstraintTarget() *ConstraintTarget { + return v +} + +// BaseConstraintTarget returns the underlying base object. +func BaseConstraintTarget(obj ConstraintTargetter) *ConstraintTarget { + return obj.baseConstraintTarget() +} + +// EditableTextWidget: GtkEditable is an interface for text editing widgets. +// +// Typical examples of editable widgets are gtk.Entry and gtk.SpinButton. +// It contains functions for generically manipulating an editable widget, +// a large number of action signals used for key bindings, and several signals +// that an application can connect to modify the behavior of a widget. +// +// As an example of the latter usage, by connecting the following handler to +// gtk.Editable::insert-text, an application can convert all entry into a widget +// into uppercase. +// +// Forcing entry to uppercase. +// +// #include +// +// void +// insert_text_handler (GtkEditable *editable, +// const char *text, +// int length, +// int *position, +// gpointer data) +// { +// char *result = g_utf8_strup (text, length); +// +// g_signal_handlers_block_by_func (editable, +// (gpointer) insert_text_handler, data); +// gtk_editable_insert_text (editable, result, length, position); +// g_signal_handlers_unblock_by_func (editable, +// (gpointer) insert_text_handler, data); +// +// g_signal_stop_emission_by_name (editable, "insert_text"); +// +// g_free (result); +// } +// +// # Implementing GtkEditable +// +// The most likely scenario for implementing GtkEditable on your own widget is +// that you will embed a GtkText inside a complex widget, and want to delegate +// the editable functionality to that text widget. GtkEditable provides some +// utility functions to make this easy. +// +// In your class_init function, call gtk.Editable().InstallProperties, passing +// the first available property ID: +// +// static void +// my_class_init (MyClass *class) +// { +// ... +// g_object_class_install_properties (object_class, NUM_PROPERTIES, props); +// gtk_editable_install_properties (object_clas, NUM_PROPERTIES); +// ... +// } +// +// In your interface_init function for the GtkEditable interface, provide an +// implementation for the get_delegate vfunc that returns your text widget: +// +// GtkEditable * +// get_editable_delegate (GtkEditable *editable) +// { +// return GTK_EDITABLE (MY_WIDGET (editable)->text_widget); +// } +// +// static void +// my_editable_init (GtkEditableInterface *iface) +// { +// iface->get_delegate = get_editable_delegate; +// } +// +// You don't need to provide any other vfuncs. The default implementations work +// by forwarding to the delegate that the GtkEditableInterface.get_delegate() +// vfunc returns. +// +// In your instance_init function, create your text widget, and then call +// gtk.Editable.InitDelegate(): +// +// static void +// my_widget_init (MyWidget *self) +// { +// ... +// self->text_widget = gtk_text_new (); +// gtk_editable_init_delegate (GTK_EDITABLE (self)); +// ... +// } +// +// In your dispose function, call gtk.Editable.FinishDelegate() before +// destroying your text widget: +// +// static void +// my_widget_dispose (GObject *object) +// { +// ... +// gtk_editable_finish_delegate (GTK_EDITABLE (self)); +// g_clear_pointer (&self->text_widget, gtk_widget_unparent); +// ... +// } +// +// Finally, use gtk.Editable().DelegateSetProperty in your set_property function +// (and similar for get_property), to set the editable properties: +// +// ... +// if (gtk_editable_delegate_set_property (object, prop_id, value, pspec)) +// return; +// +// switch (prop_id) +// ... +// +// It is important to note that if you create a GtkEditable that +// uses a delegate, the low level gtk.Editable::insert-text and +// gtk.Editable::delete-text signals will be propagated from the "wrapper" +// editable to the delegate, but they will not be propagated from the +// delegate to the "wrapper" editable, as they would cause an infinite +// recursion. If you wish to connect to the gtk.Editable::insert-text and +// gtk.Editable::delete-text signals, you will need to connect to them on the +// delegate obtained via gtk.Editable.GetDelegate(). +// +// This type has been renamed from Editable. +// +// EditableTextWidget wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type EditableTextWidget struct { + _ [0]func() // equal guard + Widget +} + +var ( + _ Widgetter = (*EditableTextWidget)(nil) +) + +// EditableTextWidgetter describes EditableTextWidget's interface methods. +type EditableTextWidgetter interface { + coreglib.Objector + + // DelegateGetAccessiblePlatformState retrieves the accessible platform + // state from the editable delegate. + DelegateGetAccessiblePlatformState(state AccessiblePlatformState) bool + // DeleteSelection deletes the currently selected text of the editable. + DeleteSelection() + // DeleteText deletes a sequence of characters. + DeleteText(startPos, endPos int) + // FinishDelegate undoes the setup done by gtk.Editable.InitDelegate(). + FinishDelegate() + // Alignment gets the alignment of the editable. + Alignment() float32 + // Chars retrieves a sequence of characters. + Chars(startPos, endPos int) string + // Delegate gets the GtkEditable that editable is delegating its + // implementation to. + Delegate() *EditableTextWidget + // Editable retrieves whether editable is editable. + Editable() bool + // EnableUndo gets if undo/redo actions are enabled for editable. + EnableUndo() bool + // MaxWidthChars retrieves the desired maximum width of editable, + // in characters. + MaxWidthChars() int + // Position retrieves the current position of the cursor relative to the + // start of the content of the editable. + Position() int + // SelectionBounds retrieves the selection bound of the editable. + SelectionBounds() (startPos, endPos int, ok bool) + // Text retrieves the contents of editable. + Text() string + // WidthChars gets the number of characters of space reserved for the + // contents of the editable. + WidthChars() int + // InitDelegate sets up a delegate for GtkEditable. + InitDelegate() + // SelectRegion selects a region of text. + SelectRegion(startPos, endPos int) + // SetAlignment sets the alignment for the contents of the editable. + SetAlignment(xalign float32) + // SetEditable determines if the user can edit the text in the editable + // widget. + SetEditable(isEditable bool) + // SetEnableUndo: if enabled, changes to editable will be saved for + // undo/redo actions. + SetEnableUndo(enableUndo bool) + // SetMaxWidthChars sets the desired maximum width in characters of + // editable. + SetMaxWidthChars(nChars int) + // SetPosition sets the cursor position in the editable to the given value. + SetPosition(position int) + // SetText sets the text in the editable to the given value. + SetText(text string) + // SetWidthChars changes the size request of the editable to be about the + // right size for n_chars characters. + SetWidthChars(nChars int) + + // Changed is emitted at the end of a single user-visible operation on the + // contents. + ConnectChanged(func()) coreglib.SignalHandle + // Delete-text is emitted when text is deleted from the widget by the user. + ConnectDeleteText(func(startPos, endPos int)) coreglib.SignalHandle +} + +var _ EditableTextWidgetter = (*EditableTextWidget)(nil) + +func wrapEditableTextWidget(obj *coreglib.Object) *EditableTextWidget { + return &EditableTextWidget{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + } +} + +func marshalEditableTextWidget(p uintptr) (interface{}, error) { + return wrapEditableTextWidget(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectChanged is emitted at the end of a single user-visible operation on +// the contents. +// +// E.g., a paste operation that replaces the contents of the selection will +// cause only one signal emission (even though it is implemented by first +// deleting the selection, then inserting the new content, and may cause +// multiple ::notify::text signals to be emitted). +func (editable *EditableTextWidget) ConnectChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(editable, "changed", false, unsafe.Pointer(C._gotk4_gtk4_EditableTextWidget_ConnectChanged), f) +} + +// ConnectDeleteText is emitted when text is deleted from the widget by the +// user. +// +// The default handler for this signal will normally be responsible for deleting +// the text, so by connecting to this signal and then stopping the signal with +// g_signal_stop_emission(), it is possible to modify the range of deleted text, +// or prevent it from being deleted entirely. +// +// The start_pos and end_pos parameters are interpreted as for +// gtk.Editable.DeleteText(). +func (editable *EditableTextWidget) ConnectDeleteText(f func(startPos, endPos int)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(editable, "delete-text", false, unsafe.Pointer(C._gotk4_gtk4_EditableTextWidget_ConnectDeleteText), f) +} + +// DelegateGetAccessiblePlatformState retrieves the accessible platform state +// from the editable delegate. +// +// This is an helper function to retrieve the accessible state for GtkEditable +// interface implementations using a delegate pattern. +// +// You should call this function in your editable widget implementation of the +// gtk.Accessible.GetPlatformState() virtual function, for instance: +// +// static void +// accessible_interface_init (GtkAccessibleInterface *iface) +// { +// iface->get_platform_state = your_editable_get_accessible_platform_state; +// } +// +// static gboolean +// your_editable_get_accessible_platform_state (GtkAccessible *accessible, +// GtkAccessiblePlatformState state) +// { +// return gtk_editable_delegate_get_accessible_platform_state (GTK_EDITABLE (accessible), state); +// }. +// +// The function takes the following parameters: +// +// - state: what kind of accessible state to retrieve. +func (editable *EditableTextWidget) DelegateGetAccessiblePlatformState(state AccessiblePlatformState) bool { + var _arg0 *C.GtkEditable // out + var _arg1 C.GtkAccessiblePlatformState // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.GtkAccessiblePlatformState(state) + + _cret = C.gtk_editable_delegate_get_accessible_platform_state(_arg0, _arg1) + runtime.KeepAlive(editable) + runtime.KeepAlive(state) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DeleteSelection deletes the currently selected text of the editable. +// +// This call doesn’t do anything if there is no selected text. +func (editable *EditableTextWidget) DeleteSelection() { + var _arg0 *C.GtkEditable // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + C.gtk_editable_delete_selection(_arg0) + runtime.KeepAlive(editable) +} + +// DeleteText deletes a sequence of characters. +// +// The characters that are deleted are those characters at positions from +// start_pos up to, but not including end_pos. If end_pos is negative, then the +// characters deleted are those from start_pos to the end of the text. +// +// Note that the positions are specified in characters, not bytes. +// +// The function takes the following parameters: +// +// - startPos: start position. +// - endPos: end position. +func (editable *EditableTextWidget) DeleteText(startPos, endPos int) { + var _arg0 *C.GtkEditable // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.int(startPos) + _arg2 = C.int(endPos) + + C.gtk_editable_delete_text(_arg0, _arg1, _arg2) + runtime.KeepAlive(editable) + runtime.KeepAlive(startPos) + runtime.KeepAlive(endPos) +} + +// FinishDelegate undoes the setup done by gtk.Editable.InitDelegate(). +// +// This is a helper function that should be called from dispose, before removing +// the delegate object. +func (editable *EditableTextWidget) FinishDelegate() { + var _arg0 *C.GtkEditable // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + C.gtk_editable_finish_delegate(_arg0) + runtime.KeepAlive(editable) +} + +// Alignment gets the alignment of the editable. +// +// The function returns the following values: +// +// - gfloat: alignment. +func (editable *EditableTextWidget) Alignment() float32 { + var _arg0 *C.GtkEditable // out + var _cret C.float // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C.gtk_editable_get_alignment(_arg0) + runtime.KeepAlive(editable) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// Chars retrieves a sequence of characters. +// +// The characters that are retrieved are those characters at positions from +// start_pos up to, but not including end_pos. If end_pos is negative, then the +// characters retrieved are those characters from start_pos to the end of the +// text. +// +// Note that positions are specified in characters, not bytes. +// +// The function takes the following parameters: +// +// - startPos: start of text. +// - endPos: end of text. +// +// The function returns the following values: +// +// - utf8: pointer to the contents of the widget as a string. This string is +// allocated by the GtkEditable implementation and should be freed by the +// caller. +func (editable *EditableTextWidget) Chars(startPos, endPos int) string { + var _arg0 *C.GtkEditable // out + var _arg1 C.int // out + var _arg2 C.int // out + var _cret *C.char // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.int(startPos) + _arg2 = C.int(endPos) + + _cret = C.gtk_editable_get_chars(_arg0, _arg1, _arg2) + runtime.KeepAlive(editable) + runtime.KeepAlive(startPos) + runtime.KeepAlive(endPos) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Delegate gets the GtkEditable that editable is delegating its implementation +// to. +// +// Typically, the delegate is a gtk.Text widget. +// +// The function returns the following values: +// +// - ret (optional): delegate GtkEditable. +func (editable *EditableTextWidget) Delegate() *EditableTextWidget { + var _arg0 *C.GtkEditable // out + var _cret *C.GtkEditable // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C.gtk_editable_get_delegate(_arg0) + runtime.KeepAlive(editable) + + var _ret *EditableTextWidget // out + + if _cret != nil { + _ret = wrapEditableTextWidget(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _ret +} + +// Editable retrieves whether editable is editable. +// +// The function returns the following values: +// +// - ok: TRUE if editable is editable. +func (editable *EditableTextWidget) Editable() bool { + var _arg0 *C.GtkEditable // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C.gtk_editable_get_editable(_arg0) + runtime.KeepAlive(editable) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// EnableUndo gets if undo/redo actions are enabled for editable. +// +// The function returns the following values: +// +// - ok: TRUE if undo is enabled. +func (editable *EditableTextWidget) EnableUndo() bool { + var _arg0 *C.GtkEditable // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C.gtk_editable_get_enable_undo(_arg0) + runtime.KeepAlive(editable) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// MaxWidthChars retrieves the desired maximum width of editable, in characters. +// +// The function returns the following values: +// +// - gint: maximum width of the entry, in characters. +func (editable *EditableTextWidget) MaxWidthChars() int { + var _arg0 *C.GtkEditable // out + var _cret C.int // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C.gtk_editable_get_max_width_chars(_arg0) + runtime.KeepAlive(editable) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Position retrieves the current position of the cursor relative to the start +// of the content of the editable. +// +// Note that this position is in characters, not in bytes. +// +// The function returns the following values: +// +// - gint: cursor position. +func (editable *EditableTextWidget) Position() int { + var _arg0 *C.GtkEditable // out + var _cret C.int // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C.gtk_editable_get_position(_arg0) + runtime.KeepAlive(editable) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// SelectionBounds retrieves the selection bound of the editable. +// +// start_pos will be filled with the start of the selection and end_pos with +// end. If no text was selected both will be identical and FALSE will be +// returned. +// +// Note that positions are specified in characters, not bytes. +// +// The function returns the following values: +// +// - startPos (optional): location to store the starting position. +// - endPos (optional): location to store the end position. +// - ok: TRUE if there is a non-empty selection, FALSE otherwise. +func (editable *EditableTextWidget) SelectionBounds() (startPos, endPos int, ok bool) { + var _arg0 *C.GtkEditable // out + var _arg1 C.int // in + var _arg2 C.int // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C.gtk_editable_get_selection_bounds(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(editable) + + var _startPos int // out + var _endPos int // out + var _ok bool // out + + _startPos = int(_arg1) + _endPos = int(_arg2) + if _cret != 0 { + _ok = true + } + + return _startPos, _endPos, _ok +} + +// Text retrieves the contents of editable. +// +// The returned string is owned by GTK and must not be modified or freed. +// +// The function returns the following values: +// +// - utf8: pointer to the contents of the editable. +func (editable *EditableTextWidget) Text() string { + var _arg0 *C.GtkEditable // out + var _cret *C.char // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C.gtk_editable_get_text(_arg0) + runtime.KeepAlive(editable) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// WidthChars gets the number of characters of space reserved for the contents +// of the editable. +// +// The function returns the following values: +// +// - gint: number of chars to request space for, or negative if unset. +func (editable *EditableTextWidget) WidthChars() int { + var _arg0 *C.GtkEditable // out + var _cret C.int // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C.gtk_editable_get_width_chars(_arg0) + runtime.KeepAlive(editable) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// InitDelegate sets up a delegate for GtkEditable. +// +// This is assuming that the get_delegate vfunc in the GtkEditable interface has +// been set up for the editable's type. +// +// This is a helper function that should be called in instance init, after +// creating the delegate object. +func (editable *EditableTextWidget) InitDelegate() { + var _arg0 *C.GtkEditable // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + C.gtk_editable_init_delegate(_arg0) + runtime.KeepAlive(editable) +} + +// SelectRegion selects a region of text. +// +// The characters that are selected are those characters at positions from +// start_pos up to, but not including end_pos. If end_pos is negative, then the +// characters selected are those characters from start_pos to the end of the +// text. +// +// Note that positions are specified in characters, not bytes. +// +// The function takes the following parameters: +// +// - startPos: start of region. +// - endPos: end of region. +func (editable *EditableTextWidget) SelectRegion(startPos, endPos int) { + var _arg0 *C.GtkEditable // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.int(startPos) + _arg2 = C.int(endPos) + + C.gtk_editable_select_region(_arg0, _arg1, _arg2) + runtime.KeepAlive(editable) + runtime.KeepAlive(startPos) + runtime.KeepAlive(endPos) +} + +// SetAlignment sets the alignment for the contents of the editable. +// +// This controls the horizontal positioning of the contents when the displayed +// text is shorter than the width of the editable. +// +// The function takes the following parameters: +// +// - xalign: horizontal alignment, from 0 (left) to 1 (right). Reversed for +// RTL layouts. +func (editable *EditableTextWidget) SetAlignment(xalign float32) { + var _arg0 *C.GtkEditable // out + var _arg1 C.float // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.float(xalign) + + C.gtk_editable_set_alignment(_arg0, _arg1) + runtime.KeepAlive(editable) + runtime.KeepAlive(xalign) +} + +// SetEditable determines if the user can edit the text in the editable widget. +// +// The function takes the following parameters: +// +// - isEditable: TRUE if the user is allowed to edit the text in the widget. +func (editable *EditableTextWidget) SetEditable(isEditable bool) { + var _arg0 *C.GtkEditable // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + if isEditable { + _arg1 = C.TRUE + } + + C.gtk_editable_set_editable(_arg0, _arg1) + runtime.KeepAlive(editable) + runtime.KeepAlive(isEditable) +} + +// SetEnableUndo: if enabled, changes to editable will be saved for undo/redo +// actions. +// +// This results in an additional copy of text changes and are not stored in +// secure memory. As such, undo is forcefully disabled when gtk.Text:visibility +// is set to FALSE. +// +// The function takes the following parameters: +// +// - enableUndo: if undo/redo should be enabled. +func (editable *EditableTextWidget) SetEnableUndo(enableUndo bool) { + var _arg0 *C.GtkEditable // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + if enableUndo { + _arg1 = C.TRUE + } + + C.gtk_editable_set_enable_undo(_arg0, _arg1) + runtime.KeepAlive(editable) + runtime.KeepAlive(enableUndo) +} + +// SetMaxWidthChars sets the desired maximum width in characters of editable. +// +// The function takes the following parameters: +// +// - nChars: new desired maximum width, in characters. +func (editable *EditableTextWidget) SetMaxWidthChars(nChars int) { + var _arg0 *C.GtkEditable // out + var _arg1 C.int // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.int(nChars) + + C.gtk_editable_set_max_width_chars(_arg0, _arg1) + runtime.KeepAlive(editable) + runtime.KeepAlive(nChars) +} + +// SetPosition sets the cursor position in the editable to the given value. +// +// The cursor is displayed before the character with the given (base 0) index +// in the contents of the editable. The value must be less than or equal to +// the number of characters in the editable. A value of -1 indicates that the +// position should be set after the last character of the editable. Note that +// position is in characters, not in bytes. +// +// The function takes the following parameters: +// +// - position of the cursor. +func (editable *EditableTextWidget) SetPosition(position int) { + var _arg0 *C.GtkEditable // out + var _arg1 C.int // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.int(position) + + C.gtk_editable_set_position(_arg0, _arg1) + runtime.KeepAlive(editable) + runtime.KeepAlive(position) +} + +// SetText sets the text in the editable to the given value. +// +// This is replacing the current contents. +// +// The function takes the following parameters: +// +// - text to set. +func (editable *EditableTextWidget) SetText(text string) { + var _arg0 *C.GtkEditable // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(text))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_editable_set_text(_arg0, _arg1) + runtime.KeepAlive(editable) + runtime.KeepAlive(text) +} + +// SetWidthChars changes the size request of the editable to be about the right +// size for n_chars characters. +// +// Note that it changes the size request, the size can still be affected by how +// you pack the widget into containers. If n_chars is -1, the size reverts to +// the default size. +// +// The function takes the following parameters: +// +// - nChars: width in chars. +func (editable *EditableTextWidget) SetWidthChars(nChars int) { + var _arg0 *C.GtkEditable // out + var _arg1 C.int // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.int(nChars) + + C.gtk_editable_set_width_chars(_arg0, _arg1) + runtime.KeepAlive(editable) + runtime.KeepAlive(nChars) +} + +func (editable *EditableTextWidget) changed() { + gclass := (*C.GtkEditableInterface)(coreglib.PeekParentClass(editable)) + fnarg := gclass.changed + + var _arg0 *C.GtkEditable // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + C._gotk4_gtk4_EditableTextWidget_virtual_changed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(editable) +} + +// deleteText deletes a sequence of characters. +// +// The characters that are deleted are those characters at positions from +// start_pos up to, but not including end_pos. If end_pos is negative, then the +// characters deleted are those from start_pos to the end of the text. +// +// Note that the positions are specified in characters, not bytes. +// +// The function takes the following parameters: +// +// - startPos: start position. +// - endPos: end position. +func (editable *EditableTextWidget) deleteText(startPos, endPos int) { + gclass := (*C.GtkEditableInterface)(coreglib.PeekParentClass(editable)) + fnarg := gclass.delete_text + + var _arg0 *C.GtkEditable // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.int(startPos) + _arg2 = C.int(endPos) + + C._gotk4_gtk4_EditableTextWidget_virtual_delete_text(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(editable) + runtime.KeepAlive(startPos) + runtime.KeepAlive(endPos) +} + +// doDeleteText deletes a sequence of characters. +// +// The characters that are deleted are those characters at positions from +// start_pos up to, but not including end_pos. If end_pos is negative, then the +// characters deleted are those from start_pos to the end of the text. +// +// Note that the positions are specified in characters, not bytes. +// +// The function takes the following parameters: +// +// - startPos: start position. +// - endPos: end position. +func (editable *EditableTextWidget) doDeleteText(startPos, endPos int) { + gclass := (*C.GtkEditableInterface)(coreglib.PeekParentClass(editable)) + fnarg := gclass.do_delete_text + + var _arg0 *C.GtkEditable // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.int(startPos) + _arg2 = C.int(endPos) + + C._gotk4_gtk4_EditableTextWidget_virtual_do_delete_text(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(editable) + runtime.KeepAlive(startPos) + runtime.KeepAlive(endPos) +} + +// Delegate gets the GtkEditable that editable is delegating its implementation +// to. +// +// Typically, the delegate is a gtk.Text widget. +// +// The function returns the following values: +// +// - ret (optional): delegate GtkEditable. +func (editable *EditableTextWidget) delegate() *EditableTextWidget { + gclass := (*C.GtkEditableInterface)(coreglib.PeekParentClass(editable)) + fnarg := gclass.get_delegate + + var _arg0 *C.GtkEditable // out + var _cret *C.GtkEditable // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C._gotk4_gtk4_EditableTextWidget_virtual_get_delegate(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(editable) + + var _ret *EditableTextWidget // out + + if _cret != nil { + _ret = wrapEditableTextWidget(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _ret +} + +// selectionBounds retrieves the selection bound of the editable. +// +// start_pos will be filled with the start of the selection and end_pos with +// end. If no text was selected both will be identical and FALSE will be +// returned. +// +// Note that positions are specified in characters, not bytes. +// +// The function returns the following values: +// +// - startPos (optional): location to store the starting position. +// - endPos (optional): location to store the end position. +// - ok: TRUE if there is a non-empty selection, FALSE otherwise. +func (editable *EditableTextWidget) selectionBounds() (startPos, endPos int, ok bool) { + gclass := (*C.GtkEditableInterface)(coreglib.PeekParentClass(editable)) + fnarg := gclass.get_selection_bounds + + var _arg0 *C.GtkEditable // out + var _arg1 C.int // in + var _arg2 C.int // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C._gotk4_gtk4_EditableTextWidget_virtual_get_selection_bounds(unsafe.Pointer(fnarg), _arg0, &_arg1, &_arg2) + runtime.KeepAlive(editable) + + var _startPos int // out + var _endPos int // out + var _ok bool // out + + _startPos = int(_arg1) + _endPos = int(_arg2) + if _cret != 0 { + _ok = true + } + + return _startPos, _endPos, _ok +} + +// Text retrieves the contents of editable. +// +// The returned string is owned by GTK and must not be modified or freed. +// +// The function returns the following values: +// +// - utf8: pointer to the contents of the editable. +func (editable *EditableTextWidget) text() string { + gclass := (*C.GtkEditableInterface)(coreglib.PeekParentClass(editable)) + fnarg := gclass.get_text + + var _arg0 *C.GtkEditable // out + var _cret *C.char // in + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + + _cret = C._gotk4_gtk4_EditableTextWidget_virtual_get_text(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(editable) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// setSelectionBounds selects a region of text. +// +// The characters that are selected are those characters at positions from +// start_pos up to, but not including end_pos. If end_pos is negative, then the +// characters selected are those characters from start_pos to the end of the +// text. +// +// Note that positions are specified in characters, not bytes. +// +// The function takes the following parameters: +// +// - startPos: start of region. +// - endPos: end of region. +func (editable *EditableTextWidget) setSelectionBounds(startPos, endPos int) { + gclass := (*C.GtkEditableInterface)(coreglib.PeekParentClass(editable)) + fnarg := gclass.set_selection_bounds + + var _arg0 *C.GtkEditable // out + var _arg1 C.int // out + var _arg2 C.int // out + + _arg0 = (*C.GtkEditable)(unsafe.Pointer(coreglib.InternObject(editable).Native())) + _arg1 = C.int(startPos) + _arg2 = C.int(endPos) + + C._gotk4_gtk4_EditableTextWidget_virtual_set_selection_bounds(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(editable) + runtime.KeepAlive(startPos) + runtime.KeepAlive(endPos) +} + +// FileChooser: GtkFileChooser is an interface that can be implemented by file +// selection widgets. +// +// In GTK, the main objects that implement this interface are +// gtk.FileChooserWidget and gtk.FileChooserDialog. +// +// You do not need to write an object that implements the GtkFileChooser +// interface unless you are trying to adapt an existing file selector to expose +// a standard programming interface. +// +// GtkFileChooser allows for shortcuts to various places in the filesystem. +// In the default implementation these are displayed in the left pane. It may be +// a bit confusing at first that these shortcuts come from various sources and +// in various flavours, so lets explain the terminology here: +// +// - Bookmarks: are created by the user, by dragging folders from the right pane +// to the left pane, or by using the “Add”. Bookmarks can be renamed and deleted +// by the user. +// +// - Shortcuts: can be provided by the application. For example, a Paint program +// may want to add a shortcut for a Clipart folder. Shortcuts cannot be modified +// by the user. +// +// - Volumes: are provided by the underlying filesystem abstraction. They are +// the “roots” of the filesystem. +// +// # File Names and Encodings +// +// When the user is finished selecting files in a GtkFileChooser, your program +// can get the selected filenames as GFiles. +// +// # Adding options +// +// You can add extra widgets to a file chooser to provide options that are +// not present in the default design, by using gtk.FileChooser.AddChoice(). +// Each choice has an identifier and a user visible label; additionally, +// each choice can have multiple options. If a choice has no option, it will be +// rendered as a check button with the given label; if a choice has options, +// it will be rendered as a combo box. +// +// Deprecated: Use gtk.FileDialog instead. +// +// FileChooser wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type FileChooser struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*FileChooser)(nil) +) + +// FileChooserer describes FileChooser's interface methods. +type FileChooserer interface { + coreglib.Objector + + // AddChoice adds a 'choice' to the file chooser. + AddChoice(id, label string, options, optionLabels []string) + // AddFilter adds filter to the list of filters that the user can select + // between. + AddFilter(filter *FileFilter) + // AddShortcutFolder adds a folder to be displayed with the shortcut folders + // in a file chooser. + AddShortcutFolder(folder gio.Filer) error + // Action gets the type of operation that the file chooser is performing. + Action() FileChooserAction + // Choice gets the currently selected option in the 'choice' with the given + // ID. + Choice(id string) string + // CreateFolders gets whether file chooser will offer to create new folders. + CreateFolders() bool + // CurrentFolder gets the current folder of chooser as GFile. + CurrentFolder() *gio.File + // CurrentName gets the current name in the file selector, as entered by the + // user. + CurrentName() string + // File gets the GFile for the currently selected file in the file selector. + File() *gio.File + // Files lists all the selected files and subfolders in the current folder + // of chooser as GFile. + Files() *gio.ListModel + // Filter gets the current filter. + Filter() *FileFilter + // Filters gets the current set of user-selectable filters, as a list model. + Filters() *gio.ListModel + // SelectMultiple gets whether multiple files can be selected in the file + // chooser. + SelectMultiple() bool + // ShortcutFolders queries the list of shortcut folders in the file chooser. + ShortcutFolders() *gio.ListModel + // RemoveChoice removes a 'choice' that has been added with + // gtk_file_chooser_add_choice(). + RemoveChoice(id string) + // RemoveFilter removes filter from the list of filters that the user can + // select between. + RemoveFilter(filter *FileFilter) + // RemoveShortcutFolder removes a folder from the shortcut folders in a file + // chooser. + RemoveShortcutFolder(folder gio.Filer) error + // SetAction sets the type of operation that the chooser is performing. + SetAction(action FileChooserAction) + // SetChoice selects an option in a 'choice' that has been added with + // gtk_file_chooser_add_choice(). + SetChoice(id, option string) + // SetCreateFolders sets whether file chooser will offer to create new + // folders. + SetCreateFolders(createFolders bool) + // SetCurrentFolder sets the current folder for chooser from a GFile. + SetCurrentFolder(file gio.Filer) error + // SetCurrentName sets the current name in the file selector, as if entered + // by the user. + SetCurrentName(name string) + // SetFile sets file as the current filename for the file chooser. + SetFile(file gio.Filer) error + // SetFilter sets the current filter. + SetFilter(filter *FileFilter) + // SetSelectMultiple sets whether multiple files can be selected in the file + // chooser. + SetSelectMultiple(selectMultiple bool) +} + +var _ FileChooserer = (*FileChooser)(nil) + +func wrapFileChooser(obj *coreglib.Object) *FileChooser { + return &FileChooser{ + Object: obj, + } +} + +func marshalFileChooser(p uintptr) (interface{}, error) { + return wrapFileChooser(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// AddChoice adds a 'choice' to the file chooser. +// +// This is typically implemented as a combobox or, for boolean choices, +// as a checkbutton. You can select a value using gtk.FileChooser.SetChoice() +// before the dialog is shown, and you can obtain the user-selected value in the +// gtk.Dialog::response signal handler using gtk.FileChooser.GetChoice(). +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - id for the added choice. +// - label: user-visible label for the added choice. +// - options (optional) ids for the options of the choice, or NULL for a +// boolean choice. +// - optionLabels (optional): user-visible labels for the options, must be the +// same length as options. +func (chooser *FileChooser) AddChoice(id, label string, options, optionLabels []string) { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 **C.char // out + var _arg4 **C.char // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(id))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg2)) + { + _arg3 = (**C.char)(C.calloc(C.size_t((len(options) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice(_arg3, len(options)+1) + var zero *C.char + out[len(options)] = zero + for i := range options { + out[i] = (*C.char)(unsafe.Pointer(C.CString(options[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + { + _arg4 = (**C.char)(C.calloc(C.size_t((len(optionLabels) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice(_arg4, len(optionLabels)+1) + var zero *C.char + out[len(optionLabels)] = zero + for i := range optionLabels { + out[i] = (*C.char)(unsafe.Pointer(C.CString(optionLabels[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gtk_file_chooser_add_choice(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(chooser) + runtime.KeepAlive(id) + runtime.KeepAlive(label) + runtime.KeepAlive(options) + runtime.KeepAlive(optionLabels) +} + +// AddFilter adds filter to the list of filters that the user can select +// between. +// +// When a filter is selected, only files that are passed by that filter are +// displayed. +// +// Note that the chooser takes ownership of the filter if it is floating, +// so you have to ref and sink it if you want to keep a reference. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - filter: GtkFileFilter. +func (chooser *FileChooser) AddFilter(filter *FileFilter) { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.GtkFileFilter // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.GtkFileFilter)(unsafe.Pointer(coreglib.InternObject(filter).Native())) + + C.gtk_file_chooser_add_filter(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(filter) +} + +// AddShortcutFolder adds a folder to be displayed with the shortcut folders in +// a file chooser. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - folder: GFile for the folder to add. +func (chooser *FileChooser) AddShortcutFolder(folder gio.Filer) error { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.GFile // out + var _cerr *C.GError // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(folder).Native())) + + C.gtk_file_chooser_add_shortcut_folder(_arg0, _arg1, &_cerr) + runtime.KeepAlive(chooser) + runtime.KeepAlive(folder) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// Action gets the type of operation that the file chooser is performing. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - fileChooserAction: action that the file selector is performing. +func (chooser *FileChooser) Action() FileChooserAction { + var _arg0 *C.GtkFileChooser // out + var _cret C.GtkFileChooserAction // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_action(_arg0) + runtime.KeepAlive(chooser) + + var _fileChooserAction FileChooserAction // out + + _fileChooserAction = FileChooserAction(_cret) + + return _fileChooserAction +} + +// Choice gets the currently selected option in the 'choice' with the given ID. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - id: ID of the choice to get. +// +// The function returns the following values: +// +// - utf8 (optional): ID of the currently selected option. +func (chooser *FileChooser) Choice(id string) string { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.char // out + var _cret *C.char // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(id))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gtk_file_chooser_get_choice(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(id) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// CreateFolders gets whether file chooser will offer to create new folders. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - ok: TRUE if the Create Folder button should be displayed. +func (chooser *FileChooser) CreateFolders() bool { + var _arg0 *C.GtkFileChooser // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_create_folders(_arg0) + runtime.KeepAlive(chooser) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// CurrentFolder gets the current folder of chooser as GFile. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - file (optional): GFile for the current folder. +func (chooser *FileChooser) CurrentFolder() *gio.File { + var _arg0 *C.GtkFileChooser // out + var _cret *C.GFile // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_current_folder(_arg0) + runtime.KeepAlive(chooser) + + var _file *gio.File // out + + if _cret != nil { + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _file = &gio.File{ + Object: obj, + } + } + } + + return _file +} + +// CurrentName gets the current name in the file selector, as entered by the +// user. +// +// This is meant to be used in save dialogs, to get the currently typed filename +// when the file itself does not exist yet. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - utf8 (optional): raw text from the file chooser’s “Name” entry. +// Free with g_free(). Note that this string is not a full pathname or URI; +// it is whatever the contents of the entry are. Note also that this string +// is in UTF-8 encoding, which is not necessarily the system’s encoding for +// filenames. +func (chooser *FileChooser) CurrentName() string { + var _arg0 *C.GtkFileChooser // out + var _cret *C.char // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_current_name(_arg0) + runtime.KeepAlive(chooser) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// File gets the GFile for the currently selected file in the file selector. +// +// If multiple files are selected, one of the files will be returned at random. +// +// If the file chooser is in folder mode, this function returns the selected +// folder. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - file (optional): selected GFile. You own the returned file; use +// g_object_unref() to release it. +func (chooser *FileChooser) File() *gio.File { + var _arg0 *C.GtkFileChooser // out + var _cret *C.GFile // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_file(_arg0) + runtime.KeepAlive(chooser) + + var _file *gio.File // out + + if _cret != nil { + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _file = &gio.File{ + Object: obj, + } + } + } + + return _file +} + +// Files lists all the selected files and subfolders in the current folder of +// chooser as GFile. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - listModel: list model containing a GFile for each selected file +// and subfolder in the current folder. Free the returned list with +// g_object_unref(). +func (chooser *FileChooser) Files() *gio.ListModel { + var _arg0 *C.GtkFileChooser // out + var _cret *C.GListModel // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_files(_arg0) + runtime.KeepAlive(chooser) + + var _listModel *gio.ListModel // out + + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _listModel = &gio.ListModel{ + Object: obj, + } + } + + return _listModel +} + +// Filter gets the current filter. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - fileFilter (optional): current filter. +func (chooser *FileChooser) Filter() *FileFilter { + var _arg0 *C.GtkFileChooser // out + var _cret *C.GtkFileFilter // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_filter(_arg0) + runtime.KeepAlive(chooser) + + var _fileFilter *FileFilter // out + + if _cret != nil { + _fileFilter = wrapFileFilter(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _fileFilter +} + +// Filters gets the current set of user-selectable filters, as a list model. +// +// See gtk.FileChooser.AddFilter() and gtk.FileChooser.RemoveFilter() for +// changing individual filters. +// +// You should not modify the returned list model. Future changes to chooser may +// or may not affect the returned model. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - listModel: GListModel containing the current set of user-selectable +// filters. +func (chooser *FileChooser) Filters() *gio.ListModel { + var _arg0 *C.GtkFileChooser // out + var _cret *C.GListModel // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_filters(_arg0) + runtime.KeepAlive(chooser) + + var _listModel *gio.ListModel // out + + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _listModel = &gio.ListModel{ + Object: obj, + } + } + + return _listModel +} + +// SelectMultiple gets whether multiple files can be selected in the file +// chooser. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - ok: TRUE if multiple files can be selected. +func (chooser *FileChooser) SelectMultiple() bool { + var _arg0 *C.GtkFileChooser // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_select_multiple(_arg0) + runtime.KeepAlive(chooser) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ShortcutFolders queries the list of shortcut folders in the file chooser. +// +// You should not modify the returned list model. Future changes to chooser may +// or may not affect the returned model. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function returns the following values: +// +// - listModel: list model of GFiles. +func (chooser *FileChooser) ShortcutFolders() *gio.ListModel { + var _arg0 *C.GtkFileChooser // out + var _cret *C.GListModel // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + + _cret = C.gtk_file_chooser_get_shortcut_folders(_arg0) + runtime.KeepAlive(chooser) + + var _listModel *gio.ListModel // out + + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _listModel = &gio.ListModel{ + Object: obj, + } + } + + return _listModel +} + +// RemoveChoice removes a 'choice' that has been added with +// gtk_file_chooser_add_choice(). +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - id: ID of the choice to remove. +func (chooser *FileChooser) RemoveChoice(id string) { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(id))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_file_chooser_remove_choice(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(id) +} + +// RemoveFilter removes filter from the list of filters that the user can select +// between. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - filter: GtkFileFilter. +func (chooser *FileChooser) RemoveFilter(filter *FileFilter) { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.GtkFileFilter // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.GtkFileFilter)(unsafe.Pointer(coreglib.InternObject(filter).Native())) + + C.gtk_file_chooser_remove_filter(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(filter) +} + +// RemoveShortcutFolder removes a folder from the shortcut folders in a file +// chooser. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - folder: GFile for the folder to remove. +func (chooser *FileChooser) RemoveShortcutFolder(folder gio.Filer) error { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.GFile // out + var _cerr *C.GError // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(folder).Native())) + + C.gtk_file_chooser_remove_shortcut_folder(_arg0, _arg1, &_cerr) + runtime.KeepAlive(chooser) + runtime.KeepAlive(folder) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetAction sets the type of operation that the chooser is performing. +// +// The user interface is adapted to suit the selected action. +// +// For example, an option to create a new folder might be shown if +// the action is GTK_FILE_CHOOSER_ACTION_SAVE but not if the action is +// GTK_FILE_CHOOSER_ACTION_OPEN. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - action that the file selector is performing. +func (chooser *FileChooser) SetAction(action FileChooserAction) { + var _arg0 *C.GtkFileChooser // out + var _arg1 C.GtkFileChooserAction // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = C.GtkFileChooserAction(action) + + C.gtk_file_chooser_set_action(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(action) +} + +// SetChoice selects an option in a 'choice' that has been added with +// gtk_file_chooser_add_choice(). +// +// For a boolean choice, the possible options are "true" and "false". +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - id: ID of the choice to set. +// - option: ID of the option to select. +func (chooser *FileChooser) SetChoice(id, option string) { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.char // out + var _arg2 *C.char // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(id))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(option))) + defer C.free(unsafe.Pointer(_arg2)) + + C.gtk_file_chooser_set_choice(_arg0, _arg1, _arg2) + runtime.KeepAlive(chooser) + runtime.KeepAlive(id) + runtime.KeepAlive(option) +} + +// SetCreateFolders sets whether file chooser will offer to create new folders. +// +// This is only relevant if the action is not set to be +// GTK_FILE_CHOOSER_ACTION_OPEN. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - createFolders: TRUE if the Create Folder button should be displayed. +func (chooser *FileChooser) SetCreateFolders(createFolders bool) { + var _arg0 *C.GtkFileChooser // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + if createFolders { + _arg1 = C.TRUE + } + + C.gtk_file_chooser_set_create_folders(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(createFolders) +} + +// SetCurrentFolder sets the current folder for chooser from a GFile. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - file (optional): GFile for the new folder. +func (chooser *FileChooser) SetCurrentFolder(file gio.Filer) error { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.GFile // out + var _cerr *C.GError // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + if file != nil { + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + } + + C.gtk_file_chooser_set_current_folder(_arg0, _arg1, &_cerr) + runtime.KeepAlive(chooser) + runtime.KeepAlive(file) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetCurrentName sets the current name in the file selector, as if entered by +// the user. +// +// Note that the name passed in here is a UTF-8 string rather than a filename. +// This function is meant for such uses as a suggested name in a “Save As...” +// dialog. You can pass “Untitled.doc” or a similarly suitable suggestion for +// the name. +// +// If you want to preselect a particular existing file, you should use +// gtk.FileChooser.SetFile() instead. +// +// Please see the documentation for those functions for an example of using +// gtk.FileChooser.SetCurrentName() as well. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - name to use, as a UTF-8 string. +func (chooser *FileChooser) SetCurrentName(name string) { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_file_chooser_set_current_name(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(name) +} + +// SetFile sets file as the current filename for the file chooser. +// +// This includes changing to the file’s parent folder and actually selecting +// the file in list. If the chooser is in GTK_FILE_CHOOSER_ACTION_SAVE mode, +// the file’s base name will also appear in the dialog’s file name entry. +// +// If the file name isn’t in the current folder of chooser, then the current +// folder of chooser will be changed to the folder containing file. +// +// Note that the file must exist, or nothing will be done except for the +// directory change. +// +// If you are implementing a save dialog, you should use this function if you +// already have a file name to which the user may save; for example, when the +// user opens an existing file and then does “Save As…”. If you don’t have a +// file name already — for example, if the user just created a new file and is +// saving it for the first time, do not call this function. +// +// Instead, use something similar to this: +// +// static void +// prepare_file_chooser (GtkFileChooser *chooser, +// GFile *existing_file) +// { +// gboolean document_is_new = (existing_file == NULL); +// +// if (document_is_new) +// { +// GFile *default_file_for_saving = g_file_new_for_path ("./out.txt"); +// // the user just created a new document +// gtk_file_chooser_set_current_folder (chooser, default_file_for_saving, NULL); +// gtk_file_chooser_set_current_name (chooser, "Untitled document"); +// g_object_unref (default_file_for_saving); +// } +// else +// { +// // the user edited an existing document +// gtk_file_chooser_set_file (chooser, existing_file, NULL); +// } +// } +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - file: GFile to set as current. +func (chooser *FileChooser) SetFile(file gio.Filer) error { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.GFile // out + var _cerr *C.GError // in + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + C.gtk_file_chooser_set_file(_arg0, _arg1, &_cerr) + runtime.KeepAlive(chooser) + runtime.KeepAlive(file) + + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr +} + +// SetFilter sets the current filter. +// +// Only the files that pass the filter will be displayed. If the user-selectable +// list of filters is non-empty, then the filter should be one of the filters in +// that list. +// +// Setting the current filter when the list of filters is empty is useful if you +// want to restrict the displayed set of files without letting the user change +// it. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - filter: GtkFileFilter. +func (chooser *FileChooser) SetFilter(filter *FileFilter) { + var _arg0 *C.GtkFileChooser // out + var _arg1 *C.GtkFileFilter // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.GtkFileFilter)(unsafe.Pointer(coreglib.InternObject(filter).Native())) + + C.gtk_file_chooser_set_filter(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(filter) +} + +// SetSelectMultiple sets whether multiple files can be selected in the file +// chooser. +// +// This is only relevant if the action is set to be GTK_FILE_CHOOSER_ACTION_OPEN +// or GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER. +// +// Deprecated: Use gtk.FileDialog instead. +// +// The function takes the following parameters: +// +// - selectMultiple: TRUE if multiple files can be selected. +func (chooser *FileChooser) SetSelectMultiple(selectMultiple bool) { + var _arg0 *C.GtkFileChooser // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkFileChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + if selectMultiple { + _arg1 = C.TRUE + } + + C.gtk_file_chooser_set_select_multiple(_arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(selectMultiple) +} + +// FontChooser: GtkFontChooser is an interface that can be implemented by +// widgets for choosing fonts. +// +// In GTK, the main objects that implement this interface are +// gtk.FontChooserWidget, gtk.FontChooserDialog and gtk.FontButton. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// FontChooser wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type FontChooser struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*FontChooser)(nil) +) + +// FontChooserer describes FontChooser's interface methods. +type FontChooserer interface { + coreglib.Objector + + // Font gets the currently-selected font name. + Font() string + // FontDesc gets the currently-selected font. + FontDesc() *pango.FontDescription + // FontFace gets the PangoFontFace representing the selected font group + // details (i.e. + FontFace() pango.FontFacer + // FontFamily gets the PangoFontFamily representing the selected font + // family. + FontFamily() pango.FontFamilier + // FontFeatures gets the currently-selected font features. + FontFeatures() string + // FontMap gets the custom font map of this font chooser widget, or NULL if + // it does not have one. + FontMap() pango.FontMapper + // FontSize: selected font size. + FontSize() int + // Language gets the language that is used for font features. + Language() string + // Level returns the current level of granularity for selecting fonts. + Level() FontChooserLevel + // PreviewText gets the text displayed in the preview area. + PreviewText() string + // ShowPreviewEntry returns whether the preview entry is shown or not. + ShowPreviewEntry() bool + // SetFilterFunc adds a filter function that decides which fonts to display + // in the font chooser. + SetFilterFunc(filter FontFilterFunc) + // SetFont sets the currently-selected font. + SetFont(fontname string) + // SetFontDesc sets the currently-selected font from font_desc. + SetFontDesc(fontDesc *pango.FontDescription) + // SetFontMap sets a custom font map to use for this font chooser widget. + SetFontMap(fontmap pango.FontMapper) + // SetLanguage sets the language to use for font features. + SetLanguage(language string) + // SetLevel sets the desired level of granularity for selecting fonts. + SetLevel(level FontChooserLevel) + // SetPreviewText sets the text displayed in the preview area. + SetPreviewText(text string) + // SetShowPreviewEntry shows or hides the editable preview entry. + SetShowPreviewEntry(showPreviewEntry bool) + + // Font-activated is emitted when a font is activated. + ConnectFontActivated(func(fontname string)) coreglib.SignalHandle +} + +var _ FontChooserer = (*FontChooser)(nil) + +func wrapFontChooser(obj *coreglib.Object) *FontChooser { + return &FontChooser{ + Object: obj, + } +} + +func marshalFontChooser(p uintptr) (interface{}, error) { + return wrapFontChooser(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectFontActivated is emitted when a font is activated. +// +// This usually happens when the user double clicks an item, or an item is +// selected and the user presses one of the keys Space, Shift+Space, Return or +// Enter. +func (fontchooser *FontChooser) ConnectFontActivated(f func(fontname string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(fontchooser, "font-activated", false, unsafe.Pointer(C._gotk4_gtk4_FontChooser_ConnectFontActivated), f) +} + +// Font gets the currently-selected font name. +// +// Note that this can be a different string than what you set with +// gtk.FontChooser.SetFont(), as the font chooser widget may normalize font +// names and thus return a string with a different structure. For example, +// “Helvetica Italic Bold 12” could be normalized to “Helvetica Bold Italic 12”. +// +// Use pango.FontDescription.Equal() if you want to compare two font +// descriptions. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - utf8 (optional): string with the name of the current font. +func (fontchooser *FontChooser) Font() string { + var _arg0 *C.GtkFontChooser // out + var _cret *C.char // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_font(_arg0) + runtime.KeepAlive(fontchooser) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// FontDesc gets the currently-selected font. +// +// Note that this can be a different string than what you set with +// gtk.FontChooser.SetFont(), as the font chooser widget may normalize font +// names and thus return a string with a different structure. For example, +// “Helvetica Italic Bold 12” could be normalized to “Helvetica Bold Italic 12”. +// +// Use pango.FontDescription.Equal() if you want to compare two font +// descriptions. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - fontDescription (optional): PangoFontDescription for the current font. +func (fontchooser *FontChooser) FontDesc() *pango.FontDescription { + var _arg0 *C.GtkFontChooser // out + var _cret *C.PangoFontDescription // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_font_desc(_arg0) + runtime.KeepAlive(fontchooser) + + var _fontDescription *pango.FontDescription // out + + if _cret != nil { + _fontDescription = (*pango.FontDescription)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_fontDescription)), + func(intern *struct{ C unsafe.Pointer }) { + C.pango_font_description_free((*C.PangoFontDescription)(intern.C)) + }, + ) + } + + return _fontDescription +} + +// FontFace gets the PangoFontFace representing the selected font group details +// (i.e. family, slant, weight, width, etc). +// +// If the selected font is not installed, returns NULL. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - fontFace (optional): PangoFontFace representing the selected font group +// details. +func (fontchooser *FontChooser) FontFace() pango.FontFacer { + var _arg0 *C.GtkFontChooser // out + var _cret *C.PangoFontFace // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_font_face(_arg0) + runtime.KeepAlive(fontchooser) + + var _fontFace pango.FontFacer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(pango.FontFacer) + return ok + }) + rv, ok := casted.(pango.FontFacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching pango.FontFacer") + } + _fontFace = rv + } + } + + return _fontFace +} + +// FontFamily gets the PangoFontFamily representing the selected font family. +// +// Font families are a collection of font faces. +// +// If the selected font is not installed, returns NULL. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - fontFamily (optional): PangoFontFamily representing the selected font +// family. +func (fontchooser *FontChooser) FontFamily() pango.FontFamilier { + var _arg0 *C.GtkFontChooser // out + var _cret *C.PangoFontFamily // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_font_family(_arg0) + runtime.KeepAlive(fontchooser) + + var _fontFamily pango.FontFamilier // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(pango.FontFamilier) + return ok + }) + rv, ok := casted.(pango.FontFamilier) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching pango.FontFamilier") + } + _fontFamily = rv + } + } + + return _fontFamily +} + +// FontFeatures gets the currently-selected font features. +// +// The format of the returned string is compatible +// with the CSS font-feature-settings property +// (https://www.w3.org/TR/css-fonts-4/#font-rend-desc). It can be passed to +// pango.AttrFontFeatures().New. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - utf8: currently selected font features. +func (fontchooser *FontChooser) FontFeatures() string { + var _arg0 *C.GtkFontChooser // out + var _cret *C.char // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_font_features(_arg0) + runtime.KeepAlive(fontchooser) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// FontMap gets the custom font map of this font chooser widget, or NULL if it +// does not have one. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - fontMap (optional): PangoFontMap. +func (fontchooser *FontChooser) FontMap() pango.FontMapper { + var _arg0 *C.GtkFontChooser // out + var _cret *C.PangoFontMap // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_font_map(_arg0) + runtime.KeepAlive(fontchooser) + + var _fontMap pango.FontMapper // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(pango.FontMapper) + return ok + }) + rv, ok := casted.(pango.FontMapper) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching pango.FontMapper") + } + _fontMap = rv + } + } + + return _fontMap +} + +// FontSize: selected font size. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - gint: n integer representing the selected font size, or -1 if no font +// size is selected. +func (fontchooser *FontChooser) FontSize() int { + var _arg0 *C.GtkFontChooser // out + var _cret C.int // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_font_size(_arg0) + runtime.KeepAlive(fontchooser) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Language gets the language that is used for font features. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - utf8: currently selected language. +func (fontchooser *FontChooser) Language() string { + var _arg0 *C.GtkFontChooser // out + var _cret *C.char // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_language(_arg0) + runtime.KeepAlive(fontchooser) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// Level returns the current level of granularity for selecting fonts. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - fontChooserLevel: current granularity level. +func (fontchooser *FontChooser) Level() FontChooserLevel { + var _arg0 *C.GtkFontChooser // out + var _cret C.GtkFontChooserLevel // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_level(_arg0) + runtime.KeepAlive(fontchooser) + + var _fontChooserLevel FontChooserLevel // out + + _fontChooserLevel = FontChooserLevel(_cret) + + return _fontChooserLevel +} + +// PreviewText gets the text displayed in the preview area. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - utf8: text displayed in the preview area. +func (fontchooser *FontChooser) PreviewText() string { + var _arg0 *C.GtkFontChooser // out + var _cret *C.char // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_preview_text(_arg0) + runtime.KeepAlive(fontchooser) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + + return _utf8 +} + +// ShowPreviewEntry returns whether the preview entry is shown or not. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - ok: TRUE if the preview entry is shown or FALSE if it is hidden. +func (fontchooser *FontChooser) ShowPreviewEntry() bool { + var _arg0 *C.GtkFontChooser // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C.gtk_font_chooser_get_show_preview_entry(_arg0) + runtime.KeepAlive(fontchooser) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetFilterFunc adds a filter function that decides which fonts to display in +// the font chooser. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - filter (optional): GtkFontFilterFunc. +func (fontchooser *FontChooser) SetFilterFunc(filter FontFilterFunc) { + var _arg0 *C.GtkFontChooser // out + var _arg1 C.GtkFontFilterFunc // out + var _arg2 C.gpointer + var _arg3 C.GDestroyNotify + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + if filter != nil { + _arg1 = (*[0]byte)(C._gotk4_gtk4_FontFilterFunc) + _arg2 = C.gpointer(gbox.Assign(filter)) + _arg3 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + } + + C.gtk_font_chooser_set_filter_func(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(filter) +} + +// SetFont sets the currently-selected font. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - fontname: font name like “Helvetica 12” or “Times Bold 18”. +func (fontchooser *FontChooser) SetFont(fontname string) { + var _arg0 *C.GtkFontChooser // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(fontname))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_font_chooser_set_font(_arg0, _arg1) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(fontname) +} + +// SetFontDesc sets the currently-selected font from font_desc. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - fontDesc: PangoFontDescription. +func (fontchooser *FontChooser) SetFontDesc(fontDesc *pango.FontDescription) { + var _arg0 *C.GtkFontChooser // out + var _arg1 *C.PangoFontDescription // out + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + _arg1 = (*C.PangoFontDescription)(gextras.StructNative(unsafe.Pointer(fontDesc))) + + C.gtk_font_chooser_set_font_desc(_arg0, _arg1) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(fontDesc) +} + +// SetFontMap sets a custom font map to use for this font chooser widget. +// +// A custom font map can be used to present application-specific fonts instead +// of or in addition to the normal system fonts. +// +// FcConfig *config; +// PangoFontMap *fontmap; +// +// config = FcInitLoadConfigAndFonts (); +// FcConfigAppFontAddFile (config, my_app_font_file); +// +// fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT); +// pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config); +// +// gtk_font_chooser_set_font_map (font_chooser, fontmap); +// +// Note that other GTK widgets will only be able to use the application-specific +// font if it is present in the font map they use: +// +// context = gtk_widget_get_pango_context (label); +// pango_context_set_font_map (context, fontmap); +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - fontmap (optional): PangoFontMap. +func (fontchooser *FontChooser) SetFontMap(fontmap pango.FontMapper) { + var _arg0 *C.GtkFontChooser // out + var _arg1 *C.PangoFontMap // out + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + if fontmap != nil { + _arg1 = (*C.PangoFontMap)(unsafe.Pointer(coreglib.InternObject(fontmap).Native())) + } + + C.gtk_font_chooser_set_font_map(_arg0, _arg1) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(fontmap) +} + +// SetLanguage sets the language to use for font features. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - language: language. +func (fontchooser *FontChooser) SetLanguage(language string) { + var _arg0 *C.GtkFontChooser // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(language))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_font_chooser_set_language(_arg0, _arg1) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(language) +} + +// SetLevel sets the desired level of granularity for selecting fonts. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - level: desired level of granularity. +func (fontchooser *FontChooser) SetLevel(level FontChooserLevel) { + var _arg0 *C.GtkFontChooser // out + var _arg1 C.GtkFontChooserLevel // out + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + _arg1 = C.GtkFontChooserLevel(level) + + C.gtk_font_chooser_set_level(_arg0, _arg1) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(level) +} + +// SetPreviewText sets the text displayed in the preview area. +// +// The text is used to show how the selected font looks. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - text to display in the preview area. +func (fontchooser *FontChooser) SetPreviewText(text string) { + var _arg0 *C.GtkFontChooser // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(text))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_font_chooser_set_preview_text(_arg0, _arg1) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(text) +} + +// SetShowPreviewEntry shows or hides the editable preview entry. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - showPreviewEntry: whether to show the editable preview entry or not. +func (fontchooser *FontChooser) SetShowPreviewEntry(showPreviewEntry bool) { + var _arg0 *C.GtkFontChooser // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + if showPreviewEntry { + _arg1 = C.TRUE + } + + C.gtk_font_chooser_set_show_preview_entry(_arg0, _arg1) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(showPreviewEntry) +} + +func (chooser *FontChooser) fontActivated(fontname string) { + gclass := (*C.GtkFontChooserIface)(coreglib.PeekParentClass(chooser)) + fnarg := gclass.font_activated + + var _arg0 *C.GtkFontChooser // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(chooser).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(fontname))) + defer C.free(unsafe.Pointer(_arg1)) + + C._gotk4_gtk4_FontChooser_virtual_font_activated(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(chooser) + runtime.KeepAlive(fontname) +} + +// fontFace gets the PangoFontFace representing the selected font group details +// (i.e. family, slant, weight, width, etc). +// +// If the selected font is not installed, returns NULL. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - fontFace (optional): PangoFontFace representing the selected font group +// details. +func (fontchooser *FontChooser) fontFace() pango.FontFacer { + gclass := (*C.GtkFontChooserIface)(coreglib.PeekParentClass(fontchooser)) + fnarg := gclass.get_font_face + + var _arg0 *C.GtkFontChooser // out + var _cret *C.PangoFontFace // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C._gotk4_gtk4_FontChooser_virtual_get_font_face(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(fontchooser) + + var _fontFace pango.FontFacer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(pango.FontFacer) + return ok + }) + rv, ok := casted.(pango.FontFacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching pango.FontFacer") + } + _fontFace = rv + } + } + + return _fontFace +} + +// fontFamily gets the PangoFontFamily representing the selected font family. +// +// Font families are a collection of font faces. +// +// If the selected font is not installed, returns NULL. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - fontFamily (optional): PangoFontFamily representing the selected font +// family. +func (fontchooser *FontChooser) fontFamily() pango.FontFamilier { + gclass := (*C.GtkFontChooserIface)(coreglib.PeekParentClass(fontchooser)) + fnarg := gclass.get_font_family + + var _arg0 *C.GtkFontChooser // out + var _cret *C.PangoFontFamily // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C._gotk4_gtk4_FontChooser_virtual_get_font_family(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(fontchooser) + + var _fontFamily pango.FontFamilier // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(pango.FontFamilier) + return ok + }) + rv, ok := casted.(pango.FontFamilier) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching pango.FontFamilier") + } + _fontFamily = rv + } + } + + return _fontFamily +} + +// fontMap gets the custom font map of this font chooser widget, or NULL if it +// does not have one. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - fontMap (optional): PangoFontMap. +func (fontchooser *FontChooser) fontMap() pango.FontMapper { + gclass := (*C.GtkFontChooserIface)(coreglib.PeekParentClass(fontchooser)) + fnarg := gclass.get_font_map + + var _arg0 *C.GtkFontChooser // out + var _cret *C.PangoFontMap // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C._gotk4_gtk4_FontChooser_virtual_get_font_map(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(fontchooser) + + var _fontMap pango.FontMapper // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.AssumeOwnership(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(pango.FontMapper) + return ok + }) + rv, ok := casted.(pango.FontMapper) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching pango.FontMapper") + } + _fontMap = rv + } + } + + return _fontMap +} + +// fontSize: selected font size. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function returns the following values: +// +// - gint: n integer representing the selected font size, or -1 if no font +// size is selected. +func (fontchooser *FontChooser) fontSize() int { + gclass := (*C.GtkFontChooserIface)(coreglib.PeekParentClass(fontchooser)) + fnarg := gclass.get_font_size + + var _arg0 *C.GtkFontChooser // out + var _cret C.int // in + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + + _cret = C._gotk4_gtk4_FontChooser_virtual_get_font_size(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(fontchooser) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// setFilterFunc adds a filter function that decides which fonts to display in +// the font chooser. +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - filter (optional): GtkFontFilterFunc. +func (fontchooser *FontChooser) setFilterFunc(filter FontFilterFunc) { + gclass := (*C.GtkFontChooserIface)(coreglib.PeekParentClass(fontchooser)) + fnarg := gclass.set_filter_func + + var _arg0 *C.GtkFontChooser // out + var _arg1 C.GtkFontFilterFunc // out + var _arg2 C.gpointer + var _arg3 C.GDestroyNotify + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + if filter != nil { + _arg1 = (*[0]byte)(C._gotk4_gtk4_FontFilterFunc) + _arg2 = C.gpointer(gbox.Assign(filter)) + _arg3 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + } + + C._gotk4_gtk4_FontChooser_virtual_set_filter_func(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(filter) +} + +// setFontMap sets a custom font map to use for this font chooser widget. +// +// A custom font map can be used to present application-specific fonts instead +// of or in addition to the normal system fonts. +// +// FcConfig *config; +// PangoFontMap *fontmap; +// +// config = FcInitLoadConfigAndFonts (); +// FcConfigAppFontAddFile (config, my_app_font_file); +// +// fontmap = pango_cairo_font_map_new_for_font_type (CAIRO_FONT_TYPE_FT); +// pango_fc_font_map_set_config (PANGO_FC_FONT_MAP (fontmap), config); +// +// gtk_font_chooser_set_font_map (font_chooser, fontmap); +// +// Note that other GTK widgets will only be able to use the application-specific +// font if it is present in the font map they use: +// +// context = gtk_widget_get_pango_context (label); +// pango_context_set_font_map (context, fontmap); +// +// Deprecated: Use gtk.FontDialog and gtk.FontDialogButton instead. +// +// The function takes the following parameters: +// +// - fontmap (optional): PangoFontMap. +func (fontchooser *FontChooser) setFontMap(fontmap pango.FontMapper) { + gclass := (*C.GtkFontChooserIface)(coreglib.PeekParentClass(fontchooser)) + fnarg := gclass.set_font_map + + var _arg0 *C.GtkFontChooser // out + var _arg1 *C.PangoFontMap // out + + _arg0 = (*C.GtkFontChooser)(unsafe.Pointer(coreglib.InternObject(fontchooser).Native())) + if fontmap != nil { + _arg1 = (*C.PangoFontMap)(unsafe.Pointer(coreglib.InternObject(fontmap).Native())) + } + + C._gotk4_gtk4_FontChooser_virtual_set_font_map(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(fontchooser) + runtime.KeepAlive(fontmap) +} + +// NativeSurface: GtkNative is the interface implemented by all widgets that +// have their own GdkSurface. +// +// The obvious example of a GtkNative is GtkWindow. +// +// Every widget that is not itself a GtkNative is contained in one, and you can +// get it with gtk.Widget.GetNative(). +// +// To get the surface of a GtkNative, use gtk.Native.GetSurface(). +// It is also possible to find the GtkNative to which a surface belongs, +// with gtk.Native().GetForSurface. +// +// In addition to a gdk.Surface, a GtkNative also provides a gsk.Renderer for +// rendering on that surface. To get the renderer, use gtk.Native.GetRenderer(). +// +// This type has been renamed from Native. +// +// NativeSurface wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type NativeSurface struct { + _ [0]func() // equal guard + Widget +} + +var ( + _ Widgetter = (*NativeSurface)(nil) +) + +// NativeSurfacer describes NativeSurface's interface methods. +type NativeSurfacer interface { + coreglib.Objector + + // Renderer returns the renderer that is used for this GtkNative. + Renderer() gsk.Rendererer + // Surface returns the surface of this GtkNative. + Surface() gdk.Surfacer + // SurfaceTransform retrieves the surface transform of self. + SurfaceTransform() (x, y float64) + // Realize realizes a GtkNative. + Realize() + // Unrealize unrealizes a GtkNative. + Unrealize() +} + +var _ NativeSurfacer = (*NativeSurface)(nil) + +func wrapNativeSurface(obj *coreglib.Object) *NativeSurface { + return &NativeSurface{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + } +} + +func marshalNativeSurface(p uintptr) (interface{}, error) { + return wrapNativeSurface(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Renderer returns the renderer that is used for this GtkNative. +// +// The function returns the following values: +// +// - renderer (optional) for self. +func (self *NativeSurface) Renderer() gsk.Rendererer { + var _arg0 *C.GtkNative // out + var _cret *C.GskRenderer // in + + _arg0 = (*C.GtkNative)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_native_get_renderer(_arg0) + runtime.KeepAlive(self) + + var _renderer gsk.Rendererer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gsk.Rendererer) + return ok + }) + rv, ok := casted.(gsk.Rendererer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.Rendererer") + } + _renderer = rv + } + } + + return _renderer +} + +// Surface returns the surface of this GtkNative. +// +// The function returns the following values: +// +// - surface (optional) of self. +func (self *NativeSurface) Surface() gdk.Surfacer { + var _arg0 *C.GtkNative // out + var _cret *C.GdkSurface // in + + _arg0 = (*C.GtkNative)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_native_get_surface(_arg0) + runtime.KeepAlive(self) + + var _surface gdk.Surfacer // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gdk.Surfacer) + return ok + }) + rv, ok := casted.(gdk.Surfacer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + } + _surface = rv + } + } + + return _surface +} + +// SurfaceTransform retrieves the surface transform of self. +// +// This is the translation from self's surface coordinates into self's widget +// coordinates. +// +// The function returns the following values: +// +// - x: return location for the x coordinate. +// - y: return location for the y coordinate. +func (self *NativeSurface) SurfaceTransform() (x, y float64) { + var _arg0 *C.GtkNative // out + var _arg1 C.double // in + var _arg2 C.double // in + + _arg0 = (*C.GtkNative)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.gtk_native_get_surface_transform(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(self) + + var _x float64 // out + var _y float64 // out + + _x = float64(_arg1) + _y = float64(_arg2) + + return _x, _y +} + +// Realize realizes a GtkNative. +// +// This should only be used by subclasses. +func (self *NativeSurface) Realize() { + var _arg0 *C.GtkNative // out + + _arg0 = (*C.GtkNative)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.gtk_native_realize(_arg0) + runtime.KeepAlive(self) +} + +// Unrealize unrealizes a GtkNative. +// +// This should only be used by subclasses. +func (self *NativeSurface) Unrealize() { + var _arg0 *C.GtkNative // out + + _arg0 = (*C.GtkNative)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.gtk_native_unrealize(_arg0) + runtime.KeepAlive(self) +} + +// NativeSurfaceGetForSurface finds the GtkNative associated with the surface. +// +// The function takes the following parameters: +// +// - surface: GdkSurface. +// +// The function returns the following values: +// +// - native (optional): GtkNative that is associated with surface. +func NativeSurfaceGetForSurface(surface gdk.Surfacer) *NativeSurface { + var _arg1 *C.GdkSurface // out + var _cret *C.GtkNative // in + + _arg1 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + + _cret = C.gtk_native_get_for_surface(_arg1) + runtime.KeepAlive(surface) + + var _native *NativeSurface // out + + if _cret != nil { + _native = wrapNativeSurface(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _native +} + +// OrientableOverrider contains methods that are overridable. +type OrientableOverrider interface { +} + +// Orientable: GtkOrientable interface is implemented by all widgets that can be +// oriented horizontally or vertically. +// +// GtkOrientable is more flexible in that it allows the orientation to be +// changed at runtime, allowing the widgets to “flip”. +// +// # CSS nodes +// +// GtkWidget types implementing the GtkOrientable interface will automatically +// acquire the horizontal or vertical CSS class depending on the value of the +// gtk.Orientable:orientation property. +// +// Orientable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Orientable struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Orientable)(nil) +) + +// Orientabler describes Orientable's interface methods. +type Orientabler interface { + coreglib.Objector + + // Orientation retrieves the orientation of the orientable. + Orientation() Orientation + // SetOrientation sets the orientation of the orientable. + SetOrientation(orientation Orientation) +} + +var _ Orientabler = (*Orientable)(nil) + +func ifaceInitOrientabler(gifacePtr, data C.gpointer) { +} + +func wrapOrientable(obj *coreglib.Object) *Orientable { + return &Orientable{ + Object: obj, + } +} + +func marshalOrientable(p uintptr) (interface{}, error) { + return wrapOrientable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Orientation retrieves the orientation of the orientable. +// +// The function returns the following values: +// +// - orientation of the orientable. +func (orientable *Orientable) Orientation() Orientation { + var _arg0 *C.GtkOrientable // out + var _cret C.GtkOrientation // in + + _arg0 = (*C.GtkOrientable)(unsafe.Pointer(coreglib.InternObject(orientable).Native())) + + _cret = C.gtk_orientable_get_orientation(_arg0) + runtime.KeepAlive(orientable) + + var _orientation Orientation // out + + _orientation = Orientation(_cret) + + return _orientation +} + +// SetOrientation sets the orientation of the orientable. +// +// The function takes the following parameters: +// +// - orientation orientable’s new orientation. +func (orientable *Orientable) SetOrientation(orientation Orientation) { + var _arg0 *C.GtkOrientable // out + var _arg1 C.GtkOrientation // out + + _arg0 = (*C.GtkOrientable)(unsafe.Pointer(coreglib.InternObject(orientable).Native())) + _arg1 = C.GtkOrientation(orientation) + + C.gtk_orientable_set_orientation(_arg0, _arg1) + runtime.KeepAlive(orientable) + runtime.KeepAlive(orientation) +} + +// PrintOperationPreview: GtkPrintOperationPreview is the interface that is used +// to implement print preview. +// +// A GtkPrintOperationPreview object is passed to the +// gtk.PrintOperation::preview signal by gtk.PrintOperation. +// +// PrintOperationPreview wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type PrintOperationPreview struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*PrintOperationPreview)(nil) +) + +// PrintOperationPreviewer describes PrintOperationPreview's interface methods. +type PrintOperationPreviewer interface { + coreglib.Objector + + // EndPreview ends a preview. + EndPreview() + // IsSelected returns whether the given page is included in the set of pages + // that have been selected for printing. + IsSelected(pageNr int) bool + // RenderPage renders a page to the preview. + RenderPage(pageNr int) + + // Got-page-size is emitted once for each page that gets rendered to the + // preview. + ConnectGotPageSize(func(context *PrintContext, pageSetup *PageSetup)) coreglib.SignalHandle + // Ready signal gets emitted once per preview operation, before the first + // page is rendered. + ConnectReady(func(context *PrintContext)) coreglib.SignalHandle +} + +var _ PrintOperationPreviewer = (*PrintOperationPreview)(nil) + +func wrapPrintOperationPreview(obj *coreglib.Object) *PrintOperationPreview { + return &PrintOperationPreview{ + Object: obj, + } +} + +func marshalPrintOperationPreview(p uintptr) (interface{}, error) { + return wrapPrintOperationPreview(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectGotPageSize is emitted once for each page that gets rendered to the +// preview. +// +// A handler for this signal should update the context according +// to page_setup and set up a suitable cairo context, using +// gtk.PrintContext.SetCairoContext(). +func (preview *PrintOperationPreview) ConnectGotPageSize(f func(context *PrintContext, pageSetup *PageSetup)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(preview, "got-page-size", false, unsafe.Pointer(C._gotk4_gtk4_PrintOperationPreview_ConnectGotPageSize), f) +} + +// ConnectReady signal gets emitted once per preview operation, before the first +// page is rendered. +// +// A handler for this signal can be used for setup tasks. +func (preview *PrintOperationPreview) ConnectReady(f func(context *PrintContext)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(preview, "ready", false, unsafe.Pointer(C._gotk4_gtk4_PrintOperationPreview_ConnectReady), f) +} + +// EndPreview ends a preview. +// +// This function must be called to finish a custom print preview. +func (preview *PrintOperationPreview) EndPreview() { + var _arg0 *C.GtkPrintOperationPreview // out + + _arg0 = (*C.GtkPrintOperationPreview)(unsafe.Pointer(coreglib.InternObject(preview).Native())) + + C.gtk_print_operation_preview_end_preview(_arg0) + runtime.KeepAlive(preview) +} + +// IsSelected returns whether the given page is included in the set of pages +// that have been selected for printing. +// +// The function takes the following parameters: +// +// - pageNr: page number. +// +// The function returns the following values: +// +// - ok: TRUE if the page has been selected for printing. +func (preview *PrintOperationPreview) IsSelected(pageNr int) bool { + var _arg0 *C.GtkPrintOperationPreview // out + var _arg1 C.int // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkPrintOperationPreview)(unsafe.Pointer(coreglib.InternObject(preview).Native())) + _arg1 = C.int(pageNr) + + _cret = C.gtk_print_operation_preview_is_selected(_arg0, _arg1) + runtime.KeepAlive(preview) + runtime.KeepAlive(pageNr) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RenderPage renders a page to the preview. +// +// This is using the print context that was passed to the +// gtk.PrintOperation::preview handler together with preview. +// +// A custom print preview should use this function to render the currently +// selected page. +// +// Note that this function requires a suitable cairo context to be associated +// with the print context. +// +// The function takes the following parameters: +// +// - pageNr: page to render. +func (preview *PrintOperationPreview) RenderPage(pageNr int) { + var _arg0 *C.GtkPrintOperationPreview // out + var _arg1 C.int // out + + _arg0 = (*C.GtkPrintOperationPreview)(unsafe.Pointer(coreglib.InternObject(preview).Native())) + _arg1 = C.int(pageNr) + + C.gtk_print_operation_preview_render_page(_arg0, _arg1) + runtime.KeepAlive(preview) + runtime.KeepAlive(pageNr) +} + +// endPreview ends a preview. +// +// This function must be called to finish a custom print preview. +func (preview *PrintOperationPreview) endPreview() { + gclass := (*C.GtkPrintOperationPreviewIface)(coreglib.PeekParentClass(preview)) + fnarg := gclass.end_preview + + var _arg0 *C.GtkPrintOperationPreview // out + + _arg0 = (*C.GtkPrintOperationPreview)(unsafe.Pointer(coreglib.InternObject(preview).Native())) + + C._gotk4_gtk4_PrintOperationPreview_virtual_end_preview(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(preview) +} + +// The function takes the following parameters: +// +// - context +// - pageSetup +func (preview *PrintOperationPreview) gotPageSize(context *PrintContext, pageSetup *PageSetup) { + gclass := (*C.GtkPrintOperationPreviewIface)(coreglib.PeekParentClass(preview)) + fnarg := gclass.got_page_size + + var _arg0 *C.GtkPrintOperationPreview // out + var _arg1 *C.GtkPrintContext // out + var _arg2 *C.GtkPageSetup // out + + _arg0 = (*C.GtkPrintOperationPreview)(unsafe.Pointer(coreglib.InternObject(preview).Native())) + _arg1 = (*C.GtkPrintContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg2 = (*C.GtkPageSetup)(unsafe.Pointer(coreglib.InternObject(pageSetup).Native())) + + C._gotk4_gtk4_PrintOperationPreview_virtual_got_page_size(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(preview) + runtime.KeepAlive(context) + runtime.KeepAlive(pageSetup) +} + +// isSelected returns whether the given page is included in the set of pages +// that have been selected for printing. +// +// The function takes the following parameters: +// +// - pageNr: page number. +// +// The function returns the following values: +// +// - ok: TRUE if the page has been selected for printing. +func (preview *PrintOperationPreview) isSelected(pageNr int) bool { + gclass := (*C.GtkPrintOperationPreviewIface)(coreglib.PeekParentClass(preview)) + fnarg := gclass.is_selected + + var _arg0 *C.GtkPrintOperationPreview // out + var _arg1 C.int // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkPrintOperationPreview)(unsafe.Pointer(coreglib.InternObject(preview).Native())) + _arg1 = C.int(pageNr) + + _cret = C._gotk4_gtk4_PrintOperationPreview_virtual_is_selected(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(preview) + runtime.KeepAlive(pageNr) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +func (preview *PrintOperationPreview) ready(context *PrintContext) { + gclass := (*C.GtkPrintOperationPreviewIface)(coreglib.PeekParentClass(preview)) + fnarg := gclass.ready + + var _arg0 *C.GtkPrintOperationPreview // out + var _arg1 *C.GtkPrintContext // out + + _arg0 = (*C.GtkPrintOperationPreview)(unsafe.Pointer(coreglib.InternObject(preview).Native())) + _arg1 = (*C.GtkPrintContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + + C._gotk4_gtk4_PrintOperationPreview_virtual_ready(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(preview) + runtime.KeepAlive(context) +} + +// renderPage renders a page to the preview. +// +// This is using the print context that was passed to the +// gtk.PrintOperation::preview handler together with preview. +// +// A custom print preview should use this function to render the currently +// selected page. +// +// Note that this function requires a suitable cairo context to be associated +// with the print context. +// +// The function takes the following parameters: +// +// - pageNr: page to render. +func (preview *PrintOperationPreview) renderPage(pageNr int) { + gclass := (*C.GtkPrintOperationPreviewIface)(coreglib.PeekParentClass(preview)) + fnarg := gclass.render_page + + var _arg0 *C.GtkPrintOperationPreview // out + var _arg1 C.int // out + + _arg0 = (*C.GtkPrintOperationPreview)(unsafe.Pointer(coreglib.InternObject(preview).Native())) + _arg1 = C.int(pageNr) + + C._gotk4_gtk4_PrintOperationPreview_virtual_render_page(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(preview) + runtime.KeepAlive(pageNr) +} + +// Root: GtkRoot is the interface implemented by all widgets that can act as a +// toplevel widget. +// +// The root widget takes care of providing the connection to the windowing +// system and manages layout, drawing and event delivery for its widget +// hierarchy. +// +// The obvious example of a GtkRoot is GtkWindow. +// +// To get the display to which a GtkRoot belongs, use gtk.Root.GetDisplay(). +// +// GtkRoot also maintains the location of keyboard focus inside its widget +// hierarchy, with gtk.Root.SetFocus() and gtk.Root.GetFocus(). +// +// Root wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Root struct { + _ [0]func() // equal guard + NativeSurface +} + +var () + +// Rooter describes Root's interface methods. +type Rooter interface { + coreglib.Objector + + // Display returns the display that this GtkRoot is on. + Display() *gdk.Display + // Focus retrieves the current focused widget within the root. + Focus() Widgetter + // SetFocus: if focus is not the current focus widget, and is focusable, + // sets it as the focus widget for the root. + SetFocus(focus Widgetter) +} + +var _ Rooter = (*Root)(nil) + +func wrapRoot(obj *coreglib.Object) *Root { + return &Root{ + NativeSurface: NativeSurface{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + }, + } +} + +func marshalRoot(p uintptr) (interface{}, error) { + return wrapRoot(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Display returns the display that this GtkRoot is on. +// +// The function returns the following values: +// +// - display of root. +func (self *Root) Display() *gdk.Display { + var _arg0 *C.GtkRoot // out + var _cret *C.GdkDisplay // in + + _arg0 = (*C.GtkRoot)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_root_get_display(_arg0) + runtime.KeepAlive(self) + + var _display *gdk.Display // out + + { + obj := coreglib.Take(unsafe.Pointer(_cret)) + _display = &gdk.Display{ + Object: obj, + } + } + + return _display +} + +// Focus retrieves the current focused widget within the root. +// +// Note that this is the widget that would have the focus if the root is active; +// if the root is not focused then gtk_widget_has_focus (widget) will be FALSE +// for the widget. +// +// The function returns the following values: +// +// - widget (optional): currently focused widget. +func (self *Root) Focus() Widgetter { + var _arg0 *C.GtkRoot // out + var _cret *C.GtkWidget // in + + _arg0 = (*C.GtkRoot)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_root_get_focus(_arg0) + runtime.KeepAlive(self) + + var _widget Widgetter // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Widgetter) + return ok + }) + rv, ok := casted.(Widgetter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter") + } + _widget = rv + } + } + + return _widget +} + +// SetFocus: if focus is not the current focus widget, and is focusable, sets it +// as the focus widget for the root. +// +// If focus is NULL, unsets the focus widget for the root. +// +// To set the focus to a particular widget in the root, it is usually more +// convenient to use gtk.Widget.GrabFocus() instead of this function. +// +// The function takes the following parameters: +// +// - focus (optional): widget to be the new focus widget, or NULL to unset the +// focus widget. +func (self *Root) SetFocus(focus Widgetter) { + var _arg0 *C.GtkRoot // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkRoot)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if focus != nil { + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(focus).Native())) + } + + C.gtk_root_set_focus(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(focus) +} + +// Scrollable: GtkScrollable is an interface for widgets with native scrolling +// ability. +// +// To implement this interface you should override the +// gtk.Scrollable:hadjustment and gtk.Scrollable:vadjustment properties. +// +// # Creating a scrollable widget +// +// All scrollable widgets should do the following. +// +// - When a parent widget sets the scrollable child widget’s adjustments, the +// widget should connect to the gtk.Adjustment::value-changed signal. The child +// widget should then populate the adjustments’ properties as soon as possible, +// which usually means queueing an allocation right away and populating the +// properties in the gtk.Widget.SizeAllocate() implementation. +// +// - Because its preferred size is the size for a fully expanded widget, +// the scrollable widget must be able to cope with underallocations. This +// means that it must accept any value passed to its gtk.Widget.SizeAllocate() +// implementation. +// +// - When the parent allocates space to the scrollable child widget, the widget +// must ensure the adjustments’ property values are correct and up to date, +// for example using gtk.Adjustment.Configure(). +// +// - When any of the adjustments emits the gtk.Adjustment::value-changed signal, +// the scrollable widget should scroll its contents. +// +// Scrollable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type Scrollable struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*Scrollable)(nil) +) + +// Scrollabler describes Scrollable's interface methods. +type Scrollabler interface { + coreglib.Objector + + // Border returns the size of a non-scrolling border around the outside of + // the scrollable. + Border() (*Border, bool) + // HAdjustment retrieves the GtkAdjustment used for horizontal scrolling. + HAdjustment() *Adjustment + // HScrollPolicy gets the horizontal GtkScrollablePolicy. + HScrollPolicy() ScrollablePolicy + // VAdjustment retrieves the GtkAdjustment used for vertical scrolling. + VAdjustment() *Adjustment + // VScrollPolicy gets the vertical GtkScrollablePolicy. + VScrollPolicy() ScrollablePolicy + // SetHAdjustment sets the horizontal adjustment of the GtkScrollable. + SetHAdjustment(hadjustment *Adjustment) + // SetHScrollPolicy sets the GtkScrollablePolicy. + SetHScrollPolicy(policy ScrollablePolicy) + // SetVAdjustment sets the vertical adjustment of the GtkScrollable. + SetVAdjustment(vadjustment *Adjustment) + // SetVScrollPolicy sets the GtkScrollablePolicy. + SetVScrollPolicy(policy ScrollablePolicy) +} + +var _ Scrollabler = (*Scrollable)(nil) + +func wrapScrollable(obj *coreglib.Object) *Scrollable { + return &Scrollable{ + Object: obj, + } +} + +func marshalScrollable(p uintptr) (interface{}, error) { + return wrapScrollable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Border returns the size of a non-scrolling border around the outside of the +// scrollable. +// +// An example for this would be treeview headers. GTK can use this information +// to display overlaid graphics, like the overshoot indication, at the right +// position. +// +// The function returns the following values: +// +// - border: return location for the results. +// - ok: TRUE if border has been set. +func (scrollable *Scrollable) Border() (*Border, bool) { + var _arg0 *C.GtkScrollable // out + var _arg1 C.GtkBorder // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + + _cret = C.gtk_scrollable_get_border(_arg0, &_arg1) + runtime.KeepAlive(scrollable) + + var _border *Border // out + var _ok bool // out + + _border = (*Border)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _border, _ok +} + +// HAdjustment retrieves the GtkAdjustment used for horizontal scrolling. +// +// The function returns the following values: +// +// - adjustment (optional): horizontal GtkAdjustment. +func (scrollable *Scrollable) HAdjustment() *Adjustment { + var _arg0 *C.GtkScrollable // out + var _cret *C.GtkAdjustment // in + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + + _cret = C.gtk_scrollable_get_hadjustment(_arg0) + runtime.KeepAlive(scrollable) + + var _adjustment *Adjustment // out + + if _cret != nil { + _adjustment = wrapAdjustment(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _adjustment +} + +// HScrollPolicy gets the horizontal GtkScrollablePolicy. +// +// The function returns the following values: +// +// - scrollablePolicy: horizontal GtkScrollablePolicy. +func (scrollable *Scrollable) HScrollPolicy() ScrollablePolicy { + var _arg0 *C.GtkScrollable // out + var _cret C.GtkScrollablePolicy // in + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + + _cret = C.gtk_scrollable_get_hscroll_policy(_arg0) + runtime.KeepAlive(scrollable) + + var _scrollablePolicy ScrollablePolicy // out + + _scrollablePolicy = ScrollablePolicy(_cret) + + return _scrollablePolicy +} + +// VAdjustment retrieves the GtkAdjustment used for vertical scrolling. +// +// The function returns the following values: +// +// - adjustment (optional): vertical GtkAdjustment. +func (scrollable *Scrollable) VAdjustment() *Adjustment { + var _arg0 *C.GtkScrollable // out + var _cret *C.GtkAdjustment // in + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + + _cret = C.gtk_scrollable_get_vadjustment(_arg0) + runtime.KeepAlive(scrollable) + + var _adjustment *Adjustment // out + + if _cret != nil { + _adjustment = wrapAdjustment(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _adjustment +} + +// VScrollPolicy gets the vertical GtkScrollablePolicy. +// +// The function returns the following values: +// +// - scrollablePolicy: vertical GtkScrollablePolicy. +func (scrollable *Scrollable) VScrollPolicy() ScrollablePolicy { + var _arg0 *C.GtkScrollable // out + var _cret C.GtkScrollablePolicy // in + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + + _cret = C.gtk_scrollable_get_vscroll_policy(_arg0) + runtime.KeepAlive(scrollable) + + var _scrollablePolicy ScrollablePolicy // out + + _scrollablePolicy = ScrollablePolicy(_cret) + + return _scrollablePolicy +} + +// SetHAdjustment sets the horizontal adjustment of the GtkScrollable. +// +// The function takes the following parameters: +// +// - hadjustment (optional): GtkAdjustment. +func (scrollable *Scrollable) SetHAdjustment(hadjustment *Adjustment) { + var _arg0 *C.GtkScrollable // out + var _arg1 *C.GtkAdjustment // out + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + if hadjustment != nil { + _arg1 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(hadjustment).Native())) + } + + C.gtk_scrollable_set_hadjustment(_arg0, _arg1) + runtime.KeepAlive(scrollable) + runtime.KeepAlive(hadjustment) +} + +// SetHScrollPolicy sets the GtkScrollablePolicy. +// +// The policy determines whether horizontal scrolling should start below the +// minimum width or below the natural width. +// +// The function takes the following parameters: +// +// - policy: horizontal GtkScrollablePolicy. +func (scrollable *Scrollable) SetHScrollPolicy(policy ScrollablePolicy) { + var _arg0 *C.GtkScrollable // out + var _arg1 C.GtkScrollablePolicy // out + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + _arg1 = C.GtkScrollablePolicy(policy) + + C.gtk_scrollable_set_hscroll_policy(_arg0, _arg1) + runtime.KeepAlive(scrollable) + runtime.KeepAlive(policy) +} + +// SetVAdjustment sets the vertical adjustment of the GtkScrollable. +// +// The function takes the following parameters: +// +// - vadjustment (optional): GtkAdjustment. +func (scrollable *Scrollable) SetVAdjustment(vadjustment *Adjustment) { + var _arg0 *C.GtkScrollable // out + var _arg1 *C.GtkAdjustment // out + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + if vadjustment != nil { + _arg1 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(vadjustment).Native())) + } + + C.gtk_scrollable_set_vadjustment(_arg0, _arg1) + runtime.KeepAlive(scrollable) + runtime.KeepAlive(vadjustment) +} + +// SetVScrollPolicy sets the GtkScrollablePolicy. +// +// The policy determines whether vertical scrolling should start below the +// minimum height or below the natural height. +// +// The function takes the following parameters: +// +// - policy: vertical GtkScrollablePolicy. +func (scrollable *Scrollable) SetVScrollPolicy(policy ScrollablePolicy) { + var _arg0 *C.GtkScrollable // out + var _arg1 C.GtkScrollablePolicy // out + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + _arg1 = C.GtkScrollablePolicy(policy) + + C.gtk_scrollable_set_vscroll_policy(_arg0, _arg1) + runtime.KeepAlive(scrollable) + runtime.KeepAlive(policy) +} + +// Border returns the size of a non-scrolling border around the outside of the +// scrollable. +// +// An example for this would be treeview headers. GTK can use this information +// to display overlaid graphics, like the overshoot indication, at the right +// position. +// +// The function returns the following values: +// +// - border: return location for the results. +// - ok: TRUE if border has been set. +func (scrollable *Scrollable) border() (*Border, bool) { + gclass := (*C.GtkScrollableInterface)(coreglib.PeekParentClass(scrollable)) + fnarg := gclass.get_border + + var _arg0 *C.GtkScrollable // out + var _arg1 C.GtkBorder // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkScrollable)(unsafe.Pointer(coreglib.InternObject(scrollable).Native())) + + _cret = C._gotk4_gtk4_Scrollable_virtual_get_border(unsafe.Pointer(fnarg), _arg0, &_arg1) + runtime.KeepAlive(scrollable) + + var _border *Border // out + var _ok bool // out + + _border = (*Border)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _border, _ok +} + +// SectionModel: GtkSectionModel is an interface that adds support for sections +// to list models. +// +// A GtkSectionModel groups successive items into so-called sections. +// List widgets like GtkListView and GtkGridView then allow displaying section +// headers for these sections by installing a header factory. +// +// Many GTK list models support sections inherently, or they pass through the +// sections of a model they are wrapping. +// +// When the section groupings of a model change, the model will +// emit the gtk.SectionModel::sections-changed signal by calling the +// gtk.SectionModel.SectionsChanged() function. All sections in the given range +// then need to be queried again. The gio.ListModel::items-changed signal has +// the same effect, all sections in that range are invalidated, too. +// +// SectionModel wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type SectionModel struct { + _ [0]func() // equal guard + gio.ListModel +} + +var () + +// SectionModeller describes SectionModel's interface methods. +type SectionModeller interface { + coreglib.Objector + + // Section: query the section that covers the given position. + Section(position uint) (outStart, outEnd uint) + SectionsChanged(position, nItems uint) + + // Sections-changed is emitted when the start-of-section state of some of + // the items in model changes. + ConnectSectionsChanged(func(position, nItems uint)) coreglib.SignalHandle +} + +var _ SectionModeller = (*SectionModel)(nil) + +func wrapSectionModel(obj *coreglib.Object) *SectionModel { + return &SectionModel{ + ListModel: gio.ListModel{ + Object: obj, + }, + } +} + +func marshalSectionModel(p uintptr) (interface{}, error) { + return wrapSectionModel(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectSectionsChanged is emitted when the start-of-section state of some of +// the items in model changes. +// +// Note that this signal does not specify the new section state of the items, +// they need to be queried manually. It is also not necessary for a model to +// change the section state of any of the items in the section model, though it +// would be rather useless to emit such a signal. +// +// The gio.ListModel::items-changed implies the effect of the +// gtk.SectionModel::sections-changed signal for all the items it covers. +func (self *SectionModel) ConnectSectionsChanged(f func(position, nItems uint)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(self, "sections-changed", false, unsafe.Pointer(C._gotk4_gtk4_SectionModel_ConnectSectionsChanged), f) +} + +// Section: query the section that covers the given position. The number of +// items in the section can be computed by out_end - out_start. +// +// If the position is larger than the number of items, a single range from +// n_items to G_MAXUINT will be returned. +// +// The function takes the following parameters: +// +// - position of the item to query. +// +// The function returns the following values: +// +// - outStart: position of the first item in the section. +// - outEnd: position of the first item not part of the section anymore. +func (self *SectionModel) Section(position uint) (outStart, outEnd uint) { + var _arg0 *C.GtkSectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // in + var _arg3 C.guint // in + + _arg0 = (*C.GtkSectionModel)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.guint(position) + + C.gtk_section_model_get_section(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(self) + runtime.KeepAlive(position) + + var _outStart uint // out + var _outEnd uint // out + + _outStart = uint(_arg2) + _outEnd = uint(_arg3) + + return _outStart, _outEnd +} + +// The function takes the following parameters: +// +// - position +// - nItems +func (self *SectionModel) SectionsChanged(position, nItems uint) { + var _arg0 *C.GtkSectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // out + + _arg0 = (*C.GtkSectionModel)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(nItems) + + C.gtk_section_model_sections_changed(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(position) + runtime.KeepAlive(nItems) +} + +// Section: query the section that covers the given position. The number of +// items in the section can be computed by out_end - out_start. +// +// If the position is larger than the number of items, a single range from +// n_items to G_MAXUINT will be returned. +// +// The function takes the following parameters: +// +// - position of the item to query. +// +// The function returns the following values: +// +// - outStart: position of the first item in the section. +// - outEnd: position of the first item not part of the section anymore. +func (self *SectionModel) section(position uint) (outStart, outEnd uint) { + gclass := (*C.GtkSectionModelInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.get_section + + var _arg0 *C.GtkSectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // in + var _arg3 C.guint // in + + _arg0 = (*C.GtkSectionModel)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.guint(position) + + C._gotk4_gtk4_SectionModel_virtual_get_section(unsafe.Pointer(fnarg), _arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(self) + runtime.KeepAlive(position) + + var _outStart uint // out + var _outEnd uint // out + + _outStart = uint(_arg2) + _outEnd = uint(_arg3) + + return _outStart, _outEnd +} + +// SelectionModel: GtkSelectionModel is an interface that add support for +// selection to list models. +// +// This support is then used by widgets using list models to add the ability to +// select and unselect various items. +// +// GTK provides default implementations of the most common selection modes such +// as gtk.SingleSelection, so you will only need to implement this interface if +// you want detailed control about how selections should be handled. +// +// A GtkSelectionModel supports a single boolean per item indicating if an item +// is selected or not. This can be queried via gtk.SelectionModel.IsSelected(). +// When the selected state of one or more items changes, the model will +// emit the gtk.SelectionModel::selection-changed signal by calling +// the gtk.SelectionModel.SelectionChanged() function. The positions +// given in that signal may have their selection state changed, though +// that is not a requirement. If new items added to the model via the +// gio.ListModel::items-changed signal are selected or not is up to the +// implementation. +// +// Note that items added via gio.ListModel::items-changed may already be +// selected and no gtk.SelectionModel::selection-changed will be emitted for +// them. So to track which items are selected, it is necessary to listen to both +// signals. +// +// Additionally, the interface can expose functionality to select and unselect +// items. If these functions are implemented, GTK's list widgets will allow +// users to select and unselect items. However, GtkSelectionModels are free to +// only implement them partially or not at all. In that case the widgets will +// not support the unimplemented operations. +// +// When selecting or unselecting is supported by a model, the return values +// of the selection functions do *not* indicate if selection or unselection +// happened. They are only meant to indicate complete failure, like when this +// mode of selecting is not supported by the model. +// +// Selections may happen asynchronously, so the only reliable way to find +// out when an item was selected is to listen to the signals that indicate +// selection. +// +// SelectionModel wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type SelectionModel struct { + _ [0]func() // equal guard + gio.ListModel +} + +var () + +// SelectionModeller describes SelectionModel's interface methods. +type SelectionModeller interface { + coreglib.Objector + + // Selection gets the set containing all currently selected items in the + // model. + Selection() *Bitset + // SelectionInRange gets the set of selected items in a range. + SelectionInRange(position, nItems uint) *Bitset + // IsSelected checks if the given item is selected. + IsSelected(position uint) bool + // SelectAll requests to select all items in the model. + SelectAll() bool + // SelectItem requests to select an item in the model. + SelectItem(position uint, unselectRest bool) bool + // SelectRange requests to select a range of items in the model. + SelectRange(position, nItems uint, unselectRest bool) bool + // SelectionChanged: helper function for implementations of + // GtkSelectionModel. + SelectionChanged(position, nItems uint) + // SetSelection: make selection changes. + SetSelection(selected, mask *Bitset) bool + // UnselectAll requests to unselect all items in the model. + UnselectAll() bool + // UnselectItem requests to unselect an item in the model. + UnselectItem(position uint) bool + // UnselectRange requests to unselect a range of items in the model. + UnselectRange(position, nItems uint) bool + + // Selection-changed is emitted when the selection state of some of the + // items in model changes. + ConnectSelectionChanged(func(position, nItems uint)) coreglib.SignalHandle +} + +var _ SelectionModeller = (*SelectionModel)(nil) + +func wrapSelectionModel(obj *coreglib.Object) *SelectionModel { + return &SelectionModel{ + ListModel: gio.ListModel{ + Object: obj, + }, + } +} + +func marshalSelectionModel(p uintptr) (interface{}, error) { + return wrapSelectionModel(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectSelectionChanged is emitted when the selection state of some of the +// items in model changes. +// +// Note that this signal does not specify the new selection state of the items, +// they need to be queried manually. It is also not necessary for a model to +// change the selection state of any of the items in the selection model, +// though it would be rather useless to emit such a signal. +func (model *SelectionModel) ConnectSelectionChanged(f func(position, nItems uint)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(model, "selection-changed", false, unsafe.Pointer(C._gotk4_gtk4_SelectionModel_ConnectSelectionChanged), f) +} + +// Selection gets the set containing all currently selected items in the model. +// +// This function may be slow, so if you are only interested in single item, +// consider using gtk.SelectionModel.IsSelected() or if you are only interested +// in a few, consider gtk.SelectionModel.GetSelectionInRange(). +// +// The function returns the following values: +// +// - bitset: GtkBitset containing all the values currently selected in model. +// If no items are selected, the bitset is empty. The bitset must not be +// modified. +func (model *SelectionModel) Selection() *Bitset { + var _arg0 *C.GtkSelectionModel // out + var _cret *C.GtkBitset // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + + _cret = C.gtk_selection_model_get_selection(_arg0) + runtime.KeepAlive(model) + + var _bitset *Bitset // out + + _bitset = (*Bitset)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bitset)), + func(intern *struct{ C unsafe.Pointer }) { + C.gtk_bitset_unref((*C.GtkBitset)(intern.C)) + }, + ) + + return _bitset +} + +// SelectionInRange gets the set of selected items in a range. +// +// This function is an optimization for gtk.SelectionModel.GetSelection() when +// you are only interested in part of the model's selected state. A common use +// case is in response to the gtk.SelectionModel::selection-changed signal. +// +// The function takes the following parameters: +// +// - position: start of the queried range. +// - nItems: number of items in the queried range. +// +// The function returns the following values: +// +// - bitset: GtkBitset that matches the selection state for the given range +// with all other values being undefined. The bitset must not be modified. +func (model *SelectionModel) SelectionInRange(position, nItems uint) *Bitset { + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // out + var _cret *C.GtkBitset // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(nItems) + + _cret = C.gtk_selection_model_get_selection_in_range(_arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(nItems) + + var _bitset *Bitset // out + + _bitset = (*Bitset)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bitset)), + func(intern *struct{ C unsafe.Pointer }) { + C.gtk_bitset_unref((*C.GtkBitset)(intern.C)) + }, + ) + + return _bitset +} + +// IsSelected checks if the given item is selected. +// +// The function takes the following parameters: +// +// - position of the item to query. +// +// The function returns the following values: +// +// - ok: TRUE if the item is selected. +func (model *SelectionModel) IsSelected(position uint) bool { + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + + _cret = C.gtk_selection_model_is_selected(_arg0, _arg1) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SelectAll requests to select all items in the model. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean that all items are now selected. +func (model *SelectionModel) SelectAll() bool { + var _arg0 *C.GtkSelectionModel // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + + _cret = C.gtk_selection_model_select_all(_arg0) + runtime.KeepAlive(model) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SelectItem requests to select an item in the model. +// +// The function takes the following parameters: +// +// - position of the item to select. +// - unselectRest: whether previously selected items should be unselected. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean the item was selected. +func (model *SelectionModel) SelectItem(position uint, unselectRest bool) bool { + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _arg2 C.gboolean // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + if unselectRest { + _arg2 = C.TRUE + } + + _cret = C.gtk_selection_model_select_item(_arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(unselectRest) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SelectRange requests to select a range of items in the model. +// +// The function takes the following parameters: +// +// - position: first item to select. +// - nItems: number of items to select. +// - unselectRest: whether previously selected items should be unselected. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean the range was selected. +func (model *SelectionModel) SelectRange(position, nItems uint, unselectRest bool) bool { + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // out + var _arg3 C.gboolean // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(nItems) + if unselectRest { + _arg3 = C.TRUE + } + + _cret = C.gtk_selection_model_select_range(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(nItems) + runtime.KeepAlive(unselectRest) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SelectionChanged: helper function for implementations of GtkSelectionModel. +// +// Call this when the selection changes to emit the +// gtk.SelectionModel::selection-changed signal. +// +// The function takes the following parameters: +// +// - position: first changed item. +// - nItems: number of changed items. +func (model *SelectionModel) SelectionChanged(position, nItems uint) { + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // out + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(nItems) + + C.gtk_selection_model_selection_changed(_arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(nItems) +} + +// SetSelection: make selection changes. +// +// This is the most advanced selection updating method that allows the most +// fine-grained control over selection changes. If you can, you should try the +// simpler versions, as implementations are more likely to implement support for +// those. +// +// Requests that the selection state of all positions set in mask be updated to +// the respective value in the selected bitmask. +// +// In pseudocode, it would look something like this: +// +// for (i = 0; i < n_items; i++) +// { +// // don't change values not in the mask +// if (!gtk_bitset_contains (mask, i)) +// continue; +// +// if (gtk_bitset_contains (selected, i)) +// select_item (i); +// else +// unselect_item (i); +// } +// +// gtk_selection_model_selection_changed (model, +// first_changed_item, +// n_changed_items); +// +// mask and selected must not be modified. They may refer to the same bitset, +// which would mean that every item in the set should be selected. +// +// The function takes the following parameters: +// +// - selected: bitmask specifying if items should be selected or unselected. +// - mask specifying which items should be updated. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean that all items were updated according to the inputs. +func (model *SelectionModel) SetSelection(selected, mask *Bitset) bool { + var _arg0 *C.GtkSelectionModel // out + var _arg1 *C.GtkBitset // out + var _arg2 *C.GtkBitset // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = (*C.GtkBitset)(gextras.StructNative(unsafe.Pointer(selected))) + _arg2 = (*C.GtkBitset)(gextras.StructNative(unsafe.Pointer(mask))) + + _cret = C.gtk_selection_model_set_selection(_arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(selected) + runtime.KeepAlive(mask) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnselectAll requests to unselect all items in the model. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean that all items are now unselected. +func (model *SelectionModel) UnselectAll() bool { + var _arg0 *C.GtkSelectionModel // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + + _cret = C.gtk_selection_model_unselect_all(_arg0) + runtime.KeepAlive(model) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnselectItem requests to unselect an item in the model. +// +// The function takes the following parameters: +// +// - position of the item to unselect. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean the item was unselected. +func (model *SelectionModel) UnselectItem(position uint) bool { + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + + _cret = C.gtk_selection_model_unselect_item(_arg0, _arg1) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// UnselectRange requests to unselect a range of items in the model. +// +// The function takes the following parameters: +// +// - position: first item to unselect. +// - nItems: number of items to unselect. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean the range was unselected. +func (model *SelectionModel) UnselectRange(position, nItems uint) bool { + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(nItems) + + _cret = C.gtk_selection_model_unselect_range(_arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(nItems) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// selectionInRange gets the set of selected items in a range. +// +// This function is an optimization for gtk.SelectionModel.GetSelection() when +// you are only interested in part of the model's selected state. A common use +// case is in response to the gtk.SelectionModel::selection-changed signal. +// +// The function takes the following parameters: +// +// - position: start of the queried range. +// - nItems: number of items in the queried range. +// +// The function returns the following values: +// +// - bitset: GtkBitset that matches the selection state for the given range +// with all other values being undefined. The bitset must not be modified. +func (model *SelectionModel) selectionInRange(position, nItems uint) *Bitset { + gclass := (*C.GtkSelectionModelInterface)(coreglib.PeekParentClass(model)) + fnarg := gclass.get_selection_in_range + + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // out + var _cret *C.GtkBitset // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(nItems) + + _cret = C._gotk4_gtk4_SelectionModel_virtual_get_selection_in_range(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(nItems) + + var _bitset *Bitset // out + + _bitset = (*Bitset)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_bitset)), + func(intern *struct{ C unsafe.Pointer }) { + C.gtk_bitset_unref((*C.GtkBitset)(intern.C)) + }, + ) + + return _bitset +} + +// isSelected checks if the given item is selected. +// +// The function takes the following parameters: +// +// - position of the item to query. +// +// The function returns the following values: +// +// - ok: TRUE if the item is selected. +func (model *SelectionModel) isSelected(position uint) bool { + gclass := (*C.GtkSelectionModelInterface)(coreglib.PeekParentClass(model)) + fnarg := gclass.is_selected + + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + + _cret = C._gotk4_gtk4_SelectionModel_virtual_is_selected(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// selectAll requests to select all items in the model. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean that all items are now selected. +func (model *SelectionModel) selectAll() bool { + gclass := (*C.GtkSelectionModelInterface)(coreglib.PeekParentClass(model)) + fnarg := gclass.select_all + + var _arg0 *C.GtkSelectionModel // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + + _cret = C._gotk4_gtk4_SelectionModel_virtual_select_all(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(model) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// selectItem requests to select an item in the model. +// +// The function takes the following parameters: +// +// - position of the item to select. +// - unselectRest: whether previously selected items should be unselected. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean the item was selected. +func (model *SelectionModel) selectItem(position uint, unselectRest bool) bool { + gclass := (*C.GtkSelectionModelInterface)(coreglib.PeekParentClass(model)) + fnarg := gclass.select_item + + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _arg2 C.gboolean // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + if unselectRest { + _arg2 = C.TRUE + } + + _cret = C._gotk4_gtk4_SelectionModel_virtual_select_item(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(unselectRest) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// selectRange requests to select a range of items in the model. +// +// The function takes the following parameters: +// +// - position: first item to select. +// - nItems: number of items to select. +// - unselectRest: whether previously selected items should be unselected. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean the range was selected. +func (model *SelectionModel) selectRange(position, nItems uint, unselectRest bool) bool { + gclass := (*C.GtkSelectionModelInterface)(coreglib.PeekParentClass(model)) + fnarg := gclass.select_range + + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // out + var _arg3 C.gboolean // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(nItems) + if unselectRest { + _arg3 = C.TRUE + } + + _cret = C._gotk4_gtk4_SelectionModel_virtual_select_range(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(nItems) + runtime.KeepAlive(unselectRest) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// setSelection: make selection changes. +// +// This is the most advanced selection updating method that allows the most +// fine-grained control over selection changes. If you can, you should try the +// simpler versions, as implementations are more likely to implement support for +// those. +// +// Requests that the selection state of all positions set in mask be updated to +// the respective value in the selected bitmask. +// +// In pseudocode, it would look something like this: +// +// for (i = 0; i < n_items; i++) +// { +// // don't change values not in the mask +// if (!gtk_bitset_contains (mask, i)) +// continue; +// +// if (gtk_bitset_contains (selected, i)) +// select_item (i); +// else +// unselect_item (i); +// } +// +// gtk_selection_model_selection_changed (model, +// first_changed_item, +// n_changed_items); +// +// mask and selected must not be modified. They may refer to the same bitset, +// which would mean that every item in the set should be selected. +// +// The function takes the following parameters: +// +// - selected: bitmask specifying if items should be selected or unselected. +// - mask specifying which items should be updated. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean that all items were updated according to the inputs. +func (model *SelectionModel) setSelection(selected, mask *Bitset) bool { + gclass := (*C.GtkSelectionModelInterface)(coreglib.PeekParentClass(model)) + fnarg := gclass.set_selection + + var _arg0 *C.GtkSelectionModel // out + var _arg1 *C.GtkBitset // out + var _arg2 *C.GtkBitset // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = (*C.GtkBitset)(gextras.StructNative(unsafe.Pointer(selected))) + _arg2 = (*C.GtkBitset)(gextras.StructNative(unsafe.Pointer(mask))) + + _cret = C._gotk4_gtk4_SelectionModel_virtual_set_selection(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(selected) + runtime.KeepAlive(mask) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// unselectAll requests to unselect all items in the model. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean that all items are now unselected. +func (model *SelectionModel) unselectAll() bool { + gclass := (*C.GtkSelectionModelInterface)(coreglib.PeekParentClass(model)) + fnarg := gclass.unselect_all + + var _arg0 *C.GtkSelectionModel // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + + _cret = C._gotk4_gtk4_SelectionModel_virtual_unselect_all(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(model) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// unselectItem requests to unselect an item in the model. +// +// The function takes the following parameters: +// +// - position of the item to unselect. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean the item was unselected. +func (model *SelectionModel) unselectItem(position uint) bool { + gclass := (*C.GtkSelectionModelInterface)(coreglib.PeekParentClass(model)) + fnarg := gclass.unselect_item + + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + + _cret = C._gotk4_gtk4_SelectionModel_virtual_unselect_item(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// unselectRange requests to unselect a range of items in the model. +// +// The function takes the following parameters: +// +// - position: first item to unselect. +// - nItems: number of items to unselect. +// +// The function returns the following values: +// +// - ok: TRUE if this action was supported and no fallback should be tried. +// This does not mean the range was unselected. +func (model *SelectionModel) unselectRange(position, nItems uint) bool { + gclass := (*C.GtkSelectionModelInterface)(coreglib.PeekParentClass(model)) + fnarg := gclass.unselect_range + + var _arg0 *C.GtkSelectionModel // out + var _arg1 C.guint // out + var _arg2 C.guint // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkSelectionModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = C.guint(position) + _arg2 = C.guint(nItems) + + _cret = C._gotk4_gtk4_SelectionModel_virtual_unselect_range(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(position) + runtime.KeepAlive(nItems) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ShortcutManager: GtkShortcutManager interface is used to implement shortcut +// scopes. +// +// This is important for gtk.Native widgets that have their own surface, since +// the event controllers that are used to implement managed and global scopes +// are limited to the same native. +// +// Examples for widgets implementing GtkShortcutManager are gtk.Window and +// gtk.Popover. +// +// Every widget that implements GtkShortcutManager will be used as a +// GTK_SHORTCUT_SCOPE_MANAGED. +// +// ShortcutManager wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type ShortcutManager struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ShortcutManager)(nil) +) + +// ShortcutManagerer describes ShortcutManager's interface methods. +type ShortcutManagerer interface { + coreglib.Objector + + baseShortcutManager() *ShortcutManager +} + +var _ ShortcutManagerer = (*ShortcutManager)(nil) + +func wrapShortcutManager(obj *coreglib.Object) *ShortcutManager { + return &ShortcutManager{ + Object: obj, + } +} + +func marshalShortcutManager(p uintptr) (interface{}, error) { + return wrapShortcutManager(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *ShortcutManager) baseShortcutManager() *ShortcutManager { + return v +} + +// BaseShortcutManager returns the underlying base object. +func BaseShortcutManager(obj ShortcutManagerer) *ShortcutManager { + return obj.baseShortcutManager() +} + +// addController: add a GtkShortcutController to be managed. +func (self *ShortcutManager) addController(controller *ShortcutController) { + gclass := (*C.GtkShortcutManagerInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.add_controller + + var _arg0 *C.GtkShortcutManager // out + var _arg1 *C.GtkShortcutController // out + + _arg0 = (*C.GtkShortcutManager)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GtkShortcutController)(unsafe.Pointer(coreglib.InternObject(controller).Native())) + + C._gotk4_gtk4_ShortcutManager_virtual_add_controller(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(controller) +} + +// removeController: remove a GtkShortcutController that had previously been +// added. +func (self *ShortcutManager) removeController(controller *ShortcutController) { + gclass := (*C.GtkShortcutManagerInterface)(coreglib.PeekParentClass(self)) + fnarg := gclass.remove_controller + + var _arg0 *C.GtkShortcutManager // out + var _arg1 *C.GtkShortcutController // out + + _arg0 = (*C.GtkShortcutManager)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GtkShortcutController)(unsafe.Pointer(coreglib.InternObject(controller).Native())) + + C._gotk4_gtk4_ShortcutManager_virtual_remove_controller(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(controller) +} + +// StyleProvider: GtkStyleProvider is an interface for style information used by +// GtkStyleContext. +// +// See gtk.StyleContext.AddProvider() and +// gtk.StyleContext().AddProviderForDisplay for adding GtkStyleProviders. +// +// GTK uses the GtkStyleProvider implementation for CSS in gtk.CSSProvider. +// +// StyleProvider wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type StyleProvider struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*StyleProvider)(nil) +) + +// StyleProviderer describes StyleProvider's interface methods. +type StyleProviderer interface { + coreglib.Objector + + baseStyleProvider() *StyleProvider +} + +var _ StyleProviderer = (*StyleProvider)(nil) + +func wrapStyleProvider(obj *coreglib.Object) *StyleProvider { + return &StyleProvider{ + Object: obj, + } +} + +func marshalStyleProvider(p uintptr) (interface{}, error) { + return wrapStyleProvider(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (v *StyleProvider) baseStyleProvider() *StyleProvider { + return v +} + +// BaseStyleProvider returns the underlying base object. +func BaseStyleProvider(obj StyleProviderer) *StyleProvider { + return obj.baseStyleProvider() +} + +func (v *StyleProvider) ConnectGTKPrivateChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(v, "gtk-private-changed", false, unsafe.Pointer(C._gotk4_gtk4_StyleProvider_ConnectGTKPrivateChanged), f) +} + +// SymbolicPaintable: GtkSymbolicPaintable is an interface that support symbolic +// colors in paintables. +// +// GdkPaintables implementing the interface will have the +// gtk.SymbolicPaintable.SnapshotSymbolic() function called and have the colors +// for drawing symbolic icons passed. At least 4 colors are guaranteed to be +// passed every time. +// +// These 4 colors are the foreground color, and the colors to use for errors, +// warnings and success information in that order. +// +// More colors may be added in the future. +// +// SymbolicPaintable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type SymbolicPaintable struct { + _ [0]func() // equal guard + gdk.Paintable +} + +var () + +// SymbolicPaintabler describes SymbolicPaintable's interface methods. +type SymbolicPaintabler interface { + coreglib.Objector + + // SnapshotSymbolic snapshots the paintable with the given colors. + SnapshotSymbolic(snapshot gdk.Snapshotter, width, height float64, colors []gdk.RGBA) +} + +var _ SymbolicPaintabler = (*SymbolicPaintable)(nil) + +func wrapSymbolicPaintable(obj *coreglib.Object) *SymbolicPaintable { + return &SymbolicPaintable{ + Paintable: gdk.Paintable{ + Object: obj, + }, + } +} + +func marshalSymbolicPaintable(p uintptr) (interface{}, error) { + return wrapSymbolicPaintable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// SnapshotSymbolic snapshots the paintable with the given colors. +// +// If less than 4 colors are provided, GTK will pad the array with default +// colors. +// +// The function takes the following parameters: +// +// - snapshot: GdkSnapshot to snapshot to. +// - width to snapshot in. +// - height to snapshot in. +// - colors: pointer to an array of colors. +func (paintable *SymbolicPaintable) SnapshotSymbolic(snapshot gdk.Snapshotter, width, height float64, colors []gdk.RGBA) { + var _arg0 *C.GtkSymbolicPaintable // out + var _arg1 *C.GdkSnapshot // out + var _arg2 C.double // out + var _arg3 C.double // out + var _arg4 *C.GdkRGBA // out + var _arg5 C.gsize + + _arg0 = (*C.GtkSymbolicPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + _arg1 = (*C.GdkSnapshot)(unsafe.Pointer(coreglib.InternObject(snapshot).Native())) + _arg2 = C.double(width) + _arg3 = C.double(height) + _arg5 = (C.gsize)(len(colors)) + _arg4 = (*C.GdkRGBA)(C.calloc(C.size_t(len(colors)), C.size_t(C.sizeof_GdkRGBA))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((*C.GdkRGBA)(_arg4), len(colors)) + for i := range colors { + out[i] = *(*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer((&colors[i])))) + } + } + + C.gtk_symbolic_paintable_snapshot_symbolic(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(paintable) + runtime.KeepAlive(snapshot) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(colors) +} + +// snapshotSymbolic snapshots the paintable with the given colors. +// +// If less than 4 colors are provided, GTK will pad the array with default +// colors. +// +// The function takes the following parameters: +// +// - snapshot: GdkSnapshot to snapshot to. +// - width to snapshot in. +// - height to snapshot in. +// - colors: pointer to an array of colors. +func (paintable *SymbolicPaintable) snapshotSymbolic(snapshot gdk.Snapshotter, width, height float64, colors []gdk.RGBA) { + gclass := (*C.GtkSymbolicPaintableInterface)(coreglib.PeekParentClass(paintable)) + fnarg := gclass.snapshot_symbolic + + var _arg0 *C.GtkSymbolicPaintable // out + var _arg1 *C.GdkSnapshot // out + var _arg2 C.double // out + var _arg3 C.double // out + var _arg4 *C.GdkRGBA // out + var _arg5 C.gsize + + _arg0 = (*C.GtkSymbolicPaintable)(unsafe.Pointer(coreglib.InternObject(paintable).Native())) + _arg1 = (*C.GdkSnapshot)(unsafe.Pointer(coreglib.InternObject(snapshot).Native())) + _arg2 = C.double(width) + _arg3 = C.double(height) + _arg5 = (C.gsize)(len(colors)) + _arg4 = (*C.GdkRGBA)(C.calloc(C.size_t(len(colors)), C.size_t(C.sizeof_GdkRGBA))) + defer C.free(unsafe.Pointer(_arg4)) + { + out := unsafe.Slice((*C.GdkRGBA)(_arg4), len(colors)) + for i := range colors { + out[i] = *(*C.GdkRGBA)(gextras.StructNative(unsafe.Pointer((&colors[i])))) + } + } + + C._gotk4_gtk4_SymbolicPaintable_virtual_snapshot_symbolic(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5) + runtime.KeepAlive(paintable) + runtime.KeepAlive(snapshot) + runtime.KeepAlive(width) + runtime.KeepAlive(height) + runtime.KeepAlive(colors) +} + +// TreeDragDest: interface for Drag-and-Drop destinations in GtkTreeView. +// +// Deprecated: List views use widgets to display their contents. You can use +// gtk.DropTarget to implement a drop destination. +// +// TreeDragDest wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type TreeDragDest struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*TreeDragDest)(nil) +) + +// TreeDragDester describes TreeDragDest's interface methods. +type TreeDragDester interface { + coreglib.Objector + + // DragDataReceived asks the GtkTreeDragDest to insert a row before the path + // dest, deriving the contents of the row from value. + DragDataReceived(dest *TreePath, value *coreglib.Value) bool + // RowDropPossible determines whether a drop is possible before the given + // dest_path, at the same depth as dest_path. + RowDropPossible(destPath *TreePath, value *coreglib.Value) bool +} + +var _ TreeDragDester = (*TreeDragDest)(nil) + +func wrapTreeDragDest(obj *coreglib.Object) *TreeDragDest { + return &TreeDragDest{ + Object: obj, + } +} + +func marshalTreeDragDest(p uintptr) (interface{}, error) { + return wrapTreeDragDest(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// DragDataReceived asks the GtkTreeDragDest to insert a row before the path +// dest, deriving the contents of the row from value. If dest is outside the +// tree so that inserting before it is impossible, FALSE will be returned. Also, +// FALSE may be returned if the new row is not created for some model-specific +// reason. Should robustly handle a dest no longer found in the model! +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - dest: row to drop in front of. +// - value: data to drop. +// +// The function returns the following values: +// +// - ok: whether a new row was created before position dest. +func (dragDest *TreeDragDest) DragDataReceived(dest *TreePath, value *coreglib.Value) bool { + var _arg0 *C.GtkTreeDragDest // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GValue // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeDragDest)(unsafe.Pointer(coreglib.InternObject(dragDest).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(dest))) + _arg2 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C.gtk_tree_drag_dest_drag_data_received(_arg0, _arg1, _arg2) + runtime.KeepAlive(dragDest) + runtime.KeepAlive(dest) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RowDropPossible determines whether a drop is possible before the given +// dest_path, at the same depth as dest_path. i.e., can we drop the data in +// value at that location. dest_path does not have to exist; the return value +// will almost certainly be FALSE if the parent of dest_path doesn’t exist, +// though. +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - destPath: destination row. +// - value: data being dropped. +// +// The function returns the following values: +// +// - ok: TRUE if a drop is possible before dest_path. +func (dragDest *TreeDragDest) RowDropPossible(destPath *TreePath, value *coreglib.Value) bool { + var _arg0 *C.GtkTreeDragDest // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GValue // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeDragDest)(unsafe.Pointer(coreglib.InternObject(dragDest).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(destPath))) + _arg2 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C.gtk_tree_drag_dest_row_drop_possible(_arg0, _arg1, _arg2) + runtime.KeepAlive(dragDest) + runtime.KeepAlive(destPath) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// dragDataReceived asks the GtkTreeDragDest to insert a row before the path +// dest, deriving the contents of the row from value. If dest is outside the +// tree so that inserting before it is impossible, FALSE will be returned. Also, +// FALSE may be returned if the new row is not created for some model-specific +// reason. Should robustly handle a dest no longer found in the model! +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - dest: row to drop in front of. +// - value: data to drop. +// +// The function returns the following values: +// +// - ok: whether a new row was created before position dest. +func (dragDest *TreeDragDest) dragDataReceived(dest *TreePath, value *coreglib.Value) bool { + gclass := (*C.GtkTreeDragDestIface)(coreglib.PeekParentClass(dragDest)) + fnarg := gclass.drag_data_received + + var _arg0 *C.GtkTreeDragDest // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GValue // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeDragDest)(unsafe.Pointer(coreglib.InternObject(dragDest).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(dest))) + _arg2 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C._gotk4_gtk4_TreeDragDest_virtual_drag_data_received(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(dragDest) + runtime.KeepAlive(dest) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// rowDropPossible determines whether a drop is possible before the given +// dest_path, at the same depth as dest_path. i.e., can we drop the data in +// value at that location. dest_path does not have to exist; the return value +// will almost certainly be FALSE if the parent of dest_path doesn’t exist, +// though. +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - destPath: destination row. +// - value: data being dropped. +// +// The function returns the following values: +// +// - ok: TRUE if a drop is possible before dest_path. +func (dragDest *TreeDragDest) rowDropPossible(destPath *TreePath, value *coreglib.Value) bool { + gclass := (*C.GtkTreeDragDestIface)(coreglib.PeekParentClass(dragDest)) + fnarg := gclass.row_drop_possible + + var _arg0 *C.GtkTreeDragDest // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GValue // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeDragDest)(unsafe.Pointer(coreglib.InternObject(dragDest).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(destPath))) + _arg2 = (*C.GValue)(unsafe.Pointer(value.Native())) + + _cret = C._gotk4_gtk4_TreeDragDest_virtual_row_drop_possible(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(dragDest) + runtime.KeepAlive(destPath) + runtime.KeepAlive(value) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TreeDragSource: interface for Drag-and-Drop destinations in GtkTreeView. +// +// Deprecated: List views use widgets to display their contents. You can use +// gtk.DragSource to implement a drag source. +// +// TreeDragSource wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type TreeDragSource struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*TreeDragSource)(nil) +) + +// TreeDragSourcer describes TreeDragSource's interface methods. +type TreeDragSourcer interface { + coreglib.Objector + + // DragDataDelete asks the GtkTreeDragSource to delete the row at path, + // because it was moved somewhere else via drag-and-drop. + DragDataDelete(path *TreePath) bool + // DragDataGet asks the GtkTreeDragSource to return a GdkContentProvider + // representing the row at path. + DragDataGet(path *TreePath) *gdk.ContentProvider + // RowDraggable asks the GtkTreeDragSource whether a particular row can be + // used as the source of a DND operation. + RowDraggable(path *TreePath) bool +} + +var _ TreeDragSourcer = (*TreeDragSource)(nil) + +func wrapTreeDragSource(obj *coreglib.Object) *TreeDragSource { + return &TreeDragSource{ + Object: obj, + } +} + +func marshalTreeDragSource(p uintptr) (interface{}, error) { + return wrapTreeDragSource(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// DragDataDelete asks the GtkTreeDragSource to delete the row at path, because +// it was moved somewhere else via drag-and-drop. Returns FALSE if the deletion +// fails because path no longer exists, or for some model-specific reason. +// Should robustly handle a path no longer found in the model! +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - path: row that was being dragged. +// +// The function returns the following values: +// +// - ok: TRUE if the row was successfully deleted. +func (dragSource *TreeDragSource) DragDataDelete(path *TreePath) bool { + var _arg0 *C.GtkTreeDragSource // out + var _arg1 *C.GtkTreePath // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeDragSource)(unsafe.Pointer(coreglib.InternObject(dragSource).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C.gtk_tree_drag_source_drag_data_delete(_arg0, _arg1) + runtime.KeepAlive(dragSource) + runtime.KeepAlive(path) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// DragDataGet asks the GtkTreeDragSource to return a GdkContentProvider +// representing the row at path. Should robustly handle a path no longer found +// in the model! +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - path: row that was dragged. +// +// The function returns the following values: +// +// - contentProvider (optional): GdkContentProvider for the given path. +func (dragSource *TreeDragSource) DragDataGet(path *TreePath) *gdk.ContentProvider { + var _arg0 *C.GtkTreeDragSource // out + var _arg1 *C.GtkTreePath // out + var _cret *C.GdkContentProvider // in + + _arg0 = (*C.GtkTreeDragSource)(unsafe.Pointer(coreglib.InternObject(dragSource).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C.gtk_tree_drag_source_drag_data_get(_arg0, _arg1) + runtime.KeepAlive(dragSource) + runtime.KeepAlive(path) + + var _contentProvider *gdk.ContentProvider // out + + if _cret != nil { + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _contentProvider = &gdk.ContentProvider{ + Object: obj, + } + } + } + + return _contentProvider +} + +// RowDraggable asks the GtkTreeDragSource whether a particular row can be +// used as the source of a DND operation. If the source doesn’t implement this +// interface, the row is assumed draggable. +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - path: row on which user is initiating a drag. +// +// The function returns the following values: +// +// - ok: TRUE if the row can be dragged. +func (dragSource *TreeDragSource) RowDraggable(path *TreePath) bool { + var _arg0 *C.GtkTreeDragSource // out + var _arg1 *C.GtkTreePath // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeDragSource)(unsafe.Pointer(coreglib.InternObject(dragSource).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C.gtk_tree_drag_source_row_draggable(_arg0, _arg1) + runtime.KeepAlive(dragSource) + runtime.KeepAlive(path) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// dragDataDelete asks the GtkTreeDragSource to delete the row at path, because +// it was moved somewhere else via drag-and-drop. Returns FALSE if the deletion +// fails because path no longer exists, or for some model-specific reason. +// Should robustly handle a path no longer found in the model! +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - path: row that was being dragged. +// +// The function returns the following values: +// +// - ok: TRUE if the row was successfully deleted. +func (dragSource *TreeDragSource) dragDataDelete(path *TreePath) bool { + gclass := (*C.GtkTreeDragSourceIface)(coreglib.PeekParentClass(dragSource)) + fnarg := gclass.drag_data_delete + + var _arg0 *C.GtkTreeDragSource // out + var _arg1 *C.GtkTreePath // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeDragSource)(unsafe.Pointer(coreglib.InternObject(dragSource).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C._gotk4_gtk4_TreeDragSource_virtual_drag_data_delete(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(dragSource) + runtime.KeepAlive(path) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// dragDataGet asks the GtkTreeDragSource to return a GdkContentProvider +// representing the row at path. Should robustly handle a path no longer found +// in the model! +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - path: row that was dragged. +// +// The function returns the following values: +// +// - contentProvider (optional): GdkContentProvider for the given path. +func (dragSource *TreeDragSource) dragDataGet(path *TreePath) *gdk.ContentProvider { + gclass := (*C.GtkTreeDragSourceIface)(coreglib.PeekParentClass(dragSource)) + fnarg := gclass.drag_data_get + + var _arg0 *C.GtkTreeDragSource // out + var _arg1 *C.GtkTreePath // out + var _cret *C.GdkContentProvider // in + + _arg0 = (*C.GtkTreeDragSource)(unsafe.Pointer(coreglib.InternObject(dragSource).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C._gotk4_gtk4_TreeDragSource_virtual_drag_data_get(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(dragSource) + runtime.KeepAlive(path) + + var _contentProvider *gdk.ContentProvider // out + + if _cret != nil { + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _contentProvider = &gdk.ContentProvider{ + Object: obj, + } + } + } + + return _contentProvider +} + +// rowDraggable asks the GtkTreeDragSource whether a particular row can be +// used as the source of a DND operation. If the source doesn’t implement this +// interface, the row is assumed draggable. +// +// Deprecated: Use list models instead. +// +// The function takes the following parameters: +// +// - path: row on which user is initiating a drag. +// +// The function returns the following values: +// +// - ok: TRUE if the row can be dragged. +func (dragSource *TreeDragSource) rowDraggable(path *TreePath) bool { + gclass := (*C.GtkTreeDragSourceIface)(coreglib.PeekParentClass(dragSource)) + fnarg := gclass.row_draggable + + var _arg0 *C.GtkTreeDragSource // out + var _arg1 *C.GtkTreePath // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeDragSource)(unsafe.Pointer(coreglib.InternObject(dragSource).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C._gotk4_gtk4_TreeDragSource_virtual_row_draggable(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(dragSource) + runtime.KeepAlive(path) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// TreeModel: tree interface used by GtkTreeView +// +// The GtkTreeModel interface defines a generic tree interface for use by the +// GtkTreeView widget. It is an abstract interface, and is designed to be usable +// with any appropriate data structure. The programmer just has to implement +// this interface on their own data type for it to be viewable by a GtkTreeView +// widget. +// +// The model is represented as a hierarchical tree of strongly-typed, columned +// data. In other words, the model can be seen as a tree where every node has +// different values depending on which column is being queried. The type of data +// found in a column is determined by using the GType system (ie. G_TYPE_INT, +// GTK_TYPE_BUTTON, G_TYPE_POINTER, etc). The types are homogeneous per column +// across all nodes. It is important to note that this interface only provides +// a way of examining a model and observing changes. The implementation of each +// individual model decides how and if changes are made. +// +// In order to make life simpler for programmers who do not need to write their +// own specialized model, two generic models are provided — the GtkTreeStore +// and the GtkListStore. To use these, the developer simply pushes data into +// these models as necessary. These models provide the data structure as well +// as all appropriate tree interfaces. As a result, implementing drag and drop, +// sorting, and storing data is trivial. For the vast majority of trees and +// lists, these two models are sufficient. +// +// Models are accessed on a node/column level of granularity. One can query for +// the value of a model at a certain node and a certain column on that node. +// There are two structures used to reference a particular node in a model. They +// are the gtk.TreePath and the gtk.TreeIter (“iter” is short for iterator). +// Most of the interface consists of operations on a gtk.TreeIter. +// +// A path is essentially a potential node. It is a location on a model that may +// or may not actually correspond to a node on a specific model. A gtk.TreePath +// can be converted into either an array of unsigned integers or a string. +// The string form is a list of numbers separated by a colon. Each number refers +// to the offset at that level. Thus, the path 0 refers to the root node and the +// path 2:4 refers to the fifth child of the third node. +// +// By contrast, a gtk.TreeIter is a reference to a specific node on a specific +// model. It is a generic struct with an integer and three generic pointers. +// These are filled in by the model in a model-specific way. One can convert a +// path to an iterator by calling gtk_tree_model_get_iter(). These iterators are +// the primary way of accessing a model and are similar to the iterators used by +// GtkTextBuffer. They are generally statically allocated on the stack and only +// used for a short time. The model interface defines a set of operations using +// them for navigating the model. +// +// It is expected that models fill in the iterator with private data. For +// example, the GtkListStore model, which is internally a simple linked list, +// stores a list node in one of the pointers. The GtkTreeModelSort stores +// an array and an offset in two of the pointers. Additionally, there is an +// integer field. This field is generally filled with a unique stamp per model. +// This stamp is for catching errors resulting from using invalid iterators with +// a model. +// +// The lifecycle of an iterator can be a little confusing at first. Iterators +// are expected to always be valid for as long as the model is unchanged (and +// doesn’t emit a signal). The model is considered to own all outstanding +// iterators and nothing needs to be done to free them from the user’s point +// of view. Additionally, some models guarantee that an iterator is valid for +// as long as the node it refers to is valid (most notably the GtkTreeStore +// and GtkListStore). Although generally uninteresting, as one always has to +// allow for the case where iterators do not persist beyond a signal, some very +// important performance enhancements were made in the sort model. As a result, +// the GTK_TREE_MODEL_ITERS_PERSIST flag was added to indicate this behavior. +// +// To help show some common operation of a model, some examples are provided. +// The first example shows three ways of getting the iter at the location 3:2:5. +// While the first method shown is easier, the second is much more common, +// as you often get paths from callbacks. +// +// Acquiring a GtkTreeIter +// +// // Three ways of getting the iter pointing to the location +// GtkTreePath *path; +// GtkTreeIter iter; +// GtkTreeIter parent_iter; +// +// // get the iterator from a string +// gtk_tree_model_get_iter_from_string (model, +// &iter, +// "3:2:5"); +// +// // get the iterator from a path +// path = gtk_tree_path_new_from_string ("3:2:5"); +// gtk_tree_model_get_iter (model, &iter, path); +// gtk_tree_path_free (path); +// +// // walk the tree to find the iterator +// gtk_tree_model_iter_nth_child (model, &iter, +// NULL, 3); +// parent_iter = iter; +// gtk_tree_model_iter_nth_child (model, &iter, +// &parent_iter, 2); +// parent_iter = iter; +// gtk_tree_model_iter_nth_child (model, &iter, +// &parent_iter, 5); +// +// This second example shows a quick way of iterating through a list and getting +// a string and an integer from each row. The populate_model() function used +// below is not shown, as it is specific to the GtkListStore. For information on +// how to write such a function, see the GtkListStore documentation. +// +// Reading data from a GtkTreeModel +// +// enum +// { +// STRING_COLUMN, +// INT_COLUMN, +// N_COLUMNS +// }; +// +// ... +// +// GtkTreeModel *list_store; +// GtkTreeIter iter; +// gboolean valid; +// int row_count = 0; +// +// // make a new list_store +// list_store = gtk_list_store_new (N_COLUMNS, +// G_TYPE_STRING, +// G_TYPE_INT); +// +// // Fill the list store with data +// populate_model (list_store); +// +// // Get the first iter in the list, check it is valid and walk +// // through the list, reading each row. +// +// valid = gtk_tree_model_get_iter_first (list_store, +// &iter); +// while (valid) +// { +// char *str_data; +// int int_data; +// +// // Make sure you terminate calls to gtk_tree_model_get() with a “-1” value +// gtk_tree_model_get (list_store, &iter, +// STRING_COLUMN, &str_data, +// INT_COLUMN, &int_data, +// -1); +// +// // Do something with the data +// g_print ("Row d: (s,d)\n", +// row_count, str_data, int_data); +// g_free (str_data); +// +// valid = gtk_tree_model_iter_next (list_store, +// &iter); +// row_count++; +// } +// +// The GtkTreeModel interface contains two methods for reference counting: +// gtk_tree_model_ref_node() and gtk_tree_model_unref_node(). These two methods +// are optional to implement. The reference counting is meant as a way for views +// to let models know when nodes are being displayed. GtkTreeView will take +// a reference on a node when it is visible, which means the node is either +// in the toplevel or expanded. Being displayed does not mean that the node +// is currently directly visible to the user in the viewport. Based on this +// reference counting scheme a caching model, for example, can decide whether or +// not to cache a node based on the reference count. A file-system based model +// would not want to keep the entire file hierarchy in memory, but just the +// folders that are currently expanded in every current view. +// +// When working with reference counting, the following rules must be taken into +// account: +// +// - Never take a reference on a node without owning a reference on its parent. +// This means that all parent nodes of a referenced node must be referenced as +// well. +// +// - Outstanding references on a deleted node are not released. This is +// not possible because the node has already been deleted by the time the +// row-deleted signal is received. +// +// - Models are not obligated to emit a signal on rows of which none of its +// siblings are referenced. To phrase this differently, signals are only +// required for levels in which nodes are referenced. For the root level +// however, signals must be emitted at all times (however the root level is +// always referenced when any view is attached). +// +// Deprecated: Use gio.ListModel instead. +// +// TreeModel wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type TreeModel struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*TreeModel)(nil) +) + +// TreeModeller describes TreeModel's interface methods. +type TreeModeller interface { + coreglib.Objector + + // ForEach calls func on each node in model in a depth-first fashion. + ForEach(fn TreeModelForEachFunc) + // ColumnType returns the type of the column. + ColumnType(index_ int) coreglib.Type + // Flags returns a set of flags supported by this interface. + Flags() TreeModelFlags + // Iter sets iter to a valid iterator pointing to path. + Iter(path *TreePath) (*TreeIter, bool) + // IterFirst initializes iter with the first iterator in the tree (the one + // at the path "0"). + IterFirst() (*TreeIter, bool) + // IterFromString sets iter to a valid iterator pointing to path_string, + // if it exists. + IterFromString(pathString string) (*TreeIter, bool) + // NColumns returns the number of columns supported by tree_model. + NColumns() int + // Path returns a newly-created GtkTreePath referenced by iter. + Path(iter *TreeIter) *TreePath + // StringFromIter generates a string representation of the iter. + StringFromIter(iter *TreeIter) string + // Value initializes and sets value to that at column. + Value(iter *TreeIter, column int) coreglib.Value + // IterChildren sets iter to point to the first child of parent. + IterChildren(parent *TreeIter) (*TreeIter, bool) + // IterHasChild returns TRUE if iter has children, FALSE otherwise. + IterHasChild(iter *TreeIter) bool + // IterNChildren returns the number of children that iter has. + IterNChildren(iter *TreeIter) int + // IterNext sets iter to point to the node following it at the current + // level. + IterNext(iter *TreeIter) bool + // IterNthChild sets iter to be the child of parent, using the given index. + IterNthChild(parent *TreeIter, n int) (*TreeIter, bool) + // IterParent sets iter to be the parent of child. + IterParent(child *TreeIter) (*TreeIter, bool) + // IterPrevious sets iter to point to the previous node at the current + // level. + IterPrevious(iter *TreeIter) bool + // RefNode lets the tree ref the node. + RefNode(iter *TreeIter) + // RowChanged emits the ::row-changed signal on tree_model. + RowChanged(path *TreePath, iter *TreeIter) + // RowDeleted emits the ::row-deleted signal on tree_model. + RowDeleted(path *TreePath) + // RowHasChildToggled emits the ::row-has-child-toggled signal on + // tree_model. + RowHasChildToggled(path *TreePath, iter *TreeIter) + // RowInserted emits the ::row-inserted signal on tree_model. + RowInserted(path *TreePath, iter *TreeIter) + // RowsReordered emits the ::rows-reordered signal on tree_model. + RowsReordered(path *TreePath, iter *TreeIter, newOrder []int) + // UnrefNode lets the tree unref the node. + UnrefNode(iter *TreeIter) + + // Row-changed: this signal is emitted when a row in the model has changed. + ConnectRowChanged(func(path *TreePath, iter *TreeIter)) coreglib.SignalHandle + // Row-deleted: this signal is emitted when a row has been deleted. + ConnectRowDeleted(func(path *TreePath)) coreglib.SignalHandle + // Row-has-child-toggled: this signal is emitted when a row has gotten the + // first child row or lost its last child row. + ConnectRowHasChildToggled(func(path *TreePath, iter *TreeIter)) coreglib.SignalHandle + // Row-inserted: this signal is emitted when a new row has been inserted in + // the model. + ConnectRowInserted(func(path *TreePath, iter *TreeIter)) coreglib.SignalHandle + // Rows-reordered: this signal is emitted when the children of a node in the + // GtkTreeModel have been reordered. + ConnectRowsReordered(func(path *TreePath, iter *TreeIter, newOrder unsafe.Pointer)) coreglib.SignalHandle +} + +var _ TreeModeller = (*TreeModel)(nil) + +func wrapTreeModel(obj *coreglib.Object) *TreeModel { + return &TreeModel{ + Object: obj, + } +} + +func marshalTreeModel(p uintptr) (interface{}, error) { + return wrapTreeModel(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectRowChanged: this signal is emitted when a row in the model has +// changed. +func (childModel *TreeModel) ConnectRowChanged(f func(path *TreePath, iter *TreeIter)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(childModel, "row-changed", false, unsafe.Pointer(C._gotk4_gtk4_TreeModel_ConnectRowChanged), f) +} + +// ConnectRowDeleted: this signal is emitted when a row has been deleted. +// +// Note that no iterator is passed to the signal handler, since the row is +// already deleted. +// +// This should be called by models after a row has been removed. The location +// pointed to by path should be the location that the row previously was at. +// It may not be a valid location anymore. +func (childModel *TreeModel) ConnectRowDeleted(f func(path *TreePath)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(childModel, "row-deleted", false, unsafe.Pointer(C._gotk4_gtk4_TreeModel_ConnectRowDeleted), f) +} + +// ConnectRowHasChildToggled: this signal is emitted when a row has gotten the +// first child row or lost its last child row. +func (childModel *TreeModel) ConnectRowHasChildToggled(f func(path *TreePath, iter *TreeIter)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(childModel, "row-has-child-toggled", false, unsafe.Pointer(C._gotk4_gtk4_TreeModel_ConnectRowHasChildToggled), f) +} + +// ConnectRowInserted: this signal is emitted when a new row has been inserted +// in the model. +// +// Note that the row may still be empty at this point, since it is a common +// pattern to first insert an empty row, and then fill it with the desired +// values. +func (childModel *TreeModel) ConnectRowInserted(f func(path *TreePath, iter *TreeIter)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(childModel, "row-inserted", false, unsafe.Pointer(C._gotk4_gtk4_TreeModel_ConnectRowInserted), f) +} + +// ConnectRowsReordered: this signal is emitted when the children of a node in +// the GtkTreeModel have been reordered. +// +// Note that this signal is not emitted when rows are reordered by DND, since +// this is implemented by removing and then reinserting the row. +func (childModel *TreeModel) ConnectRowsReordered(f func(path *TreePath, iter *TreeIter, newOrder unsafe.Pointer)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(childModel, "rows-reordered", false, unsafe.Pointer(C._gotk4_gtk4_TreeModel_ConnectRowsReordered), f) +} + +// NewFilter creates a new GtkTreeModel, with child_model as the child_model and +// root as the virtual root. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - root (optional): GtkTreePath. +// +// The function returns the following values: +// +// - treeModel: new GtkTreeModel. +func (childModel *TreeModel) NewFilter(root *TreePath) *TreeModel { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + var _cret *C.GtkTreeModel // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(childModel).Native())) + if root != nil { + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(root))) + } + + _cret = C.gtk_tree_model_filter_new(_arg0, _arg1) + runtime.KeepAlive(childModel) + runtime.KeepAlive(root) + + var _treeModel *TreeModel // out + + _treeModel = wrapTreeModel(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _treeModel +} + +// ForEach calls func on each node in model in a depth-first fashion. +// +// If func returns TRUE, then the tree ceases to be walked, and +// gtk_tree_model_foreach() returns. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - fn: function to be called on each row. +func (model *TreeModel) ForEach(fn TreeModelForEachFunc) { + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeModelForeachFunc // out + var _arg2 C.gpointer + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(model).Native())) + _arg1 = (*[0]byte)(C._gotk4_gtk4_TreeModelForEachFunc) + _arg2 = C.gpointer(gbox.Assign(fn)) + defer gbox.Delete(uintptr(_arg2)) + + C.gtk_tree_model_foreach(_arg0, _arg1, _arg2) + runtime.KeepAlive(model) + runtime.KeepAlive(fn) +} + +// ColumnType returns the type of the column. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - index_: column index. +// +// The function returns the following values: +// +// - gType: type of the column. +func (treeModel *TreeModel) ColumnType(index_ int) coreglib.Type { + var _arg0 *C.GtkTreeModel // out + var _arg1 C.int // out + var _cret C.GType // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = C.int(index_) + + _cret = C.gtk_tree_model_get_column_type(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(index_) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// Flags returns a set of flags supported by this interface. +// +// The flags are a bitwise combination of GtkTreeModelFlags. The flags supported +// should not change during the lifetime of the tree_model. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - treeModelFlags flags supported by this interface. +func (treeModel *TreeModel) Flags() TreeModelFlags { + var _arg0 *C.GtkTreeModel // out + var _cret C.GtkTreeModelFlags // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + + _cret = C.gtk_tree_model_get_flags(_arg0) + runtime.KeepAlive(treeModel) + + var _treeModelFlags TreeModelFlags // out + + _treeModelFlags = TreeModelFlags(_cret) + + return _treeModelFlags +} + +// Iter sets iter to a valid iterator pointing to path. +// +// If path does not exist, iter is set to an invalid iterator and FALSE is +// returned. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath. +// +// The function returns the following values: +// +// - iter: uninitialized GtkTreeIter. +// - ok: TRUE, if iter was set. +func (treeModel *TreeModel) Iter(path *TreePath) (*TreeIter, bool) { + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _arg2 *C.GtkTreePath // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg2 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C.gtk_tree_model_get_iter(_arg0, &_arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// IterFirst initializes iter with the first iterator in the tree (the one at +// the path "0"). +// +// Returns FALSE if the tree is empty, TRUE otherwise. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - iter: uninitialized GtkTreeIter. +// - ok: TRUE, if iter was set. +func (treeModel *TreeModel) IterFirst() (*TreeIter, bool) { + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + + _cret = C.gtk_tree_model_get_iter_first(_arg0, &_arg1) + runtime.KeepAlive(treeModel) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// IterFromString sets iter to a valid iterator pointing to path_string, +// if it exists. +// +// Otherwise, iter is left invalid and FALSE is returned. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - pathString: string representation of a GtkTreePath. +// +// The function returns the following values: +// +// - iter: uninitialized GtkTreeIter. +// - ok: TRUE, if iter was set. +func (treeModel *TreeModel) IterFromString(pathString string) (*TreeIter, bool) { + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _arg2 *C.char // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(pathString))) + defer C.free(unsafe.Pointer(_arg2)) + + _cret = C.gtk_tree_model_get_iter_from_string(_arg0, &_arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(pathString) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// NColumns returns the number of columns supported by tree_model. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - gint: number of columns. +func (treeModel *TreeModel) NColumns() int { + var _arg0 *C.GtkTreeModel // out + var _cret C.int // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + + _cret = C.gtk_tree_model_get_n_columns(_arg0) + runtime.KeepAlive(treeModel) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Path returns a newly-created GtkTreePath referenced by iter. +// +// This path should be freed with gtk_tree_path_free(). +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +// +// The function returns the following values: +// +// - treePath: newly-created GtkTreePath. +func (treeModel *TreeModel) Path(iter *TreeIter) *TreePath { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret *C.GtkTreePath // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C.gtk_tree_model_get_path(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _treePath *TreePath // out + + _treePath = (*TreePath)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_treePath)), + func(intern *struct{ C unsafe.Pointer }) { + C.gtk_tree_path_free((*C.GtkTreePath)(intern.C)) + }, + ) + + return _treePath +} + +// StringFromIter generates a string representation of the iter. +// +// This string is a “:” separated list of numbers. For example, “4:10:0:3” would +// be an acceptable return value for this string. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +// +// The function returns the following values: +// +// - utf8 (optional): newly-allocated string. +func (treeModel *TreeModel) StringFromIter(iter *TreeIter) string { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret *C.char // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C.gtk_tree_model_get_string_from_iter(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } + + return _utf8 +} + +// Value initializes and sets value to that at column. +// +// When done with value, g_value_unset() needs to be called to free any +// allocated memory. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +// - column to lookup the value at. +// +// The function returns the following values: +// +// - value: empty GValue to set. +func (treeModel *TreeModel) Value(iter *TreeIter, column int) coreglib.Value { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _arg2 C.int // out + var _arg3 C.GValue // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + _arg2 = C.int(column) + + C.gtk_tree_model_get_value(_arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + runtime.KeepAlive(column) + + var _value coreglib.Value // out + + _value = *coreglib.ValueFromNative(unsafe.Pointer((&_arg3))) + + return _value +} + +// IterChildren sets iter to point to the first child of parent. +// +// If parent has no children, FALSE is returned and iter is set to be invalid. +// parent will remain a valid node after this function has been called. +// +// If parent is NULL returns the first node, equivalent to +// gtk_tree_model_get_iter_first (tree_model, iter); +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - parent (optional): GtkTreeIter. +// +// The function returns the following values: +// +// - iter: new GtkTreeIter to be set to the child. +// - ok: TRUE, if iter has been set to the first child. +func (treeModel *TreeModel) IterChildren(parent *TreeIter) (*TreeIter, bool) { + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _arg2 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + if parent != nil { + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(parent))) + } + + _cret = C.gtk_tree_model_iter_children(_arg0, &_arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(parent) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// IterHasChild returns TRUE if iter has children, FALSE otherwise. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter to test for children. +// +// The function returns the following values: +// +// - ok: TRUE if iter has children. +func (treeModel *TreeModel) IterHasChild(iter *TreeIter) bool { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C.gtk_tree_model_iter_has_child(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IterNChildren returns the number of children that iter has. +// +// As a special case, if iter is NULL, then the number of toplevel nodes is +// returned. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter (optional): GtkTreeIter. +// +// The function returns the following values: +// +// - gint: number of children of iter. +func (treeModel *TreeModel) IterNChildren(iter *TreeIter) int { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret C.int // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + if iter != nil { + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + } + + _cret = C.gtk_tree_model_iter_n_children(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// IterNext sets iter to point to the node following it at the current level. +// +// If there is no next iter, FALSE is returned and iter is set to be invalid. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +// +// The function returns the following values: +// +// - ok: TRUE if iter has been changed to the next node. +func (treeModel *TreeModel) IterNext(iter *TreeIter) bool { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C.gtk_tree_model_iter_next(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// IterNthChild sets iter to be the child of parent, using the given index. +// +// The first index is 0. If n is too big, or parent has no children, iter is set +// to an invalid iterator and FALSE is returned. parent will remain a valid node +// after this function has been called. As a special case, if parent is NULL, +// then the n-th root node is set. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - parent (optional): GtkTreeIter to get the child from. +// - n: index of the desired child. +// +// The function returns the following values: +// +// - iter: GtkTreeIter to set to the nth child. +// - ok: TRUE, if parent has an n-th child. +func (treeModel *TreeModel) IterNthChild(parent *TreeIter, n int) (*TreeIter, bool) { + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _arg2 *C.GtkTreeIter // out + var _arg3 C.int // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + if parent != nil { + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(parent))) + } + _arg3 = C.int(n) + + _cret = C.gtk_tree_model_iter_nth_child(_arg0, &_arg1, _arg2, _arg3) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(parent) + runtime.KeepAlive(n) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// IterParent sets iter to be the parent of child. +// +// If child is at the toplevel, and doesn’t have a parent, then iter is set to +// an invalid iterator and FALSE is returned. child will remain a valid node +// after this function has been called. +// +// iter will be initialized before the lookup is performed, so child and iter +// cannot point to the same memory location. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - child: GtkTreeIter. +// +// The function returns the following values: +// +// - iter: new GtkTreeIter to set to the parent. +// - ok: TRUE, if iter is set to the parent of child. +func (treeModel *TreeModel) IterParent(child *TreeIter) (*TreeIter, bool) { + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _arg2 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(child))) + + _cret = C.gtk_tree_model_iter_parent(_arg0, &_arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(child) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// IterPrevious sets iter to point to the previous node at the current level. +// +// If there is no previous iter, FALSE is returned and iter is set to be +// invalid. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +// +// The function returns the following values: +// +// - ok: TRUE if iter has been changed to the previous node. +func (treeModel *TreeModel) IterPrevious(iter *TreeIter) bool { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C.gtk_tree_model_iter_previous(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// RefNode lets the tree ref the node. +// +// This is an optional method for models to implement. To be more specific, +// models may ignore this call as it exists primarily for performance reasons. +// +// This function is primarily meant as a way for views to let caching models +// know when nodes are being displayed (and hence, whether or not to cache that +// node). Being displayed means a node is in an expanded branch, regardless +// of whether the node is currently visible in the viewport. For example, +// a file-system based model would not want to keep the entire file-hierarchy in +// memory, just the sections that are currently being displayed by every current +// view. +// +// A model should be expected to be able to get an iter independent of its +// reffed state. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +func (treeModel *TreeModel) RefNode(iter *TreeIter) { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C.gtk_tree_model_ref_node(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) +} + +// RowChanged emits the ::row-changed signal on tree_model. +// +// See gtk.TreeModel::row-changed. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath pointing to the changed row. +// - iter: valid GtkTreeIter pointing to the changed row. +func (treeModel *TreeModel) RowChanged(path *TreePath, iter *TreeIter) { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C.gtk_tree_model_row_changed(_arg0, _arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + runtime.KeepAlive(iter) +} + +// RowDeleted emits the ::row-deleted signal on tree_model. +// +// See gtk.TreeModel::row-deleted. +// +// This should be called by models after a row has been removed. The location +// pointed to by path should be the location that the row previously was at. +// It may not be a valid location anymore. +// +// Nodes that are deleted are not unreffed, this means that any outstanding +// references on the deleted node should not be released. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath pointing to the previous location of the deleted row. +func (treeModel *TreeModel) RowDeleted(path *TreePath) { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + C.gtk_tree_model_row_deleted(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) +} + +// RowHasChildToggled emits the ::row-has-child-toggled signal on tree_model. +// +// See gtk.TreeModel::row-has-child-toggled. +// +// This should be called by models after the child state of a node changes. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath pointing to the changed row. +// - iter: valid GtkTreeIter pointing to the changed row. +func (treeModel *TreeModel) RowHasChildToggled(path *TreePath, iter *TreeIter) { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C.gtk_tree_model_row_has_child_toggled(_arg0, _arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + runtime.KeepAlive(iter) +} + +// RowInserted emits the ::row-inserted signal on tree_model. +// +// See gtk.TreeModel::row-inserted. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath pointing to the inserted row. +// - iter: valid GtkTreeIter pointing to the inserted row. +func (treeModel *TreeModel) RowInserted(path *TreePath, iter *TreeIter) { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C.gtk_tree_model_row_inserted(_arg0, _arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + runtime.KeepAlive(iter) +} + +// RowsReordered emits the ::rows-reordered signal on tree_model. +// +// See gtk.TreeModel::rows-reordered. +// +// This should be called by models when their rows have been reordered. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath pointing to the tree node whose children have been +// reordered. +// - iter (optional): valid GtkTreeIter pointing to the node whose children +// have been reordered, or NULL if the depth of path is 0. +// - newOrder: array of integers mapping the current position of each child to +// its old position before the re-ordering, i.e. new_order[newpos] = oldpos. +func (treeModel *TreeModel) RowsReordered(path *TreePath, iter *TreeIter, newOrder []int) { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GtkTreeIter // out + var _arg3 *C.int // out + var _arg4 C.int + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + if iter != nil { + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + } + _arg4 = (C.int)(len(newOrder)) + _arg3 = (*C.int)(C.calloc(C.size_t(len(newOrder)), C.size_t(C.sizeof_int))) + defer C.free(unsafe.Pointer(_arg3)) + { + out := unsafe.Slice((*C.int)(_arg3), len(newOrder)) + for i := range newOrder { + out[i] = C.int(newOrder[i]) + } + } + + C.gtk_tree_model_rows_reordered_with_length(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + runtime.KeepAlive(iter) + runtime.KeepAlive(newOrder) +} + +// UnrefNode lets the tree unref the node. +// +// This is an optional method for models to implement. To be more specific, +// models may ignore this call as it exists primarily for performance reasons. +// For more information on what this means, see gtk_tree_model_ref_node(). +// +// Please note that nodes that are deleted are not unreffed. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +func (treeModel *TreeModel) UnrefNode(iter *TreeIter) { + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C.gtk_tree_model_unref_node(_arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) +} + +// columnType returns the type of the column. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - index_: column index. +// +// The function returns the following values: +// +// - gType: type of the column. +func (treeModel *TreeModel) columnType(index_ int) coreglib.Type { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.get_column_type + + var _arg0 *C.GtkTreeModel // out + var _arg1 C.int // out + var _cret C.GType // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = C.int(index_) + + _cret = C._gotk4_gtk4_TreeModel_virtual_get_column_type(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(index_) + + var _gType coreglib.Type // out + + _gType = coreglib.Type(_cret) + + return _gType +} + +// Flags returns a set of flags supported by this interface. +// +// The flags are a bitwise combination of GtkTreeModelFlags. The flags supported +// should not change during the lifetime of the tree_model. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - treeModelFlags flags supported by this interface. +func (treeModel *TreeModel) flags() TreeModelFlags { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.get_flags + + var _arg0 *C.GtkTreeModel // out + var _cret C.GtkTreeModelFlags // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + + _cret = C._gotk4_gtk4_TreeModel_virtual_get_flags(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(treeModel) + + var _treeModelFlags TreeModelFlags // out + + _treeModelFlags = TreeModelFlags(_cret) + + return _treeModelFlags +} + +// Iter sets iter to a valid iterator pointing to path. +// +// If path does not exist, iter is set to an invalid iterator and FALSE is +// returned. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath. +// +// The function returns the following values: +// +// - iter: uninitialized GtkTreeIter. +// - ok: TRUE, if iter was set. +func (treeModel *TreeModel) iter(path *TreePath) (*TreeIter, bool) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.get_iter + + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _arg2 *C.GtkTreePath // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg2 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + _cret = C._gotk4_gtk4_TreeModel_virtual_get_iter(unsafe.Pointer(fnarg), _arg0, &_arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// nColumns returns the number of columns supported by tree_model. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - gint: number of columns. +func (treeModel *TreeModel) nColumns() int { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.get_n_columns + + var _arg0 *C.GtkTreeModel // out + var _cret C.int // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + + _cret = C._gotk4_gtk4_TreeModel_virtual_get_n_columns(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(treeModel) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Path returns a newly-created GtkTreePath referenced by iter. +// +// This path should be freed with gtk_tree_path_free(). +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +// +// The function returns the following values: +// +// - treePath: newly-created GtkTreePath. +func (treeModel *TreeModel) path(iter *TreeIter) *TreePath { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.get_path + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret *C.GtkTreePath // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C._gotk4_gtk4_TreeModel_virtual_get_path(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _treePath *TreePath // out + + _treePath = (*TreePath)(gextras.NewStructNative(unsafe.Pointer(_cret))) + runtime.SetFinalizer( + gextras.StructIntern(unsafe.Pointer(_treePath)), + func(intern *struct{ C unsafe.Pointer }) { + C.gtk_tree_path_free((*C.GtkTreePath)(intern.C)) + }, + ) + + return _treePath +} + +// Value initializes and sets value to that at column. +// +// When done with value, g_value_unset() needs to be called to free any +// allocated memory. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +// - column to lookup the value at. +// +// The function returns the following values: +// +// - value: empty GValue to set. +func (treeModel *TreeModel) value(iter *TreeIter, column int) coreglib.Value { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.get_value + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _arg2 C.int // out + var _arg3 C.GValue // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + _arg2 = C.int(column) + + C._gotk4_gtk4_TreeModel_virtual_get_value(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, &_arg3) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + runtime.KeepAlive(column) + + var _value coreglib.Value // out + + _value = *coreglib.ValueFromNative(unsafe.Pointer((&_arg3))) + + return _value +} + +// iterChildren sets iter to point to the first child of parent. +// +// If parent has no children, FALSE is returned and iter is set to be invalid. +// parent will remain a valid node after this function has been called. +// +// If parent is NULL returns the first node, equivalent to +// gtk_tree_model_get_iter_first (tree_model, iter); +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - parent (optional): GtkTreeIter. +// +// The function returns the following values: +// +// - iter: new GtkTreeIter to be set to the child. +// - ok: TRUE, if iter has been set to the first child. +func (treeModel *TreeModel) iterChildren(parent *TreeIter) (*TreeIter, bool) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.iter_children + + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _arg2 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + if parent != nil { + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(parent))) + } + + _cret = C._gotk4_gtk4_TreeModel_virtual_iter_children(unsafe.Pointer(fnarg), _arg0, &_arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(parent) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// iterHasChild returns TRUE if iter has children, FALSE otherwise. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter to test for children. +// +// The function returns the following values: +// +// - ok: TRUE if iter has children. +func (treeModel *TreeModel) iterHasChild(iter *TreeIter) bool { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.iter_has_child + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C._gotk4_gtk4_TreeModel_virtual_iter_has_child(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// iterNChildren returns the number of children that iter has. +// +// As a special case, if iter is NULL, then the number of toplevel nodes is +// returned. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter (optional): GtkTreeIter. +// +// The function returns the following values: +// +// - gint: number of children of iter. +func (treeModel *TreeModel) iterNChildren(iter *TreeIter) int { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.iter_n_children + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret C.int // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + if iter != nil { + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + } + + _cret = C._gotk4_gtk4_TreeModel_virtual_iter_n_children(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// iterNext sets iter to point to the node following it at the current level. +// +// If there is no next iter, FALSE is returned and iter is set to be invalid. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +// +// The function returns the following values: +// +// - ok: TRUE if iter has been changed to the next node. +func (treeModel *TreeModel) iterNext(iter *TreeIter) bool { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.iter_next + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C._gotk4_gtk4_TreeModel_virtual_iter_next(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// iterNthChild sets iter to be the child of parent, using the given index. +// +// The first index is 0. If n is too big, or parent has no children, iter is set +// to an invalid iterator and FALSE is returned. parent will remain a valid node +// after this function has been called. As a special case, if parent is NULL, +// then the n-th root node is set. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - parent (optional): GtkTreeIter to get the child from. +// - n: index of the desired child. +// +// The function returns the following values: +// +// - iter: GtkTreeIter to set to the nth child. +// - ok: TRUE, if parent has an n-th child. +func (treeModel *TreeModel) iterNthChild(parent *TreeIter, n int) (*TreeIter, bool) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.iter_nth_child + + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _arg2 *C.GtkTreeIter // out + var _arg3 C.int // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + if parent != nil { + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(parent))) + } + _arg3 = C.int(n) + + _cret = C._gotk4_gtk4_TreeModel_virtual_iter_nth_child(unsafe.Pointer(fnarg), _arg0, &_arg1, _arg2, _arg3) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(parent) + runtime.KeepAlive(n) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// iterParent sets iter to be the parent of child. +// +// If child is at the toplevel, and doesn’t have a parent, then iter is set to +// an invalid iterator and FALSE is returned. child will remain a valid node +// after this function has been called. +// +// iter will be initialized before the lookup is performed, so child and iter +// cannot point to the same memory location. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - child: GtkTreeIter. +// +// The function returns the following values: +// +// - iter: new GtkTreeIter to set to the parent. +// - ok: TRUE, if iter is set to the parent of child. +func (treeModel *TreeModel) iterParent(child *TreeIter) (*TreeIter, bool) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.iter_parent + + var _arg0 *C.GtkTreeModel // out + var _arg1 C.GtkTreeIter // in + var _arg2 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(child))) + + _cret = C._gotk4_gtk4_TreeModel_virtual_iter_parent(unsafe.Pointer(fnarg), _arg0, &_arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(child) + + var _iter *TreeIter // out + var _ok bool // out + + _iter = (*TreeIter)(gextras.NewStructNative(unsafe.Pointer((&_arg1)))) + if _cret != 0 { + _ok = true + } + + return _iter, _ok +} + +// iterPrevious sets iter to point to the previous node at the current level. +// +// If there is no previous iter, FALSE is returned and iter is set to be +// invalid. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +// +// The function returns the following values: +// +// - ok: TRUE if iter has been changed to the previous node. +func (treeModel *TreeModel) iterPrevious(iter *TreeIter) bool { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.iter_previous + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + _cret = C._gotk4_gtk4_TreeModel_virtual_iter_previous(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// refNode lets the tree ref the node. +// +// This is an optional method for models to implement. To be more specific, +// models may ignore this call as it exists primarily for performance reasons. +// +// This function is primarily meant as a way for views to let caching models +// know when nodes are being displayed (and hence, whether or not to cache that +// node). Being displayed means a node is in an expanded branch, regardless +// of whether the node is currently visible in the viewport. For example, +// a file-system based model would not want to keep the entire file-hierarchy in +// memory, just the sections that are currently being displayed by every current +// view. +// +// A model should be expected to be able to get an iter independent of its +// reffed state. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +func (treeModel *TreeModel) refNode(iter *TreeIter) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.ref_node + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C._gotk4_gtk4_TreeModel_virtual_ref_node(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) +} + +// rowChanged emits the ::row-changed signal on tree_model. +// +// See gtk.TreeModel::row-changed. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath pointing to the changed row. +// - iter: valid GtkTreeIter pointing to the changed row. +func (treeModel *TreeModel) rowChanged(path *TreePath, iter *TreeIter) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.row_changed + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C._gotk4_gtk4_TreeModel_virtual_row_changed(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + runtime.KeepAlive(iter) +} + +// rowDeleted emits the ::row-deleted signal on tree_model. +// +// See gtk.TreeModel::row-deleted. +// +// This should be called by models after a row has been removed. The location +// pointed to by path should be the location that the row previously was at. +// It may not be a valid location anymore. +// +// Nodes that are deleted are not unreffed, this means that any outstanding +// references on the deleted node should not be released. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath pointing to the previous location of the deleted row. +func (treeModel *TreeModel) rowDeleted(path *TreePath) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.row_deleted + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + + C._gotk4_gtk4_TreeModel_virtual_row_deleted(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) +} + +// rowHasChildToggled emits the ::row-has-child-toggled signal on tree_model. +// +// See gtk.TreeModel::row-has-child-toggled. +// +// This should be called by models after the child state of a node changes. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath pointing to the changed row. +// - iter: valid GtkTreeIter pointing to the changed row. +func (treeModel *TreeModel) rowHasChildToggled(path *TreePath, iter *TreeIter) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.row_has_child_toggled + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C._gotk4_gtk4_TreeModel_virtual_row_has_child_toggled(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + runtime.KeepAlive(iter) +} + +// rowInserted emits the ::row-inserted signal on tree_model. +// +// See gtk.TreeModel::row-inserted. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - path: GtkTreePath pointing to the inserted row. +// - iter: valid GtkTreeIter pointing to the inserted row. +func (treeModel *TreeModel) rowInserted(path *TreePath, iter *TreeIter) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.row_inserted + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreePath // out + var _arg2 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreePath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C._gotk4_gtk4_TreeModel_virtual_row_inserted(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(path) + runtime.KeepAlive(iter) +} + +// unrefNode lets the tree unref the node. +// +// This is an optional method for models to implement. To be more specific, +// models may ignore this call as it exists primarily for performance reasons. +// For more information on what this means, see gtk_tree_model_ref_node(). +// +// Please note that nodes that are deleted are not unreffed. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - iter: GtkTreeIter. +func (treeModel *TreeModel) unrefNode(iter *TreeIter) { + gclass := (*C.GtkTreeModelIface)(coreglib.PeekParentClass(treeModel)) + fnarg := gclass.unref_node + + var _arg0 *C.GtkTreeModel // out + var _arg1 *C.GtkTreeIter // out + + _arg0 = (*C.GtkTreeModel)(unsafe.Pointer(coreglib.InternObject(treeModel).Native())) + _arg1 = (*C.GtkTreeIter)(gextras.StructNative(unsafe.Pointer(iter))) + + C._gotk4_gtk4_TreeModel_virtual_unref_node(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(treeModel) + runtime.KeepAlive(iter) +} + +// TreeSortable: interface for sortable models used by GtkTreeView +// +// GtkTreeSortable is an interface to be implemented by tree models which +// support sorting. The GtkTreeView uses the methods provided by this interface +// to sort the model. +// +// Deprecated: There is no replacement for this interface. You should use +// gtk.SortListModel to wrap your list model instead. +// +// TreeSortable wraps an interface. This means the user can get the +// underlying type by calling Cast(). +type TreeSortable struct { + _ [0]func() // equal guard + TreeModel +} + +var () + +// TreeSortabler describes TreeSortable's interface methods. +type TreeSortabler interface { + coreglib.Objector + + // SortColumnID fills in sort_column_id and order with the current sort + // column and the order. + SortColumnID() (int, SortType, bool) + // HasDefaultSortFunc returns TRUE if the model has a default sort function. + HasDefaultSortFunc() bool + // SetDefaultSortFunc sets the default comparison function used when sorting + // to be sort_func. + SetDefaultSortFunc(sortFunc TreeIterCompareFunc) + // SetSortColumnID sets the current sort column to be sort_column_id. + SetSortColumnID(sortColumnId int, order SortType) + // SetSortFunc sets the comparison function used when sorting to be + // sort_func. + SetSortFunc(sortColumnId int, sortFunc TreeIterCompareFunc) + // SortColumnChanged emits a GtkTreeSortable::sort-column-changed signal on + // sortable. + SortColumnChanged() + + // Sort-column-changed signal is emitted when the sort column or sort order + // of sortable is changed. + ConnectSortColumnChanged(func()) coreglib.SignalHandle +} + +var _ TreeSortabler = (*TreeSortable)(nil) + +func wrapTreeSortable(obj *coreglib.Object) *TreeSortable { + return &TreeSortable{ + TreeModel: TreeModel{ + Object: obj, + }, + } +} + +func marshalTreeSortable(p uintptr) (interface{}, error) { + return wrapTreeSortable(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectSortColumnChanged signal is emitted when the sort column or sort order +// of sortable is changed. The signal is emitted before the contents of sortable +// are resorted. +func (sortable *TreeSortable) ConnectSortColumnChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(sortable, "sort-column-changed", false, unsafe.Pointer(C._gotk4_gtk4_TreeSortable_ConnectSortColumnChanged), f) +} + +// SortColumnID fills in sort_column_id and order with the +// current sort column and the order. It returns TRUE unless the +// sort_column_id is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or +// GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - sortColumnId: sort column id to be filled in. +// - order: GtkSortType to be filled in. +// - ok: TRUE if the sort column is not one of the special sort column ids. +func (sortable *TreeSortable) SortColumnID() (int, SortType, bool) { + var _arg0 *C.GtkTreeSortable // out + var _arg1 C.int // in + var _arg2 C.GtkSortType // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + + _cret = C.gtk_tree_sortable_get_sort_column_id(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(sortable) + + var _sortColumnId int // out + var _order SortType // out + var _ok bool // out + + _sortColumnId = int(_arg1) + _order = SortType(_arg2) + if _cret != 0 { + _ok = true + } + + return _sortColumnId, _order, _ok +} + +// HasDefaultSortFunc returns TRUE if the model has a default sort function. +// This is used primarily by GtkTreeViewColumns in order to determine if a model +// can go back to the default state, or not. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - ok: TRUE, if the model has a default sort function. +func (sortable *TreeSortable) HasDefaultSortFunc() bool { + var _arg0 *C.GtkTreeSortable // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + + _cret = C.gtk_tree_sortable_has_default_sort_func(_arg0) + runtime.KeepAlive(sortable) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetDefaultSortFunc sets the default comparison function used when +// sorting to be sort_func. If the current sort column id of sortable is +// GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using this +// function. +// +// If sort_func is NULL, then there will be no default comparison function. +// This means that once the model has been sorted, it can’t go back to the +// default state. In this case, when the current sort column id of sortable is +// GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - sortFunc: comparison function. +func (sortable *TreeSortable) SetDefaultSortFunc(sortFunc TreeIterCompareFunc) { + var _arg0 *C.GtkTreeSortable // out + var _arg1 C.GtkTreeIterCompareFunc // out + var _arg2 C.gpointer + var _arg3 C.GDestroyNotify + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + _arg1 = (*[0]byte)(C._gotk4_gtk4_TreeIterCompareFunc) + _arg2 = C.gpointer(gbox.Assign(sortFunc)) + _arg3 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + + C.gtk_tree_sortable_set_default_sort_func(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(sortable) + runtime.KeepAlive(sortFunc) +} + +// SetSortColumnID sets the current sort column to be sort_column_id. +// The sortable will resort itself to reflect this change, after emitting a +// GtkTreeSortable::sort-column-changed signal. sort_column_id may either be a +// regular column id, or one of the following special values: +// +// - GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID: the default sort function will be +// used, if it is set +// +// - GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - sortColumnId: sort column id to set. +// - order: sort order of the column. +func (sortable *TreeSortable) SetSortColumnID(sortColumnId int, order SortType) { + var _arg0 *C.GtkTreeSortable // out + var _arg1 C.int // out + var _arg2 C.GtkSortType // out + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + _arg1 = C.int(sortColumnId) + _arg2 = C.GtkSortType(order) + + C.gtk_tree_sortable_set_sort_column_id(_arg0, _arg1, _arg2) + runtime.KeepAlive(sortable) + runtime.KeepAlive(sortColumnId) + runtime.KeepAlive(order) +} + +// SetSortFunc sets the comparison function used when sorting to be sort_func. +// If the current sort column id of sortable is the same as sort_column_id, +// then the model will sort using this function. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - sortColumnId: sort column id to set the function for. +// - sortFunc: comparison function. +func (sortable *TreeSortable) SetSortFunc(sortColumnId int, sortFunc TreeIterCompareFunc) { + var _arg0 *C.GtkTreeSortable // out + var _arg1 C.int // out + var _arg2 C.GtkTreeIterCompareFunc // out + var _arg3 C.gpointer + var _arg4 C.GDestroyNotify + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + _arg1 = C.int(sortColumnId) + _arg2 = (*[0]byte)(C._gotk4_gtk4_TreeIterCompareFunc) + _arg3 = C.gpointer(gbox.Assign(sortFunc)) + _arg4 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + + C.gtk_tree_sortable_set_sort_func(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(sortable) + runtime.KeepAlive(sortColumnId) + runtime.KeepAlive(sortFunc) +} + +// SortColumnChanged emits a GtkTreeSortable::sort-column-changed signal on +// sortable. +// +// Deprecated: since version 4.10. +func (sortable *TreeSortable) SortColumnChanged() { + var _arg0 *C.GtkTreeSortable // out + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + + C.gtk_tree_sortable_sort_column_changed(_arg0) + runtime.KeepAlive(sortable) +} + +// sortColumnID fills in sort_column_id and order with the +// current sort column and the order. It returns TRUE unless the +// sort_column_id is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID or +// GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - sortColumnId: sort column id to be filled in. +// - order: GtkSortType to be filled in. +// - ok: TRUE if the sort column is not one of the special sort column ids. +func (sortable *TreeSortable) sortColumnID() (int, SortType, bool) { + gclass := (*C.GtkTreeSortableIface)(coreglib.PeekParentClass(sortable)) + fnarg := gclass.get_sort_column_id + + var _arg0 *C.GtkTreeSortable // out + var _arg1 C.int // in + var _arg2 C.GtkSortType // in + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + + _cret = C._gotk4_gtk4_TreeSortable_virtual_get_sort_column_id(unsafe.Pointer(fnarg), _arg0, &_arg1, &_arg2) + runtime.KeepAlive(sortable) + + var _sortColumnId int // out + var _order SortType // out + var _ok bool // out + + _sortColumnId = int(_arg1) + _order = SortType(_arg2) + if _cret != 0 { + _ok = true + } + + return _sortColumnId, _order, _ok +} + +// hasDefaultSortFunc returns TRUE if the model has a default sort function. +// This is used primarily by GtkTreeViewColumns in order to determine if a model +// can go back to the default state, or not. +// +// Deprecated: since version 4.10. +// +// The function returns the following values: +// +// - ok: TRUE, if the model has a default sort function. +func (sortable *TreeSortable) hasDefaultSortFunc() bool { + gclass := (*C.GtkTreeSortableIface)(coreglib.PeekParentClass(sortable)) + fnarg := gclass.has_default_sort_func + + var _arg0 *C.GtkTreeSortable // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + + _cret = C._gotk4_gtk4_TreeSortable_virtual_has_default_sort_func(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(sortable) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// setDefaultSortFunc sets the default comparison function used when +// sorting to be sort_func. If the current sort column id of sortable is +// GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using this +// function. +// +// If sort_func is NULL, then there will be no default comparison function. +// This means that once the model has been sorted, it can’t go back to the +// default state. In this case, when the current sort column id of sortable is +// GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - sortFunc: comparison function. +func (sortable *TreeSortable) setDefaultSortFunc(sortFunc TreeIterCompareFunc) { + gclass := (*C.GtkTreeSortableIface)(coreglib.PeekParentClass(sortable)) + fnarg := gclass.set_default_sort_func + + var _arg0 *C.GtkTreeSortable // out + var _arg1 C.GtkTreeIterCompareFunc // out + var _arg2 C.gpointer + var _arg3 C.GDestroyNotify + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + _arg1 = (*[0]byte)(C._gotk4_gtk4_TreeIterCompareFunc) + _arg2 = C.gpointer(gbox.Assign(sortFunc)) + _arg3 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + + C._gotk4_gtk4_TreeSortable_virtual_set_default_sort_func(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(sortable) + runtime.KeepAlive(sortFunc) +} + +// setSortColumnID sets the current sort column to be sort_column_id. +// The sortable will resort itself to reflect this change, after emitting a +// GtkTreeSortable::sort-column-changed signal. sort_column_id may either be a +// regular column id, or one of the following special values: +// +// - GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID: the default sort function will be +// used, if it is set +// +// - GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - sortColumnId: sort column id to set. +// - order: sort order of the column. +func (sortable *TreeSortable) setSortColumnID(sortColumnId int, order SortType) { + gclass := (*C.GtkTreeSortableIface)(coreglib.PeekParentClass(sortable)) + fnarg := gclass.set_sort_column_id + + var _arg0 *C.GtkTreeSortable // out + var _arg1 C.int // out + var _arg2 C.GtkSortType // out + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + _arg1 = C.int(sortColumnId) + _arg2 = C.GtkSortType(order) + + C._gotk4_gtk4_TreeSortable_virtual_set_sort_column_id(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2) + runtime.KeepAlive(sortable) + runtime.KeepAlive(sortColumnId) + runtime.KeepAlive(order) +} + +// setSortFunc sets the comparison function used when sorting to be sort_func. +// If the current sort column id of sortable is the same as sort_column_id, +// then the model will sort using this function. +// +// Deprecated: since version 4.10. +// +// The function takes the following parameters: +// +// - sortColumnId: sort column id to set the function for. +// - sortFunc: comparison function. +func (sortable *TreeSortable) setSortFunc(sortColumnId int, sortFunc TreeIterCompareFunc) { + gclass := (*C.GtkTreeSortableIface)(coreglib.PeekParentClass(sortable)) + fnarg := gclass.set_sort_func + + var _arg0 *C.GtkTreeSortable // out + var _arg1 C.int // out + var _arg2 C.GtkTreeIterCompareFunc // out + var _arg3 C.gpointer + var _arg4 C.GDestroyNotify + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + _arg1 = C.int(sortColumnId) + _arg2 = (*[0]byte)(C._gotk4_gtk4_TreeIterCompareFunc) + _arg3 = C.gpointer(gbox.Assign(sortFunc)) + _arg4 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + + C._gotk4_gtk4_TreeSortable_virtual_set_sort_func(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(sortable) + runtime.KeepAlive(sortColumnId) + runtime.KeepAlive(sortFunc) +} + +// sortColumnChanged emits a GtkTreeSortable::sort-column-changed signal on +// sortable. +// +// Deprecated: since version 4.10. +func (sortable *TreeSortable) sortColumnChanged() { + gclass := (*C.GtkTreeSortableIface)(coreglib.PeekParentClass(sortable)) + fnarg := gclass.sort_column_changed + + var _arg0 *C.GtkTreeSortable // out + + _arg0 = (*C.GtkTreeSortable)(unsafe.Pointer(coreglib.InternObject(sortable).Native())) + + C._gotk4_gtk4_TreeSortable_virtual_sort_column_changed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(sortable) +} + +// ATContext: GtkATContext is an abstract class provided by GTK to communicate +// to platform-specific assistive technologies API. +// +// Each platform supported by GTK implements a GtkATContext subclass, and is +// responsible for updating the accessible state in response to state changes in +// GtkAccessible. +type ATContext struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*ATContext)(nil) +) + +// ATContexter describes types inherited from class ATContext. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type ATContexter interface { + coreglib.Objector + baseATContext() *ATContext +} + +var _ ATContexter = (*ATContext)(nil) + +func wrapATContext(obj *coreglib.Object) *ATContext { + return &ATContext{ + Object: obj, + } +} + +func marshalATContext(p uintptr) (interface{}, error) { + return wrapATContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +func (self *ATContext) baseATContext() *ATContext { + return self +} + +// BaseATContext returns the underlying base object. +func BaseATContext(obj ATContexter) *ATContext { + return obj.baseATContext() +} + +// ConnectStateChange is emitted when the attributes of the accessible for the +// GtkATContext instance change. +func (self *ATContext) ConnectStateChange(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(self, "state-change", false, unsafe.Pointer(C._gotk4_gtk4_ATContext_ConnectStateChange), f) +} + +// NewATContextCreate creates a new GtkATContext instance for the given +// accessible role, accessible instance, and display connection. +// +// The GtkATContext implementation being instantiated will depend on the +// platform. +// +// The function takes the following parameters: +// +// - accessibleRole: accessible role used by the GtkATContext. +// - accessible: GtkAccessible implementation using the GtkATContext. +// - display: GdkDisplay used by the GtkATContext. +// +// The function returns the following values: +// +// - atContext (optional): GtkATContext. +func NewATContextCreate(accessibleRole AccessibleRole, accessible Accessibler, display *gdk.Display) *ATContext { + var _arg1 C.GtkAccessibleRole // out + var _arg2 *C.GtkAccessible // out + var _arg3 *C.GdkDisplay // out + var _cret *C.GtkATContext // in + + _arg1 = C.GtkAccessibleRole(accessibleRole) + _arg2 = (*C.GtkAccessible)(unsafe.Pointer(coreglib.InternObject(accessible).Native())) + _arg3 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gtk_at_context_create(_arg1, _arg2, _arg3) + runtime.KeepAlive(accessibleRole) + runtime.KeepAlive(accessible) + runtime.KeepAlive(display) + + var _atContext *ATContext // out + + if _cret != nil { + _atContext = wrapATContext(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } + + return _atContext +} + +// Accessible retrieves the GtkAccessible using this context. +// +// The function returns the following values: +// +// - accessible: GtkAccessible. +func (self *ATContext) Accessible() *Accessible { + var _arg0 *C.GtkATContext // out + var _cret *C.GtkAccessible // in + + _arg0 = (*C.GtkATContext)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_at_context_get_accessible(_arg0) + runtime.KeepAlive(self) + + var _accessible *Accessible // out + + _accessible = wrapAccessible(coreglib.Take(unsafe.Pointer(_cret))) + + return _accessible +} + +// AccessibleRole retrieves the accessible role of this context. +// +// The function returns the following values: +// +// - accessibleRole: GtkAccessibleRole. +func (self *ATContext) AccessibleRole() AccessibleRole { + var _arg0 *C.GtkATContext // out + var _cret C.GtkAccessibleRole // in + + _arg0 = (*C.GtkATContext)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_at_context_get_accessible_role(_arg0) + runtime.KeepAlive(self) + + var _accessibleRole AccessibleRole // out + + _accessibleRole = AccessibleRole(_cret) + + return _accessibleRole +} + +// AboutDialog: GtkAboutDialog offers a simple way to display information about +// a program. +// +// The shown information includes the programs' logo, name, copyright, website +// and license. It is also possible to give credits to the authors, documenters, +// translators and artists who have worked on the program. +// +// An about dialog is typically opened when the user selects the About option +// from the Help menu. All parts of the dialog are optional. +// +// !An example GtkAboutDialog (aboutdialog.png) +// +// About dialogs often contain links and email addresses. +// GtkAboutDialog displays these as clickable links. By default, it calls +// gtk.FileLauncher.Launch() when a user clicks one. The behaviour can be +// overridden with the gtk.AboutDialog::activate-link signal. +// +// To specify a person with an email address, use a string like Edgar Allan Poe +// . To specify a website with a title, use a string like GTK team +// https://www.gtk.org. +// +// To make constructing a GtkAboutDialog as convenient as possible, you can use +// the function gtk.ShowAboutDialog() which constructs and shows a dialog and +// keeps it around so that it can be shown again. +// +// Note that GTK sets a default title of _("About s") on the dialog window +// (where s is replaced by the name of the application, but in order to ensure +// proper translation of the title, applications should set the title property +// explicitly when constructing a GtkAboutDialog, as shown in the following +// example: +// +// GFile *logo_file = g_file_new_for_path ("./logo.png"); +// GdkTexture *example_logo = gdk_texture_new_from_file (logo_file, NULL); +// g_object_unref (logo_file); +// +// gtk_show_about_dialog (NULL, +// "program-name", "ExampleCode", +// "logo", example_logo, +// "title", _("About ExampleCode"), +// NULL); +// +// # CSS nodes +// +// GtkAboutDialog has a single CSS node with the name window and style class +// .aboutdialog. +type AboutDialog struct { + _ [0]func() // equal guard + Window +} + +var ( + _ Widgetter = (*AboutDialog)(nil) + _ coreglib.Objector = (*AboutDialog)(nil) +) + +func wrapAboutDialog(obj *coreglib.Object) *AboutDialog { + return &AboutDialog{ + Window: Window{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + Object: obj, + Root: Root{ + NativeSurface: NativeSurface{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + }, + }, + ShortcutManager: ShortcutManager{ + Object: obj, + }, + }, + } +} + +func marshalAboutDialog(p uintptr) (interface{}, error) { + return wrapAboutDialog(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectActivateLink is emitted every time a URL is activated. +// +// Applications may connect to it to override the default behaviour, which is to +// call gtk.FileLauncher.Launch(). +func (about *AboutDialog) ConnectActivateLink(f func(uri string) (ok bool)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(about, "activate-link", false, unsafe.Pointer(C._gotk4_gtk4_AboutDialog_ConnectActivateLink), f) +} + +// NewAboutDialog creates a new GtkAboutDialog. +// +// The function returns the following values: +// +// - aboutDialog: newly created GtkAboutDialog. +func NewAboutDialog() *AboutDialog { + var _cret *C.GtkWidget // in + + _cret = C.gtk_about_dialog_new() + + var _aboutDialog *AboutDialog // out + + _aboutDialog = wrapAboutDialog(coreglib.Take(unsafe.Pointer(_cret))) + + return _aboutDialog +} + +// AddCreditSection creates a new section in the "Credits" page. +// +// The function takes the following parameters: +// +// - sectionName: name of the section. +// - people who belong to that section. +func (about *AboutDialog) AddCreditSection(sectionName string, people []string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + var _arg2 **C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(sectionName))) + defer C.free(unsafe.Pointer(_arg1)) + { + _arg2 = (**C.char)(C.calloc(C.size_t((len(people) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice(_arg2, len(people)+1) + var zero *C.char + out[len(people)] = zero + for i := range people { + out[i] = (*C.char)(unsafe.Pointer(C.CString(people[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gtk_about_dialog_add_credit_section(_arg0, _arg1, _arg2) + runtime.KeepAlive(about) + runtime.KeepAlive(sectionName) + runtime.KeepAlive(people) +} + +// Artists returns the names of the artists which are displayed in the credits +// page. +// +// The function returns the following values: +// +// - utf8s: a NULL-terminated string array containing the artists. +func (about *AboutDialog) Artists() []string { + var _arg0 *C.GtkAboutDialog // out + var _cret **C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_artists(_arg0) + runtime.KeepAlive(about) + + var _utf8s []string // out + + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// Authors returns the names of the authors which are displayed in the credits +// page. +// +// The function returns the following values: +// +// - utf8s: a NULL-terminated string array containing the authors. +func (about *AboutDialog) Authors() []string { + var _arg0 *C.GtkAboutDialog // out + var _cret **C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_authors(_arg0) + runtime.KeepAlive(about) + + var _utf8s []string // out + + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// Comments returns the comments string. +// +// The function returns the following values: +// +// - utf8 (optional): comments. +func (about *AboutDialog) Comments() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_comments(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Copyright returns the copyright string. +// +// The function returns the following values: +// +// - utf8 (optional): copyright string. +func (about *AboutDialog) Copyright() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_copyright(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Documenters returns the name of the documenters which are displayed in the +// credits page. +// +// The function returns the following values: +// +// - utf8s: a NULL-terminated string array containing the documenters. +func (about *AboutDialog) Documenters() []string { + var _arg0 *C.GtkAboutDialog // out + var _cret **C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_documenters(_arg0) + runtime.KeepAlive(about) + + var _utf8s []string // out + + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + + return _utf8s +} + +// License returns the license information. +// +// The function returns the following values: +// +// - utf8 (optional): license information. +func (about *AboutDialog) License() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_license(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// LicenseType retrieves the license type. +// +// The function returns the following values: +// +// - license: gtk.License value. +func (about *AboutDialog) LicenseType() License { + var _arg0 *C.GtkAboutDialog // out + var _cret C.GtkLicense // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_license_type(_arg0) + runtime.KeepAlive(about) + + var _license License // out + + _license = License(_cret) + + return _license +} + +// Logo returns the paintable displayed as logo in the about dialog. +// +// The function returns the following values: +// +// - paintable (optional) displayed as logo or NULL if the logo is unset or +// has been set via gtk.AboutDialog.SetLogoIconName(). +func (about *AboutDialog) Logo() *gdk.Paintable { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.GdkPaintable // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_logo(_arg0) + runtime.KeepAlive(about) + + var _paintable *gdk.Paintable // out + + if _cret != nil { + { + obj := coreglib.Take(unsafe.Pointer(_cret)) + _paintable = &gdk.Paintable{ + Object: obj, + } + } + } + + return _paintable +} + +// LogoIconName returns the icon name displayed as logo in the about dialog. +// +// The function returns the following values: +// +// - utf8 (optional): icon name displayed as logo, or NULL if the logo has +// been set via gtk.AboutDialog.SetLogo(). +func (about *AboutDialog) LogoIconName() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_logo_icon_name(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ProgramName returns the program name displayed in the about dialog. +// +// The function returns the following values: +// +// - utf8 (optional): program name. +func (about *AboutDialog) ProgramName() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_program_name(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// SystemInformation returns the system information that is shown in the about +// dialog. +// +// The function returns the following values: +// +// - utf8 (optional): system information. +func (about *AboutDialog) SystemInformation() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_system_information(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// TranslatorCredits returns the translator credits string which is displayed in +// the credits page. +// +// The function returns the following values: +// +// - utf8 (optional): translator credits string. +func (about *AboutDialog) TranslatorCredits() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_translator_credits(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Version returns the version string. +// +// The function returns the following values: +// +// - utf8 (optional): version string. +func (about *AboutDialog) Version() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_version(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Website returns the website URL. +// +// The function returns the following values: +// +// - utf8 (optional): website URL. +func (about *AboutDialog) Website() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_website(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// WebsiteLabel returns the label used for the website link. +// +// The function returns the following values: +// +// - utf8 (optional): label used for the website link. +func (about *AboutDialog) WebsiteLabel() string { + var _arg0 *C.GtkAboutDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_website_label(_arg0) + runtime.KeepAlive(about) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// WrapLicense returns whether the license text in the about dialog is +// automatically wrapped. +// +// The function returns the following values: +// +// - ok: TRUE if the license text is wrapped. +func (about *AboutDialog) WrapLicense() bool { + var _arg0 *C.GtkAboutDialog // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + + _cret = C.gtk_about_dialog_get_wrap_license(_arg0) + runtime.KeepAlive(about) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetArtists sets the names of the artists to be displayed in the "Credits" +// page. +// +// The function takes the following parameters: +// +// - artists authors of the artwork of the application. +func (about *AboutDialog) SetArtists(artists []string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 **C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + { + _arg1 = (**C.char)(C.calloc(C.size_t((len(artists) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(artists)+1) + var zero *C.char + out[len(artists)] = zero + for i := range artists { + out[i] = (*C.char)(unsafe.Pointer(C.CString(artists[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gtk_about_dialog_set_artists(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(artists) +} + +// SetAuthors sets the names of the authors which are displayed in the "Credits" +// page of the about dialog. +// +// The function takes the following parameters: +// +// - authors of the application. +func (about *AboutDialog) SetAuthors(authors []string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 **C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + { + _arg1 = (**C.char)(C.calloc(C.size_t((len(authors) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(authors)+1) + var zero *C.char + out[len(authors)] = zero + for i := range authors { + out[i] = (*C.char)(unsafe.Pointer(C.CString(authors[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gtk_about_dialog_set_authors(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(authors) +} + +// SetComments sets the comments string to display in the about dialog. +// +// This should be a short string of one or two lines. +// +// The function takes the following parameters: +// +// - comments (optional) string. +func (about *AboutDialog) SetComments(comments string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if comments != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(comments))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_about_dialog_set_comments(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(comments) +} + +// SetCopyright sets the copyright string to display in the about dialog. +// +// This should be a short string of one or two lines. +// +// The function takes the following parameters: +// +// - copyright (optional) string. +func (about *AboutDialog) SetCopyright(copyright string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if copyright != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(copyright))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_about_dialog_set_copyright(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(copyright) +} + +// SetDocumenters sets the names of the documenters which are displayed in the +// "Credits" page. +// +// The function takes the following parameters: +// +// - documenters authors of the documentation of the application. +func (about *AboutDialog) SetDocumenters(documenters []string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 **C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + { + _arg1 = (**C.char)(C.calloc(C.size_t((len(documenters) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(documenters)+1) + var zero *C.char + out[len(documenters)] = zero + for i := range documenters { + out[i] = (*C.char)(unsafe.Pointer(C.CString(documenters[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gtk_about_dialog_set_documenters(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(documenters) +} + +// SetLicense sets the license information to be displayed in the about dialog. +// +// If license is NULL, the license page is hidden. +// +// The function takes the following parameters: +// +// - license (optional) information. +func (about *AboutDialog) SetLicense(license string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if license != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(license))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_about_dialog_set_license(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(license) +} + +// SetLicenseType sets the license of the application showing the about dialog +// from a list of known licenses. +// +// This function overrides the license set using gtk.AboutDialog.SetLicense(). +// +// The function takes the following parameters: +// +// - licenseType: type of license. +func (about *AboutDialog) SetLicenseType(licenseType License) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 C.GtkLicense // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + _arg1 = C.GtkLicense(licenseType) + + C.gtk_about_dialog_set_license_type(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(licenseType) +} + +// SetLogo sets the logo in the about dialog. +// +// The function takes the following parameters: +// +// - logo (optional): GdkPaintable. +func (about *AboutDialog) SetLogo(logo gdk.Paintabler) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.GdkPaintable // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if logo != nil { + _arg1 = (*C.GdkPaintable)(unsafe.Pointer(coreglib.InternObject(logo).Native())) + } + + C.gtk_about_dialog_set_logo(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(logo) +} + +// SetLogoIconName sets the icon name to be displayed as logo in the about +// dialog. +// +// The function takes the following parameters: +// +// - iconName (optional): icon name. +func (about *AboutDialog) SetLogoIconName(iconName string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if iconName != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(iconName))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_about_dialog_set_logo_icon_name(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(iconName) +} + +// SetProgramName sets the name to display in the about dialog. +// +// If name is not set, the string returned by g_get_application_name() is used. +// +// The function takes the following parameters: +// +// - name (optional): program name. +func (about *AboutDialog) SetProgramName(name string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if name != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_about_dialog_set_program_name(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(name) +} + +// SetSystemInformation sets the system information to be displayed in the about +// dialog. +// +// If system_information is NULL, the system information page is hidden. +// +// See gtk.AboutDialog:system-information. +// +// The function takes the following parameters: +// +// - systemInformation (optional): system information. +func (about *AboutDialog) SetSystemInformation(systemInformation string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if systemInformation != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(systemInformation))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_about_dialog_set_system_information(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(systemInformation) +} + +// SetTranslatorCredits sets the translator credits string which is displayed in +// the credits page. +// +// The intended use for this string is to display the translator of the language +// which is currently used in the user interface. Using gettext(), a simple way +// to achieve that is to mark the string for translation: +// +// GtkWidget *about = gtk_about_dialog_new (); +// gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (about), +// _("translator-credits")); +// +// It is a good idea to use the customary msgid “translator-credits” for this +// purpose, since translators will already know the purpose of that msgid, +// and since GtkAboutDialog will detect if “translator-credits” is untranslated +// and omit translator credits. +// +// The function takes the following parameters: +// +// - translatorCredits (optional): translator credits. +func (about *AboutDialog) SetTranslatorCredits(translatorCredits string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if translatorCredits != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(translatorCredits))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_about_dialog_set_translator_credits(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(translatorCredits) +} + +// SetVersion sets the version string to display in the about dialog. +// +// The function takes the following parameters: +// +// - version (optional) string. +func (about *AboutDialog) SetVersion(version string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if version != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(version))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_about_dialog_set_version(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(version) +} + +// SetWebsite sets the URL to use for the website link. +// +// The function takes the following parameters: +// +// - website (optional): URL string starting with http://. +func (about *AboutDialog) SetWebsite(website string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if website != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(website))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_about_dialog_set_website(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(website) +} + +// SetWebsiteLabel sets the label to be used for the website link. +// +// The function takes the following parameters: +// +// - websiteLabel: label used for the website link. +func (about *AboutDialog) SetWebsiteLabel(websiteLabel string) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(websiteLabel))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_about_dialog_set_website_label(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(websiteLabel) +} + +// SetWrapLicense sets whether the license text in the about dialog should be +// automatically wrapped. +// +// The function takes the following parameters: +// +// - wrapLicense: whether to wrap the license. +func (about *AboutDialog) SetWrapLicense(wrapLicense bool) { + var _arg0 *C.GtkAboutDialog // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAboutDialog)(unsafe.Pointer(coreglib.InternObject(about).Native())) + if wrapLicense { + _arg1 = C.TRUE + } + + C.gtk_about_dialog_set_wrap_license(_arg0, _arg1) + runtime.KeepAlive(about) + runtime.KeepAlive(wrapLicense) +} + +// ActionBar: GtkActionBar is designed to present contextual actions. +// +// !An example GtkActionBar (action-bar.png) +// +// It is expected to be displayed below the content and expand horizontally to +// fill the area. +// +// It allows placing children at the start or the end. In addition, it contains +// an internal centered box which is centered with respect to the full width +// of the box, even if the children at either side take up different amounts of +// space. +// +// # GtkActionBar as GtkBuildable +// +// The GtkActionBar implementation of the GtkBuildable interface supports +// adding children at the start or end sides by specifying “start” or “end” as +// the “type” attribute of a element, or setting the center widget by +// specifying “center” value. +// +// CSS nodes +// +// actionbar +// ╰── revealer +// ╰── box +// ├── box.start +// │ ╰── [start children] +// ├── [center widget] +// ╰── box.end +// ╰── [end children] +// +// A GtkActionBar's CSS node is called actionbar. It contains a revealer +// subnode, which contains a box subnode, which contains two box subnodes +// at the start and end of the action bar, with start and `end style classes +// respectively, as well as a center node that represents the center child. +// +// Each of the boxes contains children packed for that side. +type ActionBar struct { + _ [0]func() // equal guard + Widget +} + +var ( + _ Widgetter = (*ActionBar)(nil) +) + +func wrapActionBar(obj *coreglib.Object) *ActionBar { + return &ActionBar{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + } +} + +func marshalActionBar(p uintptr) (interface{}, error) { + return wrapActionBar(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewActionBar creates a new GtkActionBar widget. +// +// The function returns the following values: +// +// - actionBar: new GtkActionBar. +func NewActionBar() *ActionBar { + var _cret *C.GtkWidget // in + + _cret = C.gtk_action_bar_new() + + var _actionBar *ActionBar // out + + _actionBar = wrapActionBar(coreglib.Take(unsafe.Pointer(_cret))) + + return _actionBar +} + +// CenterWidget retrieves the center bar widget of the bar. +// +// The function returns the following values: +// +// - widget (optional): center GtkWidget. +func (actionBar *ActionBar) CenterWidget() Widgetter { + var _arg0 *C.GtkActionBar // out + var _cret *C.GtkWidget // in + + _arg0 = (*C.GtkActionBar)(unsafe.Pointer(coreglib.InternObject(actionBar).Native())) + + _cret = C.gtk_action_bar_get_center_widget(_arg0) + runtime.KeepAlive(actionBar) + + var _widget Widgetter // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Widgetter) + return ok + }) + rv, ok := casted.(Widgetter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter") + } + _widget = rv + } + } + + return _widget +} + +// Revealed gets whether the contents of the action bar are revealed. +// +// The function returns the following values: +// +// - ok: current value of the gtk.ActionBar:revealed property. +func (actionBar *ActionBar) Revealed() bool { + var _arg0 *C.GtkActionBar // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkActionBar)(unsafe.Pointer(coreglib.InternObject(actionBar).Native())) + + _cret = C.gtk_action_bar_get_revealed(_arg0) + runtime.KeepAlive(actionBar) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PackEnd adds child to action_bar, packed with reference to the end of the +// action_bar. +// +// The function takes the following parameters: +// +// - child: GtkWidget to be added to action_bar. +func (actionBar *ActionBar) PackEnd(child Widgetter) { + var _arg0 *C.GtkActionBar // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkActionBar)(unsafe.Pointer(coreglib.InternObject(actionBar).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + + C.gtk_action_bar_pack_end(_arg0, _arg1) + runtime.KeepAlive(actionBar) + runtime.KeepAlive(child) +} + +// PackStart adds child to action_bar, packed with reference to the start of the +// action_bar. +// +// The function takes the following parameters: +// +// - child: GtkWidget to be added to action_bar. +func (actionBar *ActionBar) PackStart(child Widgetter) { + var _arg0 *C.GtkActionBar // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkActionBar)(unsafe.Pointer(coreglib.InternObject(actionBar).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + + C.gtk_action_bar_pack_start(_arg0, _arg1) + runtime.KeepAlive(actionBar) + runtime.KeepAlive(child) +} + +// Remove removes a child from action_bar. +// +// The function takes the following parameters: +// +// - child: GtkWidget to be removed. +func (actionBar *ActionBar) Remove(child Widgetter) { + var _arg0 *C.GtkActionBar // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkActionBar)(unsafe.Pointer(coreglib.InternObject(actionBar).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + + C.gtk_action_bar_remove(_arg0, _arg1) + runtime.KeepAlive(actionBar) + runtime.KeepAlive(child) +} + +// SetCenterWidget sets the center widget for the GtkActionBar. +// +// The function takes the following parameters: +// +// - centerWidget (optional): widget to use for the center. +func (actionBar *ActionBar) SetCenterWidget(centerWidget Widgetter) { + var _arg0 *C.GtkActionBar // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkActionBar)(unsafe.Pointer(coreglib.InternObject(actionBar).Native())) + if centerWidget != nil { + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(centerWidget).Native())) + } + + C.gtk_action_bar_set_center_widget(_arg0, _arg1) + runtime.KeepAlive(actionBar) + runtime.KeepAlive(centerWidget) +} + +// SetRevealed reveals or conceals the content of the action bar. +// +// Note: this does not show or hide action_bar in the gtk.Widget:visible sense, +// so revealing has no effect if the action bar is hidden. +// +// The function takes the following parameters: +// +// - revealed: new value of the property. +func (actionBar *ActionBar) SetRevealed(revealed bool) { + var _arg0 *C.GtkActionBar // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkActionBar)(unsafe.Pointer(coreglib.InternObject(actionBar).Native())) + if revealed { + _arg1 = C.TRUE + } + + C.gtk_action_bar_set_revealed(_arg0, _arg1) + runtime.KeepAlive(actionBar) + runtime.KeepAlive(revealed) +} + +// ActivateAction: GtkShortcutAction that calls gtk_widget_activate(). +type ActivateAction struct { + _ [0]func() // equal guard + ShortcutAction +} + +var ( + _ ShortcutActioner = (*ActivateAction)(nil) +) + +func wrapActivateAction(obj *coreglib.Object) *ActivateAction { + return &ActivateAction{ + ShortcutAction: ShortcutAction{ + Object: obj, + }, + } +} + +func marshalActivateAction(p uintptr) (interface{}, error) { + return wrapActivateAction(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ActivateActionGet gets the activate action. +// +// This is an action that calls gtk_widget_activate() on the given widget upon +// activation. +// +// The function returns the following values: +// +// - activateAction: activate action. +func ActivateActionGet() *ActivateAction { + var _cret *C.GtkShortcutAction // in + + _cret = C.gtk_activate_action_get() + + var _activateAction *ActivateAction // out + + _activateAction = wrapActivateAction(coreglib.Take(unsafe.Pointer(_cret))) + + return _activateAction +} + +// AdjustmentOverrides contains methods that are overridable. +type AdjustmentOverrides struct { + Changed func() + ValueChanged func() +} + +func defaultAdjustmentOverrides(v *Adjustment) AdjustmentOverrides { + return AdjustmentOverrides{ + Changed: v.changed, + ValueChanged: v.valueChanged, + } +} + +// Adjustment: GtkAdjustment is a model for a numeric value. +// +// The GtkAdjustment has an associated lower and upper bound. It also contains +// step and page increments, and a page size. +// +// Adjustments are used within several GTK widgets, including gtk.SpinButton, +// gtk.Viewport, gtk.Scrollbar and gtk.Scale. +// +// The GtkAdjustment object does not update the value itself. Instead it is left +// up to the owner of the GtkAdjustment to control the value. +type Adjustment struct { + _ [0]func() // equal guard + coreglib.InitiallyUnowned +} + +var () + +func init() { + coreglib.RegisterClassInfo[*Adjustment, *AdjustmentClass, AdjustmentOverrides]( + GTypeAdjustment, + initAdjustmentClass, + wrapAdjustment, + defaultAdjustmentOverrides, + ) +} + +func initAdjustmentClass(gclass unsafe.Pointer, overrides AdjustmentOverrides, classInitFunc func(*AdjustmentClass)) { + pclass := (*C.GtkAdjustmentClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeAdjustment)))) + + if overrides.Changed != nil { + pclass.changed = (*[0]byte)(C._gotk4_gtk4_AdjustmentClass_changed) + } + + if overrides.ValueChanged != nil { + pclass.value_changed = (*[0]byte)(C._gotk4_gtk4_AdjustmentClass_value_changed) + } + + if classInitFunc != nil { + class := (*AdjustmentClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapAdjustment(obj *coreglib.Object) *Adjustment { + return &Adjustment{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + } +} + +func marshalAdjustment(p uintptr) (interface{}, error) { + return wrapAdjustment(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectChanged is emitted when one or more of the GtkAdjustment properties +// have been changed. +// +// Note that the gtk.Adjustment:value property is covered by the +// gtk.Adjustment::value-changed signal. +func (adjustment *Adjustment) ConnectChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(adjustment, "changed", false, unsafe.Pointer(C._gotk4_gtk4_Adjustment_ConnectChanged), f) +} + +// ConnectValueChanged is emitted when the value has been changed. +func (adjustment *Adjustment) ConnectValueChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(adjustment, "value-changed", false, unsafe.Pointer(C._gotk4_gtk4_Adjustment_ConnectValueChanged), f) +} + +// NewAdjustment creates a new GtkAdjustment. +// +// The function takes the following parameters: +// +// - value: initial value. +// - lower: minimum value. +// - upper: maximum value. +// - stepIncrement: step increment. +// - pageIncrement: page increment. +// - pageSize: page size. +// +// The function returns the following values: +// +// - adjustment: new GtkAdjustment. +func NewAdjustment(value, lower, upper, stepIncrement, pageIncrement, pageSize float64) *Adjustment { + var _arg1 C.double // out + var _arg2 C.double // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + var _cret *C.GtkAdjustment // in + + _arg1 = C.double(value) + _arg2 = C.double(lower) + _arg3 = C.double(upper) + _arg4 = C.double(stepIncrement) + _arg5 = C.double(pageIncrement) + _arg6 = C.double(pageSize) + + _cret = C.gtk_adjustment_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(value) + runtime.KeepAlive(lower) + runtime.KeepAlive(upper) + runtime.KeepAlive(stepIncrement) + runtime.KeepAlive(pageIncrement) + runtime.KeepAlive(pageSize) + + var _adjustment *Adjustment // out + + _adjustment = wrapAdjustment(coreglib.Take(unsafe.Pointer(_cret))) + + return _adjustment +} + +// ClampPage updates the value property to ensure that the range between lower +// and upper is in the current page. +// +// The current page goes from value to value + page-size. If the range is larger +// than the page size, then only the start of it will be in the current page. +// +// A gtk.Adjustment::value-changed signal will be emitted if the value is +// changed. +// +// The function takes the following parameters: +// +// - lower value. +// - upper value. +func (adjustment *Adjustment) ClampPage(lower, upper float64) { + var _arg0 *C.GtkAdjustment // out + var _arg1 C.double // out + var _arg2 C.double // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + _arg1 = C.double(lower) + _arg2 = C.double(upper) + + C.gtk_adjustment_clamp_page(_arg0, _arg1, _arg2) + runtime.KeepAlive(adjustment) + runtime.KeepAlive(lower) + runtime.KeepAlive(upper) +} + +// Configure sets all properties of the adjustment at once. +// +// Use this function to avoid multiple emissions of the gtk.Adjustment::changed +// signal. See gtk.Adjustment.SetLower() for an alternative way of compressing +// multiple emissions of gtk.Adjustment::changed into one. +// +// The function takes the following parameters: +// +// - value: new value. +// - lower: new minimum value. +// - upper: new maximum value. +// - stepIncrement: new step increment. +// - pageIncrement: new page increment. +// - pageSize: new page size. +func (adjustment *Adjustment) Configure(value, lower, upper, stepIncrement, pageIncrement, pageSize float64) { + var _arg0 *C.GtkAdjustment // out + var _arg1 C.double // out + var _arg2 C.double // out + var _arg3 C.double // out + var _arg4 C.double // out + var _arg5 C.double // out + var _arg6 C.double // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + _arg1 = C.double(value) + _arg2 = C.double(lower) + _arg3 = C.double(upper) + _arg4 = C.double(stepIncrement) + _arg5 = C.double(pageIncrement) + _arg6 = C.double(pageSize) + + C.gtk_adjustment_configure(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) + runtime.KeepAlive(adjustment) + runtime.KeepAlive(value) + runtime.KeepAlive(lower) + runtime.KeepAlive(upper) + runtime.KeepAlive(stepIncrement) + runtime.KeepAlive(pageIncrement) + runtime.KeepAlive(pageSize) +} + +// Lower retrieves the minimum value of the adjustment. +// +// The function returns the following values: +// +// - gdouble: current minimum value of the adjustment. +func (adjustment *Adjustment) Lower() float64 { + var _arg0 *C.GtkAdjustment // out + var _cret C.double // in + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + + _cret = C.gtk_adjustment_get_lower(_arg0) + runtime.KeepAlive(adjustment) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// MinimumIncrement gets the smaller of step increment and page increment. +// +// The function returns the following values: +// +// - gdouble: minimum increment of adjustment. +func (adjustment *Adjustment) MinimumIncrement() float64 { + var _arg0 *C.GtkAdjustment // out + var _cret C.double // in + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + + _cret = C.gtk_adjustment_get_minimum_increment(_arg0) + runtime.KeepAlive(adjustment) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// PageIncrement retrieves the page increment of the adjustment. +// +// The function returns the following values: +// +// - gdouble: current page increment of the adjustment. +func (adjustment *Adjustment) PageIncrement() float64 { + var _arg0 *C.GtkAdjustment // out + var _cret C.double // in + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + + _cret = C.gtk_adjustment_get_page_increment(_arg0) + runtime.KeepAlive(adjustment) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// PageSize retrieves the page size of the adjustment. +// +// The function returns the following values: +// +// - gdouble: current page size of the adjustment. +func (adjustment *Adjustment) PageSize() float64 { + var _arg0 *C.GtkAdjustment // out + var _cret C.double // in + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + + _cret = C.gtk_adjustment_get_page_size(_arg0) + runtime.KeepAlive(adjustment) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// StepIncrement retrieves the step increment of the adjustment. +// +// The function returns the following values: +// +// - gdouble: current step increment of the adjustment. +func (adjustment *Adjustment) StepIncrement() float64 { + var _arg0 *C.GtkAdjustment // out + var _cret C.double // in + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + + _cret = C.gtk_adjustment_get_step_increment(_arg0) + runtime.KeepAlive(adjustment) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// Upper retrieves the maximum value of the adjustment. +// +// The function returns the following values: +// +// - gdouble: current maximum value of the adjustment. +func (adjustment *Adjustment) Upper() float64 { + var _arg0 *C.GtkAdjustment // out + var _cret C.double // in + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + + _cret = C.gtk_adjustment_get_upper(_arg0) + runtime.KeepAlive(adjustment) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// Value gets the current value of the adjustment. +// +// The function returns the following values: +// +// - gdouble: current value of the adjustment. +func (adjustment *Adjustment) Value() float64 { + var _arg0 *C.GtkAdjustment // out + var _cret C.double // in + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + + _cret = C.gtk_adjustment_get_value(_arg0) + runtime.KeepAlive(adjustment) + + var _gdouble float64 // out + + _gdouble = float64(_cret) + + return _gdouble +} + +// SetLower sets the minimum value of the adjustment. +// +// When setting multiple adjustment properties via their individual setters, +// multiple gtk.Adjustment::changed signals will be emitted. However, since the +// emission of the gtk.Adjustment::changed signal is tied to the emission of +// the ::notify signals of the changed properties, it’s possible to compress the +// gtk.Adjustment::changed signals into one by calling g_object_freeze_notify() +// and g_object_thaw_notify() around the calls to the individual setters. +// +// Alternatively, using a single g_object_set() for all the properties to +// change, or using gtk.Adjustment.Configure() has the same effect. +// +// The function takes the following parameters: +// +// - lower: new minimum value. +func (adjustment *Adjustment) SetLower(lower float64) { + var _arg0 *C.GtkAdjustment // out + var _arg1 C.double // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + _arg1 = C.double(lower) + + C.gtk_adjustment_set_lower(_arg0, _arg1) + runtime.KeepAlive(adjustment) + runtime.KeepAlive(lower) +} + +// SetPageIncrement sets the page increment of the adjustment. +// +// See gtk.Adjustment.SetLower() about how to compress multiple emissions of the +// gtk.Adjustment::changed signal when setting multiple adjustment properties. +// +// The function takes the following parameters: +// +// - pageIncrement: new page increment. +func (adjustment *Adjustment) SetPageIncrement(pageIncrement float64) { + var _arg0 *C.GtkAdjustment // out + var _arg1 C.double // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + _arg1 = C.double(pageIncrement) + + C.gtk_adjustment_set_page_increment(_arg0, _arg1) + runtime.KeepAlive(adjustment) + runtime.KeepAlive(pageIncrement) +} + +// SetPageSize sets the page size of the adjustment. +// +// See gtk.Adjustment.SetLower() about how to compress multiple emissions of the +// gtk.Adjustment::changed signal when setting multiple adjustment properties. +// +// The function takes the following parameters: +// +// - pageSize: new page size. +func (adjustment *Adjustment) SetPageSize(pageSize float64) { + var _arg0 *C.GtkAdjustment // out + var _arg1 C.double // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + _arg1 = C.double(pageSize) + + C.gtk_adjustment_set_page_size(_arg0, _arg1) + runtime.KeepAlive(adjustment) + runtime.KeepAlive(pageSize) +} + +// SetStepIncrement sets the step increment of the adjustment. +// +// See gtk.Adjustment.SetLower() about how to compress multiple emissions of the +// gtk.Adjustment::changed signal when setting multiple adjustment properties. +// +// The function takes the following parameters: +// +// - stepIncrement: new step increment. +func (adjustment *Adjustment) SetStepIncrement(stepIncrement float64) { + var _arg0 *C.GtkAdjustment // out + var _arg1 C.double // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + _arg1 = C.double(stepIncrement) + + C.gtk_adjustment_set_step_increment(_arg0, _arg1) + runtime.KeepAlive(adjustment) + runtime.KeepAlive(stepIncrement) +} + +// SetUpper sets the maximum value of the adjustment. +// +// Note that values will be restricted by upper - page-size if the page-size +// property is nonzero. +// +// See gtk.Adjustment.SetLower() about how to compress multiple emissions of the +// gtk.Adjustment::changed signal when setting multiple adjustment properties. +// +// The function takes the following parameters: +// +// - upper: new maximum value. +func (adjustment *Adjustment) SetUpper(upper float64) { + var _arg0 *C.GtkAdjustment // out + var _arg1 C.double // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + _arg1 = C.double(upper) + + C.gtk_adjustment_set_upper(_arg0, _arg1) + runtime.KeepAlive(adjustment) + runtime.KeepAlive(upper) +} + +// SetValue sets the GtkAdjustment value. +// +// The value is clamped to lie between gtk.Adjustment:lower and +// gtk.Adjustment:upper. +// +// Note that for adjustments which are used in a GtkScrollbar, +// the effective range of allowed values goes from gtk.Adjustment:lower to +// gtk.Adjustment:upper - gtk.Adjustment:page-size. +// +// The function takes the following parameters: +// +// - value: new value. +func (adjustment *Adjustment) SetValue(value float64) { + var _arg0 *C.GtkAdjustment // out + var _arg1 C.double // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + _arg1 = C.double(value) + + C.gtk_adjustment_set_value(_arg0, _arg1) + runtime.KeepAlive(adjustment) + runtime.KeepAlive(value) +} + +func (adjustment *Adjustment) changed() { + gclass := (*C.GtkAdjustmentClass)(coreglib.PeekParentClass(adjustment)) + fnarg := gclass.changed + + var _arg0 *C.GtkAdjustment // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + + C._gotk4_gtk4_Adjustment_virtual_changed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(adjustment) +} + +func (adjustment *Adjustment) valueChanged() { + gclass := (*C.GtkAdjustmentClass)(coreglib.PeekParentClass(adjustment)) + fnarg := gclass.value_changed + + var _arg0 *C.GtkAdjustment // out + + _arg0 = (*C.GtkAdjustment)(unsafe.Pointer(coreglib.InternObject(adjustment).Native())) + + C._gotk4_gtk4_Adjustment_virtual_value_changed(unsafe.Pointer(fnarg), _arg0) + runtime.KeepAlive(adjustment) +} + +// AlertDialogOverrides contains methods that are overridable. +type AlertDialogOverrides struct { +} + +func defaultAlertDialogOverrides(v *AlertDialog) AlertDialogOverrides { + return AlertDialogOverrides{} +} + +// AlertDialog: GtkAlertDialog object collects the arguments that are needed to +// present a message to the user. +// +// The message is shown with the gtk.AlertDialog.Choose() function. This API +// follows the GIO async pattern, and the result can be obtained by calling +// gtk.AlertDialog.ChooseFinish(). +// +// If you don't need to wait for a button to be clicked, you can use +// gtk.AlertDialog.Show(). +type AlertDialog struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*AlertDialog)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*AlertDialog, *AlertDialogClass, AlertDialogOverrides]( + GTypeAlertDialog, + initAlertDialogClass, + wrapAlertDialog, + defaultAlertDialogOverrides, + ) +} + +func initAlertDialogClass(gclass unsafe.Pointer, overrides AlertDialogOverrides, classInitFunc func(*AlertDialogClass)) { + if classInitFunc != nil { + class := (*AlertDialogClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapAlertDialog(obj *coreglib.Object) *AlertDialog { + return &AlertDialog{ + Object: obj, + } +} + +func marshalAlertDialog(p uintptr) (interface{}, error) { + return wrapAlertDialog(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Choose: this function shows the alert to the user. +// +// The callback will be called when the alert is dismissed. It should call +// gtk.AlertDialog.ChooseFinish() to obtain the result. +// +// It is ok to pass NULL for the callback if the alert does not have more than +// one button. A simpler API for this case is gtk.AlertDialog.Show(). +// +// The function takes the following parameters: +// +// - ctx (optional): GCancellable to cancel the operation. +// - parent (optional) GtkWindow. +// - callback (optional) to call when the operation is complete. +func (self *AlertDialog) Choose(ctx context.Context, parent *Window, callback gio.AsyncReadyCallback) { + var _arg0 *C.GtkAlertDialog // out + var _arg2 *C.GCancellable // out + var _arg1 *C.GtkWindow // out + var _arg3 C.GAsyncReadyCallback // out + var _arg4 C.gpointer + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + cancellable := gcancel.GCancellableFromContext(ctx) + defer runtime.KeepAlive(cancellable) + _arg2 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) + } + if parent != nil { + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + if callback != nil { + _arg3 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) + _arg4 = C.gpointer(gbox.AssignOnce(callback)) + } + + C.gtk_alert_dialog_choose(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(self) + runtime.KeepAlive(ctx) + runtime.KeepAlive(parent) + runtime.KeepAlive(callback) +} + +// ChooseFinish finishes the gtk.AlertDialog.Choose() call and returns the index +// of the button that was clicked. +// +// The function takes the following parameters: +// +// - result: GAsyncResult. +// +// The function returns the following values: +// +// - gint: index of the button that was clicked, or -1 if the dialog was +// cancelled and gtk.AlertDialog:cancel-button is not set. +func (self *AlertDialog) ChooseFinish(result gio.AsyncResulter) (int, error) { + var _arg0 *C.GtkAlertDialog // out + var _arg1 *C.GAsyncResult // out + var _cret C.int // in + var _cerr *C.GError // in + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + + _cret = C.gtk_alert_dialog_choose_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) + + var _gint int // out + var _goerr error // out + + _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _gint, _goerr +} + +// Buttons returns the button labels for the alert. +// +// The function returns the following values: +// +// - utf8s (optional): button labels. +func (self *AlertDialog) Buttons() []string { + var _arg0 *C.GtkAlertDialog // out + var _cret **C.char // in + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_alert_dialog_get_buttons(_arg0) + runtime.KeepAlive(self) + + var _utf8s []string // out + + if _cret != nil { + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + } + } + } + + return _utf8s +} + +// CancelButton returns the index of the cancel button. +// +// The function returns the following values: +// +// - gint: index of the cancel button, or -1. +func (self *AlertDialog) CancelButton() int { + var _arg0 *C.GtkAlertDialog // out + var _cret C.int // in + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_alert_dialog_get_cancel_button(_arg0) + runtime.KeepAlive(self) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// DefaultButton returns the index of the default button. +// +// The function returns the following values: +// +// - gint: index of the default button, or -1. +func (self *AlertDialog) DefaultButton() int { + var _arg0 *C.GtkAlertDialog // out + var _cret C.int // in + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_alert_dialog_get_default_button(_arg0) + runtime.KeepAlive(self) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Detail returns the detail text that will be shown in the alert. +// +// The function returns the following values: +// +// - utf8: detail text. +func (self *AlertDialog) Detail() string { + var _arg0 *C.GtkAlertDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_alert_dialog_get_detail(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Message returns the message that will be shown in the alert. +// +// The function returns the following values: +// +// - utf8: message. +func (self *AlertDialog) Message() string { + var _arg0 *C.GtkAlertDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_alert_dialog_get_message(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// Modal returns whether the alert blocks interaction with the parent window +// while it is presented. +// +// The function returns the following values: +// +// - ok: TRUE if the alert is modal. +func (self *AlertDialog) Modal() bool { + var _arg0 *C.GtkAlertDialog // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_alert_dialog_get_modal(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetButtons sets the button labels for the alert. +// +// The function takes the following parameters: +// +// - labels: new button labels. +func (self *AlertDialog) SetButtons(labels []string) { + var _arg0 *C.GtkAlertDialog // out + var _arg1 **C.char // out + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + { + _arg1 = (**C.char)(C.calloc(C.size_t((len(labels) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg1)) + { + out := unsafe.Slice(_arg1, len(labels)+1) + var zero *C.char + out[len(labels)] = zero + for i := range labels { + out[i] = (*C.char)(unsafe.Pointer(C.CString(labels[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gtk_alert_dialog_set_buttons(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(labels) +} + +// SetCancelButton sets the index of the cancel button. +// +// See gtk.AlertDialog:cancel-button for details of how this value is used. +// +// The function takes the following parameters: +// +// - button: new cancel button. +func (self *AlertDialog) SetCancelButton(button int) { + var _arg0 *C.GtkAlertDialog // out + var _arg1 C.int // out + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.int(button) + + C.gtk_alert_dialog_set_cancel_button(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(button) +} + +// SetDefaultButton sets the index of the default button. +// +// See gtk.AlertDialog:default-button for details of how this value is used. +// +// The function takes the following parameters: +// +// - button: new default button. +func (self *AlertDialog) SetDefaultButton(button int) { + var _arg0 *C.GtkAlertDialog // out + var _arg1 C.int // out + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.int(button) + + C.gtk_alert_dialog_set_default_button(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(button) +} + +// SetDetail sets the detail text that will be shown in the alert. +// +// The function takes the following parameters: +// +// - detail: new detail text. +func (self *AlertDialog) SetDetail(detail string) { + var _arg0 *C.GtkAlertDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(detail))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_alert_dialog_set_detail(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(detail) +} + +// SetMessage sets the message that will be shown in the alert. +// +// The function takes the following parameters: +// +// - message: new message. +func (self *AlertDialog) SetMessage(message string) { + var _arg0 *C.GtkAlertDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(message))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_alert_dialog_set_message(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(message) +} + +// SetModal sets whether the alert blocks interaction with the parent window +// while it is presented. +// +// The function takes the following parameters: +// +// - modal: new value. +func (self *AlertDialog) SetModal(modal bool) { + var _arg0 *C.GtkAlertDialog // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if modal { + _arg1 = C.TRUE + } + + C.gtk_alert_dialog_set_modal(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(modal) +} + +// Show the alert to the user. +// +// This function is a simple version of gtk.AlertDialog.Choose() intended for +// dialogs with a single button. If you want to cancel the dialog or if the +// alert has more than one button, you should use that function instead and +// provide it with a #GCancellable or callback respectively. +// +// The function takes the following parameters: +// +// - parent (optional) GtkWindow. +func (self *AlertDialog) Show(parent *Window) { + var _arg0 *C.GtkAlertDialog // out + var _arg1 *C.GtkWindow // out + + _arg0 = (*C.GtkAlertDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if parent != nil { + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + + C.gtk_alert_dialog_show(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(parent) +} + +// AlternativeTrigger: GtkShortcutTrigger that combines two triggers. +// +// The GtkAlternativeTrigger triggers when either of two trigger. +// +// This can be cascaded to combine more than two triggers. +type AlternativeTrigger struct { + _ [0]func() // equal guard + ShortcutTrigger +} + +var ( + _ ShortcutTriggerer = (*AlternativeTrigger)(nil) +) + +func wrapAlternativeTrigger(obj *coreglib.Object) *AlternativeTrigger { + return &AlternativeTrigger{ + ShortcutTrigger: ShortcutTrigger{ + Object: obj, + }, + } +} + +func marshalAlternativeTrigger(p uintptr) (interface{}, error) { + return wrapAlternativeTrigger(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewAlternativeTrigger creates a GtkShortcutTrigger that will trigger whenever +// either of the two given triggers gets triggered. +// +// Note that nesting is allowed, so if you want more than two alternative, +// create a new alternative trigger for each option. +// +// The function takes the following parameters: +// +// - first trigger that may trigger. +// - second trigger that may trigger. +// +// The function returns the following values: +// +// - alternativeTrigger: new GtkShortcutTrigger. +func NewAlternativeTrigger(first, second ShortcutTriggerer) *AlternativeTrigger { + var _arg1 *C.GtkShortcutTrigger // out + var _arg2 *C.GtkShortcutTrigger // out + var _cret *C.GtkShortcutTrigger // in + + _arg1 = (*C.GtkShortcutTrigger)(unsafe.Pointer(coreglib.InternObject(first).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(first).Native())) + _arg2 = (*C.GtkShortcutTrigger)(unsafe.Pointer(coreglib.InternObject(second).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(second).Native())) + + _cret = C.gtk_alternative_trigger_new(_arg1, _arg2) + runtime.KeepAlive(first) + runtime.KeepAlive(second) + + var _alternativeTrigger *AlternativeTrigger // out + + _alternativeTrigger = wrapAlternativeTrigger(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _alternativeTrigger +} + +// First gets the first of the two alternative triggers that may trigger self. +// +// gtk.AlternativeTrigger.GetSecond() will return the other one. +// +// The function returns the following values: +// +// - shortcutTrigger: first alternative trigger. +func (self *AlternativeTrigger) First() ShortcutTriggerer { + var _arg0 *C.GtkAlternativeTrigger // out + var _cret *C.GtkShortcutTrigger // in + + _arg0 = (*C.GtkAlternativeTrigger)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_alternative_trigger_get_first(_arg0) + runtime.KeepAlive(self) + + var _shortcutTrigger ShortcutTriggerer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gtk.ShortcutTriggerer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(ShortcutTriggerer) + return ok + }) + rv, ok := casted.(ShortcutTriggerer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.ShortcutTriggerer") + } + _shortcutTrigger = rv + } + + return _shortcutTrigger +} + +// Second gets the second of the two alternative triggers that may trigger self. +// +// gtk.AlternativeTrigger.GetFirst() will return the other one. +// +// The function returns the following values: +// +// - shortcutTrigger: second alternative trigger. +func (self *AlternativeTrigger) Second() ShortcutTriggerer { + var _arg0 *C.GtkAlternativeTrigger // out + var _cret *C.GtkShortcutTrigger // in + + _arg0 = (*C.GtkAlternativeTrigger)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_alternative_trigger_get_second(_arg0) + runtime.KeepAlive(self) + + var _shortcutTrigger ShortcutTriggerer // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gtk.ShortcutTriggerer is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(ShortcutTriggerer) + return ok + }) + rv, ok := casted.(ShortcutTriggerer) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.ShortcutTriggerer") + } + _shortcutTrigger = rv + } + + return _shortcutTrigger +} + +// AnyFilter: GtkAnyFilter matches an item when at least one of its filters +// matches. +// +// To add filters to a GtkAnyFilter, use gtk.MultiFilter.Append(). +type AnyFilter struct { + _ [0]func() // equal guard + MultiFilter +} + +var ( + _ MultiFilterer = (*AnyFilter)(nil) +) + +func wrapAnyFilter(obj *coreglib.Object) *AnyFilter { + return &AnyFilter{ + MultiFilter: MultiFilter{ + Filter: Filter{ + Object: obj, + }, + Object: obj, + ListModel: gio.ListModel{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + }, + } +} + +func marshalAnyFilter(p uintptr) (interface{}, error) { + return wrapAnyFilter(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewAnyFilter creates a new empty "any" filter. +// +// Use gtk.MultiFilter.Append() to add filters to it. +// +// This filter matches an item if any of the filters added to it matches the +// item. In particular, this means that if no filter has been added to it, +// the filter matches no item. +// +// The function returns the following values: +// +// - anyFilter: new GtkAnyFilter. +func NewAnyFilter() *AnyFilter { + var _cret *C.GtkAnyFilter // in + + _cret = C.gtk_any_filter_new() + + var _anyFilter *AnyFilter // out + + _anyFilter = wrapAnyFilter(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _anyFilter +} + +// AppChooserButton: GtkAppChooserButton lets the user select an application. +// +// !An example GtkAppChooserButton (appchooserbutton.png) +// +// Initially, a GtkAppChooserButton selects the first application in its +// list, which will either be the most-recently used application or, +// if gtk.AppChooserButton:show-default-item is TRUE, the default application. +// +// The list of applications shown in a GtkAppChooserButton includes +// the recommended applications for the given content type. When +// gtk.AppChooserButton:show-default-item is set, the default application is +// also included. To let the user chooser other applications, you can set the +// gtk.AppChooserButton:show-dialog-item property, which allows to open a full +// gtk.AppChooserDialog. +// +// It is possible to add custom items to the list, using +// gtk.AppChooserButton.AppendCustomItem(). These items cause the +// gtk.AppChooserButton::custom-item-activated signal to be emitted when they +// are selected. +// +// To track changes in the selected application, use the +// gtk.AppChooserButton::changed signal. +// +// # CSS nodes +// +// GtkAppChooserButton has a single CSS node with the name “appchooserbutton”. +// +// Deprecated: The application selection widgets should be implemented according +// to the design of each platform and/or application requiring them. +type AppChooserButton struct { + _ [0]func() // equal guard + Widget + + *coreglib.Object + AppChooser +} + +var ( + _ Widgetter = (*AppChooserButton)(nil) + _ coreglib.Objector = (*AppChooserButton)(nil) +) + +func wrapAppChooserButton(obj *coreglib.Object) *AppChooserButton { + return &AppChooserButton{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + Object: obj, + AppChooser: AppChooser{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + }, + } +} + +func marshalAppChooserButton(p uintptr) (interface{}, error) { + return wrapAppChooserButton(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectActivate is emitted to when the button is activated. +// +// The ::activate signal on GtkAppChooserButton is an action signal and emitting +// it causes the button to pop up its dialog. +func (self *AppChooserButton) ConnectActivate(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(self, "activate", false, unsafe.Pointer(C._gotk4_gtk4_AppChooserButton_ConnectActivate), f) +} + +// ConnectChanged is emitted when the active application changes. +func (self *AppChooserButton) ConnectChanged(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(self, "changed", false, unsafe.Pointer(C._gotk4_gtk4_AppChooserButton_ConnectChanged), f) +} + +// ConnectCustomItemActivated is emitted when a custom item is activated. +// +// Use gtk.AppChooserButton.AppendCustomItem(), to add custom items. +func (self *AppChooserButton) ConnectCustomItemActivated(f func(itemName string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(self, "custom-item-activated", false, unsafe.Pointer(C._gotk4_gtk4_AppChooserButton_ConnectCustomItemActivated), f) +} + +// NewAppChooserButton creates a new GtkAppChooserButton for applications that +// can handle content of the given type. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - contentType: content type to show applications for. +// +// The function returns the following values: +// +// - appChooserButton: newly created GtkAppChooserButton. +func NewAppChooserButton(contentType string) *AppChooserButton { + var _arg1 *C.char // out + var _cret *C.GtkWidget // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gtk_app_chooser_button_new(_arg1) + runtime.KeepAlive(contentType) + + var _appChooserButton *AppChooserButton // out + + _appChooserButton = wrapAppChooserButton(coreglib.Take(unsafe.Pointer(_cret))) + + return _appChooserButton +} + +// AppendCustomItem appends a custom item to the list of applications that is +// shown in the popup. +// +// The item name must be unique per-widget. Clients can use the provided name +// as a detail for the gtk.AppChooserButton::custom-item-activated signal, +// to add a callback for the activation of a particular custom item in the list. +// +// See also gtk.AppChooserButton.AppendSeparator(). +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - name of the custom item. +// - label for the custom item. +// - icon for the custom item. +func (self *AppChooserButton) AppendCustomItem(name, label string, icon gio.Iconner) { + var _arg0 *C.GtkAppChooserButton // out + var _arg1 *C.char // out + var _arg2 *C.char // out + var _arg3 *C.GIcon // out + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(label))) + defer C.free(unsafe.Pointer(_arg2)) + _arg3 = (*C.GIcon)(unsafe.Pointer(coreglib.InternObject(icon).Native())) + + C.gtk_app_chooser_button_append_custom_item(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(self) + runtime.KeepAlive(name) + runtime.KeepAlive(label) + runtime.KeepAlive(icon) +} + +// AppendSeparator appends a separator to the list of applications that is shown +// in the popup. +// +// Deprecated: This widget will be removed in GTK 5. +func (self *AppChooserButton) AppendSeparator() { + var _arg0 *C.GtkAppChooserButton // out + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + C.gtk_app_chooser_button_append_separator(_arg0) + runtime.KeepAlive(self) +} + +// Heading returns the text to display at the top of the dialog. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - utf8 (optional): text to display at the top of the dialog, or NULL, +// in which case a default text is displayed. +func (self *AppChooserButton) Heading() string { + var _arg0 *C.GtkAppChooserButton // out + var _cret *C.char // in + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_button_get_heading(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Modal gets whether the dialog is modal. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - ok: TRUE if the dialog is modal. +func (self *AppChooserButton) Modal() bool { + var _arg0 *C.GtkAppChooserButton // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_button_get_modal(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ShowDefaultItem returns whether the dropdown menu should show the default +// application at the top. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - ok: value of gtk.AppChooserButton:show-default-item. +func (self *AppChooserButton) ShowDefaultItem() bool { + var _arg0 *C.GtkAppChooserButton // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_button_get_show_default_item(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ShowDialogItem returns whether the dropdown menu shows an item for a +// GtkAppChooserDialog. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - ok: value of gtk.AppChooserButton:show-dialog-item. +func (self *AppChooserButton) ShowDialogItem() bool { + var _arg0 *C.GtkAppChooserButton // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_button_get_show_dialog_item(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetActiveCustomItem selects a custom item. +// +// See gtk.AppChooserButton.AppendCustomItem(). +// +// Use gtk.AppChooser.Refresh() to bring the selection to its initial state. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - name of the custom item. +func (self *AppChooserButton) SetActiveCustomItem(name string) { + var _arg0 *C.GtkAppChooserButton // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_app_chooser_button_set_active_custom_item(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(name) +} + +// SetHeading sets the text to display at the top of the dialog. +// +// If the heading is not set, the dialog displays a default text. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - heading: string containing Pango markup. +func (self *AppChooserButton) SetHeading(heading string) { + var _arg0 *C.GtkAppChooserButton // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(heading))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_app_chooser_button_set_heading(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(heading) +} + +// SetModal sets whether the dialog should be modal. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - modal: TRUE to make the dialog modal. +func (self *AppChooserButton) SetModal(modal bool) { + var _arg0 *C.GtkAppChooserButton // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if modal { + _arg1 = C.TRUE + } + + C.gtk_app_chooser_button_set_modal(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(modal) +} + +// SetShowDefaultItem sets whether the dropdown menu of this button should show +// the default application for the given content type at top. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - setting: new value for gtk.AppChooserButton:show-default-item. +func (self *AppChooserButton) SetShowDefaultItem(setting bool) { + var _arg0 *C.GtkAppChooserButton // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if setting { + _arg1 = C.TRUE + } + + C.gtk_app_chooser_button_set_show_default_item(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(setting) +} + +// SetShowDialogItem sets whether the dropdown menu of this button should show +// an entry to trigger a GtkAppChooserDialog. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - setting: new value for gtk.AppChooserButton:show-dialog-item. +func (self *AppChooserButton) SetShowDialogItem(setting bool) { + var _arg0 *C.GtkAppChooserButton // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAppChooserButton)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if setting { + _arg1 = C.TRUE + } + + C.gtk_app_chooser_button_set_show_dialog_item(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(setting) +} + +// AppChooserDialog: GtkAppChooserDialog shows a GtkAppChooserWidget inside a +// GtkDialog. +// +// !An example GtkAppChooserDialog (appchooserdialog.png) +// +// Note that GtkAppChooserDialog does not have any interesting methods of +// its own. Instead, you should get the embedded GtkAppChooserWidget using +// gtk.AppChooserDialog.GetWidget() and call its methods if the generic +// gtk.AppChooser interface is not sufficient for your needs. +// +// To set the heading that is shown above the GtkAppChooserWidget, use +// gtk.AppChooserDialog.SetHeading(). +// +// # CSS nodes +// +// GtkAppChooserDialog has a single CSS node with the name window and style +// class .appchooser. +// +// Deprecated: The application selection widgets should be implemented according +// to the design of each platform and/or application requiring them. +type AppChooserDialog struct { + _ [0]func() // equal guard + Dialog + + *coreglib.Object + AppChooser +} + +var ( + _ coreglib.Objector = (*AppChooserDialog)(nil) + _ Widgetter = (*AppChooserDialog)(nil) +) + +func wrapAppChooserDialog(obj *coreglib.Object) *AppChooserDialog { + return &AppChooserDialog{ + Dialog: Dialog{ + Window: Window{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + Object: obj, + Root: Root{ + NativeSurface: NativeSurface{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + }, + }, + ShortcutManager: ShortcutManager{ + Object: obj, + }, + }, + }, + Object: obj, + AppChooser: AppChooser{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + }, + } +} + +func marshalAppChooserDialog(p uintptr) (interface{}, error) { + return wrapAppChooserDialog(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewAppChooserDialog creates a new GtkAppChooserDialog for the provided GFile. +// +// The dialog will show applications that can open the file. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - parent (optional): GtkWindow. +// - flags for this dialog. +// - file: GFile. +// +// The function returns the following values: +// +// - appChooserDialog: newly created GtkAppChooserDialog. +func NewAppChooserDialog(parent *Window, flags DialogFlags, file gio.Filer) *AppChooserDialog { + var _arg1 *C.GtkWindow // out + var _arg2 C.GtkDialogFlags // out + var _arg3 *C.GFile // out + var _cret *C.GtkWidget // in + + if parent != nil { + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + _arg2 = C.GtkDialogFlags(flags) + _arg3 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + + _cret = C.gtk_app_chooser_dialog_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(parent) + runtime.KeepAlive(flags) + runtime.KeepAlive(file) + + var _appChooserDialog *AppChooserDialog // out + + _appChooserDialog = wrapAppChooserDialog(coreglib.Take(unsafe.Pointer(_cret))) + + return _appChooserDialog +} + +// NewAppChooserDialogForContentType creates a new GtkAppChooserDialog for the +// provided content type. +// +// The dialog will show applications that can open the content type. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - parent (optional): GtkWindow. +// - flags for this dialog. +// - contentType: content type string. +// +// The function returns the following values: +// +// - appChooserDialog: newly created GtkAppChooserDialog. +func NewAppChooserDialogForContentType(parent *Window, flags DialogFlags, contentType string) *AppChooserDialog { + var _arg1 *C.GtkWindow // out + var _arg2 C.GtkDialogFlags // out + var _arg3 *C.char // out + var _cret *C.GtkWidget // in + + if parent != nil { + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(parent).Native())) + } + _arg2 = C.GtkDialogFlags(flags) + _arg3 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg3)) + + _cret = C.gtk_app_chooser_dialog_new_for_content_type(_arg1, _arg2, _arg3) + runtime.KeepAlive(parent) + runtime.KeepAlive(flags) + runtime.KeepAlive(contentType) + + var _appChooserDialog *AppChooserDialog // out + + _appChooserDialog = wrapAppChooserDialog(coreglib.Take(unsafe.Pointer(_cret))) + + return _appChooserDialog +} + +// Heading returns the text to display at the top of the dialog. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - utf8 (optional): text to display at the top of the dialog, or NULL, +// in which case a default text is displayed. +func (self *AppChooserDialog) Heading() string { + var _arg0 *C.GtkAppChooserDialog // out + var _cret *C.char // in + + _arg0 = (*C.GtkAppChooserDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_dialog_get_heading(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Widget returns the GtkAppChooserWidget of this dialog. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - widget: GtkAppChooserWidget of self. +func (self *AppChooserDialog) Widget() Widgetter { + var _arg0 *C.GtkAppChooserDialog // out + var _cret *C.GtkWidget // in + + _arg0 = (*C.GtkAppChooserDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_dialog_get_widget(_arg0) + runtime.KeepAlive(self) + + var _widget Widgetter // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gtk.Widgetter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Widgetter) + return ok + }) + rv, ok := casted.(Widgetter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter") + } + _widget = rv + } + + return _widget +} + +// SetHeading sets the text to display at the top of the dialog. +// +// If the heading is not set, the dialog displays a default text. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - heading: string containing Pango markup. +func (self *AppChooserDialog) SetHeading(heading string) { + var _arg0 *C.GtkAppChooserDialog // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAppChooserDialog)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(heading))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_app_chooser_dialog_set_heading(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(heading) +} + +// AppChooserWidget: GtkAppChooserWidget is a widget for selecting applications. +// +// It is the main building block for gtk.AppChooserDialog. Most applications +// only need to use the latter; but you can use this widget as part of a larger +// widget if you have special needs. +// +// GtkAppChooserWidget offers detailed control over what applications +// are shown, using the gtk.AppChooserWidget:show-default, +// gtk.AppChooserWidget:show-recommended, gtk.AppChooserWidget:show-fallback, +// gtk.AppChooserWidget:show-other and gtk.AppChooserWidget:show-all properties. +// See the gtk.AppChooser documentation for more information about these groups +// of applications. +// +// To keep track of the selected application, use the +// gtk.AppChooserWidget::application-selected and +// gtk.AppChooserWidget::application-activated signals. +// +// # CSS nodes +// +// GtkAppChooserWidget has a single CSS node with name appchooser. +// +// Deprecated: The application selection widgets should be implemented according +// to the design of each platform and/or application requiring them. +type AppChooserWidget struct { + _ [0]func() // equal guard + Widget + + *coreglib.Object + AppChooser +} + +var ( + _ Widgetter = (*AppChooserWidget)(nil) + _ coreglib.Objector = (*AppChooserWidget)(nil) +) + +func wrapAppChooserWidget(obj *coreglib.Object) *AppChooserWidget { + return &AppChooserWidget{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + Object: obj, + AppChooser: AppChooser{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + }, + } +} + +func marshalAppChooserWidget(p uintptr) (interface{}, error) { + return wrapAppChooserWidget(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectApplicationActivated is emitted when an application item is activated +// from the widget's list. +// +// This usually happens when the user double clicks an item, or an item is +// selected and the user presses one of the keys Space, Shift+Space, Return or +// Enter. +func (self *AppChooserWidget) ConnectApplicationActivated(f func(application gio.AppInfor)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(self, "application-activated", false, unsafe.Pointer(C._gotk4_gtk4_AppChooserWidget_ConnectApplicationActivated), f) +} + +// ConnectApplicationSelected is emitted when an application item is selected +// from the widget's list. +func (self *AppChooserWidget) ConnectApplicationSelected(f func(application gio.AppInfor)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(self, "application-selected", false, unsafe.Pointer(C._gotk4_gtk4_AppChooserWidget_ConnectApplicationSelected), f) +} + +// NewAppChooserWidget creates a new GtkAppChooserWidget for applications that +// can handle content of the given type. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - contentType: content type to show applications for. +// +// The function returns the following values: +// +// - appChooserWidget: newly created GtkAppChooserWidget. +func NewAppChooserWidget(contentType string) *AppChooserWidget { + var _arg1 *C.char // out + var _cret *C.GtkWidget // in + + _arg1 = (*C.char)(unsafe.Pointer(C.CString(contentType))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gtk_app_chooser_widget_new(_arg1) + runtime.KeepAlive(contentType) + + var _appChooserWidget *AppChooserWidget // out + + _appChooserWidget = wrapAppChooserWidget(coreglib.Take(unsafe.Pointer(_cret))) + + return _appChooserWidget +} + +// DefaultText returns the text that is shown if there are not applications that +// can handle the content type. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - utf8 (optional): value of gtk.AppChooserWidget:default-text. +func (self *AppChooserWidget) DefaultText() string { + var _arg0 *C.GtkAppChooserWidget // out + var _cret *C.char // in + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_widget_get_default_text(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// ShowAll gets whether the app chooser should show all applications in a flat +// list. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - ok: value of gtk.AppChooserWidget:show-all. +func (self *AppChooserWidget) ShowAll() bool { + var _arg0 *C.GtkAppChooserWidget // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_widget_get_show_all(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ShowDefault gets whether the app chooser should show the default handler for +// the content type in a separate section. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - ok: value of gtk.AppChooserWidget:show-default. +func (self *AppChooserWidget) ShowDefault() bool { + var _arg0 *C.GtkAppChooserWidget // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_widget_get_show_default(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ShowFallback gets whether the app chooser should show related applications +// for the content type in a separate section. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - ok: value of gtk.AppChooserWidget:show-fallback. +func (self *AppChooserWidget) ShowFallback() bool { + var _arg0 *C.GtkAppChooserWidget // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_widget_get_show_fallback(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ShowOther gets whether the app chooser should show applications which are +// unrelated to the content type. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - ok: value of gtk.AppChooserWidget:show-other. +func (self *AppChooserWidget) ShowOther() bool { + var _arg0 *C.GtkAppChooserWidget // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_widget_get_show_other(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// ShowRecommended gets whether the app chooser should show recommended +// applications for the content type in a separate section. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - ok: value of gtk.AppChooserWidget:show-recommended. +func (self *AppChooserWidget) ShowRecommended() bool { + var _arg0 *C.GtkAppChooserWidget // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_app_chooser_widget_get_show_recommended(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetDefaultText sets the text that is shown if there are not applications that +// can handle the content type. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - text: new value for gtk.AppChooserWidget:default-text. +func (self *AppChooserWidget) SetDefaultText(text string) { + var _arg0 *C.GtkAppChooserWidget // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(text))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gtk_app_chooser_widget_set_default_text(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(text) +} + +// SetShowAll sets whether the app chooser should show all applications in a +// flat list. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - setting: new value for gtk.AppChooserWidget:show-all. +func (self *AppChooserWidget) SetShowAll(setting bool) { + var _arg0 *C.GtkAppChooserWidget // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if setting { + _arg1 = C.TRUE + } + + C.gtk_app_chooser_widget_set_show_all(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(setting) +} + +// SetShowDefault sets whether the app chooser should show the default handler +// for the content type in a separate section. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - setting: new value for gtk.AppChooserWidget:show-default. +func (self *AppChooserWidget) SetShowDefault(setting bool) { + var _arg0 *C.GtkAppChooserWidget // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if setting { + _arg1 = C.TRUE + } + + C.gtk_app_chooser_widget_set_show_default(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(setting) +} + +// SetShowFallback sets whether the app chooser should show related applications +// for the content type in a separate section. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - setting: new value for gtk.AppChooserWidget:show-fallback. +func (self *AppChooserWidget) SetShowFallback(setting bool) { + var _arg0 *C.GtkAppChooserWidget // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if setting { + _arg1 = C.TRUE + } + + C.gtk_app_chooser_widget_set_show_fallback(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(setting) +} + +// SetShowOther sets whether the app chooser should show applications which are +// unrelated to the content type. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - setting: new value for gtk.AppChooserWidget:show-other. +func (self *AppChooserWidget) SetShowOther(setting bool) { + var _arg0 *C.GtkAppChooserWidget // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if setting { + _arg1 = C.TRUE + } + + C.gtk_app_chooser_widget_set_show_other(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(setting) +} + +// SetShowRecommended sets whether the app chooser should show recommended +// applications for the content type in a separate section. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - setting: new value for gtk.AppChooserWidget:show-recommended. +func (self *AppChooserWidget) SetShowRecommended(setting bool) { + var _arg0 *C.GtkAppChooserWidget // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAppChooserWidget)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if setting { + _arg1 = C.TRUE + } + + C.gtk_app_chooser_widget_set_show_recommended(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(setting) +} + +// ApplicationOverrides contains methods that are overridable. +type ApplicationOverrides struct { + // WindowAdded: signal emitted when a GtkWindow is added to application + // through gtk_application_add_window(). + WindowAdded func(window *Window) + // WindowRemoved: signal emitted when a GtkWindow is removed from + // application, either as a side-effect of being destroyed or explicitly + // through gtk_application_remove_window(). + WindowRemoved func(window *Window) +} + +func defaultApplicationOverrides(v *Application) ApplicationOverrides { + return ApplicationOverrides{ + WindowAdded: v.windowAdded, + WindowRemoved: v.windowRemoved, + } +} + +// Application: GtkApplication is a high-level API for writing applications. +// +// It supports many aspects of writing a GTK application in a convenient +// fashion, without enforcing a one-size-fits-all model. +// +// Currently, GtkApplication handles GTK initialization, application uniqueness, +// session management, provides some basic scriptability and desktop shell +// integration by exporting actions and menus and manages a list of toplevel +// windows whose life-cycle is automatically tied to the life-cycle of your +// application. +// +// While GtkApplication works fine with plain gtk.Windows, it is recommended to +// use it together with gtk.ApplicationWindow. +// +// # Automatic resources +// +// GtkApplication will automatically load menus from the GtkBuilder resource +// located at "gtk/menus.ui", relative to the application's resource base path +// (see gio.Application.SetResourceBasePath()). The menu with the ID "menubar" +// is taken as the application's menubar. Additional menus (most interesting +// submenus) can be named and accessed via gtk.Application.GetMenuByID() which +// allows for dynamic population of a part of the menu structure. +// +// Note that automatic resource loading uses the resource base path that is set +// at construction time and will not work if the resource base path is changed +// at a later time. +// +// It is also possible to provide the menubar manually using +// gtk.Application.SetMenubar(). +// +// GtkApplication will also automatically setup an icon search path for +// the default icon theme by appending "icons" to the resource base path. +// This allows your application to easily store its icons as resources. +// See gtk.IconTheme.AddResourcePath() for more information. +// +// If there is a resource located at gtk/help-overlay.ui which defines a +// gtk.ShortcutsWindow with ID help_overlay then GtkApplication associates an +// instance of this shortcuts window with each gtk.ApplicationWindow and sets +// up the keyboard accelerator Control+? to open it. +// To create a menu item that displays the shortcuts window, associate the item +// with the action win.show-help-overlay. +// +// # A simple application +// +// A simple example +// (https://gitlab.gnome.org/GNOME/gtk/tree/main/examples/bp/bloatpad.c) is +// available in the GTK source code repository +// +// GtkApplication optionally registers with a session manager of the users +// session (if you set the gtk.Application:register-session property) and offers +// various functionality related to the session life-cycle. +// +// An application can block various ways to end the session with the +// gtk.Application.Inhibit() function. Typical use cases for this kind of +// inhibiting are long-running, uninterruptible operations, such as burning a CD +// or performing a disk backup. The session manager may not honor the inhibitor, +// but it can be expected to inform the user about the negative consequences of +// ending the session while inhibitors are present. +// +// # See Also +// +// HowDoI: Using GtkApplication (https://wiki.gnome.org/HowDoI/GtkApplication), +// Getting Started with GTK: Basics (getting_started.html#basics). +type Application struct { + _ [0]func() // equal guard + gio.Application +} + +var ( + _ coreglib.Objector = (*Application)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*Application, *ApplicationClass, ApplicationOverrides]( + GTypeApplication, + initApplicationClass, + wrapApplication, + defaultApplicationOverrides, + ) +} + +func initApplicationClass(gclass unsafe.Pointer, overrides ApplicationOverrides, classInitFunc func(*ApplicationClass)) { + pclass := (*C.GtkApplicationClass)(unsafe.Pointer(C.g_type_check_class_cast((*C.GTypeClass)(gclass), C.GType(GTypeApplication)))) + + if overrides.WindowAdded != nil { + pclass.window_added = (*[0]byte)(C._gotk4_gtk4_ApplicationClass_window_added) + } + + if overrides.WindowRemoved != nil { + pclass.window_removed = (*[0]byte)(C._gotk4_gtk4_ApplicationClass_window_removed) + } + + if classInitFunc != nil { + class := (*ApplicationClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapApplication(obj *coreglib.Object) *Application { + return &Application{ + Application: gio.Application{ + Object: obj, + ActionGroup: gio.ActionGroup{ + Object: obj, + }, + ActionMap: gio.ActionMap{ + Object: obj, + }, + }, + } +} + +func marshalApplication(p uintptr) (interface{}, error) { + return wrapApplication(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectQueryEnd is emitted when the session manager is about to end the +// session. +// +// This signal is only emitted if gtk.Application:register-session is TRUE. +// Applications can connect to this signal and call gtk.Application.Inhibit() +// with GTK_APPLICATION_INHIBIT_LOGOUT to delay the end of the session until +// state has been saved. +func (application *Application) ConnectQueryEnd(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "query-end", false, unsafe.Pointer(C._gotk4_gtk4_Application_ConnectQueryEnd), f) +} + +// ConnectWindowAdded is emitted when a gtk.Window is added to application +// through gtk.Application.AddWindow(). +func (application *Application) ConnectWindowAdded(f func(window *Window)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "window-added", false, unsafe.Pointer(C._gotk4_gtk4_Application_ConnectWindowAdded), f) +} + +// ConnectWindowRemoved is emitted when a gtk.Window is removed from +// application. +// +// This can happen as a side-effect of the window being destroyed or explicitly +// through gtk.Application.RemoveWindow(). +func (application *Application) ConnectWindowRemoved(f func(window *Window)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(application, "window-removed", false, unsafe.Pointer(C._gotk4_gtk4_Application_ConnectWindowRemoved), f) +} + +// NewApplication creates a new GtkApplication instance. +// +// When using GtkApplication, it is not necessary to call gtk.Init() manually. +// It is called as soon as the application gets registered as the primary +// instance. +// +// Concretely, gtk.Init() is called in the default handler for the +// GApplication::startup signal. Therefore, GtkApplication subclasses should +// always chain up in their GApplication::startup handler before using any GTK +// API. +// +// Note that commandline arguments are not passed to gtk.Init(). +// +// If application_id is not NULL, then it must be valid. See +// g_application_id_is_valid(). +// +// If no application ID is given then some features (most notably application +// uniqueness) will be disabled. +// +// The function takes the following parameters: +// +// - applicationId (optional): application ID. +// - flags: application flags. +// +// The function returns the following values: +// +// - application: new GtkApplication instance. +func NewApplication(applicationId string, flags gio.ApplicationFlags) *Application { + var _arg1 *C.char // out + var _arg2 C.GApplicationFlags // out + var _cret *C.GtkApplication // in + + if applicationId != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(applicationId))) + defer C.free(unsafe.Pointer(_arg1)) + } + _arg2 = C.GApplicationFlags(flags) + + _cret = C.gtk_application_new(_arg1, _arg2) + runtime.KeepAlive(applicationId) + runtime.KeepAlive(flags) + + var _application *Application // out + + _application = wrapApplication(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _application +} + +// AddWindow adds a window to application. +// +// This call can only happen after the application has started; typically, +// you should add new application windows in response to the emission of the +// GApplication::activate signal. +// +// This call is equivalent to setting the gtk.Window:application property of +// window to application. +// +// Normally, the connection between the application and the window will +// remain until the window is destroyed, but you can explicitly remove it with +// gtk.Application.RemoveWindow(). +// +// GTK will keep the application running as long as it has any windows. +// +// The function takes the following parameters: +// +// - window: GtkWindow. +func (application *Application) AddWindow(window *Window) { + var _arg0 *C.GtkApplication // out + var _arg1 *C.GtkWindow // out + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + + C.gtk_application_add_window(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(window) +} + +// AccelsForAction gets the accelerators that are currently associated with the +// given action. +// +// The function takes the following parameters: +// +// - detailedActionName: detailed action name, specifying an action and target +// to obtain accelerators for. +// +// The function returns the following values: +// +// - utf8s: accelerators for detailed_action_name. +func (application *Application) AccelsForAction(detailedActionName string) []string { + var _arg0 *C.GtkApplication // out + var _arg1 *C.char // out + var _cret **C.char // in + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(detailedActionName))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gtk_application_get_accels_for_action(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(detailedActionName) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// ActionsForAccel returns the list of actions (possibly empty) that accel maps +// to. +// +// Each item in the list is a detailed action name in the usual form. +// +// This might be useful to discover if an accel already exists in order to +// prevent installation of a conflicting accelerator (from an accelerator editor +// or a plugin system, for example). Note that having more than one action per +// accelerator may not be a bad thing and might make sense in cases where the +// actions never appear in the same context. +// +// In case there are no actions for a given accelerator, an empty array is +// returned. NULL is never returned. +// +// It is a programmer error to pass an invalid accelerator string. +// +// If you are unsure, check it with gtk.AcceleratorParse() first. +// +// The function takes the following parameters: +// +// - accel: accelerator that can be parsed by gtk.AcceleratorParse(). +// +// The function returns the following values: +// +// - utf8s: NULL-terminated array of actions for accel. +func (application *Application) ActionsForAccel(accel string) []string { + var _arg0 *C.GtkApplication // out + var _arg1 *C.char // out + var _cret **C.char // in + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(accel))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gtk_application_get_actions_for_accel(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(accel) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// ActiveWindow gets the “active” window for the application. +// +// The active window is the one that was most recently focused (within the +// application). This window may not have the focus at the moment if another +// application has it — this is just the most recently-focused window within +// this application. +// +// The function returns the following values: +// +// - window (optional): active window. +func (application *Application) ActiveWindow() *Window { + var _arg0 *C.GtkApplication // out + var _cret *C.GtkWindow // in + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.gtk_application_get_active_window(_arg0) + runtime.KeepAlive(application) + + var _window *Window // out + + if _cret != nil { + _window = wrapWindow(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _window +} + +// MenuByID gets a menu from automatically loaded resources. +// +// See the section on Automatic resources +// (class.Application.html#automatic-resources) for more information. +// +// The function takes the following parameters: +// +// - id of the menu to look up. +// +// The function returns the following values: +// +// - menu (optional) gets the menu with the given id from the automatically +// loaded resources. +func (application *Application) MenuByID(id string) *gio.Menu { + var _arg0 *C.GtkApplication // out + var _arg1 *C.char // out + var _cret *C.GMenu // in + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(id))) + defer C.free(unsafe.Pointer(_arg1)) + + _cret = C.gtk_application_get_menu_by_id(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(id) + + var _menu *gio.Menu // out + + if _cret != nil { + { + obj := coreglib.Take(unsafe.Pointer(_cret)) + _menu = &gio.Menu{ + MenuModel: gio.MenuModel{ + Object: obj, + }, + } + } + } + + return _menu +} + +// Menubar returns the menu model that has been set with +// gtk.Application.SetMenubar(). +// +// The function returns the following values: +// +// - menuModel (optional): menubar for windows of application. +func (application *Application) Menubar() gio.MenuModeller { + var _arg0 *C.GtkApplication // out + var _cret *C.GMenuModel // in + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.gtk_application_get_menubar(_arg0) + runtime.KeepAlive(application) + + var _menuModel gio.MenuModeller // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(gio.MenuModeller) + return ok + }) + rv, ok := casted.(gio.MenuModeller) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.MenuModeller") + } + _menuModel = rv + } + } + + return _menuModel +} + +// WindowByID returns the gtk.ApplicationWindow with the given ID. +// +// The ID of a GtkApplicationWindow can be retrieved with +// gtk.ApplicationWindow.GetID(). +// +// The function takes the following parameters: +// +// - id: identifier number. +// +// The function returns the following values: +// +// - window (optional) for the given id. +func (application *Application) WindowByID(id uint) *Window { + var _arg0 *C.GtkApplication // out + var _arg1 C.guint // out + var _cret *C.GtkWindow // in + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = C.guint(id) + + _cret = C.gtk_application_get_window_by_id(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(id) + + var _window *Window // out + + if _cret != nil { + _window = wrapWindow(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _window +} + +// Windows gets a list of the gtk.Window instances associated with application. +// +// The list is sorted by most recently focused window, such that the first +// element is the currently focused window. (Useful for choosing a parent for a +// transient window.) +// +// The list that is returned should not be modified in any way. It will only +// remain valid until the next focus change or window creation or deletion. +// +// The function returns the following values: +// +// - list: GList of GtkWindow instances. +func (application *Application) Windows() []*Window { + var _arg0 *C.GtkApplication // out + var _cret *C.GList // in + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.gtk_application_get_windows(_arg0) + runtime.KeepAlive(application) + + var _list []*Window // out + + _list = make([]*Window, 0, gextras.ListSize(unsafe.Pointer(_cret))) + gextras.MoveList(unsafe.Pointer(_cret), false, func(v unsafe.Pointer) { + src := (*C.GtkWindow)(v) + var dst *Window // out + dst = wrapWindow(coreglib.Take(unsafe.Pointer(src))) + _list = append(_list, dst) + }) + + return _list +} + +// Inhibit: inform the session manager that certain types of actions should be +// inhibited. +// +// This is not guaranteed to work on all platforms and for all types of actions. +// +// Applications should invoke this method when they begin an operation +// that should not be interrupted, such as creating a CD or DVD. +// The types of actions that may be blocked are specified by the flags +// parameter. When the application completes the operation it should call +// gtk.Application.Uninhibit() to remove the inhibitor. Note that an application +// can have multiple inhibitors, and all of them must be individually removed. +// Inhibitors are also cleared when the application exits. +// +// Applications should not expect that they will always be able to block the +// action. In most cases, users will be given the option to force the action to +// take place. +// +// The reason message should be short and to the point. +// +// If window is given, the session manager may point the user to this window to +// find out more about why the action is inhibited. +// +// The function takes the following parameters: +// +// - window (optional): GtkWindow. +// - flags: what types of actions should be inhibited. +// - reason (optional): short, human-readable string that explains why these +// operations are inhibited. +// +// The function returns the following values: +// +// - guint: non-zero cookie that is used to uniquely identify this request. +// It should be used as an argument to gtk.Application.Uninhibit() in order +// to remove the request. If the platform does not support inhibiting or the +// request failed for some reason, 0 is returned. +func (application *Application) Inhibit(window *Window, flags ApplicationInhibitFlags, reason string) uint { + var _arg0 *C.GtkApplication // out + var _arg1 *C.GtkWindow // out + var _arg2 C.GtkApplicationInhibitFlags // out + var _arg3 *C.char // out + var _cret C.guint // in + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + if window != nil { + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + } + _arg2 = C.GtkApplicationInhibitFlags(flags) + if reason != "" { + _arg3 = (*C.char)(unsafe.Pointer(C.CString(reason))) + defer C.free(unsafe.Pointer(_arg3)) + } + + _cret = C.gtk_application_inhibit(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(application) + runtime.KeepAlive(window) + runtime.KeepAlive(flags) + runtime.KeepAlive(reason) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// ListActionDescriptions lists the detailed action names which have associated +// accelerators. +// +// See gtk.Application.SetAccelsForAction(). +// +// The function returns the following values: +// +// - utf8s: detailed action names. +func (application *Application) ListActionDescriptions() []string { + var _arg0 *C.GtkApplication // out + var _cret **C.char // in + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.gtk_application_list_action_descriptions(_arg0) + runtime.KeepAlive(application) + + var _utf8s []string // out + + defer C.free(unsafe.Pointer(_cret)) + { + var i int + var z *C.char + for p := _cret; *p != z; p = &unsafe.Slice(p, 2)[1] { + i++ + } + + src := unsafe.Slice(_cret, i) + _utf8s = make([]string, i) + for i := range src { + _utf8s[i] = C.GoString((*C.gchar)(unsafe.Pointer(src[i]))) + defer C.free(unsafe.Pointer(src[i])) + } + } + + return _utf8s +} + +// RemoveWindow: remove a window from application. +// +// If window belongs to application then this call is equivalent to setting the +// gtk.Window:application property of window to NULL. +// +// The application may stop running as a result of a call to this function, +// if window was the last window of the application. +// +// The function takes the following parameters: +// +// - window: GtkWindow. +func (application *Application) RemoveWindow(window *Window) { + var _arg0 *C.GtkApplication // out + var _arg1 *C.GtkWindow // out + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + + C.gtk_application_remove_window(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(window) +} + +// SetAccelsForAction sets zero or more keyboard accelerators that will trigger +// the given action. +// +// The first item in accels will be the primary accelerator, which may be +// displayed in the UI. +// +// To remove all accelerators for an action, use an empty, zero-terminated array +// for accels. +// +// For the detailed_action_name, see g_action_parse_detailed_name() and +// g_action_print_detailed_name(). +// +// The function takes the following parameters: +// +// - detailedActionName: detailed action name, specifying an action and target +// to associate accelerators with. +// - accels: list of accelerators in the format understood by +// gtk.AcceleratorParse(). +func (application *Application) SetAccelsForAction(detailedActionName string, accels []string) { + var _arg0 *C.GtkApplication // out + var _arg1 *C.char // out + var _arg2 **C.char // out + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.char)(unsafe.Pointer(C.CString(detailedActionName))) + defer C.free(unsafe.Pointer(_arg1)) + { + _arg2 = (**C.char)(C.calloc(C.size_t((len(accels) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) + defer C.free(unsafe.Pointer(_arg2)) + { + out := unsafe.Slice(_arg2, len(accels)+1) + var zero *C.char + out[len(accels)] = zero + for i := range accels { + out[i] = (*C.char)(unsafe.Pointer(C.CString(accels[i]))) + defer C.free(unsafe.Pointer(out[i])) + } + } + } + + C.gtk_application_set_accels_for_action(_arg0, _arg1, _arg2) + runtime.KeepAlive(application) + runtime.KeepAlive(detailedActionName) + runtime.KeepAlive(accels) +} + +// SetMenubar sets or unsets the menubar for windows of application. +// +// This is a menubar in the traditional sense. +// +// This can only be done in the primary instance of the application, after it +// has been registered. GApplication::startup is a good place to call this. +// +// Depending on the desktop environment, this may appear at the top of each +// window, or at the top of the screen. In some environments, if both the +// application menu and the menubar are set, the application menu will be +// presented as if it were the first item of the menubar. Other environments +// treat the two as completely separate — for example, the application menu may +// be rendered by the desktop shell while the menubar (if set) remains in each +// individual window. +// +// Use the base GActionMap interface to add actions, to respond to the user +// selecting these menu items. +// +// The function takes the following parameters: +// +// - menubar (optional): GMenuModel. +func (application *Application) SetMenubar(menubar gio.MenuModeller) { + var _arg0 *C.GtkApplication // out + var _arg1 *C.GMenuModel // out + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + if menubar != nil { + _arg1 = (*C.GMenuModel)(unsafe.Pointer(coreglib.InternObject(menubar).Native())) + } + + C.gtk_application_set_menubar(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(menubar) +} + +// Uninhibit removes an inhibitor that has been previously established. +// +// See gtk.Application.Inhibit(). +// +// Inhibitors are also cleared when the application exits. +// +// The function takes the following parameters: +// +// - cookie that was returned by gtk.Application.Inhibit(). +func (application *Application) Uninhibit(cookie uint) { + var _arg0 *C.GtkApplication // out + var _arg1 C.guint // out + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = C.guint(cookie) + + C.gtk_application_uninhibit(_arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(cookie) +} + +// windowAdded: signal emitted when a GtkWindow is added to application through +// gtk_application_add_window(). +func (application *Application) windowAdded(window *Window) { + gclass := (*C.GtkApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.window_added + + var _arg0 *C.GtkApplication // out + var _arg1 *C.GtkWindow // out + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + + C._gotk4_gtk4_Application_virtual_window_added(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(window) +} + +// windowRemoved: signal emitted when a GtkWindow is removed from application, +// either as a side-effect of being destroyed or explicitly through +// gtk_application_remove_window(). +func (application *Application) windowRemoved(window *Window) { + gclass := (*C.GtkApplicationClass)(coreglib.PeekParentClass(application)) + fnarg := gclass.window_removed + + var _arg0 *C.GtkApplication // out + var _arg1 *C.GtkWindow // out + + _arg0 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + _arg1 = (*C.GtkWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + + C._gotk4_gtk4_Application_virtual_window_removed(unsafe.Pointer(fnarg), _arg0, _arg1) + runtime.KeepAlive(application) + runtime.KeepAlive(window) +} + +// ApplicationWindowOverrides contains methods that are overridable. +type ApplicationWindowOverrides struct { +} + +func defaultApplicationWindowOverrides(v *ApplicationWindow) ApplicationWindowOverrides { + return ApplicationWindowOverrides{} +} + +// ApplicationWindow: GtkApplicationWindow is a GtkWindow subclass that +// integrates with GtkApplication. +// +// Notably, GtkApplicationWindow can handle an application menubar. +// +// This class implements the GActionGroup and GActionMap interfaces, to let +// you add window-specific actions that will be exported by the associated +// gtk.Application, together with its application-wide actions. Window-specific +// actions are prefixed with the “win.” prefix and application-wide actions are +// prefixed with the “app.” prefix. Actions must be addressed with the prefixed +// name when referring to them from a GMenuModel. +// +// Note that widgets that are placed inside a GtkApplicationWindow can also +// activate these actions, if they implement the gtk.Actionable interface. +// +// The settings gtk.Settings:gtk-shell-shows-app-menu and +// gtk.Settings:gtk-shell-shows-menubar tell GTK whether the desktop environment +// is showing the application menu and menubar models outside the application +// as part of the desktop shell. For instance, on OS X, both menus will be +// displayed remotely; on Windows neither will be. +// +// If the desktop environment does not display the menubar, then +// GtkApplicationWindow will automatically show a menubar for it. This behaviour +// can be overridden with the gtk.ApplicationWindow:show-menubar property. +// If the desktop environment does not display the application menu, then it +// will automatically be included in the menubar or in the windows client-side +// decorations. +// +// See gtk.PopoverMenu for information about the XML language used by GtkBuilder +// for menu models. +// +// See also: gtk.Application.SetMenubar(). +// +// # A GtkApplicationWindow with a menubar +// +// The code sample below shows how to set up a GtkApplicationWindow with a menu +// bar defined on the gtk.Application: +// +// GtkApplication *app = gtk_application_new ("org.gtk.test", 0); +// +// GtkBuilder *builder = gtk_builder_new_from_string ( +// "" +// " " +// " " +// " _Edit" +// " " +// " _Copy" +// " win.copy" +// " " +// " " +// " _Paste" +// " win.paste" +// " " +// " " +// " " +// "", +// -1); +// +// GMenuModel *menubar = G_MENU_MODEL (gtk_builder_get_object (builder, "menubar")); +// gtk_application_set_menubar (GTK_APPLICATION (app), menubar); +// g_object_unref (builder); +// +// // ... +// +// GtkWidget *window = gtk_application_window_new (app);. +type ApplicationWindow struct { + _ [0]func() // equal guard + Window + + *coreglib.Object + gio.ActionGroup + gio.ActionMap +} + +var ( + _ coreglib.Objector = (*ApplicationWindow)(nil) + _ Widgetter = (*ApplicationWindow)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*ApplicationWindow, *ApplicationWindowClass, ApplicationWindowOverrides]( + GTypeApplicationWindow, + initApplicationWindowClass, + wrapApplicationWindow, + defaultApplicationWindowOverrides, + ) +} + +func initApplicationWindowClass(gclass unsafe.Pointer, overrides ApplicationWindowOverrides, classInitFunc func(*ApplicationWindowClass)) { + if classInitFunc != nil { + class := (*ApplicationWindowClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapApplicationWindow(obj *coreglib.Object) *ApplicationWindow { + return &ApplicationWindow{ + Window: Window{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + Object: obj, + Root: Root{ + NativeSurface: NativeSurface{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + }, + }, + ShortcutManager: ShortcutManager{ + Object: obj, + }, + }, + Object: obj, + ActionGroup: gio.ActionGroup{ + Object: obj, + }, + ActionMap: gio.ActionMap{ + Object: obj, + }, + } +} + +func marshalApplicationWindow(p uintptr) (interface{}, error) { + return wrapApplicationWindow(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewApplicationWindow creates a new GtkApplicationWindow. +// +// The function takes the following parameters: +// +// - application: GtkApplication. +// +// The function returns the following values: +// +// - applicationWindow: newly created GtkApplicationWindow. +func NewApplicationWindow(application *Application) *ApplicationWindow { + var _arg1 *C.GtkApplication // out + var _cret *C.GtkWidget // in + + _arg1 = (*C.GtkApplication)(unsafe.Pointer(coreglib.InternObject(application).Native())) + + _cret = C.gtk_application_window_new(_arg1) + runtime.KeepAlive(application) + + var _applicationWindow *ApplicationWindow // out + + _applicationWindow = wrapApplicationWindow(coreglib.Take(unsafe.Pointer(_cret))) + + return _applicationWindow +} + +// HelpOverlay gets the GtkShortcutsWindow that is associated with window. +// +// See gtk.ApplicationWindow.SetHelpOverlay(). +// +// The function returns the following values: +// +// - shortcutsWindow (optional): help overlay associated with window. +func (window *ApplicationWindow) HelpOverlay() *ShortcutsWindow { + var _arg0 *C.GtkApplicationWindow // out + var _cret *C.GtkShortcutsWindow // in + + _arg0 = (*C.GtkApplicationWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + + _cret = C.gtk_application_window_get_help_overlay(_arg0) + runtime.KeepAlive(window) + + var _shortcutsWindow *ShortcutsWindow // out + + if _cret != nil { + _shortcutsWindow = wrapShortcutsWindow(coreglib.Take(unsafe.Pointer(_cret))) + } + + return _shortcutsWindow +} + +// ID returns the unique ID of the window. +// +// If the window has not yet been added to a GtkApplication, returns 0. +// +// The function returns the following values: +// +// - guint: unique ID for window, or 0 if the window has not yet been added to +// a GtkApplication. +func (window *ApplicationWindow) ID() uint { + var _arg0 *C.GtkApplicationWindow // out + var _cret C.guint // in + + _arg0 = (*C.GtkApplicationWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + + _cret = C.gtk_application_window_get_id(_arg0) + runtime.KeepAlive(window) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// ShowMenubar returns whether the window will display a menubar for the app +// menu and menubar as needed. +// +// The function returns the following values: +// +// - ok: TRUE if window will display a menubar when needed. +func (window *ApplicationWindow) ShowMenubar() bool { + var _arg0 *C.GtkApplicationWindow // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkApplicationWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + + _cret = C.gtk_application_window_get_show_menubar(_arg0) + runtime.KeepAlive(window) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetHelpOverlay associates a shortcuts window with the application window. +// +// Additionally, sets up an action with the name win.show-help-overlay to +// present it. +// +// window takes responsibility for destroying help_overlay. +// +// The function takes the following parameters: +// +// - helpOverlay (optional): GtkShortcutsWindow. +func (window *ApplicationWindow) SetHelpOverlay(helpOverlay *ShortcutsWindow) { + var _arg0 *C.GtkApplicationWindow // out + var _arg1 *C.GtkShortcutsWindow // out + + _arg0 = (*C.GtkApplicationWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + if helpOverlay != nil { + _arg1 = (*C.GtkShortcutsWindow)(unsafe.Pointer(coreglib.InternObject(helpOverlay).Native())) + } + + C.gtk_application_window_set_help_overlay(_arg0, _arg1) + runtime.KeepAlive(window) + runtime.KeepAlive(helpOverlay) +} + +// SetShowMenubar sets whether the window will display a menubar for the app +// menu and menubar as needed. +// +// The function takes the following parameters: +// +// - showMenubar: whether to show a menubar when needed. +func (window *ApplicationWindow) SetShowMenubar(showMenubar bool) { + var _arg0 *C.GtkApplicationWindow // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkApplicationWindow)(unsafe.Pointer(coreglib.InternObject(window).Native())) + if showMenubar { + _arg1 = C.TRUE + } + + C.gtk_application_window_set_show_menubar(_arg0, _arg1) + runtime.KeepAlive(window) + runtime.KeepAlive(showMenubar) +} + +// AspectFrame: GtkAspectFrame preserves the aspect ratio of its child. +// +// The frame can respect the aspect ratio of the child widget, or use its own +// aspect ratio. +// +// # CSS nodes +// +// GtkAspectFrame uses a CSS node with name frame. +// +// # Accessibility +// +// Until GTK 4.10, GtkAspectFrame used the GTK_ACCESSIBLE_ROLE_GROUP role. +// +// Starting from GTK 4.12, GtkAspectFrame uses the GTK_ACCESSIBLE_ROLE_GENERIC +// role. +type AspectFrame struct { + _ [0]func() // equal guard + Widget +} + +var ( + _ Widgetter = (*AspectFrame)(nil) +) + +func wrapAspectFrame(obj *coreglib.Object) *AspectFrame { + return &AspectFrame{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + } +} + +func marshalAspectFrame(p uintptr) (interface{}, error) { + return wrapAspectFrame(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewAspectFrame: create a new GtkAspectFrame. +// +// The function takes the following parameters: +// +// - xalign: horizontal alignment of the child within the parent. Ranges from +// 0.0 (left aligned) to 1.0 (right aligned). +// - yalign: vertical alignment of the child within the parent. Ranges from +// 0.0 (top aligned) to 1.0 (bottom aligned). +// - ratio: desired aspect ratio. +// - obeyChild: if TRUE, ratio is ignored, and the aspect ratio is taken from +// the requistion of the child. +// +// The function returns the following values: +// +// - aspectFrame: new GtkAspectFrame. +func NewAspectFrame(xalign, yalign, ratio float32, obeyChild bool) *AspectFrame { + var _arg1 C.float // out + var _arg2 C.float // out + var _arg3 C.float // out + var _arg4 C.gboolean // out + var _cret *C.GtkWidget // in + + _arg1 = C.float(xalign) + _arg2 = C.float(yalign) + _arg3 = C.float(ratio) + if obeyChild { + _arg4 = C.TRUE + } + + _cret = C.gtk_aspect_frame_new(_arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(xalign) + runtime.KeepAlive(yalign) + runtime.KeepAlive(ratio) + runtime.KeepAlive(obeyChild) + + var _aspectFrame *AspectFrame // out + + _aspectFrame = wrapAspectFrame(coreglib.Take(unsafe.Pointer(_cret))) + + return _aspectFrame +} + +// Child gets the child widget of self. +// +// The function returns the following values: +// +// - widget (optional): child widget of self. +func (self *AspectFrame) Child() Widgetter { + var _arg0 *C.GtkAspectFrame // out + var _cret *C.GtkWidget // in + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_aspect_frame_get_child(_arg0) + runtime.KeepAlive(self) + + var _widget Widgetter // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Widgetter) + return ok + }) + rv, ok := casted.(Widgetter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter") + } + _widget = rv + } + } + + return _widget +} + +// ObeyChild returns whether the child's size request should override the set +// aspect ratio of the GtkAspectFrame. +// +// The function returns the following values: +// +// - ok: whether to obey the child's size request. +func (self *AspectFrame) ObeyChild() bool { + var _arg0 *C.GtkAspectFrame // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_aspect_frame_get_obey_child(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Ratio returns the desired aspect ratio of the child. +// +// The function returns the following values: +// +// - gfloat: desired aspect ratio. +func (self *AspectFrame) Ratio() float32 { + var _arg0 *C.GtkAspectFrame // out + var _cret C.float // in + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_aspect_frame_get_ratio(_arg0) + runtime.KeepAlive(self) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// XAlign returns the horizontal alignment of the child within the allocation of +// the GtkAspectFrame. +// +// The function returns the following values: +// +// - gfloat: horizontal alignment. +func (self *AspectFrame) XAlign() float32 { + var _arg0 *C.GtkAspectFrame // out + var _cret C.float // in + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_aspect_frame_get_xalign(_arg0) + runtime.KeepAlive(self) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// YAlign returns the vertical alignment of the child within the allocation of +// the GtkAspectFrame. +// +// The function returns the following values: +// +// - gfloat: vertical alignment. +func (self *AspectFrame) YAlign() float32 { + var _arg0 *C.GtkAspectFrame // out + var _cret C.float // in + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_aspect_frame_get_yalign(_arg0) + runtime.KeepAlive(self) + + var _gfloat float32 // out + + _gfloat = float32(_cret) + + return _gfloat +} + +// SetChild sets the child widget of self. +// +// The function takes the following parameters: +// +// - child (optional) widget. +func (self *AspectFrame) SetChild(child Widgetter) { + var _arg0 *C.GtkAspectFrame // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if child != nil { + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + } + + C.gtk_aspect_frame_set_child(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(child) +} + +// SetObeyChild sets whether the aspect ratio of the child's size request should +// override the set aspect ratio of the GtkAspectFrame. +// +// The function takes the following parameters: +// +// - obeyChild: if TRUE, ratio is ignored, and the aspect ratio is taken from +// the requisition of the child. +func (self *AspectFrame) SetObeyChild(obeyChild bool) { + var _arg0 *C.GtkAspectFrame // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if obeyChild { + _arg1 = C.TRUE + } + + C.gtk_aspect_frame_set_obey_child(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(obeyChild) +} + +// SetRatio sets the desired aspect ratio of the child. +// +// The function takes the following parameters: +// +// - ratio: aspect ratio of the child. +func (self *AspectFrame) SetRatio(ratio float32) { + var _arg0 *C.GtkAspectFrame // out + var _arg1 C.float // out + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.float(ratio) + + C.gtk_aspect_frame_set_ratio(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(ratio) +} + +// SetXAlign sets the horizontal alignment of the child within the allocation of +// the GtkAspectFrame. +// +// The function takes the following parameters: +// +// - xalign: horizontal alignment, from 0.0 (left aligned) to 1.0 (right +// aligned). +func (self *AspectFrame) SetXAlign(xalign float32) { + var _arg0 *C.GtkAspectFrame // out + var _arg1 C.float // out + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.float(xalign) + + C.gtk_aspect_frame_set_xalign(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(xalign) +} + +// SetYAlign sets the vertical alignment of the child within the allocation of +// the GtkAspectFrame. +// +// The function takes the following parameters: +// +// - yalign: horizontal alignment, from 0.0 (top aligned) to 1.0 (bottom +// aligned). +func (self *AspectFrame) SetYAlign(yalign float32) { + var _arg0 *C.GtkAspectFrame // out + var _arg1 C.float // out + + _arg0 = (*C.GtkAspectFrame)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.float(yalign) + + C.gtk_aspect_frame_set_yalign(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(yalign) +} + +// Assistant: GtkAssistant is used to represent a complex as a series of steps. +// +// !An example GtkAssistant (assistant.png) +// +// Each step consists of one or more pages. GtkAssistant guides the user through +// the pages, and controls the page flow to collect the data needed for the +// operation. +// +// GtkAssistant handles which buttons to show and to make sensitive based +// on page sequence knowledge and the gtk.AssistantPageType of each page in +// addition to state information like the *completed* and *committed* page +// statuses. +// +// If you have a case that doesn’t quite fit in GtkAssistants way of handling +// buttons, you can use the GTK_ASSISTANT_PAGE_CUSTOM page type and handle +// buttons yourself. +// +// GtkAssistant maintains a GtkAssistantPage object for each added child, +// which holds additional per-child properties. You obtain the GtkAssistantPage +// for a child with gtk.Assistant.GetPage(). +// +// # GtkAssistant as GtkBuildable +// +// The GtkAssistant implementation of the GtkBuildable interface exposes the +// action_area as internal children with the name “action_area”. +// +// To add pages to an assistant in GtkBuilder, simply add it as a child to +// the GtkAssistant object. If you need to set per-object properties, create a +// GtkAssistantPage object explicitly, and set the child widget as a property on +// it. +// +// # CSS nodes +// +// GtkAssistant has a single CSS node with the name window and style class +// .assistant. +// +// Deprecated: This widget will be removed in GTK 5. +type Assistant struct { + _ [0]func() // equal guard + Window +} + +var ( + _ Widgetter = (*Assistant)(nil) + _ coreglib.Objector = (*Assistant)(nil) +) + +func wrapAssistant(obj *coreglib.Object) *Assistant { + return &Assistant{ + Window: Window{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + Object: obj, + Root: Root{ + NativeSurface: NativeSurface{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + }, + }, + ShortcutManager: ShortcutManager{ + Object: obj, + }, + }, + } +} + +func marshalAssistant(p uintptr) (interface{}, error) { + return wrapAssistant(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// ConnectApply is emitted when the apply button is clicked. +// +// The default behavior of the GtkAssistant is to switch to the page after the +// current page, unless the current page is the last one. +// +// A handler for the ::apply signal should carry out the actions for which the +// wizard has collected data. If the action takes a long time to complete, you +// might consider putting a page of type GTK_ASSISTANT_PAGE_PROGRESS after the +// confirmation page and handle this operation within the gtk.Assistant::prepare +// signal of the progress page. +func (assistant *Assistant) ConnectApply(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(assistant, "apply", false, unsafe.Pointer(C._gotk4_gtk4_Assistant_ConnectApply), f) +} + +// ConnectCancel is emitted when then the cancel button is clicked. +func (assistant *Assistant) ConnectCancel(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(assistant, "cancel", false, unsafe.Pointer(C._gotk4_gtk4_Assistant_ConnectCancel), f) +} + +// ConnectClose is emitted either when the close button of a summary page is +// clicked, or when the apply button in the last page in the flow (of type +// GTK_ASSISTANT_PAGE_CONFIRM) is clicked. +func (assistant *Assistant) ConnectClose(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(assistant, "close", false, unsafe.Pointer(C._gotk4_gtk4_Assistant_ConnectClose), f) +} + +// ConnectEscape: action signal for the Escape binding. +func (assistant *Assistant) ConnectEscape(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(assistant, "escape", false, unsafe.Pointer(C._gotk4_gtk4_Assistant_ConnectEscape), f) +} + +// ConnectPrepare is emitted when a new page is set as the assistant's current +// page, before making the new page visible. +// +// A handler for this signal can do any preparations which are necessary before +// showing page. +func (assistant *Assistant) ConnectPrepare(f func(page Widgetter)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(assistant, "prepare", false, unsafe.Pointer(C._gotk4_gtk4_Assistant_ConnectPrepare), f) +} + +// NewAssistant creates a new GtkAssistant. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - assistant: newly created GtkAssistant. +func NewAssistant() *Assistant { + var _cret *C.GtkWidget // in + + _cret = C.gtk_assistant_new() + + var _assistant *Assistant // out + + _assistant = wrapAssistant(coreglib.Take(unsafe.Pointer(_cret))) + + return _assistant +} + +// AddActionWidget adds a widget to the action area of a GtkAssistant. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - child: GtkWidget. +func (assistant *Assistant) AddActionWidget(child Widgetter) { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + + C.gtk_assistant_add_action_widget(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(child) +} + +// AppendPage appends a page to the assistant. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - page: GtkWidget. +// +// The function returns the following values: +// +// - gint: index (starting at 0) of the inserted page. +func (assistant *Assistant) AppendPage(page Widgetter) int { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _cret C.int // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(page).Native())) + + _cret = C.gtk_assistant_append_page(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(page) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// Commit erases the visited page history. +// +// GTK will then hide the back button on the current page, and removes the +// cancel button from subsequent pages. +// +// Use this when the information provided up to the current page is hereafter +// deemed permanent and cannot be modified or undone. For example, showing a +// progress page to track a long-running, unreversible operation after the user +// has clicked apply on a confirmation page. +// +// Deprecated: This widget will be removed in GTK 5. +func (assistant *Assistant) Commit() { + var _arg0 *C.GtkAssistant // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + + C.gtk_assistant_commit(_arg0) + runtime.KeepAlive(assistant) +} + +// CurrentPage returns the page number of the current page. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - gint: index (starting from 0) of the current page in the assistant, +// or -1 if the assistant has no pages, or no current page. +func (assistant *Assistant) CurrentPage() int { + var _arg0 *C.GtkAssistant // out + var _cret C.int // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + + _cret = C.gtk_assistant_get_current_page(_arg0) + runtime.KeepAlive(assistant) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// NPages returns the number of pages in the assistant +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - gint: number of pages in the assistant. +func (assistant *Assistant) NPages() int { + var _arg0 *C.GtkAssistant // out + var _cret C.int // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + + _cret = C.gtk_assistant_get_n_pages(_arg0) + runtime.KeepAlive(assistant) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// NthPage returns the child widget contained in page number page_num. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - pageNum: index of a page in the assistant, or -1 to get the last page. +// +// The function returns the following values: +// +// - widget (optional): child widget, or NULL if page_num is out of bounds. +func (assistant *Assistant) NthPage(pageNum int) Widgetter { + var _arg0 *C.GtkAssistant // out + var _arg1 C.int // out + var _cret *C.GtkWidget // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = C.int(pageNum) + + _cret = C.gtk_assistant_get_nth_page(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(pageNum) + + var _widget Widgetter // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Widgetter) + return ok + }) + rv, ok := casted.(Widgetter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter") + } + _widget = rv + } + } + + return _widget +} + +// Page returns the GtkAssistantPage object for child. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - child of assistant. +// +// The function returns the following values: +// +// - assistantPage: GtkAssistantPage for child. +func (assistant *Assistant) Page(child Widgetter) *AssistantPage { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _cret *C.GtkAssistantPage // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + + _cret = C.gtk_assistant_get_page(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(child) + + var _assistantPage *AssistantPage // out + + _assistantPage = wrapAssistantPage(coreglib.Take(unsafe.Pointer(_cret))) + + return _assistantPage +} + +// PageComplete gets whether page is complete. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - page of assistant. +// +// The function returns the following values: +// +// - ok: TRUE if page is complete. +func (assistant *Assistant) PageComplete(page Widgetter) bool { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(page).Native())) + + _cret = C.gtk_assistant_get_page_complete(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(page) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// PageTitle gets the title for page. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - page of assistant. +// +// The function returns the following values: +// +// - utf8: title for page. +func (assistant *Assistant) PageTitle(page Widgetter) string { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _cret *C.char // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(page).Native())) + + _cret = C.gtk_assistant_get_page_title(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(page) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + +// PageType gets the page type of page. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - page of assistant. +// +// The function returns the following values: +// +// - assistantPageType: page type of page. +func (assistant *Assistant) PageType(page Widgetter) AssistantPageType { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _cret C.GtkAssistantPageType // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(page).Native())) + + _cret = C.gtk_assistant_get_page_type(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(page) + + var _assistantPageType AssistantPageType // out + + _assistantPageType = AssistantPageType(_cret) + + return _assistantPageType +} + +// Pages gets a list model of the assistant pages. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - listModel: list model of the pages. +func (assistant *Assistant) Pages() *gio.ListModel { + var _arg0 *C.GtkAssistant // out + var _cret *C.GListModel // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + + _cret = C.gtk_assistant_get_pages(_arg0) + runtime.KeepAlive(assistant) + + var _listModel *gio.ListModel // out + + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _listModel = &gio.ListModel{ + Object: obj, + } + } + + return _listModel +} + +// InsertPage inserts a page in the assistant at a given position. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - page: GtkWidget. +// - position: index (starting at 0) at which to insert the page, or -1 to +// append the page to the assistant. +// +// The function returns the following values: +// +// - gint: index (starting from 0) of the inserted page. +func (assistant *Assistant) InsertPage(page Widgetter, position int) int { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _arg2 C.int // out + var _cret C.int // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(page).Native())) + _arg2 = C.int(position) + + _cret = C.gtk_assistant_insert_page(_arg0, _arg1, _arg2) + runtime.KeepAlive(assistant) + runtime.KeepAlive(page) + runtime.KeepAlive(position) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// NextPage: navigate to the next page. +// +// It is a programming error to call this function when there is no next page. +// +// This function is for use when creating pages of the GTK_ASSISTANT_PAGE_CUSTOM +// type. +// +// Deprecated: This widget will be removed in GTK 5. +func (assistant *Assistant) NextPage() { + var _arg0 *C.GtkAssistant // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + + C.gtk_assistant_next_page(_arg0) + runtime.KeepAlive(assistant) +} + +// PrependPage prepends a page to the assistant. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - page: GtkWidget. +// +// The function returns the following values: +// +// - gint: index (starting at 0) of the inserted page. +func (assistant *Assistant) PrependPage(page Widgetter) int { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _cret C.int // in + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(page).Native())) + + _cret = C.gtk_assistant_prepend_page(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(page) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// PreviousPage: navigate to the previous visited page. +// +// It is a programming error to call this function when no previous page is +// available. +// +// This function is for use when creating pages of the GTK_ASSISTANT_PAGE_CUSTOM +// type. +// +// Deprecated: This widget will be removed in GTK 5. +func (assistant *Assistant) PreviousPage() { + var _arg0 *C.GtkAssistant // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + + C.gtk_assistant_previous_page(_arg0) + runtime.KeepAlive(assistant) +} + +// RemoveActionWidget removes a widget from the action area of a GtkAssistant. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - child: GtkWidget. +func (assistant *Assistant) RemoveActionWidget(child Widgetter) { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + + C.gtk_assistant_remove_action_widget(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(child) +} + +// RemovePage removes the page_num’s page from assistant. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - pageNum: index of a page in the assistant, or -1 to remove the last page. +func (assistant *Assistant) RemovePage(pageNum int) { + var _arg0 *C.GtkAssistant // out + var _arg1 C.int // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = C.int(pageNum) + + C.gtk_assistant_remove_page(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(pageNum) +} + +// SetCurrentPage switches the page to page_num. +// +// Note that this will only be necessary in custom buttons, as the assistant +// flow can be set with gtk_assistant_set_forward_page_func(). +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - pageNum: index of the page to switch to, starting from 0. If negative, +// the last page will be used. If greater than the number of pages in the +// assistant, nothing will be done. +func (assistant *Assistant) SetCurrentPage(pageNum int) { + var _arg0 *C.GtkAssistant // out + var _arg1 C.int // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = C.int(pageNum) + + C.gtk_assistant_set_current_page(_arg0, _arg1) + runtime.KeepAlive(assistant) + runtime.KeepAlive(pageNum) +} + +// SetForwardPageFunc sets the page forwarding function to be page_func. +// +// This function will be used to determine what will be the next page when the +// user presses the forward button. Setting page_func to NULL will make the +// assistant to use the default forward function, which just goes to the next +// visible page. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - pageFunc (optional): GtkAssistantPageFunc, or NULL to use the default +// one. +func (assistant *Assistant) SetForwardPageFunc(pageFunc AssistantPageFunc) { + var _arg0 *C.GtkAssistant // out + var _arg1 C.GtkAssistantPageFunc // out + var _arg2 C.gpointer + var _arg3 C.GDestroyNotify + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + if pageFunc != nil { + _arg1 = (*[0]byte)(C._gotk4_gtk4_AssistantPageFunc) + _arg2 = C.gpointer(gbox.Assign(pageFunc)) + _arg3 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) + } + + C.gtk_assistant_set_forward_page_func(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(assistant) + runtime.KeepAlive(pageFunc) +} + +// SetPageComplete sets whether page contents are complete. +// +// This will make assistant update the buttons state to be able to continue the +// task. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - page of assistant. +// - complete completeness status of the page. +func (assistant *Assistant) SetPageComplete(page Widgetter, complete bool) { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _arg2 C.gboolean // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(page).Native())) + if complete { + _arg2 = C.TRUE + } + + C.gtk_assistant_set_page_complete(_arg0, _arg1, _arg2) + runtime.KeepAlive(assistant) + runtime.KeepAlive(page) + runtime.KeepAlive(complete) +} + +// SetPageTitle sets a title for page. +// +// The title is displayed in the header area of the assistant when page is the +// current page. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - page of assistant. +// - title: new title for page. +func (assistant *Assistant) SetPageTitle(page Widgetter, title string) { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _arg2 *C.char // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(page).Native())) + _arg2 = (*C.char)(unsafe.Pointer(C.CString(title))) + defer C.free(unsafe.Pointer(_arg2)) + + C.gtk_assistant_set_page_title(_arg0, _arg1, _arg2) + runtime.KeepAlive(assistant) + runtime.KeepAlive(page) + runtime.KeepAlive(title) +} + +// SetPageType sets the page type for page. +// +// The page type determines the page behavior in the assistant. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function takes the following parameters: +// +// - page of assistant. +// - typ: new type for page. +func (assistant *Assistant) SetPageType(page Widgetter, typ AssistantPageType) { + var _arg0 *C.GtkAssistant // out + var _arg1 *C.GtkWidget // out + var _arg2 C.GtkAssistantPageType // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(page).Native())) + _arg2 = C.GtkAssistantPageType(typ) + + C.gtk_assistant_set_page_type(_arg0, _arg1, _arg2) + runtime.KeepAlive(assistant) + runtime.KeepAlive(page) + runtime.KeepAlive(typ) +} + +// UpdateButtonsState forces assistant to recompute the buttons state. +// +// GTK automatically takes care of this in most situations, e.g. when the user +// goes to a different page, or when the visibility or completeness of a page +// changes. +// +// One situation where it can be necessary to call this function is when +// changing a value on the current page affects the future page flow of the +// assistant. +// +// Deprecated: This widget will be removed in GTK 5. +func (assistant *Assistant) UpdateButtonsState() { + var _arg0 *C.GtkAssistant // out + + _arg0 = (*C.GtkAssistant)(unsafe.Pointer(coreglib.InternObject(assistant).Native())) + + C.gtk_assistant_update_buttons_state(_arg0) + runtime.KeepAlive(assistant) +} + +// AssistantPage: GtkAssistantPage is an auxiliary object used by `GtkAssistant. +// +// Deprecated: This object will be removed in GTK 5. +type AssistantPage struct { + _ [0]func() // equal guard + *coreglib.Object +} + +var ( + _ coreglib.Objector = (*AssistantPage)(nil) +) + +func wrapAssistantPage(obj *coreglib.Object) *AssistantPage { + return &AssistantPage{ + Object: obj, + } +} + +func marshalAssistantPage(p uintptr) (interface{}, error) { + return wrapAssistantPage(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// Child returns the child to which page belongs. +// +// Deprecated: This widget will be removed in GTK 5. +// +// The function returns the following values: +// +// - widget: child to which page belongs. +func (page *AssistantPage) Child() Widgetter { + var _arg0 *C.GtkAssistantPage // out + var _cret *C.GtkWidget // in + + _arg0 = (*C.GtkAssistantPage)(unsafe.Pointer(coreglib.InternObject(page).Native())) + + _cret = C.gtk_assistant_page_get_child(_arg0) + runtime.KeepAlive(page) + + var _widget Widgetter // out + + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gtk.Widgetter is nil") + } + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Widgetter) + return ok + }) + rv, ok := casted.(Widgetter) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Widgetter") + } + _widget = rv + } + + return _widget +} + +// BinLayoutOverrides contains methods that are overridable. +type BinLayoutOverrides struct { +} + +func defaultBinLayoutOverrides(v *BinLayout) BinLayoutOverrides { + return BinLayoutOverrides{} +} + +// BinLayout: GtkBinLayout is a GtkLayoutManager subclass useful for create +// "bins" of widgets. +// +// GtkBinLayout will stack each child of a widget on top of each other, +// using the gtk.Widget:hexpand, gtk.Widget:vexpand, gtk.Widget:halign, +// and gtk.Widget:valign properties of each child to determine where they should +// be positioned. +type BinLayout struct { + _ [0]func() // equal guard + LayoutManager +} + +var ( + _ LayoutManagerer = (*BinLayout)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*BinLayout, *BinLayoutClass, BinLayoutOverrides]( + GTypeBinLayout, + initBinLayoutClass, + wrapBinLayout, + defaultBinLayoutOverrides, + ) +} + +func initBinLayoutClass(gclass unsafe.Pointer, overrides BinLayoutOverrides, classInitFunc func(*BinLayoutClass)) { + if classInitFunc != nil { + class := (*BinLayoutClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapBinLayout(obj *coreglib.Object) *BinLayout { + return &BinLayout{ + LayoutManager: LayoutManager{ + Object: obj, + }, + } +} + +func marshalBinLayout(p uintptr) (interface{}, error) { + return wrapBinLayout(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBinLayout creates a new GtkBinLayout instance. +// +// The function returns the following values: +// +// - binLayout: newly created GtkBinLayout. +func NewBinLayout() *BinLayout { + var _cret *C.GtkLayoutManager // in + + _cret = C.gtk_bin_layout_new() + + var _binLayout *BinLayout // out + + _binLayout = wrapBinLayout(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _binLayout +} + +// BookmarkListOverrides contains methods that are overridable. +type BookmarkListOverrides struct { +} + +func defaultBookmarkListOverrides(v *BookmarkList) BookmarkListOverrides { + return BookmarkListOverrides{} +} + +// BookmarkList: GtkBookmarkList is a list model that wraps GBookmarkFile. +// +// It presents a GListModel and fills it asynchronously with the GFileInfos +// returned from that function. +// +// The GFileInfos in the list have some attributes in the recent namespace +// added: recent::private (boolean) and recent:applications (stringv). +type BookmarkList struct { + _ [0]func() // equal guard + *coreglib.Object + + gio.ListModel +} + +var ( + _ coreglib.Objector = (*BookmarkList)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*BookmarkList, *BookmarkListClass, BookmarkListOverrides]( + GTypeBookmarkList, + initBookmarkListClass, + wrapBookmarkList, + defaultBookmarkListOverrides, + ) +} + +func initBookmarkListClass(gclass unsafe.Pointer, overrides BookmarkListOverrides, classInitFunc func(*BookmarkListClass)) { + if classInitFunc != nil { + class := (*BookmarkListClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapBookmarkList(obj *coreglib.Object) *BookmarkList { + return &BookmarkList{ + Object: obj, + ListModel: gio.ListModel{ + Object: obj, + }, + } +} + +func marshalBookmarkList(p uintptr) (interface{}, error) { + return wrapBookmarkList(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBookmarkList creates a new GtkBookmarkList with the given attributes. +// +// The function takes the following parameters: +// +// - filename (optional): bookmark file to load. +// - attributes (optional) to query. +// +// The function returns the following values: +// +// - bookmarkList: new GtkBookmarkList. +func NewBookmarkList(filename, attributes string) *BookmarkList { + var _arg1 *C.char // out + var _arg2 *C.char // out + var _cret *C.GtkBookmarkList // in + + if filename != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + } + if attributes != "" { + _arg2 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg2)) + } + + _cret = C.gtk_bookmark_list_new(_arg1, _arg2) + runtime.KeepAlive(filename) + runtime.KeepAlive(attributes) + + var _bookmarkList *BookmarkList // out + + _bookmarkList = wrapBookmarkList(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _bookmarkList +} + +// Attributes gets the attributes queried on the children. +// +// The function returns the following values: +// +// - utf8 (optional): queried attributes. +func (self *BookmarkList) Attributes() string { + var _arg0 *C.GtkBookmarkList // out + var _cret *C.char // in + + _arg0 = (*C.GtkBookmarkList)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_bookmark_list_get_attributes(_arg0) + runtime.KeepAlive(self) + + var _utf8 string // out + + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } + + return _utf8 +} + +// Filename returns the filename of the bookmark file that this list is loading. +// +// The function returns the following values: +// +// - filename of the .xbel file. +func (self *BookmarkList) Filename() string { + var _arg0 *C.GtkBookmarkList // out + var _cret *C.char // in + + _arg0 = (*C.GtkBookmarkList)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_bookmark_list_get_filename(_arg0) + runtime.KeepAlive(self) + + var _filename string // out + + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _filename +} + +// IOPriority gets the IO priority to use while loading file. +// +// The function returns the following values: +// +// - gint: IO priority. +func (self *BookmarkList) IOPriority() int { + var _arg0 *C.GtkBookmarkList // out + var _cret C.int // in + + _arg0 = (*C.GtkBookmarkList)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_bookmark_list_get_io_priority(_arg0) + runtime.KeepAlive(self) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// IsLoading returns TRUE if the files are currently being loaded. +// +// Files will be added to self from time to time while loading is going on. +// The order in which are added is undefined and may change in between runs. +// +// The function returns the following values: +// +// - ok: TRUE if self is loading. +func (self *BookmarkList) IsLoading() bool { + var _arg0 *C.GtkBookmarkList // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkBookmarkList)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_bookmark_list_is_loading(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetAttributes sets the attributes to be enumerated and starts the +// enumeration. +// +// If attributes is NULL, no attributes will be queried, but a list of +// GFileInfos will still be created. +// +// The function takes the following parameters: +// +// - attributes (optional) to enumerate. +func (self *BookmarkList) SetAttributes(attributes string) { + var _arg0 *C.GtkBookmarkList // out + var _arg1 *C.char // out + + _arg0 = (*C.GtkBookmarkList)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if attributes != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(attributes))) + defer C.free(unsafe.Pointer(_arg1)) + } + + C.gtk_bookmark_list_set_attributes(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(attributes) +} + +// SetIOPriority sets the IO priority to use while loading files. +// +// The default IO priority is G_PRIORITY_DEFAULT. +// +// The function takes the following parameters: +// +// - ioPriority: IO priority to use. +func (self *BookmarkList) SetIOPriority(ioPriority int) { + var _arg0 *C.GtkBookmarkList // out + var _arg1 C.int // out + + _arg0 = (*C.GtkBookmarkList)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.int(ioPriority) + + C.gtk_bookmark_list_set_io_priority(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(ioPriority) +} + +// BoolFilterOverrides contains methods that are overridable. +type BoolFilterOverrides struct { +} + +func defaultBoolFilterOverrides(v *BoolFilter) BoolFilterOverrides { + return BoolFilterOverrides{} +} + +// BoolFilter: GtkBoolFilter evaluates a boolean GtkExpression to determine +// whether to include items. +type BoolFilter struct { + _ [0]func() // equal guard + Filter +} + +var ( + _ coreglib.Objector = (*BoolFilter)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*BoolFilter, *BoolFilterClass, BoolFilterOverrides]( + GTypeBoolFilter, + initBoolFilterClass, + wrapBoolFilter, + defaultBoolFilterOverrides, + ) +} + +func initBoolFilterClass(gclass unsafe.Pointer, overrides BoolFilterOverrides, classInitFunc func(*BoolFilterClass)) { + if classInitFunc != nil { + class := (*BoolFilterClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapBoolFilter(obj *coreglib.Object) *BoolFilter { + return &BoolFilter{ + Filter: Filter{ + Object: obj, + }, + } +} + +func marshalBoolFilter(p uintptr) (interface{}, error) { + return wrapBoolFilter(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBoolFilter creates a new bool filter. +// +// The function takes the following parameters: +// +// - expression (optional) to evaluate. +// +// The function returns the following values: +// +// - boolFilter: new GtkBoolFilter. +func NewBoolFilter(expression Expressioner) *BoolFilter { + var _arg1 *C.GtkExpression // out + var _cret *C.GtkBoolFilter // in + + if expression != nil { + _arg1 = (*C.GtkExpression)(unsafe.Pointer(coreglib.InternObject(expression).Native())) + C.g_object_ref(C.gpointer(coreglib.InternObject(expression).Native())) + } + + _cret = C.gtk_bool_filter_new(_arg1) + runtime.KeepAlive(expression) + + var _boolFilter *BoolFilter // out + + _boolFilter = wrapBoolFilter(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _boolFilter +} + +// Expression gets the expression that the filter uses to evaluate if an item +// should be filtered. +// +// The function returns the following values: +// +// - expression (optional): GtkExpression. +func (self *BoolFilter) Expression() Expressioner { + var _arg0 *C.GtkBoolFilter // out + var _cret *C.GtkExpression // in + + _arg0 = (*C.GtkBoolFilter)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_bool_filter_get_expression(_arg0) + runtime.KeepAlive(self) + + var _expression Expressioner // out + + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) + + object := coreglib.Take(objptr) + casted := object.WalkCast(func(obj coreglib.Objector) bool { + _, ok := obj.(Expressioner) + return ok + }) + rv, ok := casted.(Expressioner) + if !ok { + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gtk.Expressioner") + } + _expression = rv + } + } + + return _expression +} + +// Invert returns whether the filter inverts the expression. +// +// The function returns the following values: +// +// - ok: TRUE if the filter inverts. +func (self *BoolFilter) Invert() bool { + var _arg0 *C.GtkBoolFilter // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkBoolFilter)(unsafe.Pointer(coreglib.InternObject(self).Native())) + + _cret = C.gtk_bool_filter_get_invert(_arg0) + runtime.KeepAlive(self) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// SetExpression sets the expression that the filter uses to check if items +// should be filtered. +// +// The expression must have a value type of G_TYPE_BOOLEAN. +// +// The function takes the following parameters: +// +// - expression (optional): GtkExpression. +func (self *BoolFilter) SetExpression(expression Expressioner) { + var _arg0 *C.GtkBoolFilter // out + var _arg1 *C.GtkExpression // out + + _arg0 = (*C.GtkBoolFilter)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if expression != nil { + _arg1 = (*C.GtkExpression)(unsafe.Pointer(coreglib.InternObject(expression).Native())) + } + + C.gtk_bool_filter_set_expression(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(expression) +} + +// SetInvert sets whether the filter should invert the expression. +// +// The function takes the following parameters: +// +// - invert: TRUE to invert. +func (self *BoolFilter) SetInvert(invert bool) { + var _arg0 *C.GtkBoolFilter // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkBoolFilter)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if invert { + _arg1 = C.TRUE + } + + C.gtk_bool_filter_set_invert(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(invert) +} + +// BoxOverrides contains methods that are overridable. +type BoxOverrides struct { +} + +func defaultBoxOverrides(v *Box) BoxOverrides { + return BoxOverrides{} +} + +// Box: GtkBox widget arranges child widgets into a single row or column. +// +// !An example GtkBox (box.png) +// +// Whether it is a row or column depends on the value of its +// gtk.Orientable:orientation property. Within the other dimension, all +// children are allocated the same size. Of course, the gtk.Widget:halign and +// gtk.Widget:valign properties can be used on the children to influence their +// allocation. +// +// Use repeated calls to gtk.Box.Append() to pack widgets into a GtkBox from +// start to end. Use gtk.Box.Remove() to remove widgets from the GtkBox. +// gtk.Box.InsertChildAfter() can be used to add a child at a particular +// position. +// +// Use gtk.Box.SetHomogeneous() to specify whether or not all children of the +// GtkBox are forced to get the same amount of space. +// +// Use gtk.Box.SetSpacing() to determine how much space will be minimally placed +// between all children in the GtkBox. Note that spacing is added *between* the +// children. +// +// Use gtk.Box.ReorderChildAfter() to move a child to a different place in the +// box. +// +// # CSS nodes +// +// GtkBox uses a single CSS node with name box. +// +// # Accessibility +// +// Until GTK 4.10, GtkBox used the GTK_ACCESSIBLE_ROLE_GROUP role. +// +// Starting from GTK 4.12, GtkBox uses the GTK_ACCESSIBLE_ROLE_GENERIC role. +type Box struct { + _ [0]func() // equal guard + Widget + + *coreglib.Object + Orientable +} + +var ( + _ Widgetter = (*Box)(nil) + _ coreglib.Objector = (*Box)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*Box, *BoxClass, BoxOverrides]( + GTypeBox, + initBoxClass, + wrapBox, + defaultBoxOverrides, + ) +} + +func initBoxClass(gclass unsafe.Pointer, overrides BoxOverrides, classInitFunc func(*BoxClass)) { + if classInitFunc != nil { + class := (*BoxClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapBox(obj *coreglib.Object) *Box { + return &Box{ + Widget: Widget{ + InitiallyUnowned: coreglib.InitiallyUnowned{ + Object: obj, + }, + Object: obj, + Accessible: Accessible{ + Object: obj, + }, + Buildable: Buildable{ + Object: obj, + }, + ConstraintTarget: ConstraintTarget{ + Object: obj, + }, + }, + Object: obj, + Orientable: Orientable{ + Object: obj, + }, + } +} + +func marshalBox(p uintptr) (interface{}, error) { + return wrapBox(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBox creates a new GtkBox. +// +// The function takes the following parameters: +// +// - orientation box’s orientation. +// - spacing: number of pixels to place by default between children. +// +// The function returns the following values: +// +// - box: new GtkBox. +func NewBox(orientation Orientation, spacing int) *Box { + var _arg1 C.GtkOrientation // out + var _arg2 C.int // out + var _cret *C.GtkWidget // in + + _arg1 = C.GtkOrientation(orientation) + _arg2 = C.int(spacing) + + _cret = C.gtk_box_new(_arg1, _arg2) + runtime.KeepAlive(orientation) + runtime.KeepAlive(spacing) + + var _box *Box // out + + _box = wrapBox(coreglib.Take(unsafe.Pointer(_cret))) + + return _box +} + +// Append adds child as the last child to box. +// +// The function takes the following parameters: +// +// - child: GtkWidget to append. +func (box *Box) Append(child Widgetter) { + var _arg0 *C.GtkBox // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + + C.gtk_box_append(_arg0, _arg1) + runtime.KeepAlive(box) + runtime.KeepAlive(child) +} + +// BaselineChild gets the value set by gtk_box_set_baseline_child(). +// +// The function returns the following values: +// +// - gint: baseline child. +func (box *Box) BaselineChild() int { + var _arg0 *C.GtkBox // out + var _cret C.int // in + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + + _cret = C.gtk_box_get_baseline_child(_arg0) + runtime.KeepAlive(box) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// BaselinePosition gets the value set by gtk_box_set_baseline_position(). +// +// The function returns the following values: +// +// - baselinePosition: baseline position. +func (box *Box) BaselinePosition() BaselinePosition { + var _arg0 *C.GtkBox // out + var _cret C.GtkBaselinePosition // in + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + + _cret = C.gtk_box_get_baseline_position(_arg0) + runtime.KeepAlive(box) + + var _baselinePosition BaselinePosition // out + + _baselinePosition = BaselinePosition(_cret) + + return _baselinePosition +} + +// Homogeneous returns whether the box is homogeneous (all children are the same +// size). +// +// The function returns the following values: +// +// - ok: TRUE if the box is homogeneous. +func (box *Box) Homogeneous() bool { + var _arg0 *C.GtkBox // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + + _cret = C.gtk_box_get_homogeneous(_arg0) + runtime.KeepAlive(box) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Spacing gets the value set by gtk_box_set_spacing(). +// +// The function returns the following values: +// +// - gint: spacing between children. +func (box *Box) Spacing() int { + var _arg0 *C.GtkBox // out + var _cret C.int // in + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + + _cret = C.gtk_box_get_spacing(_arg0) + runtime.KeepAlive(box) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// InsertChildAfter inserts child in the position after sibling in the list of +// box children. +// +// If sibling is NULL, insert child at the first position. +// +// The function takes the following parameters: +// +// - child: GtkWidget to insert. +// - sibling (optional) after which to insert child. +func (box *Box) InsertChildAfter(child, sibling Widgetter) { + var _arg0 *C.GtkBox // out + var _arg1 *C.GtkWidget // out + var _arg2 *C.GtkWidget // out + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + if sibling != nil { + _arg2 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(sibling).Native())) + } + + C.gtk_box_insert_child_after(_arg0, _arg1, _arg2) + runtime.KeepAlive(box) + runtime.KeepAlive(child) + runtime.KeepAlive(sibling) +} + +// Prepend adds child as the first child to box. +// +// The function takes the following parameters: +// +// - child: GtkWidget to prepend. +func (box *Box) Prepend(child Widgetter) { + var _arg0 *C.GtkBox // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + + C.gtk_box_prepend(_arg0, _arg1) + runtime.KeepAlive(box) + runtime.KeepAlive(child) +} + +// Remove removes a child widget from box. +// +// The child must have been added before with gtk.Box.Append(), +// gtk.Box.Prepend(), or gtk.Box.InsertChildAfter(). +// +// The function takes the following parameters: +// +// - child to remove. +func (box *Box) Remove(child Widgetter) { + var _arg0 *C.GtkBox // out + var _arg1 *C.GtkWidget // out + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + + C.gtk_box_remove(_arg0, _arg1) + runtime.KeepAlive(box) + runtime.KeepAlive(child) +} + +// ReorderChildAfter moves child to the position after sibling in the list of +// box children. +// +// If sibling is NULL, move child to the first position. +// +// The function takes the following parameters: +// +// - child: GtkWidget to move, must be a child of box. +// - sibling (optional) to move child after. +func (box *Box) ReorderChildAfter(child, sibling Widgetter) { + var _arg0 *C.GtkBox // out + var _arg1 *C.GtkWidget // out + var _arg2 *C.GtkWidget // out + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(child).Native())) + if sibling != nil { + _arg2 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(sibling).Native())) + } + + C.gtk_box_reorder_child_after(_arg0, _arg1, _arg2) + runtime.KeepAlive(box) + runtime.KeepAlive(child) + runtime.KeepAlive(sibling) +} + +// SetBaselineChild sets the baseline child of a box. +// +// This affects only vertical boxes. +// +// The function takes the following parameters: +// +// - child: child, or -1. +func (box *Box) SetBaselineChild(child int) { + var _arg0 *C.GtkBox // out + var _arg1 C.int // out + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + _arg1 = C.int(child) + + C.gtk_box_set_baseline_child(_arg0, _arg1) + runtime.KeepAlive(box) + runtime.KeepAlive(child) +} + +// SetBaselinePosition sets the baseline position of a box. +// +// This affects only horizontal boxes with at least one baseline aligned child. +// If there is more vertical space available than requested, and the baseline +// is not allocated by the parent then position is used to allocate the baseline +// with respect to the extra space available. +// +// The function takes the following parameters: +// +// - position: GtkBaselinePosition. +func (box *Box) SetBaselinePosition(position BaselinePosition) { + var _arg0 *C.GtkBox // out + var _arg1 C.GtkBaselinePosition // out + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + _arg1 = C.GtkBaselinePosition(position) + + C.gtk_box_set_baseline_position(_arg0, _arg1) + runtime.KeepAlive(box) + runtime.KeepAlive(position) +} + +// SetHomogeneous sets whether or not all children of box are given equal space +// in the box. +// +// The function takes the following parameters: +// +// - homogeneous: boolean value, TRUE to create equal allotments, FALSE for +// variable allotments. +func (box *Box) SetHomogeneous(homogeneous bool) { + var _arg0 *C.GtkBox // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + if homogeneous { + _arg1 = C.TRUE + } + + C.gtk_box_set_homogeneous(_arg0, _arg1) + runtime.KeepAlive(box) + runtime.KeepAlive(homogeneous) +} + +// SetSpacing sets the number of pixels to place between children of box. +// +// The function takes the following parameters: +// +// - spacing: number of pixels to put between children. +func (box *Box) SetSpacing(spacing int) { + var _arg0 *C.GtkBox // out + var _arg1 C.int // out + + _arg0 = (*C.GtkBox)(unsafe.Pointer(coreglib.InternObject(box).Native())) + _arg1 = C.int(spacing) + + C.gtk_box_set_spacing(_arg0, _arg1) + runtime.KeepAlive(box) + runtime.KeepAlive(spacing) +} + +// BoxLayoutOverrides contains methods that are overridable. +type BoxLayoutOverrides struct { +} + +func defaultBoxLayoutOverrides(v *BoxLayout) BoxLayoutOverrides { + return BoxLayoutOverrides{} +} + +// BoxLayout: GtkBoxLayout is a layout manager that arranges children in a +// single row or column. +// +// Whether it is a row or column depends on the value of its +// gtk.Orientable:orientation property. Within the other dimension all +// children all allocated the same size. The GtkBoxLayout will respect the +// gtk.Widget:halign and gtk.Widget:valign properties of each child widget. +// +// If you want all children to be assigned the same size, you can use the +// gtk.BoxLayout:homogeneous property. +// +// If you want to specify the amount of space placed between each child, you can +// use the gtk.BoxLayout:spacing property. +type BoxLayout struct { + _ [0]func() // equal guard + LayoutManager + + *coreglib.Object + Orientable +} + +var ( + _ LayoutManagerer = (*BoxLayout)(nil) + _ coreglib.Objector = (*BoxLayout)(nil) +) + +func init() { + coreglib.RegisterClassInfo[*BoxLayout, *BoxLayoutClass, BoxLayoutOverrides]( + GTypeBoxLayout, + initBoxLayoutClass, + wrapBoxLayout, + defaultBoxLayoutOverrides, + ) +} + +func initBoxLayoutClass(gclass unsafe.Pointer, overrides BoxLayoutOverrides, classInitFunc func(*BoxLayoutClass)) { + if classInitFunc != nil { + class := (*BoxLayoutClass)(gextras.NewStructNative(gclass)) + classInitFunc(class) + } +} + +func wrapBoxLayout(obj *coreglib.Object) *BoxLayout { + return &BoxLayout{ + LayoutManager: LayoutManager{ + Object: obj, + }, + Object: obj, + Orientable: Orientable{ + Object: obj, + }, + } +} + +func marshalBoxLayout(p uintptr) (interface{}, error) { + return wrapBoxLayout(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} + +// NewBoxLayout creates a new GtkBoxLayout. +// +// The function takes the following parameters: +// +// - orientation for the new layout. +// +// The function returns the following values: +// +// - boxLayout: new box layout. +func NewBoxLayout(orientation Orientation) *BoxLayout { + var _arg1 C.GtkOrientation // out + var _cret *C.GtkLayoutManager // in + + _arg1 = C.GtkOrientation(orientation) + + _cret = C.gtk_box_layout_new(_arg1) + runtime.KeepAlive(orientation) + + var _boxLayout *BoxLayout // out + + _boxLayout = wrapBoxLayout(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _boxLayout +} + +// BaselineChild gets the value set by gtk_box_layout_set_baseline_child(). +// +// The function returns the following values: +// +// - gint: index of the child that determines the baseline in vertical layout, +// or -1. +func (boxLayout *BoxLayout) BaselineChild() int { + var _arg0 *C.GtkBoxLayout // out + var _cret C.int // in + + _arg0 = (*C.GtkBoxLayout)(unsafe.Pointer(coreglib.InternObject(boxLayout).Native())) + + _cret = C.gtk_box_layout_get_baseline_child(_arg0) + runtime.KeepAlive(boxLayout) + + var _gint int // out + + _gint = int(_cret) + + return _gint +} + +// BaselinePosition gets the value set by +// gtk_box_layout_set_baseline_position(). +// +// The function returns the following values: +// +// - baselinePosition: baseline position. +func (boxLayout *BoxLayout) BaselinePosition() BaselinePosition { + var _arg0 *C.GtkBoxLayout // out + var _cret C.GtkBaselinePosition // in + + _arg0 = (*C.GtkBoxLayout)(unsafe.Pointer(coreglib.InternObject(boxLayout).Native())) + + _cret = C.gtk_box_layout_get_baseline_position(_arg0) + runtime.KeepAlive(boxLayout) + + var _baselinePosition BaselinePosition // out + + _baselinePosition = BaselinePosition(_cret) + + return _baselinePosition +} + +// Homogeneous returns whether the layout is set to be homogeneous. +// +// The function returns the following values: +// +// - ok: TRUE if the layout is homogeneous. +func (boxLayout *BoxLayout) Homogeneous() bool { + var _arg0 *C.GtkBoxLayout // out + var _cret C.gboolean // in + + _arg0 = (*C.GtkBoxLayout)(unsafe.Pointer(coreglib.InternObject(boxLayout).Native())) + + _cret = C.gtk_box_layout_get_homogeneous(_arg0) + runtime.KeepAlive(boxLayout) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok +} + +// Spacing returns the space that box_layout puts between children. +// +// The function returns the following values: +// +// - guint: spacing of the layout. +func (boxLayout *BoxLayout) Spacing() uint { + var _arg0 *C.GtkBoxLayout // out + var _cret C.guint // in + + _arg0 = (*C.GtkBoxLayout)(unsafe.Pointer(coreglib.InternObject(boxLayout).Native())) + + _cret = C.gtk_box_layout_get_spacing(_arg0) + runtime.KeepAlive(boxLayout) + + var _guint uint // out + + _guint = uint(_cret) + + return _guint +} + +// SetBaselineChild sets the index of the child that determines the baseline in +// vertical layout. +// +// The function takes the following parameters: +// +// - child position, or -1. +func (boxLayout *BoxLayout) SetBaselineChild(child int) { + var _arg0 *C.GtkBoxLayout // out + var _arg1 C.int // out + + _arg0 = (*C.GtkBoxLayout)(unsafe.Pointer(coreglib.InternObject(boxLayout).Native())) + _arg1 = C.int(child) + + C.gtk_box_layout_set_baseline_child(_arg0, _arg1) + runtime.KeepAlive(boxLayout) + runtime.KeepAlive(child) +} + +// SetBaselinePosition sets the baseline position of a box layout. +// +// The baseline position affects only horizontal boxes with at least one +// baseline aligned child. If there is more vertical space available than +// requested, and the baseline is not allocated by the parent then the given +// position is used to allocate the baseline within the extra space available. +// +// The function takes the following parameters: +// +// - position: GtkBaselinePosition. +func (boxLayout *BoxLayout) SetBaselinePosition(position BaselinePosition) { + var _arg0 *C.GtkBoxLayout // out + var _arg1 C.GtkBaselinePosition // out + + _arg0 = (*C.GtkBoxLayout)(unsafe.Pointer(coreglib.InternObject(boxLayout).Native())) + _arg1 = C.GtkBaselinePosition(position) + + C.gtk_box_layout_set_baseline_position(_arg0, _arg1) + runtime.KeepAlive(boxLayout) + runtime.KeepAlive(position) +} + +// SetHomogeneous sets whether the box layout will allocate the same size to all +// children. +// +// The function takes the following parameters: +// +// - homogeneous: TRUE to set the box layout as homogeneous. +func (boxLayout *BoxLayout) SetHomogeneous(homogeneous bool) { + var _arg0 *C.GtkBoxLayout // out + var _arg1 C.gboolean // out + + _arg0 = (*C.GtkBoxLayout)(unsafe.Pointer(coreglib.InternObject(boxLayout).Native())) + if homogeneous { + _arg1 = C.TRUE + } + + C.gtk_box_layout_set_homogeneous(_arg0, _arg1) + runtime.KeepAlive(boxLayout) + runtime.KeepAlive(homogeneous) +} + +// SetSpacing sets how much spacing to put between children. +// +// The function takes the following parameters: +// +// - spacing to apply between children. +func (boxLayout *BoxLayout) SetSpacing(spacing uint) { + var _arg0 *C.GtkBoxLayout // out + var _arg1 C.guint // out + + _arg0 = (*C.GtkBoxLayout)(unsafe.Pointer(coreglib.InternObject(boxLayout).Native())) + _arg1 = C.guint(spacing) + + C.gtk_box_layout_set_spacing(_arg0, _arg1) + runtime.KeepAlive(boxLayout) + runtime.KeepAlive(spacing) +} + +// Builder: GtkBuilder reads XML descriptions of a user interface and +// instantiates the described objects. +// +// To create a GtkBuilder from a user interface description, +// call gtk.Builder.NewFromFile, gtk.Builder.NewFromResource or +// gtk.Builder.NewFromString. +// +// In the (unusual) case that you want to add user interface descriptions +// from multiple sources to the same GtkBuilder you can call +// gtk.Builder.New to get an empty builder and populate it by (multiple) +// calls to gtk.Builder.AddFromFile(), gtk.Builder.AddFromResource() or +// gtk.Builder.AddFromString(). +// +// A GtkBuilder holds a reference to all objects that it has constructed and +// drops these references when it is finalized. This finalization can cause the +// destruction of non-widget objects or widgets which are not contained in a +// toplevel window. For toplevel windows constructed by a builder, it is the +// responsibility of the user to call gtk.Window.Destroy() to get rid of them +// and all the widgets they contain. +// +// The functions gtk.Builder.GetObject() and gtk.Builder.GetObjects() can +// be used to access the widgets in the interface by the names assigned +// to them inside the UI description. Toplevel windows returned by these +// functions will stay around until the user explicitly destroys them with +// gtk.Window.Destroy(). Other widgets will either be part of a larger hierarchy +// constructed by the builder (in which case you should not have to worry about +// their lifecycle), or without a parent, in which case they have to be added to +// some container to make use of them. Non-widget objects need to be reffed with +// g_object_ref() to keep them beyond the lifespan of the builder. +// +// # GtkBuilder UI Definitions +// +// GtkBuilder parses textual descriptions of user interfaces which are specified +// in XML format. We refer to these descriptions as “GtkBuilder UI definitions” +// or just “UI definitions” if the context is clear. +// +// # Structure of UI definitions +// +// UI definition files are always encoded in UTF-8. +// +// The toplevel element is . It optionally takes a “domain” +// attribute, which will make the builder look for translated strings using +// dgettext() in the domain specified. This can also be done by calling +// gtk.Builder.SetTranslationDomain() on the builder. For example: +// +// +// +// ... +// +// +// # Requirements +// +// The target toolkit version(s) are described by elements, +// the “lib” attribute specifies the widget library in question (currently the +// only supported value is “gtk”) and the “version” attribute specifies the +// target version in the form “.”. GtkBuilder will error out if +// the version requirements are not met. For example: +// +// +// +// +// +// +// # Objects +// +// Objects are defined as children of the element. +// +// Objects are described by elements, which can contain +// elements to set properties, elements which connect signals to +// handlers, and elements, which describe child objects. +// +// Typically, the specific kind of object represented by an element +// is specified by the “class” attribute. If the type has not been loaded yet, +// GTK tries to find the get_type() function from the class name by applying +// heuristics. This works in most cases, but if necessary, it is possible to +// specify the name of the get_type() function explicitly with the "type-func" +// attribute. If your UI definition is referencing internal types, you should +// make sure to call g_type_ensure() for each object type before parsing the UI +// definition. +// +// Objects may be given a name with the “id” attribute, which allows the +// application to retrieve them from the builder with gtk.Builder.GetObject(). +// An id is also necessary to use the object as property value in other parts +// of the UI definition. GTK reserves ids starting and ending with ___ (three +// consecutive underscores) for its own purposes. +// +// # Properties +// +// Setting properties of objects is pretty straightforward with the +// element: the “name” attribute specifies the name of the property, and the +// content of the element specifies the value: +// +// +// Hello, world +// +// +// If the “translatable” attribute is set to a true value, GTK uses gettext() +// (or dgettext() if the builder has a translation domain set) to find a +// translation for the value. This happens before the value is parsed, so it can +// be used for properties of any type, but it is probably most useful for string +// properties. It is also possible to specify a context to disambiguate short +// strings, and comments which may help the translators: +// +// +// Hello, world +// +// +// GtkBuilder can parse textual representations for the most common property +// types: +// +// - characters +// +// - strings +// +// - integers +// +// - floating-point numbers +// +// - booleans (strings like “TRUE”, “t”, “yes”, “y”, “1” are interpreted as true +// values, strings like “FALSE”, “f”, “no”, “n”, “0” are interpreted as false +// values) +// +// - enumeration types (can be specified by their full C identifier their short +// name used when registering the enumeration type, or their integer value) +// +// - flag types (can be specified by their C identifier, short name, +// integer value, and optionally combined with “|” for bitwise OR, e.g. +// “GTK_INPUT_HINT_EMOJI|GTK_INPUT_HINT_LOWERCASE”, or “emoji|lowercase”) +// +// - colors (in a format understood by gdk.RGBA.Parse()) +// +// - GVariant (can be specified in the format understood by +// glib.Variant().Parse) +// +// - pixbufs (can be specified as a filename of an image file to load) +// +// Objects can be referred to by their name and by default refer to +// objects declared in the local XML fragment and objects exposed via +// gtk.Builder.ExposeObject(). In general, GtkBuilder allows forward references +// to objects declared in the local XML; an object doesn’t have to be +// constructed before it can be referred to. The exception to this rule is +// that an object has to be constructed before it can be used as the value of a +// construct-only property. +// +// # Child objects +// +// Many widgets have properties for child widgets, such as gtk.Expander:child. +// In this case, the preferred way to specify the child widget in a ui file is +// to simply set the property: +// +// +// +// +// ... +// +// +// +// +// Generic containers that can contain an arbitrary number of children, +// such as gtk.Box instead use the element. A element +// contains an element which describes the child object. Most often, +// child objects are widgets inside a container, but they can also be, e.g., +// actions in an action group, or columns in a tree model. +// +// Any object type that implements the gtk.Buildable interface can specify how +// children may be added to it. Since many objects and widgets that are included +// with GTK already implement the GtkBuildable interface, typically child +// objects can be added using the element without having to be concerned +// about the underlying implementation. +// +// See the GtkWidget documentation (class.Widget.html#gtkwidget-as-gtkbuildable) +// for many examples of using GtkBuilder with widgets, including setting child +// objects using the element. +// +// A noteworthy special case to the general rule that only objects implementing +// GtkBuildable may specify how to handle the element is that GtkBuilder +// provides special support for adding objects to a gio.ListStore by using the +// element. For instance: +// +// +// MyObject +// +// +// +// ... +// +// +// # Property bindings +// +// It is also possible to bind a property value to another object's property +// value using the attributes "bind-source" to specify the source object of +// the binding, and optionally, "bind-property" and "bind-flags" to specify the +// source property and source binding flags respectively. Internally, GtkBuilder +// implements this using gobject.Binding objects. +// +// For instance, in the example below the “label” property of the bottom_label +// widget is bound to the “label” property of the top_button widget: +// +// +// vertical +// +// +// Hello, world +// +// +// +// +// +// +// +// +// +// For more information, see the documentation of the +// gobject.Object.BindProperty() method. +// +// Please note that another way to set up bindings between objects in .ui files +// is to use the GtkExpression methodology. See the GtkExpression documentation +// (class.Expression.html#gtkexpression-in-ui-files) for more information. +// +// # Internal children +// +// Sometimes it is necessary to refer to widgets which have implicitly been +// constructed by GTK as part of a composite widget, to set properties on them +// or to add further children (e.g. the content area of a GtkDialog). This can +// be achieved by setting the “internal-child” property of the element +// to a true value. Note that GtkBuilder still requires an element for +// the internal child, even if it has already been constructed. +// +// # Specialized children +// +// A number of widgets have different places where a child can be added (e.g. +// tabs vs. page content in notebooks). This can be reflected in a UI definition +// by specifying the “type” attribute on a The possible values for the +// “type” attribute are described in the sections describing the widget-specific +// portions of UI definitions. +// +// # Signal handlers and function pointers +// +// Signal handlers are set up with the element. The “name” attribute +// specifies the name of the signal, and the “handler” attribute specifies the +// function to connect to the signal. +// +// +// +// +// +// The remaining attributes, “after”, “swapped” and “object”, have the same +// meaning as the corresponding parameters of the gobject.SignalConnectObject() +// or gobject.SignalConnectData() functions: +// +// - “after” matches the G_CONNECT_AFTER flag, and will ensure that the handler +// is called after the default class closure for the signal +// +// - “swapped” matches the G_CONNECT_SWAPPED flag, and will swap the instance +// and closure arguments when invoking the signal handler +// +// - “object” will bind the signal handler to the lifetime of the object +// referenced by the attribute +// +// By default "swapped" will be set to "yes" if not specified otherwise, in +// the case where "object" is set, for convenience. A “last_modification_time” +// attribute is also allowed, but it does not have a meaning to the builder. +// +// When compiling applications for Windows, you must declare signal callbacks +// with the G_MODULE_EXPORT decorator, or they will not be put in the symbol +// table: +// +// G_MODULE_EXPORT void +// hello_button__clicked (GtkButton *button, +// gpointer data) +// { +// // ... +// } +// +// On Linux and Unix, this is not necessary; applications should instead be +// compiled with the -Wl,--export-dynamic argument inside their compiler flags, +// and linked against gmodule-export-2.0. +// +// Example UI Definition +// +// +// +// +// +// +// +// +// +// _Ok +// True +// +// +// +// +// +// +// +// +// +// +// # Using GtkBuildable for extending UI definitions +// +// Objects can implement the gtk.Buildable interface to add custom elements and +// attributes to the XML. Typically, any extension will be documented in each +// type that implements the interface. +// +// # Templates +// +// When describing a gtk.Widget, you can use the