From ab1a56e93c15c1a861c56ed3da5c8e1680f3cbfc Mon Sep 17 00:00:00 2001 From: Jakob Gillich Date: Fri, 12 Jul 2024 15:22:36 +0200 Subject: [PATCH] Bump nixpkgs to 24.05, GTK to 4.14.4 (#145) * Bump nixpkgs to 24.05 * Detect length parameters * Add vscode debug config * Set module to go 1.22.0 * Regenerate pkg --- .vscode/launch.json | 19 + flake.lock | 8 +- flake.nix | 2 +- gir/cmd/gir-generate/gendata/gendata.go | 72 +- gir/girgen/generators/callable/callable.go | 2 + gir/girgen/generators/callback/callback.go | 2 + gir/girgen/types/types.go | 25 + gir/pkgconfig/pkgconfig_test.go | 12 +- go.mod | 2 +- pkg/atk/atk.go | 488 +- pkg/atk/atk_export.go | 86 + pkg/gdk/v3/gdk.go | 19 +- pkg/gdk/v4/gdk.go | 7003 +++-- pkg/gdk/v4/gdk_export.go | 8 +- pkg/gdkpixbuf/v2/gdkpixbuf.go | 372 +- pkg/gdkwayland/v4/gdkwayland.go | 65 +- pkg/gdkx11/v4/gdkx11.go | 157 +- pkg/gio/v2/gio.go | 18077 +++++-------- pkg/gio/v2/gio_export.go | 477 +- pkg/glib/v2/glib.go | 17641 +++++++----- pkg/glib/v2/glib_export.go | 36 +- pkg/gobject/v2/gobject.go | 2 +- pkg/graphene/graphene.go | 2 +- pkg/gsk/v4/gsk.go | 4387 ++- pkg/gsk/v4/gsk_export.go | 33 + pkg/gtk/v3/gtk.go | 1825 +- pkg/gtk/v3/gtk_export.go | 19 +- pkg/gtk/v4/gtk.go | 26791 ++++++++++++++----- pkg/gtk/v4/gtk_export.go | 321 +- pkg/pango/pango.go | 3846 ++- pkg/pangocairo/pangocairo.go | 17 +- 31 files changed, 51307 insertions(+), 30509 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..0b3f57163 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,19 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Generate", + "type": "go", + "request": "launch", + "cwd": "${workspaceFolder}", + "program": "${workspaceFolder}/gir/cmd/gir-generate", + "args": [ + "-o", + "./pkg" + ] + } + ] +} \ No newline at end of file diff --git a/flake.lock b/flake.lock index 759438a72..e67115bc8 100644 --- a/flake.lock +++ b/flake.lock @@ -111,17 +111,17 @@ }, "nixpkgs-gotk4": { "locked": { - "lastModified": 1622966049, - "narHash": "sha256-6g+28v94ISkVk9TBSsITVOnB2slK8plieWPIF2jo/l0=", + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fbfb79400a08bf754e32b4d4fc3f7d8f8055cf94", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", "type": "github" }, "original": { "owner": "NixOS", + "ref": "nixos-24.05", "repo": "nixpkgs", - "rev": "fbfb79400a08bf754e32b4d4fc3f7d8f8055cf94", "type": "github" } }, diff --git a/flake.nix b/flake.nix index 1a12ecabf..f82c9f5df 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - nixpkgs-gotk4.url = "github:NixOS/nixpkgs/fbfb79400a08bf754e32b4d4fc3f7d8f8055cf94"; # 2021-06-06 + nixpkgs-gotk4.url = "github:NixOS/nixpkgs?ref=nixos-24.05"; flake-utils.url = "github:numtide/flake-utils"; flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"; diff --git a/gir/cmd/gir-generate/gendata/gendata.go b/gir/cmd/gir-generate/gendata/gendata.go index 5dbec7fef..3e56403d1 100644 --- a/gir/cmd/gir-generate/gendata/gendata.go +++ b/gir/cmd/gir-generate/gendata/gendata.go @@ -50,6 +50,7 @@ var PkgExceptions = []string{ // the given Packages list. It is manually updated. var PkgGenerated = []string{ "atk", + // "atspi", "gdk", "gdkpixbuf", "gdkpixdata", @@ -68,6 +69,7 @@ var PkgGenerated = []string{ // GenerateExceptions contains the keys of the underneath ImportOverrides map. var GenerateExceptions = []string{ "cairo-1", + "Atspi-2", // Missing AtspiDevice } // ImportOverrides is the list of imports to defer to another library, usually @@ -79,10 +81,12 @@ var ImportOverrides = map[string]string{} // Packages lists pkg-config packages and optionally the namespaces to be // generated. If the list of namespaces is nil, then everything is generated. var Packages = []genmain.Package{ - {Name: "gobject-introspection-1.0", Namespaces: []string{ + {Name: "glib-2.0", Namespaces: []string{ "GLib-2", "GObject-2", "Gio-2", + }}, + {Name: "gobject-introspection-1.0", Namespaces: []string{ "cairo-1", }}, {Name: "gdk-pixbuf-2.0"}, @@ -119,6 +123,7 @@ var Preprocessors = []Preprocessor{ RenameEnumMembers("Pango-1.AttrType", "ATTR_(.*)", "ATTR_TYPE_$1"), RenameEnumMembers("Gsk-4.RenderNodeType", ".*", "${0}_TYPE"), RenameEnumMembers("Gdk-3.EventType", ".*", "${0}_TYPE"), + RenameEnumMembers("Gtk-4.GraphicsOffloadEnabled", ".*", "${0}_TYPE"), // See #28. RemoveCIncludes("Gio-2.0.gir", "gio/gdesktopappinfo.h"), // These probably shouldn't be built on Windows. @@ -206,63 +211,6 @@ var Preprocessors = []Preprocessor{ } } }), - - modifyBufferInsert("Gtk-4.TextBuffer.insert"), - modifyBufferInsert("Gtk-4.TextBuffer.insert_markup"), - modifyBufferInsert("Gtk-4.TextBuffer.insert_at_cursor"), - modifyBufferInsert("Gtk-4.TextBuffer.insert_interactive"), - modifyBufferInsert("Gtk-4.TextBuffer.insert_interactive_at_cursor"), - modifyBufferInsert("Gtk-4.TextBuffer.set_text"), - - modifyBufferInsert("Gtk-3.TextBuffer.insert"), - modifyBufferInsert("Gtk-3.TextBuffer.insert_markup"), - modifyBufferInsert("Gtk-3.TextBuffer.insert_at_cursor"), - modifyBufferInsert("Gtk-3.TextBuffer.insert_interactive"), - modifyBufferInsert("Gtk-3.TextBuffer.insert_interactive_at_cursor"), - modifyBufferInsert("Gtk-3.TextBuffer.set_text"), -} - -func modifyBufferInsert(name string) Preprocessor { - names := []string{"text", "markup"} - - return ModifyCallable(name, func(c *gir.CallableAttrs) { - var p *gir.ParameterAttrs - - for _, name := range names { - if p = FindParameter(c, name); p != nil { - break - } - } - - if p == nil { - return - } - - lenIx := findTextLenParam(c.Parameters.Parameters) - if lenIx == -1 { - return - } - - p.Type = nil - p.Array = &gir.Array{ - CType: "const char*", - Type: &gir.Type{Name: "gchar"}, - Length: &lenIx, - ZeroTerminated: new(bool), // false - } - }) -} - -func findTextLenParam(params []gir.Parameter) int { - const doc = "length of" - - for i, param := range params { - if param.Doc != nil && strings.Contains(param.Doc.String, doc) { - return i - } - } - - return -1 } var ConversionProcessors = []ConversionProcessor{ @@ -276,6 +224,7 @@ var ConversionProcessors = []ConversionProcessor{ // namespace, and the values are list of names. var Filters = []FilterMatcher{ AbsoluteFilter("C.cairo_image_surface_create"), + AbsoluteFilter("C.gsk_path_builder_add_cairo_path"), // This seems to be macro-guarded between x86 and arm64. AbsoluteFilter("GLib.VA_COPY_AS_ARRAY"), @@ -309,6 +258,9 @@ var Filters = []FilterMatcher{ AbsoluteFilter("GdkPixbuf.PixbufFormat.domain"), AbsoluteFilter("GdkPixbuf.PixbufFormat.flags"), AbsoluteFilter("GdkPixbuf.PixbufFormat.disabled"), + // Incomplete GArray implementation + AbsoluteFilter("Atk.Document.get_text_selections"), + AbsoluteFilter("Atk.Document.set_text_selections"), // Dangerous. AbsoluteFilter("GLib.IOChannel.read"), AbsoluteFilter("GLib.Bytes.new_take"), @@ -386,6 +338,10 @@ var Filters = []FilterMatcher{ AbsoluteFilter("C.gtk_print_capabilities_get_type"), AbsoluteFilter("C.GdkPixbufAnimationClass"), AbsoluteFilter("C.GdkPixbufAnimationIterClass"), + AbsoluteFilter("C.GThreadedResolverClass"), + AbsoluteFilter("C.g_threaded_resolver_get_type"), + AbsoluteFilter("C.GtkFileChooserWidgetAccessibleClass"), + AbsoluteFilter("C.gtk_file_chooser_widget_accessible_get_type"), // Missing. AbsoluteFilter("Gtk-3.HeaderBarAccessibleClass"), diff --git a/gir/girgen/generators/callable/callable.go b/gir/girgen/generators/callable/callable.go index b06c9295c..d13622f3f 100644 --- a/gir/girgen/generators/callable/callable.go +++ b/gir/girgen/generators/callable/callable.go @@ -244,6 +244,8 @@ func (g *Generator) renderDynamicLinkedBlock() bool { // Copy the parameters list so we can freely mutate it. parameters := types.ResolveParameters(g.gen, g.Parameters.Parameters) + types.DetectLengthParameters(parameters) + // Preprocess the values to normalize an edge case; see comment below. for i, value := range parameters { if value.AnyType.Array == nil || value.AnyType.Array.Length == nil { diff --git a/gir/girgen/generators/callback/callback.go b/gir/girgen/generators/callback/callback.go index 3c9544a54..d0825cda7 100644 --- a/gir/girgen/generators/callback/callback.go +++ b/gir/girgen/generators/callback/callback.go @@ -243,6 +243,8 @@ func (g *Generator) renderBlock() bool { if g.Parameters != nil && len(g.Parameters.Parameters) > 0 { callbackValues = make([]typeconv.ConversionValue, 0, len(g.Parameters.Parameters)+2) + types.DetectLengthParameters(g.Parameters.Parameters) + for i, param := range g.Parameters.Parameters { // Skip generating the closure parameter. if param.Skip || (g.Closure != nil && i == *g.Closure) { diff --git a/gir/girgen/types/types.go b/gir/girgen/types/types.go index 1beba4c84..6a600c8e1 100644 --- a/gir/girgen/types/types.go +++ b/gir/girgen/types/types.go @@ -586,3 +586,28 @@ func GuessParameterOutput(param *gir.Parameter) string { param.Direction = "in" return "in" } + +// Convert char* to array with an associated length parameter +// Based on detect_length https://github.com/gtk-rs/gir/blob/master/src/analysis/function_parameters.rs +func DetectLengthParameters(params []gir.Parameter) { + for i, param := range params { + if i == 0 || + GuessParameterOutput(¶m) != "in" || + param.Name != "length" && !strings.HasSuffix(param.Name, "len") { + continue + } + + data := ¶ms[i-1] + if data.Type == nil || data.Type.CType != "const gchar*" && data.Type.CType != "const char*" { + continue + } + + data.Array = &gir.Array{ + CType: data.Type.CType, + Type: &gir.Type{Name: "gchar"}, + Length: &i, + ZeroTerminated: new(bool), // false + } + data.Type = nil + } +} diff --git a/gir/pkgconfig/pkgconfig_test.go b/gir/pkgconfig/pkgconfig_test.go index 3cf7b8fe9..f3d4a0f7c 100644 --- a/gir/pkgconfig/pkgconfig_test.go +++ b/gir/pkgconfig/pkgconfig_test.go @@ -51,17 +51,17 @@ func TestGIRDirs(t *testing.T) { { []string{"gtk4"}, map[string]string{ - "gtk4": "/nix/store/niw855nnjgqbq2s0iqxrk9xs5mr10rz8-gtk4-4.2.1-dev/share/gir-1.0", + "gtk4": "/nix/store/j2vgh4x3wmxrycvwkbnp74vh32yip9i5-gtk4-4.14.4-dev/share/gir-1.0", }, }, { []string{"gtk4", "pango", "cairo", "glib-2.0", "gdk-3.0"}, map[string]string{ - "gtk4": "/nix/store/niw855nnjgqbq2s0iqxrk9xs5mr10rz8-gtk4-4.2.1-dev/share/gir-1.0", - "pango": "/nix/store/c52730cidby7p2qwwq8cf91anqrni6lg-pango-1.48.4-dev/share/gir-1.0", - "cairo": "/nix/store/gp87jysb40b919z8s7ixcilwdsiyl0rp-cairo-1.16.0-dev/share/gir-1.0", - "glib-2.0": "/nix/store/d9zs9xg86lhqjqni0v8h2ibdrjb57fn4-glib-2.68.2-dev/share/gir-1.0", - "gdk-3.0": "/nix/store/vsk1qc1na4izgz461vxkvn655yvarfr7-gtk+3-3.24.27-dev/share/gir-1.0", + "gtk4": "/nix/store/j2vgh4x3wmxrycvwkbnp74vh32yip9i5-gtk4-4.14.4-dev/share/gir-1.0", + "pango": "/nix/store/fmqv9zpvf9fkb8n384ramhhbp8k20rnw-pango-1.52.2-dev/share/gir-1.0", + "cairo": "/nix/store/0i4xfw9ylgmg8f7z6rwwmfbin3ckyli5-cairo-1.18.0-dev/share/gir-1.0", + "glib-2.0": "/nix/store/kd2a4kyia0lai7n7hn657mpcr2gykw00-glib-2.80.2-dev/share/gir-1.0", + "gdk-3.0": "/nix/store/kd2a4kyia0lai7n7hn657mpcr2gykw00-glib-2.80.2-dev/share/gir-1.0", }, }, } diff --git a/go.mod b/go.mod index d34d40728..19f166ecc 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/diamondburned/gotk4 -go 1.21.0 +go 1.22.0 require ( github.com/alecthomas/assert/v2 v2.8.1 diff --git a/pkg/atk/atk.go b/pkg/atk/atk.go index 261e4acf8..42b0e940a 100644 --- a/pkg/atk/atk.go +++ b/pkg/atk/atk.go @@ -47,8 +47,11 @@ import ( // extern void _gotk4_atk1_Object_ConnectVisibleDataChanged(gpointer, guintptr); // extern void _gotk4_atk1_Object_ConnectStateChange(gpointer, gchar*, gboolean, guintptr); // extern void _gotk4_atk1_Object_ConnectPropertyChange(gpointer, gpointer*, guintptr); +// extern void _gotk4_atk1_Object_ConnectNotification(gpointer, gchar*, gint, guintptr); // extern void _gotk4_atk1_Object_ConnectFocusEvent(gpointer, gboolean, guintptr); // extern void _gotk4_atk1_Object_ConnectChildrenChanged(gpointer, guint, gpointer*, guintptr); +// extern void _gotk4_atk1_Object_ConnectAttributeChanged(gpointer, gchar*, gchar*, guintptr); +// extern void _gotk4_atk1_Object_ConnectAnnouncement(gpointer, gchar*, guintptr); // extern void _gotk4_atk1_Object_ConnectActiveDescendantChanged(gpointer, gpointer*, guintptr); // extern void _gotk4_atk1_ObjectFactoryClass_invalidate(AtkObjectFactory*); // extern void _gotk4_atk1_ObjectClass_visible_data_changed(AtkObject*); @@ -72,6 +75,7 @@ import ( // extern void _gotk4_atk1_Document_ConnectPageChanged(gpointer, gint, guintptr); // extern void _gotk4_atk1_Document_ConnectLoadStopped(gpointer, guintptr); // extern void _gotk4_atk1_Document_ConnectLoadComplete(gpointer, guintptr); +// extern void _gotk4_atk1_Document_ConnectDocumentAttributeChanged(gpointer, gchar*, gchar*, guintptr); // extern void _gotk4_atk1_Component_ConnectBoundsChanged(gpointer, AtkRectangle*, guintptr); // extern guint _gotk4_atk1_HyperlinkClass_link_state(AtkHyperlink*); // extern gint _gotk4_atk1_ObjectClass_get_n_children(AtkObject*); @@ -610,6 +614,7 @@ var ( GTypeCoordType = coreglib.Type(C.atk_coord_type_get_type()) GTypeKeyEventType = coreglib.Type(C.atk_key_event_type_get_type()) GTypeLayer = coreglib.Type(C.atk_layer_get_type()) + GTypeLive = coreglib.Type(C.atk_live_get_type()) GTypeRelationType = coreglib.Type(C.atk_relation_type_get_type()) GTypeRole = coreglib.Type(C.atk_role_get_type()) GTypeScrollType = coreglib.Type(C.atk_scroll_type_get_type()) @@ -659,6 +664,7 @@ func init() { coreglib.TypeMarshaler{T: GTypeCoordType, F: marshalCoordType}, coreglib.TypeMarshaler{T: GTypeKeyEventType, F: marshalKeyEventType}, coreglib.TypeMarshaler{T: GTypeLayer, F: marshalLayer}, + coreglib.TypeMarshaler{T: GTypeLive, F: marshalLive}, coreglib.TypeMarshaler{T: GTypeRelationType, F: marshalRelationType}, coreglib.TypeMarshaler{T: GTypeRole, F: marshalRole}, coreglib.TypeMarshaler{T: GTypeScrollType, F: marshalScrollType}, @@ -707,7 +713,7 @@ func init() { // BINARY_AGE: like atk_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 = 23610 +const BINARY_AGE = 25210 // INTERFACE_AGE: like atk_get_interface_age(), but from the headers used at // application compile time, rather than from the library linked against at @@ -727,7 +733,7 @@ const MICRO_VERSION = 0 // MINOR_VERSION: like atk_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 = 36 +const MINOR_VERSION = 52 // VERSION_MIN_REQUIRED: macro that should be defined by the user prior // to including the atk/atk.h header. The definition should be one of the @@ -748,6 +754,12 @@ const VERSION_MIN_REQUIRED = 2 // atk_object_get_attributes(). type AttributeSet = coreglib.SList +// State describes a single state of an object. +// +// An AtkState describes a single state of an object. The full set of states +// that apply to an object at a given time are contained in its StateSet. +// +// See atk_object_ref_state_set and atk_object_notify_state_change. type State = uint64 // CoordType specifies how xy coordinates are to be interpreted. @@ -868,6 +880,39 @@ func (l Layer) String() string { } } +// Live: enumeration used to indicate a type of live region and how assertive +// it should be in terms of speaking notifications. Currently, this is only used +// for "notification" events, but it may be used for additional purposes in the +// future. +type Live C.gint + +const ( + // LiveNone: no live region. + LiveNone Live = iota + // LivePolite: this live region should be considered polite. + LivePolite + // LiveAssertive: this live region should be considered assertive. + LiveAssertive +) + +func marshalLive(p uintptr) (interface{}, error) { + return Live(coreglib.ValueFromNative(unsafe.Pointer(p)).Enum()), nil +} + +// String returns the name in string for Live. +func (l Live) String() string { + switch l { + case LiveNone: + return "None" + case LivePolite: + return "Polite" + case LiveAssertive: + return "Assertive" + default: + return fmt.Sprintf("Live(%d)", l) + } +} + // RelationType describes the type of the relation. type RelationType C.gint @@ -1526,6 +1571,9 @@ const ( // and/or ATK_ROLE_CONTENT_INSERTION children, in any order, to indicate // what the actual change is. (Since: 2.36). RoleSuggestion + // RolePushButtonMenu: specialized push button to open a menu. (Since: + // 2.46). + RolePushButtonMenu // RoleLastDefined: not a valid role, used for finding end of the // enumeration. RoleLastDefined @@ -1792,6 +1840,8 @@ func (r Role) String() string { return "Mark" case RoleSuggestion: return "Suggestion" + case RolePushButtonMenu: + return "PushButtonMenu" case RoleLastDefined: return "LastDefined" default: @@ -2188,6 +2238,8 @@ const ( // user, as is the case with labels and containers, ATK_STATE_READ_ONLY // should not be applied. See also ATK_STATE_EDITABLE. Since: ATK-2-16. StateReadOnly + // StateCollapsed indicates this object is collapsed. Since: ATK-2.38. + StateCollapsed // StateLastDefined: not a valid state, used for finding end of enumeration. StateLastDefined ) @@ -2285,6 +2337,8 @@ func (s StateType) String() string { return "HasTooltip" case StateReadOnly: return "ReadOnly" + case StateCollapsed: + return "Collapsed" case StateLastDefined: return "LastDefined" default: @@ -3249,6 +3303,9 @@ func RemoveKeyEventListener(listenerId uint) { runtime.KeepAlive(listenerId) } +// Action: ATK interface provided by UI components which the user can +// activate/interact with. +// // Action should be implemented by instances of Object classes with which // the user can interact directly, i.e. buttons, checkboxes, scrollbars, e.g. // components which are not "passive" providers of UI information. @@ -3827,6 +3884,9 @@ func (action *Action) setDescription(i int, desc string) bool { return _ok } +// Component: ATK interface provided by UI components which occupy a physical +// area on the screen. which the user can activate/interact with. +// // Component should be implemented by most if not all UI elements with an // actual on-screen presence, i.e. components which can be said to have a // screen-coordinate bounding box. Virtually all widgets will need to have @@ -3891,7 +3951,7 @@ type Componenter interface { // SetSize: set the size of the component in terms of width and height. SetSize(width, height int) bool - // Bounds-changed: 'bounds-changed" signal is emitted when the bposition or + // Bounds-changed: 'bounds-changed" signal is emitted when the position or // size of the component changes. ConnectBoundsChanged(func(arg1 *Rectangle)) coreglib.SignalHandle } @@ -3908,8 +3968,8 @@ func marshalComponent(p uintptr) (interface{}, error) { return wrapComponent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// ConnectBoundsChanged: 'bounds-changed" signal is emitted when the bposition -// or size of the component changes. +// ConnectBoundsChanged: 'bounds-changed" signal is emitted when the position or +// size of the component changes. func (component *Component) ConnectBoundsChanged(f func(arg1 *Rectangle)) coreglib.SignalHandle { return coreglib.ConnectGeneratedClosure(component, "bounds-changed", false, unsafe.Pointer(C._gotk4_atk1_Component_ConnectBoundsChanged), f) } @@ -4988,12 +5048,15 @@ func (component *Component) setSize(width, height int) bool { return _ok } -// Document interface should be supported by any object whose content is a -// representation or view of a document. The AtkDocument interface should appear -// on the toplevel container for the document content; however AtkDocument -// instances may be nested (i.e. an AtkDocument may be a descendant of another -// AtkDocument) in those cases where one document contains "embedded content" -// which can reasonably be considered a document in its own right. +// Document: ATK interface which represents the toplevel container for document +// content. +// +// The AtkDocument interface should be supported by any object whose content +// is a representation or view of a document. The AtkDocument interface +// should appear on the toplevel container for the document content; however +// AtkDocument instances may be nested (i.e. an AtkDocument may be a descendant +// of another AtkDocument) in those cases where one document contains "embedded +// content" which can reasonably be considered a document in its own right. // // Document wraps an interface. This means the user can get the // underlying type by calling Cast(). @@ -5028,6 +5091,10 @@ type Documenter interface { // document. SetAttributeValue(attributeName, attributeValue string) bool + // Document-attribute-changed: "document-attribute-changed" signal should be + // emitted when there is a change to one of the document attributes returned + // by atk_document_get_attributes. + ConnectDocumentAttributeChanged(func(arg1, arg2 string)) coreglib.SignalHandle // Load-complete: 'load-complete' signal is emitted when a pending load of a // static document has completed. ConnectLoadComplete(func()) coreglib.SignalHandle @@ -5055,6 +5122,13 @@ func marshalDocument(p uintptr) (interface{}, error) { return wrapDocument(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } +// ConnectDocumentAttributeChanged: "document-attribute-changed" signal should +// be emitted when there is a change to one of the document attributes returned +// by atk_document_get_attributes. +func (document *Document) ConnectDocumentAttributeChanged(f func(arg1, arg2 string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(document, "document-attribute-changed", false, unsafe.Pointer(C._gotk4_atk1_Document_ConnectDocumentAttributeChanged), f) +} + // ConnectLoadComplete: 'load-complete' signal is emitted when a pending load of // a static document has completed. This signal is to be expected by ATK clients // if and when AtkDocument implementors expose ATK_STATE_BUSY. If the state of @@ -5504,6 +5578,9 @@ func (document *Document) setDocumentAttribute(attributeName, attributeValue str return _ok } +// EditableText: ATK interface implemented by components containing +// user-editable text content. +// // EditableText should be implemented by UI components which contain text // which the user can edit, via the Object corresponding to that component (see // Object). @@ -5511,7 +5588,7 @@ func (document *Document) setDocumentAttribute(attributeName, attributeValue str // EditableText is a subclass of Text, and as such, an object which implements // EditableText is by definition an Text implementor as well. // -// See also: Text. +// See atktext. // // EditableText wraps an interface. This means the user can get the // underlying type by calling Cast(). @@ -5537,7 +5614,7 @@ type EditableTexter interface { // DeleteText: delete text start_pos up to, but not including end_pos. DeleteText(startPos, endPos int) // InsertText: insert text at a given position. - InsertText(str string, length int, position *int) + InsertText(str string, position *int) // PasteText: paste text from clipboard to specified position. PasteText(position int) // SetTextContents: set text contents of text. @@ -5626,26 +5703,25 @@ func (text *EditableText) DeleteText(startPos, endPos int) { // The function takes the following parameters: // // - str: text to insert. -// - length of text to insert, in bytes. // - position: caller initializes this to the position at which to insert the // text. After the call it points at the position after the newly inserted // text. -func (text *EditableText) InsertText(str string, length int, position *int) { +func (text *EditableText) InsertText(str string, position *int) { var _arg0 *C.AtkEditableText // out var _arg1 *C.gchar // out - var _arg2 C.gint // out - var _arg3 *C.gint // out + var _arg2 C.gint + var _arg3 *C.gint // out _arg0 = (*C.AtkEditableText)(unsafe.Pointer(coreglib.InternObject(text).Native())) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gint(length) _arg3 = (*C.gint)(unsafe.Pointer(position)) C.atk_editable_text_insert_text(_arg0, _arg1, _arg2, _arg3) runtime.KeepAlive(text) runtime.KeepAlive(str) - runtime.KeepAlive(length) runtime.KeepAlive(position) } @@ -5763,29 +5839,28 @@ func (text *EditableText) deleteText(startPos, endPos int) { // The function takes the following parameters: // // - str: text to insert. -// - length of text to insert, in bytes. // - position: caller initializes this to the position at which to insert the // text. After the call it points at the position after the newly inserted // text. -func (text *EditableText) insertText(str string, length int, position *int) { +func (text *EditableText) insertText(str string, position *int) { gclass := (*C.AtkEditableTextIface)(coreglib.PeekParentClass(text)) fnarg := gclass.insert_text var _arg0 *C.AtkEditableText // out var _arg1 *C.gchar // out - var _arg2 C.gint // out - var _arg3 *C.gint // out + var _arg2 C.gint + var _arg3 *C.gint // out _arg0 = (*C.AtkEditableText)(unsafe.Pointer(coreglib.InternObject(text).Native())) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gint(length) _arg3 = (*C.gint)(unsafe.Pointer(position)) C._gotk4_atk1_EditableText_virtual_insert_text(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3) runtime.KeepAlive(text) runtime.KeepAlive(str) - runtime.KeepAlive(length) runtime.KeepAlive(position) } @@ -5830,30 +5905,11 @@ func (text *EditableText) setTextContents(str string) { runtime.KeepAlive(str) } -// HyperlinkImpl allows AtkObjects to refer to their associated AtkHyperlink -// instance, if one exists. AtkHyperlinkImpl differs from AtkHyperlink in that -// AtkHyperlinkImpl is an interface, whereas AtkHyperlink is a object type. -// The AtkHyperlinkImpl interface allows a client to query an AtkObject for -// the availability of an associated AtkHyperlink instance, and obtain that -// instance. It is thus particularly useful in cases where embedded content -// or inline content within a text object is present, since the embedding text -// object implements AtkHypertext and the inline/embedded objects are exposed -// as children which implement AtkHyperlinkImpl, in addition to their being -// obtainable via AtkHypertext:getLink followed by AtkHyperlink:getObject. -// -// The AtkHyperlinkImpl interface should be supported by objects exposed within -// the hierarchy as children of an AtkHypertext container which correspond -// to "links" or embedded content within the text. HTML anchors are not, for -// instance, normally exposed this way, but embedded images and components which -// appear inline in the content of a text object are. The AtkHyperlinkIface -// interface allows a means of determining which children are hyperlinks in this -// sense of the word, and for obtaining their corresponding AtkHyperlink object, -// from which the embedding range, URI, etc. can be obtained. -// -// To some extent this interface exists because, for historical reasons, -// AtkHyperlink was defined as an object type, not an interface. Thus, in order -// to interact with AtkObjects via AtkHyperlink semantics, a new interface was -// required. +// HyperlinkImpl: queryable interface which allows AtkHyperlink instances +// associated with an AtkObject to be obtained. AtkHyperlinkImpl corresponds +// to AT-SPI's Hyperlink interface, and differs from AtkHyperlink in that +// AtkHyperlink is an object type, rather than an interface, and thus cannot be +// directly queried. FTW. // // HyperlinkImpl wraps an interface. This means the user can get the // underlying type by calling Cast(). @@ -5933,8 +5989,11 @@ func (impl *HyperlinkImpl) hyperlink() *Hyperlink { return _hyperlink } -// Hypertext: interface used for objects which implement linking between -// multiple resource or content locations, or multiple 'markers' within a single +// Hypertext: ATK interface which provides standard mechanism for manipulating +// hyperlinks. +// +// An interface used for objects which implement linking between multiple +// resource or content locations, or multiple 'markers' within a single // document. A Hypertext instance is associated with one or more Hyperlinks, // which are associated with particular offsets within the Hypertext's included // content. While this interface is derived from Text, there is no requirement @@ -6169,6 +6228,9 @@ func (hypertext *Hypertext) linkSelected(linkIndex int) { runtime.KeepAlive(linkIndex) } +// Image: ATK Interface implemented by components which expose image or pixmap +// content on-screen. +// // Image should be implemented by Object subtypes on behalf of components which // display image/pixmap information onscreen, and which provide information // (other than just widget borders, etc.) via that image content. For instance, @@ -6575,6 +6637,9 @@ func BaseImplementorIface(obj ImplementorIfacer) *ImplementorIface { return obj.baseImplementorIface() } +// Selection: ATK interface implemented by container objects whose Object +// children can be selected. +// // Selection should be implemented by UI components with children which are // exposed by #atk_object_ref_child and #atk_object_get_n_children, if the use // of the parent UI component ordinarily involves selection of one or more of @@ -7096,9 +7161,11 @@ func (selection *Selection) selectionChanged() { runtime.KeepAlive(selection) } -// StreamableContent: interface whereby an object allows its backing content -// to be streamed to clients. Typical implementors would be images or icons, -// HTML content, or multimedia display/rendering widgets. +// StreamableContent: ATK interface which provides access to streamable content. +// +// An interface whereby an object allows its backing content to be streamed +// to clients. Typical implementors would be images or icons, HTML content, +// or multimedia display/rendering widgets. // // Negotiation of content type is allowed. Clients may examine the backing data // and transform, convert, or parse the content in order to present it in an @@ -7413,6 +7480,9 @@ func (streamable *StreamableContent) urI(mimeType string) string { return _utf8 } +// Table: ATK interface implemented for UI components which contain tabular or +// row/column information. +// // Table should be implemented by components which present elements ordered via // rows and columns. It may also be used to present tree-structured information // if the nodes of the trees can be said to contain multiple "columns". @@ -9460,11 +9530,14 @@ func (table *Table) setSummary(accessible *AtkObject) { runtime.KeepAlive(accessible) } -// TableCell: being Table a component which present elements ordered via rows -// and columns, an TableCell is the interface which each of those elements, -// so "cells" should implement. +// TableCell: ATK interface implemented for a cell inside a two-dimentional +// Table // -// See also Table. +// Being Table a component which present elements ordered via rows and columns, +// an TableCell is the interface which each of those elements, so "cells" should +// implement. +// +// See atktable. // // TableCell wraps an interface. This means the user can get the // underlying type by calling Cast(). @@ -9804,6 +9877,8 @@ func (cell *TableCell) table() *AtkObject { return _object } +// Text: ATK interface implemented by components with text content. +// // Text should be implemented by Objects on behalf of widgets that have text // content which is either attributed or otherwise non-trivial. Objects whose // text content is simple, unattributed, and very brief may expose that @@ -11720,6 +11795,10 @@ func (text *Text) textCaretMoved(location int) { runtime.KeepAlive(location) } +// textChanged: signal handler which is executed when there is a text change. +// This virtual function is deprecated sice 2.9.4 and it should not be +// overriden. +// // The function takes the following parameters: // // - position @@ -11754,6 +11833,9 @@ func (text *Text) textSelectionChanged() { runtime.KeepAlive(text) } +// Value: ATK interface implemented by valuators and components which display or +// select a value from a bounded range of values. +// // Value should be implemented for components which either display a value // from a bounded range, or which allow the user to specify a value from a // bounded range, or both. For instance, most sliders and range controls, @@ -12501,9 +12583,14 @@ func (obj *Value) setValue(newValue float64) { type WindowOverrider interface { } +// Window: ATK Interface provided by UI components that represent a top-level +// window. +// // Window should be implemented by the UI elements that represent a top-level // window, such as the main window of an application or dialog. // +// See atkobject. +// // Window wraps an interface. This means the user can get the // underlying type by calling Cast(). type Window struct { @@ -12605,10 +12692,13 @@ func defaultGObjectAccessibleOverrides(v *GObjectAccessible) GObjectAccessibleOv return GObjectAccessibleOverrides{} } -// GObjectAccessible: this object class is derived from AtkObject. It can be -// used as a basis for implementing accessible objects for GObjects which -// are not derived from GtkWidget. One example of its use is in providing an -// accessible object for GnomeCanvasItem in the GAIL library. +// GObjectAccessible: this object class is derived from AtkObject and can be +// used as a basis implementing accessible objects. +// +// This object class is derived from AtkObject. It can be used as a basis for +// implementing accessible objects for GObjects which are not derived from +// GtkWidget. One example of its use is in providing an accessible object for +// GnomeCanvasItem in the GAIL library. type GObjectAccessible struct { _ [0]func() // equal guard AtkObject @@ -12775,11 +12865,14 @@ func defaultHyperlinkOverrides(v *Hyperlink) HyperlinkOverrides { } } -// Hyperlink: ATK object which encapsulates a link or set of links (for -// instance in the case of client-side image maps) in a hypertext document. -// It may implement the AtkAction interface. AtkHyperlink may also be used to -// refer to inline embedded content, since it allows specification of a start -// and end offset within the host AtkHypertext object. +// Hyperlink: ATK object which encapsulates a link or set of links in a +// hypertext document. +// +// An ATK object which encapsulates a link or set of links (for instance in the +// case of client-side image maps) in a hypertext document. It may implement +// the AtkAction interface. AtkHyperlink may also be used to refer to inline +// embedded content, since it allows specification of a start and end offset +// within the host AtkHypertext object. type Hyperlink struct { _ [0]func() // equal guard *coreglib.Object @@ -13326,7 +13419,9 @@ func defaultMiscOverrides(v *Misc) MiscOverrides { } } -// Misc: set of utility functions for thread locking. This interface and all his +// Misc: set of ATK utility functions for thread locking +// +// A set of utility functions for thread locking. This interface and all his // related methods are deprecated since 2.12. type Misc struct { _ [0]func() // equal guard @@ -13473,9 +13568,12 @@ func defaultNoOpObjectOverrides(v *NoOpObject) NoOpObjectOverrides { return NoOpObjectOverrides{} } -// NoOpObject is an AtkObject which purports to implement all ATK interfaces. -// It is the type of AtkObject which is created if an accessible object is -// requested for an object type for which no factory type is specified. +// NoOpObject: atkObject which purports to implement all ATK interfaces. +// +// An AtkNoOpObject is an AtkObject which purports to implement all ATK +// interfaces. It is the type of AtkObject which is created if an accessible +// object is requested for an object type for which no factory type is +// specified. type NoOpObject struct { _ [0]func() // equal guard AtkObject @@ -13603,8 +13701,10 @@ func defaultNoOpObjectFactoryOverrides(v *NoOpObjectFactory) NoOpObjectFactoryOv } // NoOpObjectFactory: atkObjectFactory which creates an AtkNoOpObject. -// An instance of this is created by an AtkRegistry if no factory type has not -// been specified to create an accessible object of a particular type. +// +// The AtkObjectFactory which creates an AtkNoOpObject. An instance of this is +// created by an AtkRegistry if no factory type has not been specified to create +// an accessible object of a particular type. type NoOpObjectFactory struct { _ [0]func() // equal guard ObjectFactory @@ -13668,7 +13768,11 @@ type AtkObjectOverrides struct { // - changeIndex // - changedChild (optional) ChildrenChanged func(changeIndex uint, changedChild unsafe.Pointer) - FocusEvent func(focusIn bool) + // FocusEvent: signal handler which is executed when there is a focus event + // for an object. This virtual function is deprecated since 2.9.4 and it + // should not be overriden. Use the Object::state-change "focused" signal + // instead. + FocusEvent func(focusIn bool) // Description gets the accessible description of the accessible. // // The function returns the following values: @@ -13838,8 +13942,10 @@ func defaultAtkObjectOverrides(v *AtkObject) AtkObjectOverrides { } } -// AtkObject: this class is the primary class for accessibility support via -// the Accessibility ToolKit (ATK). Objects which are instances of Object (or +// AtkObject: base object class for the Accessibility Toolkit API. +// +// This class is the primary class for accessibility support via the +// Accessibility ToolKit (ATK). Objects which are instances of Object (or // instances of AtkObject-derived types) are queried for properties which // relate basic (and generic) properties of a UI component such as name and // description. Instances of Object may also be queried as to whether they @@ -13853,7 +13959,7 @@ func defaultAtkObjectOverrides(v *AtkObject) AtkObjectOverrides { // ancestor class, or in the case of custom widgets, if the inherited Object // implementation is insufficient, via instances of a new Object subclass. // -// See also: ObjectFactory, Registry. (GTK+ users see also Accessible). +// See atkobjectfactory, atkregistry. (GTK+ users see also Accessible). type AtkObject struct { _ [0]func() // equal guard *coreglib.Object @@ -13991,8 +14097,22 @@ func (object *AtkObject) ConnectActiveDescendantChanged(f func(arg1 *AtkObject)) return coreglib.ConnectGeneratedClosure(object, "active-descendant-changed", false, unsafe.Pointer(C._gotk4_atk1_Object_ConnectActiveDescendantChanged), f) } +// ConnectAnnouncement: "announcement" signal can be emitted to pass an +// announcement on to be read by a screen reader. +// +// Depcrecated (2.50): Use AtkObject::notification instead. +func (object *AtkObject) ConnectAnnouncement(f func(arg1 string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(object, "announcement", false, unsafe.Pointer(C._gotk4_atk1_Object_ConnectAnnouncement), f) +} + +// ConnectAttributeChanged: "attribute-changed" signal should be emitted when +// one of an object's attributes changes. +func (object *AtkObject) ConnectAttributeChanged(f func(arg1, arg2 string)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(object, "attribute-changed", false, unsafe.Pointer(C._gotk4_atk1_Object_ConnectAttributeChanged), f) +} + // ConnectChildrenChanged: signal "children-changed" is emitted when a child is -// added or removed form an object. It supports two details: "add" and "remove". +// added or removed from an object. It supports two details: "add" and "remove". func (object *AtkObject) ConnectChildrenChanged(f func(arg1 uint, arg2 *AtkObject)) coreglib.SignalHandle { return coreglib.ConnectGeneratedClosure(object, "children-changed", false, unsafe.Pointer(C._gotk4_atk1_Object_ConnectChildrenChanged), f) } @@ -14003,6 +14123,12 @@ func (object *AtkObject) ConnectFocusEvent(f func(arg1 bool)) coreglib.SignalHan return coreglib.ConnectGeneratedClosure(object, "focus-event", false, unsafe.Pointer(C._gotk4_atk1_Object_ConnectFocusEvent), f) } +// ConnectNotification: "notification" signal can be emitted to pass an +// announcement on to be read by a screen reader. +func (object *AtkObject) ConnectNotification(f func(arg1 string, arg2 int)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(object, "notification", false, unsafe.Pointer(C._gotk4_atk1_Object_ConnectNotification), f) +} + // ConnectPropertyChange: signal "property-change" is emitted when an object's // property value changes. arg1 contains an PropertyValues with the name and the // new value of the property whose value has changed. Note that, as with GObject @@ -14109,6 +14235,28 @@ func (accessible *AtkObject) Description() string { return _utf8 } +// HelpText gets the help text associated with the accessible. +// +// The function returns the following values: +// +// - utf8: character string representing the help text or the object, or NULL +// if no such string was set. +func (accessible *AtkObject) HelpText() string { + var _arg0 *C.AtkObject // out + var _cret *C.gchar // in + + _arg0 = (*C.AtkObject)(unsafe.Pointer(coreglib.InternObject(accessible).Native())) + + _cret = C.atk_object_get_help_text(_arg0) + runtime.KeepAlive(accessible) + + var _utf8 string // out + + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + + return _utf8 +} + // IndexInParent gets the 0-based index of this accessible in its parent; // returns -1 if the accessible does not have an accessible parent. // @@ -14504,18 +14652,18 @@ func (object *AtkObject) RemoveRelationship(relationship RelationType, target *A // // The function takes the following parameters: // -// - name: character string to be set as the accessible id. -func (accessible *AtkObject) SetAccessibleID(name string) { +// - id: character string to be set as the accessible id. +func (accessible *AtkObject) SetAccessibleID(id string) { var _arg0 *C.AtkObject // out var _arg1 *C.gchar // out _arg0 = (*C.AtkObject)(unsafe.Pointer(coreglib.InternObject(accessible).Native())) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(id))) defer C.free(unsafe.Pointer(_arg1)) C.atk_object_set_accessible_id(_arg0, _arg1) runtime.KeepAlive(accessible) - runtime.KeepAlive(name) + runtime.KeepAlive(id) } // SetDescription sets the accessible description of the accessible. You can't @@ -14539,6 +14687,26 @@ func (accessible *AtkObject) SetDescription(description string) { runtime.KeepAlive(description) } +// SetHelpText sets the help text associated with the accessible. This can be +// used to expose context-sensitive information to help a user understand how to +// interact with the object. +// +// The function takes the following parameters: +// +// - helpText: character string to be set as the accessible's help text. +func (accessible *AtkObject) SetHelpText(helpText string) { + var _arg0 *C.AtkObject // out + var _arg1 *C.gchar // out + + _arg0 = (*C.AtkObject)(unsafe.Pointer(coreglib.InternObject(accessible).Native())) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(helpText))) + defer C.free(unsafe.Pointer(_arg1)) + + C.atk_object_set_help_text(_arg0, _arg1) + runtime.KeepAlive(accessible) + runtime.KeepAlive(helpText) +} + // SetName sets the accessible name of the accessible. You can't set the name to // NULL. This is reserved for the initial value. In this aspect NULL is similar // to ATK_ROLE_UNKNOWN. If you want to set the name to a empty value you can use @@ -14633,6 +14801,9 @@ func (accessible *AtkObject) childrenChanged(changeIndex uint, changedChild unsa runtime.KeepAlive(changedChild) } +// focusEvent: signal handler which is executed when there is a focus event for +// an object. This virtual function is deprecated since 2.9.4 and it should not +// be overriden. Use the Object::state-change "focused" signal instead. func (accessible *AtkObject) focusEvent(focusIn bool) { gclass := (*C.AtkObjectClass)(coreglib.PeekParentClass(accessible)) fnarg := gclass.focus_event @@ -15129,8 +15300,11 @@ func defaultObjectFactoryOverrides(v *ObjectFactory) ObjectFactoryOverrides { } } -// ObjectFactory: this class is the base object class for a factory used -// to create an accessible object for a specific GType. The function +// ObjectFactory: base object class for a factory used to create accessible +// objects for objects of a specific GType. +// +// This class is the base object class for a factory used to +// create an accessible object for a specific GType. The function // atk_registry_set_factory_type() is normally called to store in the registry // the factory type to be used to create an accessible of a particular GType. type ObjectFactory struct { @@ -15266,7 +15440,9 @@ func defaultPlugOverrides(v *Plug) PlugOverrides { } } -// Plug: see Socket. +// Plug: toplevel for embedding into other processes +// +// See atksocket. type Plug struct { _ [0]func() // equal guard AtkObject @@ -15415,7 +15591,10 @@ func defaultRegistryOverrides(v *Registry) RegistryOverrides { return RegistryOverrides{} } -// Registry is normally used to create appropriate ATK "peers" for user +// Registry: object used to store the GType of the factories used to create an +// accessible object for an object of a particular GType. +// +// The AtkRegistry is normally used to create appropriate ATK "peers" for user // interface components. Application developers usually need only interact // with the AtkRegistry by associating appropriate ATK implementation classes // with GObject classes via the atk_registry_set_factory_type call, passing the @@ -15545,7 +15724,10 @@ func defaultRelationOverrides(v *Relation) RelationOverrides { return RelationOverrides{} } -// Relation describes a relation between an object and one or more other +// Relation: object used to describe a relation between a object and one or more +// other objects. +// +// An AtkRelation describes a relation between an object and one or more other // objects. The actual relations that an object has with other objects are // defined as an AtkRelationSet, which is a set of AtkRelations. type Relation struct { @@ -15700,9 +15882,12 @@ func defaultRelationSetOverrides(v *RelationSet) RelationSetOverrides { return RelationSetOverrides{} } -// RelationSet held by an object establishes its relationships with objects -// beyond the normal "parent/child" hierarchical relationships that all user -// interface objects have. AtkRelationSets establish whether objects are +// RelationSet: set of AtkRelations, normally the set of AtkRelations which an +// AtkObject has. +// +// The AtkRelationSet held by an object establishes its relationships with +// objects beyond the normal "parent/child" hierarchical relationships that all +// user interface objects have. AtkRelationSets establish whether objects are // labelled or controlled by other components, share group membership with other // components (for instance within a radio-button group), or share content which // "flows" between them, among other types of possible relationships. @@ -15989,8 +16174,10 @@ func defaultSocketOverrides(v *Socket) SocketOverrides { } } -// Socket: together with Plug, Socket provides the ability to embed accessibles -// from one process into another in a fashion that is transparent to assistive +// Socket: container for AtkPlug objects from other processes +// +// Together with Plug, Socket provides the ability to embed accessibles from +// one process into another in a fashion that is transparent to assistive // technologies. Socket works as the container of Plug, embedding it using the // method atk_socket_embed(). Any accessible contained in the Plug will appear // to the assistive technologies as being inside the application that created @@ -16009,6 +16196,8 @@ func defaultSocketOverrides(v *Socket) SocketOverrides { // atk_object_get_n_accessible_children() and atk_object_ref_accessible_child(). // All the logic related to those functions will be implemented by the IPC // layer. +// +// See atkplug. type Socket struct { _ [0]func() // equal guard AtkObject @@ -16160,7 +16349,9 @@ func defaultStateSetOverrides(v *StateSet) StateSetOverrides { return StateSetOverrides{} } -// StateSet is a read-only representation of the full set of States that +// StateSet contains the states of an object. +// +// An AtkStateSet is a read-only representation of the full set of States that // apply to an object at a given time. This set is not meant to be modified, // but rather created when #atk_object_ref_state_set() is called. type StateSet struct { @@ -16510,10 +16701,11 @@ func defaultUtilOverrides(v *Util) UtilOverrides { return UtilOverrides{} } -// Util: set of ATK utility functions which are used to support event -// registration of various types, and obtaining the 'root' accessible of a -// process and information about the current ATK implementation and toolkit -// version. +// Util: set of ATK utility functions for event and toolkit support. +// +// A set of ATK utility functions which are used to support event registration +// of various types, and obtaining the 'root' accessible of a process and +// information about the current ATK implementation and toolkit version. type Util struct { _ [0]func() // equal guard *coreglib.Object @@ -16931,6 +17123,8 @@ func (p *PropertyValues) PropertyName() string { return _v } +// Range: given range or subrange, to be used with Value +// // Range are used on Value, in order to represent the full range of a given // component (for example an slider or a range control), or to define each // individual subrange this full range is splitted if available. See Value @@ -17429,6 +17623,102 @@ func (t *TextRectangle) SetHeight(height int) { *valptr = C.gint(height) } +// TextSelection: this structure represents a single text selection within a +// document. This selection is defined by two points in the content, where +// each one is defined by an AtkObject supporting the AtkText interface and a +// character offset relative to it. +// +// The end object must appear after the start object in the accessibility tree, +// i.e. the end object must be reachable from the start object by navigating +// forward (next, first child etc). +// +// This struct also contains a start_is_active boolean, to communicate if the +// start of the selection is the active point or not. +// +// The active point corresponds to the user's focus or point of interest. +// The user moves the active point to expand or collapse the range. The anchor +// point is the other point of the range and typically remains constant. In +// most cases, anchor is the start of the range and active is the end. However, +// when selecting backwards (e.g. pressing shift+left arrow in a text field), +// the start of the range is the active point, as the user moves this to +// manipulate the selection. +// +// An instance of this type is always passed by reference. +type TextSelection struct { + *textSelection +} + +// textSelection is the struct that's finalized. +type textSelection struct { + native *C.AtkTextSelection +} + +// StartObject: atkText containing the start of the selection. +func (t *TextSelection) StartObject() *AtkObject { + valptr := &t.native.start_object + var _v *AtkObject // out + _v = wrapObject(coreglib.Take(unsafe.Pointer(*valptr))) + return _v +} + +// StartOffset: text offset of the beginning of the selection within +// start_object. +func (t *TextSelection) StartOffset() int { + valptr := &t.native.start_offset + var _v int // out + _v = int(*valptr) + return _v +} + +// EndObject: atkText containing the end of the selection. +func (t *TextSelection) EndObject() *AtkObject { + valptr := &t.native.end_object + var _v *AtkObject // out + _v = wrapObject(coreglib.Take(unsafe.Pointer(*valptr))) + return _v +} + +// EndOffset: text offset of the end of the selection within end_object. +func (t *TextSelection) EndOffset() int { + valptr := &t.native.end_offset + var _v int // out + _v = int(*valptr) + return _v +} + +// StartIsActive: gboolean indicating whether the start of the selection is the +// active point. +func (t *TextSelection) StartIsActive() bool { + valptr := &t.native.start_is_active + var _v bool // out + if *valptr != 0 { + _v = true + } + return _v +} + +// StartOffset: text offset of the beginning of the selection within +// start_object. +func (t *TextSelection) SetStartOffset(startOffset int) { + valptr := &t.native.start_offset + *valptr = C.gint(startOffset) +} + +// EndOffset: text offset of the end of the selection within end_object. +func (t *TextSelection) SetEndOffset(endOffset int) { + valptr := &t.native.end_offset + *valptr = C.gint(endOffset) +} + +// StartIsActive: gboolean indicating whether the start of the selection is the +// active point. +func (t *TextSelection) SetStartIsActive(startIsActive bool) { + valptr := &t.native.start_is_active + if startIsActive { + *valptr = C.TRUE + } +} + // UtilClass: instance of this type is always passed by reference. type UtilClass struct { *utilClass diff --git a/pkg/atk/atk_export.go b/pkg/atk/atk_export.go index 442eba041..a4af7b47b 100644 --- a/pkg/atk/atk_export.go +++ b/pkg/atk/atk_export.go @@ -80,6 +80,28 @@ func _gotk4_atk1_Component_ConnectBoundsChanged(arg0 C.gpointer, arg1 *C.AtkRect f(_arg1) } +//export _gotk4_atk1_Document_ConnectDocumentAttributeChanged +func _gotk4_atk1_Document_ConnectDocumentAttributeChanged(arg0 C.gpointer, arg1 *C.gchar, arg2 *C.gchar, arg3 C.guintptr) { + var f func(arg1, arg2 string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(arg1, arg2 string)) + } + + var _arg1 string // out + var _arg2 string // out + + _arg1 = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _arg2 = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + f(_arg1, _arg2) +} + //export _gotk4_atk1_Document_ConnectLoadComplete func _gotk4_atk1_Document_ConnectLoadComplete(arg0 C.gpointer, arg1 C.guintptr) { var f func() @@ -1203,6 +1225,48 @@ func _gotk4_atk1_Object_ConnectActiveDescendantChanged(arg0 C.gpointer, arg1 *C. f(_arg1) } +//export _gotk4_atk1_Object_ConnectAnnouncement +func _gotk4_atk1_Object_ConnectAnnouncement(arg0 C.gpointer, arg1 *C.gchar, arg2 C.guintptr) { + var f func(arg1 string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg2)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(arg1 string)) + } + + var _arg1 string // out + + _arg1 = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + + f(_arg1) +} + +//export _gotk4_atk1_Object_ConnectAttributeChanged +func _gotk4_atk1_Object_ConnectAttributeChanged(arg0 C.gpointer, arg1 *C.gchar, arg2 *C.gchar, arg3 C.guintptr) { + var f func(arg1, arg2 string) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(arg1, arg2 string)) + } + + var _arg1 string // out + var _arg2 string // out + + _arg1 = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _arg2 = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) + + f(_arg1, _arg2) +} + //export _gotk4_atk1_Object_ConnectChildrenChanged func _gotk4_atk1_Object_ConnectChildrenChanged(arg0 C.gpointer, arg1 C.guint, arg2 *C.gpointer, arg3 C.guintptr) { var f func(arg1 uint, arg2 *AtkObject) @@ -1247,6 +1311,28 @@ func _gotk4_atk1_Object_ConnectFocusEvent(arg0 C.gpointer, arg1 C.gboolean, arg2 f(_arg1) } +//export _gotk4_atk1_Object_ConnectNotification +func _gotk4_atk1_Object_ConnectNotification(arg0 C.gpointer, arg1 *C.gchar, arg2 C.gint, arg3 C.guintptr) { + var f func(arg1 string, arg2 int) + { + closure := coreglib.ConnectedGeneratedClosure(uintptr(arg3)) + if closure == nil { + panic("given unknown closure user_data") + } + defer closure.TryRepanic() + + f = closure.Func.(func(arg1 string, arg2 int)) + } + + var _arg1 string // out + var _arg2 int // out + + _arg1 = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) + _arg2 = int(arg2) + + f(_arg1, _arg2) +} + //export _gotk4_atk1_Object_ConnectPropertyChange func _gotk4_atk1_Object_ConnectPropertyChange(arg0 C.gpointer, arg1 *C.gpointer, arg2 C.guintptr) { var f func(arg1 *PropertyValues) diff --git a/pkg/gdk/v3/gdk.go b/pkg/gdk/v3/gdk.go index cdf116859..698bbc8d6 100644 --- a/pkg/gdk/v3/gdk.go +++ b/pkg/gdk/v3/gdk.go @@ -2533,7 +2533,7 @@ const KEY_zerosuperior = 16785520 const KEY_zstroke = 16777654 const MAJOR_VERSION = 3 const MAX_TIMECOORD_AXES = 128 -const MICRO_VERSION = 27 +const MICRO_VERSION = 42 const MINOR_VERSION = 24 // PARENT_RELATIVE: special value, indicating that the background for a window @@ -7355,9 +7355,11 @@ func PixbufGetFromSurface(surface *cairo.Surface, srcX, srcY, width, height int) } // PixbufGetFromWindow transfers image data from a Window and converts it to an -// RGB(A) representation inside a Pixbuf. In other words, copies image data from -// a server-side drawable to a client-side RGB(A) buffer. This allows you to -// efficiently read individual pixels on the client side. +// RGB(A) representation inside a Pixbuf. +// +// In other words, copies image data from a server-side drawable to a +// client-side RGB(A) buffer. This allows you to efficiently read individual +// pixels on the client side. // // This function will create an RGB pixbuf with 8 bits per channel with the size // specified by the width and height arguments scaled by the scale factor of @@ -7377,8 +7379,10 @@ func PixbufGetFromSurface(surface *cairo.Surface, srcX, srcY, width, height int) // If memory can’t be allocated for the return value, NULL will be returned // instead. // -// (In short, there are several ways this function can fail, and if it fails it -// returns NULL; so check the return value.). +// In short, there are several ways this function can fail, and if it fails it +// returns NULL; so check the return value. +// +// You should rarely, if ever, need to call this function. // // The function takes the following parameters: // @@ -8489,6 +8493,9 @@ func (context *AppLaunchContext) SetIconName(iconName string) { // SetScreen sets the screen on which applications will be launched when using // this context. See also gdk_app_launch_context_set_display(). // +// Note that, typically, a Screen represents a logical screen, not a physical +// monitor. +// // If both screen and display are set, the screen takes priority. If neither // screen or display are set, the default screen and display are used. // diff --git a/pkg/gdk/v4/gdk.go b/pkg/gdk/v4/gdk.go index e37cb06cc..d80f7b42b 100644 --- a/pkg/gdk/v4/gdk.go +++ b/pkg/gdk/v4/gdk.go @@ -3,7 +3,6 @@ package gdk import ( - "context" "fmt" "runtime" _ "runtime/cgo" @@ -11,8 +10,6 @@ import ( "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" @@ -27,7 +24,6 @@ import ( // #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); @@ -62,7 +58,6 @@ import ( // 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**); @@ -105,9 +100,6 @@ import ( // 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); // }; @@ -119,6 +111,7 @@ var ( 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()) @@ -129,14 +122,18 @@ var ( 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()) @@ -161,6 +158,8 @@ var ( 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()) @@ -169,6 +168,7 @@ var ( 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()) @@ -186,11 +186,14 @@ var ( 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()) ) @@ -200,6 +203,7 @@ func init() { 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}, @@ -210,14 +214,18 @@ func init() { 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}, @@ -242,6 +250,8 @@ func init() { 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}, @@ -250,6 +260,7 @@ func init() { 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}, @@ -267,11 +278,14 @@ func init() { 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}, }) } @@ -2804,6 +2818,50 @@ func (d DeviceToolType) String() string { } } +// 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 @@ -2900,6 +2958,9 @@ const ( 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 ) @@ -2967,6 +3028,8 @@ func (e EventType) String() string { return "PadStrip" case PadGroupMode: return "PadGroupMode" + case TouchpadHold: + return "TouchpadHold" case EventLast: return "EventLast" default: @@ -3051,7 +3114,8 @@ func GLErrorQuark() glib.Quark { return _quark } -// Gravity defines the reference point of a surface and is used in PopupLayout. +// Gravity defines the reference point of a surface and is used in +// GdkPopupLayout. type Gravity C.gint const ( @@ -3193,7 +3257,7 @@ func (k KeyMatch) String() string { } } -// MemoryFormat: GdkMemoryFormat describes a format that bytes can have in +// 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 @@ -3202,9 +3266,9 @@ func (k KeyMatch) String() string { // is represented by different GdkMemoryFormats on architectures with different // endiannesses. // -// Its naming is modelled after VkFormat (see -// https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.htmlFormat for -// details). +// 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 ( @@ -3229,6 +3293,63 @@ const ( 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 @@ -3259,6 +3380,54 @@ func (m MemoryFormat) String() string { 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: @@ -3356,6 +3525,48 @@ func (s ScrollDirection) String() string { } } +// 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 @@ -3449,6 +3660,80 @@ func (s SurfaceEdge) String() string { } } +// 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 @@ -3501,7 +3786,7 @@ func (t TouchpadGesturePhase) String() string { } } -// VulkanError: error enumeration for VulkanContext. +// VulkanError: error enumeration for GdkVulkanContext. type VulkanError C.gint const ( @@ -3820,7 +4105,7 @@ const ( // FrameClockPhaseUpdate corresponds to GdkFrameClock::update. FrameClockPhaseUpdate FrameClockPhase = 0b100 // FrameClockPhaseLayout corresponds to GdkFrameClock::layout. Should not be - // handled by applicatiosn. + // handled by applications. FrameClockPhaseLayout FrameClockPhase = 0b1000 // FrameClockPhasePaint corresponds to GdkFrameClock::paint. FrameClockPhasePaint FrameClockPhase = 0b10000 @@ -3881,6 +4166,53 @@ 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. // @@ -3893,6 +4225,8 @@ func (f FrameClockPhase) Has(other FrameClockPhase) bool { 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 @@ -3933,13 +4267,15 @@ func (m ModifierType) String() string { } var builder strings.Builder - builder.Grow(127) + 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: @@ -3985,11 +4321,11 @@ func (m ModifierType) Has(other ModifierType) bool { type PaintableFlags C.guint const ( - // PaintableStaticSize: size is immutable. The gdkpaintable::invalidate-size - // signal will never be emitted. + // PaintableStaticSize: size is immutable. The + // gdk.Paintable::invalidate-size signal will never be emitted. PaintableStaticSize PaintableFlags = 0b1 // PaintableStaticContents: content is immutable. The - // gdkpaintable::invalidate-contents signal will never be emitted. + // gdk.Paintable::invalidate-contents signal will never be emitted. PaintableStaticContents PaintableFlags = 0b10 ) @@ -4049,7 +4385,7 @@ const ( // SeatCapabilityAllPointing: union of all pointing capabilities. SeatCapabilityAllPointing SeatCapabilities = 0b111 // SeatCapabilityAll: union of all capabilities. - SeatCapabilityAll SeatCapabilities = 0b1111 + SeatCapabilityAll SeatCapabilities = 0b11111 ) func marshalSeatCapabilities(p uintptr) (interface{}, error) { @@ -4144,6 +4480,8 @@ const ( 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) { @@ -4196,6 +4534,8 @@ func (t ToplevelState) String() string { builder.WriteString("LeftTiled|") case ToplevelStateLeftResizable: builder.WriteString("LeftResizable|") + case ToplevelStateSuspended: + builder.WriteString("Suspended|") default: builder.WriteString(fmt.Sprintf("ToplevelState(0b%b)|", bit)) } @@ -4211,10 +4551,10 @@ func (t ToplevelState) Has(other ToplevelState) bool { return (t & other) == other } -// CairoDrawFromGL: main way to draw GL content in GTK. +// CairoDrawFromGL: main way to not draw GL content in GTK. // -// It takes a render buffer ID (source_type == RENDERBUFFER) or a texture -// id (source_type == TEXTURE) and draws it onto cr with an OVER operation, +// 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. @@ -4224,11 +4564,16 @@ func (t ToplevelState) Has(other ToplevelState) bool { // 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 RENDERBUFFER the code will always fall back to software for buffers with -// alpha components, so make sure you use TEXTURE if using alpha. +// 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. @@ -4278,7 +4623,7 @@ func CairoDrawFromGL(cr *cairo.Context, surface Surfacer, source, sourceType, bu // The function takes the following parameters: // // - cr: cairo context. -// - rectangle: Rectangle. +// - rectangle: GdkRectangle. func CairoRectangle(cr *cairo.Context, rectangle *Rectangle) { var _arg1 *C.cairo_t // out var _arg2 *C.GdkRectangle // out @@ -4296,7 +4641,7 @@ func CairoRectangle(cr *cairo.Context, rectangle *Rectangle) { // The function takes the following parameters: // // - cr: cairo context. -// - region: #cairo_region_t. +// - 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 @@ -4321,7 +4666,7 @@ func CairoRegion(cr *cairo.Context, region *cairo.Region) { // // The function returns the following values: // -// - region: cairo_region_t; must be freed with cairo_region_destroy(). +// - 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 @@ -4352,7 +4697,7 @@ func CairoRegionCreateFromSurface(surface *cairo.Surface) *cairo.Region { // The function takes the following parameters: // // - cr: cairo context. -// - pixbuf: Pixbuf. +// - 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) { @@ -4373,12 +4718,12 @@ func CairoSetSourcePixbuf(cr *cairo.Context, pixbuf *gdkpixbuf.Pixbuf, pixbufX, runtime.KeepAlive(pixbufY) } -// CairoSetSourceRGBA sets the specified RGBA as the source color of cr. +// CairoSetSourceRGBA sets the specified GdkRGBA as the source color of cr. // // The function takes the following parameters: // // - cr: cairo context. -// - rgba: RGBA. +// - rgba: GdkRGBA. func CairoSetSourceRGBA(cr *cairo.Context, rgba *RGBA) { var _arg1 *C.cairo_t // out var _arg2 *C.GdkRGBA // out @@ -4391,131 +4736,34 @@ func CairoSetSourceRGBA(cr *cairo.Context, rgba *RGBA) { 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 -// content_deserialize_finish 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, value *coreglib.Value) error { +func ContentDeserializeFinish(result gio.AsyncResulter) (coreglib.Value, error) { var _arg1 *C.GAsyncResult // out - var _arg2 *C.GValue // out + var _arg2 C.GValue // in var _cerr *C.GError // in _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) - _arg2 = (*C.GValue)(unsafe.Pointer(value.Native())) - C.gdk_content_deserialize_finish(_arg1, _arg2, &_cerr) + C.gdk_content_deserialize_finish(_arg1, &_arg2, &_cerr) runtime.KeepAlive(result) - runtime.KeepAlive(value) - var _goerr error // out + 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 _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 -// content_serialize_finish 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) + return _value, _goerr } // ContentSerializeFinish finishes a content serialization operation. @@ -4541,6 +4789,18 @@ func ContentSerializeFinish(result gio.AsyncResulter) error { 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 @@ -4674,8 +4934,8 @@ func EventsGetDistance(event1, event2 Eventer) (float64, bool) { // // The function returns the following values: // -// - utf8: interned string for the canonicalized mime type or NULL if the -// string wasn't a valid mime type. +// - 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 @@ -4688,7 +4948,9 @@ func InternMIMEType(str string) string { var _utf8 string // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } return _utf8 } @@ -4696,7 +4958,7 @@ func InternMIMEType(str string) string { // KeyvalConvertCase obtains the upper- and lower-case versions of the keyval // symbol. // -// Examples of keyvals are K_KEY_a, K_KEY_Enter, K_KEY_F1, etc. +// Examples of keyvals are GDK_KEY_a, GDK_KEY_Enter, GDK_KEY_F1, etc. // // The function takes the following parameters: // @@ -4822,8 +5084,7 @@ func KeyvalIsUpper(keyval uint) bool { // // The function returns the following values: // -// - utf8 (optional): string containing the name of the key, or NULL if keyval -// is not a valid key. The string should not be modified. +// - utf8 (optional): string containing the name of the key. func KeyvalName(keyval uint) string { var _arg1 C.guint // out var _cret *C.char // in @@ -4932,6 +5193,9 @@ func KeyvalToUpper(keyval uint) uint { // 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. @@ -4942,8 +5206,7 @@ func KeyvalToUpper(keyval uint) uint { // // The function returns the following values: // -// - pixbuf (optional): newly-created pixbuf with a reference count of 1, -// or NULL on error. +// - 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 @@ -4989,13 +5252,16 @@ func PixbufGetFromSurface(surface *cairo.Surface, srcX, srcY, width, height int) // 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 Pixbuf or NULL in case of an error. +// - pixbuf (optional): new GdkPixbuf. func PixbufGetFromTexture(texture Texturer) *gdkpixbuf.Pixbuf { var _arg1 *C.GdkTexture // out var _cret *C.GdkPixbuf // in @@ -5122,7 +5388,7 @@ func UnicodeToKeyval(wc uint32) uint { // (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 K_PAD_GROUP_MODE. +// 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(). @@ -5277,7 +5543,7 @@ func (pad *DevicePad) NGroups() int { return _gint } -// DragSurface is an interface for surfaces used during DND. +// 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(). @@ -5363,7 +5629,7 @@ func (dragSurface *DragSurface) Present(width, height int) bool { // it is suggested that you scale your paintable ignoring any potential aspect // ratio. // -// The contents that a GdkPaintable produces may depend on the gdksnapshot +// 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. @@ -5371,7 +5637,7 @@ func (dragSurface *DragSurface) Present(width, height int) bool { // 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 -// gdkpaintable::invalidate-contents signal. If a paintable is known to +// 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 @@ -5382,7 +5648,7 @@ func (dragSurface *DragSurface) Present(width, height int) bool { // 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 gdkpaintable::invalidate-size signal. And just like for contents, +// 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. // @@ -5944,9 +6210,9 @@ func (paintable *Paintable) snapshot(snapshot Snapshotter, width, height float64 // NewPaintableEmpty returns a paintable that has the given intrinsic size and // draws nothing. // -// This is often useful for implementing the -// PaintableInterface.get_current_image() virtual function when the paintable -// is in an incomplete state (like a gtk.MediaStream before receiving the first +// 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: @@ -5981,7 +6247,7 @@ func NewPaintableEmpty(intrinsicWidth, intrinsicHeight int) *Paintable { // 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 gdkpopup:autohide property. +// 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(). @@ -6010,7 +6276,7 @@ type Popupper interface { RectAnchor() Gravity // SurfaceAnchor gets the current popup surface anchor. SurfaceAnchor() Gravity - // Present popup after having processed the PopupLayout rules. + // Present popup after having processed the GdkPopupLayout rules. Present(width, height int, layout *PopupLayout) bool } @@ -6055,7 +6321,7 @@ func (popup *Popup) Autohide() bool { // // The function returns the following values: // -// - surface: parent surface. +// - surface (optional): parent surface. func (popup *Popup) Parent() Surfacer { var _arg0 *C.GdkPopup // out var _cret *C.GdkSurface // in @@ -6067,22 +6333,21 @@ func (popup *Popup) Parent() Surfacer { var _surface Surfacer // out - { - objptr := unsafe.Pointer(_cret) - if objptr == nil { - panic("object of type gdk.Surfacer is nil") - } + 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") + 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 } - _surface = rv } return _surface @@ -6178,13 +6443,13 @@ func (popup *Popup) SurfaceAnchor() Gravity { return _gravity } -// Present popup after having processed the PopupLayout rules. +// 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 gdksurface::layout signal being emitted. The resulting popup position +// 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 @@ -6291,6 +6556,7 @@ type Topleveller interface { // SupportsEdgeConstraints returns whether the desktop environment supports // tiled window states. SupportsEdgeConstraints() bool + TitlebarGesture(gesture TitlebarGesture) bool } var _ Topleveller = (*Toplevel)(nil) @@ -6385,8 +6651,9 @@ func (toplevel *Toplevel) BeginResize(edge SurfaceEdge, device Devicer, button i // Focus sets keyboard focus to surface. // -// In most cases, gtk.Window.PresentWithTime() should be used on a gtk.Window, -// rather than calling this function. +// 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: // @@ -6656,8 +6923,9 @@ func (toplevel *Toplevel) SetModal(modal bool) { // SetStartupID sets the startup notification ID. // -// When using GTK, typically you should use gtk.Window.SetStartupID() instead of -// this low-level function. +// 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: // @@ -6701,7 +6969,9 @@ func (toplevel *Toplevel) SetTitle(title string) { // 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.SetTransientFor() if you’re using gtk.Window or gtk.Dialog. +// 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: // @@ -6777,12 +7047,35 @@ func (toplevel *Toplevel) SupportsEdgeConstraints() bool { 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 screen or -// workspace. +// notification and allows to launch applications on a specific workspace. // // Launching an application // @@ -6790,7 +7083,6 @@ func (toplevel *Toplevel) SupportsEdgeConstraints() bool { // // context = gdk_display_get_app_launch_context (display); // -// gdk_app_launch_context_set_display (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)) @@ -6843,7 +7135,10 @@ func (context *AppLaunchContext) Display() *Display { // // 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). +// (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. @@ -6872,7 +7167,7 @@ func (context *AppLaunchContext) SetDesktop(desktop int) { // // The function takes the following parameters: // -// - icon (optional) or NULL. +// - icon (optional): GIcon. func (context *AppLaunchContext) SetIcon(icon gio.Iconner) { var _arg0 *C.GdkAppLaunchContext // out var _arg1 *C.GIcon // out @@ -6891,7 +7186,7 @@ func (context *AppLaunchContext) SetIcon(icon gio.Iconner) { // context. // // The icon_name will be interpreted in the same way as the Icon field in -// desktop files. See also gdk.AppLaunchContext.SetIcon()(). +// 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 @@ -6900,7 +7195,7 @@ func (context *AppLaunchContext) SetIcon(icon gio.Iconner) { // // The function takes the following parameters: // -// - iconName (optional): icon name, or NULL. +// - iconName (optional): icon name. func (context *AppLaunchContext) SetIconName(iconName string) { var _arg0 *C.GdkAppLaunchContext // out var _arg1 *C.char // out @@ -7041,8 +7336,7 @@ func BaseCairoContext(obj CairoContexter) *CairoContext { // // The function returns the following values: // -// - context (optional): cairo context to be used to draw the contents of the -// GdkSurface. NULL is returned when context is not drawing. +// - 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 @@ -7109,8 +7403,8 @@ func (clipboard *Clipboard) ConnectChanged(f func()) coreglib.SignalHandle { // // The function returns the following values: // -// - contentProvider (optional): content of a clipboard or NULL if the -// clipboard does not maintain any content. +// - 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 @@ -7208,62 +7502,6 @@ func (clipboard *Clipboard) IsLocal() bool { 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, NULL to ignore. -// - 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(). @@ -7274,8 +7512,8 @@ func (clipboard *Clipboard) ReadAsync(ctx context.Context, mimeTypes []string, i // // The function returns the following values: // -// - outMimeType (optional): pointer to store the chosen mime type in or NULL. -// - inputStream (optional): GInputStream or NULL on error. +// - 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 @@ -7320,43 +7558,6 @@ func (clipboard *Clipboard) ReadFinish(result gio.AsyncResulter) (string, gio.In 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, NULL to ignore. -// - 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(). @@ -7367,7 +7568,7 @@ func (clipboard *Clipboard) ReadTextAsync(ctx context.Context, callback gio.Asyn // // The function returns the following values: // -// - utf8 (optional): new string or NULL on error. +// - utf8 (optional): new string. func (clipboard *Clipboard) ReadTextFinish(result gio.AsyncResulter) (string, error) { var _arg0 *C.GdkClipboard // out var _arg1 *C.GAsyncResult // out @@ -7395,43 +7596,6 @@ func (clipboard *Clipboard) ReadTextFinish(result gio.AsyncResulter) (string, er 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(). @@ -7442,7 +7606,7 @@ func (clipboard *Clipboard) ReadTextureAsync(ctx context.Context, callback gio.A // // The function returns the following values: // -// - texture (optional): new GdkTexture or NULL on error. +// - texture (optional): new GdkTexture. func (clipboard *Clipboard) ReadTextureFinish(result gio.AsyncResulter) (Texturer, error) { var _arg0 *C.GdkClipboard // out var _arg1 *C.GAsyncResult // out @@ -7482,54 +7646,9 @@ func (clipboard *Clipboard) ReadTextureFinish(result gio.AsyncResulter) (Texture 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. +// ReadValueFinish finishes an asynchronous clipboard read. // -// 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, NULL to ignore. -// - 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(). +// See gdk.Clipboard.ReadValueAsync(). // // The function takes the following parameters: // @@ -7657,52 +7776,6 @@ func (clipboard *Clipboard) Set(value *coreglib.Value) { 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 gtk.Application is shut down, -// so you likely don't need to call it. -// -// The function takes the following parameters: -// -// - ctx (optional): optional GCancellable object, NULL to ignore. -// - 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(). @@ -7768,11 +7841,11 @@ func marshalContentDeserializer(p uintptr) (interface{}, error) { // Cancellable gets the cancellable for the current operation. // -// This is the GCancellable that was passed to content_deserialize_async. +// This is the GCancellable that was passed to gdk.ContentDeserializeAsync(). // // The function returns the following values: // -// - cancellable for the current operation. +// - cancellable (optional) for the current operation. func (deserializer *ContentDeserializer) Cancellable() *gio.Cancellable { var _arg0 *C.GdkContentDeserializer // out var _cret *C.GCancellable // in @@ -7784,10 +7857,12 @@ func (deserializer *ContentDeserializer) Cancellable() *gio.Cancellable { var _cancellable *gio.Cancellable // out - { - obj := coreglib.Take(unsafe.Pointer(_cret)) - _cancellable = &gio.Cancellable{ - Object: obj, + if _cret != nil { + { + obj := coreglib.Take(unsafe.Pointer(_cret)) + _cancellable = &gio.Cancellable{ + Object: obj, + } } } @@ -7817,7 +7892,7 @@ func (deserializer *ContentDeserializer) GType() coreglib.Type { // InputStream gets the input stream for the current operation. // -// This is the stream that was passed to content_deserialize_async. +// This is the stream that was passed to gdk.ContentDeserializeAsync(). // // The function returns the following values: // @@ -7877,7 +7952,7 @@ func (deserializer *ContentDeserializer) MIMEType() string { // Priority gets the I/O priority for the current operation. // -// This is the priority that was passed to [funccontent_deserialize_async]. +// This is the priority that was passed to gdk.ContentDeserializeAsync(). // // The function returns the following values: // @@ -8007,13 +8082,13 @@ type ContentProviderOverrides struct { // 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 IO_ERROR_NOT_SUPPORTED will - // be reported. + // is not supported, this operation can fail and G_IO_ERROR_NOT_SUPPORTED + // will be reported. // - // The function takes the following parameters: + // The function returns the following values: // // - value: GValue to fill. - Value func(value *coreglib.Value) error + Value func() (coreglib.Value, error) // RefFormats gets the formats that the provider can provide its current // contents in. // @@ -8209,7 +8284,7 @@ func NewContentProviderForValue(value *coreglib.Value) *ContentProvider { // // The function takes the following parameters: // -// - providers (optional): The ContentProviders to present the union of. +// - providers (optional): The GdkContentProviders to present the union of. // // The function returns the following values: // @@ -8255,32 +8330,32 @@ func (provider *ContentProvider) ContentChanged() { // // 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 IO_ERROR_NOT_SUPPORTED will be +// 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 takes the following parameters: +// The function returns the following values: // // - value: GValue to fill. -func (provider *ContentProvider) Value(value *coreglib.Value) error { +func (provider *ContentProvider) Value() (coreglib.Value, error) { var _arg0 *C.GdkContentProvider // out - var _arg1 *C.GValue // out + var _arg1 C.GValue // in var _cerr *C.GError // in _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) - _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) - C.gdk_content_provider_get_value(_arg0, _arg1, &_cerr) + C.gdk_content_provider_get_value(_arg0, &_arg1, &_cerr) runtime.KeepAlive(provider) - runtime.KeepAlive(value) - var _goerr error // out + 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 _goerr + return _value, _goerr } // RefFormats gets the formats that the provider can provide its current @@ -8343,58 +8418,6 @@ func (provider *ContentProvider) RefStorableFormats() *ContentFormats { 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, 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(). @@ -8470,35 +8493,35 @@ func (provider *ContentProvider) detachClipboard(clipboard *Clipboard) { // // 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 IO_ERROR_NOT_SUPPORTED will be +// 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 takes the following parameters: +// The function returns the following values: // // - value: GValue to fill. -func (provider *ContentProvider) value(value *coreglib.Value) error { +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 // out + var _arg1 C.GValue // in var _cerr *C.GError // in _arg0 = (*C.GdkContentProvider)(unsafe.Pointer(coreglib.InternObject(provider).Native())) - _arg1 = (*C.GValue)(unsafe.Pointer(value.Native())) - C._gotk4_gdk4_ContentProvider_virtual_get_value(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + C._gotk4_gdk4_ContentProvider_virtual_get_value(unsafe.Pointer(fnarg), _arg0, &_arg1, &_cerr) runtime.KeepAlive(provider) - runtime.KeepAlive(value) - var _goerr error // out + 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 _goerr + return _value, _goerr } // refFormats gets the formats that the provider can provide its current @@ -8567,61 +8590,6 @@ func (provider *ContentProvider) refStorableFormats() *ContentFormats { 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, 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(). @@ -8662,7 +8630,7 @@ func (provider *ContentProvider) writeMIMETypeFinish(result gio.AsyncResulter) e // // GTK provides serializers and deserializers for common data types such as // text, colors, images or file lists. To register your own serialization -// functions, use content_register_serializer. +// functions, use gdk.ContentRegisterSerializer(). // // Also see gdk.ContentDeserializer. type ContentSerializer struct { @@ -8691,11 +8659,11 @@ func marshalContentSerializer(p uintptr) (interface{}, error) { // Cancellable gets the cancellable for the current operation. // -// This is the GCancellable that was passed to [content_serialize_async]. +// This is the GCancellable that was passed to content_serialize_async. // // The function returns the following values: // -// - cancellable for the current operation. +// - cancellable (optional) for the current operation. func (serializer *ContentSerializer) Cancellable() *gio.Cancellable { var _arg0 *C.GdkContentSerializer // out var _cret *C.GCancellable // in @@ -8707,10 +8675,12 @@ func (serializer *ContentSerializer) Cancellable() *gio.Cancellable { var _cancellable *gio.Cancellable // out - { - obj := coreglib.Take(unsafe.Pointer(_cret)) - _cancellable = &gio.Cancellable{ - Object: obj, + if _cret != nil { + { + obj := coreglib.Take(unsafe.Pointer(_cret)) + _cancellable = &gio.Cancellable{ + Object: obj, + } } } @@ -9013,9 +8983,10 @@ func (event *CrossingEvent) Mode() CrossingMode { // 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.SetCursor()` instead. +// 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. @@ -9123,8 +9094,8 @@ func NewCursorFromName(name string, fallback *Cursor) *Cursor { // - 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): NULL or the GdkCursor to fall back to when this one -// cannot be supported. +// - fallback (optional): GdkCursor to fall back to when this one cannot be +// supported. // // The function returns the following values: // @@ -9427,7 +9398,7 @@ func BaseDevice(obj Devicer) *Device { return obj.baseDevice() } -// ConnectChanged is emitted either when the the number of either axes or keys +// 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 @@ -9474,7 +9445,7 @@ func (device *Device) CapsLockState() bool { // // The function returns the following values: // -// - deviceTool: GdkDeviceTool, or NULL. +// - deviceTool (optional): GdkDeviceTool. func (device *Device) DeviceTool() *DeviceTool { var _arg0 *C.GdkDevice // out var _cret *C.GdkDeviceTool // in @@ -9486,7 +9457,9 @@ func (device *Device) DeviceTool() *DeviceTool { var _deviceTool *DeviceTool // out - _deviceTool = wrapDeviceTool(coreglib.Take(unsafe.Pointer(_cret))) + if _cret != nil { + _deviceTool = wrapDeviceTool(coreglib.Take(unsafe.Pointer(_cret))) + } return _deviceTool } @@ -9662,7 +9635,7 @@ func (device *Device) NumTouches() uint { // // The function returns the following values: // -// - utf8 (optional): product ID, or NULL. +// - utf8 (optional): product ID. func (device *Device) ProductID() string { var _arg0 *C.GdkDevice // out var _cret *C.char // in @@ -9766,7 +9739,7 @@ func (device *Device) Source() InputSource { } // SurfaceAtPosition obtains the surface underneath device, returning the -// location of the device in win_x and win_y +// 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). @@ -9774,10 +9747,10 @@ func (device *Device) Source() InputSource { // The function returns the following values: // // - winX (optional): return location for the X coordinate of the device -// location, relative to the surface origin, or NULL. +// location relative to the surface origin. // - winY (optional): return location for the Y coordinate of the device -// location, relative to the surface origin, or NULL. -// - surface (optional): GdkSurface under the device position, or NULL. +// 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 @@ -9867,7 +9840,7 @@ func (device *Device) Timestamp() uint32 { // // The function returns the following values: // -// - utf8 (optional): vendor ID, or NULL. +// - utf8 (optional): vendor ID. func (device *Device) VendorID() string { var _arg0 *C.GdkDevice // out var _cret *C.char // in @@ -9955,18 +9928,18 @@ func (tool *DeviceTool) Axes() AxisFlags { // HardwareID gets the hardware ID of this tool, or 0 if it's not known. // -// When non-zero, the identificator 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()). +// 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 -// identificators. +// identifiers. // // The function returns the following values: // -// - guint64: hardware identificator of this tool. +// - guint64: hardware identifier of this tool. func (tool *DeviceTool) HardwareID() uint64 { var _arg0 *C.GdkDeviceTool // out var _cret C.guint64 // in @@ -10115,6 +10088,56 @@ func (display *Display) Close() { 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. // @@ -10170,8 +10193,7 @@ func (display *Display) Flush() { // // The function returns the following values: // -// - appLaunchContext: new GdkAppLaunchContext for display. Free with -// g_object_unref() when done. +// - appLaunchContext: new GdkAppLaunchContext for display. func (display *Display) AppLaunchContext() *AppLaunchContext { var _arg0 *C.GdkDisplay // out var _cret *C.GdkAppLaunchContext // in @@ -10248,18 +10270,52 @@ func (display *Display) DefaultSeat() Seater { 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. // -// Returns a monitor close to surface if it is outside of all monitors. -// // The function takes the following parameters: // // - surface: GdkSurface. // // The function returns the following values: // -// - monitor with the largest overlap with surface. +// - 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 @@ -10274,7 +10330,9 @@ func (display *Display) MonitorAtSurface(surface Surfacer) *Monitor { var _monitor *Monitor // out - _monitor = wrapMonitor(coreglib.Take(unsafe.Pointer(_cret))) + if _cret != nil { + _monitor = wrapMonitor(coreglib.Take(unsafe.Pointer(_cret))) + } return _monitor } @@ -10289,7 +10347,7 @@ func (display *Display) MonitorAtSurface(surface Surfacer) *Monitor { // // The function returns the following values: // -// - listModel of GdkMonitor. +// - listModel: GListModel of GdkMonitor. func (self *Display) Monitors() *gio.ListModel { var _arg0 *C.GdkDisplay // out var _cret *C.GListModel // in @@ -10397,9 +10455,11 @@ func (display *Display) Setting(name string, value *coreglib.Value) bool { // 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, or NULL. +// - utf8 (optional): startup notification ID for display. func (display *Display) StartupNotificationID() string { var _arg0 *C.GdkDisplay // out var _cret *C.char // in @@ -10564,8 +10624,8 @@ func (display *Display) ListSeats() []Seater { // // The function returns the following values: // -// - keys (optional): return location for array of GdkKeymapKey, or NULL. -// - keyvals (optional): return location for array of keyvals, or NULL. +// - 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 @@ -10684,9 +10744,13 @@ func (display *Display) MapKeyval(keyval uint) ([]KeymapKey, bool) { // NotifyStartupComplete indicates to the GUI environment that the application // has finished loading, using a given identifier. // -// GTK will call this function automatically for gtk.Window -// with custom startup-notification identifier unless -// gtk.Window.SetAutoStartupNotification() is called to disable that feature. +// 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: // @@ -10705,11 +10769,41 @@ func (display *Display) NotifyStartupComplete(startupId string) { runtime.KeepAlive(startupId) } -// PutEvent appends the given event onto the front of the event queue for -// display. +// 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. // -// This function is only useful in very special situations and should not be -// used by applications. +// Deprecated: This function is only useful in very special situations and +// should not be used by applications. // // The function takes the following parameters: // @@ -10754,6 +10848,34 @@ func (display *Display) SupportsInputShapes() bool { 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. // @@ -10800,11 +10922,11 @@ func (display *Display) Sync() { // // The function returns the following values: // -// - keyval (optional): return location for keyval, or NULL. -// - effectiveGroup (optional): return location for effective group, or NULL. -// - level (optional): return location for level, or NULL. +// - 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, or NULL. +// 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 @@ -10847,8 +10969,9 @@ func (display *Display) TranslateKey(keycode uint, state ModifierType, group int // DisplayGetDefault gets the default GdkDisplay. // -// This is a convenience function for: gdk_display_manager_get_default_display -// (gdk_display_manager_get ()). +// This is a convenience function for: +// +// gdk_display_manager_get_default_display (gdk_display_manager_get ()). // // The function returns the following values: // @@ -10869,20 +10992,23 @@ func DisplayGetDefault() *Display { // DisplayOpen opens a display. // +// If opening the display fails, NULL is returned. +// // The function takes the following parameters: // -// - displayName: name of the display to open. +// - displayName (optional): name of the display to open. // // The function returns the following values: // -// - display (optional): GdkDisplay, or NULL if the display could not be -// opened. +// - display (optional): GdkDisplay. func DisplayOpen(displayName string) *Display { var _arg1 *C.char // out var _cret *C.GdkDisplay // in - _arg1 = (*C.char)(unsafe.Pointer(C.CString(displayName))) - defer C.free(unsafe.Pointer(_arg1)) + 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) @@ -10915,7 +11041,7 @@ func DisplayOpen(displayName string) *Display { // // 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 K_WINDOWING_X11, K_WINDOWING_WIN32 macros, +// 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: @@ -10963,7 +11089,7 @@ func (manager *DisplayManager) ConnectDisplayOpened(f func(display *Display)) co // // The function returns the following values: // -// - display (optional): GdkDisplay, or NULL if there is no default display. +// - display (optional): GdkDisplay. func (manager *DisplayManager) DefaultDisplay() *Display { var _arg0 *C.GdkDisplayManager // out var _cret *C.GdkDisplay // in @@ -10986,8 +11112,7 @@ func (manager *DisplayManager) DefaultDisplay() *Display { // // The function returns the following values: // -// - sList: newly allocated GSList of GdkDisplay objects. Free with -// g_slist_free() when you are done with it. +// - sList: newly allocated GSList of GdkDisplay objects. func (manager *DisplayManager) ListDisplays() []*Display { var _arg0 *C.GdkDisplayManager // out var _cret *C.GSList // in @@ -11014,7 +11139,7 @@ func (manager *DisplayManager) ListDisplays() []*Display { // // The function takes the following parameters: // -// - name of the display to open. +// - name (optional) of the display to open. // // The function returns the following values: // @@ -11026,8 +11151,10 @@ func (manager *DisplayManager) OpenDisplay(name string) *Display { var _cret *C.GdkDisplay // in _arg0 = (*C.GdkDisplayManager)(unsafe.Pointer(coreglib.InternObject(manager).Native())) - _arg1 = (*C.char)(unsafe.Pointer(C.CString(name))) - defer C.free(unsafe.Pointer(_arg1)) + 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) @@ -11065,7 +11192,8 @@ func (manager *DisplayManager) SetDefaultDisplay(display *Display) { // 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 wil be used. +// Applications can use set_allowed_backends to limit what backends will be +// used. // // The function returns the following values: // @@ -11082,752 +11210,805 @@ func DisplayManagerGet() *DisplayManager { return _displayManager } -// Drag: GdkDrag object represents the source of an ongoing DND operation. +// DmabufTexture: GdkTexture representing a DMA buffer. // -// 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. +// To create a GdkDmabufTexture, use the auxiliary gdk.DmabufTextureBuilder +// 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 { +// Dma-buf textures can only be created on Linux. +type DmabufTexture struct { _ [0]func() // equal guard - *coreglib.Object + Texture } var ( - _ coreglib.Objector = (*Drag)(nil) + _ Texturer = (*DmabufTexture)(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 wrapDmabufTexture(obj *coreglib.Object) *DmabufTexture { + return &DmabufTexture{ + Texture: Texture{ + Object: obj, + Paintable: Paintable{ + Object: obj, + }, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, + }, } } -func marshalDrag(p uintptr) (interface{}, error) { - return wrapDrag(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil -} - -func (drag *Drag) baseDrag() *Drag { - return drag +func marshalDmabufTexture(p uintptr) (interface{}, error) { + return wrapDmabufTexture(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// BaseDrag returns the underlying base object. -func BaseDrag(obj Dragger) *Drag { - return obj.baseDrag() +// 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 } -// 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) -} +var ( + _ coreglib.Objector = (*DmabufTextureBuilder)(nil) +) -// 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) +func wrapDmabufTextureBuilder(obj *coreglib.Object) *DmabufTextureBuilder { + return &DmabufTextureBuilder{ + Object: obj, + } } -// 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) +func marshalDmabufTextureBuilder(p uintptr) (interface{}, error) { + return wrapDmabufTextureBuilder(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// 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. +// NewDmabufTextureBuilder creates a new texture builder. // -// The function takes the following parameters: +// The function returns the following values: // -// - success: whether the drag was ultimatively successful. -func (drag *Drag) DropDone(success bool) { - var _arg0 *C.GdkDrag // out - var _arg1 C.gboolean // out +// - dmabufTextureBuilder: new GdkTextureBuilder. +func NewDmabufTextureBuilder() *DmabufTextureBuilder { + var _cret *C.GdkDmabufTextureBuilder // in - _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) - if success { - _arg1 = C.TRUE - } + _cret = C.gdk_dmabuf_texture_builder_new() - C.gdk_drag_drop_done(_arg0, _arg1) - runtime.KeepAlive(drag) - runtime.KeepAlive(success) + var _dmabufTextureBuilder *DmabufTextureBuilder // out + + _dmabufTextureBuilder = wrapDmabufTextureBuilder(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + + return _dmabufTextureBuilder } -// Actions determines the bitmask of possible actions proposed by the source. +// Display returns the display that this texture builder is associated with. // // The function returns the following values: // -// - dragAction: GdkDragAction flags. -func (drag *Drag) Actions() DragAction { - var _arg0 *C.GdkDrag // out - var _cret C.GdkDragAction // in +// - display: display. +func (self *DmabufTextureBuilder) Display() *Display { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret *C.GdkDisplay // in - _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_drag_get_actions(_arg0) - runtime.KeepAlive(drag) + _cret = C.gdk_dmabuf_texture_builder_get_display(_arg0) + runtime.KeepAlive(self) - var _dragAction DragAction // out + var _display *Display // out - _dragAction = DragAction(_cret) + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) - return _dragAction + return _display } -// Content returns the GdkContentProvider associated to the GdkDrag object. +// 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: // -// - contentProvider: GdkContentProvider associated to drag. -func (drag *Drag) Content() *ContentProvider { - var _arg0 *C.GdkDrag // out - var _cret *C.GdkContentProvider // in +// - 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.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) - _cret = C.gdk_drag_get_content(_arg0) - runtime.KeepAlive(drag) + _cret = C.gdk_dmabuf_texture_builder_get_fd(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) - var _contentProvider *ContentProvider // out + var _gint int // out - _contentProvider = wrapContentProvider(coreglib.Take(unsafe.Pointer(_cret))) + _gint = int(_cret) - return _contentProvider + return _gint } -// Device returns the GdkDevice associated to the GdkDrag object. +// 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: // -// - 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())) +// - guint32: format. +func (self *DmabufTextureBuilder) Fourcc() uint32 { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.guint32 // in - _cret = C.gdk_drag_get_device(_arg0) - runtime.KeepAlive(drag) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - var _device Devicer // out + _cret = C.gdk_dmabuf_texture_builder_get_fourcc(_arg0) + runtime.KeepAlive(self) - { - objptr := unsafe.Pointer(_cret) - if objptr == nil { - panic("object of type gdk.Devicer is nil") - } + var _guint32 uint32 // out - 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 - } + _guint32 = uint32(_cret) - return _device + return _guint32 } -// Display gets the GdkDisplay that the drag object was created for. +// 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: // -// - display: GdkDisplay. -func (drag *Drag) Display() *Display { - var _arg0 *C.GdkDrag // out - var _cret *C.GdkDisplay // in +// - guint: height. +func (self *DmabufTextureBuilder) Height() uint { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.uint // in - _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_drag_get_display(_arg0) - runtime.KeepAlive(drag) + _cret = C.gdk_dmabuf_texture_builder_get_height(_arg0) + runtime.KeepAlive(self) - var _display *Display // out + var _guint uint // out - _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) + _guint = uint(_cret) - return _display + return _guint } -// 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. +// Modifier gets the modifier value. // // The function returns the following values: // -// - surface (optional): drag surface, or NULL. -func (drag *Drag) DragSurface() Surfacer { - var _arg0 *C.GdkDrag // out - var _cret *C.GdkSurface // in +// - guint64: modifier. +func (self *DmabufTextureBuilder) Modifier() uint64 { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.guint64 // in - _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) - - _cret = C.gdk_drag_get_drag_surface(_arg0) - runtime.KeepAlive(drag) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - var _surface Surfacer // out + _cret = C.gdk_dmabuf_texture_builder_get_modifier(_arg0) + runtime.KeepAlive(self) - if _cret != nil { - { - objptr := unsafe.Pointer(_cret) + var _guint64 uint64 // out - 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 - } - } + _guint64 = uint64(_cret) - return _surface + return _guint64 } -// Formats retrieves the formats supported by this GdkDrag object. +// NPlanes gets the number of planes. // // The function returns the following values: // -// - contentFormats: GdkContentFormats. -func (drag *Drag) Formats() *ContentFormats { - var _arg0 *C.GdkDrag // out - var _cret *C.GdkContentFormats // in +// - guint: number of planes. +func (self *DmabufTextureBuilder) NPlanes() uint { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.uint // in - _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_drag_get_formats(_arg0) - runtime.KeepAlive(drag) + _cret = C.gdk_dmabuf_texture_builder_get_n_planes(_arg0) + runtime.KeepAlive(self) - var _contentFormats *ContentFormats // out + var _guint uint // 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)) - }, - ) + _guint = uint(_cret) - return _contentFormats + return _guint } -// SelectedAction determines the action chosen by the drag destination. +// 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: // -// - dragAction: GdkDragAction value. -func (drag *Drag) SelectedAction() DragAction { - var _arg0 *C.GdkDrag // out - var _cret C.GdkDragAction // in +// - 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.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) - _cret = C.gdk_drag_get_selected_action(_arg0) - runtime.KeepAlive(drag) + _cret = C.gdk_dmabuf_texture_builder_get_offset(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) - var _dragAction DragAction // out + var _guint uint // out - _dragAction = DragAction(_cret) + _guint = uint(_cret) - return _dragAction + return _guint } -// Surface returns the GdkSurface where the drag originates. +// Premultiplied: whether the data is premultiplied. // // 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 +// - ok: whether the data is premultiplied. +func (self *DmabufTextureBuilder) Premultiplied() bool { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.gboolean // in - _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_drag_get_surface(_arg0) - runtime.KeepAlive(drag) + _cret = C.gdk_dmabuf_texture_builder_get_premultiplied(_arg0) + runtime.KeepAlive(self) - var _surface Surfacer // out + var _ok bool // out - { - objptr := unsafe.Pointer(_cret) - if objptr == nil { - panic("object of type gdk.Surfacer is nil") - } + if _cret != 0 { + _ok = true + } - 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 + return _ok } -// 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. +// Stride gets the stride value for a plane. // // 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 +// - 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.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) - _arg1 = C.int(hotX) - _arg2 = C.int(hotY) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) - C.gdk_drag_set_hotspot(_arg0, _arg1, _arg2) - runtime.KeepAlive(drag) - runtime.KeepAlive(hotX) - runtime.KeepAlive(hotY) + _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 } -// 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. +// UpdateRegion gets the region previously set via +// gdk_dmabuf_texture_builder_set_update_region() or NULL if none was set. // -// The function takes the following parameters: +// The function returns the following values: // -// - 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. +// - 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: // -// - drag (optional): newly created gdk.Drag or NULL on error. -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 +// - texture (optional): texture. +func (self *DmabufTextureBuilder) UpdateTexture() Texturer { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret *C.GdkTexture // 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) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _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) + _cret = C.gdk_dmabuf_texture_builder_get_update_texture(_arg0) + runtime.KeepAlive(self) - var _drag Dragger // out + var _texture Texturer // out if _cret != nil { { objptr := unsafe.Pointer(_cret) - object := coreglib.AssumeOwnership(objptr) + object := coreglib.Take(objptr) casted := object.WalkCast(func(obj coreglib.Objector) bool { - _, ok := obj.(Dragger) + _, ok := obj.(Texturer) return ok }) - rv, ok := casted.(Dragger) + rv, ok := casted.(Texturer) if !ok { - panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Dragger") + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") } - _drag = rv + _texture = rv } } - return _drag + return _texture } -// 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. +// Width gets the width previously set via +// gdk_dmabuf_texture_builder_set_width() or 0 if the width wasn't set. // -// You will always interact with one of those subclasses. +// The function returns the following values: // -// A GdkDrawContext is always associated with a single toplevel surface. -type DrawContext struct { - _ [0]func() // equal guard - *coreglib.Object -} +// - guint: width. +func (self *DmabufTextureBuilder) Width() uint { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _cret C.uint // in -var ( - _ coreglib.Objector = (*DrawContext)(nil) -) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) -// 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 -} + _cret = C.gdk_dmabuf_texture_builder_get_width(_arg0) + runtime.KeepAlive(self) -var _ DrawContexter = (*DrawContext)(nil) + var _guint uint // out -func wrapDrawContext(obj *coreglib.Object) *DrawContext { - return &DrawContext{ - Object: obj, - } -} + _guint = uint(_cret) -func marshalDrawContext(p uintptr) (interface{}, error) { - return wrapDrawContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil + return _guint } -func (context *DrawContext) baseDrawContext() *DrawContext { - return context -} +// 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 -// BaseDrawContext returns the underlying base object. -func BaseDrawContext(obj DrawContexter) *DrawContext { - return obj.baseDrawContext() + _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) } -// BeginFrame indicates that you are beginning the process of redrawing region -// on the context's surface. +// SetFd sets the file descriptor for a plane. // -// 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. +// The function takes the following parameters: // -// 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. +// - 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. // -// 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 [methodGdk.DrawContext.get_frame_region() to query the region that -// must be drawn. +// The format is specified as a fourcc code. // -// 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 gsk.Renderers, so application code does not need to call these functions -// explicitly. +// The format must be set before calling gdk.GLTextureBuilder.Build(). // // 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 +// - 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.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) - _arg1 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.guint32(fourcc) - C.gdk_draw_context_begin_frame(_arg0, _arg1) - runtime.KeepAlive(context) - runtime.KeepAlive(region) + C.gdk_dmabuf_texture_builder_set_fourcc(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(fourcc) } -// EndFrame ends a drawing operation started with -// gdk_draw_context_begin_frame(). +// SetHeight sets the height of the texture. // -// This makes the drawing available on screen. See gdk.DrawContext.BeginFrame() -// for more details about drawing. +// The height must be set before calling gdk.GLTextureBuilder.Build(). // -// 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 +// 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.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(height) - C.gdk_draw_context_end_frame(_arg0) - runtime.KeepAlive(context) + C.gdk_dmabuf_texture_builder_set_height(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(height) } -// Display retrieves the GdkDisplay the context is created for. +// SetModifier sets the modifier. // -// The function returns the following values: +// The function takes the following parameters: // -// - display (optional): GdkDisplay or NULL. -func (context *DrawContext) Display() *Display { - var _arg0 *C.GdkDrawContext // out - var _cret *C.GdkDisplay // in +// - modifier value. +func (self *DmabufTextureBuilder) SetModifier(modifier uint64) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 C.guint64 // out - _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.guint64(modifier) - _cret = C.gdk_draw_context_get_display(_arg0) - runtime.KeepAlive(context) + C.gdk_dmabuf_texture_builder_set_modifier(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(modifier) +} - var _display *Display // out +// 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 - if _cret != nil { - _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) - } + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(nPlanes) - return _display + C.gdk_dmabuf_texture_builder_set_n_planes(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(nPlanes) } -// 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. +// SetOffset sets the offset for a plane. // -// The function returns the following values: +// The function takes the following parameters: // -// - region (optional): cairo region or NULL if not drawing a frame. -func (context *DrawContext) FrameRegion() *cairo.Region { - var _arg0 *C.GdkDrawContext // out - var _cret *C.cairo_region_t // in +// - 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.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) + _arg2 = C.uint(offset) - _cret = C.gdk_draw_context_get_frame_region(_arg0) - runtime.KeepAlive(context) + C.gdk_dmabuf_texture_builder_set_offset(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) + runtime.KeepAlive(offset) +} - var _region *cairo.Region // out +// 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 - 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()))) - }) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if premultiplied { + _arg1 = C.TRUE } - return _region + C.gdk_dmabuf_texture_builder_set_premultiplied(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(premultiplied) } -// Surface retrieves the surface that context is bound to. +// SetStride sets the stride for a plane. // -// The function returns the following values: +// The stride must be set for all planes before calling +// gdk.GLTextureBuilder.Build(). // -// - surface (optional) or NULL. -func (context *DrawContext) Surface() Surfacer { - var _arg0 *C.GdkDrawContext // out - var _cret *C.GdkSurface // in - - _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) +// 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 - _cret = C.gdk_draw_context_get_surface(_arg0) - runtime.KeepAlive(context) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(plane) + _arg2 = C.uint(stride) - var _surface Surfacer // out + C.gdk_dmabuf_texture_builder_set_stride(_arg0, _arg1, _arg2) + runtime.KeepAlive(self) + runtime.KeepAlive(plane) + runtime.KeepAlive(stride) +} - if _cret != nil { - { - objptr := unsafe.Pointer(_cret) +// 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 - 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 - } + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if region != nil { + _arg1 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) } - return _surface + C.gdk_dmabuf_texture_builder_set_update_region(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(region) } -// 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. +// SetUpdateTexture sets the texture to be updated by this texture. See +// gdk.DmabufTextureBuilder.SetUpdateRegion() for an explanation. // -// The function returns the following values: +// The function takes the following parameters: // -// - 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 +// - texture (optional) to update. +func (self *DmabufTextureBuilder) SetUpdateTexture(texture Texturer) { + var _arg0 *C.GdkDmabufTextureBuilder // out + var _arg1 *C.GdkTexture // out - _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if texture != nil { + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) + } - _cret = C.gdk_draw_context_is_in_frame(_arg0) - runtime.KeepAlive(context) + C.gdk_dmabuf_texture_builder_set_update_texture(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(texture) +} - var _ok bool // out +// 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 - if _cret != 0 { - _ok = true - } + _arg0 = (*C.GdkDmabufTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.uint(width) - return _ok + C.gdk_dmabuf_texture_builder_set_width(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(width) } -// 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(). +// Drag: GdkDrag object represents the source of an ongoing DND operation. // -// 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(). +// 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 Drop struct { +type Drag struct { _ [0]func() // equal guard *coreglib.Object } var ( - _ coreglib.Objector = (*Drop)(nil) + _ coreglib.Objector = (*Drag)(nil) ) -// Dropper describes types inherited from class Drop. +// Dragger describes types inherited from class Drag. // // To get the original type, the caller must assert this to an interface or // another type. -type Dropper interface { +type Dragger interface { coreglib.Objector - baseDrop() *Drop + baseDrag() *Drag } -var _ Dropper = (*Drop)(nil) +var _ Dragger = (*Drag)(nil) -func wrapDrop(obj *coreglib.Object) *Drop { - return &Drop{ +func wrapDrag(obj *coreglib.Object) *Drag { + return &Drag{ Object: obj, } } -func marshalDrop(p uintptr) (interface{}, error) { - return wrapDrop(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +func marshalDrag(p uintptr) (interface{}, error) { + return wrapDrag(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -func (self *Drop) baseDrop() *Drop { - return self +func (drag *Drag) baseDrag() *Drag { + return drag } -// BaseDrop returns the underlying base object. -func BaseDrop(obj Dropper) *Drop { - return obj.baseDrop() +// BaseDrag returns the underlying base object. +func BaseDrag(obj Dragger) *Drag { + return obj.baseDrag() } -// Finish ends the drag operation after a drop. +// 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 action must be a single action selected from the actions available via -// gdk.Drop.GetActions(). +// 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: // -// - 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 +// - 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.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _arg1 = C.GdkDragAction(action) + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + if success { + _arg1 = C.TRUE + } - C.gdk_drop_finish(_arg0, _arg1) - runtime.KeepAlive(self) - runtime.KeepAlive(action) + C.gdk_drag_drop_done(_arg0, _arg1) + runtime.KeepAlive(drag) + runtime.KeepAlive(success) } -// 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. +// Actions determines the bitmask of possible actions proposed by the source. // // The function returns the following values: // -// - dragAction: possible GdkDragActions. -func (self *Drop) Actions() DragAction { - var _arg0 *C.GdkDrop // out +// - dragAction: GdkDragAction flags. +func (drag *Drag) Actions() DragAction { + var _arg0 *C.GdkDrag // out var _cret C.GdkDragAction // in - _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) - _cret = C.gdk_drop_get_actions(_arg0) - runtime.KeepAlive(self) + _cret = C.gdk_drag_get_actions(_arg0) + runtime.KeepAlive(drag) var _dragAction DragAction // out @@ -11836,19 +12017,40 @@ func (self *Drop) Actions() DragAction { return _dragAction } -// Device returns the GdkDevice performing the drop. +// Content returns the GdkContentProvider associated to the GdkDrag object. // // The function returns the following values: // -// - device: GdkDevice performing the drop. -func (self *Drop) Device() Devicer { - var _arg0 *C.GdkDrop // out +// - 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.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) - _cret = C.gdk_drop_get_device(_arg0) - runtime.KeepAlive(self) + _cret = C.gdk_drag_get_device(_arg0) + runtime.KeepAlive(drag) var _device Devicer // out @@ -11873,19 +12075,19 @@ func (self *Drop) Device() Devicer { return _device } -// Display gets the GdkDisplay that self was created for. +// Display gets the GdkDisplay that the drag object was created for. // // The function returns the following values: // // - display: GdkDisplay. -func (self *Drop) Display() *Display { - var _arg0 *C.GdkDrop // out +func (drag *Drag) Display() *Display { + var _arg0 *C.GdkDrag // out var _cret *C.GdkDisplay // in - _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) - _cret = C.gdk_drop_get_display(_arg0) - runtime.KeepAlive(self) + _cret = C.gdk_drag_get_display(_arg0) + runtime.KeepAlive(drag) var _display *Display // out @@ -11894,24 +12096,27 @@ func (self *Drop) Display() *Display { 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. +// 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: // -// - drag (optional): corresponding GdkDrag. -func (self *Drop) Drag() Dragger { - var _arg0 *C.GdkDrop // out - var _cret *C.GdkDrag // in +// - surface (optional): drag surface. +func (drag *Drag) DragSurface() Surfacer { + var _arg0 *C.GdkDrag // out + var _cret *C.GdkSurface // in - _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) - _cret = C.gdk_drop_get_drag(_arg0) - runtime.KeepAlive(self) + _cret = C.gdk_drag_get_drag_surface(_arg0) + runtime.KeepAlive(drag) - var _drag Dragger // out + var _surface Surfacer // out if _cret != nil { { @@ -11919,34 +12124,33 @@ func (self *Drop) Drag() Dragger { object := coreglib.Take(objptr) casted := object.WalkCast(func(obj coreglib.Objector) bool { - _, ok := obj.(Dragger) + _, ok := obj.(Surfacer) return ok }) - rv, ok := casted.(Dragger) + rv, ok := casted.(Surfacer) if !ok { - panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Dragger") + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") } - _drag = rv + _surface = rv } } - return _drag + return _surface } -// Formats returns the GdkContentFormats that the drop offers the data to be -// read in. +// Formats retrieves the formats supported by this GdkDrag object. // // The function returns the following values: // -// - contentFormats: possible GdkContentFormats. -func (self *Drop) Formats() *ContentFormats { - var _arg0 *C.GdkDrop // out +// - contentFormats: GdkContentFormats. +func (drag *Drag) Formats() *ContentFormats { + var _arg0 *C.GdkDrag // out var _cret *C.GdkContentFormats // in - _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) - _cret = C.gdk_drop_get_formats(_arg0) - runtime.KeepAlive(self) + _cret = C.gdk_drag_get_formats(_arg0) + runtime.KeepAlive(drag) var _contentFormats *ContentFormats // out @@ -11962,19 +12166,40 @@ func (self *Drop) Formats() *ContentFormats { return _contentFormats } -// Surface returns the GdkSurface performing the drop. +// SelectedAction determines the action chosen by the drag destination. // // The function returns the following values: // -// - surface: GdkSurface performing the drop. -func (self *Drop) Surface() Surfacer { - var _arg0 *C.GdkDrop // out +// - 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.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) - _cret = C.gdk_drop_get_surface(_arg0) - runtime.KeepAlive(self) + _cret = C.gdk_drag_get_surface(_arg0) + runtime.KeepAlive(drag) var _surface Surfacer // out @@ -11999,356 +12224,280 @@ func (self *Drop) Surface() Surfacer { return _surface } -// ReadAsync: asynchronously read the dropped data from a GdkDrop in a format -// that complies with one of the mime types. +// 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: // -// - ctx (optional): optional GCancellable object, NULL to ignore. -// - 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 +// - 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.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)) - } + _arg0 = (*C.GdkDrag)(unsafe.Pointer(coreglib.InternObject(drag).Native())) + _arg1 = C.int(hotX) + _arg2 = C.int(hotY) - 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) + C.gdk_drag_set_hotspot(_arg0, _arg1, _arg2) + runtime.KeepAlive(drag) + runtime.KeepAlive(hotX) + runtime.KeepAlive(hotY) } -// ReadFinish finishes an async drop read operation. +// DragBegin starts a drag and creates a new drag context for it. // -// 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(). +// 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(). // -// See gdk.Drop.ReadAsync(). +// 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: // -// - result: GAsyncResult. +// - 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: // -// - outMimeType: return location for the used mime type. -// - inputStream (optional): GInputStream, or NULL. -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 +// - 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 - _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) + _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_drop_read_finish(_arg0, _arg1, &_arg2, &_cerr) - runtime.KeepAlive(self) - runtime.KeepAlive(result) + _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 _outMimeType string // out - var _inputStream gio.InputStreamer // out - var _goerr error // out + var _drag Dragger // out - _outMimeType = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) - defer C.free(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) + _, ok := obj.(Dragger) return ok }) - rv, ok := casted.(gio.InputStreamer) + rv, ok := casted.(Dragger) if !ok { - panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.InputStreamer") + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Dragger") } - _inputStream = rv + _drag = rv } } - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } - return _outMimeType, _inputStream, _goerr + return _drag } -// ReadValueAsync: asynchronously request the drag operation's contents -// converted to the given type. +// DrawContext: base class for objects implementing different rendering methods. // -// When the operation is finished callback will be called. You must then call -// gdk.Drop.ReadValueFinish() to get the resulting GValue. +// 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. // -// For local drag'n'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. +// You will always interact with one of those subclasses. // -// The function takes the following parameters: +// 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. // -// - 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 +// To get the original type, the caller must assert this to an interface or +// another type. +type DrawContexter interface { + coreglib.Objector + baseDrawContext() *DrawContext +} - _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)) +var _ DrawContexter = (*DrawContext)(nil) + +func wrapDrawContext(obj *coreglib.Object) *DrawContext { + return &DrawContext{ + Object: obj, } +} - 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) +func marshalDrawContext(p uintptr) (interface{}, error) { + return wrapDrawContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// ReadValueFinish finishes an async drop read. +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. // -// See gdk.Drop.ReadValueAsync(). +// 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. // -// The function takes the following parameters: +// 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. // -// - result: GAsyncResult. +// 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. // -// 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'n'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. +// 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: // -// - 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 +// - 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.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _arg1 = C.GdkDragAction(actions) - _arg2 = C.GdkDragAction(preferred) + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg1 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) - C.gdk_drop_status(_arg0, _arg1, _arg2) - runtime.KeepAlive(self) - runtime.KeepAlive(actions) - runtime.KeepAlive(preferred) + C.gdk_draw_context_begin_frame(_arg0, _arg1) + runtime.KeepAlive(context) + runtime.KeepAlive(region) } -// Event GdkEvents are immutable data structures, created by GDK to represent -// windowing system events. +// EndFrame ends a drawing operation started with +// gdk_draw_context_begin_frame(). // -// 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. +// This makes the drawing available on screen. See gdk.DrawContext.BeginFrame() +// for more details about drawing. // -// 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 -} +// 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 -func (event *Event) baseEvent() *Event { - return event -} + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) -// BaseEvent returns the underlying base object. -func BaseEvent(obj Eventer) *Event { - return obj.baseEvent() + C.gdk_draw_context_end_frame(_arg0) + runtime.KeepAlive(context) } -// Axes extracts all axis values from an event. +// Display retrieves the GdkDisplay the context is created for. // // 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 +// - display (optional): GdkDisplay. +func (context *DrawContext) Display() *Display { + var _arg0 *C.GdkDrawContext // out + var _cret *C.GdkDisplay // in - _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) - _cret = C.gdk_event_get_axes(_arg0, &_arg1, &_arg2) - runtime.KeepAlive(event) + _cret = C.gdk_draw_context_get_display(_arg0) + runtime.KeepAlive(context) - var _axes []float64 // out - var _ok bool // out + var _display *Display // out - _axes = make([]float64, _arg2) - copy(_axes, unsafe.Slice((*float64)(unsafe.Pointer(_arg1)), _arg2)) - if _cret != 0 { - _ok = true + if _cret != nil { + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) } - return _axes, _ok + return _display } -// Axis: extract the axis value for a particular axis use from an event -// structure. +// FrameRegion retrieves the region that is currently being repainted. // -// The function takes the following parameters: +// 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. // -// - axisUse axis use to look for. +// 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: // -// - 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 +// - region (optional): cairo region. +func (context *DrawContext) FrameRegion() *cairo.Region { + var _arg0 *C.GdkDrawContext // out + var _cret *C.cairo_region_t // in - _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) - _arg1 = C.GdkAxisUse(axisUse) + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) - _cret = C.gdk_event_get_axis(_arg0, _arg1, &_arg2) - runtime.KeepAlive(event) - runtime.KeepAlive(axisUse) + _cret = C.gdk_draw_context_get_frame_region(_arg0) + runtime.KeepAlive(context) - var _value float64 // out - var _ok bool // out + var _region *cairo.Region // out - _value = float64(_arg2) - if _cret != 0 { - _ok = true + 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 _value, _ok + return _region } -// Device returns the device of an event. +// Surface retrieves the surface that context is bound to. // // The function returns the following values: // -// - device (optional): Device. -func (event *Event) Device() Devicer { - var _arg0 *C.GdkEvent // out - var _cret *C.GdkDevice // in +// - surface (optional): GdkSurface. +func (context *DrawContext) Surface() Surfacer { + var _arg0 *C.GdkDrawContext // out + var _cret *C.GdkSurface // in - _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) - _cret = C.gdk_event_get_device(_arg0) - runtime.KeepAlive(event) + _cret = C.gdk_draw_context_get_surface(_arg0) + runtime.KeepAlive(context) - var _device Devicer // out + var _surface Surfacer // out if _cret != nil { { @@ -12356,249 +12505,231 @@ func (event *Event) Device() Devicer { object := coreglib.Take(objptr) casted := object.WalkCast(func(obj coreglib.Objector) bool { - _, ok := obj.(Devicer) + _, ok := obj.(Surfacer) return ok }) - rv, ok := casted.(Devicer) + rv, ok := casted.(Surfacer) if !ok { - panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Devicer") + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") } - _device = rv + _surface = rv } } - return _device + return _surface } -// 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. +// IsInFrame returns TRUE if context is in the process of drawing to its +// surface. // -// Note: the GdkDeviceTool will be constant during the application -// lifetime, if settings must be stored persistently across runs, see -// gdk.DeviceTool.GetSerial(). +// 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: // -// - deviceTool (optional): current device tool, or NULL. -func (event *Event) DeviceTool() *DeviceTool { - var _arg0 *C.GdkEvent // out - var _cret *C.GdkDeviceTool // in +// - 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.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg0 = (*C.GdkDrawContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) - _cret = C.gdk_event_get_device_tool(_arg0) - runtime.KeepAlive(event) + _cret = C.gdk_draw_context_is_in_frame(_arg0) + runtime.KeepAlive(context) - var _deviceTool *DeviceTool // out + var _ok bool // out - if _cret != nil { - _deviceTool = wrapDeviceTool(coreglib.Take(unsafe.Pointer(_cret))) + if _cret != 0 { + _ok = true } - return _deviceTool + return _ok } -// Display retrieves the display associated to the event. +// Drop: GdkDrop object represents the target of an ongoing DND operation. // -// The function returns the following values: +// 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(). // -// - display (optional): Display. -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 +// 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 } -// EventSequence retuns 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: +var ( + _ coreglib.Objector = (*Drop)(nil) +) + +// Dropper describes types inherited from class Drop. // -// - eventSequence: event sequence that the event belongs to. -func (event *Event) EventSequence() *EventSequence { - var _arg0 *C.GdkEvent // out - var _cret *C.GdkEventSequence // in +// To get the original type, the caller must assert this to an interface or +// another type. +type Dropper interface { + coreglib.Objector + baseDrop() *Drop +} - _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) +var _ Dropper = (*Drop)(nil) - _cret = C.gdk_event_get_event_sequence(_arg0) - runtime.KeepAlive(event) +func wrapDrop(obj *coreglib.Object) *Drop { + return &Drop{ + Object: obj, + } +} - var _eventSequence *EventSequence // out +func marshalDrop(p uintptr) (interface{}, error) { + return wrapDrop(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +} - _eventSequence = (*EventSequence)(gextras.NewStructNative(unsafe.Pointer(_cret))) +func (self *Drop) baseDrop() *Drop { + return self +} - return _eventSequence +// BaseDrop returns the underlying base object. +func BaseDrop(obj Dropper) *Drop { + return obj.baseDrop() } -// EventType retrieves the type of the event. +// Finish ends the drag operation after a drop. // -// The function returns the following values: +// The action must be a single action selected from the actions available via +// gdk.Drop.GetActions(). // -// - 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 +// 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 - _eventType = EventType(_cret) + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GdkDragAction(action) - return _eventType + C.gdk_drop_finish(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(action) } -// History retrieves the history of the device that event is for, as a list of -// time and coordinates. +// Actions returns the possible actions for this GdkDrop. // -// The history includes positions that are not delivered as separate events to -// the application because they occurred in the same frame as event. +// 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. // -// Note that only motion and scroll events record history, and motion events do -// it only if one of the mouse buttons is down. +// 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: // -// - 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 +// - dragAction: possible GdkDragActions. +func (self *Drop) Actions() DragAction { + var _arg0 *C.GdkDrop // out + var _cret C.GdkDragAction // in - _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_event_get_history(_arg0, &_arg1) - runtime.KeepAlive(event) + _cret = C.gdk_drop_get_actions(_arg0) + runtime.KeepAlive(self) - var _timeCoords []TimeCoord // out + var _dragAction DragAction // 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])))) - } - } - } + _dragAction = DragAction(_cret) - return _timeCoords + return _dragAction } -// ModifierState returns the modifier state field of an event. +// Device returns the GdkDevice performing the drop. // // 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 -} +// - device: GdkDevice performing the drop. +func (self *Drop) Device() Devicer { + var _arg0 *C.GdkDrop // out + var _cret *C.GdkDevice // in -// 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.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _cret = C.gdk_drop_get_device(_arg0) + runtime.KeepAlive(self) - _cret = C.gdk_event_get_pointer_emulated(_arg0) - runtime.KeepAlive(event) + var _device Devicer // out - var _ok bool // out + { + objptr := unsafe.Pointer(_cret) + if objptr == nil { + panic("object of type gdk.Devicer is nil") + } - if _cret != 0 { - _ok = true + 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 _ok + return _device } -// Position: extract the event surface relative x/y coordinates from an event. +// Display gets the GdkDisplay that self was created for. // // 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 +// - display: GdkDisplay. +func (self *Drop) Display() *Display { + var _arg0 *C.GdkDrop // out + var _cret *C.GdkDisplay // in - _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_event_get_position(_arg0, &_arg1, &_arg2) - runtime.KeepAlive(event) + _cret = C.gdk_drop_get_display(_arg0) + runtime.KeepAlive(self) - var _x float64 // out - var _y float64 // out - var _ok bool // out + var _display *Display // out - _x = float64(_arg1) - _y = float64(_arg2) - if _cret != 0 { - _ok = true - } + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) - return _x, _y, _ok + return _display } -// Seat returns the seat that originated the event. +// 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: // -// - seat (optional): Seat. -func (event *Event) Seat() Seater { - var _arg0 *C.GdkEvent // out - var _cret *C.GdkSeat // in +// - drag (optional): corresponding GdkDrag. +func (self *Drop) Drag() Dragger { + var _arg0 *C.GdkDrop // out + var _cret *C.GdkDrag // in - _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_event_get_seat(_arg0) - runtime.KeepAlive(event) + _cret = C.gdk_drop_get_drag(_arg0) + runtime.KeepAlive(self) - var _seat Seater // out + var _drag Dragger // out if _cret != nil { { @@ -12606,33 +12737,62 @@ func (event *Event) Seat() Seater { object := coreglib.Take(objptr) casted := object.WalkCast(func(obj coreglib.Objector) bool { - _, ok := obj.(Seater) + _, ok := obj.(Dragger) return ok }) - rv, ok := casted.(Seater) + rv, ok := casted.(Dragger) if !ok { - panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Seater") + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Dragger") } - _seat = rv + _drag = rv } } - return _seat + return _drag } -// Surface extracts the surface associated with an event. +// Formats returns the GdkContentFormats that the drop offers the data to be +// read in. // // The function returns the following values: // -// - surface associated with the event. -func (event *Event) Surface() Surfacer { - var _arg0 *C.GdkEvent // out +// - 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.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_event_get_surface(_arg0) - runtime.KeepAlive(event) + _cret = C.gdk_drop_get_surface(_arg0) + runtime.KeepAlive(self) var _surface Surfacer // out @@ -12657,610 +12817,1888 @@ func (event *Event) Surface() Surfacer { return _surface } -// Time returns the timestamp of event. +// ReadFinish finishes an async drop read operation. // -// Not all events have timestamps. In that case, this function returns -// GDK_CURRENT_TIME. +// 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: // -// - guint32: timestamp field from event. -func (event *Event) Time() uint32 { - var _arg0 *C.GdkEvent // out - var _cret C.guint32 // in +// - 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.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) - _cret = C.gdk_event_get_time(_arg0) - runtime.KeepAlive(event) + _cret = C.gdk_drop_read_finish(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) - var _guint32 uint32 // out + var _outMimeType string // out + var _inputStream gio.InputStreamer // out + var _goerr error // out - _guint32 = uint32(_cret) + _outMimeType = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) - return _guint32 + 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 } -// TriggersContextMenu returns whether a GdkEvent should trigger a context menu, -// according to platform conventions. +// ReadValueFinish finishes an async drop read. // -// The right mouse button typically triggers context menus. +// See gdk.Drop.ReadValueAsync(). // -// This function should always be used instead of simply checking for -// event->button == GDK_BUTTON_SECONDARY. +// The function takes the following parameters: +// +// - result: GAsyncResult. // // 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 +// - 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.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg0 = (*C.GdkDrop)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) - _cret = C.gdk_event_triggers_context_menu(_arg0) - runtime.KeepAlive(event) + _cret = C.gdk_drop_read_value_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(self) + runtime.KeepAlive(result) - var _ok bool // out + var _value *coreglib.Value // out + var _goerr error // out - if _cret != 0 { - _ok = true + _value = coreglib.ValueFromNative(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _ok + return _value, _goerr } -// FocusEvent: event related to a keyboard focus change. -type FocusEvent struct { +// 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 - Event + *coreglib.Object } var ( - _ Eventer = (*FocusEvent)(nil) + _ coreglib.Objector = (*Event)(nil) ) -func wrapFocusEvent(obj *coreglib.Object) *FocusEvent { - return &FocusEvent{ - Event: Event{ - Object: obj, - }, +// 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 marshalFocusEvent(p uintptr) (interface{}, error) { - return wrapFocusEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +func marshalEvent(p uintptr) (interface{}, error) { + return wrapEvent(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// In extracts whether this event is about focus entering or leaving the -// surface. +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: // -// - ok: TRUE of the focus is entering. -func (event *FocusEvent) In() bool { +// - 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_focus_event_get_in(_arg0) + _cret = C.gdk_event_get_axes(_arg0, &_arg1, &_arg2) runtime.KeepAlive(event) - var _ok bool // out + 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 _ok + return _axes, _ok } -// FrameClock: GdkFrameClock tells the application when to update and repaint a -// surface. +// Axis: extract the axis value for a particular axis use from an event +// structure. // -// 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). +// To find out which axes are used, use gdk.DeviceTool.GetAxes() on the device +// tool returned by gdk.Event.GetDeviceTool(). // -// The frame clock can also automatically stop painting when it knows the frames -// will not be visible, or scale back animation framerates. +// The function takes the following parameters: // -// GdkFrameClock is designed to be compatible with an OpenGL-based -// implementation or with mozRequestAnimationFrame in Firefox, for example. +// - axisUse axis use to look for. // -// 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 gdkframeclock::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 function returns the following values: // -// 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 gdkframeclock::update -// signal of the clock, they will stay exactly synchronized. -type FrameClock struct { - _ [0]func() // equal guard - *coreglib.Object -} +// - 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 -var ( - _ coreglib.Objector = (*FrameClock)(nil) -) + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) + _arg1 = C.GdkAxisUse(axisUse) -// 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 -} + _cret = C.gdk_event_get_axis(_arg0, _arg1, &_arg2) + runtime.KeepAlive(event) + runtime.KeepAlive(axisUse) -var _ FrameClocker = (*FrameClock)(nil) + var _value float64 // out + var _ok bool // out -func wrapFrameClock(obj *coreglib.Object) *FrameClock { - return &FrameClock{ - Object: obj, + _value = float64(_arg2) + if _cret != 0 { + _ok = true } -} -func marshalFrameClock(p uintptr) (interface{}, error) { - return wrapFrameClock(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil + return _value, _ok } -func (frameClock *FrameClock) baseFrameClock() *FrameClock { - return frameClock -} +// 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 -// BaseFrameClock returns the underlying base object. -func BaseFrameClock(obj FrameClocker) *FrameClock { - return obj.baseFrameClock() -} + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) -// 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) -} + _cret = C.gdk_event_get_device(_arg0) + runtime.KeepAlive(event) -// 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) -} + var _device Devicer // out -// 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) -} + if _cret != nil { + { + objptr := unsafe.Pointer(_cret) -// 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) -} + 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 + } + } -// 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 gtk.Widget::snapshot -// 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) + return _device } -// ConnectResumeEvents is emitted after processing of the frame is finished. +// DeviceTool returns a GdkDeviceTool representing the tool that caused the +// event. // -// 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. +// If the was not generated by a device that supports different tools (such as a +// tablet), this function will return NULL. // -// Animations should be updated using gdk.FrameClock.GetFrameTime(). -// Applications can connect directly to this signal, or use -// gtk.Widget.AddTickCallback() 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. +// Note: the GdkDeviceTool will be constant during the application +// lifetime, if settings must be stored persistently across runs, see +// gdk.DeviceTool.GetSerial(). // -// 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 +// 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.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) - C.gdk_frame_clock_begin_updating(_arg0) - runtime.KeepAlive(frameClock) -} + _cret = C.gdk_event_get_device_tool(_arg0) + runtime.KeepAlive(event) -// EndUpdating stops updates for an animation. -// -// See the documentation for gdk.FrameClock.BeginUpdating(). -func (frameClock *FrameClock) EndUpdating() { - var _arg0 *C.GdkFrameClock // out + var _deviceTool *DeviceTool // out - _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + if _cret != nil { + _deviceTool = wrapDeviceTool(coreglib.Take(unsafe.Pointer(_cret))) + } - C.gdk_frame_clock_end_updating(_arg0) - runtime.KeepAlive(frameClock) + return _deviceTool } -// CurrentTimings gets the frame timings for the current frame. +// Display retrieves the display associated to the event. // // 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 +// - display (optional): GdkDisplay. +func (event *Event) Display() *Display { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkDisplay // in - _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) - _cret = C.gdk_frame_clock_get_current_timings(_arg0) - runtime.KeepAlive(frameClock) + _cret = C.gdk_event_get_display(_arg0) + runtime.KeepAlive(event) - var _frameTimings *FrameTimings // out + var _display *Display // 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)) - }, - ) + _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) } - return _frameTimings + return _display } -// FPS calculates the current frames-per-second, based on the frame timings of -// frame_clock. +// 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: // -// - gdouble: current fps, as a double. -func (frameClock *FrameClock) FPS() float64 { - var _arg0 *C.GdkFrameClock // out - var _cret C.double // in +// - 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.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) - _cret = C.gdk_frame_clock_get_fps(_arg0) - runtime.KeepAlive(frameClock) + _cret = C.gdk_event_get_event_sequence(_arg0) + runtime.KeepAlive(event) - var _gdouble float64 // out + var _eventSequence *EventSequence // out - _gdouble = float64(_cret) + _eventSequence = (*EventSequence)(gextras.NewStructNative(unsafe.Pointer(_cret))) - return _gdouble + return _eventSequence } -// FrameCounter: GdkFrameClock maintains a 64-bit counter that increments for -// each frame drawn. +// EventType retrieves the type of the event. // // 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 +// - eventType: GdkEventType. +func (event *Event) EventType() EventType { + var _arg0 *C.GdkEvent // out + var _cret C.GdkEventType // in - _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) - _cret = C.gdk_frame_clock_get_frame_counter(_arg0) - runtime.KeepAlive(frameClock) + _cret = C.gdk_event_get_event_type(_arg0) + runtime.KeepAlive(event) - var _gint64 int64 // out + var _eventType EventType // out - _gint64 = int64(_cret) + _eventType = EventType(_cret) - return _gint64 + return _eventType } -// FrameTime gets the time that should currently be used for animations. +// History retrieves the history of the device that event is for, as a list of +// time and coordinates. // -// 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 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: // -// - 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 +// - 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.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) - _cret = C.gdk_frame_clock_get_frame_time(_arg0) - runtime.KeepAlive(frameClock) + _cret = C.gdk_event_get_history(_arg0, &_arg1) + runtime.KeepAlive(event) - var _gint64 int64 // out + var _timeCoords []TimeCoord // out - _gint64 = int64(_cret) + 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 _gint64 + return _timeCoords } -// 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. +// ModifierState returns the modifier state field of an event. // // 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 +// - modifierType: modifier state of event. +func (event *Event) ModifierState() ModifierType { + var _arg0 *C.GdkEvent // out + var _cret C.GdkModifierType // in - _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) - _cret = C.gdk_frame_clock_get_history_start(_arg0) - runtime.KeepAlive(frameClock) + _cret = C.gdk_event_get_modifier_state(_arg0) + runtime.KeepAlive(event) - var _gint64 int64 // out + var _modifierType ModifierType // out - _gint64 = int64(_cret) + _modifierType = ModifierType(_cret) - return _gint64 + return _modifierType } -// RefreshInfo predicts a presentation time, based on history. +// PointerEmulated returns whether this event is an 'emulated' pointer event. // -// 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. +// Emulated pointer events typically originate from a touch events. // -// The function takes the following parameters: +// The function returns the following values: // -// - baseTime: base time for determining a presentaton time. +// - 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: // -// - 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 +// - 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.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) - _arg1 = C.gint64(baseTime) + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) - C.gdk_frame_clock_get_refresh_info(_arg0, _arg1, &_arg2, &_arg3) - runtime.KeepAlive(frameClock) - runtime.KeepAlive(baseTime) + _cret = C.gdk_event_get_position(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(event) - var _refreshIntervalReturn int64 // out - var _presentationTimeReturn int64 // out + var _x float64 // out + var _y float64 // out + var _ok bool // out - _refreshIntervalReturn = int64(_arg2) - _presentationTimeReturn = int64(_arg3) + _x = float64(_arg1) + _y = float64(_arg2) + if _cret != 0 { + _ok = true + } - return _refreshIntervalReturn, _presentationTimeReturn + return _x, _y, _ok } -// 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(). +// Seat returns the seat that originated the event. // -// The function takes the following parameters: +// The function returns the following values: // -// - frameCounter: frame counter value identifying the frame to be received. +// - 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: // -// - frameTimings (optional): GdkFrameTimings object for the specified frame, -// or NULL if it is not available. See gdk.FrameClock.GetHistoryStart(). -func (frameClock *FrameClock) Timings(frameCounter int64) *FrameTimings { - var _arg0 *C.GdkFrameClock // out - var _arg1 C.gint64 // out - var _cret *C.GdkFrameTimings // in +// - surface (optional): GdkSurface associated with the event. +func (event *Event) Surface() Surfacer { + var _arg0 *C.GdkEvent // out + var _cret *C.GdkSurface // in - _arg0 = (*C.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) - _arg1 = C.gint64(frameCounter) + _arg0 = (*C.GdkEvent)(unsafe.Pointer(coreglib.InternObject(event).Native())) - _cret = C.gdk_frame_clock_get_timings(_arg0, _arg1) - runtime.KeepAlive(frameClock) - runtime.KeepAlive(frameCounter) + _cret = C.gdk_event_get_surface(_arg0) + runtime.KeepAlive(event) - var _frameTimings *FrameTimings // out + var _surface Surfacer // 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)) - }, - ) + { + 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 _frameTimings + 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 } -// 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: +// Release releases the GL resources held by a GdkGLTexture. // -// - phase that is requested. -func (frameClock *FrameClock) RequestPhase(phase FrameClockPhase) { - var _arg0 *C.GdkFrameClock // out - var _arg1 C.GdkFrameClockPhase // out +// 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.GdkFrameClock)(unsafe.Pointer(coreglib.InternObject(frameClock).Native())) - _arg1 = C.GdkFrameClockPhase(phase) + _arg0 = (*C.GdkGLTexture)(unsafe.Pointer(coreglib.InternObject(self).Native())) - C.gdk_frame_clock_request_phase(_arg0, _arg1) - runtime.KeepAlive(frameClock) - runtime.KeepAlive(phase) + C.gdk_gl_texture_release(_arg0) + runtime.KeepAlive(self) } -// 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 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); +// GLTextureBuilder: GdkGLTextureBuilder is a builder used to construct +// gdk.Texture objects from GL textures. // -// You can now perform your drawing using OpenGL commands. +// 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. // -// 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 { +// 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 - DrawContext + *coreglib.Object } var ( - _ DrawContexter = (*GLContext)(nil) + _ coreglib.Objector = (*GLTextureBuilder)(nil) ) -// GLContexter describes types inherited from class GLContext. +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. // -// To get the original type, the caller must assert this to an interface or -// another type. -type GLContexter interface { - coreglib.Objector - baseGLContext() *GLContext +// 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 } -var _ GLContexter = (*GLContext)(nil) +// 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 -func wrapGLContext(obj *coreglib.Object) *GLContext { - return &GLContext{ - DrawContext: DrawContext{ - Object: obj, - }, + _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 + } } -} -func marshalGLContext(p uintptr) (interface{}, error) { - return wrapGLContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil + return _glContext } -func (context *GLContext) baseGLContext() *GLContext { - return context -} +// 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 -// BaseGLContext returns the underlying base object. -func BaseGLContext(obj GLContexter) *GLContext { - return obj.baseGLContext() + _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 } -// DebugEnabled retrieves whether the context is doing extra validations and -// runtime checking. -// -// See gdk.GLContext.SetDebugEnabled(). +// HasMipmap gets whether the texture has a mipmap. // // 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 +// - ok: whether the texture has a mipmap. +func (self *GLTextureBuilder) HasMipmap() bool { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.gboolean // in - _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_gl_context_get_debug_enabled(_arg0) - runtime.KeepAlive(context) + _cret = C.gdk_gl_texture_builder_get_has_mipmap(_arg0) + runtime.KeepAlive(self) var _ok bool // out @@ -13271,132 +14709,118 @@ func (context *GLContext) DebugEnabled() bool { return _ok } -// Display retrieves the display the context is created for. +// 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: // -// - display (optional): GdkDisplay or NULL. -func (context *GLContext) Display() *Display { - var _arg0 *C.GdkGLContext // out - var _cret *C.GdkDisplay // in +// - gint: height. +func (self *GLTextureBuilder) Height() int { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.int // in - _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_gl_context_get_display(_arg0) - runtime.KeepAlive(context) + _cret = C.gdk_gl_texture_builder_get_height(_arg0) + runtime.KeepAlive(self) - var _display *Display // out + var _gint int // out - if _cret != nil { - _display = wrapDisplay(coreglib.Take(unsafe.Pointer(_cret))) - } + _gint = int(_cret) - return _display + return _gint } -// ForwardCompatible retrieves whether the context is forward-compatible. -// -// See gdk.GLContext.SetForwardCompatible(). +// 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: // -// - ok: TRUE if the context should be forward-compatible. -func (context *GLContext) ForwardCompatible() bool { - var _arg0 *C.GdkGLContext // out - var _cret C.gboolean // in +// - guint: id. +func (self *GLTextureBuilder) ID() uint { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.guint // in - _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_gl_context_get_forward_compatible(_arg0) - runtime.KeepAlive(context) + _cret = C.gdk_gl_texture_builder_get_id(_arg0) + runtime.KeepAlive(self) - var _ok bool // out + var _guint uint // out - if _cret != 0 { - _ok = true - } + _guint = uint(_cret) - return _ok + return _guint } -// RequiredVersion retrieves required OpenGL version. -// -// See gdk.GLContext.SetRequiredVersion(). +// Sync gets the GLsync previously set via gdk_gl_texture_builder_set_sync(). // // 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 +// - gpointer (optional): GLSync. +func (self *GLTextureBuilder) Sync() unsafe.Pointer { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.gpointer // in - _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - C.gdk_gl_context_get_required_version(_arg0, &_arg1, &_arg2) - runtime.KeepAlive(context) + _cret = C.gdk_gl_texture_builder_get_sync(_arg0) + runtime.KeepAlive(self) - var _major int // out - var _minor int // out + var _gpointer unsafe.Pointer // out - _major = int(_arg1) - _minor = int(_arg2) + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) - return _major, _minor + return _gpointer } -// SharedContext retrieves the GdkGLContext that this context share data with. +// 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: // -// - glContext (optional): GdkGLContext or NULL. -func (context *GLContext) SharedContext() GLContexter { - var _arg0 *C.GdkGLContext // out - var _cret *C.GdkGLContext // in +// - region (optional): region. +func (self *GLTextureBuilder) UpdateRegion() *cairo.Region { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret *C.cairo_region_t // in - _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_gl_context_get_shared_context(_arg0) - runtime.KeepAlive(context) + _cret = C.gdk_gl_texture_builder_get_update_region(_arg0) + runtime.KeepAlive(self) - var _glContext GLContexter // out + var _region *cairo.Region // 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 + _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 _glContext + return _region } -// Surface retrieves the surface used by the context. +// 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: // -// - surface (optional): GdkSurface or NULL. -func (context *GLContext) Surface() Surfacer { - var _arg0 *C.GdkGLContext // out - var _cret *C.GdkSurface // in +// - texture (optional): texture. +func (self *GLTextureBuilder) UpdateTexture() Texturer { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret *C.GdkTexture // in - _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_gl_context_get_surface(_arg0) - runtime.KeepAlive(context) + _cret = C.gdk_gl_texture_builder_get_update_texture(_arg0) + runtime.KeepAlive(self) - var _surface Surfacer // out + var _texture Texturer // out if _cret != nil { { @@ -13404,324 +14828,251 @@ func (context *GLContext) Surface() Surfacer { object := coreglib.Take(objptr) casted := object.WalkCast(func(obj coreglib.Objector) bool { - _, ok := obj.(Surfacer) + _, ok := obj.(Texturer) return ok }) - rv, ok := casted.(Surfacer) + rv, ok := casted.(Texturer) if !ok { - panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Texturer") } - _surface = rv + _texture = rv } } - return _surface + return _texture } -// UseES checks whether the context is using an OpenGL or OpenGL ES profile. +// 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: // -// - ok: TRUE if the GdkGLContext is using an OpenGL ES profile. -func (context *GLContext) UseES() bool { - var _arg0 *C.GdkGLContext // out - var _cret C.gboolean // in +// - gint: width. +func (self *GLTextureBuilder) Width() int { + var _arg0 *C.GdkGLTextureBuilder // out + var _cret C.int // in - _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) - _cret = C.gdk_gl_context_get_use_es(_arg0) - runtime.KeepAlive(context) + _cret = C.gdk_gl_texture_builder_get_width(_arg0) + runtime.KeepAlive(self) - var _ok bool // out + var _gint int // out - if _cret != 0 { - _ok = true - } + _gint = int(_cret) - return _ok + return _gint } -// Version retrieves the OpenGL version of the context. +// SetContext sets the context to be used for the texture. This is the context +// that owns the texture. // -// The context must be realized prior to calling this function. +// The context must be set before calling gdk.GLTextureBuilder.Build(). // -// The function returns the following values: +// The function takes the following parameters: // -// - 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 +// - 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.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if context != nil { + _arg1 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) + } - C.gdk_gl_context_get_version(_arg0, &_arg1, &_arg2) + C.gdk_gl_texture_builder_set_context(_arg0, _arg1) + runtime.KeepAlive(self) 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. +// SetFormat sets the format of the texture. The default is +// GDK_MEMORY_R8G8B8A8_PREMULTIPLIED. // -// 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. +// 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. // -// 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. +// 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. // -// 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. +// 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. // -// The function returns the following values: +// Non-RGBA textures need to have swizzling parameters set up properly to be +// usable in GSK's shaders. // -// - 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 -} - -// 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. +// The function takes the following parameters: // -// 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 +// - format texture's format. +func (self *GLTextureBuilder) SetFormat(format MemoryFormat) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 C.GdkMemoryFormat // out - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.GdkMemoryFormat(format) - return _goerr + C.gdk_gl_texture_builder_set_format(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(format) } -// SetDebugEnabled sets whether the GdkGLContext should perform extra -// validations and runtime checking. -// -// This is useful during development, but has additional overhead. +// 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. // -// The GdkGLContext must not be realized or made current prior to calling this -// function. +// Typically, the glGenerateMipmap function is used to generate a mimap. // // 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 +// - 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.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) - if enabled { + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if hasMipmap { _arg1 = C.TRUE } - C.gdk_gl_context_set_debug_enabled(_arg0, _arg1) - runtime.KeepAlive(context) - runtime.KeepAlive(enabled) + C.gdk_gl_texture_builder_set_has_mipmap(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(hasMipmap) } -// 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. +// SetHeight sets the height of the texture. // -// The GdkGLContext must not be realized or made current prior to calling this -// function. +// The height must be set before calling gdk.GLTextureBuilder.Build(). // // 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 +// - 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.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) - if compatible { - _arg1 = C.TRUE - } + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.int(height) - C.gdk_gl_context_set_forward_compatible(_arg0, _arg1) - runtime.KeepAlive(context) - runtime.KeepAlive(compatible) + C.gdk_gl_texture_builder_set_height(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(height) } -// SetRequiredVersion sets the major and minor version of OpenGL to request. -// -// Setting major and minor to zero will use the default values. +// 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 GdkGLContext must not be realized or made current prior to calling this -// function. +// The id must be set before calling gdk.GLTextureBuilder.Build(). // // 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 +// - 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.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) - _arg1 = C.int(major) - _arg2 = C.int(minor) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.guint(id) - C.gdk_gl_context_set_required_version(_arg0, _arg1, _arg2) - runtime.KeepAlive(context) - runtime.KeepAlive(major) - runtime.KeepAlive(minor) + C.gdk_gl_texture_builder_set_id(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(id) } -// 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. +// SetSync sets the GLSync object to use for the texture. // -// By default, GDK will attempt to automatically detect whether the underlying -// GL implementation is OpenGL or OpenGL ES once the context is realized. +// GTK will wait on this object before using the created GdkTexture. // -// 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 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: // -// - 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 +// - sync (optional): GLSync object. +func (self *GLTextureBuilder) SetSync(sync unsafe.Pointer) { + var _arg0 *C.GdkGLTextureBuilder // out + var _arg1 C.gpointer // out - _arg0 = (*C.GdkGLContext)(unsafe.Pointer(coreglib.InternObject(context).Native())) - _arg1 = C.int(useEs) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = (C.gpointer)(unsafe.Pointer(sync)) - C.gdk_gl_context_set_use_es(_arg0, _arg1) - runtime.KeepAlive(context) - runtime.KeepAlive(useEs) + C.gdk_gl_texture_builder_set_sync(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(sync) } -// GLContextClearCurrent clears the current GdkGLContext. +// SetUpdateRegion sets the region to be updated by this texture. Together with +// gdk.GLTextureBuilder:update-texture this describes an update of a previous +// texture. // -// 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. +// 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. // -// The function returns the following values: +// An example would be a screen recording where only the mouse pointer moves. // -// - glContext (optional): current GdkGLContext, or NULL. -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) +// 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 - 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 - } + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if region != nil { + _arg1 = (*C.cairo_region_t)(unsafe.Pointer(region.Native())) } - return _glContext -} - -// GLTexture: gdkTexture representing a GL texture object. -type GLTexture struct { - _ [0]func() // equal guard - Texture + C.gdk_gl_texture_builder_set_update_region(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(region) } -var ( - _ Texturer = (*GLTexture)(nil) -) +// 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 -func wrapGLTexture(obj *coreglib.Object) *GLTexture { - return &GLTexture{ - Texture: Texture{ - Object: obj, - Paintable: Paintable{ - Object: obj, - }, - }, + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + if texture != nil { + _arg1 = (*C.GdkTexture)(unsafe.Pointer(coreglib.InternObject(texture).Native())) } -} -func marshalGLTexture(p uintptr) (interface{}, error) { - return wrapGLTexture(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil + C.gdk_gl_texture_builder_set_update_texture(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(texture) } -// Release releases the GL resources held by a GdkGLTexture. +// SetWidth sets the width of the texture. // -// 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 +// 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.GdkGLTexture)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg0 = (*C.GdkGLTextureBuilder)(unsafe.Pointer(coreglib.InternObject(self).Native())) + _arg1 = C.int(width) - C.gdk_gl_texture_release(_arg0) + C.gdk_gl_texture_builder_set_width(_arg0, _arg1) runtime.KeepAlive(self) + runtime.KeepAlive(width) } // GrabBrokenEvent: event related to a broken windowing system grab. @@ -14045,6 +15396,11 @@ func wrapMemoryTexture(obj *coreglib.Object) *MemoryTexture { Paintable: Paintable{ Object: obj, }, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, }, } } @@ -14055,7 +15411,7 @@ func marshalMemoryTexture(p uintptr) (interface{}, error) { // NewMemoryTexture creates a new texture for a blob of image data. // -// The GBytes must contain stride x height pixels in the given format. +// The GBytes must contain stride × height pixels in the given format. // // The function takes the following parameters: // @@ -14129,6 +15485,10 @@ func (monitor *Monitor) ConnectInvalidate(f func()) coreglib.SignalHandle { // 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. @@ -14150,6 +15510,31 @@ func (monitor *Monitor) Connector() string { 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: @@ -14175,7 +15560,7 @@ func (monitor *Monitor) Display() *Display { // coordinate space. // // The returned geometry is in ”application pixels”, not in ”device pixels” (see -// gdk.Monitor.GetScaleFactor()). +// gdk.Monitor.GetScale()). // // The function returns the following values: // @@ -14226,7 +15611,7 @@ func (monitor *Monitor) HeightMm() int { // // The function returns the following values: // -// - utf8 (optional): name of the manufacturer, or NULL. +// - utf8 (optional): name of the manufacturer. func (monitor *Monitor) Manufacturer() string { var _arg0 *C.GdkMonitor // out var _cret *C.char // in @@ -14249,7 +15634,7 @@ func (monitor *Monitor) Manufacturer() string { // // The function returns the following values: // -// - utf8 (optional): monitor model, or NULL. +// - utf8 (optional): monitor model. func (monitor *Monitor) Model() string { var _arg0 *C.GdkMonitor // out var _cret *C.char // in @@ -14291,6 +15676,32 @@ func (monitor *Monitor) RefreshRate() int { 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. // @@ -14552,6 +15963,8 @@ func marshalScrollEvent(p uintptr) (interface{}, error) { // // 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. @@ -14596,6 +16009,30 @@ func (event *ScrollEvent) Direction() ScrollDirection { 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 @@ -14682,7 +16119,7 @@ func (seat *Seat) ConnectDeviceRemoved(f func(device Devicer)) coreglib.SignalHa // 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 [signalGdkDevice::tool-changed] signal accordingly. +// 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 { @@ -14891,7 +16328,8 @@ func (seat *Seat) Tools() []*DeviceTool { // Snapshot: base type for snapshot operations. // -// The subclass of GdkSnapshot used by GTK is gtk.Snapshot. +// The subclass of GdkSnapshot used by GTK is GtkSnapshot +// (../gtk4/class.Snapshot.html). type Snapshot struct { _ [0]func() // equal guard *coreglib.Object @@ -14934,7 +16372,7 @@ func BaseSnapshot(obj Snapshotter) *Snapshot { // Surface: GdkSurface is a rectangular region on the screen. // // It’s a low-level object, used to implement high-level objects such as -// gtk.Window or gtk.Dialog in GTK. +// 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 @@ -15128,7 +16566,7 @@ func (surface *Surface) CreateCairoContext() CairoContexter { // // The function returns the following values: // -// - glContext: newly created GdkGLContext, or NULL on error. +// - glContext: newly created GdkGLContext. func (surface *Surface) CreateGLContext() (GLContexter, error) { var _arg0 *C.GdkSurface // out var _cret *C.GdkGLContext // in @@ -15181,6 +16619,8 @@ func (surface *Surface) CreateGLContext() (GLContexter, error) { // 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. @@ -15219,13 +16659,14 @@ func (surface *Surface) CreateSimilarSurface(content cairo.Content, width, heigh return _ret } -// CreateVulkanContext creates a new GdkVulkanContext for rendering on surface. +// CreateVulkanContext sets an error and returns NULL. // -// If the creation of the GdkVulkanContext failed, error will be set. +// Deprecated: GTK does not expose any Vulkan internals. This function is a +// leftover that was accidentally exposed. // // The function returns the following values: // -// - vulkanContext: newly created GdkVulkanContext, or NULL on error. +// - vulkanContext: NULL. func (surface *Surface) CreateVulkanContext() (VulkanContexter, error) { var _arg0 *C.GdkSurface // out var _cret *C.GdkVulkanContext // in @@ -15286,11 +16727,11 @@ func (surface *Surface) Destroy() { // 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, or NULL. The returned object is owned -// by the GdkSurface and should not be unreferenced directly. Use -// gdk.Surface.SetCursor() to unset the cursor of the surface. +// - cursor (optional): GdkCursor. func (surface *Surface) Cursor() *Cursor { var _arg0 *C.GdkSurface // out var _cret *C.GdkCursor // in @@ -15315,15 +16756,15 @@ func (surface *Surface) Cursor() *Cursor { // 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, or NULL. The returned object is owned -// by the GdkSurface and should not be unreferenced directly. Use -// gdk.Surface.SetCursor() to unset the cursor of the surface. +// - cursor (optional): GdkCursor. func (surface *Surface) DeviceCursor(device Devicer) *Cursor { var _arg0 *C.GdkSurface // out var _arg1 *C.GdkDevice // out @@ -15356,9 +16797,9 @@ func (surface *Surface) DeviceCursor(device Devicer) *Cursor { // // The function returns the following values: // -// - x (optional): return locatio for the X coordinate of device, or NULL. -// - y (optional): return location for the Y coordinate of device, or NULL. -// - mask (optional): return location for the modifier mask, or NULL. +// - 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 @@ -15500,6 +16941,37 @@ func (surface *Surface) Mapped() bool { 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. // @@ -15510,7 +16982,7 @@ func (surface *Surface) Mapped() bool { // the scale value can be used to determine whether to use a pixel resource with // higher resolution data. // -// The scale of a surface may change during runtime. +// The scale factor may change during the lifetime of the surface. // // The function returns the following values: // @@ -15557,9 +17029,10 @@ func (surface *Surface) Width() int { // 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(). +// 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 @@ -15713,12 +17186,12 @@ func (surface *Surface) SetInputRegion(region *cairo.Region) { // // 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 WidgetClass.css_changed() -// handler. +// 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. +// - 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 @@ -15738,19 +17211,21 @@ func (surface *Surface) SetOpaqueRegion(region *cairo.Region) { // 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, -// or a Cairo surface, or other pixel data. +// 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 g_object_ref(). +// 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 ( @@ -15774,6 +17249,11 @@ func wrapTexture(obj *coreglib.Object) *Texture { Paintable: Paintable{ Object: obj, }, + LoadableIcon: gio.LoadableIcon{ + Icon: gio.Icon{ + Object: obj, + }, + }, } } @@ -15781,8 +17261,8 @@ func marshalTexture(p uintptr) (interface{}, error) { return wrapTexture(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -func (texture *Texture) baseTexture() *Texture { - return texture +func (self *Texture) baseTexture() *Texture { + return self } // BaseTexture returns the underlying base object. @@ -15792,6 +17272,10 @@ func BaseTexture(obj Texturer) *Texture { // 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. @@ -15815,20 +17299,63 @@ func NewTextureForPixbuf(pixbuf *gdkpixbuf.Pixbuf) *Texture { 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 and -// JPEG, though more formats might be available. +// 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 or NULL if an error occurred. +// - texture: newly-created GdkTexture. func NewTextureFromFile(file gio.Filer) (*Texture, error) { var _arg1 *C.GFile // out var _cret *C.GdkTexture // in @@ -15850,6 +17377,46 @@ func NewTextureFromFile(file gio.Filer) (*Texture, error) { 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. // @@ -15860,6 +17427,10 @@ func NewTextureFromFile(file gio.Filer) (*Texture, error) { // 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. @@ -15884,6 +17455,35 @@ func NewTextureFromResource(resourcePath string) *Texture { 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: @@ -15928,9 +17528,10 @@ func (texture *Texture) Width() int { // 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 GFile -// or other location, you might want to look into using the gdk-pixbuf library. +// 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: // @@ -15961,6 +17562,114 @@ func (texture *Texture) SaveToPNG(filename string) bool { 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 @@ -16146,7 +17855,7 @@ func (event *TouchpadEvent) PinchScale() float64 { // platform-specific Vulkan draw context. // // GdkVulkanContexts are created for a surface using -// gdk.Surface.CreateVulkanContext(), and the context will match the the +// gdk.Surface.CreateVulkanContext(), and the context will match the // characteristics of the surface. // // Support for GdkVulkanContext is platform-specific and context creation can @@ -16238,7 +17947,7 @@ func (v *VulkanContext) ConnectImagesUpdated(f func()) coreglib.SignalHandle { // // 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. +// The gdk.ContentFormatsBuilder structure is meant to help in this endeavor. // // An instance of this type is always passed by reference. type ContentFormats struct { @@ -16319,7 +18028,7 @@ func NewContentFormatsForGType(typ coreglib.Type) *ContentFormats { // // The function returns the following values: // -// - ok: TRUE if the #GType was found. +// - 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 @@ -16374,13 +18083,13 @@ func (formats *ContentFormats) ContainMIMEType(mimeType string) bool { // GTypes gets the GTypes included in formats. // -// Note that formats may not contain any #GTypes, in particular when they are +// 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 or NULL if none. +// formats. func (formats *ContentFormats) GTypes() []coreglib.Type { var _arg0 *C.GdkContentFormats // out var _cret *C.GType // in @@ -16414,7 +18123,7 @@ func (formats *ContentFormats) GTypes() []coreglib.Type { // The function returns the following values: // // - utf8s (optional): NULL-terminated array of interned strings of mime types -// included in formats or NULL if none. +// included in formats. func (formats *ContentFormats) MIMETypes() []string { var _arg0 *C.GdkContentFormats // out var _cret **C.char // in @@ -16535,6 +18244,8 @@ func (first *ContentFormats) MatchMIMEType(second *ContentFormats) string { // 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. // @@ -16705,6 +18416,46 @@ func (formats *ContentFormats) UnionSerializeMIMETypes() *ContentFormats { 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. // @@ -16829,7 +18580,7 @@ func (builder *ContentFormatsBuilder) ToFormats() *ContentFormats { return _contentFormats } -// ContentProviderClass class structure for ContentProvider. +// ContentProviderClass class structure for GdkContentProvider. // // An instance of this type is always passed by reference. type ContentProviderClass struct { @@ -16841,6 +18592,166 @@ 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. // @@ -16859,6 +18770,118 @@ func marshalEventSequence(p uintptr) (interface{}, error) { 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. // @@ -17140,12 +19163,12 @@ func (k *KeymapKey) SetLevel(level int) { // PaintableInterface: list of functions that can be implemented for the // GdkPaintable interface. // -// Note that apart from the PaintableInterface.snapshot() function, no virtual +// 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 PaintableInterface.get_current_image() for non-static -// paintables and PaintableInterface.get_flags() if the image is not dynamic -// as the default implementation returns no flags and that will make the -// implementation likely quite slow. +// 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 { @@ -17184,10 +19207,11 @@ type paintableInterface struct { // 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, gtk.Popover 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. +// 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 { @@ -17800,7 +19824,7 @@ func (rgba *RGBA) IsOpaque() bool { // // The string can be either one of: // -// - A standard name (Taken from the X11 rgb.txt file). +// - A standard name (Taken from the CSS specification). // // - A hexadecimal value in the form “\#rgb”, “\#rrggbb”, “\#rrrgggbbb” or // ”\#rrrrggggbbbb” @@ -17813,6 +19837,10 @@ func (rgba *RGBA) IsOpaque() bool { // // - 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 @@ -17990,7 +20018,7 @@ func (r *Rectangle) SetHeight(height int) { *valptr = C.int(height) } -// ContainsPoint returns UE if rect contains the point described by x and y. +// ContainsPoint returns TRUE if rect contains the point described by x and y. // // The function takes the following parameters: // @@ -17999,7 +20027,7 @@ func (r *Rectangle) SetHeight(height int) { // // The function returns the following values: // -// - ok if rect contains the point. +// - 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 @@ -18068,8 +20096,7 @@ func (rect1 *Rectangle) Equal(rect2 *Rectangle) bool { // // The function returns the following values: // -// - dest (optional): return location for the intersection of src1 and src2, -// or NULL. +// - 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 @@ -18130,7 +20157,221 @@ func (src1 *Rectangle) Union(src2 *Rectangle) *Rectangle { return _dest } -// TimeCoord stores a single event in a motion history. +// 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 { @@ -18150,7 +20391,7 @@ func (t *TimeCoord) Time() uint32 { return _v } -// Flags indicating what axes are present. +// Flags indicating what axes are present, see gdk.AxisFlags. func (t *TimeCoord) Flags() AxisFlags { valptr := &t.native.flags var _v AxisFlags // out @@ -18158,7 +20399,7 @@ func (t *TimeCoord) Flags() AxisFlags { return _v } -// Axes axis values. +// Axes axis values, indexed by gdk.AxisUse. func (t *TimeCoord) Axes() [12]float64 { valptr := &t.native.axes var _v [12]float64 // out @@ -18214,7 +20455,7 @@ func NewToplevelLayout() *ToplevelLayout { return _toplevelLayout } -// Copy: create a new ToplevelLayout and copy the contents of layout into it. +// Copy: create a new GdkToplevelLayout and copy the contents of layout into it. // // The function returns the following values: // @@ -18245,7 +20486,7 @@ func (layout *ToplevelLayout) Copy() *ToplevelLayout { // // The function takes the following parameters: // -// - other ToplevelLayout. +// - other GdkToplevelLayout. // // The function returns the following values: // diff --git a/pkg/gdk/v4/gdk_export.go b/pkg/gdk/v4/gdk_export.go index 5afc54158..25ae58ba2 100644 --- a/pkg/gdk/v4/gdk_export.go +++ b/pkg/gdk/v4/gdk_export.go @@ -115,14 +115,12 @@ func _gotk4_gdk4_ContentProviderClass_get_value(arg0 *C.GdkContentProvider, arg1 panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected ContentProviderOverrides.Value, got none") } - var _value *coreglib.Value // out - - _value = coreglib.ValueFromNative(unsafe.Pointer(arg1)) - - _goerr := overrides.Value(_value) + 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)) } diff --git a/pkg/gdkpixbuf/v2/gdkpixbuf.go b/pkg/gdkpixbuf/v2/gdkpixbuf.go index 160c99834..9847c3829 100644 --- a/pkg/gdkpixbuf/v2/gdkpixbuf.go +++ b/pkg/gdkpixbuf/v2/gdkpixbuf.go @@ -27,7 +27,6 @@ import ( // #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); @@ -36,7 +35,6 @@ import ( // 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); @@ -91,7 +89,7 @@ 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 = 6 +const PIXBUF_MICRO = 12 // PIXBUF_MINOR: minor version of gdk-pixbuf library, that is the "8" in "0.8.2" // for example. @@ -100,7 +98,7 @@ 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.6" +const PIXBUF_VERSION = "2.42.12" // Colorspace: this enumeration defines the color spaces that are supported by // the gdk-pixbuf library. @@ -1175,7 +1173,7 @@ func NewPixbufFromStreamFinish(asyncResult gio.AsyncResulter) (*Pixbuf, error) { // // The function returns the following values: // -// - pixbuf: newly-created pixbuf. +// - pixbuf (optional): newly-created pixbuf. func NewPixbufFromXPMData(data []string) *Pixbuf { var _arg1 **C.char // out var _cret *C.GdkPixbuf // in @@ -1199,7 +1197,9 @@ func NewPixbufFromXPMData(data []string) *Pixbuf { var _pixbuf *Pixbuf // out - _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cret != nil { + _pixbuf = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } return _pixbuf } @@ -1225,7 +1225,7 @@ func NewPixbufFromXPMData(data []string) *Pixbuf { // // The function returns the following values: // -// - ret: newly-created pixbuf. +// - 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 @@ -1251,7 +1251,9 @@ func (pixbuf *Pixbuf) AddAlpha(substituteColor bool, r, g, b byte) *Pixbuf { var _ret *Pixbuf // out - _ret = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cret != nil { + _ret = wrapPixbuf(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } return _ret } @@ -1871,8 +1873,8 @@ func (pixbuf *Pixbuf) Options() map[string]string { // 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 (#image-data) for information about how -// the pixel data is stored in memory. +// 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: // @@ -2370,85 +2372,6 @@ func (pixbuf *Pixbuf) SaveToStreamv(ctx context.Context, stream gio.OutputStream 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", @@ -2763,46 +2686,6 @@ func PixbufGetFileInfo(filename string) (width, height int, pixbufFormat *Pixbuf 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(). // @@ -2904,98 +2787,6 @@ func PixbufInitModules(path string) error { 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(). // @@ -3372,45 +3163,6 @@ func (animation *PixbufAnimation) IsStaticImage() bool { 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 { @@ -4285,8 +4037,8 @@ func marshalPixbufFormat(p uintptr) (interface{}, error) { // // The function returns the following values: // -// - pixbufFormat: newly allocated copy of a GdkPixbufFormat. Use -// gdk_pixbuf_format_free() to free the resources when done. +// - 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 @@ -4298,13 +4050,15 @@ func (format *PixbufFormat) Copy() *PixbufFormat { var _pixbufFormat *PixbufFormat // out - _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)) - }, - ) + 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 } @@ -4313,7 +4067,7 @@ func (format *PixbufFormat) Copy() *PixbufFormat { // // The function returns the following values: // -// - utf8: description of the format. +// - utf8 (optional): description of the format. func (format *PixbufFormat) Description() string { var _arg0 *C.GdkPixbufFormat // out var _cret *C.gchar // in @@ -4325,8 +4079,10 @@ func (format *PixbufFormat) Description() string { var _utf8 string // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } return _utf8 } @@ -4336,7 +4092,7 @@ func (format *PixbufFormat) Description() string { // // The function returns the following values: // -// - utf8s: array of filename extensions. +// - utf8s (optional): array of filename extensions. func (format *PixbufFormat) Extensions() []string { var _arg0 *C.GdkPixbufFormat // out var _cret **C.gchar // in @@ -4348,19 +4104,21 @@ func (format *PixbufFormat) Extensions() []string { 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++ - } + 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])) + 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])) + } } } @@ -4375,7 +4133,7 @@ func (format *PixbufFormat) Extensions() []string { // // The function returns the following values: // -// - utf8: string describing the license of the pixbuf format. +// - 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 @@ -4387,8 +4145,10 @@ func (format *PixbufFormat) License() string { var _utf8 string // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } return _utf8 } @@ -4397,7 +4157,7 @@ func (format *PixbufFormat) License() string { // // The function returns the following values: // -// - utf8s: array of mime types. +// - utf8s (optional): array of mime types. func (format *PixbufFormat) MIMETypes() []string { var _arg0 *C.GdkPixbufFormat // out var _cret **C.gchar // in @@ -4409,19 +4169,21 @@ func (format *PixbufFormat) MIMETypes() []string { 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++ - } + 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])) + 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])) + } } } @@ -4432,7 +4194,7 @@ func (format *PixbufFormat) MIMETypes() []string { // // The function returns the following values: // -// - utf8: name of the format. +// - utf8 (optional): name of the format. func (format *PixbufFormat) Name() string { var _arg0 *C.GdkPixbufFormat // out var _cret *C.gchar // in @@ -4444,8 +4206,10 @@ func (format *PixbufFormat) Name() string { var _utf8 string // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } return _utf8 } diff --git a/pkg/gdkwayland/v4/gdkwayland.go b/pkg/gdkwayland/v4/gdkwayland.go index c04448670..8b4c7b22d 100644 --- a/pkg/gdkwayland/v4/gdkwayland.go +++ b/pkg/gdkwayland/v4/gdkwayland.go @@ -142,12 +142,36 @@ func marshalWaylandDisplay(p uintptr) (interface{}, error) { return wrapWaylandDisplay(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } +// EglDisplay retrieves the EGL display connection object for the given GDK +// display. +// +// The function returns the following values: +// +// - gpointer (optional): EGL display. +func (display *WaylandDisplay) EglDisplay() unsafe.Pointer { + var _arg0 *C.GdkDisplay // out + var _cret C.gpointer // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_wayland_display_get_egl_display(_arg0) + runtime.KeepAlive(display) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + // 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, or NULL. +// - utf8 (optional): startup notification ID for display. func (display *WaylandDisplay) StartupNotificationID() string { var _arg0 *C.GdkDisplay // out var _cret *C.char // in @@ -166,7 +190,7 @@ func (display *WaylandDisplay) StartupNotificationID() string { return _utf8 } -// QueryRegistry returns TRUE if the the interface was found in the display +// QueryRegistry returns TRUE if the interface was found in the display // wl_registry.global handler. // // The function takes the following parameters: @@ -230,6 +254,8 @@ func (display *WaylandDisplay) SetCursorTheme(name string, size int) { // is complete (for example, when opening a window or when calling // gdk.Display.NotifyStartupComplete()). // +// Deprecated: Use gdk.Toplevel.SetStartupID(). +// // The function takes the following parameters: // // - startupId: startup notification ID (must be valid utf8). @@ -426,6 +452,28 @@ func marshalWaylandToplevel(p uintptr) (interface{}, error) { return wrapWaylandToplevel(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } +// DropExportedHandle: destroy a handle that was obtained with +// gdk_wayland_toplevel_export_handle(). +// +// Note that this API depends on an unstable Wayland protocol, and thus may +// require changes in the future. +// +// The function takes the following parameters: +// +// - handle to drop. +func (toplevel *WaylandToplevel) DropExportedHandle(handle 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(handle))) + defer C.free(unsafe.Pointer(_arg1)) + + C.gdk_wayland_toplevel_drop_exported_handle(_arg0, _arg1) + runtime.KeepAlive(toplevel) + runtime.KeepAlive(handle) +} + // ExportHandle: asynchronously obtains a handle for a surface that can be // passed to other processes. // @@ -441,6 +489,12 @@ func marshalWaylandToplevel(p uintptr) (interface{}, error) { // surface from another surface as transient for this one, see // gdkwayland.WaylandToplevel.SetTransientForExported(). // +// Before 4.12, this API could not safely be used multiple times, +// since there was no reference counting for handles. Starting with 4.12, +// every call to this function obtains a new handle, and every call to +// gdkwayland.WaylandToplevel.DropExportedHandle() drops just the handle that it +// is given. +// // Note that this API depends on an unstable Wayland protocol, and thus may // require changes in the future. // @@ -539,8 +593,15 @@ func (toplevel *WaylandToplevel) SetTransientForExported(parentHandleStr string) // It is an error to call this function on a surface that does not have a // handle. // +// Since 4.12, this function does nothing. Use +// gdkwayland.WaylandToplevel.DropExportedHandle() instead to drop a handle that +// was obtained with gdkwayland.WaylandToplevel.ExportHandle(). +// // Note that this API depends on an unstable Wayland protocol, and thus may // require changes in the future. +// +// Deprecated: Use gdkwayland.WaylandToplevel.DropExportedHandle() instead, +// this function does nothing. func (toplevel *WaylandToplevel) UnexportHandle() { var _arg0 *C.GdkToplevel // out diff --git a/pkg/gdkx11/v4/gdkx11.go b/pkg/gdkx11/v4/gdkx11.go index 296fd84ec..7c3954484 100644 --- a/pkg/gdkx11/v4/gdkx11.go +++ b/pkg/gdkx11/v4/gdkx11.go @@ -76,7 +76,7 @@ func (x X11DeviceType) String() string { // // The function takes the following parameters: // -// - device: Device. +// - device: GdkDevice. // // The function returns the following values: // @@ -97,17 +97,17 @@ func X11DeviceGetID(device *X11DeviceXI2) int { return _gint } -// X11DeviceManagerLookup returns the Device that wraps the given device ID. +// X11DeviceManagerLookup returns the GdkDevice that wraps the given device ID. // // The function takes the following parameters: // -// - deviceManager: DeviceManager. +// - deviceManager: GdkDeviceManager. // - deviceId: device ID, as understood by the XInput2 protocol. // // The function returns the following values: // -// - x11DeviceXI2 (optional) wrapping the device ID, or NULL if the given ID -// doesn’t currently represent a device. +// - x11DeviceXI2 (optional): the GdkDevice wrapping the device ID, or NULL if +// the given ID doesn’t currently represent a device. func X11DeviceManagerLookup(deviceManager *X11DeviceManagerXI2, deviceId int) *X11DeviceXI2 { var _arg1 *C.GdkX11DeviceManagerXI2 // out var _arg2 C.int // out @@ -149,8 +149,9 @@ func X11FreeCompoundText(ctext *byte) { // // The function takes the following parameters: // -// - surface used for communication with the server. The surface must have -// GDK_PROPERTY_CHANGE_MASK in its events mask or a hang will result. +// - surface: GdkSurface, used for communication with the server. The surface +// must have GDK_PROPERTY_CHANGE_MASK in its events mask or a hang will +// result. // // The function returns the following values: // @@ -287,7 +288,7 @@ func marshalX11Display(p uintptr) (interface{}, error) { // translate, you may break GDK and/or GTK+ in interesting ways. You have been // warned. // -// If you want this signal handler to queue a Event, you can use +// If you want this signal handler to queue a GdkEvent, you can use // gdk_display_put_event(). // // If you are interested in X GenericEvents, bear in mind that XGetEventData() @@ -389,6 +390,61 @@ func (display *X11Display) DefaultGroup() gdk.Surfacer { return _surface } +// EglDisplay retrieves the EGL display connection object for the given GDK +// display. +// +// This function returns NULL if GDK is using GLX. +// +// The function returns the following values: +// +// - gpointer (optional): EGL display object. +func (display *X11Display) EglDisplay() unsafe.Pointer { + var _arg0 *C.GdkDisplay // out + var _cret C.gpointer // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_x11_display_get_egl_display(_arg0) + runtime.KeepAlive(display) + + var _gpointer unsafe.Pointer // out + + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + + return _gpointer +} + +// EglVersion retrieves the version of the EGL implementation. +// +// The function returns the following values: +// +// - major: return location for the EGL major version. +// - minor: return location for the EGL minor version. +// - ok: TRUE if EGL is available. +func (display *X11Display) EglVersion() (major, minor int, ok bool) { + var _arg0 *C.GdkDisplay // out + var _arg1 C.int // in + var _arg2 C.int // in + var _cret C.gboolean // in + + _arg0 = (*C.GdkDisplay)(unsafe.Pointer(coreglib.InternObject(display).Native())) + + _cret = C.gdk_x11_display_get_egl_version(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(display) + + var _major int // out + var _minor int // out + var _ok bool // out + + _major = int(_arg1) + _minor = int(_arg2) + if _cret != 0 { + _ok = true + } + + return _major, _minor, _ok +} + // GLXVersion retrieves the version of the GLX implementation. // // The function returns the following values: @@ -455,11 +511,11 @@ func (display *X11Display) PrimaryMonitor() *gdk.Monitor { return _monitor } -// Screen retrieves the X11Screen of the display. +// Screen retrieves the GdkX11Screen of the display. // // The function returns the following values: // -// - x11Screen: X11Screen. +// - x11Screen: GdkX11Screen. func (display *X11Display) Screen() *X11Screen { var _arg0 *C.GdkDisplay // out var _cret *C.GdkX11Screen // in @@ -478,6 +534,8 @@ func (display *X11Display) Screen() *X11Screen { // StartupNotificationID gets the startup notification ID for a display. // +// Deprecated: since version 4.10. +// // The function returns the following values: // // - utf8: startup notification ID for display. @@ -537,10 +595,10 @@ func (display *X11Display) Grab() { // be taken. // // If the windowing system supports it, existing cursors created with -// gdk_cursor_new_from_name() are updated to reflect the theme change. -// Custom cursors constructed with gdk_cursor_new_from_texture() will have to -// be handled by the application (GTK applications can learn about cursor theme -// changes by listening for change notification for the corresponding Setting). +// gdk.Cursor.NewFromName are updated to reflect the theme change. Custom +// cursors constructed with gdk.Cursor.NewFromTexture will have to be handled +// by the application (GTK applications can learn about cursor theme changes by +// listening for change notification for the corresponding GtkSetting). // // The function takes the following parameters: // @@ -579,6 +637,8 @@ func (display *X11Display) SetCursorTheme(theme string, size int) { // is complete (for example, when opening a window or when calling // gdk_display_notify_startup_complete()). // +// Deprecated: Using gdk.Toplevel.SetStartupID() is sufficient. +// // The function takes the following parameters: // // - startupId: startup notification ID (must be valid utf8). @@ -730,7 +790,7 @@ func (display *X11Display) UTF8ToCompoundText(str string) (string, int, []byte, // // The function returns the following values: // -// - display (optional): new display or NULL on error. +// - display (optional): new display. func X11DisplayOpen(displayName string) *gdk.Display { var _arg1 *C.char // out var _cret *C.GdkDisplay // in @@ -764,7 +824,7 @@ func X11DisplayOpen(displayName string) *gdk.Display { // // The function takes the following parameters: // -// - display: Display. +// - display: GdkDisplay. // - programClass: string. func X11DisplaySetProgramClass(display *gdk.Display, programClass string) { var _arg1 *C.GdkDisplay // out @@ -809,6 +869,17 @@ var ( _ gdk.GLContexter = (*X11GLContext)(nil) ) +// X11GLContexter describes types inherited from class X11GLContext. +// +// To get the original type, the caller must assert this to an interface or +// another type. +type X11GLContexter interface { + coreglib.Objector + baseX11GLContext() *X11GLContext +} + +var _ X11GLContexter = (*X11GLContext)(nil) + func wrapX11GLContext(obj *coreglib.Object) *X11GLContext { return &X11GLContext{ GLContext: gdk.GLContext{ @@ -823,6 +894,15 @@ func marshalX11GLContext(p uintptr) (interface{}, error) { return wrapX11GLContext(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } +func (v *X11GLContext) baseX11GLContext() *X11GLContext { + return v +} + +// BaseX11GLContext returns the underlying base object. +func BaseX11GLContext(obj X11GLContexter) *X11GLContext { + return obj.baseX11GLContext() +} + type X11Monitor struct { _ [0]func() // equal guard gdk.Monitor @@ -845,12 +925,14 @@ func marshalX11Monitor(p uintptr) (interface{}, error) { } // Workarea retrieves the size and position of the “work area” on a monitor -// within the display coordinate space. The returned geometry is in ”application -// pixels”, not in ”device pixels” (see gdk_monitor_get_scale_factor()). +// within the display coordinate space. +// +// The returned geometry is in ”application pixels”, not in ”device pixels” (see +// gdk.Monitor.GetScaleFactor()). // // The function returns the following values: // -// - workarea to be filled with the monitor workarea. +// - workarea: GdkRectangle to be filled with the monitor workarea. func (monitor *X11Monitor) Workarea() *gdk.Rectangle { var _arg0 *C.GdkMonitor // out var _arg1 C.GdkRectangle // in @@ -938,7 +1020,7 @@ func (screen *X11Screen) NumberOfDesktops() uint32 { return _guint32 } -// ScreenNumber returns the index of a X11Screen. +// ScreenNumber returns the index of a GdkX11Screen. // // The function returns the following values: // @@ -993,7 +1075,7 @@ func (screen *X11Screen) WindowManagerName() string { // start up before the window manager does when the user logs in, and before // the window manager starts gdk_x11_screen_supports_net_wm_hint() will return // FALSE for every property. You can monitor the window_manager_changed signal -// on X11Screen to detect a window manager change. +// on GdkX11Screen to detect a window manager change. // // The function takes the following parameters: // @@ -1070,7 +1152,7 @@ func (surface *X11Surface) Desktop() uint32 { // // The function returns the following values: // -// - ret: group of this surface;. +// - ret (optional): group of this surface;. func (surface *X11Surface) Group() gdk.Surfacer { var _arg0 *C.GdkSurface // out var _cret *C.GdkSurface // in @@ -1082,22 +1164,21 @@ func (surface *X11Surface) Group() gdk.Surfacer { var _ret gdk.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.(gdk.Surfacer) - return ok - }) - rv, ok := casted.(gdk.Surfacer) - if !ok { - panic("no marshaler for " + object.TypeFromInstance().String() + " matching gdk.Surfacer") + 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") + } + _ret = rv } - _ret = rv } return _ret @@ -1166,7 +1247,7 @@ func (surface *X11Surface) SetFrameSyncEnabled(frameSyncEnabled bool) { // // The function takes the following parameters: // -// - leader: Surface. +// - leader: GdkSurface. func (surface *X11Surface) SetGroup(leader gdk.Surfacer) { var _arg0 *C.GdkSurface // out var _arg1 *C.GdkSurface // out diff --git a/pkg/gio/v2/gio.go b/pkg/gio/v2/gio.go index 89d5e19cb..5db5ba1a8 100644 --- a/pkg/gio/v2/gio.go +++ b/pkg/gio/v2/gio.go @@ -18,7 +18,7 @@ import ( "github.com/diamondburned/gotk4/pkg/glib/v2" ) -// #cgo pkg-config: gio-2.0 gobject-introspection-1.0 +// #cgo pkg-config: gio-2.0 glib-2.0 // #cgo CFLAGS: -Wno-deprecated-declarations // #include // #include @@ -88,7 +88,6 @@ import ( // 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_FileProgressCallback(goffset, goffset, gpointer); // 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); @@ -112,13 +111,13 @@ import ( // 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*); @@ -130,8 +129,10 @@ import ( // 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); @@ -164,9 +165,11 @@ import ( // 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); @@ -213,7 +216,10 @@ import ( // 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*); @@ -231,7 +237,6 @@ import ( // 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 GType _gotk4_gio2_DBusProxyTypeFunc(GDBusObjectManagerClient*, gchar*, gchar*, gpointer); // 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**); @@ -278,6 +283,7 @@ import ( // 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); @@ -300,6 +306,9 @@ import ( // 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); // }; @@ -843,6 +852,9 @@ import ( // 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); // }; @@ -927,9 +939,6 @@ import ( // 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(void* fnptr, GFile* arg0, GFile* arg1, GFileCopyFlags arg2, GCancellable* arg3, GFileProgressCallback arg4, gpointer arg5, GError** arg6) { -// return ((gboolean (*)(GFile*, GFile*, GFileCopyFlags, GCancellable*, GFileProgressCallback, gpointer, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); -// }; // gboolean _gotk4_gio2_File_virtual_copy_finish(void* fnptr, GFile* arg0, GAsyncResult* arg1, GError** arg2) { // return ((gboolean (*)(GFile*, GAsyncResult*, GError**))(fnptr))(arg0, arg1, arg2); // }; @@ -963,14 +972,17 @@ import ( // 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(void* fnptr, GFile* arg0, GFile* arg1, GFileCopyFlags arg2, GCancellable* arg3, GFileProgressCallback arg4, gpointer arg5, GError** arg6) { -// return ((gboolean (*)(GFile*, GFile*, GFileCopyFlags, GCancellable*, GFileProgressCallback, gpointer, GError**))(fnptr))(arg0, arg1, arg2, arg3, arg4, arg5, arg6); +// 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); @@ -1206,6 +1218,9 @@ import ( // 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); // }; @@ -1353,15 +1368,18 @@ import ( // 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); // }; @@ -1398,12 +1416,6 @@ import ( // 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); // }; @@ -1440,150 +1452,27 @@ import ( // 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_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_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); // }; @@ -1611,84 +1500,21 @@ import ( // 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); // }; @@ -1698,9 +1524,6 @@ import ( // 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); // }; @@ -1716,27 +1539,6 @@ import ( // 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); // }; @@ -1785,15 +1587,6 @@ import ( // 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); // }; @@ -1840,6 +1633,7 @@ var ( 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()) @@ -1892,6 +1686,7 @@ var ( 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()) @@ -1906,6 +1701,7 @@ var ( 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()) @@ -1943,6 +1739,7 @@ var ( 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()) @@ -2067,6 +1864,7 @@ func init() { 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}, @@ -2119,6 +1917,7 @@ func init() { 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}, @@ -2133,6 +1932,7 @@ func init() { 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}, @@ -2170,6 +1970,7 @@ func init() { 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}, @@ -2275,6 +2076,10 @@ const DBUS_METHOD_INVOCATION_HANDLED = true // 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]. // @@ -2285,365 +2090,512 @@ const DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME = "gio-desktop-app-info-looku // 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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 of used on the file system. Corresponding AttributeType -// is G_FILE_ATTRIBUTE_TYPE_UINT64. +// 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. +// 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. +// 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. +// 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). +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// #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. +// 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). +// +// 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. +// 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. +// 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. +// 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. +// 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). +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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 FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET for the persistent URI. +// 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 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. +// 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. @@ -2651,137 +2603,286 @@ const FILE_ATTRIBUTE_THUMBNAILING_FAILED = "thumbnail::failed" // Corresponding AttributeType is G_FILE_ATTRIBUTE_TYPE_BOOLEAN. const FILE_ATTRIBUTE_THUMBNAIL_IS_VALID = "thumbnail::is-valid" -// FILE_ATTRIBUTE_THUMBNAIL_PATH: key in the "thumbnail" namespace for -// getting the path to the thumbnail image. Corresponding AttributeType is -// G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +// 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_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. +// 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_USEC: key in the "time" namespace for getting the -// microseconds of the time the file was last accessed. This should be used in +// 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. +// 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_USEC: key in the "time" namespace for getting the -// microseconds of the time the file was last changed. This should be used in +// 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. +// 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_USEC: key in the "time" namespace for getting -// the microseconds of the time the file was created. This should be used in +// 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. +// 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_USEC: key in the "time" namespace for getting -// the microseconds of the time the file was last modified. This should be used +// 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. When -// requested against items in trash:///, will return the date and time when the -// file was trashed. The format of the returned string is YYYY-MM-DDThh:mm:ss. +// 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. When requested -// against trash:/// returns the number of (toplevel) items in the trash folder. +// 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. -// When requested against items in trash:///, will return the original -// path to the file before it was trashed. Corresponding AttributeType is -// G_FILE_ATTRIBUTE_TYPE_BYTE_STRING. +// 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. +// 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. +// 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. +// +// 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. +// 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. +// 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. +// 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. +// 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 lstat() documentation. This attribute -// is only available for UNIX file systems. Corresponding AttributeType is -// G_FILE_ATTRIBUTE_TYPE_UINT32. +// 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 lstat() documentation. -// This attribute is only available for UNIX file systems. Corresponding -// AttributeType is G_FILE_ATTRIBUTE_TYPE_UINT32. +// 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. +// 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" @@ -2819,6 +2920,12 @@ const MENU_ATTRIBUTE_LABEL = "label" // 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. @@ -2837,6 +2944,10 @@ const NATIVE_VOLUME_MONITOR_EXTENSION_POINT_NAME = "gio-native-volume-monitor" // 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" @@ -2997,6 +3108,9 @@ const ( // 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) { @@ -3020,6 +3134,8 @@ func (c CredentialsType) String() string { return "NetbsdUnpcbid" case CredentialsTypeAppleXucred: return "AppleXucred" + case CredentialsTypeWin32Pid: + return "Win32Pid" default: return fmt.Sprintf("CredentialsType(%d)", c) } @@ -3379,8 +3495,8 @@ func DBusErrorIsRemoteError(err error) bool { // 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 IO_ERROR error domain is returned. Also, dbus_error_name +// 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(). // @@ -4073,7 +4189,7 @@ func (f FileType) String() string { // FilesystemPreviewType indicates a hint from the file system whether files // should be previewed in a file manager. Returned as the value of the key -// FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW. +// G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW. type FilesystemPreviewType C.gint const ( @@ -4119,7 +4235,7 @@ func (f FilesystemPreviewType) String() string { // } // // but should instead treat all unrecognized error codes the same as -// IO_ERROR_FAILED. +// G_IO_ERROR_FAILED. // // See also Return for a cheaper way of returning G_IO_ERROR_WOULD_BLOCK to // callers without allocating a #GError. @@ -4236,6 +4352,10 @@ const ( 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) { @@ -4339,6 +4459,10 @@ func (i IOErrorEnum) String() string { return "NotConnected" case IOErrorMessageTooLarge: return "MessageTooLarge" + case IOErrorNoSuchDevice: + return "NoSuchDevice" + case IOErrorDestinationUnset: + return "DestinationUnset" default: return fmt.Sprintf("IOErrorEnum(%d)", i) } @@ -5093,8 +5217,8 @@ func TLSChannelBindingErrorQuark() glib.Quark { return _quark } -// TLSChannelBindingType: type of TLS channel binding data to retrieve -// from Connection or Connection, as documented by RFC 5929. The +// 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 @@ -5106,6 +5230,9 @@ const ( // 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) { @@ -5119,6 +5246,8 @@ func (t TLSChannelBindingType) String() string { return "Unique" case TLSChannelBindingTLSServerEndPoint: return "ServerEndPoint" + case TLSChannelBindingTLSExporter: + return "Exporter" default: return fmt.Sprintf("TLSChannelBindingType(%d)", t) } @@ -5183,6 +5312,9 @@ const ( // 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) { @@ -5208,6 +5340,8 @@ func (t TLSError) String() string { return "EOF" case TLSErrorInappropriateFallback: return "InappropriateFallback" + case TLSErrorBadCertificatePassword: + return "BadCertificatePassword" default: return fmt.Sprintf("TLSError(%d)", t) } @@ -5264,6 +5398,71 @@ func (t TLSInteractionResult) String() string { } } +// 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(). // @@ -5390,8 +5589,11 @@ func (a AppInfoCreateFlags) Has(other AppInfoCreateFlags) bool { type ApplicationFlags C.guint const ( - // ApplicationFlagsNone: default. + // 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. @@ -5445,7 +5647,7 @@ func (a ApplicationFlags) String() string { } var builder strings.Builder - builder.Grow(239) + builder.Grow(256) for a != 0 { next := a & (a - 1) @@ -5561,8 +5763,8 @@ const ( // to claim the name. BusNameOwnerFlagsAllowReplacement BusNameOwnerFlags = 0b1 // BusNameOwnerFlagsReplace: if another message bus connection owns the name - // and have specified BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take the - // name from the other connection. + // 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 @@ -5838,6 +6040,14 @@ const ( // 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) { @@ -5872,6 +6082,8 @@ func (d DBusConnectionFlags) String() string { builder.WriteString("DelayMessageProcessing|") case DBusConnectionFlagsAuthenticationRequireSameUser: builder.WriteString("AuthenticationRequireSameUser|") + case DBusConnectionFlagsCrossNamespace: + builder.WriteString("CrossNamespace|") default: builder.WriteString(fmt.Sprintf("DBusConnectionFlags(0b%b)|", bit)) } @@ -6132,6 +6344,10 @@ const ( // 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) { @@ -6145,7 +6361,7 @@ func (d DBusProxyFlags) String() string { } var builder strings.Builder - builder.Grow(197) + builder.Grow(223) for d != 0 { next := d & (d - 1) @@ -6164,6 +6380,8 @@ func (d DBusProxyFlags) String() string { builder.WriteString("GetInvalidatedProperties|") case DBusProxyFlagsDoNotAutoStartAtConstruction: builder.WriteString("DoNotAutoStartAtConstruction|") + case DBusProxyFlagsNoMatchRule: + builder.WriteString("NoMatchRule|") default: builder.WriteString(fmt.Sprintf("DBusProxyFlags(0b%b)|", bit)) } @@ -6513,6 +6731,9 @@ const ( // 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) { @@ -6526,7 +6747,7 @@ func (f FileCopyFlags) String() string { } var builder strings.Builder - builder.Grow(143) + builder.Grow(177) for f != 0 { next := f & (f - 1) @@ -6547,6 +6768,8 @@ func (f FileCopyFlags) String() string { builder.WriteString("NoFallbackForMove|") case FileCopyTargetDefaultPerms: builder.WriteString("TargetDefaultPerms|") + case FileCopyTargetDefaultModifiedTime: + builder.WriteString("TargetDefaultModifiedTime|") default: builder.WriteString(fmt.Sprintf("FileCopyFlags(0b%b)|", bit)) } @@ -6634,7 +6857,10 @@ const ( // 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. + // --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. @@ -7155,7 +7381,7 @@ const ( // SettingsBindNoSensitivity: do not try to bind a "sensitivity" property to // the writability of the setting. SettingsBindNoSensitivity SettingsBindFlags = 0b100 - // SettingsBindGetNoChanges: when set in addition to SETTINGS_BIND_GET, + // 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 @@ -7312,6 +7538,10 @@ const ( // 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) { @@ -7325,7 +7555,7 @@ func (s SubprocessFlags) String() string { } var builder strings.Builder - builder.Grow(235) + builder.Grow(256) for s != 0 { next := s & (s - 1) @@ -7350,6 +7580,8 @@ func (s SubprocessFlags) String() string { builder.WriteString("StderrMerge|") case SubprocessFlagsInheritFds: builder.WriteString("InheritFds|") + case SubprocessFlagsSearchPathFromEnvp: + builder.WriteString("SearchPathFromEnvp|") default: builder.WriteString(fmt.Sprintf("SubprocessFlags(0b%b)|", bit)) } @@ -7409,12 +7641,20 @@ func (t TestDBusFlags) Has(other TestDBusFlags) bool { } // TLSCertificateFlags: set of flags describing TLS certification validation. -// This can be used to set which validation steps to perform (eg, with -// g_tls_client_connection_set_validation_flags()), or to describe why a -// particular certificate was rejected (eg, in Connection::accept-certificate). +// 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 @@ -7448,13 +7688,15 @@ func (t TLSCertificateFlags) String() string { } var builder strings.Builder - builder.Grow(196) + 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: @@ -7543,6 +7785,15 @@ const ( // 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) { @@ -7556,7 +7807,7 @@ func (t TLSPasswordFlags) String() string { } var builder strings.Builder - builder.Grow(73) + builder.Grow(161) for t != 0 { next := t & (t - 1) @@ -7571,6 +7822,12 @@ func (t TLSPasswordFlags) String() string { 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)) } @@ -7586,14 +7843,6 @@ 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. -type AsyncReadyCallback func(res AsyncResulter) - // BusAcquiredCallback: invoked when a connection to a message bus has been // obtained. type BusAcquiredCallback func(connection *DBusConnection, name string) @@ -7616,10 +7865,6 @@ type BusNameLostCallback func(connection *DBusConnection, name string) // established has been closed. In that case, connection will be NULL. type BusNameVanishedCallback func(connection *DBusConnection, name string) -// CancellableSourceFunc: this is the function type of the callback used for the -// #GSource returned by g_cancellable_source_new(). -type CancellableSourceFunc func(cancellable context.Context) (ok bool) - // DBusInterfaceGetPropertyFunc: type of the get_property function in // BusInterfaceVTable. type DBusInterfaceGetPropertyFunc func(connection *DBusConnection, sender, objectPath, interfaceName, propertyName string) (err error, variant *glib.Variant) @@ -7693,14 +7938,6 @@ type DBusInterfaceSetPropertyFunc func(connection *DBusConnection, sender, objec // BusCapabilityFlags value obtained from connection. type DBusMessageFilterFunction func(connection *DBusConnection, message *DBusMessage, incoming bool) (dBusMessage *DBusMessage) -// DBusProxyTypeFunc: function signature for a function used to determine the -// #GType to use for an interface proxy (if interface_name is not NULL) or -// object proxy (if interface_name is NULL). -// -// This function is called in the [thread-default main -// loop][g-main-context-push-thread-default] that manager was constructed in. -type DBusProxyTypeFunc func(manager *DBusObjectManagerClient, objectPath, interfaceName string) (gType coreglib.Type) - // 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) @@ -7744,56 +7981,6 @@ type DBusSubtreeEnumerateFunc func(connection *DBusConnection, sender, objectPat // the empty array case, but not in the NULL case. type DBusSubtreeIntrospectFunc func(connection *DBusConnection, sender, objectPath, node string) (dBusInterfaceInfos []*DBusInterfaceInfo) -// DatagramBasedSourceFunc: this is the function type of the callback used for -// the #GSource returned by g_datagram_based_create_source(). -type DatagramBasedSourceFunc func(datagramBased DatagramBasedder, condition glib.IOCondition) (ok bool) - -// FileMeasureProgressCallback: this callback type is used by -// g_file_measure_disk_usage() to make periodic progress reports when measuring -// the amount of disk spaced used by a directory. -// -// These calls are made on a best-effort basis and not all types of #GFile -// will support them. At the minimum, however, one call will always be made -// immediately. -// -// In the case that there is no support, reporting will be set to FALSE (and -// the other values undefined) and no further calls will be made. Otherwise, -// the reporting will be TRUE and the other values all-zeros during the first -// (immediate) call. In this way, you can know which type of progress UI to show -// without a delay. -// -// For g_file_measure_disk_usage() the callback is made directly. For -// g_file_measure_disk_usage_async() the callback is made via the default main -// context of the calling thread (ie: the same way that the final async result -// would be reported). -// -// current_size is in the same units as requested by the operation (see -// G_FILE_MEASURE_APPARENT_SIZE). -// -// The frequency of the updates is implementation defined, but is ideally about -// once every 200ms. -// -// The last progress callback may or may not be equal to the final result. -// Always check the async result to get the final value. -type FileMeasureProgressCallback func(reporting bool, currentSize, numDirs, numFiles uint64) - -// FileProgressCallback: when doing file operations that may take a while, -// such as moving a file or copying a file, a progress callback is used to pass -// how far along that operation is to the application. -type FileProgressCallback func(currentNumBytes, totalNumBytes int64) - -// FileReadMoreCallback: when loading the partial contents of a file with -// g_file_load_partial_contents_async(), it may become necessary to determine -// if any more data from the file should be loaded. A ReadMoreCallback function -// facilitates this by returning TRUE if more data should be read, or FALSE -// otherwise. -type FileReadMoreCallback func(fileContents string, fileSize int64) (ok bool) - -// PollableSourceFunc: this is the function type of the callback used for -// the #GSource returned by g_pollable_input_stream_create_source() and -// g_pollable_output_stream_create_source(). -type PollableSourceFunc func(pollableStream *coreglib.Object) (ok bool) - // 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. @@ -7815,10 +8002,6 @@ type SettingsBindSetMapping func(value *coreglib.Value, expectedType *glib.Varia // this case. type SettingsGetMapping func(value *glib.Variant) (result unsafe.Pointer, ok bool) -// SocketSourceFunc: this is the function type of the callback used for the -// #GSource returned by g_socket_create_source(). -type SocketSourceFunc func(socket *Socket, condition glib.IOCondition) (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. @@ -7827,48 +8010,14 @@ type SocketSourceFunc func(socket *Socket, condition glib.IOCondition) (ok bool) // 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(). +// 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. @@ -7909,10 +8058,12 @@ func BusGetFinish(res AsyncResulter) (*DBusConnection, error) { // 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(). +// 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. @@ -8276,7 +8427,7 @@ func ContentTypeGetSymbolicIcon(typ string) *Icon { // // The function takes the following parameters: // -// - filename (optional): string, or NULL. +// - filename (optional): path, or NULL. // - data (optional): stream of data, or NULL. // // The function returns the following values: @@ -8616,47 +8767,6 @@ func DBusAddressGetForBusSync(ctx context.Context, busType BusType) (string, err 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(). // @@ -8863,8 +8973,14 @@ func DBusEscapeObjectPathBytestring(bytes []byte) string { // DBusGenerateGUID: generate a D-Bus GUID that can be used with e.g. // g_dbus_connection_new(). // -// See the D-Bus specification regarding what strings are valid D-Bus GUID (for -// example, D-Bus GUIDs are not RFC-4122 compliant). +// 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: // @@ -8887,31 +9003,31 @@ func DBusGenerateGUID() string { // // The conversion is using the following rules: // -// - TYPE_STRING: 's', 'o', 'g' or 'ay' +// - G_TYPE_STRING: 's', 'o', 'g' or 'ay' // -// - TYPE_STRV: 'as', 'ao' or 'aay' +// - G_TYPE_STRV: 'as', 'ao' or 'aay' // -// - TYPE_BOOLEAN: 'b' +// - G_TYPE_BOOLEAN: 'b' // -// - TYPE_UCHAR: 'y' +// - G_TYPE_UCHAR: 'y' // -// - TYPE_INT: 'i', 'n' +// - G_TYPE_INT: 'i', 'n' // -// - TYPE_UINT: 'u', 'q' +// - G_TYPE_UINT: 'u', 'q' // -// - TYPE_INT64 'x' +// - G_TYPE_INT64: 'x' // -// - TYPE_UINT64: 't' +// - G_TYPE_UINT64: 't' // -// - TYPE_DOUBLE: 'd' +// - G_TYPE_DOUBLE: 'd' // -// - TYPE_VARIANT: Any Type +// - G_TYPE_VARIANT: Any Type // -// This can fail if e.g. gvalue is of type TYPE_STRING and type is -// ['i'][G-VARIANT-TYPE-INT32:CAPS]. It will also fail for any #GType (including -// e.g. TYPE_OBJECT and TYPE_BOXED derived-types) not in the table above. +// 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 TYPE_VARIANT and its value is NULL, +// 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). @@ -9021,10 +9137,42 @@ func DBusIsAddress(str string) bool { 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 D-Bus specification regarding what strings are valid D-Bus GUID (for -// example, D-Bus GUIDs are not RFC-4122 compliant). +// See the documentation for g_dbus_generate_guid() for more information about +// the format of a GUID. // // The function takes the following parameters: // @@ -9032,7 +9180,7 @@ func DBusIsAddress(str string) bool { // // The function returns the following values: // -// - ok: TRUE if string is a guid, FALSE otherwise. +// - ok: TRUE if string is a GUID, FALSE otherwise. func DBusIsGUID(str string) bool { var _arg1 *C.gchar // out var _cret C.gboolean // in @@ -9239,13 +9387,22 @@ func DBusUnescapeObjectPath(s string) []byte { 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). +// 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 as soon as the call which sets it. +// 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: // @@ -9270,6 +9427,31 @@ func IOErrorFromErrno(errNo int) IOErrorEnum { 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: @@ -9830,66 +10012,32 @@ func ResourcesUnregister(resource *Resource) { 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 represents a single named action. +// Action: GAction represents a single named action. // // The main interface to an action is that it can be activated with -// g_action_activate(). This results in the 'activate' signal being emitted. -// An activation has a #GVariant parameter (which may be NULL). The correct type +// 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 g_action_change_state(). This call takes a #GVariant. The correct +// 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 Action. +// 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 g_action_activate() and -// g_action_change_state() for type safety and for the state being enabled. +// 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 -// ActionGroup. +// 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(). @@ -10487,22 +10635,27 @@ func ActionNameIsValid(actionName string) bool { // // 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". +// :, ( 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 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 +// 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 '.'. +// 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: // @@ -10510,8 +10663,8 @@ func ActionNameIsValid(actionName string) bool { // // The function returns the following values: // -// - actionName: action name. -// - targetValue: target value, or NULL for no target. +// - 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 @@ -10528,15 +10681,19 @@ func ActionParseDetailedName(detailedName string) (string, *glib.Variant, error) var _targetValue *glib.Variant // out var _goerr error // out - _actionName = C.GoString((*C.gchar)(unsafe.Pointer(_arg2))) - defer C.free(unsafe.Pointer(_arg2)) - _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 _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)) } @@ -10587,23 +10744,24 @@ func ActionPrintDetailedName(actionName string, targetValue *glib.Variant) strin return _utf8 } -// ActionGroup 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 Model that provides additional representation data for displaying the -// actions to the user, e.g. in a menu. +// 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 g_action_group_activate_action(). Activating an action may require -// a #GVariant parameter. The required type of the parameter can be inquired -// with g_action_group_get_action_parameter_type(). Actions may be disabled, -// see g_action_group_get_action_enabled(). Activating a disabled action has no +// 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 g_action_group_get_action_state(). +// 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 g_action_group_change_action_state(). +// 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 @@ -10611,23 +10769,24 @@ func ActionPrintDetailedName(actionName string, targetValue *glib.Variant) strin // state. // // Each action in the group has a unique name (which is a string). All method -// calls, except g_action_group_list_actions() take the name of an action as an +// calls, except gio.ActionGroup.ListActions() take the name of an action as an // argument. // -// The Group API is meant to be the 'public' API to the action group. +// 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 - -// g_action_group_get_action_enabled() but not an equivalent set() call. +// 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 Group should provide implementations for the virtual -// functions g_action_group_list_actions() and g_action_group_query_action(). -// The other virtual functions should not be implemented - their "wrappers" are -// actually implemented with calls to g_action_group_query_action(). +// 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(). @@ -11267,21 +11426,9 @@ func (actionGroup *ActionGroup) QueryAction(actionName string) (enabled bool, pa } if _arg3 != nil { _parameterType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_arg3))) - runtime.SetFinalizer( - gextras.StructIntern(unsafe.Pointer(_parameterType)), - func(intern *struct{ C unsafe.Pointer }) { - C.g_variant_type_free((*C.GVariantType)(intern.C)) - }, - ) } if _arg4 != nil { _stateType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_arg4))) - runtime.SetFinalizer( - gextras.StructIntern(unsafe.Pointer(_stateType)), - func(intern *struct{ C unsafe.Pointer }) { - C.g_variant_type_free((*C.GVariantType)(intern.C)) - }, - ) } if _arg5 != nil { _stateHint = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_arg5))) @@ -11885,21 +12032,9 @@ func (actionGroup *ActionGroup) queryAction(actionName string) (enabled bool, pa } if _arg3 != nil { _parameterType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_arg3))) - runtime.SetFinalizer( - gextras.StructIntern(unsafe.Pointer(_parameterType)), - func(intern *struct{ C unsafe.Pointer }) { - C.g_variant_type_free((*C.GVariantType)(intern.C)) - }, - ) } if _arg4 != nil { _stateType = (*glib.VariantType)(gextras.NewStructNative(unsafe.Pointer(_arg4))) - runtime.SetFinalizer( - gextras.StructIntern(unsafe.Pointer(_stateType)), - func(intern *struct{ C unsafe.Pointer }) { - C.g_variant_type_free((*C.GVariantType)(intern.C)) - }, - ) } if _arg5 != nil { _stateHint = (*glib.Variant)(gextras.NewStructNative(unsafe.Pointer(_arg5))) @@ -11926,8 +12061,11 @@ func (actionGroup *ActionGroup) queryAction(actionName string) (enabled bool, pa return _enabled, _parameterType, _stateType, _stateHint, _state, _ok } -// ActionMap interface is implemented by Group implementations that operate by -// containing a number of named #GAction instances, such as ActionGroup. +// 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 @@ -11957,6 +12095,8 @@ type ActionMapper interface { 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) @@ -12110,6 +12250,50 @@ func (actionMap *ActionMap) RemoveAction(actionName string) { 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 @@ -12194,26 +12378,29 @@ func (actionMap *ActionMap) removeAction(actionName string) { runtime.KeepAlive(actionName) } -// AppInfo and LaunchContext are used for describing and launching applications -// installed on the system. +// 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 -// g_file_get_path()) when using g_app_info_launch() even if the application +// 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 +// 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 +// 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 #GFile constructors (since gvfs implements -// the #GVfs extension point). As such, if the application needs to -// examine the URI, it needs to use g_file_get_uri() or similar on #GFile. +// 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. -// g_file_new_for_commandline_arg() is equal to the result of g_file_get_uri(). +// gio.File().NewForCommandlineArg is equal to the result of gio.File.GetURI(). // The following snippet illustrates this: // // GFile *f; @@ -12290,8 +12477,6 @@ type AppInfor interface { 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, @@ -12561,6 +12746,10 @@ func (appinfo *AppInfo) DisplayName() string { // 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. @@ -12714,8 +12903,8 @@ func (appinfo *AppInfo) SupportedTypes() []string { // 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 and DESKTOP_STARTUP_ID environment variables -// are also set, based on information provided in context. +// 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: // @@ -12756,9 +12945,11 @@ func (appinfo *AppInfo) Launch(files []Filer, context *AppLaunchContext) error { } // 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. +// 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. // @@ -12805,59 +12996,6 @@ func (appinfo *AppInfo) LaunchURIs(uris []string, context *AppLaunchContext) err 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: @@ -13328,6 +13466,10 @@ func (appinfo *AppInfo) displayName() string { // 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. @@ -13496,8 +13638,8 @@ func (appinfo *AppInfo) supportedTypes() []string { // 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 and DESKTOP_STARTUP_ID environment variables -// are also set, based on information provided in context. +// 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: // @@ -13541,9 +13683,11 @@ func (appinfo *AppInfo) launch(files []Filer, context *AppLaunchContext) error { } // 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. +// 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. // @@ -13593,62 +13737,6 @@ func (appinfo *AppInfo) launchURIs(uris []string, context *AppLaunchContext) err 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: @@ -14029,6 +14117,39 @@ func AppInfoGetDefaultForType(contentType string, mustSupportUris bool) *AppInfo return _appInfo } +// 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". @@ -14059,6 +14180,39 @@ func AppInfoGetDefaultForURIScheme(uriScheme string) *AppInfo { return _appInfo } +// 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. @@ -14165,52 +14319,6 @@ func AppInfoLaunchDefaultForURI(uri string, context *AppLaunchContext) error { 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. // @@ -14253,17 +14361,20 @@ func AppInfoResetTypeAssociations(contentType string) { runtime.KeepAlive(contentType) } -// AsyncInitable: this is the asynchronous version of #GInitable; it behaves the -// same in all ways except that initialization is asynchronous. For more details -// see the descriptions on #GInitable. +// AsyncInitable: GAsyncInitable is an interface for asynchronously +// initializable objects. // -// A class may implement both the #GInitable and Initable interfaces. +// 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 g_async_initable_new_async() +// For C applications you generally just call gio.AsyncInitable().NewAsync // directly, or indirectly via a foo_thing_new_async() wrapper. This will call -// g_async_initable_init_async() under the cover, calling back with NULL and a +// gio.AsyncInitable.InitAsync() under the covers, calling back with NULL and a // set GError on failure. // // A typical implementation might look something like this: @@ -14366,9 +14477,6 @@ var ( 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 @@ -14389,73 +14497,6 @@ 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(). // @@ -14518,76 +14559,6 @@ func (initable *AsyncInitable) NewFinish(res AsyncResulter) (*coreglib.Object, e 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(). // @@ -14618,32 +14589,32 @@ func (initable *AsyncInitable) initFinish(res AsyncResulter) error { return _goerr } -// AsyncResult provides a base class for implementing asynchronous function -// results. +// 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 ReadyCallback. To begin an asynchronous -// operation, provide a ReadyCallback to the asynchronous function. +// 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][g-main-context-push-thread-default] from where the operation was -// initiated. It will be passed a Result instance filled with the details of -// the operation's success or failure, the object the asynchronous function was +// 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 Result 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 -// Result) and returns the specific result that the operation in question yields -// (e.g. a Enumerator 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 ReadyCallback returns. You can pass NULL for the -// ReadyCallback if you don't need to take any action at all after the operation -// completes. Applications may also take a reference to the Result and call -// "_finish()" later; however, the "_finish()" function may be called at most -// once. +// 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: // @@ -14925,8 +14896,10 @@ func (res *AsyncResult) isTagged(sourceTag unsafe.Pointer) bool { return _ok } -// Converter is implemented by objects that convert binary data in various ways. -// The conversion can be stateful and may fail at any place. +// 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. @@ -15046,7 +15019,7 @@ func marshalConverter(p uintptr) (interface{}, error) { // The function takes the following parameters: // // - inbuf: buffer containing the data to convert. -// - outbuf: buffer to write converted data in. +// - outbuf: a buffer to write converted data in. // - flags controlling the conversion details. // // The function returns the following values: @@ -15192,7 +15165,7 @@ func (converter *Converter) Reset() { // The function takes the following parameters: // // - inbuf (optional): buffer containing the data to convert. -// - outbuf (optional): buffer to write converted data in. +// - outbuf: a buffer to write converted data in. // - flags controlling the conversion details. // // The function returns the following values: @@ -15263,8 +15236,11 @@ func (converter *Converter) reset() { runtime.KeepAlive(converter) } -// DBusInterface type is the base type for D-Bus interfaces both on the service -// side (see BusInterfaceSkeleton) and client side (see BusProxy). +// 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(). @@ -15459,9 +15435,9 @@ func (interface_ *DBusInterface) setObject(object DBusObjector) { runtime.KeepAlive(object) } -// DBusObject type is the base type for D-Bus objects on both the service -// side (see BusObjectSkeleton) and the client side (see BusObjectProxy). -// It is essentially just a container of interfaces. +// 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(). @@ -15687,6 +15663,7 @@ func (object *DBusObject) objectPath() string { 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 @@ -15702,6 +15679,7 @@ func (object *DBusObject) interfaceAdded(interface_ DBusInterfacer) { 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 @@ -15717,13 +15695,14 @@ func (object *DBusObject) interfaceRemoved(interface_ DBusInterfacer) { runtime.KeepAlive(interface_) } -// DBusObjectManager type is the base type for service- and client-side -// implementations of the standardized org.freedesktop.DBus.ObjectManager +// 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 BusObjectManagerClient for the client-side implementation and -// BusObjectManagerServer for the service-side implementation. +// 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(). @@ -15743,7 +15722,7 @@ type DBusObjectManagerer interface { // Interface gets the interface proxy for interface_name at object_path, // if any. Interface(objectPath, interfaceName string) *DBusInterface - // GetObject gets the BusObjectProxy at object_path, if any. + // GetObject gets the BusObject at object_path, if any. GetObject(objectPath string) *DBusObject // ObjectPath gets the object path that manager is for. ObjectPath() string @@ -15808,7 +15787,7 @@ func (manager *DBusObjectManager) ConnectObjectRemoved(f func(object DBusObjecto // // The function returns the following values: // -// - dBusInterface instance or NULL. Free with g_object_unref(). +// - 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 @@ -15828,12 +15807,14 @@ func (manager *DBusObjectManager) Interface(objectPath, interfaceName string) *D var _dBusInterface *DBusInterface // out - _dBusInterface = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cret != nil { + _dBusInterface = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } return _dBusInterface } -// GetObject gets the BusObjectProxy at object_path, if any. +// GetObject gets the BusObject at object_path, if any. // // The function takes the following parameters: // @@ -15841,7 +15822,7 @@ func (manager *DBusObjectManager) Interface(objectPath, interfaceName string) *D // // The function returns the following values: // -// - dBusObject or NULL. Free with g_object_unref(). +// - 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 @@ -15857,7 +15838,9 @@ func (manager *DBusObjectManager) GetObject(objectPath string) *DBusObject { var _dBusObject *DBusObject // out - _dBusObject = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cret != nil { + _dBusObject = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } return _dBusObject } @@ -15920,7 +15903,7 @@ func (manager *DBusObjectManager) Objects() []*DBusObject { // // The function returns the following values: // -// - dBusInterface instance or NULL. Free with g_object_unref(). +// - 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 @@ -15943,12 +15926,14 @@ func (manager *DBusObjectManager) iface(objectPath, interfaceName string) *DBusI var _dBusInterface *DBusInterface // out - _dBusInterface = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cret != nil { + _dBusInterface = wrapDBusInterface(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } return _dBusInterface } -// getObject gets the BusObjectProxy at object_path, if any. +// getObject gets the BusObject at object_path, if any. // // The function takes the following parameters: // @@ -15956,7 +15941,7 @@ func (manager *DBusObjectManager) iface(objectPath, interfaceName string) *DBusI // // The function returns the following values: // -// - dBusObject or NULL. Free with g_object_unref(). +// - 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 @@ -15975,7 +15960,9 @@ func (manager *DBusObjectManager) getObject(objectPath string) *DBusObject { var _dBusObject *DBusObject // out - _dBusObject = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cret != nil { + _dBusObject = wrapDBusObject(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } return _dBusObject } @@ -16035,6 +16022,9 @@ func (manager *DBusObjectManager) objects() []*DBusObject { return _list } +// interfaceAdded: signal handler for the BusObjectManager::interface-added +// signal. +// // The function takes the following parameters: // // - object @@ -16057,6 +16047,9 @@ func (manager *DBusObjectManager) interfaceAdded(object DBusObjector, interface_ runtime.KeepAlive(interface_) } +// interfaceRemoved: signal handler for the BusObjectManager::interface-removed +// signal. +// // The function takes the following parameters: // // - object @@ -16079,6 +16072,7 @@ func (manager *DBusObjectManager) interfaceRemoved(object DBusObjector, interfac 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 @@ -16094,6 +16088,8 @@ func (manager *DBusObjectManager) objectAdded(object DBusObjector) { 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 @@ -16109,33 +16105,35 @@ func (manager *DBusObjectManager) objectRemoved(object DBusObjector) { runtime.KeepAlive(object) } -// DatagramBased is a networking interface for representing datagram-based +// 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 -// #GSocket, which wraps the UNIX socket API on UNIX and winsock2 on Windows. +// gio.Socket, which wraps the UNIX socket API on UNIX and winsock2 on Windows. // -// Based is entirely platform independent, and is intended to be used alongside -// higher-level networking APIs such as OStream. +// 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 +// 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 Based 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 -// g_datagram_based_condition_check() or g_datagram_based_condition_wait(). -// You can also use g_datagram_based_create_source() and attach it to a Context -// to get callbacks when I/O is possible. +// 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 @@ -16144,16 +16142,17 @@ func (manager *DBusObjectManager) objectRemoved(object DBusObjector) { // For instance, on Windows a socket is always seen as writable until a write // returns G_IO_ERROR_WOULD_BLOCK. // -// As with #GSocket, Baseds can be either connection oriented (for example, -// SCTP) or connectionless (for example, UDP). Baseds 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 Based API. For connectionless socket types the -// target/source address is specified or received in each I/O operation. +// 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, Based is not inherently thread safe. To use -// a Based concurrently from multiple threads, you must implement your own -// locking. +// 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(). @@ -16956,30 +16955,128 @@ func (datagramBased *DatagramBased) sendMessages(ctx context.Context, messages [ return _gint, _goerr } -// Drive - this represent a piece of hardware connected to the machine. -// It's generally only created for removable hardware or hardware with removable +// 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 #GVolume 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. +// 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 +// 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 +// 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 g_drive_get_start_stop_type(). +// 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 note that there is no equivalent of #GDrive in that -// API. +// 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(). @@ -17006,12 +17103,8 @@ type Driver interface { 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. @@ -17042,18 +17135,11 @@ type Driver interface { // 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 @@ -17221,44 +17307,6 @@ func (drive *Drive) CanStop() bool { 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. @@ -17287,47 +17335,6 @@ func (drive *Drive) EjectFinish(result AsyncResulter) error { 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. @@ -17415,7 +17422,7 @@ func (drive *Drive) Icon() *Icon { } // Identifier gets the identifier of the given kind for drive. The only -// identifier currently available is DRIVE_IDENTIFIER_KIND_UNIX_DEVICE. +// identifier currently available is G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE. // // The function takes the following parameters: // @@ -17689,39 +17696,6 @@ func (drive *Drive) IsRemovable() bool { 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. // @@ -17749,48 +17723,6 @@ func (drive *Drive) PollForMediaFinish(result AsyncResulter) error { 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: @@ -17817,48 +17749,6 @@ func (drive *Drive) StartFinish(result AsyncResulter) error { 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: @@ -18015,6 +17905,7 @@ func (drive *Drive) canStop() bool { return _ok } +// Changed: signal emitted when the drive is changed. func (drive *Drive) changed() { gclass := (*C.GDriveIface)(coreglib.PeekParentClass(drive)) fnarg := gclass.changed @@ -18027,6 +17918,9 @@ func (drive *Drive) changed() { 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 @@ -18039,47 +17933,8 @@ func (drive *Drive) disconnected() { 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 @@ -18123,50 +17978,6 @@ func (drive *Drive) ejectFinish(result AsyncResulter) error { 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. @@ -18263,7 +18074,7 @@ func (drive *Drive) icon() *Icon { } // Identifier gets the identifier of the given kind for drive. The only -// identifier currently available is DRIVE_IDENTIFIER_KIND_UNIX_DEVICE. +// identifier currently available is G_DRIVE_IDENTIFIER_KIND_UNIX_DEVICE. // // The function takes the following parameters: // @@ -18570,42 +18381,6 @@ func (drive *Drive) isRemovable() bool { 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. // @@ -18636,51 +18411,6 @@ func (drive *Drive) pollForMediaFinish(result AsyncResulter) error { 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: @@ -18710,51 +18440,8 @@ func (drive *Drive) startFinish(result AsyncResulter) error { 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 @@ -18800,8 +18487,8 @@ func (drive *Drive) stopFinish(result AsyncResulter) error { type DTLSClientConnectionOverrider interface { } -// DTLSClientConnection is the client-side subclass of Connection, representing -// a client-side DTLS connection. +// 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(). @@ -18871,7 +18558,12 @@ func (conn *DTLSClientConnection) ServerIdentity() *SocketConnectable { return _socketConnectable } -// ValidationFlags gets conn's validation flags. +// 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: // @@ -18916,6 +18608,11 @@ func (conn *DTLSClientConnection) SetServerIdentity(identity SocketConnectabler) // 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. @@ -18969,23 +18666,25 @@ func NewDTLSClientConnection(baseSocket DatagramBasedder, serverIdentity SocketC return _dtlsClientConnection, _goerr } -// DTLSConnection is the base DTLS connection class type, which wraps a Based -// and provides DTLS encryption on top of it. Its subclasses, ClientConnection -// and ServerConnection, implement client-side and server-side DTLS, -// respectively. +// 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 Connection. +// For TLS support, see gio.TLSConnection. // -// As DTLS is datagram based, Connection implements Based, presenting a -// datagram-socket-like API for the encrypted connection. This operates over a -// base datagram connection, which is also a Based (Connection:base-socket). +// 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 g_dtls_connection_close(). +// To close a DTLS connection, use gio.DTLSConnection.Close(). // -// Neither ServerConnection or ClientConnection set the peer address on their -// base Based if it is a #GSocket — it is up to the caller to do that if they -// wish. If they do not, and g_socket_close() is called on the base socket, the -// Connection will not raise a G_IO_ERROR_NOT_CONNECTED error on further I/O. +// 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(). @@ -19002,8 +18701,6 @@ type DTLSConnectioner interface { // 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 @@ -19015,6 +18712,9 @@ type DTLSConnectioner interface { // 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 @@ -19029,6 +18729,11 @@ type DTLSConnectioner interface { // 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 @@ -19036,8 +18741,6 @@ type DTLSConnectioner interface { 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 @@ -19060,9 +18763,6 @@ type DTLSConnectioner interface { 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 @@ -19096,6 +18796,14 @@ func marshalDTLSConnection(p uintptr) (interface{}, error) { // 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 @@ -19165,40 +18873,6 @@ func (conn *DTLSConnection) Close(ctx context.Context) error { 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. // @@ -19345,6 +19019,36 @@ func (conn *DTLSConnection) ChannelBindingData(typ TLSChannelBindingType) ([]byt 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(). // @@ -19497,6 +19201,30 @@ func (conn *DTLSConnection) PeerCertificateErrors() TLSCertificateFlags { 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. // @@ -19601,40 +19329,6 @@ func (conn *DTLSConnection) Handshake(ctx context.Context) error { 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. // @@ -19741,6 +19435,9 @@ func (conn *DTLSConnection) SetCertificate(certificate TLSCertificater) { // 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. @@ -19902,52 +19599,6 @@ func (conn *DTLSConnection) Shutdown(ctx context.Context, shutdownRead, shutdown 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. // @@ -19975,6 +19626,8 @@ func (conn *DTLSConnection) ShutdownFinish(result AsyncResulter) error { return _goerr } +// acceptCertificate: check whether to accept a certificate. +// // The function takes the following parameters: // // - peerCert @@ -20006,6 +19659,8 @@ func (connection *DTLSConnection) acceptCertificate(peerCert TLSCertificater, er return _ok } +// bindingData: retrieve TLS channel binding data (Since: 2.66). +// // The function takes the following parameters: // // - typ @@ -20129,43 +19784,6 @@ func (conn *DTLSConnection) handshake(ctx context.Context) error { 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. // @@ -20299,55 +19917,6 @@ func (conn *DTLSConnection) shutdown(ctx context.Context, shutdownRead, shutdown 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. // @@ -20382,8 +19951,8 @@ func (conn *DTLSConnection) shutdownFinish(result AsyncResulter) error { type DTLSServerConnectionOverrider interface { } -// DTLSServerConnection is the server-side subclass of Connection, representing -// a server-side DTLS connection. +// 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(). @@ -20465,92 +20034,98 @@ func NewDTLSServerConnection(baseSocket DatagramBasedder, certificate TLSCertifi return _dtlsServerConnection, _goerr } -// File 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 +// 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 Stream and Stream). +// as streaming operations (see gio.InputStream and gio.OutputStream). +// +// To construct a GFile, you can use: +// +// - gio.File().NewForPath if you have a path. // -// To construct a #GFile, you can use: +// - gio.File().NewForURI if you have a URI. // -// - g_file_new_for_path() if you have a path. +// - gio.File().NewForCommandlineArg or gio.File().NewForCommandlineArgAndCwd +// for a command line argument. // -// - g_file_new_for_uri() if you have a URI. +// - gio.File().NewTmp to create a temporary file from a template. // -// - g_file_new_for_commandline_arg() for a command line argument. +// - gio.File().NewTmpAsync to asynchronously create a temporary file. // -// - g_file_new_tmp() to create a temporary file from a template. +// - gio.File().NewTmpDirAsync to asynchronously create a temporary directory. // -// - g_file_parse_name() from a UTF-8 string gotten from -// g_file_get_parse_name(). +// - gio.File().ParseName from a UTF-8 string gotten from +// gio.File.GetParseName(). // -// - g_file_new_build_filename() to create a file from path elements. +// - 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 +// 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 g_file_get_parent() to get an identifier for the -// parent directory, g_file_get_child() to get a child within a directory, -// g_file_resolve_relative_path() 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 g_file_get_parent() on two different files. +// 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 g_file_get_basename()). These names are +// 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 -// g_file_query_info(). 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 +// 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 +// 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 +// 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 +// 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 ReadyCallback which is then used to finalize the operation, -// producing a GAsyncResult which is then passed to the function's matching +// (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][async-programming] for -// more. +// 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, +// Some GFile operations almost always take a noticeable amount of time, // and so do not have synchronous analogs. Notable cases include: // -// - g_file_mount_mountable() to mount a mountable file. +// - gio.File.MountMountable() to mount a mountable file. // -// - g_file_unmount_mountable_with_operation() to unmount a mountable file. +// - gio.File.UnmountMountableWithOperation() to unmount a mountable file. // -// - g_file_eject_mountable_with_operation() to eject 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. +// 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 +// (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 @@ -20570,69 +20145,48 @@ type Filer interface { // 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) - // Copy copies the file source to the location specified by destination. - Copy(ctx context.Context, destination Filer, flags FileCopyFlags, progressCallback FileProgressCallback) 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 @@ -20666,15 +20220,11 @@ type Filer interface { 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 @@ -20682,8 +20232,6 @@ type Filer interface { 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 @@ -20693,6 +20241,9 @@ type Filer interface { // MakeSymbolicLink creates a symbolic link named file which contains the // string symlink_value. MakeSymbolicLink(ctx context.Context, symlinkValue string) error + // 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) @@ -20703,39 +20254,27 @@ type Filer interface { 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) - // Move tries to move the file or directory source to the location specified - // by destination. - Move(ctx context.Context, destination Filer, flags FileCopyFlags, progressCallback FileProgressCallback) 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 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) @@ -20747,16 +20286,10 @@ type Filer interface { // 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 @@ -20767,26 +20300,15 @@ type Filer interface { 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 @@ -20795,10 +20317,6 @@ type Filer interface { // 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) @@ -20826,8 +20344,6 @@ type Filer interface { // 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) @@ -20836,18 +20352,11 @@ type Filer interface { 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 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 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 @@ -20856,19 +20365,12 @@ type Filer interface { 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 - // 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 @@ -20889,8 +20391,8 @@ func marshalFile(p uintptr) (interface{}, error) { // 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 FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// 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 @@ -20942,49 +20444,6 @@ func (file *File) AppendTo(ctx context.Context, flags FileCreateFlags) (*FileOut 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) 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(). // @@ -21071,98 +20530,11 @@ func (file *File) BuildAttributeListForCopy(ctx context.Context, flags FileCopyF return _utf8, _goerr } -// Copy copies the file source to the location specified by destination. Can not -// handle recursive copies of directories. -// -// If the flag FILE_COPY_OVERWRITE is specified an already existing destination -// file is overwritten. -// -// If the flag FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will -// be copied as symlinks, otherwise the target of the source symlink will be -// copied. -// -// If the flag FILE_COPY_ALL_METADATA is specified then all the metadata that is -// possible to copy is copied, not just the default subset (which, for instance, -// does not include the owner, see 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 returned. -// -// If progress_callback is not NULL, then the operation can be monitored by -// setting this to a ProgressCallback function. progress_callback_data will be -// passed to this function. It is guaranteed that this callback will be called -// after all data has been transferred with the total number of bytes copied -// during the operation. -// -// If the source file does not exist, then the G_IO_ERROR_NOT_FOUND error is -// returned, independent on the status of the destination. -// -// If FILE_COPY_OVERWRITE is not specified and the target exists, then the error -// G_IO_ERROR_EXISTS is returned. -// -// If trying to overwrite a file over a directory, the G_IO_ERROR_IS_DIRECTORY -// error is returned. If trying to overwrite a directory with a directory the -// G_IO_ERROR_WOULD_MERGE error is returned. -// -// If the source is a directory and the target does not exist, -// or FILE_COPY_OVERWRITE is specified and the target is a file, then the -// G_IO_ERROR_WOULD_RECURSE error is returned. -// -// If you are interested in copying the #GFile object itself (not the on-disk -// file), see g_file_dup(). -// -// The function takes the following parameters: -// -// - ctx (optional): optional #GCancellable object, NULL to ignore. -// - destination #GFile. -// - flags: set of CopyFlags. -// - progressCallback (optional): function to callback with progress -// information, or NULL if progress information is not needed. -func (source *File) Copy(ctx context.Context, destination Filer, flags FileCopyFlags, progressCallback FileProgressCallback) error { - var _arg0 *C.GFile // out - var _arg3 *C.GCancellable // out - var _arg1 *C.GFile // out - var _arg2 C.GFileCopyFlags // out - var _arg4 C.GFileProgressCallback // out - var _arg5 C.gpointer - 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) - if progressCallback != nil { - _arg4 = (*[0]byte)(C._gotk4_gio2_FileProgressCallback) - _arg5 = C.gpointer(gbox.Assign(progressCallback)) - defer gbox.Delete(uintptr(_arg5)) - } - - C.g_file_copy(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) - runtime.KeepAlive(source) - runtime.KeepAlive(ctx) - runtime.KeepAlive(destination) - runtime.KeepAlive(flags) - runtime.KeepAlive(progressCallback) - - var _goerr error // out - - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } - - return _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 FILE_COPY_ALL_METADATA is specified in flags, +// 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. // @@ -21231,8 +20603,8 @@ func (file *File) CopyFinish(res AsyncResulter) error { // 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 FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// 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 @@ -21285,50 +20657,6 @@ func (file *File) Create(ctx context.Context, flags FileCreateFlags) (*FileOutpu 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) 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(). // @@ -21367,8 +20695,8 @@ func (file *File) CreateFinish(res AsyncResulter) (*FileOutputStream, error) { // 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 FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// 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 @@ -21425,50 +20753,6 @@ func (file *File) CreateReadwrite(ctx context.Context, flags FileCreateFlags) (* 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) 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(). // @@ -21553,41 +20837,6 @@ func (file *File) Delete(ctx context.Context) error { 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: @@ -21644,47 +20893,6 @@ func (file *File) Dup() *File { 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) to call when the request is satisfied, or NULL. -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(). // @@ -21714,52 +20922,6 @@ func (file *File) EjectMountableFinish(result AsyncResulter) error { 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) to call when the request is satisfied, or NULL. -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(). // @@ -21798,7 +20960,9 @@ func (file *File) EjectMountableWithOperationFinish(result AsyncResulter) error // 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 FILE_ATTRIBUTE_STANDARD_NAME. +// 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, @@ -21853,56 +21017,6 @@ func (file *File) EnumerateChildren(ctx context.Context, attributes string, flag 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) 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(). // @@ -22019,45 +21133,6 @@ func (file *File) FindEnclosingMount(ctx context.Context) (*Mount, error) { 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) 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(). // @@ -22628,44 +21703,6 @@ func (file *File) LoadBytes(ctx context.Context) (string, *glib.Bytes, error) { 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) 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(). // @@ -22776,46 +21813,6 @@ func (file *File) LoadContents(ctx context.Context) ([]byte, string, error) { 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 @@ -22954,39 +21951,6 @@ func (file *File) MakeDirectory(ctx context.Context) error { 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(). // @@ -23096,6 +22060,33 @@ func (file *File) MakeSymbolicLink(ctx context.Context, symlinkValue string) err return _goerr } +// 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. @@ -23341,54 +22332,6 @@ func (file *File) MonitorFile(ctx context.Context, flags FileMonitorFlags) (File 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(). // @@ -23416,54 +22359,6 @@ func (location *File) MountEnclosingVolumeFinish(result AsyncResulter) error { 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) to call when the request is satisfied, or NULL. -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. // @@ -23501,75 +22396,23 @@ func (file *File) MountMountableFinish(result AsyncResulter) (*File, error) { return _ret, _goerr } -// Move tries to move the file or directory source to the location specified -// by destination. If native move operations are supported then this is used, -// otherwise a copy + delete fallback is used. The native implementation -// may support moving directories (for instance on moves inside the same -// filesystem), but the fallback code does not. -// -// If the flag FILE_COPY_OVERWRITE is specified an already existing destination -// file is overwritten. -// -// 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 progress_callback is not NULL, then the operation can be monitored by -// setting this to a ProgressCallback function. progress_callback_data will be -// passed to this function. It is guaranteed that this callback will be called -// after all data has been transferred with the total number of bytes copied -// during the operation. -// -// If the source file does not exist, then the G_IO_ERROR_NOT_FOUND error is -// returned, independent on the status of the destination. -// -// If FILE_COPY_OVERWRITE is not specified and the target exists, then the error -// G_IO_ERROR_EXISTS is returned. -// -// If trying to overwrite a file over a directory, the G_IO_ERROR_IS_DIRECTORY -// error is returned. If trying to overwrite a directory with a directory the -// G_IO_ERROR_WOULD_MERGE error is returned. -// -// If the source is a directory and the target does not exist, -// or FILE_COPY_OVERWRITE is specified and the target is a file, then the -// G_IO_ERROR_WOULD_RECURSE error may be returned (if the native move operation -// isn't available). +// MoveFinish finishes an asynchronous file movement, started with +// g_file_move_async(). // // The function takes the following parameters: // -// - ctx (optional): optional #GCancellable object, NULL to ignore. -// - destination pointing to the destination location. -// - flags: set of CopyFlags. -// - progressCallback (optional): ProgressCallback function for updates. -func (source *File) Move(ctx context.Context, destination Filer, flags FileCopyFlags, progressCallback FileProgressCallback) error { - var _arg0 *C.GFile // out - var _arg3 *C.GCancellable // out - var _arg1 *C.GFile // out - var _arg2 C.GFileCopyFlags // out - var _arg4 C.GFileProgressCallback // out - var _arg5 C.gpointer - var _cerr *C.GError // in +// - 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(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) - if progressCallback != nil { - _arg4 = (*[0]byte)(C._gotk4_gio2_FileProgressCallback) - _arg5 = C.gpointer(gbox.Assign(progressCallback)) - defer gbox.Delete(uintptr(_arg5)) - } + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) - C.g_file_move(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) - runtime.KeepAlive(source) - runtime.KeepAlive(ctx) - runtime.KeepAlive(destination) - runtime.KeepAlive(flags) - runtime.KeepAlive(progressCallback) + C.g_file_move_finish(_arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) var _goerr error // out @@ -23630,45 +22473,6 @@ func (file *File) OpenReadwrite(ctx context.Context) (*FileIOStream, error) { 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) 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(). // @@ -23733,42 +22537,6 @@ func (file *File) PeekPath() string { return _filename } -// PollMountable polls a file of type 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. // @@ -23842,39 +22610,6 @@ func (file *File) QueryDefaultHandler(ctx context.Context) (*AppInfo, error) { 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. // @@ -23980,7 +22715,7 @@ func (file *File) QueryExists(ctx context.Context) bool { // // The function returns the following values: // -// - fileType of the file and FILE_TYPE_UNKNOWN if the file does not exist. +// - 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 @@ -24018,9 +22753,9 @@ func (file *File) QueryFileType(ctx context.Context, flags FileQueryInfoFlags) F // 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 FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem -// in bytes), FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available), -// and FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem). +// 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, @@ -24071,52 +22806,6 @@ func (file *File) QueryFilesystemInfo(ctx context.Context, attributes string) (* 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) 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(). // @@ -24163,15 +22852,15 @@ func (file *File) QueryFilesystemInfoFinish(res AsyncResulter) (*FileInfo, error // 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 FILE_ATTRIBUTE_STANDARD_NAME. +// 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 FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in flags the information about +// 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. // @@ -24224,56 +22913,6 @@ func (file *File) QueryInfo(ctx context.Context, attributes string, flags FileQu 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) 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(). // @@ -24460,45 +23099,6 @@ func (file *File) Read(ctx context.Context) (*FileInputStream, error) { 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) 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(). // @@ -24543,8 +23143,8 @@ func (file *File) ReadFinish(res AsyncResulter) (*FileInputStream, error) { // 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 FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// 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 @@ -24575,7 +23175,7 @@ func (file *File) ReadFinish(res AsyncResulter) (*FileInputStream, error) { // The function takes the following parameters: // // - ctx (optional): optional #GCancellable object, NULL to ignore. -// - etag (optional): optional [entity tag][gfile-etag] for the current +// - 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. @@ -24626,64 +23226,6 @@ func (file *File) Replace(ctx context.Context, etag string, makeBackup bool, fla 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][gfile-etag] 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) 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, @@ -24705,13 +23247,13 @@ func (file *File) ReplaceAsync(ctx context.Context, etag string, makeBackup bool // // - ctx (optional): optional #GCancellable object, NULL to ignore. // - contents: string containing the new contents for file. -// - etag (optional): old [entity-tag][gfile-etag] for the document, or NULL. +// - 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][gfile-etag] for the +// - 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) { @@ -24766,134 +23308,6 @@ func (file *File) ReplaceContents(ctx context.Context, contents, etag string, ma 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][gfile-etag] 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][gfile-etag] 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. @@ -24904,7 +23318,7 @@ func (file *File) ReplaceContentsBytesAsync(ctx context.Context, contents *glib. // // The function returns the following values: // -// - newEtag (optional): location of a new [entity tag][gfile-etag] for the +// - 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) { @@ -24983,7 +23397,7 @@ func (file *File) ReplaceFinish(res AsyncResulter) (*FileOutputStream, error) { // The function takes the following parameters: // // - ctx (optional): optional #GCancellable object, NULL to ignore. -// - etag (optional): optional [entity tag][gfile-etag] for the current +// - 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. @@ -25034,64 +23448,6 @@ func (file *File) ReplaceReadwrite(ctx context.Context, etag string, makeBackup 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][gfile-etag] 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) 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(). // @@ -25131,14 +23487,16 @@ func (file *File) ReplaceReadwriteFinish(res AsyncResulter) (*FileIOStream, erro // // 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 to the resolved path. NULL if relative_path is NULL or if file is -// invalid. Free the returned object with g_object_unref(). +// - ret for the resolved path. func (file *File) ResolveRelativePath(relativePath string) *File { var _arg0 *C.GFile // out var _arg1 *C.char // out @@ -25506,53 +23864,6 @@ func (file *File) SetAttributeUint64(ctx context.Context, attribute string, valu 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. -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(). // @@ -25641,9 +23952,9 @@ func (file *File) SetAttributesFromInfo(ctx context.Context, info *FileInfo, fla // 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 (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(). +// 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. // @@ -25692,50 +24003,6 @@ func (file *File) SetDisplayName(ctx context.Context, displayName string) (*File 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) 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(). // @@ -25770,54 +24037,6 @@ func (file *File) SetDisplayNameFinish(res AsyncResulter) (*File, error) { return _ret, _goerr } -// StartMountable starts a file of type 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. // @@ -25848,52 +24067,6 @@ func (file *File) StartMountableFinish(result AsyncResulter) error { return _goerr } -// StopMountable stops a file of type 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. // @@ -25989,39 +24162,6 @@ func (file *File) Trash(ctx context.Context) error { 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(). // @@ -26049,48 +24189,6 @@ func (file *File) TrashFinish(result AsyncResulter) error { 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) to call when the request is satisfied, or NULL. -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. // @@ -26123,52 +24221,6 @@ func (file *File) UnmountMountableFinish(result AsyncResulter) error { return _goerr } -// UnmountMountableWithOperation unmounts a file of type 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) to call when the request is satisfied, or NULL. -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. // @@ -26202,8 +24254,8 @@ func (file *File) UnmountMountableWithOperationFinish(result AsyncResulter) erro // 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 FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// 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 @@ -26258,52 +24310,6 @@ func (file *File) appendTo(ctx context.Context, flags FileCreateFlags) (*FileOut 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) 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(). // @@ -26342,96 +24348,6 @@ func (file *File) appendToFinish(res AsyncResulter) (*FileOutputStream, error) { return _fileOutputStream, _goerr } -// Copy copies the file source to the location specified by destination. Can not -// handle recursive copies of directories. -// -// If the flag FILE_COPY_OVERWRITE is specified an already existing destination -// file is overwritten. -// -// If the flag FILE_COPY_NOFOLLOW_SYMLINKS is specified then symlinks will -// be copied as symlinks, otherwise the target of the source symlink will be -// copied. -// -// If the flag FILE_COPY_ALL_METADATA is specified then all the metadata that is -// possible to copy is copied, not just the default subset (which, for instance, -// does not include the owner, see 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 returned. -// -// If progress_callback is not NULL, then the operation can be monitored by -// setting this to a ProgressCallback function. progress_callback_data will be -// passed to this function. It is guaranteed that this callback will be called -// after all data has been transferred with the total number of bytes copied -// during the operation. -// -// If the source file does not exist, then the G_IO_ERROR_NOT_FOUND error is -// returned, independent on the status of the destination. -// -// If FILE_COPY_OVERWRITE is not specified and the target exists, then the error -// G_IO_ERROR_EXISTS is returned. -// -// If trying to overwrite a file over a directory, the G_IO_ERROR_IS_DIRECTORY -// error is returned. If trying to overwrite a directory with a directory the -// G_IO_ERROR_WOULD_MERGE error is returned. -// -// If the source is a directory and the target does not exist, -// or FILE_COPY_OVERWRITE is specified and the target is a file, then the -// G_IO_ERROR_WOULD_RECURSE error is returned. -// -// If you are interested in copying the #GFile object itself (not the on-disk -// file), see g_file_dup(). -// -// The function takes the following parameters: -// -// - ctx (optional): optional #GCancellable object, NULL to ignore. -// - destination #GFile. -// - flags: set of CopyFlags. -// - progressCallback (optional): function to callback with progress -// information, or NULL if progress information is not needed. -func (source *File) copy(ctx context.Context, destination Filer, flags FileCopyFlags, progressCallback FileProgressCallback) error { - gclass := (*C.GFileIface)(coreglib.PeekParentClass(source)) - fnarg := gclass.copy - - var _arg0 *C.GFile // out - var _arg3 *C.GCancellable // out - var _arg1 *C.GFile // out - var _arg2 C.GFileCopyFlags // out - var _arg4 C.GFileProgressCallback // out - var _arg5 C.gpointer - 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) - if progressCallback != nil { - _arg4 = (*[0]byte)(C._gotk4_gio2_FileProgressCallback) - _arg5 = C.gpointer(gbox.Assign(progressCallback)) - defer gbox.Delete(uintptr(_arg5)) - } - - C._gotk4_gio2_File_virtual_copy(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) - runtime.KeepAlive(source) - runtime.KeepAlive(ctx) - runtime.KeepAlive(destination) - runtime.KeepAlive(flags) - runtime.KeepAlive(progressCallback) - - 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: @@ -26464,8 +24380,8 @@ func (file *File) copyFinish(res AsyncResulter) error { // 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 FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// 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 @@ -26521,53 +24437,6 @@ func (file *File) create(ctx context.Context, flags FileCreateFlags) (*FileOutpu 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) 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(). // @@ -26609,8 +24478,8 @@ func (file *File) createFinish(res AsyncResulter) (*FileOutputStream, error) { // 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 FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// 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 @@ -26670,53 +24539,6 @@ func (file *File) createReadwrite(ctx context.Context, flags FileCreateFlags) (* 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) 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(). // @@ -26807,44 +24629,6 @@ func (file *File) deleteFile(ctx context.Context) error { 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: @@ -26907,50 +24691,6 @@ func (file *File) dup() *File { 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) to call when the request is satisfied, or NULL. -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(). // @@ -26983,55 +24723,6 @@ func (file *File) ejectMountableFinish(result AsyncResulter) error { 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) to call when the request is satisfied, or NULL. -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(). // @@ -27073,7 +24764,9 @@ func (file *File) ejectMountableWithOperationFinish(result AsyncResulter) error // 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 FILE_ATTRIBUTE_STANDARD_NAME. +// 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, @@ -27131,59 +24824,6 @@ func (file *File) enumerateChildren(ctx context.Context, attributes string, flag 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) 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(). // @@ -27309,48 +24949,6 @@ func (file *File) findEnclosingMount(ctx context.Context) (*Mount, error) { 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) 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(). // @@ -27827,42 +25425,6 @@ func (file *File) makeDirectory(ctx context.Context) error { 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(). // @@ -27936,6 +25498,36 @@ func (file *File) makeSymbolicLink(ctx context.Context, symlinkValue string) err return _goerr } +// 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. @@ -28127,57 +25719,6 @@ func (file *File) monitorFile(ctx context.Context, flags FileMonitorFlags) (File 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(). // @@ -28208,57 +25749,6 @@ func (location *File) mountEnclosingVolumeFinish(result AsyncResulter) error { 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) to call when the request is satisfied, or NULL. -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. // @@ -28299,78 +25789,26 @@ func (file *File) mountMountableFinish(result AsyncResulter) (*File, error) { return _ret, _goerr } -// Move tries to move the file or directory source to the location specified -// by destination. If native move operations are supported then this is used, -// otherwise a copy + delete fallback is used. The native implementation -// may support moving directories (for instance on moves inside the same -// filesystem), but the fallback code does not. -// -// If the flag FILE_COPY_OVERWRITE is specified an already existing destination -// file is overwritten. -// -// 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 progress_callback is not NULL, then the operation can be monitored by -// setting this to a ProgressCallback function. progress_callback_data will be -// passed to this function. It is guaranteed that this callback will be called -// after all data has been transferred with the total number of bytes copied -// during the operation. -// -// If the source file does not exist, then the G_IO_ERROR_NOT_FOUND error is -// returned, independent on the status of the destination. -// -// If FILE_COPY_OVERWRITE is not specified and the target exists, then the error -// G_IO_ERROR_EXISTS is returned. -// -// If trying to overwrite a file over a directory, the G_IO_ERROR_IS_DIRECTORY -// error is returned. If trying to overwrite a directory with a directory the -// G_IO_ERROR_WOULD_MERGE error is returned. -// -// If the source is a directory and the target does not exist, -// or FILE_COPY_OVERWRITE is specified and the target is a file, then the -// G_IO_ERROR_WOULD_RECURSE error may be returned (if the native move operation -// isn't available). +// moveFinish finishes an asynchronous file movement, started with +// g_file_move_async(). // // The function takes the following parameters: // -// - ctx (optional): optional #GCancellable object, NULL to ignore. -// - destination pointing to the destination location. -// - flags: set of CopyFlags. -// - progressCallback (optional): ProgressCallback function for updates. -func (source *File) move(ctx context.Context, destination Filer, flags FileCopyFlags, progressCallback FileProgressCallback) error { - gclass := (*C.GFileIface)(coreglib.PeekParentClass(source)) - fnarg := gclass.move +// - 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 _arg3 *C.GCancellable // out - var _arg1 *C.GFile // out - var _arg2 C.GFileCopyFlags // out - var _arg4 C.GFileProgressCallback // out - var _arg5 C.gpointer - var _cerr *C.GError // in + var _arg0 *C.GFile // out + var _arg1 *C.GAsyncResult // 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) - if progressCallback != nil { - _arg4 = (*[0]byte)(C._gotk4_gio2_FileProgressCallback) - _arg5 = C.gpointer(gbox.Assign(progressCallback)) - defer gbox.Delete(uintptr(_arg5)) - } + _arg0 = (*C.GFile)(unsafe.Pointer(coreglib.InternObject(file).Native())) + _arg1 = (*C.GAsyncResult)(unsafe.Pointer(coreglib.InternObject(result).Native())) - C._gotk4_gio2_File_virtual_move(unsafe.Pointer(fnarg), _arg0, _arg1, _arg2, _arg3, _arg4, _arg5, &_cerr) - runtime.KeepAlive(source) - runtime.KeepAlive(ctx) - runtime.KeepAlive(destination) - runtime.KeepAlive(flags) - runtime.KeepAlive(progressCallback) + C._gotk4_gio2_File_virtual_move_finish(unsafe.Pointer(fnarg), _arg0, _arg1, &_cerr) + runtime.KeepAlive(file) + runtime.KeepAlive(result) var _goerr error // out @@ -28434,48 +25872,6 @@ func (file *File) openReadwrite(ctx context.Context) (*FileIOStream, error) { 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) 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(). // @@ -28514,45 +25910,6 @@ func (file *File) openReadwriteFinish(res AsyncResulter) (*FileIOStream, error) return _fileIOStream, _goerr } -// pollMountable polls a file of type 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. // @@ -28642,9 +25999,9 @@ func (prefix *File) prefixMatches(file Filer) bool { // 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 FILE_ATTRIBUTE_FILESYSTEM_SIZE (the total size of the filesystem -// in bytes), FILE_ATTRIBUTE_FILESYSTEM_FREE (number of bytes available), -// and FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem). +// 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, @@ -28698,55 +26055,6 @@ func (file *File) queryFilesystemInfo(ctx context.Context, attributes string) (* 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) 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(). // @@ -28796,15 +26104,15 @@ func (file *File) queryFilesystemInfoFinish(res AsyncResulter) (*FileInfo, error // 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 FILE_ATTRIBUTE_STANDARD_NAME. +// 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 FILE_QUERY_INFO_NOFOLLOW_SYMLINKS in flags the information about +// 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. // @@ -28860,59 +26168,6 @@ func (file *File) queryInfo(ctx context.Context, attributes string, flags FileQu 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) 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(). // @@ -29060,48 +26315,6 @@ func (file *File) queryWritableNamespaces(ctx context.Context) (*FileAttributeIn 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) 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(). // @@ -29200,8 +26413,8 @@ func (file *File) readFn(ctx context.Context) (*FileInputStream, error) { // 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 FILE_CREATE_PRIVATE in flags the file will be made readable only to the +// 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 @@ -29232,7 +26445,7 @@ func (file *File) readFn(ctx context.Context) (*FileInputStream, error) { // The function takes the following parameters: // // - ctx (optional): optional #GCancellable object, NULL to ignore. -// - etag (optional): optional [entity tag][gfile-etag] for the current +// - 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. @@ -29286,67 +26499,6 @@ func (file *File) replace(ctx context.Context, etag string, makeBackup bool, fla 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][gfile-etag] 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) 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(). // @@ -29399,7 +26551,7 @@ func (file *File) replaceFinish(res AsyncResulter) (*FileOutputStream, error) { // The function takes the following parameters: // // - ctx (optional): optional #GCancellable object, NULL to ignore. -// - etag (optional): optional [entity tag][gfile-etag] for the current +// - 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. @@ -29453,67 +26605,6 @@ func (file *File) replaceReadwrite(ctx context.Context, etag string, makeBackup 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][gfile-etag] 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) 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(). // @@ -29556,14 +26647,16 @@ func (file *File) replaceReadwriteFinish(res AsyncResulter) (*FileIOStream, erro // // 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 to the resolved path. NULL if relative_path is NULL or if file is -// invalid. Free the returned object with g_object_unref(). +// - ret for the resolved path. func (file *File) resolveRelativePath(relativePath string) *File { gclass := (*C.GFileIface)(coreglib.PeekParentClass(file)) fnarg := gclass.resolve_relative_path @@ -29646,56 +26739,6 @@ func (file *File) setAttribute(ctx context.Context, attribute string, typ FileAt 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. -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(). // @@ -29790,9 +26833,9 @@ func (file *File) setAttributesFromInfo(ctx context.Context, info *FileInfo, fla // 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 (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(). +// 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. // @@ -29844,53 +26887,6 @@ func (file *File) setDisplayName(ctx context.Context, displayName string) (*File 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) 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(). // @@ -29928,57 +26924,6 @@ func (file *File) setDisplayNameFinish(res AsyncResulter) (*File, error) { return _ret, _goerr } -// startMountable starts a file of type 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. // @@ -30012,55 +26957,6 @@ func (file *File) startMountableFinish(result AsyncResulter) error { return _goerr } -// stopMountable stops a file of type 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. // @@ -30136,42 +27032,6 @@ func (file *File) trash(ctx context.Context) error { 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(). // @@ -30202,51 +27062,6 @@ func (file *File) trashFinish(result AsyncResulter) error { 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) to call when the request is satisfied, or NULL. -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. // @@ -30282,55 +27097,6 @@ func (file *File) unmountMountableFinish(result AsyncResulter) error { return _goerr } -// unmountMountableWithOperation unmounts a file of type 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) to call when the request is satisfied, or NULL. -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. // @@ -30364,6 +27130,47 @@ func (file *File) unmountMountableWithOperationFinish(result AsyncResulter) erro 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. @@ -30549,6 +27356,72 @@ func NewFileTmp(tmpl string) (*FileIOStream, *File, error) { return _iostream, _file, _goerr } +// 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 @@ -30578,30 +27451,32 @@ func FileParseName(parseName string) *File { return _file } -// Icon is a very minimal interface for icons. It provides functions for +// 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 Icon), or the path to an icon (see Icon). +// 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 g_icon_hash(). +// To obtain a hash of a GIcon, see gio.Icon.Hash(). // -// To check if two #GIcons are equal, see g_icon_equal(). +// To check if two GIcons are equal, see gio.Icon.Equal(). // -// For serializing a #GIcon, use g_icon_serialize() and g_icon_deserialize(). +// 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: Icon, Icon and Icon. -// It may also make sense to have fast-paths for other cases (like handling -// Pixbuf directly, for example) but all compliant #GIcon implementations -// outside of GIO must implement Icon. +// 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 Icon. -// Additionally, you must provide an implementation of g_icon_serialize() that -// gives a result that is understood by g_icon_deserialize(), yielding one of +// 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 @@ -30621,6 +27496,8 @@ type Iconner interface { // 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 @@ -30675,6 +27552,28 @@ func (icon1 *Icon) Equal(icon2 Iconner) bool { 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 @@ -30875,32 +27774,6 @@ func IconDeserialize(value *glib.Variant) *Icon { return _icon } -// IconHash gets a hash for an icon. -// -// The function takes the following parameters: -// -// - icon to an icon object. -// -// The function returns the following values: -// -// - guint containing a hash for the icon, suitable for use in a Table or -// similar data structure. -func IconHash(icon unsafe.Pointer) uint { - var _arg1 C.gconstpointer // out - var _cret C.guint // in - - _arg1 = (C.gconstpointer)(unsafe.Pointer(icon)) - - _cret = C.g_icon_hash(_arg1) - runtime.KeepAlive(icon) - - var _guint uint // out - - _guint = uint(_cret) - - return _guint -} - // NewIconForString: generate a #GIcon instance from str. This function can fail // if str is not valid - see g_icon_to_string() for discussion. // @@ -30937,22 +27810,22 @@ func NewIconForString(str string) (*Icon, error) { return _icon, _goerr } -// Initable 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 g_initable_init() or -// g_async_initable_init_async() (the latter is only available if it also -// implements Initable). +// 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 g_critical() or g_warning(), but this must not be relied on. +// 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 g_initable_new() directly, -// or indirectly via a foo_thing_new() wrapper. This will call g_initable_init() -// under the cover, returning NULL and setting a #GError on failure (at which +// 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 @@ -31126,48 +27999,63 @@ func (initable *Initable) init(ctx context.Context) error { return _goerr } -// ListModel is an interface that represents a mutable list of #GObjects. -// 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. +// 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::notify signal). Taken together with the -// Model::items-changed signal, this provides for a list that can change its -// membership, and in which the members can change their individual properties. +// 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 Model 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. +// 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 Model are of (or derived from) the same type. -// g_list_model_get_item_type() returns that type. The type may be an interface, +// 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: g_list_model_get_n_items() -// returns the number of items in the list and g_list_model_get_item() returns +// 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 g_list_model_get_item() until it returns NULL. +// 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 +// 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][g-main-context-push-thread-default] in effect -// at the time that the model was created. +// 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(). @@ -31220,8 +28108,10 @@ func (list *ListModel) ConnectItemsChanged(f func(position, removed, added uint) 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_type() are of that type or a subtype, or are an +// 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. @@ -31270,11 +28160,17 @@ func (list *ListModel) NItems() uint { return _guint } -// Item: get the item at position. If position is greater than the number of -// items in list, NULL is returned. +// 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(). +// 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: // @@ -31352,6 +28248,8 @@ func (list *ListModel) ItemsChanged(position, removed, added uint) { // 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. @@ -31381,8 +28279,10 @@ func (list *ListModel) item(position uint) *coreglib.Object { return _object } -// itemType gets the type of the items in list. All items returned from -// g_list_model_get_type() are of that type or a subtype, or are an +// 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. @@ -31437,8 +28337,8 @@ func (list *ListModel) nItems() uint { return _guint } -// LoadableIcon extends the #GIcon interface and adds the ability to load icons -// from streams. +// 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(). @@ -31455,8 +28355,6 @@ type LoadableIconner interface { // 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) @@ -31542,41 +28440,6 @@ func (icon *LoadableIcon) Load(ctx context.Context, size int) (string, InputStre 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) 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(). // @@ -31704,44 +28567,6 @@ func (icon *LoadableIcon) load(ctx context.Context, size int) (string, InputStre 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) 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(). // @@ -31803,36 +28628,31 @@ func (icon *LoadableIcon) loadFinish(res AsyncResulter) (string, InputStreamer, return _typ, _inputStream, _goerr } -// MemoryMonitor 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 +// 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) to return cached heap pages to the -// kernel (if supported by your libc) +// - 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 MonitorWarningLevel for details on the various warning levels. +// See gio.MemoryMonitorWarningLevel for details on the various warning levels. // // static void // warning_cb (GMemoryMonitor *m, GMemoryMonitorWarningLevel level) @@ -31852,8 +28672,8 @@ func (icon *LoadableIcon) loadFinish(res AsyncResulter) (string, InputStreamer, // return m; // } // -// Don't forget to disconnect the Monitor::low-memory-warning signal, and unref -// the Monitor itself when exiting. +// 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(). @@ -31901,6 +28721,8 @@ func (v *MemoryMonitor) ConnectLowMemoryWarning(f func(level MemoryMonitorWarnin 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 @@ -31934,24 +28756,26 @@ func MemoryMonitorDupDefault() *MemoryMonitor { return _memoryMonitor } -// Mount interface represents user-visible mounts. Note, when porting from -// GnomeVFS, #GMount is the moral equivalent of VFSVolume. +// 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, +// 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 Result and #GTask. -// To unmount a #GMount instance, first call g_mount_unmount_with_operation() -// with (at least) the #GMount instance and a ReadyCallback. The callback will -// be fired when the operation has resolved (either with success or failure), -// and a Result structure will be passed to the callback. That callback should -// then call g_mount_unmount_with_operation_finish() with the #GMount and the -// Result data to see if the operation was completed successfully. If an error -// is present when g_mount_unmount_with_operation_finish() is called, then it -// will be filled with any error information. +// 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(). @@ -31972,12 +28796,8 @@ type Mounter interface { 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. @@ -31998,26 +28818,18 @@ type Mounter interface { 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. @@ -32111,43 +28923,6 @@ func (mount *Mount) CanUnmount() bool { 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. @@ -32178,47 +28953,6 @@ func (mount *Mount) EjectFinish(result AsyncResulter) error { 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. @@ -32464,52 +29198,6 @@ func (mount *Mount) Volume() *Volume { 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 @@ -32670,52 +29358,6 @@ func (mount *Mount) IsShadowed() bool { 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. @@ -32757,43 +29399,6 @@ func (mount *Mount) Shadow() { 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. @@ -32824,47 +29429,6 @@ func (mount *Mount) UnmountFinish(result AsyncResulter) error { 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. @@ -32958,6 +29522,7 @@ func (mount *Mount) canUnmount() bool { 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 @@ -32970,46 +29535,6 @@ func (mount *Mount) changed() { 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. @@ -33043,50 +29568,6 @@ func (mount *Mount) ejectFinish(result AsyncResulter) error { 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. @@ -33362,55 +29843,6 @@ func (mount *Mount) volume() *Volume { 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 @@ -33535,6 +29967,9 @@ func (mount *Mount) guessContentTypeSync(ctx context.Context, forceRescan bool) 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 @@ -33547,55 +29982,6 @@ func (mount *Mount) preUnmount() { 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. @@ -33627,46 +30013,6 @@ func (mount *Mount) remountFinish(result AsyncResulter) error { 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. @@ -33700,50 +30046,6 @@ func (mount *Mount) unmountFinish(result AsyncResulter) error { 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. @@ -33775,6 +30077,9 @@ func (mount *Mount) unmountWithOperationFinish(result AsyncResulter) error { 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 @@ -33787,9 +30092,9 @@ func (mount *Mount) unmounted() { runtime.KeepAlive(mount) } -// NetworkMonitor 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. +// 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. // @@ -33809,10 +30114,6 @@ type NetworkMonitorrer interface { // 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 @@ -33894,46 +30195,6 @@ func (monitor *NetworkMonitor) CanReach(ctx context.Context, connectable SocketC 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) 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(). // @@ -34101,49 +30362,6 @@ func (monitor *NetworkMonitor) canReach(ctx context.Context, connectable SocketC 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) 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(). // @@ -34174,6 +30392,8 @@ func (monitor *NetworkMonitor) canReachFinish(result AsyncResulter) error { 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 @@ -34209,9 +30429,15 @@ func NetworkMonitorGetDefault() *NetworkMonitor { return _networkMonitor } -// PollableInputStream is implemented by Streams 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. +// 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(). @@ -34292,6 +30518,9 @@ func (stream *PollableInputStream) CanPoll() bool { // 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. @@ -34336,6 +30565,9 @@ func (stream *PollableInputStream) CreateSource(ctx context.Context) *glib.Sourc // 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 @@ -34370,10 +30602,14 @@ func (stream *PollableInputStream) IsReadable() bool { // 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 to read data into (which should be at least count bytes long). +// - buffer: a buffer to read data into (which should be at least count bytes +// long). // // The function returns the following values: // @@ -34455,6 +30691,9 @@ func (stream *PollableInputStream) canPoll() bool { // 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. @@ -34502,6 +30741,9 @@ func (stream *PollableInputStream) createSource(ctx context.Context) *glib.Sourc // 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 @@ -34539,10 +30781,13 @@ func (stream *PollableInputStream) isReadable() bool { // 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) to read data into (which should be at least count bytes -// long). +// - buffer (optional): a buffer to read data into (which should be at least +// count bytes long). // // The function returns the following values: // @@ -34579,9 +30824,15 @@ func (stream *PollableInputStream) readNonblocking(buffer []byte) (int, error) { return _gssize, _goerr } -// PollableOutputStream is implemented by Streams 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. +// 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(). @@ -34665,6 +30916,9 @@ func (stream *PollableOutputStream) CanPoll() bool { // 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. @@ -34709,6 +30963,9 @@ func (stream *PollableOutputStream) CreateSource(ctx context.Context) *glib.Sour // 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 @@ -34747,6 +31004,9 @@ func (stream *PollableOutputStream) IsWritable() bool { // 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. @@ -34807,6 +31067,9 @@ func (stream *PollableOutputStream) WriteNonblocking(ctx context.Context, buffer // 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. @@ -34904,6 +31167,9 @@ func (stream *PollableOutputStream) canPoll() bool { // 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. @@ -34951,6 +31217,9 @@ func (stream *PollableOutputStream) createSource(ctx context.Context) *glib.Sour // 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 @@ -34992,6 +31261,9 @@ func (stream *PollableOutputStream) isWritable() bool { // 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. @@ -35047,6 +31319,9 @@ func (stream *PollableOutputStream) writeNonblocking(buffer []byte) (int, error) // 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. @@ -35098,11 +31373,120 @@ func (stream *PollableOutputStream) writevNonblocking(vectors []OutputVector) (u return _bytesWritten, _pollableReturn, _goerr } -// Proxy handles connecting to a remote host via a given type of proxy server. -// It is implemented by the 'gio-proxy' extension point. The extensions +// 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 -// g_io_extension_point_get_extension_by_name(). +// 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(). @@ -35124,8 +31508,6 @@ type Proxier interface { // 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, @@ -35210,43 +31592,6 @@ func (proxy *Proxy) ConnectProxy(ctx context.Context, connection IOStreamer, pro 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: @@ -35392,46 +31737,6 @@ func (proxy *Proxy) connectProxy(ctx context.Context, connection IOStreamer, pro 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: @@ -35544,13 +31849,14 @@ func ProxyGetDefaultForProtocol(protocol string) *Proxy { return _proxy } -// ProxyResolver provides synchronous and asynchronous network proxy -// resolution. Resolver is used within Client through the method -// g_socket_connectable_proxy_enumerate(). +// ProxyResolver: GProxyResolver provides synchronous and asynchronous network +// proxy resolution. GProxyResolver is used within gio.SocketClient through the +// method gio.SocketConnectable.ProxyEnumerate(). // -// Implementations of Resolver based on libproxy and GNOME settings can be found -// in glib-networking. GIO comes with an implementation for use inside Flatpak -// portals. +// 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(). @@ -35572,8 +31878,6 @@ type ProxyResolverer interface { // 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) @@ -35618,8 +31922,8 @@ func (resolver *ProxyResolver) IsSupported() bool { // 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. +// ://[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 @@ -35684,41 +31988,6 @@ func (resolver *ProxyResolver) Lookup(ctx context.Context, uri string) ([]string 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. @@ -35799,8 +32068,8 @@ func (resolver *ProxyResolver) isSupported() bool { // 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. +// ://[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 @@ -35868,44 +32137,6 @@ func (resolver *ProxyResolver) lookup(ctx context.Context, uri string) ([]string 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. @@ -35977,23 +32208,24 @@ func ProxyResolverGetDefault() *ProxyResolver { return _proxyResolver } -// RemoteActionGroup interface is implemented by Group instances that either -// transmit action invocations to other processes or receive action invocations -// in the local process from other processes. +// 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 Group -// used to activate actions: g_action_group_activate_action() and -// g_action_group_change_action_state(). These variants allow a "platform data" -// #GVariant to be specified: a dictionary providing context for the action +// 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). // -// BusActionGroup implements ActionGroup. This provides a mechanism to send -// platform data for action invocations over D-Bus. +// gio.DBusActionGroup implements GRemoteActionGroup. This provides a mechanism +// to send platform data for action invocations over D-Bus. // -// Additionally, g_dbus_connection_export_action_group() will check if the -// exported Group implements ActionGroup 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. +// 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(). @@ -36174,18 +32406,18 @@ func (remote *RemoteActionGroup) changeActionStateFull(actionName string, value, runtime.KeepAlive(platformData) } -// Seekable is implemented by streams (implementations of Stream or Stream) that -// support seeking. +// 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() -// 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 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() on -// a normal file. Seeking past the end and writing data will usually cause the -// stream to resize by introducing zero bytes. +// 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(). @@ -36329,7 +32561,8 @@ func (seekable *Seekable) Seek(ctx context.Context, offset int64, typ glib.SeekT // // The function returns the following values: // -// - gint64: offset from the beginning of the buffer. +// - 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 @@ -36499,7 +32732,8 @@ func (seekable *Seekable) seek(ctx context.Context, offset int64, typ glib.SeekT // // The function returns the following values: // -// - gint64: offset from the beginning of the buffer. +// - 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 @@ -36565,9 +32799,10 @@ func (seekable *Seekable) truncateFn(ctx context.Context, offset int64) error { } // SocketConnectable objects that describe one or more potential -// socket endpoints implement Connectable. Callers can then use -// g_socket_connectable_enumerate() to get a AddressEnumerator to try out each -// socket address in turn until one succeeds, as shown in the sample code below. +// 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, @@ -36878,6 +33113,8 @@ func (connectable *SocketConnectable) str() string { } // 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(). @@ -37289,8 +33526,8 @@ func TLSBackendGetDefault() *TLSBackend { return _tlsBackend } -// TLSClientConnection is the client-side subclass of Connection, representing a -// client-side TLS connection. +// 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(). @@ -37436,7 +33673,12 @@ func (conn *TLSClientConnection) UseSSL3() bool { return _ok } -// ValidationFlags gets conn's validation flags. +// 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: // @@ -37510,6 +33752,11 @@ func (conn *TLSClientConnection) SetUseSSL3(useSsl3 bool) { // 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. @@ -37616,9 +33863,9 @@ func NewTLSClientConnection(baseIoStream IOStreamer, serverIdentity SocketConnec type TLSFileDatabaseOverrider interface { } -// TLSFileDatabase is implemented by Database objects which load their -// certificate information from a file. It is an interface which TLS library -// specific subtypes implement. +// 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(). @@ -37702,8 +33949,8 @@ func NewTLSFileDatabase(anchors string) (*TLSFileDatabase, error) { type TLSServerConnectionOverrider interface { } -// TLSServerConnection is the server-side subclass of Connection, representing a -// server-side TLS connection. +// 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(). @@ -37792,37 +34039,44 @@ func NewTLSServerConnection(baseIoStream IOStreamer, certificate TLSCertificater return _tlsServerConnection, _goerr } -// Volume interface represents user-visible objects that can be mounted. Note, -// when porting from GnomeVFS, #GVolume is the moral equivalent of VFSDrive. +// 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 Result and #GTask. To mount a -// #GVolume, first call g_volume_mount() with (at least) the #GVolume instance, -// optionally a Operation object and a ReadyCallback. +// 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 Operation if automounting -// all volumes when a desktop session starts since it's not desirable to put up -// a lot of dialogs asking for credentials. +// 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 Result instance will be passed to the callback. -// That callback should then call g_volume_mount_finish() with the #GVolume -// instance and the Result data to see if the operation was completed -// successfully. If an error is present when g_volume_mount_finish() is called, -// then it will be filled with any error information. +// 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 -// commandline). For this purpose, GIO allows to obtain an 'identifier' for +// 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: -// VOLUME_IDENTIFIER_KIND_UUID, VOLUME_IDENTIFIER_KIND_LABEL, etc. Use -// g_volume_get_identifier() to obtain an identifier for a volume. +// G_VOLUME_IDENTIFIER_KIND_UUID, G_VOLUME_IDENTIFIER_KIND_LABEL, etc. Use +// gio.Volume.GetIdentifier() to obtain an identifier for a volume. // -// Note that 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 VOLUME_IDENTIFIER_KIND_UNIX_DEVICE identifier, which can be used to obtain a hal device by means of libhal_manager_find_device_string_match(). +// 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(). @@ -37843,15 +34097,11 @@ type Volumer interface { 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-identifier] + // 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 @@ -37863,8 +34113,8 @@ type Volumer interface { 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 + // Mount gets the mount for the volume. + Mount() *Mount // Name gets the name of volume. Name() string // SortKey gets the sort key for volume, if any. @@ -37873,8 +34123,6 @@ type Volumer interface { 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 @@ -37957,43 +34205,6 @@ func (volume *Volume) CanMount() bool { 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. @@ -38024,47 +34235,6 @@ func (volume *Volume) EjectFinish(result AsyncResulter) error { 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. @@ -38093,7 +34263,7 @@ func (volume *Volume) EjectWithOperationFinish(result AsyncResulter) error { return _goerr } -// EnumerateIdentifiers gets the kinds of [identifiers][volume-identifier] +// EnumerateIdentifiers gets the kinds of identifiers (#volume-identifiers) // that volume has. Use g_volume_get_identifier() to obtain the identifiers // themselves. // @@ -38215,7 +34385,7 @@ func (volume *Volume) Icon() *Icon { } // Identifier gets the identifier of the given kind for volume. See the -// [introduction][volume-identifier] for more information about volume +// introduction (#volume-identifiers) for more information about volume // identifiers. // // The function takes the following parameters: @@ -38249,13 +34419,13 @@ func (volume *Volume) Identifier(kind string) string { return _utf8 } -// GetMount gets the mount for the volume. +// 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) GetMount() *Mount { +func (volume *Volume) Mount() *Mount { var _arg0 *C.GVolume // out var _cret *C.GMount // in @@ -38369,47 +34539,6 @@ func (volume *Volume) UUID() string { 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. @@ -38517,6 +34646,7 @@ func (volume *Volume) canMount() bool { 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 @@ -38529,46 +34659,6 @@ func (volume *Volume) changed() { 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. @@ -38602,50 +34692,6 @@ func (volume *Volume) ejectFinish(result AsyncResulter) error { 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. @@ -38677,7 +34723,7 @@ func (volume *Volume) ejectWithOperationFinish(result AsyncResulter) error { return _goerr } -// enumerateIdentifiers gets the kinds of [identifiers][volume-identifier] +// enumerateIdentifiers gets the kinds of identifiers (#volume-identifiers) // that volume has. Use g_volume_get_identifier() to obtain the identifiers // themselves. // @@ -38811,7 +34857,7 @@ func (volume *Volume) icon() *Icon { } // Identifier gets the identifier of the given kind for volume. See the -// [introduction][volume-identifier] for more information about volume +// introduction (#volume-identifiers) for more information about volume // identifiers. // // The function takes the following parameters: @@ -39018,50 +35064,9 @@ func (volume *Volume) mountFinish(result AsyncResulter) error { 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 @@ -39100,21 +35105,49 @@ func (volume *Volume) shouldAutomount() bool { return _ok } -// AppInfoMonitor is a very simple object used for monitoring the app info -// database for changes (ie: newly installed or removed applications). +// 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. // -// Call g_app_info_monitor_get() to get a InfoMonitor and connect to the -// "changed" signal. +// 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 Info APIs in response to the change -// signal, deferring these until the time that the data is actually required. -// The exception to this case is when application information is actually -// being displayed on the screen (eg: 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. +// 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 @@ -39134,8 +35167,8 @@ func marshalAppInfoMonitor(p uintptr) (interface{}, error) { return wrapAppInfoMonitor(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// ConnectChanged: signal emitted when the app info database for changes (ie: -// newly installed or removed applications). +// 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) } @@ -39147,6 +35180,10 @@ func (v *AppInfoMonitor) ConnectChanged(f func()) coreglib.SignalHandle { // 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. // @@ -39181,16 +35218,26 @@ type AppLaunchContextOverrides struct { // - utf8 (optional): display string for the display. Display func(info AppInfor, files []Filer) string // StartupNotifyID initiates startup notification for the application and - // returns the DESKTOP_STARTUP_ID for the launched operation, if supported. + // 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). // - // Startup notification IDs are defined in the - // FreeDesktop.Org Startup Notifications standard + // 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 of #GFile objects. + // - files of #GFile objects. // // The function returns the following values: // @@ -39210,6 +35257,11 @@ type AppLaunchContextOverrides struct { // // - info // - platformData + LaunchStarted func(info AppInfor, platformData *glib.Variant) + // The function takes the following parameters: + // + // - info + // - platformData Launched func(info AppInfor, platformData *glib.Variant) } @@ -39218,6 +35270,7 @@ func defaultAppLaunchContextOverrides(v *AppLaunchContext) AppLaunchContextOverr Display: v.display, StartupNotifyID: v.startupNotifyID, LaunchFailed: v.launchFailed, + LaunchStarted: v.launchStarted, Launched: v.launched, } } @@ -39258,6 +35311,10 @@ func initAppLaunchContextClass(gclass unsafe.Pointer, overrides AppLaunchContext 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) } @@ -39281,15 +35338,53 @@ func marshalAppLaunchContext(p uintptr) (interface{}, error) { // 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. +// 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) } @@ -39394,16 +35489,25 @@ func (context *AppLaunchContext) Environment() []string { } // StartupNotifyID initiates startup notification for the application and -// returns the DESKTOP_STARTUP_ID for the launched operation, if supported. +// 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). // -// Startup notification IDs are defined in the -// FreeDesktop.Org Startup Notifications standard +// 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 of #GFile objects. +// - files of #GFile objects. // // The function returns the following values: // @@ -39551,16 +35655,25 @@ func (context *AppLaunchContext) display(info AppInfor, files []Filer) string { } // startupNotifyID initiates startup notification for the application and -// returns the DESKTOP_STARTUP_ID for the launched operation, if supported. +// returns the XDG_ACTIVATION_TOKEN or DESKTOP_STARTUP_ID for the launched +// operation, if supported. // -// Startup notification IDs are defined in the -// FreeDesktop.Org Startup Notifications standard +// 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 of #GFile objects. +// - files of #GFile objects. // // The function returns the following values: // @@ -39624,6 +35737,28 @@ func (context *AppLaunchContext) launchFailed(startupNotifyId string) { 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 @@ -39654,23 +35789,49 @@ type ApplicationOverrides struct { // emitted in the primary instance. // // The application must be registered before calling this function. - Activate func() + 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 func(platformData *glib.Variant) - BeforeEmit func(platformData *glib.Variant) - CommandLine func(commandLine *ApplicationCommandLine) int + // 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) + 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 func() bool + // 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 @@ -39690,11 +35851,21 @@ type ApplicationOverrides struct { // // - files: array of #GFiles to open. // - hint (or ""), but never NULL. - Open func(files []Filer, hint string) + 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 func() - Shutdown func() - Startup 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 { @@ -39716,17 +35887,19 @@ func defaultApplicationOverrides(v *Application) ApplicationOverrides { } } -// Application is the foundation of an application. It wraps some low-level +// 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 Application or Application. In +// 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 +// GApplication provides convenient life-cycle management by maintaining a "use // count" for the primary application instance. The use count can be changed -// using g_application_hold() and g_application_release(). If it drops to zero, -// the application exits. Higher-level classes such as Application employ the -// use count to ensure that the application stays alive as long as it has any -// opened windows. +// 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 @@ -39738,23 +35911,23 @@ func defaultApplicationOverrides(v *Application) ApplicationOverrides { // 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 +// 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 +// Instead, the main() function of a GApplication should do very little more // than instantiating the application instance, possibly connecting signal -// handlers, then calling g_application_run(). All checks for uniqueness +// 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 -// g_application_run() promptly returns. See the code examples below. +// 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 of a D-Bus well-known bus name +// 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 -// g_application_id_is_valid(). +// 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 @@ -39765,17 +35938,21 @@ func defaultApplicationOverrides(v *Application) ApplicationOverrides { // 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 g_application_register()). -// Unfortunately, this means that you cannot use g_application_get_is_remote() -// to decide if you want to register object paths. -// -// GApplication also implements the Group and Map interfaces and lets you easily -// export actions by adding them with g_action_map_add_action(). When invoking -// an action by calling g_action_group_activate_action() on the application, it -// is always invoked in the primary instance. The actions are also exported on -// the session bus, and GIO provides the BusActionGroup wrapper to conveniently -// access them remotely. GIO provides a BusMenuModel wrapper for remote access -// to exported Models. +// 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: // @@ -39787,43 +35964,44 @@ func defaultApplicationOverrides(v *Application) ApplicationOverrides { // // - via activating an action // -// The #GApplication::startup signal lets you handle the application +// 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 #GVariant dictionary +// to the primary instance, in the form of a glib.Variant dictionary // mapping strings to variants. To use platform data, override the -// before_emit or after_emit virtual functions in your #GApplication -// subclass. When dealing with CommandLine objects, the platform data -// is directly available via g_application_command_line_get_cwd(), -// g_application_command_line_get_environ() and -// g_application_command_line_get_platform_data(). +// 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 -// add_platform_data virtual function. For instance, Application adds startup -// notification data in this way. -// -// To parse commandline arguments you may handle the #GApplication::command-line -// signal or override the local_command_line() vfunc, to parse them in either +// 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://git.gnome.org/browse/glib/tree/gio/tests/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://git.gnome.org/browse/glib/tree/gio/tests/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://git.gnome.org/browse/glib/tree/gio/tests/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 @@ -40127,8 +36305,10 @@ func (application *Application) AddMainOption(longName string, shortName byte, f // 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. This "packing" +// 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 @@ -40177,7 +36357,7 @@ func (application *Application) AddMainOption(longName string, shortName byte, f // // The function takes the following parameters: // -// - entries: a NULL-terminated list of Entrys. +// - entries: the main options for the application. func (application *Application) AddMainOptionEntries(entries []glib.OptionEntry) { var _arg0 *C.GApplication // out var _arg1 *C.GOptionEntry // out @@ -40513,10 +36693,33 @@ func (application *Application) ResourceBasePath() string { 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 +// 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(). @@ -40538,6 +36741,8 @@ func (application *Application) Hold() { // 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 @@ -40720,8 +36925,8 @@ func (application *Application) Release() { // 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][gapplication-example-cmdline2] for an -// example. +// [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 @@ -40816,6 +37021,8 @@ func (application *Application) Run(argv []string) int { // 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. @@ -41074,6 +37281,28 @@ func (application *Application) SetResourceBasePath(resourcePath string) { 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(). @@ -41161,6 +37390,8 @@ func (application *Application) activate() { 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 @@ -41176,6 +37407,9 @@ func (application *Application) addPlatformData(builder *glib.VariantBuilder) { 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 @@ -41191,6 +37425,9 @@ func (application *Application) afterEmit(platformData *glib.Variant) { 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 @@ -41206,6 +37443,8 @@ func (application *Application) beforeEmit(platformData *glib.Variant) { 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 @@ -41228,6 +37467,14 @@ func (application *Application) commandLine(commandLine *ApplicationCommandLine) 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 @@ -41260,6 +37507,10 @@ func (application *Application) dBusRegister(connection *DBusConnection, objectP 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 @@ -41283,6 +37534,8 @@ func (application *Application) dBusUnregister(connection *DBusConnection, objec 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 @@ -41305,6 +37558,7 @@ func (application *Application) handleLocalOptions(options *glib.VariantDict) in 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 @@ -41373,6 +37627,9 @@ func (application *Application) open(files []Filer, hint string) { 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 @@ -41385,6 +37642,9 @@ func (application *Application) quitMainloop() { 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 @@ -41397,6 +37657,8 @@ func (application *Application) runMainloop() { 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 @@ -41409,6 +37671,7 @@ func (application *Application) shutdown() { 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 @@ -41522,6 +37785,21 @@ func ApplicationIDIsValid(applicationId string) bool { // 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 @@ -41535,22 +37813,47 @@ type ApplicationCommandLineOverrides struct { // The function returns the following values: // // - inputStream (optional) for stdin. - Stdin func() InputStreamer - PrintLiteral func(message string) + 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 represents a command-line invocation of -// an application. It is created by #GApplication and emitted in the -// #GApplication::command-line signal and virtual function. +// 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: @@ -41558,29 +37861,115 @@ func defaultApplicationCommandLineOverrides(v *ApplicationCommandLine) Applicati // 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 Context command-line parsing API, -// with the g_application_command_line_get_arguments() function. See +// 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. The lifecycle of the -// originally-invoked process is tied to the lifecycle of this object (ie: -// the process exits when the last reference is dropped). +// The exit status of the originally-invoked process may be set and messages can +// be printed to stdout or stderr of that process. // -// The main use for CommandLine (and the #GApplication::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. +// 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 -// #GApplication::command-line handler. The launching instance exits once 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) // { @@ -41612,13 +38001,13 @@ func defaultApplicationCommandLineOverrides(v *ApplicationCommandLine) Applicati // } // // In this example the commandline is not completely handled before the -// #GApplication::command-line handler returns. Instead, we keep a reference -// to the CommandLine 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. +// 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://git.gnome.org/browse/glib/tree/gio/tests/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 @@ -41640,6 +38029,10 @@ func init() { 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) } @@ -41702,6 +38095,29 @@ func (cmdline *ApplicationCommandLine) CreateFileForArg(arg string) *File { 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 @@ -41863,7 +38279,7 @@ func (cmdline *ApplicationCommandLine) IsRemote() bool { return _ok } -// OptionsDict gets the options there were passed to +// 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 @@ -41874,6 +38290,9 @@ func (cmdline *ApplicationCommandLine) IsRemote() bool { // 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. @@ -41907,6 +38326,9 @@ func (cmdline *ApplicationCommandLine) OptionsDict() *glib.VariantDict { // 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: @@ -42021,6 +38443,52 @@ func (cmdline *ApplicationCommandLine) env(name string) string { 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. // @@ -42041,6 +38509,8 @@ func (cmdline *ApplicationCommandLine) env(name string) string { // 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. @@ -42056,6 +38526,32 @@ func (cmdline *ApplicationCommandLine) SetExitStatus(exitStatus int) { 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 @@ -42103,6 +38599,16 @@ func (cmdline *ApplicationCommandLine) stdin() InputStreamer { 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 @@ -42119,6 +38625,16 @@ func (cmdline *ApplicationCommandLine) printLiteral(message string) { 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 @@ -42194,17 +38710,17 @@ func defaultBufferedInputStreamOverrides(v *BufferedInputStream) BufferedInputSt // BufferedInputStream: buffered input stream implements InputStream and // provides for buffered reads. // -// By default, InputStream's buffer size is set at 4 kilobytes. +// By default, GBufferedInputStream's buffer size is set at 4 kilobytes. // -// To create a buffered input stream, use g_buffered_input_stream_new(), -// or g_buffered_input_stream_new_sized() to specify the buffer's size at +// 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 -// g_buffered_input_stream_get_buffer_size(). To change the size of a buffered -// input stream's buffer, use g_buffered_input_stream_set_buffer_size(). Note -// that the buffer's size cannot be reduced below the size of the data within -// the buffer. +// 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 @@ -42380,48 +38896,6 @@ func (stream *BufferedInputStream) Fill(ctx context.Context, count int) (int, er 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: @@ -42695,51 +39169,6 @@ func (stream *BufferedInputStream) fill(ctx context.Context, count int) (int, er 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: @@ -42784,20 +39213,20 @@ func defaultBufferedOutputStreamOverrides(v *BufferedOutputStream) BufferedOutpu return BufferedOutputStreamOverrides{} } -// BufferedOutputStream: buffered output stream implements OutputStream and -// provides for buffered writes. +// BufferedOutputStream: buffered output stream implements +// gio.FilterOutputStream and provides for buffered writes. // -// By default, OutputStream's buffer size is set at 4 kilobytes. +// By default, GBufferedOutputStream's buffer size is set at 4 kilobytes. // -// To create a buffered output stream, use g_buffered_output_stream_new(), -// or g_buffered_output_stream_new_sized() to specify the buffer's size at +// 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 -// g_buffered_output_stream_get_buffer_size(). To change the size of a buffered -// output stream's buffer, use g_buffered_output_stream_set_buffer_size(). -// Note that the buffer's size cannot be reduced below the size of the data -// within the buffer. +// 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 @@ -42981,8 +39410,8 @@ func (stream *BufferedOutputStream) SetBufferSize(size uint) { runtime.KeepAlive(size) } -// BytesIcon specifies an image held in memory in a common format (usually png) -// to be used as icon. +// 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 @@ -43076,8 +39505,10 @@ func defaultCancellableOverrides(v *Cancellable) CancellableOverrides { } } -// Cancellable is a thread-safe operation cancellation stack used throughout GIO -// to allow for cancellation of synchronous and asynchronous operations. +// 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 @@ -43485,7 +39916,8 @@ func defaultCharsetConverterOverrides(v *CharsetConverter) CharsetConverterOverr return CharsetConverterOverrides{} } -// CharsetConverter is an implementation of #GConverter based on GIConv. +// CharsetConverter: GCharsetConverter is an implementation of gio.Converter +// based on glib.IConv. type CharsetConverter struct { _ [0]func() // equal guard *coreglib.Object @@ -43637,10 +40069,10 @@ func defaultConverterInputStreamOverrides(v *ConverterInputStream) ConverterInpu return ConverterInputStreamOverrides{} } -// ConverterInputStream: converter input stream implements Stream and allows -// conversion of data of various types during reading. +// ConverterInputStream: converter input stream implements gio.InputStream and +// allows conversion of data of various types during reading. // -// As of GLib 2.34, InputStream implements InputStream. +// As of GLib 2.34, GConverterInputStream implements gio.PollableInputStream. type ConverterInputStream struct { _ [0]func() // equal guard FilterInputStream @@ -43754,10 +40186,10 @@ func defaultConverterOutputStreamOverrides(v *ConverterOutputStream) ConverterOu return ConverterOutputStreamOverrides{} } -// ConverterOutputStream: converter output stream implements Stream and allows -// conversion of data of various types during reading. +// ConverterOutputStream: converter output stream implements gio.OutputStream +// and allows conversion of data of various types during reading. // -// As of GLib 2.34, OutputStream implements OutputStream. +// As of GLib 2.34, GConverterOutputStream implements gio.PollableOutputStream. type ConverterOutputStream struct { _ [0]func() // equal guard FilterOutputStream @@ -43863,20 +40295,23 @@ func (converterStream *ConverterOutputStream) Converter() *Converter { return _converter } -// Credentials type is a reference-counted wrapper for native credentials. This -// information is typically used for identifying, authenticating and authorizing -// other processes. +// 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. g_socket_get_credentials(). +// 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 -// CredentialsMessage, g_unix_connection_send_credentials() and -// g_unix_connection_receive_credentials() for details. +// 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 for details. This corresponds to G_CREDENTIALS_TYPE_LINUX_UCRED. +// 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 @@ -43893,6 +40328,9 @@ func (converterStream *ConverterOutputStream) Converter() *Converter { // // 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 @@ -44008,9 +40446,11 @@ func (credentials *Credentials) String() string { return _utf8 } -// DBusActionGroup is an implementation of the Group interface that can -// be used as a proxy for an action group that is exported over D-Bus with -// g_dbus_connection_export_action_group(). +// 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 @@ -44087,20 +40527,43 @@ func DBusActionGroupGet(connection *DBusConnection, busName, objectPath string) return _dBusActionGroup } -// DBusAuthObserver type provides a mechanism for participating in how a -// BusServer (or a BusConnection) authenticates remote peers. Simply instantiate -// a BusAuthObserver and connect to the signals you are interested in. Note that -// new signals may be added in the future +// 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 BusServer or server-side BusConnection will allow any +// 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, @@ -44236,53 +40699,57 @@ func (observer *DBusAuthObserver) AuthorizeAuthenticatedPeer(stream IOStreamer, return _ok } -// DBusConnection 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 OStream. +// 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 g_bus_own_name(), -// g_bus_watch_name() or g_dbus_proxy_new_for_bus() APIs. +// 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, BusConnection's methods may be called -// from any thread. This is so that g_bus_get() and g_bus_get_sync() can safely -// return the same BusConnection when called from any thread. -// -// Most of the ways to obtain a BusConnection automatically initialize it (i.e. -// connect to D-Bus): for instance, g_dbus_connection_new() and g_bus_get(), -// and the synchronous versions of those methods, give you an initialized -// connection. Language bindings for GIO should use g_initable_new() or -// g_async_initable_new_async(), which also initialize the connection. -// -// If you construct an uninitialized BusConnection, such as via g_object_new(), -// you must initialize it via g_initable_init() or g_async_initable_init_async() -// before using its methods or properties. Calling methods or accessing -// properties on a BusConnection 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 BusConnection is to free it with g_object_unref(). +// 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://git.gnome.org/browse/glib/tree/gio/tests/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://git.gnome.org/browse/glib/tree/gio/tests/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://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-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://git.gnome.org/browse/glib/tree/gio/tests/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 @@ -44580,122 +41047,6 @@ func (connection *DBusConnection) AddFilter(filterFunction DBusMessageFilterFunc 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: @@ -44855,56 +41206,6 @@ func (connection *DBusConnection) CallSync(ctx context.Context, busName, objectP 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: @@ -45087,6 +41388,10 @@ func (connection *DBusConnection) ExportActionGroup(objectPath string, actionGro // 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. // @@ -45126,48 +41431,6 @@ func (connection *DBusConnection) ExportMenuModel(objectPath string, menu MenuMo 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: @@ -45596,89 +41859,6 @@ func (connection *DBusConnection) SendMessage(message *DBusMessage, flags DBusSe 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(). // @@ -45834,8 +42014,8 @@ func (connection *DBusConnection) SetExitOnClose(exitOnClose bool) { runtime.KeepAlive(exitOnClose) } -// SignalSubscribe subscribes to signals on connection and invokes callback with -// a whenever the signal is received. Note that callback will be invoked in the +// 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. // @@ -45963,7 +42143,9 @@ func (connection *DBusConnection) SignalSubscribe(sender, interfaceName, member, // 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. +// 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: // @@ -46100,128 +42282,6 @@ func (connection *DBusConnection) UnregisterSubtree(registrationId uint) bool { 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 @@ -46231,7 +42291,9 @@ type DBusInterfaceSkeletonOverrides struct { // 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() + 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_. @@ -46247,6 +42309,15 @@ type DBusInterfaceSkeletonOverrides struct { // - 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 { @@ -46255,6 +42326,7 @@ func defaultDBusInterfaceSkeletonOverrides(v *DBusInterfaceSkeleton) DBusInterfa GAuthorizeMethod: v.gAuthorizeMethod, Info: v.info, Properties: v.properties, + Vtable: v.vtable, } } @@ -46310,6 +42382,10 @@ func initDBusInterfaceSkeletonClass(gclass unsafe.Pointer, overrides DBusInterfa 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) @@ -46581,6 +42657,30 @@ func (interface_ *DBusInterfaceSkeleton) Properties() *glib.Variant { 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: @@ -46680,6 +42780,8 @@ func (interface_ *DBusInterfaceSkeleton) flush() { 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 @@ -46767,9 +42869,36 @@ func (interface_ *DBusInterfaceSkeleton) properties() *glib.Variant { return _variant } -// DBusMenuModel is an implementation of Model that can be used -// as a proxy for a menu model that is exported over D-Bus with -// g_dbus_connection_export_menu_model(). +// 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 @@ -46837,7 +42966,7 @@ func DBusMenuModelGet(connection *DBusConnection, busName, objectPath string) *D } // DBusMessage: type for representing D-Bus messages that can be sent or -// received on a BusConnection. +// received on a gio.DBusConnection. type DBusMessage struct { _ [0]func() // equal guard *coreglib.Object @@ -47032,6 +43161,9 @@ func (message *DBusMessage) Copy() (*DBusMessage, error) { // 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 @@ -47054,6 +43186,32 @@ func (message *DBusMessage) Arg0() string { 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: @@ -47442,6 +43600,8 @@ func (message *DBusMessage) Serial() uint32 { // 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. @@ -47566,7 +43726,7 @@ func (methodCallMessage *DBusMessage) NewMethodReply() *DBusMessage { // // The function returns the following values: // -// - utf8: string that should be freed with g_free(). +// - 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 @@ -47970,13 +44130,13 @@ func DBusMessageBytesNeeded(blob []byte) (int, error) { return _gssize, _goerr } -// DBusMethodInvocation instances of the BusMethodInvocation class are used +// 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 BusMethodInvocation object is to receive it as an -// argument to the handle_method_call() function in a BusInterfaceVTable that -// was passed to g_dbus_connection_register_object(). +// 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 @@ -48370,6 +44530,9 @@ func (invocation *DBusMethodInvocation) ReturnValue(parameters *glib.Variant) { // 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 @@ -48386,69 +44549,73 @@ func defaultDBusObjectManagerClientOverrides(v *DBusObjectManagerClient) DBusObj } } -// DBusObjectManagerClient is used to create, monitor and delete object -// proxies for remote objects exported by a BusObjectManagerServer -// (or any code implementing the org.freedesktop.DBus.ObjectManager +// 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 -// BusObjectManager::object-added and BusObjectManager::object-removed -// signals and inspect the BusObjectProxy objects returned by -// g_dbus_object_manager_get_objects(). -// -// If the name for a BusObjectManagerClient 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 +// 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, BusObjectManagerClient object +// owner for the requested name. In this case, GDBusObjectManagerClient object // construction still succeeds but there will be no object proxies (e.g. -// g_dbus_object_manager_get_objects() returns the empty list) and the -// BusObjectManagerClient:name-owner property is NULL. +// 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) – BusObjectManagerClient handles this -// case too; simply connect to the #GObject::notify signal to watch for -// changes on the BusObjectManagerClient:name-owner property. When the name -// owner vanishes, the behavior is that BusObjectManagerClient:name-owner -// is set to NULL (this includes emission of the #GObject::notify signal) -// and then BusObjectManager::object-removed signals are synthesized for all -// currently existing object proxies. Since BusObjectManagerClient: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 BusObjectManager. Similarly, when a new name owner appears, -// BusObjectManager::object-added signals are synthesized while -// BusObjectManagerClient:name-owner is still NULL. Only when all object proxies -// have been added, the BusObjectManagerClient:name-owner is set to the new name -// owner (this includes emission of the #GObject::notify signal). Furthermore, -// you are guaranteed that BusObjectManagerClient:name-owner will alternate +// 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, BusObjectManagerClient is used to obtain BusProxy instances. -// All signals (including the org.freedesktop.DBus.Properties::PropertiesChanged -// signal) delivered to BusProxy 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 -// BusObjectProxy and BusProxy objects, the BusObject::interface-added, -// BusObject::interface-removed, BusProxy::g-properties-changed and -// BusProxy::g-signal signals are also emitted on the BusObjectManagerClient -// instance managing these objects. The signals emitted are -// BusObjectManager::interface-added, BusObjectManager::interface-removed, -// BusObjectManagerClient::interface-proxy-properties-changed and -// BusObjectManagerClient::interface-proxy-signal. -// -// Note that all callbacks and signals are emitted in the [thread-default main -// context][g-main-context-push-thread-default] that the BusObjectManagerClient -// object was constructed in. Additionally, the BusObjectProxy and BusProxy -// objects originating from the BusObjectManagerClient object will be created -// in the same context and, consequently, will deliver signals in the same main -// loop. +// 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 @@ -48596,149 +44763,6 @@ func NewDBusObjectManagerClientForBusFinish(res AsyncResulter) (*DBusObjectManag return _dBusObjectManagerClient, _goerr } -// NewDBusObjectManagerClientForBusSync: like -// g_dbus_object_manager_client_new_sync() but takes a Type instead of a -// BusConnection. -// -// This is a synchronous failable constructor - the calling thread is blocked -// until a reply is received. See g_dbus_object_manager_client_new_for_bus() for -// the asynchronous version. -// -// The function takes the following parameters: -// -// - ctx (optional) or NULL. -// - busType: Type. -// - flags: zero or more flags from the BusObjectManagerClientFlags -// enumeration. -// - name: owner of the control object (unique or well-known name). -// - objectPath: object path of the control object. -// - getProxyTypeFunc (optional) function or NULL to always construct BusProxy -// proxies. -// -// The function returns the following values: -// -// - dBusObjectManagerClient: a BusObjectManagerClient object or NULL if error -// is set. Free with g_object_unref(). -func NewDBusObjectManagerClientForBusSync(ctx context.Context, busType BusType, flags DBusObjectManagerClientFlags, name, objectPath string, getProxyTypeFunc DBusProxyTypeFunc) (*DBusObjectManagerClient, error) { - var _arg8 *C.GCancellable // out - var _arg1 C.GBusType // out - var _arg2 C.GDBusObjectManagerClientFlags // out - var _arg3 *C.gchar // out - var _arg4 *C.gchar // out - var _arg5 C.GDBusProxyTypeFunc // out - var _arg6 C.gpointer - var _arg7 C.GDestroyNotify - var _cret *C.GDBusObjectManager // in - var _cerr *C.GError // in - - { - cancellable := gcancel.GCancellableFromContext(ctx) - defer runtime.KeepAlive(cancellable) - _arg8 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) - } - _arg1 = C.GBusType(busType) - _arg2 = C.GDBusObjectManagerClientFlags(flags) - _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(name))) - defer C.free(unsafe.Pointer(_arg3)) - _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) - defer C.free(unsafe.Pointer(_arg4)) - if getProxyTypeFunc != nil { - _arg5 = (*[0]byte)(C._gotk4_gio2_DBusProxyTypeFunc) - _arg6 = C.gpointer(gbox.Assign(getProxyTypeFunc)) - _arg7 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) - } - - _cret = C.g_dbus_object_manager_client_new_for_bus_sync(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, &_cerr) - runtime.KeepAlive(ctx) - runtime.KeepAlive(busType) - runtime.KeepAlive(flags) - runtime.KeepAlive(name) - runtime.KeepAlive(objectPath) - runtime.KeepAlive(getProxyTypeFunc) - - 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 -} - -// NewDBusObjectManagerClientSync creates a new BusObjectManagerClient object. -// -// This is a synchronous failable constructor - the calling thread is blocked -// until a reply is received. See g_dbus_object_manager_client_new() for the -// asynchronous version. -// -// The function takes the following parameters: -// -// - ctx (optional) or NULL. -// - connection: BusConnection. -// - flags: zero or more flags from the BusObjectManagerClientFlags -// enumeration. -// - name (optional): owner of the control object (unique or well-known name), -// or NULL when not using a message bus connection. -// - objectPath: object path of the control object. -// - getProxyTypeFunc (optional) function or NULL to always construct BusProxy -// proxies. -// -// The function returns the following values: -// -// - dBusObjectManagerClient: a BusObjectManagerClient object or NULL if error -// is set. Free with g_object_unref(). -func NewDBusObjectManagerClientSync(ctx context.Context, connection *DBusConnection, flags DBusObjectManagerClientFlags, name, objectPath string, getProxyTypeFunc DBusProxyTypeFunc) (*DBusObjectManagerClient, error) { - var _arg8 *C.GCancellable // out - var _arg1 *C.GDBusConnection // out - var _arg2 C.GDBusObjectManagerClientFlags // out - var _arg3 *C.gchar // out - var _arg4 *C.gchar // out - var _arg5 C.GDBusProxyTypeFunc // out - var _arg6 C.gpointer - var _arg7 C.GDestroyNotify - var _cret *C.GDBusObjectManager // in - var _cerr *C.GError // in - - { - cancellable := gcancel.GCancellableFromContext(ctx) - defer runtime.KeepAlive(cancellable) - _arg8 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) - } - _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) - _arg2 = C.GDBusObjectManagerClientFlags(flags) - if name != "" { - _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(name))) - defer C.free(unsafe.Pointer(_arg3)) - } - _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) - defer C.free(unsafe.Pointer(_arg4)) - if getProxyTypeFunc != nil { - _arg5 = (*[0]byte)(C._gotk4_gio2_DBusProxyTypeFunc) - _arg6 = C.gpointer(gbox.Assign(getProxyTypeFunc)) - _arg7 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) - } - - _cret = C.g_dbus_object_manager_client_new_sync(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, &_cerr) - runtime.KeepAlive(ctx) - runtime.KeepAlive(connection) - runtime.KeepAlive(flags) - runtime.KeepAlive(name) - runtime.KeepAlive(objectPath) - runtime.KeepAlive(getProxyTypeFunc) - - 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: @@ -48832,6 +44856,9 @@ func (manager *DBusObjectManagerClient) NameOwner() string { return _utf8 } +// interfaceProxySignal: signal class handler for the +// BusObjectManagerClient::interface-proxy-signal signal. +// // The function takes the following parameters: // // - objectProxy @@ -48868,134 +44895,6 @@ func (manager *DBusObjectManagerClient) interfaceProxySignal(objectProxy *DBusOb runtime.KeepAlive(parameters) } -// NewDBusObjectManagerClient: asynchronously creates a new -// BusObjectManagerClient object. -// -// This is an asynchronous failable constructor. When the result -// is ready, 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_object_manager_client_new_finish() -// to get the result. See g_dbus_object_manager_client_new_sync() for the -// synchronous version. -// -// The function takes the following parameters: -// -// - ctx (optional) or NULL. -// - connection: BusConnection. -// - flags: zero or more flags from the BusObjectManagerClientFlags -// enumeration. -// - name: owner of the control object (unique or well-known name). -// - objectPath: object path of the control object. -// - getProxyTypeFunc (optional) function or NULL to always construct BusProxy -// proxies. -// - callback (optional) to call when the request is satisfied. -func NewDBusObjectManagerClient(ctx context.Context, connection *DBusConnection, flags DBusObjectManagerClientFlags, name, objectPath string, getProxyTypeFunc DBusProxyTypeFunc, callback AsyncReadyCallback) { - var _arg8 *C.GCancellable // out - var _arg1 *C.GDBusConnection // out - var _arg2 C.GDBusObjectManagerClientFlags // out - var _arg3 *C.gchar // out - var _arg4 *C.gchar // out - var _arg5 C.GDBusProxyTypeFunc // out - var _arg6 C.gpointer - var _arg7 C.GDestroyNotify - var _arg9 C.GAsyncReadyCallback // out - var _arg10 C.gpointer - - { - cancellable := gcancel.GCancellableFromContext(ctx) - defer runtime.KeepAlive(cancellable) - _arg8 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) - } - _arg1 = (*C.GDBusConnection)(unsafe.Pointer(coreglib.InternObject(connection).Native())) - _arg2 = C.GDBusObjectManagerClientFlags(flags) - _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(name))) - defer C.free(unsafe.Pointer(_arg3)) - _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) - defer C.free(unsafe.Pointer(_arg4)) - if getProxyTypeFunc != nil { - _arg5 = (*[0]byte)(C._gotk4_gio2_DBusProxyTypeFunc) - _arg6 = C.gpointer(gbox.Assign(getProxyTypeFunc)) - _arg7 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) - } - if callback != nil { - _arg9 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) - _arg10 = C.gpointer(gbox.AssignOnce(callback)) - } - - C.g_dbus_object_manager_client_new(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10) - runtime.KeepAlive(ctx) - runtime.KeepAlive(connection) - runtime.KeepAlive(flags) - runtime.KeepAlive(name) - runtime.KeepAlive(objectPath) - runtime.KeepAlive(getProxyTypeFunc) - runtime.KeepAlive(callback) -} - -// NewDBusObjectManagerClientForBus: like g_dbus_object_manager_client_new() but -// takes a Type instead of a BusConnection. -// -// This is an asynchronous failable constructor. When the result -// is ready, callback will be invoked in the [thread-default -// main loop][g-main-context-push-thread-default] of the -// thread you are calling this method from. You can then call -// g_dbus_object_manager_client_new_for_bus_finish() to get the result. See -// g_dbus_object_manager_client_new_for_bus_sync() for the synchronous version. -// -// The function takes the following parameters: -// -// - ctx (optional) or NULL. -// - busType: Type. -// - flags: zero or more flags from the BusObjectManagerClientFlags -// enumeration. -// - name: owner of the control object (unique or well-known name). -// - objectPath: object path of the control object. -// - getProxyTypeFunc (optional) function or NULL to always construct BusProxy -// proxies. -// - callback (optional) to call when the request is satisfied. -func NewDBusObjectManagerClientForBus(ctx context.Context, busType BusType, flags DBusObjectManagerClientFlags, name, objectPath string, getProxyTypeFunc DBusProxyTypeFunc, callback AsyncReadyCallback) { - var _arg8 *C.GCancellable // out - var _arg1 C.GBusType // out - var _arg2 C.GDBusObjectManagerClientFlags // out - var _arg3 *C.gchar // out - var _arg4 *C.gchar // out - var _arg5 C.GDBusProxyTypeFunc // out - var _arg6 C.gpointer - var _arg7 C.GDestroyNotify - var _arg9 C.GAsyncReadyCallback // out - var _arg10 C.gpointer - - { - cancellable := gcancel.GCancellableFromContext(ctx) - defer runtime.KeepAlive(cancellable) - _arg8 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) - } - _arg1 = C.GBusType(busType) - _arg2 = C.GDBusObjectManagerClientFlags(flags) - _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(name))) - defer C.free(unsafe.Pointer(_arg3)) - _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(objectPath))) - defer C.free(unsafe.Pointer(_arg4)) - if getProxyTypeFunc != nil { - _arg5 = (*[0]byte)(C._gotk4_gio2_DBusProxyTypeFunc) - _arg6 = C.gpointer(gbox.Assign(getProxyTypeFunc)) - _arg7 = (C.GDestroyNotify)((*[0]byte)(C.callbackDelete)) - } - if callback != nil { - _arg9 = (*[0]byte)(C._gotk4_gio2_AsyncReadyCallback) - _arg10 = C.gpointer(gbox.AssignOnce(callback)) - } - - C.g_dbus_object_manager_client_new_for_bus(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10) - runtime.KeepAlive(ctx) - runtime.KeepAlive(busType) - runtime.KeepAlive(flags) - runtime.KeepAlive(name) - runtime.KeepAlive(objectPath) - runtime.KeepAlive(getProxyTypeFunc) - runtime.KeepAlive(callback) -} - // DBusObjectManagerServerOverrides contains methods that are overridable. type DBusObjectManagerServerOverrides struct { } @@ -49004,8 +44903,9 @@ func defaultDBusObjectManagerServerOverrides(v *DBusObjectManagerServer) DBusObj return DBusObjectManagerServerOverrides{} } -// DBusObjectManagerServer is used to export BusObject instances -// using the standardized org.freedesktop.DBus.ObjectManager +// 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 @@ -49021,8 +44921,8 @@ func defaultDBusObjectManagerServerOverrides(v *DBusObjectManagerServer) DBusObj // It is supported, but not recommended, to export an object manager at the root // path, /. // -// See BusObjectManagerClient for the client-side code that is intended to -// be used with BusObjectManagerServer or any D-Bus object implementing the +// 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 @@ -49146,8 +45046,8 @@ func (manager *DBusObjectManagerServer) ExportUniquely(object *DBusObjectSkeleto // // The function returns the following values: // -// - dBusConnection object or NULL if manager isn't exported on a connection. -// The returned object should be freed with g_object_unref(). +// - 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 @@ -49159,7 +45059,9 @@ func (manager *DBusObjectManagerServer) Connection() *DBusConnection { var _dBusConnection *DBusConnection // out - _dBusConnection = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + if _cret != nil { + _dBusConnection = wrapDBusConnection(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + } return _dBusConnection } @@ -49257,9 +45159,10 @@ func defaultDBusObjectProxyOverrides(v *DBusObjectProxy) DBusObjectProxyOverride return DBusObjectProxyOverrides{} } -// DBusObjectProxy is an object used to represent a remote object with one or -// more D-Bus interfaces. Normally, you don't instantiate a BusObjectProxy -// yourself - typically BusObjectManagerClient is used to obtain it. +// 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 @@ -49354,6 +45257,9 @@ func (proxy *DBusObjectProxy) Connection() *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_ @@ -49367,11 +45273,11 @@ func defaultDBusObjectSkeletonOverrides(v *DBusObjectSkeleton) DBusObjectSkeleto } } -// DBusObjectSkeleton instance is essentially a group of D-Bus interfaces. -// The set of exported interfaces on the object may be dynamic and change at -// runtime. +// 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 BusObjectManager. +// This type is intended to be used with gio.DBusObjectManager. type DBusObjectSkeleton struct { _ [0]func() // equal guard *coreglib.Object @@ -49547,6 +45453,9 @@ func (object *DBusObjectSkeleton) SetObjectPath(objectPath string) { runtime.KeepAlive(objectPath) } +// authorizeMethod: signal class handler for the +// BusObjectSkeleton::authorize-method signal. +// // The function takes the following parameters: // // - interface_ @@ -49580,6 +45489,8 @@ func (object *DBusObjectSkeleton) authorizeMethod(interface_ DBusInterfaceSkelet // 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 @@ -49594,42 +45505,49 @@ func defaultDBusProxyOverrides(v *DBusProxy) DBusProxyOverrides { } } -// DBusProxy is a base class used for proxies to access a D-Bus interface on a -// remote object. A BusProxy can be constructed for both well-known and unique -// names. +// 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, BusProxy 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 BusProxyFlags when the proxy is created. +// 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 -// BusProxy:g-name-owner. Connect to the #GObject::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). -// -// The generic BusProxy::g-properties-changed and BusProxy::g-signal signals are -// not very convenient to work with. Therefore, the recommended way of working -// with proxies is to subclass BusProxy, and have more natural properties and -// signals in your derived class. This [example][gdbus-example-gdbus-codegen] -// shows how this can easily be done using the [gdbus-codegen][gdbus-codegen] -// tool. -// -// A BusProxy instance can be used from multiple threads but note that -// all signals (e.g. BusProxy::g-signal, BusProxy::g-properties-changed -// and #GObject::notify) are emitted in the [thread-default main -// context][g-main-context-push-thread-default] of the thread where the instance +// 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://git.gnome.org/browse/glib/tree/gio/tests/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 @@ -49700,6 +45618,10 @@ func (proxy *DBusProxy) ConnectGPropertiesChanged(f func(changedProperties *glib // 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) } @@ -49921,95 +45843,6 @@ func NewDBusProxySync(ctx context.Context, connection *DBusConnection, flags DBu 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: @@ -50350,9 +46183,12 @@ func (proxy *DBusProxy) InterfaceName() string { // 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: string owned by proxy. Do not free. +// - utf8 (optional): string owned by proxy. Do not free. func (proxy *DBusProxy) Name() string { var _arg0 *C.GDBusProxy // out var _cret *C.gchar // in @@ -50364,7 +46200,9 @@ func (proxy *DBusProxy) Name() string { var _utf8 string // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } return _utf8 } @@ -50513,6 +46351,8 @@ func (proxy *DBusProxy) SetInterfaceInfo(info *DBusInterfaceInfo) { runtime.KeepAlive(info) } +// gSignal: signal class handler for the BusProxy::g-signal signal. +// // The function takes the following parameters: // // - senderName @@ -50541,169 +46381,26 @@ func (proxy *DBusProxy) gSignal(senderName, signalName string, parameters *glib. 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 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. +// 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 g_bus_own_name(). +// 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://git.gnome.org/browse/glib/tree/gio/tests/gdbus-example-peer.c). -// -// Note that a minimal BusServer will accept connections from any peer. In many -// use-cases it will be necessary to add a BusAuthObserver that only accepts -// connections that have successfully authenticated as the same user that is -// running the BusServer. 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. +// (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 @@ -50828,6 +46525,8 @@ func NewDBusServerSync(ctx context.Context, address string, flags DBusServerFlag // (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. @@ -50868,7 +46567,7 @@ func (server *DBusServer) Flags() DBusServerFlags { return _dBusServerFlags } -// GUID gets the GUID for server. +// GUID gets the GUID for server, as provided to g_dbus_server_new_sync(). // // The function returns the following values: // @@ -50940,8 +46639,8 @@ func defaultDataInputStreamOverrides(v *DataInputStream) DataInputStreamOverride return DataInputStreamOverrides{} } -// DataInputStream: data input stream implements Stream and includes functions -// for reading structured data directly from a binary input stream. +// 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 @@ -51291,43 +46990,6 @@ func (stream *DataInputStream) ReadLine(ctx context.Context) (uint, []byte, erro 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. @@ -51678,59 +47340,6 @@ func (stream *DataInputStream) ReadUntil(ctx context.Context, stopChars string) 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(). // @@ -51790,8 +47399,6 @@ func (stream *DataInputStream) ReadUntilFinish(result AsyncResulter) (uint, stri // // - ctx (optional): optional #GCancellable object, NULL to ignore. // - stopChars characters to terminate the read. -// - stopCharsLen: length of stop_chars. May be -1 if stop_chars is -// nul-terminated. // // The function returns the following values: // @@ -51799,14 +47406,14 @@ func (stream *DataInputStream) ReadUntilFinish(result AsyncResulter) (uint, stri // - 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, stopCharsLen int) (uint, string, 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 // out - var _arg3 C.gsize // in - var _cret *C.char // in - var _cerr *C.GError // in + 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())) { @@ -51814,15 +47421,15 @@ func (stream *DataInputStream) ReadUpto(ctx context.Context, stopChars string, s defer runtime.KeepAlive(cancellable) _arg4 = (*C.GCancellable)(unsafe.Pointer(cancellable.Native())) } - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(stopChars))) + _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)) - _arg2 = C.gssize(stopCharsLen) _cret = C.g_data_input_stream_read_upto(_arg0, _arg1, _arg2, &_arg3, _arg4, &_cerr) runtime.KeepAlive(stream) runtime.KeepAlive(ctx) runtime.KeepAlive(stopChars) - runtime.KeepAlive(stopCharsLen) var _length uint // out var _utf8 string // out @@ -51838,59 +47445,6 @@ func (stream *DataInputStream) ReadUpto(ctx context.Context, stopChars string, s 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. -// - stopCharsLen: length of stop_chars. May be -1 if stop_chars is -// nul-terminated. -// - 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, stopCharsLen, ioPriority int, callback AsyncReadyCallback) { - var _arg0 *C.GDataInputStream // out - var _arg4 *C.GCancellable // out - var _arg1 *C.gchar // out - var _arg2 C.gssize // out - 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())) - } - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(stopChars))) - defer C.free(unsafe.Pointer(_arg1)) - _arg2 = C.gssize(stopCharsLen) - _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(stopCharsLen) - runtime.KeepAlive(ioPriority) - runtime.KeepAlive(callback) -} - // ReadUptoFinish: finish an asynchronous call started by // g_data_input_stream_read_upto_async(). // @@ -51985,8 +47539,8 @@ func defaultDataOutputStreamOverrides(v *DataOutputStream) DataOutputStreamOverr return DataOutputStreamOverrides{} } -// DataOutputStream: data output stream implements Stream and includes functions -// for writing data directly to an output stream. +// 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 @@ -52367,8 +47921,291 @@ func (stream *DataOutputStream) SetByteOrder(order DataStreamByteOrder) { runtime.KeepAlive(order) } -// Emblem is an implementation of #GIcon that supports having an emblem, -// which is an icon with additional properties. It can than be added to a Icon. +// 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. @@ -52501,12 +48338,12 @@ func defaultEmblemedIconOverrides(v *EmblemedIcon) EmblemedIconOverrides { return EmblemedIconOverrides{} } -// EmblemedIcon is an implementation of #GIcon that supports adding an -// emblem to an icon. Adding multiple emblems to an icon is ensured via -// g_emblemed_icon_add_emblem(). +// 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 Icon allows no control over the position of the emblems. See also -// #GEmblem for more information. +// 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 @@ -52716,18 +48553,19 @@ func defaultFileEnumeratorOverrides(v *FileEnumerator) FileEnumeratorOverrides { } } -// FileEnumerator allows you to operate on a set of #GFiles, returning a Info -// structure for each file enumerated (e.g. g_file_enumerate_children() will -// return a Enumerator for each of the children within a directory). +// 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 Enumerator, -// use g_file_enumerator_next_file() or its asynchronous version, -// g_file_enumerator_next_files_async(). Note that the asynchronous version will -// return a list of Infos, whereas the synchronous will only return the next -// file in the enumerator. +// 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 g_dir_read_name(). On Unix, when operating on local +// 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. @@ -52735,10 +48573,10 @@ func defaultFileEnumeratorOverrides(v *FileEnumerator) FileEnumeratorOverrides { // 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 Enumerator, use g_file_enumerator_close(), or its asynchronous -// version, g_file_enumerator_close_async(). Once a Enumerator is closed, -// no further actions may be performed on it, and it should be freed with -// g_object_unref(). +// 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 @@ -52827,44 +48665,6 @@ func (enumerator *FileEnumerator) Close(ctx context.Context) error { 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) 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(). // @@ -52905,6 +48705,9 @@ func (enumerator *FileEnumerator) CloseFinish(result AsyncResulter) error { // 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); @@ -53130,61 +48933,6 @@ func (enumerator *FileEnumerator) NextFile(ctx context.Context) (*FileInfo, erro 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. -// -// The callback can be called with less than num_files files in case of error or -// at the end of the enumerator. In case of a partial error the callback will -// be called with any succeeding items and no error, and on the next request the -// error will be reported. If a request is cancelled the callback will be called -// with G_IO_ERROR_CANCELLED. -// -// 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) 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(). // @@ -53245,47 +48993,6 @@ func (enumerator *FileEnumerator) SetPending(pending bool) { 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) 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(). // @@ -53405,64 +49112,6 @@ func (enumerator *FileEnumerator) nextFile(ctx context.Context) (*FileInfo, erro 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. -// -// The callback can be called with less than num_files files in case of error or -// at the end of the enumerator. In case of a partial error the callback will -// be called with any succeeding items and no error, and on the next request the -// error will be reported. If a request is cancelled the callback will be called -// with G_IO_ERROR_CANCELLED. -// -// 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) 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(). // @@ -53583,23 +49232,24 @@ func defaultFileIOStreamOverrides(v *FileIOStream) FileIOStreamOverrides { } } -// FileIOStream provides io streams that both read and write to the same file -// handle. +// FileIOStream: GFileIOStream provides I/O streams that both read and write to +// the same file handle. // -// GFileIOStream implements #GSeekable, which allows the io stream to jump +// 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 io stream, use g_seekable_tell(). +// To find the position of a file I/O stream, use gio.Seekable.Tell(). // -// To find out if a file io stream supports seeking, use g_seekable_can_seek(). -// To position a file io stream, use g_seekable_seek(). To find out if a file io -// stream supports truncating, use g_seekable_can_truncate(). To truncate a file -// io stream, use g_seekable_truncate(). +// 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 IOStream operations and the -// implementation of #GSeekable just call into the same operations on the output -// stream. +// 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 @@ -53761,49 +49411,6 @@ func (stream *FileIOStream) QueryInfo(ctx context.Context, attributes string) (* 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][gio-GIOScheduler] of the request. -// - callback (optional) 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(). // @@ -53968,52 +49575,6 @@ func (stream *FileIOStream) queryInfo(ctx context.Context, attributes string) (* 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][gio-GIOScheduler] of the request. -// - callback (optional) 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(). // @@ -54144,7 +49705,10 @@ func (stream *FileIOStream) truncateFn(ctx context.Context, size int64) error { return _goerr } -// FileIcon specifies an icon by pointing to an image file to be used as icon. +// 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 @@ -54217,29 +49781,43 @@ func (icon *FileIcon) File() *File { return _file } -// FileInfo: functionality for manipulating basic metadata for files. Info -// implements methods for getting information that all files should contain, -// and allows for manipulation of extended attributes. +// FileInfo stores information about a file system object referenced by a +// gio.File. // -// See [GFileAttribute][gio-GFileAttribute] for more information on how GIO +// 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 Info for a #GFile, use g_file_query_info() (or its async -// variant). To obtain a Info for a file input or output stream, use -// g_file_input_stream_query_info() or g_file_output_stream_query_info() (or +// 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 Info and call g_file_set_attributes_from_info() or -// g_file_set_attributes_async() on a GFile. +// 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 g_file_info_set_size(). -// You may call g_file_query_settable_attributes() and -// g_file_query_writable_namespaces() to discover the settable attributes of a +// 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. // -// AttributeMatcher allows for searching through a Info for attributes. +// 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 @@ -54326,7 +49904,44 @@ func (other *FileInfo) Dup() *FileInfo { return _fileInfo } -// AttributeAsString gets the value of a attribute, formatted as a string. +// 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: @@ -54470,6 +50085,43 @@ func (info *FileInfo) AttributeData(attribute string) (FileAttributeType, unsafe 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. @@ -54766,6 +50418,9 @@ func (info *FileInfo) AttributeUint64(attribute string) uint64 { // 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 @@ -54788,6 +50443,43 @@ func (info *FileInfo) ContentType() string { 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. @@ -54822,6 +50514,9 @@ func (info *FileInfo) DeletionDate() *glib.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. @@ -54843,6 +50538,9 @@ func (info *FileInfo) DisplayName() string { // 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. @@ -54862,7 +50560,10 @@ func (info *FileInfo) EditName() string { return _utf8 } -// ETag gets the [entity tag][gfile-etag] for a given Info. See +// 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: @@ -54891,6 +50592,9 @@ func (info *FileInfo) ETag() string { // 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. @@ -54912,6 +50616,9 @@ func (info *FileInfo) FileType() 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. @@ -54935,6 +50642,9 @@ func (info *FileInfo) Icon() *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. @@ -54958,6 +50668,9 @@ func (info *FileInfo) IsBackup() bool { // 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. @@ -54981,6 +50694,9 @@ func (info *FileInfo) IsHidden() bool { // 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. @@ -55005,9 +50721,12 @@ func (info *FileInfo) IsSymlink() bool { // ModificationDateTime gets the modification time of the current info and // returns it as a Time. // -// This requires the G_FILE_ATTRIBUTE_TIME_MODIFIED attribute. If -// G_FILE_ATTRIBUTE_TIME_MODIFIED_USEC is provided, the resulting Time will have -// microsecond precision. +// 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: // @@ -55039,6 +50758,10 @@ func (info *FileInfo) ModificationDateTime() *glib.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. // @@ -55063,6 +50786,9 @@ func (info *FileInfo) ModificationTime() *glib.TimeVal { // 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. @@ -55086,6 +50812,9 @@ func (info *FileInfo) Name() string { // 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). @@ -55108,6 +50837,9 @@ func (info *FileInfo) Size() int64 { // 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. @@ -55129,6 +50861,9 @@ func (info *FileInfo) SortOrder() int32 { // 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. @@ -55152,9 +50887,12 @@ func (info *FileInfo) SymbolicIcon() *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: // -// - utf8 (optional): string containing the symlink target. +// - filename (optional): string containing the symlink target. func (info *FileInfo) SymlinkTarget() string { var _arg0 *C.GFileInfo // out var _cret *C.char // in @@ -55164,13 +50902,13 @@ func (info *FileInfo) SymlinkTarget() string { _cret = C.g_file_info_get_symlink_target(_arg0) runtime.KeepAlive(info) - var _utf8 string // out + var _filename string // out if _cret != nil { - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) } - return _utf8 + return _filename } // HasAttribute checks if a file info structure has an attribute named @@ -55304,6 +51042,27 @@ func (info *FileInfo) RemoveAttribute(attribute string) { 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. // @@ -55380,6 +51139,33 @@ func (info *FileInfo) SetAttributeByteString(attribute, attrValue string) { 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. // @@ -55632,6 +51418,27 @@ func (info *FileInfo) SetContentType(contentType string) { 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. // @@ -55749,6 +51556,8 @@ func (info *FileInfo) SetIsSymlink(isSymlink bool) { // 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. @@ -55768,6 +51577,8 @@ func (info *FileInfo) SetModificationDateTime(mtime *glib.DateTime) { // 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. // @@ -55937,14 +51748,15 @@ func defaultFileInputStreamOverrides(v *FileInputStream) FileInputStreamOverride } } -// FileInputStream provides input streams that take their content from a file. +// FileInputStream: GFileInputStream provides input streams that take their +// content from a file. // -// GFileInputStream implements #GSeekable, which allows the input stream +// 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 g_seekable_tell(). To find out if a file input stream supports seeking, -// use g_seekable_can_seek(). To position a file input stream, use -// g_seekable_seek(). +// 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 @@ -56058,53 +51870,6 @@ func (stream *FileInputStream) QueryInfo(ctx context.Context, attributes string) 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) 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: @@ -56208,56 +51973,6 @@ func (stream *FileInputStream) queryInfo(ctx context.Context, attributes string) 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) 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: @@ -56377,13 +52092,13 @@ func defaultFileMonitorOverrides(v *FileMonitor) FileMonitorOverrides { // FileMonitor monitors a file or directory for changes. // -// To obtain a Monitor for a file or directory, use g_file_monitor(), -// g_file_monitor_file(), or g_file_monitor_directory(). +// 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 Monitor::changed signal. The signal will be emitted in the -// [thread-default main context][g-main-context-push-thread-default] of the -// thread that the monitor was created in (though if the global default main +// 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 { @@ -56472,8 +52187,8 @@ func BaseFileMonitor(obj FileMonitorrer) *FileMonitor { // 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 FILE_MONITOR_EVENT_MOVED, file will be set to a #GFile containing the old +// 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. @@ -56704,17 +52419,19 @@ func defaultFileOutputStreamOverrides(v *FileOutputStream) FileOutputStreamOverr } } -// FileOutputStream provides output streams that write their content to a file. +// FileOutputStream: GFileOutputStream provides output streams that write their +// content to a file. // -// GFileOutputStream implements #GSeekable, which allows the output stream to +// 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 g_seekable_tell(). To find -// out if a file output stream supports seeking, use g_seekable_can_seek().To -// position a file output stream, use g_seekable_seek(). To find out if a file -// output stream supports truncating, use g_seekable_can_truncate(). To truncate -// a file output stream, use g_seekable_truncate(). +// 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 @@ -56876,49 +52593,6 @@ func (stream *FileOutputStream) QueryInfo(ctx context.Context, attributes string 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][gio-GIOScheduler] 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(). // @@ -57083,52 +52757,6 @@ func (stream *FileOutputStream) queryInfo(ctx context.Context, attributes string 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][gio-GIOScheduler] 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(). // @@ -57780,50 +53408,52 @@ func defaultIOStreamOverrides(v *IOStream) IOStreamOverrides { } } -// IOStream 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. +// 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 OStream objects are Connection, which represents a two-way -// network connection; and IOStream, which represents a file handle opened in -// read-write mode. +// 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 -// g_io_stream_get_input_stream() and g_io_stream_get_output_stream(). +// gio.IOStream.GetInputStream() and gio.IOStream.GetOutputStream(). // -// The OStream object owns the input and the output streams, not the other way -// around, so keeping the substreams alive will not keep the OStream object -// alive. If the OStream object is freed it will be closed, thus closing the +// 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 g_io_stream_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 OStream may still be open. -// However, some streams may support "half-closed" states where one direction of -// the stream is actually shut down. -// -// Operations on OStreams cannot be started while another operation on the -// OStream or its substreams is in progress. Specifically, an application -// can read from the Stream and write to the Stream simultaneously (either in -// separate threads, or as asynchronous operations in the same thread), but an -// application cannot start any OStream operation while there is a OStream, -// Stream or Stream operation in progress, and an application can’t start any -// Stream or Stream operation while there is a OStream operation in progress. -// -// This is a product of individual stream operations being associated with -// a given Context (the thread-default context at the time the operation was -// started), rather than entire streams being associated with a single Context. -// -// GIO may run operations on OStreams from other (worker) threads, and this may -// be exposed to application code in the behaviour of wrapper streams, such as -// InputStream or Connection. 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). +// 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 @@ -57968,47 +53598,6 @@ func (stream *IOStream) Close(ctx context.Context) error { 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) 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: @@ -58176,96 +53765,6 @@ func (stream *IOStream) SetPending() error { 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. -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) 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: @@ -58444,13 +53943,14 @@ func defaultInetAddressOverrides(v *InetAddress) InetAddressOverrides { } } -// InetAddress represents an IPv4 or IPv6 internet address. Use -// g_resolver_lookup_by_name() or g_resolver_lookup_by_name_async() to look -// up the Address for a hostname. Use g_resolver_lookup_by_address() or -// g_resolver_lookup_by_address_async() to look up the hostname for a Address. +// 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 SocketAddress (which -// includes a Address as well as a port number). +// 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 @@ -58941,10 +54441,10 @@ func defaultInetAddressMaskOverrides(v *InetAddressMask) InetAddressMaskOverride return InetAddressMaskOverrides{} } -// InetAddressMask 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. Eg, -// "10.0.0.0/8", or "fe80::/10". +// 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 @@ -59208,8 +54708,11 @@ func defaultInetSocketAddressOverrides(v *InetSocketAddress) InetSocketAddressOv return InetSocketAddressOverrides{} } -// InetSocketAddress: IPv4 or IPv6 socket address; that is, the combination of a -// Address and a port number. +// 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 @@ -59470,15 +54973,17 @@ func defaultInputStreamOverrides(v *InputStream) InputStreamOverrides { } } -// InputStream has functions to read from a stream (g_input_stream_read()), -// to close a stream (g_input_stream_close()) and to skip some content -// (g_input_stream_skip()). +// 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 g_output_stream_splice(). +// handling the reads and writes, use gio.OutputStream.Splice(). // -// See the documentation for OStream for details of thread safety of streaming -// APIs. +// 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 { @@ -59620,48 +55125,6 @@ func (stream *InputStream) Close(ctx context.Context) error { 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) 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(). // @@ -59866,57 +55329,6 @@ func (stream *InputStream) ReadAll(ctx context.Context, buffer []byte) (uint, er 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) 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(). // @@ -59959,71 +55371,6 @@ func (stream *InputStream) ReadAllFinish(result AsyncResulter) (uint, error) { 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) 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 @@ -60091,61 +55438,6 @@ func (stream *InputStream) ReadBytes(ctx context.Context, count uint) (*glib.Byt 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) 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: @@ -60293,65 +55585,6 @@ func (stream *InputStream) Skip(ctx context.Context, count uint) (int, error) { 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) 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: @@ -60385,51 +55618,6 @@ func (stream *InputStream) SkipFinish(result AsyncResulter) (int, error) { 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) 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(). // @@ -60582,68 +55770,6 @@ func (stream *InputStream) skip(ctx context.Context, count uint) (int, error) { 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) 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: @@ -60688,8 +55814,8 @@ func defaultListStoreOverrides(v *ListStore) ListStoreOverrides { return ListStoreOverrides{} } -// ListStore is a simple implementation of Model that stores all items in -// memory. +// 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. @@ -60821,6 +55947,53 @@ func (store *ListStore) Find(item *coreglib.Object) (uint, bool) { 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. @@ -60996,10 +56169,10 @@ func defaultMemoryInputStreamOverrides(v *MemoryInputStream) MemoryInputStreamOv return MemoryInputStreamOverrides{} } -// MemoryInputStream is a class for using arbitrary memory chunks as input for -// GIO streaming input operations. +// MemoryInputStream: GMemoryInputStream is a class for using arbitrary memory +// chunks as input for GIO streaming input operations. // -// As of GLib 2.34, InputStream implements InputStream. +// As of GLib 2.34, GMemoryInputStream implements gio.PollableInputStream. type MemoryInputStream struct { _ [0]func() // equal guard InputStream @@ -61119,11 +56292,11 @@ func defaultMemoryOutputStreamOverrides(v *MemoryOutputStream) MemoryOutputStrea return MemoryOutputStreamOverrides{} } -// MemoryOutputStream is a class for using arbitrary memory chunks as output for -// GIO streaming output operations. +// MemoryOutputStream: GMemoryOutputStream is a class for using arbitrary memory +// chunks as output for GIO streaming output operations. // -// As of GLib 2.34, OutputStream trivially implements OutputStream: it always -// polls as ready. +// As of GLib 2.34, GMemoryOutputStream trivially implements +// gio.PollableOutputStream: it always polls as ready. type MemoryOutputStream struct { _ [0]func() // equal guard OutputStream @@ -61324,13 +56497,13 @@ func (ostream *MemoryOutputStream) StealData() unsafe.Pointer { return _gpointer } -// Menu is a simple implementation of Model. You populate a #GMenu by adding -// Item instances to it. +// 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 Item) for the common cases. To add a regular item, -// use g_menu_insert(). To add a section, use g_menu_insert_section(). To add a -// submenu, use g_menu_insert_submenu(). +// 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 @@ -63030,18 +58203,19 @@ func defaultMenuModelOverrides(v *MenuModel) MenuModelOverrides { } } -// MenuModel 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. +// 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 Model is hierarchical: sections and submenus -// are again represented by Models. Menus themselves do not define their own -// roles. Rather, the role of a particular Model 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). +// 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: // @@ -63049,7 +58223,7 @@ func defaultMenuModelOverrides(v *MenuModel) MenuModelOverrides { // // ! (menu-example.png) // -// There are 8 "menus" visible in the screenshot: one menubar, two submenus and +// There are 8 ‘menus’ visible in the screenshot: one menubar, two submenus and // 5 sections: // // - the toplevel menubar (containing 4 items) @@ -63068,48 +58242,48 @@ func defaultMenuModelOverrides(v *MenuModel) MenuModelOverrides { // // - the Markup section (containing 2 items) // -// The [example][menu-model] 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. +// 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][menu-example] appear -// nowhere in the [menu model][menu-model]. 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. +// 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 -// [GActionGroup exporter][gio-GActionGroup-exporter] and the [GMenuModel -// exporter][gio-GMenuModel-exporter] do for Group and Model. The client-side -// counterparts to make use of the exported information are BusActionGroup and -// BusMenuModel. -// -// The API of Model is very generic, with iterators for the attributes -// and links of an item, see g_menu_model_iterate_item_attributes() and -// g_menu_model_iterate_item_links(). The 'standard' attributes and link types +// 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 Model 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 Application, 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.". +// 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 @@ -63129,12 +58303,12 @@ func defaultMenuModelOverrides(v *MenuModel) MenuModelOverrides { // // # 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 +// 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. +// be rendered as ‘checked’ when the state is true. // // # String Parameter and State // @@ -63146,7 +58320,7 @@ func defaultMenuModelOverrides(v *MenuModel) MenuModelOverrides { // 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 +// 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 @@ -63961,26 +59135,26 @@ func defaultMountOperationOverrides(v *MountOperation) MountOperationOverrides { } } -// MountOperation 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. +// 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 Operation is used for more than just #GMount objects – for example -// it is also used in g_drive_start() and g_drive_stop(). +// 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 MountOperation. If no user -// interaction is desired (for example when automounting filesystems at login -// time), usually NULL can be passed, see each method taking a Operation for -// details. +// 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. // -// 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. +// 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 @@ -64637,6 +59811,9 @@ func defaultNativeSocketAddressOverrides(v *NativeSocketAddress) NativeSocketAdd } // 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 @@ -64779,14 +59956,14 @@ func defaultNetworkAddressOverrides(v *NetworkAddress) NetworkAddressOverrides { return NetworkAddressOverrides{} } -// NetworkAddress 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. +// 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 Connectable for an example of using the connectable interface. +// See gio.SocketConnectable for an example of using the connectable interface. type NetworkAddress struct { _ [0]func() // equal guard *coreglib.Object @@ -65065,13 +60242,13 @@ func defaultNetworkServiceOverrides(v *NetworkService) NetworkServiceOverrides { return NetworkServiceOverrides{} } -// NetworkService: like Address does with hostnames, Service 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. +// 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 Target for more information about SRV records, and see Connectable for an -// example of using the connectable interface. +// 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 @@ -65255,26 +60432,48 @@ func (srv *NetworkService) SetScheme(scheme string) { runtime.KeepAlive(scheme) } -// Notification 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. +// 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 +// 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 #GApplication. +// 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). +// 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 g_application_send_notification(). +// A notification can be sent with gio.Application.SendNotification(). type Notification struct { _ [0]func() // equal guard *coreglib.Object @@ -65406,6 +60605,32 @@ func (notification *Notification) SetBody(body string) { 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. // @@ -65439,6 +60664,7 @@ func (notification *Notification) SetDefaultAction(detailedAction string) { // 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. @@ -65632,17 +60858,24 @@ func defaultOutputStreamOverrides(v *OutputStream) OutputStreamOverrides { } } -// OutputStream has functions to write to a stream (g_output_stream_write()), -// to close a stream (g_output_stream_close()) and to flush pending writes -// (g_output_stream_flush()). +// 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 g_output_stream_splice(). +// handling the reads and writes, use gio.OutputStream.Splice(). // -// See the documentation for OStream for details of thread safety of streaming -// APIs. +// 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 @@ -65799,48 +61032,6 @@ func (stream *OutputStream) Close(ctx context.Context) error { 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) 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: @@ -65905,43 +61096,6 @@ func (stream *OutputStream) Flush(ctx context.Context) error { 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) 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: @@ -66107,52 +61261,6 @@ func (stream *OutputStream) Splice(ctx context.Context, source InputStreamer, fl 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. -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: @@ -66314,61 +61422,6 @@ func (stream *OutputStream) WriteAll(ctx context.Context, buffer []byte) (uint, 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) 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(). // @@ -66411,80 +61464,6 @@ func (stream *OutputStream) WriteAllFinish(result AsyncResulter) (uint, error) { 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) 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 @@ -66535,54 +61514,6 @@ func (stream *OutputStream) WriteBytes(ctx context.Context, bytes *glib.Bytes) ( 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) 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: @@ -66793,67 +61724,6 @@ func (stream *OutputStream) WritevAll(ctx context.Context, vectors []OutputVecto 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) 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(). // @@ -66896,81 +61766,6 @@ func (stream *OutputStream) WritevAllFinish(result AsyncResulter) (uint, error) 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) 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: @@ -67005,51 +61800,6 @@ func (stream *OutputStream) WritevFinish(result AsyncResulter) (uint, error) { 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) 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: @@ -67148,46 +61898,6 @@ func (stream *OutputStream) flush(ctx context.Context) error { 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) 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: @@ -67268,55 +61978,6 @@ func (stream *OutputStream) splice(ctx context.Context, source InputStreamer, fl 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. -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: @@ -67355,83 +62016,6 @@ func (stream *OutputStream) spliceFinish(result AsyncResulter) (int, error) { 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) 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: @@ -67534,84 +62118,6 @@ func (stream *OutputStream) writeFn(ctx context.Context, buffer []byte) (int, er 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) 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: @@ -67798,8 +62304,8 @@ func defaultPermissionOverrides(v *Permission) PermissionOverrides { } } -// Permission represents the status of the caller's permission to perform a -// certain action. +// 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. @@ -67807,9 +62313,9 @@ func defaultPermissionOverrides(v *Permission) PermissionOverrides { // 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 #GSettings object. This #GPermission object could then be used -// to decide if it is appropriate to show a "Click here to unlock" button in a +// 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 @@ -67928,37 +62434,6 @@ func (permission *Permission) Acquire(ctx context.Context) error { 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. // @@ -68143,37 +62618,6 @@ func (permission *Permission) Release(ctx context.Context) error { 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. // @@ -68251,40 +62695,6 @@ func (permission *Permission) acquire(ctx context.Context) error { 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. // @@ -68365,40 +62775,6 @@ func (permission *Permission) release(ctx context.Context) error { 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. // @@ -68432,27 +62808,27 @@ func (permission *Permission) releaseFinish(result AsyncResulter) error { return _goerr } -// PropertyAction is a way to get a #GAction with a state value reflecting and -// controlling the value of a #GObject property. +// 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 Spec). +// 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 Value table. +// 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 #GVariant types are not currently supported. +// 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 @@ -68463,23 +62839,26 @@ func (permission *Permission) releaseFinish(result AsyncResulter) error { // // 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). -// Action 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 #GAction corresponding to the -// "visible-child-name" property of a Stack 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 Stack. -// -// An anti-example would be binding the "active-id" property on a ComboBox. -// This is because the state of the combobox 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 Stack if this value is actually stored in #GSettings. In that case, -// the real source of the value is #GSettings. If you want a #GAction to control -// a setting stored in #GSettings, see g_settings_create_action() instead, -// and possibly combine its use with g_settings_bind(). +// 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 @@ -68554,7 +62933,8 @@ func defaultProxyAddressOverrides(v *ProxyAddress) ProxyAddressOverrides { return ProxyAddressOverrides{} } -// ProxyAddress: support for proxied SocketAddress. +// ProxyAddress: gio.InetSocketAddress representing a connection via a proxy +// server. type ProxyAddress struct { _ [0]func() // equal guard InetSocketAddress @@ -68825,14 +63205,16 @@ func defaultProxyAddressEnumeratorOverrides(v *ProxyAddressEnumerator) ProxyAddr return ProxyAddressEnumeratorOverrides{} } -// ProxyAddressEnumerator is a wrapper around AddressEnumerator which takes the -// Address instances returned by the AddressEnumerator and wraps them in Address -// instances, using the given AddressEnumerator:proxy-resolver. +// 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 -// g_socket_connectable_enumerate()) as appropriate when a proxy is configured; -// there should be no need to manually wrap a AddressEnumerator instance with -// one. +// 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 @@ -68958,7 +63340,7 @@ type ResolverOverrides struct { 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 RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY. + // be used to limit results with G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY. // // The function takes the following parameters: // @@ -69063,14 +63445,24 @@ func defaultResolverOverrides(v *Resolver) ResolverOverrides { } } -// Resolver provides cancellable synchronous and asynchronous DNS -// resolution, for hostnames (g_resolver_lookup_by_address(), -// g_resolver_lookup_by_name() and their async variants) and SRV (service) -// records (g_resolver_lookup_service()). +// Resolver: object that handles DNS resolution. Use gio.Resolver().GetDefault +// to get the default resolver. // -// Address and Service provide wrappers around #GResolver functionality -// that also implement Connectable, making it easy to connect to a remote -// host/service. +// 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 @@ -69174,6 +63566,28 @@ 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. // @@ -69224,41 +63638,6 @@ func (resolver *Resolver) LookupByAddress(ctx context.Context, address *InetAddr 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(). // @@ -69368,43 +63747,6 @@ func (resolver *Resolver) LookupByName(ctx context.Context, hostname string) ([] 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(). // @@ -69452,7 +63794,7 @@ func (resolver *Resolver) LookupByNameFinish(result AsyncResulter) ([]*InetAddre // 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 RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY. +// to limit results with G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY. // // The function takes the following parameters: // @@ -69506,47 +63848,6 @@ func (resolver *Resolver) LookupByNameWithFlags(ctx context.Context, hostname st 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(). // @@ -69660,47 +63961,6 @@ func (resolver *Resolver) LookupRecords(ctx context.Context, rrname string, reco 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. @@ -69837,53 +64097,6 @@ func (resolver *Resolver) LookupService(ctx context.Context, service, protocol, 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(). // @@ -69953,6 +64166,24 @@ func (resolver *Resolver) SetDefault() { 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. // @@ -70006,44 +64237,6 @@ func (resolver *Resolver) lookupByAddress(ctx context.Context, address *InetAddr 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(). // @@ -70159,46 +64352,6 @@ func (resolver *Resolver) lookupByName(ctx context.Context, hostname string) ([] 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(). // @@ -70249,7 +64402,7 @@ func (resolver *Resolver) lookupByNameFinish(result AsyncResulter) ([]*InetAddre // 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 RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY. +// to limit results with G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY. // // The function takes the following parameters: // @@ -70306,50 +64459,6 @@ func (resolver *Resolver) lookupByNameWithFlags(ctx context.Context, hostname st 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(). // @@ -70469,50 +64578,6 @@ func (resolver *Resolver) lookupRecords(ctx context.Context, rrname string, reco 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. @@ -70569,41 +64634,6 @@ func (resolver *Resolver) lookupRecordsFinish(result AsyncResulter) ([]*glib.Var 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(). // @@ -70726,23 +64756,24 @@ func defaultSettingsOverrides(v *Settings) SettingsOverrides { } } -// Settings class provides a convenient API for storing and retrieving -// application settings. +// 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 Table 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 -// g_settings_bind() functionality is careful not to write settings in response -// to notify signals as a result of modifications that it makes to widgets. +// 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, @@ -70750,23 +64781,23 @@ func defaultSettingsOverrides(v *Settings) SettingsOverrides { // // 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][gsettings-relocatable]', 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. +// 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. +// 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 #GVariant, and allows any Type 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. +// 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 @@ -70795,33 +64826,32 @@ func defaultSettingsOverrides(v *Settings) SettingsOverrides { // ['bad', 'words'] // // Translations of default values must remain syntactically valid serialized -// #GVariants (e.g. retaining any surrounding quotation marks) or runtime errors -// will occur. +// 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] utility. The input is a schema -// description in an XML format. +// 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://git.gnome.org/browse/glib/tree/gio/gschema.dtd) +// (https://gitlab.gnome.org/GNOME/glib/-/blob/HEAD/gio/gschema.dtd) // -// The [glib-compile-schemas][glib-compile-schemas] tool expects schema files to -// have the extension .gschema.xml. +// 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 +// 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". +// 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 #GVariant types, keys can have types that have enumerated +// 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 [example][schema-enumerated]. The underlying type of such a -// key is string, but you can use g_settings_get_enum(), g_settings_set_enum(), -// g_settings_get_flags(), g_settings_set_flags() access the numeric values +// 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: @@ -70899,11 +64929,11 @@ func defaultSettingsOverrides(v *Settings) SettingsOverrides { // 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] 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 -// GVariant form, as in the following example: +// 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' @@ -70914,24 +64944,25 @@ func defaultSettingsOverrides(v *Settings) SettingsOverrides { // // # Binding // -// A very convenient feature of GSettings lets you bind #GObject properties -// directly to settings, using g_settings_bind(). Once a GObject 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 and -// GVariant types, and preventing infinite cycles. +// 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 SETTINGS_BIND_NO_SENSITIVITY flag. +// 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 g_settings_new_with_path(), a #GSettings object can be +// 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 g_settings_new_with_path() will typically be constructed +// 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. @@ -71391,6 +65422,9 @@ func (settings *Settings) Boolean(key string) bool { // 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. @@ -72857,11 +66891,9 @@ func SettingsUnbind(object *coreglib.Object, property string) { runtime.KeepAlive(property) } -// SimpleAction is the obvious simple implementation of the #GAction interface. -// This is the easiest way to create an action for purposes of adding it to a -// ActionGroup. -// -// See also Action. +// 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 @@ -73093,8 +67125,8 @@ func defaultSimpleActionGroupOverrides(v *SimpleActionGroup) SimpleActionGroupOv return SimpleActionGroupOverrides{} } -// SimpleActionGroup is a hash table filled with #GAction objects, implementing -// the Group and Map interfaces. +// 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 @@ -73268,69 +67300,69 @@ func (simple *SimpleActionGroup) Remove(actionName string) { runtime.KeepAlive(actionName) } -// SimpleAsyncResult as of GLib 2.46, AsyncResult is deprecated in favor of -// #GTask, which provides a simpler API. +// SimpleAsyncResult as of GLib 2.46, GSimpleAsyncResult is deprecated in favor +// of gio.Task, which provides a simpler API. // -// AsyncResult implements Result. +// GSimpleAsyncResult implements gio.AsyncResult. // -// GSimpleAsyncResult handles ReadyCallbacks, 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. +// 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 -// Result'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. +// 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 AsyncResult, call g_simple_async_result_new(). If the result -// needs to be created for a #GError, use g_simple_async_result_new_from_error() -// or g_simple_async_result_new_take_error(). If a #GError is not available -// (e.g. the asynchronous operation's doesn't take a #GError argument), -// but the result still needs to be created for an error condition, use -// g_simple_async_result_new_error() (or g_simple_async_result_set_error_va() -// if your application or binding requires passing a variable argument -// list directly), and the error can then be propagated through the use of -// g_simple_async_result_propagate_error(). -// -// An asynchronous operation can be made to ignore a cancellation event by -// calling g_simple_async_result_set_handle_cancellation() with a AsyncResult -// 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, Loop, or it can use -// #GThreads. g_simple_async_result_complete() will finish an I/O task directly -// from the point where it is called. g_simple_async_result_complete_in_idle() -// will finish it from an idle handler in the [thread-default main -// context][g-main-context-push-thread-default] where the AsyncResult was -// created. g_simple_async_result_run_in_thread() will run the job in a separate -// thread and then use g_simple_async_result_complete_in_idle() to deliver the -// result. +// 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, -// g_simple_async_result_set_op_res_gpointer(), -// g_simple_async_result_set_op_res_gboolean(), and -// g_simple_async_result_set_op_res_gssize() are provided, setting the -// operation's result to a gpointer, gboolean, or gssize, respectively. -// -// Likewise, to get the result of an asynchronous function, -// g_simple_async_result_get_op_res_gpointer(), -// g_simple_async_result_get_op_res_gboolean(), and -// g_simple_async_result_get_op_res_gssize() are provided, getting the -// operation's result as a gpointer, gboolean, and gssize, respectively. -// -// For the details of the requirements implementations must respect, -// see Result. A typical implementation of an asynchronous operation using +// 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 @@ -73449,99 +67481,6 @@ 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 @@ -73828,13 +67767,15 @@ func SimpleAsyncResultIsValid(result AsyncResulter, source *coreglib.Object, sou return _ok } -// SimpleIOStream creates a OStream from an arbitrary Stream and Stream. This -// allows any pair of input and output streams to be used with OStream methods. +// 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 Stream and a Stream by other means, -// for instance creating them with platform specific methods as -// g_unix_input_stream_new() or g_win32_input_stream_new(), and you want to take -// advantage of the methods provided by OStream. +// 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 @@ -73886,11 +67827,12 @@ func NewSimpleIOStream(inputStream InputStreamer, outputStream OutputStreamer) * return _simpleIOStream } -// SimplePermission is a trivial implementation of #GPermission that represents -// a permission that is either always or never allowed. The value is given at -// construction and doesn't change. +// 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 request or release will result in errors. +// Calling gio.Permission.Acquire() or gio.Permission.Release() on a +// GSimplePermission will result in errors. type SimplePermission struct { _ [0]func() // equal guard Permission @@ -73948,13 +67890,14 @@ func defaultSimpleProxyResolverOverrides(v *SimpleProxyResolver) SimpleProxyReso return SimpleProxyResolverOverrides{} } -// SimpleProxyResolver is a simple Resolver implementation that handles a single -// default proxy, multiple URI-scheme-specific proxies, and a list of hosts that -// proxies should not be used for. +// 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. // -// ProxyResolver 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 g_socket_client_set_proxy_resolver(). +// 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 @@ -74004,14 +67947,16 @@ func marshalSimpleProxyResolver(p uintptr) (interface{}, error) { // // The function takes the following parameters: // -// - defaultProxy: default proxy to use. +// - 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())) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(defaultProxy))) - defer C.free(unsafe.Pointer(_arg1)) + 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) @@ -74047,6 +67992,53 @@ func (resolver *SimpleProxyResolver) SetURIProxy(uriScheme, proxy string) { 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 { } @@ -74055,30 +68047,31 @@ func defaultSocketOverrides(v *Socket) SocketOverrides { return SocketOverrides{} } -// Socket 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. +// 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 +// 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 Client, Service and Connection. -// However there may be cases where direct use of #GSocket is useful. -// -// #GSocket implements the #GInitable interface, so if it is manually -// constructed by e.g. g_object_new() you must call g_initable_init() and -// check the results before using the object. This is done automatically in -// g_socket_new() and g_socket_new_from_fd(), 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 g_socket_condition_check(), or g_socket_condition_wait(). -// You can also use g_socket_create_source() and attach it to a Context 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. +// 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 @@ -74087,7 +68080,7 @@ func defaultSocketOverrides(v *Socket) SocketOverrides { // 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 +// 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 @@ -74095,15 +68088,32 @@ func defaultSocketOverrides(v *Socket) SocketOverrides { // // 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 +// 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 +// 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 +// 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 @@ -75438,6 +69448,150 @@ func (socket *Socket) Receive(ctx context.Context, buffer []byte) (int, error) { 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 @@ -76487,9 +70641,10 @@ func defaultSocketAddressOverrides(v *SocketAddress) SocketAddressOverrides { } } -// SocketAddress is the equivalent of struct sockaddr in the BSD sockets API. -// This is an abstract class; use SocketAddress for internet sockets, -// or SocketAddress for UNIX domain sockets. +// 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 @@ -76784,8 +70939,8 @@ type SocketAddressEnumeratorOverrides struct { // // The function returns the following values: // - // - socketAddress (owned by the caller), or NULL on error (in which case - // *error will be set) or if there are no more addresses. + // - 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 @@ -76798,8 +70953,8 @@ type SocketAddressEnumeratorOverrides struct { // // The function returns the following values: // - // - socketAddress (owned by the caller), or NULL on error (in which case - // *error will be set) or if there are no more addresses. + // - 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) } @@ -76810,18 +70965,19 @@ func defaultSocketAddressEnumeratorOverrides(v *SocketAddressEnumerator) SocketA } } -// SocketAddressEnumerator is an enumerator type for Address instances. It is -// returned by enumeration functions such as g_socket_connectable_enumerate(), -// which returns a AddressEnumerator to list each Address which could be used to -// connect to that Connectable. +// 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 g_socket_address_enumerator_next_async() and -// g_socket_address_enumerator_next_finish() should be used where possible. +// asynchronous methods gio.SocketAddressEnumerator.NextAsync() and +// gio.SocketAddressEnumerator.NextFinish() should be used where possible. // -// Each AddressEnumerator can only be enumerated once. Once -// g_socket_address_enumerator_next() has returned NULL, further enumeration -// with that AddressEnumerator is not possible, and it can be unreffed. +// 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 @@ -76905,8 +71061,8 @@ func BaseSocketAddressEnumerator(obj SocketAddressEnumeratorrer) *SocketAddressE // // The function returns the following values: // -// - socketAddress (owned by the caller), or NULL on error (in which case -// *error will be set) or if there are no more addresses. +// - 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 @@ -76927,22 +71083,21 @@ func (enumerator *SocketAddressEnumerator) Next(ctx context.Context) (SocketAddr var _socketAddress SocketAddresser // out var _goerr error // out - { - objptr := unsafe.Pointer(_cret) - if objptr == nil { - panic("object of type gio.SocketAddresser is nil") - } + 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") + 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 } - _socketAddress = rv } if _cerr != nil { _goerr = gerror.Take(unsafe.Pointer(_cerr)) @@ -76951,40 +71106,6 @@ func (enumerator *SocketAddressEnumerator) Next(ctx context.Context) (SocketAddr 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. @@ -76995,8 +71116,8 @@ func (enumerator *SocketAddressEnumerator) NextAsync(ctx context.Context, callba // // The function returns the following values: // -// - socketAddress (owned by the caller), or NULL on error (in which case -// *error will be set) or if there are no more addresses. +// - 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 @@ -77013,22 +71134,21 @@ func (enumerator *SocketAddressEnumerator) NextFinish(result AsyncResulter) (Soc var _socketAddress SocketAddresser // out var _goerr error // out - { - objptr := unsafe.Pointer(_cret) - if objptr == nil { - panic("object of type gio.SocketAddresser is nil") - } + 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") + 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 } - _socketAddress = rv } if _cerr != nil { _goerr = gerror.Take(unsafe.Pointer(_cerr)) @@ -77055,8 +71175,8 @@ func (enumerator *SocketAddressEnumerator) NextFinish(result AsyncResulter) (Soc // // The function returns the following values: // -// - socketAddress (owned by the caller), or NULL on error (in which case -// *error will be set) or if there are no more addresses. +// - 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 @@ -77080,22 +71200,21 @@ func (enumerator *SocketAddressEnumerator) next(ctx context.Context) (SocketAddr var _socketAddress SocketAddresser // out var _goerr error // out - { - objptr := unsafe.Pointer(_cret) - if objptr == nil { - panic("object of type gio.SocketAddresser is nil") - } + 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") + 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 } - _socketAddress = rv } if _cerr != nil { _goerr = gerror.Take(unsafe.Pointer(_cerr)) @@ -77104,43 +71223,6 @@ func (enumerator *SocketAddressEnumerator) next(ctx context.Context) (SocketAddr 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. @@ -77151,8 +71233,8 @@ func (enumerator *SocketAddressEnumerator) nextAsync(ctx context.Context, callba // // The function returns the following values: // -// - socketAddress (owned by the caller), or NULL on error (in which case -// *error will be set) or if there are no more addresses. +// - 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 @@ -77172,22 +71254,21 @@ func (enumerator *SocketAddressEnumerator) nextFinish(result AsyncResulter) (Soc var _socketAddress SocketAddresser // out var _goerr error // out - { - objptr := unsafe.Pointer(_cret) - if objptr == nil { - panic("object of type gio.SocketAddresser is nil") - } + 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") + 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 } - _socketAddress = rv } if _cerr != nil { _goerr = gerror.Take(unsafe.Pointer(_cerr)) @@ -77212,18 +71293,19 @@ func defaultSocketClientOverrides(v *SocketClient) SocketClientOverrides { } } -// SocketClient is a lightweight high-level utility class for connecting to a -// network host using a connection oriented socket type. +// SocketClient: GSocketClient is a lightweight high-level utility class for +// connecting to a network host using a connection oriented socket type. // -// You create a Client object, set any options you want, and then call a sync or -// async connect operation, which returns a Connection subclass on success. +// 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 Connection 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 Connection. +// 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 Client is a lightweight object, you don't need to cache it. You can just -// create a new one any time you need one. +// 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 @@ -77426,50 +71508,6 @@ func (client *SocketClient) ConnectSocketClient(ctx context.Context, connectable 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(). // @@ -77578,48 +71616,6 @@ func (client *SocketClient) ConnectToHost(ctx context.Context, hostAndPort strin 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(). // @@ -77713,46 +71709,6 @@ func (client *SocketClient) ConnectToService(ctx context.Context, domain, servic 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(). // @@ -77851,48 +71807,6 @@ func (client *SocketClient) ConnectToURI(ctx context.Context, uri string, defaul 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(). // @@ -78131,6 +72045,11 @@ func (client *SocketClient) TLS() bool { // 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. @@ -78347,6 +72266,11 @@ func (client *SocketClient) SetTLS(tls bool) { // 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. @@ -78396,21 +72320,22 @@ func defaultSocketConnectionOverrides(v *SocketConnection) SocketConnectionOverr return SocketConnectionOverrides{} } -// SocketConnection is a OStream for a connected socket. They can be created -// either by Client when connecting to a host, or by Listener when accepting a -// new client. +// 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 Connection 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 Connection. +// 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 3rd parties to register custom socket +// factory, and it is possible for third parties to register custom socket // connection types for specific combination of socket family/type/protocol -// using g_socket_connection_factory_register_type(). +// using gio.SocketConnection().FactoryRegisterType. // -// To close a Connection, use g_io_stream_close(). Closing both substreams of -// the OStream separately will not close the underlying #GSocket. +// 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 @@ -78482,45 +72407,6 @@ func (connection *SocketConnection) ConnectSocketConnection(ctx context.Context, 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. -// -// 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: @@ -78769,6 +72655,7 @@ type SocketControlMessageOverrides struct { // // - 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. @@ -78791,24 +72678,24 @@ func defaultSocketControlMessageOverrides(v *SocketControlMessage) SocketControl } } -// SocketControlMessage is a special-purpose utility message that can be sent -// to or received from a #GSocket. These types of messages are often called -// "ancillary data". +// 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 g_socket_send_message() and received with -// g_socket_receive_message(). +// 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 GType typesystem before calling -// g_socket_receive_message() to read such a message. +// 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 @@ -79018,6 +72905,7 @@ func (message *SocketControlMessage) size() uint { 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 @@ -79076,7 +72964,7 @@ func (message *SocketControlMessage) serialize(data unsafe.Pointer) { // // The function returns the following values: // -// - socketControlMessage: deserialized message or NULL. +// - socketControlMessage (optional): deserialized message or NULL. func SocketControlMessageDeserialize(level, typ int, data []byte) SocketControlMessager { var _arg1 C.int // out var _arg2 C.int // out @@ -79098,22 +72986,21 @@ func SocketControlMessageDeserialize(level, typ int, data []byte) SocketControlM var _socketControlMessage SocketControlMessager // out - { - objptr := unsafe.Pointer(_cret) - if objptr == nil { - panic("object of type gio.SocketControlMessager is nil") - } + 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") + 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 } - _socketControlMessage = rv } return _socketControlMessage @@ -79121,6 +73008,8 @@ func SocketControlMessageDeserialize(level, typ int, data []byte) SocketControlM // 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: // @@ -79136,17 +73025,19 @@ func defaultSocketListenerOverrides(v *SocketListener) SocketListenerOverrides { } } -// SocketListener 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. +// 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 g_socket_listener_add_address() -// and g_socket_listener_add_inet_port(). These will be listened on until -// g_socket_listener_close() is called. Dropping your final reference to the -// Listener will not cause g_socket_listener_close() to be called implicitly, -// as some references to the Listener may be held internally. +// 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 Service and -// SocketService which are subclasses of Listener that make this even easier. +// 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 @@ -79271,38 +73162,6 @@ func (listener *SocketListener) Accept(ctx context.Context) (*coreglib.Object, * 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_socket() 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(). // @@ -79398,39 +73257,6 @@ func (listener *SocketListener) AcceptSocket(ctx context.Context) (*coreglib.Obj 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(). // @@ -79711,6 +73537,7 @@ func (listener *SocketListener) SetBacklog(listenBacklog int) { 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 @@ -79747,6 +73574,8 @@ func (listener *SocketListener) event(event SocketListenerEvent, socket *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 @@ -79760,28 +73589,29 @@ func defaultSocketServiceOverrides(v *SocketService) SocketServiceOverrides { } } -// SocketService 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 Service::incoming signal is emitted. +// 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 Service is a subclass of Listener and you need to add the addresses you -// want to accept connections on with the Listener APIs. +// 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 Service. -// The first is to create the service using g_socket_service_new() and to -// connect to the Service::incoming signal. The second is to subclass Service -// and override the default signal handler implementation. +// 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 -// SocketService. +// gio.ThreadedSocketService. // -// The socket service runs on the main loop of the [thread-default -// context][g-main-context-push-thread-default-context] 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. +// 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 @@ -79922,6 +73752,8 @@ func (service *SocketService) Stop() { runtime.KeepAlive(service) } +// Incoming: signal emitted when new connections are accepted. +// // The function takes the following parameters: // // - connection @@ -79953,24 +73785,352 @@ func (service *SocketService) incoming(connection *SocketConnection, sourceObjec return _ok } -// Task represents and manages a cancellable "task". +// Task: GTask represents and manages a cancellable ‘task’. // // # Asynchronous operations // -// The most common usage of #GTask is as a Result, to manage data during -// an asynchronous operation. You call g_task_new() in the "start" method, -// followed by g_task_set_task_data() and the like if you need to keep some +// 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 g_task_return_pointer() or g_task_return_error(), which will -// save the value you give it and then invoke the task's callback function in -// the [thread-default main context][g-main-context-push-thread-default] 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 Result), and you can use g_task_propagate_pointer() or the -// like to extract the return value. +// 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); +// } // -// Here is an example for using GTask as a GAsyncResult: +// # 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, @@ -79992,8 +74152,8 @@ func (service *SocketService) incoming(connection *SocketConnection, sourceObjec // 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 +// // 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 @@ -80001,11 +74161,11 @@ func (service *SocketService) incoming(connection *SocketConnection, sourceObjec // 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 +// // 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. +// // 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); // } @@ -80061,55 +74221,75 @@ func (service *SocketService) incoming(connection *SocketConnection, sourceObjec // return cake; // } // -// # Porting from GSimpleAsyncResult +// # Porting from gio.SimpleAsyncResult // -// #GTask's API attempts to be simpler than AsyncResult's in several ways: +// GTask’s API attempts to be simpler than gio.SimpleAsyncResult’s in several +// ways: // -// - You can save task-specific data with g_task_set_task_data(), and -// retrieve it later with g_task_get_task_data(). This replaces the abuse -// of g_simple_async_result_set_op_res_gpointer() for the same purpose with -// AsyncResult. +// - 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][io-priority], #GCancellable, and Context 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. +// - 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. // -// - g_task_return_error_if_cancelled() provides simplified handling +// - gio.Task.ReturnErrorIfCancelled() provides simplified handling // for cancellation. In addition, cancellation overrides any other -// #GTask return value by default, like AsyncResult does when -// g_simple_async_result_set_check_cancellable() is called. (You can use -// g_task_set_check_cancellable() to turn off that behavior.) On the other -// hand, g_task_run_in_thread() guarantees that it will always run your -// task_func, even if the task's #GCancellable is already cancelled before -// the task gets a chance to run; you can start your task_func with a -// g_task_return_error_if_cancelled() check if you need the old behavior. -// -// - The "return" methods (eg, g_task_return_pointer()) 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 Context, or delayed until the next iteration of the current -// Context.) -// -// - The "finish" functions for #GTask based operations are generally much -// simpler than AsyncResult ones, normally consisting of only a single call to -// g_task_propagate_pointer() or the like. Since g_task_propagate_pointer() -// "steals" the return value from the #GTask, it is not necessary to juggle -// pointers around to prevent it from being freed twice. -// -// - With AsyncResult, it was common to call -// g_simple_async_result_propagate_error() from the _finish() wrapper function, +// 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 g_async_result_legacy_propagate_error() to do old-style -// AsyncResult error-returning behavior, and g_async_result_is_tagged() -// 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 -// g_input_stream_read_async()). +// 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 @@ -80134,66 +74314,11 @@ 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 task's #GCancellable. +// - cancellable (optional) task's #GCancellable. func (task *Task) Cancellable() *Cancellable { var _arg0 *C.GTask // out var _cret *C.GCancellable // in @@ -80205,7 +74330,9 @@ func (task *Task) Cancellable() *Cancellable { var _cancellable *Cancellable // out - _cancellable = wrapCancellable(coreglib.Take(unsafe.Pointer(_cret))) + if _cret != nil { + _cancellable = wrapCancellable(coreglib.Take(unsafe.Pointer(_cret))) + } return _cancellable } @@ -80594,7 +74721,7 @@ func (task *Task) ReturnBoolean(result bool) { // 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 g_task_return_new_error(). +// See also gio.Task.ReturnNewError(), gio.Task.ReturnNewErrorLiteral(). // // The function takes the following parameters: // @@ -80656,10 +74783,42 @@ func (task *Task) ReturnInt(result int) { 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 TYPE_POINTER with a value of NULL +// 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 @@ -80723,7 +74882,8 @@ func (task *Task) SetCheckCancellable(checkCancellable bool) { // 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. +// 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: // @@ -80752,7 +74912,7 @@ func (task *Task) SetName(name string) { // // The function takes the following parameters: // -// - priority: [priority][io-priority] of the request. +// - 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 @@ -80823,11 +74983,16 @@ func (task *Task) SetReturnOnCancel(returnOnCancel bool) bool { 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. +// 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: // @@ -80844,6 +75009,29 @@ func (task *Task) SetSourceTag(sourceTag unsafe.Pointer) { 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. @@ -80878,45 +75066,6 @@ func TaskIsValid(result AsyncResulter, sourceObject *coreglib.Object) bool { 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 { } @@ -80925,8 +75074,8 @@ func defaultTCPConnectionOverrides(v *TCPConnection) TCPConnectionOverrides { return TCPConnectionOverrides{} } -// TCPConnection: this is the subclass of Connection that is created for TCP/IP -// sockets. +// TCPConnection: this is the subclass of gio.SocketConnection that is created +// for TCP/IP sockets. type TCPConnection struct { _ [0]func() // equal guard SocketConnection @@ -81026,10 +75175,11 @@ func defaultTCPWrapperConnectionOverrides(v *TCPWrapperConnection) TCPWrapperCon return TCPWrapperConnectionOverrides{} } -// TCPWrapperConnection can be used to wrap a OStream that is based on a -// #GSocket, but which is not actually a Connection. This is used by Client -// so that it can always return a Connection, even when the connection it has -// actually created is not directly a Connection. +// 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 @@ -81139,21 +75289,23 @@ func (conn *TCPWrapperConnection) BaseIOStream() IOStreamer { } // TestDBus: helper class for testing code which uses D-Bus without touching the -// user's session bus. +// user’s session bus. // -// Note that DBus modifies the user’s environment, calling setenv(). This is -// not thread-safe, so all DBus calls should be completed before threads are -// spawned, or should have appropriate locking to ensure no access conflicts to -// environment variables shared between DBus and other threads. +// 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 DBus 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. +// 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 @@ -81173,26 +75325,26 @@ func (conn *TCPWrapperConnection) BaseIOStream() IOStreamer { // 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, +// -DTEST_SERVICES=\""$(abs_top_builddir)/tests/services"\" // -// you can proceed to set up a GTest fixture using the DBus scaffolding. +// 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://git.gnome.org/browse/glib/tree/gio/tests/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 GSettings 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). +// 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 DBus +// 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 @@ -81373,12 +75525,14 @@ func TestDBusUnset() { C.g_test_dbus_unset() } -// ThemedIcon is an implementation of #GIcon that supports icon themes. Icon -// contains a list of all of the icons present in an icon theme, so that icons -// can be looked up quickly. Icon does not provide actual pixmaps for icons, -// just the icon names. Ideally something like gtk_icon_theme_choose_icon() -// should be used to resolve the list of names so that fallback icons work -// nicely with themes that inherit other themes. +// 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 @@ -81578,6 +75732,25 @@ func (icon *ThemedIcon) PrependName(iconname string) { 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: @@ -81593,19 +75766,21 @@ func defaultThreadedSocketServiceOverrides(v *ThreadedSocketService) ThreadedSoc } } -// ThreadedSocketService is a simple subclass of Service that handles incoming -// connections by creating a worker thread and dispatching the connection to it -// by emitting the SocketService::run signal in the new thread. +// 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 IO and need not return until the +// 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 Service from accepting new connections when all threads are busy. +// stops the gio.SocketService from accepting new connections when all threads +// are busy. // -// As with Service, you may connect to SocketService::run, or subclass and -// override the default handler. +// 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 @@ -81724,6 +75899,8 @@ type TLSCertificateOverrides struct { // 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 @@ -81734,8 +75911,19 @@ type TLSCertificateOverrides struct { // be set in the return value. If trusted_ca is NULL, that bit will never be // set in the return value. // - // (All other CertificateFlags values will always be set or unset as - // appropriate.). + // 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: // @@ -81757,7 +75945,7 @@ func defaultTLSCertificateOverrides(v *TLSCertificate) TLSCertificateOverrides { // 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 ServerConnection). +// key (which is needed when acting as a gio.TLSServerConnection). type TLSCertificate struct { _ [0]func() // equal guard *coreglib.Object @@ -81819,21 +76007,18 @@ func BaseTLSCertificate(obj TLSCertificater) *TLSCertificate { return obj.baseTLSCertificate() } -// NewTLSCertificateFromFile creates a Certificate from the PEM-encoded data in -// file. The returned certificate will be the first certificate found in file. -// As of GLib 2.44, if 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. +// 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. Otherwise, this behaves like g_tls_certificate_new_from_pem(). +// error. // // The function takes the following parameters: // -// - file containing a PEM-encoded certificate to import. +// - file containing a certificate to import. // // The function returns the following values: // @@ -81860,6 +76045,50 @@ func NewTLSCertificateFromFile(file string) (*TLSCertificate, error) { 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 @@ -81923,24 +76152,23 @@ func NewTLSCertificateFromFiles(certFile, keyFile string) (*TLSCertificate, erro // The function takes the following parameters: // // - data: PEM-encoded certificate data. -// - length of data, or -1 if it's 0-terminated. // // The function returns the following values: // // - tlsCertificate: new certificate, or NULL if data is invalid. -func NewTLSCertificateFromPem(data string, length int) (*TLSCertificate, error) { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(data))) + _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)) - _arg2 = C.gssize(length) _cret = C.g_tls_certificate_new_from_pem(_arg1, _arg2, &_cerr) runtime.KeepAlive(data) - runtime.KeepAlive(length) var _tlsCertificate *TLSCertificate // out var _goerr error // out @@ -81953,7 +76181,9 @@ func NewTLSCertificateFromPem(data string, length int) (*TLSCertificate, error) return _tlsCertificate, _goerr } -// NewTLSCertificateFromPKCS11URIs creates a Certificate from a PKCS \#11 URI. +// 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 @@ -82014,6 +76244,60 @@ func NewTLSCertificateFromPKCS11URIs(pkcs11Uri, privateKeyPkcs11Uri string) (*TL 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: @@ -82051,6 +76335,115 @@ func (cert *TLSCertificate) Issuer() TLSCertificater { 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 @@ -82090,6 +76483,8 @@ func (certOne *TLSCertificate) IsSame(certTwo TLSCertificater) bool { // 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. @@ -82099,8 +76494,19 @@ func (certOne *TLSCertificate) IsSame(certTwo TLSCertificater) bool { // in the return value. If trusted_ca is NULL, that bit will never be set in the // return value. // -// (All other CertificateFlags values will always be set or unset as -// appropriate.). +// 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: // @@ -82141,6 +76547,8 @@ func (cert *TLSCertificate) Verify(identity SocketConnectabler, trustedCa TLSCer // 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. @@ -82150,8 +76558,19 @@ func (cert *TLSCertificate) Verify(identity SocketConnectabler, trustedCa TLSCer // in the return value. If trusted_ca is NULL, that bit will never be set in the // return value. // -// (All other CertificateFlags values will always be set or unset as -// appropriate.). +// 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: // @@ -82249,16 +76668,32 @@ func TLSCertificateListNewFromFile(file string) ([]TLSCertificater, error) { // 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 @@ -82303,19 +76738,20 @@ type TLSConnectionOverrides struct { func defaultTLSConnectionOverrides(v *TLSConnection) TLSConnectionOverrides { return TLSConnectionOverrides{ - AcceptCertificate: v.acceptCertificate, - BindingData: v.bindingData, - Handshake: v.handshake, - HandshakeFinish: v.handshakeFinish, + AcceptCertificate: v.acceptCertificate, + BindingData: v.bindingData, + NegotiatedProtocol: v.negotiatedProtocol, + Handshake: v.handshake, + HandshakeFinish: v.handshakeFinish, } } -// TLSConnection is the base TLS connection class type, which wraps a OStream -// and provides TLS encryption on top of it. Its subclasses, ClientConnection -// and ServerConnection, implement client-side and server-side TLS, -// respectively. +// 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 Connection. +// For DTLS (Datagram TLS) support, see gio.DTLSConnection. type TLSConnection struct { _ [0]func() // equal guard IOStream @@ -82356,6 +76792,10 @@ func initTLSConnectionClass(gclass unsafe.Pointer, overrides TLSConnectionOverri 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) } @@ -82402,6 +76842,14 @@ func BaseTLSConnection(obj TLSConnectioner) *TLSConnection { // 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 @@ -82543,6 +76991,36 @@ func (conn *TLSConnection) ChannelBindingData(typ TLSChannelBindingType) ([]byte 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(). // @@ -82674,7 +77152,9 @@ func (conn *TLSConnection) PeerCertificate() TLSCertificater { // 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.). +// set during the emission of Connection::accept-certificate.) +// +// See Connection:peer-certificate-errors for more information. // // The function returns the following values: // @@ -82695,6 +77175,30 @@ func (conn *TLSConnection) PeerCertificateErrors() TLSCertificateFlags { 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. // @@ -82828,40 +77332,6 @@ func (conn *TLSConnection) Handshake(ctx context.Context) error { 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. // @@ -82968,6 +77438,9 @@ func (conn *TLSConnection) SetCertificate(certificate TLSCertificater) { // 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. @@ -83102,6 +77575,8 @@ func (conn *TLSConnection) SetUseSystemCertDB(useSystemCertdb bool) { runtime.KeepAlive(useSystemCertdb) } +// acceptCertificate: check whether to accept a certificate. +// // The function takes the following parameters: // // - peerCert @@ -83133,6 +77608,8 @@ func (connection *TLSConnection) acceptCertificate(peerCert TLSCertificater, err return _ok } +// bindingData: retrieve TLS channel binding data (Since: 2.66). +// // The function takes the following parameters: // // - typ @@ -83168,6 +77645,38 @@ func (conn *TLSConnection) bindingData(typ TLSChannelBindingType, data []byte) e 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 @@ -83227,43 +77736,6 @@ func (conn *TLSConnection) handshake(ctx context.Context) error { 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. // @@ -83356,15 +77828,26 @@ type TLSDatabaseOverrides struct { // 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. + // 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 + // 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. @@ -83424,20 +77907,17 @@ type TLSDatabaseOverrides struct { // 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 after looking - // up and adding any missing certificates to the chain. + // 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. - // The chain may initially consist of one or more certificates. After the - // verification process is complete, chain may be modified by adding missing - // certificates, or removing extra certificates. If a certificate anchor was - // found, then it is added to the chain. // // purpose describes the purpose (or usage) for which the // certificate is being used. Typically purpose will be set to - // TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER which means that the certificate - // is being used to authenticate a server (and we are acting as the client). + // 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, @@ -83451,14 +77931,39 @@ type TLSDatabaseOverrides struct { // 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 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. + // 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. // - // This function can block, use g_tls_database_verify_chain_async() to + // 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: @@ -83511,15 +78016,15 @@ func defaultTLSDatabaseOverrides(v *TLSDatabase) TLSDatabaseOverrides { } } -// TLSDatabase 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. +// 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 Database may be accessed from multiple threads by the TLS backend. +// 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 Database. -// It is used internally by Connection. +// 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 @@ -83731,52 +78236,6 @@ func (self *TLSDatabase) LookupCertificateForHandle(ctx context.Context, handle 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. @@ -83833,13 +78292,25 @@ func (self *TLSDatabase) LookupCertificateForHandleFinish(result AsyncResulter) } // 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() +// 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. @@ -83906,51 +78377,6 @@ func (self *TLSDatabase) LookupCertificateIssuer(ctx context.Context, certificat 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. @@ -84086,59 +78512,6 @@ func (self *TLSDatabase) LookupCertificatesIssuedBy(ctx context.Context, issuerR 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 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. @@ -84197,20 +78570,16 @@ func (self *TLSDatabase) LookupCertificatesIssuedByFinish(result AsyncResulter) return _list, _goerr } -// VerifyChain determines the validity of a certificate chain after looking up -// and adding any missing certificates to the chain. +// 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. The chain may initially -// consist of one or more certificates. After the verification process is -// complete, chain may be modified by adding missing certificates, or removing -// extra certificates. If a certificate anchor was found, then it is added to -// the chain. +// 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 -// TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER which means that the certificate is -// being used to authenticate a server (and we are acting as the client). +// 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, @@ -84222,14 +78591,38 @@ func (self *TLSDatabase) LookupCertificatesIssuedByFinish(result AsyncResulter) // // 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 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. -// -// This function can block, use g_tls_database_verify_chain_async() to perform +// 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: @@ -84293,62 +78686,6 @@ func (self *TLSDatabase) VerifyChain(ctx context.Context, chain TLSCertificater, 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. // @@ -84515,55 +78852,6 @@ func (self *TLSDatabase) lookupCertificateForHandle(ctx context.Context, handle 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. @@ -84623,13 +78911,25 @@ func (self *TLSDatabase) lookupCertificateForHandleFinish(result AsyncResulter) } // 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() +// 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. @@ -84699,54 +78999,6 @@ func (self *TLSDatabase) lookupCertificateIssuer(ctx context.Context, certificat 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. @@ -84888,62 +79140,6 @@ func (self *TLSDatabase) lookupCertificatesIssuedBy(ctx context.Context, issuerR 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 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. @@ -85005,20 +79201,16 @@ func (self *TLSDatabase) lookupCertificatesIssuedByFinish(result AsyncResulter) return _list, _goerr } -// verifyChain determines the validity of a certificate chain after looking up -// and adding any missing certificates to the chain. +// 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. The chain may initially -// consist of one or more certificates. After the verification process is -// complete, chain may be modified by adding missing certificates, or removing -// extra certificates. If a certificate anchor was found, then it is added to -// the chain. +// 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 -// TLS_DATABASE_PURPOSE_AUTHENTICATE_SERVER which means that the certificate is -// being used to authenticate a server (and we are acting as the client). +// 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, @@ -85030,14 +79222,38 @@ func (self *TLSDatabase) lookupCertificatesIssuedByFinish(result AsyncResulter) // // 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 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. -// -// This function can block, use g_tls_database_verify_chain_async() to perform +// 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: @@ -85104,65 +79320,6 @@ func (self *TLSDatabase) verifyChain(ctx context.Context, chain TLSCertificater, 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. // @@ -85313,22 +79470,23 @@ func defaultTLSInteractionOverrides(v *TLSInteraction) TLSInteractionOverrides { } } -// TLSInteraction 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. +// 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 Interaction with a TLS connection use -// g_tls_connection_set_interaction(). +// 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 -// g_tls_interaction_invoke_ask_password() to run interaction methods. These +// 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 +// 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. @@ -85438,53 +79596,6 @@ func (interaction *TLSInteraction) AskPassword(ctx context.Context, password *TL 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. @@ -85711,51 +79822,6 @@ func (interaction *TLSInteraction) RequestCertificate(ctx context.Context, conne 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. @@ -85855,56 +79921,6 @@ func (interaction *TLSInteraction) askPassword(ctx context.Context, password *TL 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. @@ -86015,54 +80031,6 @@ func (interaction *TLSInteraction) requestCertificate(ctx context.Context, conne 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. @@ -86111,20 +80079,18 @@ func (interaction *TLSInteraction) requestCertificateFinish(result AsyncResulter // 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 takes the following parameters: - // - // - length (optional): location to place the length of the password. - // // The function returns the following values: // - // - guint8: password value (owned by the password object). - Value func(length *uint) *byte + // - guint8s: password value (owned by the password object). + Value func() []byte } func defaultTLSPasswordOverrides(v *TLSPassword) TLSPasswordOverrides { @@ -86134,7 +80100,8 @@ func defaultTLSPasswordOverrides(v *TLSPassword) TLSPasswordOverrides { } } -// TLSPassword holds a password used in TLS. +// 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 @@ -86258,32 +80225,25 @@ func (password *TLSPassword) Flags() TLSPasswordFlags { // 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 takes the following parameters: -// -// - length (optional): location to place the length of the password. -// // The function returns the following values: // -// - guint8: password value (owned by the password object). -func (password *TLSPassword) Value(length *uint) *byte { +// - guint8s: password value (owned by the password object). +func (password *TLSPassword) Value() []byte { var _arg0 *C.GTlsPassword // out - var _arg1 *C.gsize // out var _cret *C.guchar // in + var _arg1 C.gsize // in _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) - if length != nil { - _arg1 = (*C.gsize)(unsafe.Pointer(length)) - } - _cret = C.g_tls_password_get_value(_arg0, _arg1) + _cret = C.g_tls_password_get_value(_arg0, &_arg1) runtime.KeepAlive(password) - runtime.KeepAlive(length) - var _guint8 *byte // out + var _guint8s []byte // out - _guint8 = (*byte)(unsafe.Pointer(_cret)) + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) - return _guint8 + return _guint8s } // Warning: get a user readable translated warning. Usually this @@ -86392,6 +80352,8 @@ func (password *TLSPassword) SetWarning(warning string) { 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 @@ -86416,35 +80378,28 @@ func (password *TLSPassword) defaultWarning() string { // 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 takes the following parameters: -// -// - length (optional): location to place the length of the password. -// // The function returns the following values: // -// - guint8: password value (owned by the password object). -func (password *TLSPassword) value(length *uint) *byte { +// - 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 _arg1 *C.gsize // out var _cret *C.guchar // in + var _arg1 C.gsize // in _arg0 = (*C.GTlsPassword)(unsafe.Pointer(coreglib.InternObject(password).Native())) - if length != nil { - _arg1 = (*C.gsize)(unsafe.Pointer(length)) - } - _cret = C._gotk4_gio2_TLSPassword_virtual_get_value(unsafe.Pointer(fnarg), _arg0, _arg1) + _cret = C._gotk4_gio2_TLSPassword_virtual_get_value(unsafe.Pointer(fnarg), _arg0, &_arg1) runtime.KeepAlive(password) - runtime.KeepAlive(length) - var _guint8 *byte // out + var _guint8s []byte // out - _guint8 = (*byte)(unsafe.Pointer(_cret)) + _guint8s = make([]byte, _arg1) + copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) - return _guint8 + return _guint8s } // VFSOverrides contains methods that are overridable. @@ -87245,13 +81200,13 @@ func defaultVolumeMonitorOverrides(v *VolumeMonitor) VolumeMonitorOverrides { } } -// VolumeMonitor 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. +// 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. // -// Monitor is not [thread-default-context -// aware][g-main-context-push-thread-default], and so should not be used other -// than from the main thread, with no thread-default-context active. +// 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. @@ -88012,7 +81967,8 @@ func defaultZlibCompressorOverrides(v *ZlibCompressor) ZlibCompressorOverrides { return ZlibCompressorOverrides{} } -// ZlibCompressor: zlib decompression. +// ZlibCompressor: GZlibCompressor is an implementation of gio.Converter that +// compresses data using zlib. type ZlibCompressor struct { _ [0]func() // equal guard *coreglib.Object @@ -88139,7 +82095,8 @@ func defaultZlibDecompressorOverrides(v *ZlibDecompressor) ZlibDecompressorOverr return ZlibDecompressorOverrides{} } -// ZlibDecompressor: zlib decompression. +// ZlibDecompressor: GZlibDecompressor is an implementation of gio.Converter +// that decompresses data compressed with zlib. type ZlibDecompressor struct { _ [0]func() // equal guard *coreglib.Object @@ -88293,7 +82250,7 @@ type actionGroupInterface struct { native *C.GActionGroupInterface } -// ActionInterface: virtual function table for #GAction. +// ActionInterface: virtual function table for gio.Action. // // An instance of this type is always passed by reference. type ActionInterface struct { @@ -89747,6 +83704,42 @@ 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. @@ -90118,7 +84111,7 @@ func (matcher *FileAttributeMatcher) Matches(attribute string) bool { return _ok } -// MatchesOnly checks if a attribute matcher only matches a given attribute. +// 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: @@ -90844,6 +84837,18 @@ 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. @@ -90924,18 +84929,20 @@ type resolverClass struct { // Resource applications and libraries often contain binary or textual data // that is really part of the application, rather than user data. For instance -// Builder .ui files, splashscreen images, GMenu 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] -// program provide a convenient and efficient alternative to this which has some -// nice properties. You maintain the files as normal files, so its 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. +// 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 @@ -90946,28 +84953,30 @@ type resolverClass struct { // the preprocess attribute to a comma-separated list of preprocessing options. // The only options currently supported are: // -// xml-stripblanks which will use the xmllint 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 Pixdata 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 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. +// - 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. @@ -90976,10 +84985,10 @@ type resolverClass struct { // 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] 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. +// 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: // @@ -91003,35 +85012,37 @@ type resolverClass struct { // 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] to compile -// the XML to a binary bundle that you can load with g_resource_load(). -// However, its 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]. get_resource() returns the -// generated #GResource object. The register and unregister functions register -// the resource so its files can be accessed using g_resources_lookup_data(). -// -// Once a #GResource has been created and registered all the data in +// 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 -// g_resources_open_stream() to stream the data or g_resources_lookup_data() +// 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 #GFile to access the +// resource:///org/gtk/Example/data/splashscreen.png with gio.File to access the // resource data. // -// Some higher-level APIs, such as Application, will automatically load -// resources from certain well-known paths in the resource namespace as a +// 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.) +// 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 @@ -91040,6 +85051,8 @@ type resolverClass struct { // 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. @@ -91064,10 +85077,10 @@ type resolverClass struct { // 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. +// 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 { @@ -91411,28 +85424,83 @@ func (s *SettingsClass) Padding() [20]unsafe.Pointer { return _v } -// SettingsSchema and Schema APIs provide a mechanism for advanced control over -// the loading of schemas and a mechanism for introspecting their content. +// 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. // -// SchemaSource 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. +// 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 @@ -91869,11 +85937,10 @@ func (key *SettingsSchemaKey) ValueType() *glib.VariantType { return _variantType } -// RangeCheck checks if the given value is of the correct type and within the -// permitted range for key. +// 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. +// 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: // @@ -92257,18 +86324,21 @@ func (s *SocketServiceClass) ParentClass() *SocketListenerClass { return _v } -// SrvTarget: 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. +// 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 g_resolver_lookup_service() or g_resolver_lookup_service_async() -// to find the Targets for a given service. However, if you are simply planning -// to connect to the remote service, you can use Service's Connectable interface -// and not need to worry about Target at all. +// 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 { @@ -92595,7 +86665,9 @@ type tlsClientConnectionInterface struct { native *C.GTlsClientConnectionInterface } -// TLSConnectionClass: instance of this type is always passed by reference. +// TLSConnectionClass class structure for the Connection type. +// +// An instance of this type is always passed by reference. type TLSConnectionClass struct { *tlsConnectionClass } @@ -92605,6 +86677,7 @@ type tlsConnectionClass struct { native *C.GTlsConnectionClass } +// ParentClass: parent class. func (t *TLSConnectionClass) ParentClass() *IOStreamClass { valptr := &t.native.parent_class var _v *IOStreamClass // out diff --git a/pkg/gio/v2/gio_export.go b/pkg/gio/v2/gio_export.go index bdc7e39c5..a41e99266 100644 --- a/pkg/gio/v2/gio_export.go +++ b/pkg/gio/v2/gio_export.go @@ -20,40 +20,6 @@ import ( // #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 @@ -156,34 +122,6 @@ func _gotk4_gio2_BusNameVanishedCallback(arg1 *C.GDBusConnection, arg2 *C.gchar, fn(_connection, _name) } -//export _gotk4_gio2_CancellableSourceFunc -func _gotk4_gio2_CancellableSourceFunc(arg1 *C.GCancellable, arg2 C.gpointer) (cret C.gboolean) { - var fn CancellableSourceFunc - { - v := gbox.Get(uintptr(arg2)) - if v == nil { - panic(`callback not found`) - } - fn = v.(CancellableSourceFunc) - } - - var _cancellable context.Context // out - - if arg1 != nil { - _cancellable = gcancel.NewCancellableContext(unsafe.Pointer(arg1)) - } - - ok := fn(_cancellable) - - var _ bool - - if ok { - cret = C.TRUE - } - - return cret -} - //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 @@ -337,36 +275,6 @@ func _gotk4_gio2_DBusMessageFilterFunction(arg1 *C.GDBusConnection, arg2 *C.GDBu return cret } -//export _gotk4_gio2_DBusProxyTypeFunc -func _gotk4_gio2_DBusProxyTypeFunc(arg1 *C.GDBusObjectManagerClient, arg2 *C.gchar, arg3 *C.gchar, arg4 C.gpointer) (cret C.GType) { - var fn DBusProxyTypeFunc - { - v := gbox.Get(uintptr(arg4)) - if v == nil { - panic(`callback not found`) - } - fn = v.(DBusProxyTypeFunc) - } - - var _manager *DBusObjectManagerClient // out - var _objectPath string // out - var _interfaceName string // out - - _manager = wrapDBusObjectManagerClient(coreglib.Take(unsafe.Pointer(arg1))) - _objectPath = C.GoString((*C.gchar)(unsafe.Pointer(arg2))) - if arg3 != nil { - _interfaceName = C.GoString((*C.gchar)(unsafe.Pointer(arg3))) - } - - gType := fn(_manager, _objectPath, _interfaceName) - - var _ coreglib.Type - - cret = C.GType(gType) - - 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 @@ -520,150 +428,6 @@ func _gotk4_gio2_DBusSubtreeIntrospectFunc(arg1 *C.GDBusConnection, arg2 *C.gcha return cret } -//export _gotk4_gio2_DatagramBasedSourceFunc -func _gotk4_gio2_DatagramBasedSourceFunc(arg1 *C.GDatagramBased, arg2 C.GIOCondition, arg3 C.gpointer) (cret C.gboolean) { - var fn DatagramBasedSourceFunc - { - v := gbox.Get(uintptr(arg3)) - if v == nil { - panic(`callback not found`) - } - fn = v.(DatagramBasedSourceFunc) - } - - var _datagramBased DatagramBasedder // out - var _condition glib.IOCondition // out - - { - objptr := unsafe.Pointer(arg1) - if objptr == nil { - panic("object of type gio.DatagramBasedder is nil") - } - - object := coreglib.Take(objptr) - casted := object.WalkCast(func(obj coreglib.Objector) bool { - _, ok := obj.(DatagramBasedder) - return ok - }) - rv, ok := casted.(DatagramBasedder) - if !ok { - panic("no marshaler for " + object.TypeFromInstance().String() + " matching gio.DatagramBasedder") - } - _datagramBased = rv - } - _condition = glib.IOCondition(arg2) - - ok := fn(_datagramBased, _condition) - - var _ bool - - if ok { - cret = C.TRUE - } - - return cret -} - -//export _gotk4_gio2_FileMeasureProgressCallback -func _gotk4_gio2_FileMeasureProgressCallback(arg1 C.gboolean, arg2 C.guint64, arg3 C.guint64, arg4 C.guint64, arg5 C.gpointer) { - var fn FileMeasureProgressCallback - { - v := gbox.Get(uintptr(arg5)) - if v == nil { - panic(`callback not found`) - } - fn = v.(FileMeasureProgressCallback) - } - - var _reporting bool // out - var _currentSize uint64 // out - var _numDirs uint64 // out - var _numFiles uint64 // out - - if arg1 != 0 { - _reporting = true - } - _currentSize = uint64(arg2) - _numDirs = uint64(arg3) - _numFiles = uint64(arg4) - - fn(_reporting, _currentSize, _numDirs, _numFiles) -} - -//export _gotk4_gio2_FileProgressCallback -func _gotk4_gio2_FileProgressCallback(arg1 C.goffset, arg2 C.goffset, arg3 C.gpointer) { - var fn FileProgressCallback - { - v := gbox.Get(uintptr(arg3)) - if v == nil { - panic(`callback not found`) - } - fn = v.(FileProgressCallback) - } - - var _currentNumBytes int64 // out - var _totalNumBytes int64 // out - - _currentNumBytes = int64(arg1) - _totalNumBytes = int64(arg2) - - fn(_currentNumBytes, _totalNumBytes) -} - -//export _gotk4_gio2_FileReadMoreCallback -func _gotk4_gio2_FileReadMoreCallback(arg1 *C.char, arg2 C.goffset, arg3 C.gpointer) (cret C.gboolean) { - var fn FileReadMoreCallback - { - v := gbox.Get(uintptr(arg3)) - if v == nil { - panic(`callback not found`) - } - fn = v.(FileReadMoreCallback) - } - - var _fileContents string // out - var _fileSize int64 // out - - _fileContents = C.GoString((*C.gchar)(unsafe.Pointer(arg1))) - _fileSize = int64(arg2) - - ok := fn(_fileContents, _fileSize) - - var _ bool - - if ok { - cret = C.TRUE - } - - return cret -} - -//export _gotk4_gio2_PollableSourceFunc -func _gotk4_gio2_PollableSourceFunc(arg1 *C.GObject, arg2 C.gpointer) (cret C.gboolean) { - var fn PollableSourceFunc - { - v := gbox.Get(uintptr(arg2)) - if v == nil { - panic(`callback not found`) - } - fn = v.(PollableSourceFunc) - } - - var _pollableStream *coreglib.Object // out - - _pollableStream = coreglib.Take(unsafe.Pointer(arg1)) - - ok := fn(_pollableStream) - - var _ bool - - if ok { - cret = C.TRUE - } - - 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 @@ -760,34 +524,6 @@ func _gotk4_gio2_SettingsGetMapping(arg1 *C.GVariant, arg2 *C.gpointer, arg3 C.g return cret } -//export _gotk4_gio2_SocketSourceFunc -func _gotk4_gio2_SocketSourceFunc(arg1 *C.GSocket, arg2 C.GIOCondition, arg3 C.gpointer) (cret C.gboolean) { - var fn SocketSourceFunc - { - v := gbox.Get(uintptr(arg3)) - if v == nil { - panic(`callback not found`) - } - fn = v.(SocketSourceFunc) - } - - var _socket *Socket // out - var _condition glib.IOCondition // out - - _socket = wrapSocket(coreglib.Take(unsafe.Pointer(arg1))) - _condition = glib.IOCondition(arg2) - - ok := fn(_socket, _condition) - - var _ bool - - 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 @@ -1573,6 +1309,46 @@ func _gotk4_gio2_AppLaunchContextClass_launch_failed(arg0 *C.GAppLaunchContext, 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)) @@ -1633,6 +1409,53 @@ func _gotk4_gio2_AppLaunchContext_ConnectLaunchFailed(arg0 C.gpointer, arg1 *C.g 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) @@ -2123,6 +1946,17 @@ func _gotk4_gio2_Application_ConnectStartup(arg0 C.gpointer, arg1 C.guintptr) { 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)) @@ -2440,6 +2274,23 @@ func _gotk4_gio2_DBusInterfaceSkeletonClass_get_properties(arg0 *C.GDBusInterfac 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) @@ -2793,6 +2644,57 @@ func _gotk4_gio2_DBusServer_ConnectNewConnection(arg0 C.gpointer, arg1 *C.GDBusC 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)) @@ -5535,8 +5437,10 @@ func _gotk4_gio2_SocketAddressEnumeratorClass_next(arg0 *C.GSocketAddressEnumera var _ SocketAddresser var _ error - cret = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(socketAddress).Native())) - C.g_object_ref(C.gpointer(coreglib.InternObject(socketAddress).Native())) + 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)) } @@ -5577,8 +5481,10 @@ func _gotk4_gio2_SocketAddressEnumeratorClass_next_finish(arg0 *C.GSocketAddress var _ SocketAddresser var _ error - cret = (*C.GSocketAddress)(unsafe.Pointer(coreglib.InternObject(socketAddress).Native())) - C.g_object_ref(C.gpointer(coreglib.InternObject(socketAddress).Native())) + 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)) } @@ -6042,6 +5948,26 @@ func _gotk4_gio2_TlsConnectionClass_get_binding_data(arg0 *C.GTlsConnection, arg 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)) @@ -6749,17 +6675,14 @@ func _gotk4_gio2_TlsPasswordClass_get_value(arg0 *C.GTlsPassword, arg1 *C.gsize) panic("gotk4: " + instance0.TypeFromInstance().String() + ": expected TLSPasswordOverrides.Value, got none") } - var _length *uint // out + guint8s := overrides.Value() - if arg1 != nil { - _length = (*uint)(unsafe.Pointer(arg1)) - } - - guint8 := overrides.Value(_length) + var _ []byte - var _ *byte - - cret = (*C.guchar)(unsafe.Pointer(guint8)) + *arg1 = (C.gsize)(len(guint8s)) + if len(guint8s) > 0 { + cret = (*C.guchar)(unsafe.Pointer(&guint8s[0])) + } return cret } diff --git a/pkg/glib/v2/glib.go b/pkg/glib/v2/glib.go index fba91da8b..79f75489a 100644 --- a/pkg/glib/v2/glib.go +++ b/pkg/glib/v2/glib.go @@ -20,24 +20,34 @@ import ( coreglib "github.com/diamondburned/gotk4/pkg/core/glib" ) -// #cgo pkg-config: glib-2.0 gobject-introspection-1.0 +// #cgo pkg-config: glib-2.0 // #cgo CFLAGS: -Wno-deprecated-declarations // #include // #include // #include // extern void callbackDelete(gpointer); -// extern void _gotk4_glib2_SpawnChildSetupFunc(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()) @@ -46,6 +56,8 @@ var ( 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()) @@ -59,10 +71,17 @@ var ( 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}, @@ -71,6 +90,8 @@ func init() { 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}, @@ -83,10 +104,15 @@ func init() { }) } +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 -// g_ascii_dtostr(). It is guaranteed to be enough for all output of that +// 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: @@ -96,7 +122,24 @@ const ANALYZER_ANALYZING = 1 // fprintf (out, "value=s\n", g_ascii_dtostr (buf, sizeof (buf), value));. const ASCII_DTOSTR_BUF_SIZE = 39 -// BIG_ENDIAN specifies one of the possible types of byte order. See BYTE_ORDER. +// 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 @@ -110,6 +153,7 @@ 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 & @@ -124,76 +168,16 @@ const DATE_BAD_JULIAN = 0 // DATE_BAD_YEAR represents an invalid year. const DATE_BAD_YEAR = 0 - -// DIR_SEPARATOR: directory separator character. This is '/' on UNIX machines -// and '\' under Windows. const DIR_SEPARATOR = 47 - -// DIR_SEPARATOR_S: directory separator as a string. This is "/" on UNIX -// machines and "\" under Windows. const DIR_SEPARATOR_S = "/" - -// E: base of natural logarithms. const E = 2.718282 - -// GINT16_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #gint16. It is a string literal, -// but doesn't include the percent-sign, such that you can add precision and -// length modifiers between percent-sign and conversion specifier. -// -// gint16 in; -// gint32 out; -// sscanf ("42", "%" G_GINT16_FORMAT, &in) -// out = in * 1000; -// g_print ("%" G_GINT32_FORMAT, out);. const GINT16_FORMAT = "hi" - -// GINT16_MODIFIER: platform dependent length modifier for conversion specifiers -// for scanning and printing values of type #gint16 or #guint16. It is a -// string literal, but doesn't include the percent-sign, such that you can add -// precision and length modifiers between percent-sign and conversion specifier -// and append a conversion specifier. -// -// The following example prints "0x7b"; -// -// gint16 value = 123; -// g_print ("%#" G_GINT16_MODIFIER "x", value);. const GINT16_MODIFIER = "h" - -// GINT32_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #gint32. See also GINT16_FORMAT. const GINT32_FORMAT = "i" - -// GINT32_MODIFIER: platform dependent length modifier for conversion specifiers -// for scanning and printing values of type #gint32 or #guint32. It is a string -// literal. See also GINT16_MODIFIER. const GINT32_MODIFIER = "" - -// GINT64_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #gint64. See also GINT16_FORMAT. -// -// Some platforms do not support scanning and printing 64-bit integers, -// even though the types are supported. On such platforms G_GINT64_FORMAT is -// not defined. Note that scanf() may not support 64-bit integers, even if -// G_GINT64_FORMAT is defined. Due to its weak error handling, scanf() is not -// recommended for parsing anyway; consider using g_ascii_strtoull() instead. const GINT64_FORMAT = "li" - -// GINT64_MODIFIER: platform dependent length modifier for conversion specifiers -// for scanning and printing values of type #gint64 or #guint64. It is a string -// literal. -// -// Some platforms do not support printing 64-bit integers, even though the types -// are supported. On such platforms G_GINT64_MODIFIER is not defined. const GINT64_MODIFIER = "l" - -// GINTPTR_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #gintptr. const GINTPTR_FORMAT = "li" - -// GINTPTR_MODIFIER: platform dependent length modifier for conversion -// specifiers for scanning and printing values of type #gintptr or #guintptr. -// It is a string literal. const GINTPTR_MODIFIER = "l" // GNUC_FUNCTION expands to "" on all modern compilers, and to __FUNCTION__ on @@ -207,49 +191,16 @@ const GNUC_FUNCTION = "" // // Deprecated: Use G_STRFUNC() instead. const GNUC_PRETTY_FUNCTION = "" - -// GSIZE_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #gsize. See also GINT16_FORMAT. const GSIZE_FORMAT = "lu" - -// GSIZE_MODIFIER: platform dependent length modifier for conversion specifiers -// for scanning and printing values of type #gsize. It is a string literal. const GSIZE_MODIFIER = "l" - -// GSSIZE_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #gssize. See also GINT16_FORMAT. const GSSIZE_FORMAT = "li" - -// GSSIZE_MODIFIER: platform dependent length modifier for conversion specifiers -// for scanning and printing values of type #gssize. It is a string literal. const GSSIZE_MODIFIER = "l" - -// GUINT16_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #guint16. See also GINT16_FORMAT. const GUINT16_FORMAT = "hu" - -// GUINT32_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #guint32. See also GINT16_FORMAT. const GUINT32_FORMAT = "u" - -// GUINT64_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #guint64. See also GINT16_FORMAT. -// -// Some platforms do not support scanning and printing 64-bit integers, -// even though the types are supported. On such platforms G_GUINT64_FORMAT -// is not defined. Note that scanf() may not support 64-bit integers, even if -// G_GINT64_FORMAT is defined. Due to its weak error handling, scanf() is not -// recommended for parsing anyway; consider using g_ascii_strtoull() instead. const GUINT64_FORMAT = "lu" - -// GUINTPTR_FORMAT: this is the platform dependent conversion specifier for -// scanning and printing values of type #guintptr. const GUINTPTR_FORMAT = "lu" const HAVE_GINT64 = 1 const HAVE_GNUC_VARARGS = 1 - -// HAVE_GNUC_VISIBILITY: defined to 1 if gcc-style visibility handling is -// supported. const HAVE_GNUC_VISIBILITY = 1 const HAVE_GROWING_STACK = 0 const HAVE_ISO_VARARGS = 1 @@ -258,13 +209,7 @@ const HAVE_ISO_VARARGS = 1 // 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 - -// IEEE754_DOUBLE_BIAS bias by which exponents in double-precision floats are -// offset. const IEEE754_DOUBLE_BIAS = 1023 - -// IEEE754_FLOAT_BIAS bias by which exponents in single-precision floats are -// offset. const IEEE754_FLOAT_BIAS = 127 // KEY_FILE_DESKTOP_GROUP: name of the main group of a desktop @@ -273,132 +218,126 @@ const IEEE754_FLOAT_BIAS = 127 // 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 KEY_FILE_DESKTOP_GROUP, whose value +// 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 KEY_FILE_DESKTOP_GROUP, whose +// 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 KEY_FILE_DESKTOP_GROUP, whose value +// 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 KEY_FILE_DESKTOP_GROUP, +// 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 KEY_FILE_DESKTOP_GROUP, whose value is -// a string giving the command line to execute. It is only valid for desktop +// 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 KEY_FILE_DESKTOP_GROUP, whose +// 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 KEY_FILE_DESKTOP_GROUP, whose value is -// a boolean stating whether the desktop entry has been deleted by the user. +// 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 KEY_FILE_DESKTOP_GROUP, whose value is a -// localized string giving the name of the icon to be displayed for the desktop -// entry. +// 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 KEY_FILE_DESKTOP_GROUP, whose value -// is a list of strings giving the MIME types supported by this desktop entry. +// 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 KEY_FILE_DESKTOP_GROUP, whose value is a -// localized string giving the specific name of the desktop entry. +// 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 KEY_FILE_DESKTOP_GROUP, +// 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 KEY_FILE_DESKTOP_GROUP, +// 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 KEY_FILE_DESKTOP_GROUP, whose -// value is a list of strings identifying the environments that should display -// the desktop entry. +// 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 KEY_FILE_DESKTOP_GROUP, whose value is +// 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 KEY_FILE_DESKTOP_GROUP, +// 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 KEY_FILE_DESKTOP_GROUP, +// 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 KEY_FILE_DESKTOP_GROUP, whose value -// is a boolean stating whether the program should be run in a terminal window. +// 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 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. +// 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 KEY_FILE_DESKTOP_GROUP, -// whose value is a string giving the type of the desktop entry. -// Usually KEY_FILE_DESKTOP_TYPE_APPLICATION, KEY_FILE_DESKTOP_TYPE_LINK, -// or KEY_FILE_DESKTOP_TYPE_DIRECTORY. +// 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 KEY_FILE_DESKTOP_GROUP, whose value is a -// string giving the URL to access. It is only valid for desktop entries with +// 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 KEY_FILE_DESKTOP_GROUP, whose value +// 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 KEY_FILE_DESKTOP_KEY_TYPE, +// 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 KEY_FILE_DESKTOP_KEY_TYPE, +// 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 KEY_FILE_DESKTOP_KEY_TYPE, key for -// desktop entries representing links to documents. +// 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" - -// LITTLE_ENDIAN specifies one of the possible types of byte order. See -// BYTE_ORDER. const LITTLE_ENDIAN = 1234 - -// LN10: natural logarithm of 10. const LN10 = 2.302585 - -// LN2: natural logarithm of 2. const LN2 = 0.693147 - -// LOG_2_BASE_10: multiplying the base 2 exponent by this number yields the base -// 10 exponent. const LOG_2_BASE_10 = 0.301030 // LOG_DOMAIN defines the log domain. See Log Domains (#log-domains). @@ -415,7 +354,7 @@ const LOG_2_BASE_10 = 0.301030 // not advisable, as it cannot be filtered against using the G_MESSAGES_DEBUG // environment variable. // -// For example, GTK+ uses this in its Makefile.am: +// For example, GTK uses this in its Makefile.am: // // AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Gtk\" // @@ -425,8 +364,8 @@ 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][using-structured-logging]. +// 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< 0 { _arg2 = (*C.guchar)(unsafe.Pointer(&key[0])) } - _arg4 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg5 = C.gssize(length) _cret = C.g_compute_hmac_for_string(_arg1, _arg2, _arg3, _arg4, _arg5) runtime.KeepAlive(digestType) runtime.KeepAlive(key) runtime.KeepAlive(str) - runtime.KeepAlive(length) var _utf8 string // out @@ -5278,8 +5455,8 @@ func ComputeHMACForString(digestType ChecksumType, key []byte, str string, lengt // 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 -// CONVERT_ERROR_ILLEGAL_SEQUENCE occurs, the value stored will be the byte -// offset after the last valid input sequence. +// 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. @@ -5458,11 +5635,11 @@ func Dcgettext(domain, msgid string, category int) string { // 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 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 +// 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 @@ -5480,7 +5657,7 @@ func Dcgettext(domain, msgid string, category int) string { // // 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+. +// the application should call textdomain() after initializing GTK. // // Applications should normally not use this function directly, but use the _() // macro for translations. @@ -5800,9 +5977,9 @@ func Dpgettext2(domain, context, msgid string) string { // // The function returns the following values: // -// - filename: 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. +// - 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 @@ -5830,7 +6007,9 @@ func EnvironGetenv(envp []string, variable string) string { var _filename string // out - _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } return _filename } @@ -5960,9 +6139,11 @@ func EnvironUnsetenv(envp []string, variable string) []string { return _filenames } -// FileErrorFromErrno gets a Error constant based on the passed-in err_no. For -// example, if you pass in EEXIST this function returns FILE_ERROR_EXIST. Unlike -// errno values, you can portably assume that all Error values will exist. +// 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 @@ -5974,7 +6155,7 @@ func EnvironUnsetenv(envp []string, variable string) []string { // // The function returns the following values: // -// - fileError corresponding to the given errno. +// - fileError corresponding to the given err_no. func FileErrorFromErrno(errNo int) FileError { var _arg1 C.gint // out var _cret C.GFileError // in @@ -6010,9 +6191,9 @@ func FileErrorQuark() Quark { // 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 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. +// 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: // @@ -6103,9 +6284,27 @@ func FileOpenTmp(tmpl string) (string, int, error) { 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. +// 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: // @@ -6220,7 +6419,7 @@ func FileSetContents(filename, contents string) error { // 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 FILE_ERROR. Possible +// 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 @@ -6282,12 +6481,14 @@ func FileSetContentsFull(filename, contents string, flags FileSetContentsFlags, // 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. 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! +// 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)) @@ -6296,6 +6497,21 @@ func FileSetContentsFull(filename, contents string, flags FileSetContentsFlags, // // 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 @@ -6428,6 +6644,11 @@ func FilenameDisplayName(filename string) string { // 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). @@ -6481,7 +6702,6 @@ func FilenameFromURI(uri string) (hostname, filename string, goerr error) { // The function takes the following parameters: // // - utf8String: UTF-8 encoded string. -// - len: length of the string, or -1 if the string is nul-terminated. // // The function returns the following values: // @@ -6494,21 +6714,21 @@ func FilenameFromURI(uri string) (hostname, filename string, goerr error) { // - 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, len int) (bytesRead, bytesWritten uint, filename string, goerr error) { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(utf8String))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_filename_from_utf8(_arg1, _arg2, &_arg3, &_arg4, &_cerr) runtime.KeepAlive(utf8String) - runtime.KeepAlive(len) var _bytesRead uint // out var _bytesWritten uint // out @@ -6583,9 +6803,6 @@ func FilenameToURI(filename, hostname string) (string, error) { // The function takes the following parameters: // // - opsysstring: string in the encoding for filenames. -// - len: length of the string, or -1 if the string is nul-terminated (Note -// that some encodings may allow nul bytes to occur inside strings. In that -// case, using -1 for the len parameter is unsafe). // // The function returns the following values: // @@ -6598,21 +6815,21 @@ func FilenameToURI(filename, hostname string) (string, error) { // - 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, len int) (bytesRead, bytesWritten uint, utf8 string, goerr error) { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(opsysstring))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_filename_to_utf8(_arg1, _arg2, &_arg3, &_arg4, &_cerr) runtime.KeepAlive(opsysstring) - runtime.KeepAlive(len) var _bytesRead uint // out var _bytesWritten uint // out @@ -6819,7 +7036,8 @@ func GetApplicationName() string { // // 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. +// 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(). @@ -7324,7 +7542,7 @@ func GetOsInfo(keyName string) string { // 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 +// 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]. // @@ -7404,7 +7622,7 @@ func GetRealTime() int64 { // 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 -// CSIDL_COMMON_APPDATA folder. This information will not roam and is available +// 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, @@ -7450,8 +7668,8 @@ func GetSystemConfigDirs() []string { // 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 CSIDL_COMMON_APPDATA and -// CSIDL_COMMON_DOCUMENTS. +// 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. @@ -7537,8 +7755,8 @@ func GetTmpDir() string { // 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 CSIDL_INTERNET_CACHE -// (https://msdn.microsoft.com/en-us/library/windows/desktop/bb76249428v=vs.8529.aspx#csidl_internet_cache). +// 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. @@ -7568,9 +7786,9 @@ func GetUserCacheDir() string { // // 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 CSIDL_LOCAL_APPDATA -// (https://msdn.microsoft.com/en-us/library/windows/desktop/bb76249428v=vs.8529.aspx#csidl_local_appdata). +// 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. // @@ -7602,9 +7820,9 @@ func GetUserConfigDir() string { // // 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 CSIDL_LOCAL_APPDATA -// (https://msdn.microsoft.com/en-us/library/windows/desktop/bb76249428v=vs.8529.aspx#csidl_local_appdata). +// 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. // @@ -7690,9 +7908,9 @@ func GetUserRuntimeDir() string { // // The function returns the following values: // -// - filename: 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. +// - 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 @@ -7704,36 +7922,39 @@ func GetUserSpecialDir(directory UserDirectory) string { var _filename string // out - _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } return _filename } -// Getenv returns the value of an environment variable. +// GetUserStateDir returns a base directory in which to store state files +// specific to particular user. // -// 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. +// 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. // -// The function takes the following parameters: +// 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. // -// - variable: environment variable to get. +// 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: 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 +// - filename: string owned by GLib that must not be modified or freed. +func GetUserStateDir() string { 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) + _cret = C.g_get_user_state_dir() var _filename string // out @@ -7742,6 +7963,41 @@ func Getenv(variable string) string { 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() @@ -8164,7 +8420,7 @@ func InternString(str string) string { } // IOCreateWatch creates a #GSource that's dispatched when condition is met for -// the given channel. For example, if condition is IO_IN, the source will be +// 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 @@ -8262,7 +8518,6 @@ func Listenv() []string { // The function takes the following parameters: // // - utf8String: UTF-8 encoded string. -// - len: length of the string, or -1 if the string is nul-terminated. // // The function returns the following values: // @@ -8274,21 +8529,21 @@ func Listenv() []string { // 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, len int) (uint, []byte, error) { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(utf8String))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_locale_from_utf8(_arg1, _arg2, &_arg3, &_arg4, &_cerr) runtime.KeepAlive(utf8String) - runtime.KeepAlive(len) var _bytesRead uint // out var _guint8s []byte // out @@ -8365,29 +8620,32 @@ func LocaleToUTF8(opsysstring string) (bytesRead, bytesWritten uint, utf8 string } // LogDefaultHandler: default log handler set up by GLib; -// g_log_set_default_handler() 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 G_BREAKPOINT(). It automatically -// prints a new-line character after the message, so one does not need to be -// manually included in message. +// 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_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(). // -// - 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. +// 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(). // -// stderr is used for levels G_LOG_LEVEL_ERROR, G_LOG_LEVEL_CRITICAL, -// G_LOG_LEVEL_WARNING and G_LOG_LEVEL_MESSAGE. stdout is used for the rest, -// unless stderr was requested by g_log_writer_default_set_use_stderr(). -// -// This has no effect if structured logging is enabled; see [Using Structured -// Logging][using-structured-logging]. +// This has no effect if structured logging is enabled; see Using Structured +// Logging (logging.html#using-structured-logging). // // The function takes the following parameters: // @@ -8395,7 +8653,7 @@ func LocaleToUTF8(opsysstring string) (bytesRead, bytesWritten uint, utf8 string // "" application domain. // - logLevel: level of the message. // - message (optional): message. -// - unusedData (optional): data passed from g_log() which is unused. +// - 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 @@ -8420,15 +8678,43 @@ func LogDefaultHandler(logDomain string, logLevel LogLevelFlags, message string, 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][using-structured-logging]. +// 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 g_log_set_handler(). +// - 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 @@ -8442,10 +8728,12 @@ func LogRemoveHandler(logDomain string, handlerId uint) { 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. -// G_LOG_LEVEL_ERROR is always fatal. +// 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)). @@ -8453,10 +8741,10 @@ func LogRemoveHandler(logDomain string, handlerId uint) { // Libraries should not call this function, as it affects all messages logged by // a process, including those from other libraries. // -// Structured log messages (using g_log_structured() and -// g_log_structured_array()) are fatal only if the default log writer is used; +// 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][using-structured-logging]. +// fatal. See Using Structured Logging (logging.html#using-structured-logging). // // The function takes the following parameters: // @@ -8482,19 +8770,45 @@ func LogSetAlwaysFatal(fatalMask LogLevelFlags) LogLevelFlags { 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. -// G_LOG_LEVEL_ERROR is always fatal. // -// This has no effect on structured log messages (using g_log_structured() -// or g_log_structured_array()). To change the fatal behaviour for +// 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 g_log_set_writer_func(). See [Using Structured -// Logging][using-structured-logging]. +// function using glib.LogSetWriterFunc(). See Using Structured Logging +// (logging.html#using-structured-logging). // -// This function is mostly intended to be used with G_LOG_LEVEL_CRITICAL. -// You should typically not set G_LOG_LEVEL_WARNING, G_LOG_LEVEL_MESSAGE, -// G_LOG_LEVEL_INFO or G_LOG_LEVEL_DEBUG as fatal except inside of test -// programs. +// 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: // @@ -8524,19 +8838,22 @@ func LogSetFatalMask(logDomain string, fatalMask LogLevelFlags) LogLevelFlags { return _logLevelFlags } -// LogStructuredArray: log a message with structured data. The message -// will be passed through to the log writer set by the application using -// g_log_set_writer_func(). If the message is fatal (i.e. its log level is -// G_LOG_LEVEL_ERROR), the program will be aborted at the end of this function. +// 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 g_log_structured() for more documentation. +// 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 LevelFlags, or a user-defined level. +// - 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 @@ -8559,29 +8876,32 @@ func LogStructuredArray(logLevel LogLevelFlags, fields []LogField) { runtime.KeepAlive(fields) } -// LogVariant: log a message with structured data, accepting the data within -// a #GVariant. This version is especially useful for use in other languages, -// via introspection. +// 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 String -// (VARIANT_TYPE_STRING). Array of bytes (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 +// 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 g_variant_print() will be used to convert the value into a +// 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 -// g_log_structured(). +// glib.LogStructured(). // // The function takes the following parameters: // // - logDomain (optional): log domain, usually G_LOG_DOMAIN. -// - logLevel: log level, either from LevelFlags, or a user-defined level. -// - fields: dictionary (#GVariant of the type G_VARIANT_TYPE_VARDICT) +// - 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 @@ -8602,35 +8922,40 @@ func LogVariant(logDomain string, logLevel LogLevelFlags, fields *Variant) { } // 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. +// 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 WriterFunc, and is the default writer used if -// no other is set using g_log_set_writer_func(). +// 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 g_log_default_handler(), this function drops debug and informational -// messages unless their log domain (or all) is listed in the space-separated -// G_MESSAGES_DEBUG environment variable. +// 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(). // -// g_log_writer_default() uses the mask set by g_log_set_always_fatal() to -// determine which messages are fatal. When using a custom writer func instead -// it is up to the writer function to determine which log messages are fatal. +// 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 LevelFlags, or a user-defined level. +// - 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 g_log_set_writer_func(). +// - userData (optional): user data passed to glib.LogSetWriterFunc(). // // The function returns the following values: // -// - logWriterOutput: G_LOG_WRITER_HANDLED on success, G_LOG_WRITER_UNHANDLED -// otherwise. +// - 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 @@ -8662,15 +8987,17 @@ func LogWriterDefault(logLevel LogLevelFlags, fields []LogField, userData unsafe return _logWriterOutput } -// LogWriterDefaultSetUseStderr: configure whether the built-in log -// functions (g_log_default_handler() for the old-style API, and both -// g_log_writer_default() and g_log_writer_standard_streams() for the structured -// API) will output all log messages to stderr. +// LogWriterDefaultSetUseStderr: configure whether the built-in log functions +// will output all log messages to stderr. // -// By default, log messages of levels G_LOG_LEVEL_INFO and G_LOG_LEVEL_DEBUG -// 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. +// 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 @@ -8691,33 +9018,42 @@ func LogWriterDefaultSetUseStderr(useStderr bool) { runtime.KeepAlive(useStderr) } -// LogWriterDefaultWouldDrop: check whether g_log_writer_default() and -// g_log_default_handler() would ignore a message with the given domain and +// LogWriterDefaultWouldDrop: check whether glib.LogWriterDefault() and +// glib.LogDefaultHandler() would ignore a message with the given domain and // level. // -// As with g_log_default_handler(), this function drops debug and informational -// messages unless their log domain (or all) is listed in the space-separated -// G_MESSAGES_DEBUG environment variable. +// 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 (G_LOG_LEVEL_DEBUG, G_LOG_DOMAIN)) -// { -// gchar *result = expensive_computation (my_object); +// if (g_log_writer_default_would_drop (log_level, log_domain)) +// return G_LOG_WRITER_HANDLED; +// ]| // -// g_debug ("my_object result: s", result); -// g_free (result); -// }. +// 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 LevelFlags, or a user-defined level. +// - 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 +// - 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 @@ -8744,10 +9080,11 @@ func LogWriterDefaultWouldDrop(logLevel LogLevelFlags, logDomain string) bool { } // 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 g_log_structured()). It does not -// include values from unknown fields. +// 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 @@ -8755,9 +9092,11 @@ func LogWriterDefaultWouldDrop(logLevel LogLevelFlags, logDomain string) bool { // // The function takes the following parameters: // -// - logLevel: log level, either from LevelFlags, or a user-defined level. +// - 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 when formatting the +// - 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: @@ -8833,25 +9172,27 @@ func LogWriterIsJournald(outputFd int) bool { } // 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. +// journal as a set of key–value pairs. // -// This is suitable for use as a WriterFunc. +// 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 G_LOG_WRITER_UNHANDLED. +// defined, but will always return glib.LogWriterOutput.UNHANDLED. // // The function takes the following parameters: // -// - logLevel: log level, either from LevelFlags, or a user-defined level. +// - 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 g_log_set_writer_func(). +// - userData (optional): user data passed to glib.LogSetWriterFunc(). // // The function returns the following values: // -// - logWriterOutput: G_LOG_WRITER_HANDLED on success, G_LOG_WRITER_UNHANDLED -// otherwise. +// - 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 @@ -8884,29 +9225,33 @@ func LogWriterJournald(logLevel LogLevelFlags, fields []LogField, userData unsaf } // LogWriterStandardStreams: format a structured log message and print it to -// either stdout or stderr, depending on its log level. G_LOG_LEVEL_INFO and -// G_LOG_LEVEL_DEBUG messages are sent to stdout, or to stderr if requested -// by g_log_writer_default_set_use_stderr(); all other log levels are sent to -// stderr. Only fields which are understood by this function are included in the +// 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, they will be used -// in the output. +// 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 WriterFunc. +// This is suitable for use as a glib.LogWriterFunc. // // The function takes the following parameters: // -// - logLevel: log level, either from LevelFlags, or a user-defined level. +// - 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 g_log_set_writer_func(). +// - userData (optional): user data passed to glib.LogSetWriterFunc(). // // The function returns the following values: // -// - logWriterOutput: G_LOG_WRITER_HANDLED on success, G_LOG_WRITER_UNHANDLED -// otherwise. +// - 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 @@ -8938,9 +9283,11 @@ func LogWriterStandardStreams(logLevel LogLevelFlags, fields []LogField, userDat return _logWriterOutput } -// LogWriterSupportsColor: check whether the given output_fd file descriptor -// supports ANSI color escape sequences. If so, they can safely be used when -// formatting log messages. +// 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: // @@ -8967,6 +9314,61 @@ func LogWriterSupportsColor(outputFd int) bool { 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: @@ -9095,23 +9497,22 @@ func MarkupErrorQuark() Quark { // The function takes the following parameters: // // - text: some valid UTF-8 text. -// - length of text in bytes, or -1 if the text is nul-terminated. // // The function returns the following values: // // - utf8: newly allocated string with the escaped text. -func MarkupEscapeText(text string, length int) string { +func MarkupEscapeText(text string) string { var _arg1 *C.gchar // out - var _arg2 C.gssize // out + var _arg2 C.gssize var _cret *C.gchar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(text))) + _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)) - _arg2 = C.gssize(length) _cret = C.g_markup_escape_text(_arg1, _arg2) runtime.KeepAlive(text) - runtime.KeepAlive(length) var _utf8 string // out @@ -9178,7 +9579,7 @@ func OptionErrorQuark() 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 +// 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 @@ -9408,6 +9809,38 @@ func PatternMatchSimple(pattern, str string) bool { 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. @@ -9418,7 +9851,7 @@ func PatternMatchSimple(pattern, str string) bool { // 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). +// 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 @@ -9696,11 +10129,13 @@ func SetApplicationName(applicationName string) { // 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 +// 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]. // -// Note that for thread-safety reasons this function can only be called once. +// 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: // @@ -9785,11 +10220,21 @@ func ShellErrorQuark() 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 SHELL_ERROR domain. +// 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: @@ -9833,10 +10278,14 @@ func ShellParseArgv(commandLine string) ([]string, error) { } // 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). +// 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: // @@ -9863,23 +10312,30 @@ func ShellQuote(unquotedString string) string { return _filename } -// ShellUnquote unquotes a string as the shell (/bin/sh) would. 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). +// 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 SHELL_ERROR domain. +// 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. +// Double quotes allow $, , ", \`, and newline to be escaped with backslash. // Otherwise double quotes preserve things literally. // // The function takes the following parameters: @@ -9943,53 +10399,90 @@ func SpacedPrimesClosest(num uint) uint { return _guint } -// SpawnCheckExitStatus: set error if exit_status indicates the child exited +// 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 an exit -// status for subprocesses encoded in a platform-specific way. On Unix, this is +// 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 -// exit_status required use of platform-specific APIs, which is problematic for +// 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 exit +// 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 exit_status. On Windows, +// 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, -// the domain will be G_SPAWN_ERROR, and the code will be G_SPAWN_ERROR_FAILED. +// 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 exit_status directly. Do not attempt to scan or parse the +// 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: // -// - exitStatus: exit code as returned from g_spawn_sync(). -func SpawnCheckExitStatus(exitStatus int) error { +// - 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(exitStatus) + _arg1 = C.gint(waitStatus) - C.g_spawn_check_exit_status(_arg1, &_cerr) - runtime.KeepAlive(exitStatus) + C.g_spawn_check_wait_status(_arg1, &_cerr) + runtime.KeepAlive(waitStatus) var _goerr error // out @@ -10002,6 +10495,7 @@ func SpawnCheckExitStatus(exitStatus int) error { // 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 @@ -10034,15 +10528,22 @@ func SpawnCommandLineAsync(commandLine string) error { // 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. command_line 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 exit_status is non-NULL, the platform-specific exit status of the child is -// stored there; see the documentation of g_spawn_check_exit_status() for how to -// use and interpret this. +// 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 @@ -10061,9 +10562,9 @@ func SpawnCommandLineAsync(commandLine string) error { // // - standardOutput (optional): return location for child output. // - standardError (optional): return location for child errors. -// - exitStatus (optional): return location for child exit status, as returned +// - waitStatus (optional): return location for child wait status, as returned // by waitpid(). -func SpawnCommandLineSync(commandLine string) (standardOutput, standardError []byte, exitStatus int, goerr error) { +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 @@ -10078,7 +10579,7 @@ func SpawnCommandLineSync(commandLine string) (standardOutput, standardError []b var _standardOutput []byte // out var _standardError []byte // out - var _exitStatus int // out + var _waitStatus int // out var _goerr error // out if _arg2 != nil { @@ -10113,12 +10614,12 @@ func SpawnCommandLineSync(commandLine string) (standardOutput, standardError []b } } } - _exitStatus = int(_arg4) + _waitStatus = int(_arg4) if _cerr != nil { _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _standardOutput, _standardError, _exitStatus, _goerr + return _standardOutput, _standardError, _waitStatus, _goerr } func SpawnErrorQuark() Quark { @@ -10145,141 +10646,6 @@ func SpawnExitErrorQuark() Quark { return _quark } -// SpawnSync executes a child synchronously (waits for the child to exit before -// returning). All output from the child is stored in standard_output and -// standard_error, if those parameters are non-NULL. Note that you must set the -// G_SPAWN_STDOUT_TO_DEV_NULL and G_SPAWN_STDERR_TO_DEV_NULL flags when passing -// NULL for standard_output and standard_error. -// -// If exit_status is non-NULL, the platform-specific exit status of the child -// is stored there; see the documentation of g_spawn_check_exit_status() -// for how to use and interpret this. Note that it is invalid to pass -// G_SPAWN_DO_NOT_REAP_CHILD in flags, and on POSIX platforms, the same -// restrictions as for g_child_watch_source_new() apply. -// -// If an error occurs, no data is returned in standard_output, standard_error, -// or exit_status. -// -// This function calls g_spawn_async_with_pipes() internally; see that function -// for full details on the other parameters and details on how these functions -// work on Windows. -// -// The function takes the following parameters: -// -// - workingDirectory (optional) child's current working directory, or NULL to -// inherit parent's. -// - argv: child's argument vector. -// - envp (optional): child's environment, or NULL to inherit parent's. -// - flags from Flags. -// - childSetup (optional): function to run in the child just before exec(). -// -// The function returns the following values: -// -// - standardOutput (optional): return location for child output, or NULL. -// - standardError (optional): return location for child error messages, -// or NULL. -// - exitStatus (optional): return location for child exit status, as returned -// by waitpid(), or NULL. -func SpawnSync(workingDirectory string, argv, envp []string, flags SpawnFlags, childSetup SpawnChildSetupFunc) (standardOutput, standardError []byte, exitStatus int, goerr error) { - var _arg1 *C.gchar // out - var _arg2 **C.gchar // out - var _arg3 **C.gchar // out - var _arg4 C.GSpawnFlags // out - var _arg5 C.GSpawnChildSetupFunc // out - var _arg6 C.gpointer - var _arg7 *C.gchar // in - var _arg8 *C.gchar // in - var _arg9 C.gint // in - var _cerr *C.GError // in - - if workingDirectory != "" { - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(workingDirectory))) - defer C.free(unsafe.Pointer(_arg1)) - } - { - _arg2 = (**C.gchar)(C.calloc(C.size_t((len(argv) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) - defer C.free(unsafe.Pointer(_arg2)) - { - out := unsafe.Slice(_arg2, len(argv)+1) - var zero *C.gchar - out[len(argv)] = zero - for i := range argv { - out[i] = (*C.gchar)(unsafe.Pointer(C.CString(argv[i]))) - defer C.free(unsafe.Pointer(out[i])) - } - } - } - { - _arg3 = (**C.gchar)(C.calloc(C.size_t((len(envp) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) - defer C.free(unsafe.Pointer(_arg3)) - { - out := unsafe.Slice(_arg3, 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])) - } - } - } - _arg4 = C.GSpawnFlags(flags) - if childSetup != nil { - _arg5 = (*[0]byte)(C._gotk4_glib2_SpawnChildSetupFunc) - _arg6 = C.gpointer(gbox.AssignOnce(childSetup)) - } - - C.g_spawn_sync(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, &_arg7, &_arg8, &_arg9, &_cerr) - runtime.KeepAlive(workingDirectory) - runtime.KeepAlive(argv) - runtime.KeepAlive(envp) - runtime.KeepAlive(flags) - runtime.KeepAlive(childSetup) - - var _standardOutput []byte // out - var _standardError []byte // out - var _exitStatus int // out - var _goerr error // out - - if _arg7 != nil { - defer C.free(unsafe.Pointer(_arg7)) - { - var i int - var z C.gchar - for p := _arg7; *p != z; p = &unsafe.Slice(p, 2)[1] { - i++ - } - - src := unsafe.Slice(_arg7, i) - _standardOutput = make([]byte, i) - for i := range src { - _standardOutput[i] = byte(src[i]) - } - } - } - if _arg8 != nil { - defer C.free(unsafe.Pointer(_arg8)) - { - var i int - var z C.gchar - for p := _arg8; *p != z; p = &unsafe.Slice(p, 2)[1] { - i++ - } - - src := unsafe.Slice(_arg8, i) - _standardError = make([]byte, i) - for i := range src { - _standardError[i] = byte(src[i]) - } - } - } - _exitStatus = int(_arg9) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } - - return _standardOutput, _standardError, _exitStatus, _goerr -} - // 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. @@ -10481,8 +10847,6 @@ func TimeoutSourceNewSeconds(interval uint) *Source { // The function takes the following parameters: // // - str: UCS-4 encoded string. -// - len: maximum length (number of characters) of str to use. If len < 0, -// then the string is nul-terminated. // // The function returns the following values: // @@ -10493,20 +10857,21 @@ func TimeoutSourceNewSeconds(interval uint) *Source { // - 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, len int32) (itemsRead, itemsWritten int32, guint16 *uint16, goerr error) { - var _arg1 *C.gunichar // out - var _arg2 C.glong // out +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 - _arg1 = (*C.gunichar)(unsafe.Pointer(str)) - _arg2 = C.glong(len) + _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) - runtime.KeepAlive(len) var _itemsRead int32 // out var _itemsWritten int32 // out @@ -10529,8 +10894,6 @@ func UCS4ToUTF16(str *uint32, len int32) (itemsRead, itemsWritten int32, guint16 // The function takes the following parameters: // // - str: UCS-4 encoded string. -// - len: maximum length (number of characters) of str to use. If len < 0, -// then the string is nul-terminated. // // The function returns the following values: // @@ -10542,20 +10905,21 @@ func UCS4ToUTF16(str *uint32, len int32) (itemsRead, itemsWritten int32, guint16 // 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, len int32) (itemsRead, itemsWritten int32, utf8 string, goerr error) { +func UCS4ToUTF8(str []uint32) (itemsRead, itemsWritten int32, utf8 string, goerr error) { var _arg1 *C.gunichar // out - var _arg2 C.glong // out - var _arg3 C.glong // in - var _arg4 C.glong // in - var _cret *C.gchar // in - var _cerr *C.GError // in + var _arg2 C.glong + var _arg3 C.glong // in + var _arg4 C.glong // in + var _cret *C.gchar // in + var _cerr *C.GError // in - _arg1 = (*C.gunichar)(unsafe.Pointer(str)) - _arg2 = C.glong(len) + _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) - runtime.KeepAlive(len) var _itemsRead int32 // out var _itemsWritten int32 // out @@ -10818,30 +11182,30 @@ func UnicharFullyDecompose(ch uint32, compat bool, resultLen uint) (uint32, uint // The function takes the following parameters: // // - ch: unicode character. -// - mirroredCh: location to store the mirrored 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, mirroredCh *uint32) bool { - var _arg1 C.gunichar // out - var _arg2 *C.gunichar // out - var _cret C.gboolean // in +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) - _arg2 = (*C.gunichar)(unsafe.Pointer(mirroredCh)) - _cret = C.g_unichar_get_mirror_char(_arg1, _arg2) + _cret = C.g_unichar_get_mirror_char(_arg1, &_arg2) runtime.KeepAlive(ch) - runtime.KeepAlive(mirroredCh) - var _ok bool // out + var _mirroredCh uint32 // out + var _ok bool // out + _mirroredCh = uint32(_arg2) if _cret != 0 { _ok = true } - return _ok + return _mirroredCh, _ok } // UnicharGetScript looks up the Script for a particular character (as defined @@ -11579,85 +11943,17 @@ func UnicodeCanonicalDecomposition(ch uint32, resultLen *uint) *uint32 { // The function takes the following parameters: // // - str: UCS-4 encoded string. -// - len: maximum length of string to use. -func UnicodeCanonicalOrdering(str *uint32, len uint) { +func UnicodeCanonicalOrdering(str []uint32) { var _arg1 *C.gunichar // out - var _arg2 C.gsize // out + var _arg2 C.gsize - _arg1 = (*C.gunichar)(unsafe.Pointer(str)) - _arg2 = C.gsize(len) + _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) - runtime.KeepAlive(len) -} - -// 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 } // Unsetenv removes an environment variable from the environment. @@ -11692,9 +11988,9 @@ func Unsetenv(variable string) { // Usleep pauses the current thread for the given number of microseconds. // -// There are 1 million microseconds per second (represented by the 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. +// 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: // @@ -11714,8 +12010,6 @@ func Usleep(microseconds uint32) { // The function takes the following parameters: // // - str: UTF-16 encoded string. -// - len: maximum length (number of #gunichar2) of str to use. If len < 0, -// then the string is nul-terminated. // // The function returns the following values: // @@ -11728,20 +12022,21 @@ func Usleep(microseconds uint32) { // - 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, len int32) (itemsRead, itemsWritten int32, gunichar *uint32, goerr error) { +func UTF16ToUCS4(str []uint16) (itemsRead, itemsWritten int32, gunichar *uint32, goerr error) { var _arg1 *C.gunichar2 // out - var _arg2 C.glong // out - var _arg3 C.glong // in - var _arg4 C.glong // in - var _cret *C.gunichar // in - var _cerr *C.GError // in + var _arg2 C.glong + var _arg3 C.glong // in + var _arg4 C.glong // in + var _cret *C.gunichar // in + var _cerr *C.GError // in - _arg1 = (*C.gunichar2)(unsafe.Pointer(str)) - _arg2 = C.glong(len) + _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) - runtime.KeepAlive(len) var _itemsRead int32 // out var _itemsWritten int32 // out @@ -11773,33 +12068,33 @@ func UTF16ToUCS4(str *uint16, len int32) (itemsRead, itemsWritten int32, gunicha // The function takes the following parameters: // // - str: UTF-16 encoded string. -// - len: maximum length (number of #gunichar2) of str to use. If len < 0, -// then the string is nul-terminated. // // 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. +// 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, len int32) (itemsRead, itemsWritten int32, utf8 string, goerr error) { +func UTF16ToUTF8(str []uint16) (itemsRead, itemsWritten int32, utf8 string, goerr error) { var _arg1 *C.gunichar2 // out - var _arg2 C.glong // out - var _arg3 C.glong // in - var _arg4 C.glong // in - var _cret *C.gchar // in - var _cerr *C.GError // in + var _arg2 C.glong + var _arg3 C.glong // in + var _arg4 C.glong // in + var _cret *C.gchar // in + var _cerr *C.GError // in - _arg1 = (*C.gunichar2)(unsafe.Pointer(str)) - _arg2 = C.glong(len) + _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) - runtime.KeepAlive(len) var _itemsRead int32 // out var _itemsWritten int32 // out @@ -11831,23 +12126,22 @@ func UTF16ToUTF8(str *uint16, len int32) (itemsRead, itemsWritten int32, utf8 st // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: length of str, in bytes, or -1 if str is nul-terminated. // // The function returns the following values: // // - utf8: newly allocated string, that is a case independent form of str. -func UTF8Casefold(str string, len int) string { +func UTF8Casefold(str string) string { var _arg1 *C.gchar // out - var _arg2 C.gssize // out + var _arg2 C.gssize var _cret *C.gchar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_utf8_casefold(_arg1, _arg2) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _utf8 string // out @@ -11863,6 +12157,10 @@ func UTF8Casefold(str string, len int) string { // 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. @@ -11904,24 +12202,23 @@ func UTF8Collate(str1, str2 string) int { // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: length of str, in bytes, or -1 if str is nul-terminated. // // 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, len int) string { +func UTF8CollateKey(str string) string { var _arg1 *C.gchar // out - var _arg2 C.gssize // out + var _arg2 C.gssize var _cret *C.gchar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_utf8_collate_key(_arg1, _arg2) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _utf8 string // out @@ -11947,24 +12244,23 @@ func UTF8CollateKey(str string, len int) string { // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: length of str, in bytes, or -1 if str is nul-terminated. // // 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, len int) string { +func UTF8CollateKeyForFilename(str string) string { var _arg1 *C.gchar // out - var _arg2 C.gssize // out + var _arg2 C.gssize var _cret *C.gchar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_utf8_collate_key_for_filename(_arg1, _arg2) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _utf8 string // out @@ -12101,7 +12397,6 @@ func UTF8GetChar(p string) uint32 { // The function takes the following parameters: // // - p: pointer to Unicode character encoded as UTF-8. -// - maxLen: maximum number of bytes to read, or -1 if p is nul-terminated. // // The function returns the following values: // @@ -12109,18 +12404,18 @@ func UTF8GetChar(p string) uint32 { // 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, maxLen int) uint32 { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +func UTF8GetCharValidated(p string) uint32 { + var _arg1 *C.gchar // out + var _arg2 C.gssize var _cret C.gunichar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(p))) + _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)) - _arg2 = C.gssize(maxLen) _cret = C.g_utf8_get_char_validated(_arg1, _arg2) runtime.KeepAlive(p) - runtime.KeepAlive(maxLen) var _gunichar uint32 // out @@ -12142,24 +12437,22 @@ func UTF8GetCharValidated(p string, maxLen int) uint32 { // The function takes the following parameters: // // - str: string to coerce into UTF-8. -// - len: maximum length of str to use, in bytes. If len < 0, then the string -// is nul-terminated. // // The function returns the following values: // // - utf8: valid UTF-8 string whose content resembles str. -func UTF8MakeValid(str string, len int) string { +func UTF8MakeValid(str string) string { var _arg1 *C.gchar // out - var _arg2 C.gssize // out + var _arg2 C.gssize var _cret *C.gchar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_utf8_make_valid(_arg1, _arg2) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _utf8 string // out @@ -12191,27 +12484,26 @@ func UTF8MakeValid(str string, len int) string { // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: length of str, in bytes, or -1 if str is nul-terminated. // - 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, len int, mode NormalizeMode) string { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gssize(len) _arg3 = C.GNormalizeMode(mode) _cret = C.g_utf8_normalize(_arg1, _arg2, _arg3) runtime.KeepAlive(str) - runtime.KeepAlive(len) runtime.KeepAlive(mode) var _utf8 string // out @@ -12339,7 +12631,6 @@ func UTF8PrevChar(p string) string { // The function takes the following parameters: // // - p: nul-terminated UTF-8 encoded string. -// - len: maximum length of p. // - c: unicode character. // // The function returns the following values: @@ -12347,20 +12638,20 @@ func UTF8PrevChar(p string) string { // - 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, len int, c uint32) string { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(p))) + _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)) - _arg2 = C.gssize(len) _arg3 = C.gunichar(c) _cret = C.g_utf8_strchr(_arg1, _arg2, _arg3) runtime.KeepAlive(p) - runtime.KeepAlive(len) runtime.KeepAlive(c) var _utf8 string // out @@ -12379,23 +12670,22 @@ func UTF8Strchr(p string, len int, c uint32) string { // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: length of str, in bytes, or -1 if str is nul-terminated. // // The function returns the following values: // // - utf8: newly allocated string, with all characters converted to lowercase. -func UTF8Strdown(str string, len int) string { +func UTF8Strdown(str string) string { var _arg1 *C.gchar // out - var _arg2 C.gssize // out + var _arg2 C.gssize var _cret *C.gchar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_utf8_strdown(_arg1, _arg2) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _utf8 string // out @@ -12445,8 +12735,8 @@ func UTF8Strlen(p string, max int) int32 { // 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 to fit the largest possible UTF-8 -// characters. +// 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: // @@ -12488,7 +12778,6 @@ func UTF8Strncpy(dest, src string, n uint) string { // The function takes the following parameters: // // - p: nul-terminated UTF-8 encoded string. -// - len: maximum length of p. // - c: unicode character. // // The function returns the following values: @@ -12496,20 +12785,20 @@ func UTF8Strncpy(dest, src string, n uint) string { // - 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, len int, c uint32) string { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(p))) + _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)) - _arg2 = C.gssize(len) _arg3 = C.gunichar(c) _cret = C.g_utf8_strrchr(_arg1, _arg2, _arg3) runtime.KeepAlive(p) - runtime.KeepAlive(len) runtime.KeepAlive(c) var _utf8 string // out @@ -12536,24 +12825,22 @@ func UTF8Strrchr(p string, len int, c uint32) string { // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: maximum length of str to use, in bytes. If len < 0, then the string -// is nul-terminated. // // The function returns the following values: // // - utf8: newly-allocated string which is the reverse of str. -func UTF8Strreverse(str string, len int) string { +func UTF8Strreverse(str string) string { var _arg1 *C.gchar // out - var _arg2 C.gssize // out + var _arg2 C.gssize var _cret *C.gchar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_utf8_strreverse(_arg1, _arg2) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _utf8 string // out @@ -12571,23 +12858,22 @@ func UTF8Strreverse(str string, len int) string { // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: length of str, in bytes, or -1 if str is nul-terminated. // // The function returns the following values: // // - utf8: newly allocated string, with all characters converted to uppercase. -func UTF8Strup(str string, len int) string { +func UTF8Strup(str string) string { var _arg1 *C.gchar // out - var _arg2 C.gssize // out + var _arg2 C.gssize var _cret *C.gchar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gssize(len) _cret = C.g_utf8_strup(_arg1, _arg2) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _utf8 string // out @@ -12600,11 +12886,15 @@ func UTF8Strup(str string, len int) string { // 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. +// - endPos: another character offset within str, or -1 to indicate the end of +// the string. // // The function returns the following values: // @@ -12641,8 +12931,6 @@ func UTF8Substring(str string, startPos, endPos int32) string { // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: maximum length of str to use, in bytes. If len < 0, then the string -// is nul-terminated. // // The function returns the following values: // @@ -12655,21 +12943,21 @@ func UTF8Substring(str string, startPos, endPos int32) string { // - 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, len int32) (itemsRead, itemsWritten int32, gunichar *uint32, goerr error) { - var _arg1 *C.gchar // out - var _arg2 C.glong // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.glong(len) _cret = C.g_utf8_to_ucs4(_arg1, _arg2, &_arg3, &_arg4, &_cerr) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _itemsRead int32 // out var _itemsWritten int32 // out @@ -12694,8 +12982,6 @@ func UTF8ToUCS4(str string, len int32) (itemsRead, itemsWritten int32, gunichar // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: maximum length of str to use, in bytes. If len < 0, then the string -// is nul-terminated. // // The function returns the following values: // @@ -12703,19 +12989,19 @@ func UTF8ToUCS4(str string, len int32) (itemsRead, itemsWritten int32, gunichar // 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, len int32) (int32, *uint32) { - var _arg1 *C.gchar // out - var _arg2 C.glong // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.glong(len) _cret = C.g_utf8_to_ucs4_fast(_arg1, _arg2, &_arg3) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _itemsWritten int32 // out var _gunichar *uint32 // out @@ -12732,8 +13018,6 @@ func UTF8ToUCS4Fast(str string, len int32) (int32, *uint32) { // The function takes the following parameters: // // - str: UTF-8 encoded string. -// - len: maximum length (number of bytes) of str to use. If len < 0, then the -// string is nul-terminated. // // The function returns the following values: // @@ -12746,21 +13030,21 @@ func UTF8ToUCS4Fast(str string, len int32) (int32, *uint32) { // - 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, len int32) (itemsRead, itemsWritten int32, guint16 *uint16, goerr error) { - var _arg1 *C.gchar // out - var _arg2 C.glong // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.glong(len) _cret = C.g_utf8_to_utf16(_arg1, _arg2, &_arg3, &_arg4, &_cerr) runtime.KeepAlive(str) - runtime.KeepAlive(len) var _itemsRead int32 // out var _itemsWritten int32 // out @@ -12777,6 +13061,42 @@ func UTF8ToUTF16(str string, len int32) (itemsRead, itemsWritten int32, guint16 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 @@ -12787,7 +13107,7 @@ func UTF8ToUTF16(str string, len int32) (itemsRead, itemsWritten int32, guint16 // 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 +// 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. // @@ -12971,1248 +13291,1643 @@ func (a *Array) SetLen(len uint) { *valptr = C.guint(len) } -// ByteArray contains the public fields of a GByteArray. +// 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 ByteArray struct { - *byteArray +type BookmarkFile struct { + *bookmarkFile } -// byteArray is the struct that's finalized. -type byteArray struct { - native *C.GByteArray +// bookmarkFile is the struct that's finalized. +type bookmarkFile struct { + native *C.GBookmarkFile } -// 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 +func marshalBookmarkFile(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &BookmarkFile{&bookmarkFile{(*C.GBookmarkFile)(b)}}, nil } -// 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 -} +// NewBookmarkFile constructs a struct BookmarkFile. +func NewBookmarkFile() *BookmarkFile { + var _cret *C.GBookmarkFile // in -// Len: number of elements in the Array. -func (b *ByteArray) SetLen(len uint) { - valptr := &b.native.len - *valptr = C.guint(len) + _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 } -// Bytes: simple refcounted data type representing an immutable sequence of zero -// or more bytes from an unspecified origin. +// AddApplication adds the application with name and exec to the list of +// applications that have registered a bookmark for uri into bookmark. // -// 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. +// 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. // -// 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. +// 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. // -// #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(). +// 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. // -// 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. +// If no bookmark for uri is found, one is created. // -// An instance of this type is always passed by reference. -type Bytes struct { - *bytes +// 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) } -// bytes is the struct that's finalized. -type bytes struct { - native *C.GBytes +// 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) } -// NewBytes constructs a struct Bytes. -func NewBytes(data []byte) *Bytes { - var _arg1 C.gconstpointer // out - var _arg2 C.gsize - var _cret *C.GBytes // in +// 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 - _arg2 = (C.gsize)(len(data)) - if len(data) > 0 { - _arg1 = (C.gconstpointer)(unsafe.Pointer(&data[0])) - } + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) - _cret = C.g_bytes_new(_arg1, _arg2) - runtime.KeepAlive(data) + _cret = C.g_bookmark_file_copy(_arg0) + runtime.KeepAlive(bookmark) - var _bytes *Bytes // out + var _bookmarkFile *BookmarkFile // out - _bytes = (*Bytes)(gextras.NewStructNative(unsafe.Pointer(_cret))) + _bookmarkFile = (*BookmarkFile)(gextras.NewStructNative(unsafe.Pointer(_cret))) runtime.SetFinalizer( - gextras.StructIntern(unsafe.Pointer(_bytes)), + gextras.StructIntern(unsafe.Pointer(_bookmarkFile)), func(intern *struct{ C unsafe.Pointer }) { - C.g_bytes_unref((*C.GBytes)(intern.C)) + C.g_bookmark_file_free((*C.GBookmarkFile)(intern.C)) }, ) - return _bytes + return _bookmarkFile } -// Compare compares the two #GBytes values. +// AddedDateTime gets the time the bookmark for uri was added to bookmark // -// 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. +// 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: // -// - bytes2: pointer to a #GBytes to compare with bytes1. +// - uri: valid URI. // // 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 +// - 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.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes1))) - _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes2))) + _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_bytes_compare(_arg0, _arg1) - runtime.KeepAlive(bytes1) - runtime.KeepAlive(bytes2) + _cret = C.g_bookmark_file_get_added_date_time(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _gint int // out + var _dateTime *DateTime // out + var _goerr error // out - _gint = int(_cret) + _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 _gint + return _dateTime, _goerr } -// Equal compares the two #GBytes values being pointed to and returns TRUE if -// they are equal. +// 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. // -// 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 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: // -// - bytes2: pointer to a #GBytes to compare with bytes1. +// - uri: valid URI. +// - name application's name. // // 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 +// - 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.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes1))) - _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes2))) + _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)) - _cret = C.g_bytes_equal(_arg0, _arg1) - runtime.KeepAlive(bytes1) - runtime.KeepAlive(bytes2) + C.g_bookmark_file_get_application_info(_arg0, _arg1, _arg2, &_arg3, &_arg4, &_arg5, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(name) - var _ok bool // out + var _exec string // out + var _count uint // out + var _stamp *DateTime // out + var _goerr error // out - if _cret != 0 { - _ok = true + 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 _ok + return _exec, _count, _stamp, _goerr } -// Data: get the byte data in the #GBytes. This data should not be modified. +// Applications retrieves the names of the applications that have registered the +// bookmark for uri. // -// This function will always return the same pointer for a given #GBytes. +// In the event the URI cannot be found, NULL is returned and error is set to +// G_BOOKMARK_FILE_ERROR_URI_NOT_FOUND. // -// 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 takes the following parameters: +// +// - uri: valid URI. // // 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 +// - 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.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + _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_bytes_get_data(_arg0, &_arg1) - runtime.KeepAlive(bytes) + _cret = C.g_bookmark_file_get_applications(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _guint8s []byte // out + var _utf8s []string // out + var _goerr error // out - _guint8s = make([]byte, _arg1) - copy(_guint8s, unsafe.Slice((*byte)(unsafe.Pointer(_cret)), _arg1)) + 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 _guint8s + return _utf8s, _goerr } -// Size: get the size of the byte data in the #GBytes. +// Description retrieves the description of the bookmark for uri. // -// This function will always return the same value for a given #GBytes. +// 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: // -// - gsize: size. -func (bytes *Bytes) Size() uint { - var _arg0 *C.GBytes // out - var _cret C.gsize // in +// - 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.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + _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_bytes_get_size(_arg0) - runtime.KeepAlive(bytes) + _cret = C.g_bookmark_file_get_description(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _gsize uint // out + var _utf8 string // out + var _goerr error // out - _gsize = uint(_cret) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } - return _gsize + return _utf8, _goerr } -// Hash creates an integer hash code for the byte data in the #GBytes. +// Groups retrieves the list of group names of the bookmark for uri. // -// 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. +// 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: // -// - guint: hash value corresponding to the key. -func (bytes *Bytes) Hash() uint { - var _arg0 C.gconstpointer // out - var _cret C.guint // in +// - 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.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes))) + _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_bytes_hash(_arg0) - runtime.KeepAlive(bytes) + _cret = C.g_bookmark_file_get_groups(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _guint uint // out + var _utf8s []string // out + var _goerr error // out - _guint = uint(_cret) + 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 _guint + return _utf8s, _goerr } -// 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. +// Icon gets the icon of the bookmark for uri. // -// 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. +// 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: // -// - offset which subsection starts at. -// - length of subsection. +// - uri: valid URI. // // 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 +// - 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.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) - _arg1 = C.gsize(offset) - _arg2 = C.gsize(length) + _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_bytes_new_from_bytes(_arg0, _arg1, _arg2) - runtime.KeepAlive(bytes) - runtime.KeepAlive(offset) - runtime.KeepAlive(length) + C.g_bookmark_file_get_icon(_arg0, _arg1, &_arg2, &_arg3, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _ret *Bytes // out + var _href string // out + var _mimeType string // out + var _goerr error // 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)) - }, - ) + 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 _ret + return _href, _mimeType, _goerr } -// Checksum: opaque structure representing a checksumming operation. -// To create a new GChecksum, use g_checksum_new(). To free a GChecksum, -// use g_checksum_free(). +// IsPrivate gets whether the private flag of the bookmark for uri is set. // -// An instance of this type is always passed by reference. -type Checksum struct { - *checksum -} +// 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 -// checksum is the struct that's finalized. -type checksum struct { - native *C.GChecksum -} + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) + defer C.free(unsafe.Pointer(_arg1)) -func marshalChecksum(p uintptr) (interface{}, error) { - b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &Checksum{&checksum{(*C.GChecksum)(b)}}, nil + 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 } -// NewChecksum constructs a struct Checksum. -func NewChecksum(checksumType ChecksumType) *Checksum { - var _arg1 C.GChecksumType // out - var _cret *C.GChecksum // in +// 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 - _arg1 = C.GChecksumType(checksumType) + _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_checksum_new(_arg1) - runtime.KeepAlive(checksumType) + _cret = C.g_bookmark_file_get_mime_type(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _checksum *Checksum // out + var _utf8 string // out + var _goerr error // 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)) - }, - ) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _checksum + return _utf8, _goerr } -// 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. +// 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: // -// - 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 +// - 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.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) + _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_checksum_copy(_arg0) - runtime.KeepAlive(checksum) + _cret = C.g_bookmark_file_get_modified_date_time(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _ret *Checksum // out + var _dateTime *DateTime // out + var _goerr error // out - _ret = (*Checksum)(gextras.NewStructNative(unsafe.Pointer(_cret))) + _dateTime = (*DateTime)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_date_time_ref(_cret) runtime.SetFinalizer( - gextras.StructIntern(unsafe.Pointer(_ret)), + gextras.StructIntern(unsafe.Pointer(_dateTime)), func(intern *struct{ C unsafe.Pointer }) { - C.g_checksum_free((*C.GChecksum)(intern.C)) + C.g_date_time_unref((*C.GDateTime)(intern.C)) }, ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } - return _ret + return _dateTime, _goerr } -// String gets the digest as a hexadecimal string. +// Size gets the number of bookmarks inside bookmark. // -// Once this function has been called the #GChecksum can no longer be updated -// with g_checksum_update(). +// The function returns the following values: // -// The hexadecimal characters will be lower case. +// - 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: 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 +// - 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.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) + _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_checksum_get_string(_arg0) - runtime.KeepAlive(checksum) + _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 + return _utf8, _goerr } -// Reset resets the state of the checksum back to its initial state. -func (checksum *Checksum) Reset() { - var _arg0 *C.GChecksum // out +// 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.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) - C.g_checksum_reset(_arg0) - runtime.KeepAlive(checksum) -} + _cret = C.g_bookmark_file_get_uris(_arg0, &_arg1) + runtime.KeepAlive(bookmark) -// 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 + var _utf8s []string // out - _arg0 = (*C.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) - _arg2 = (C.gssize)(len(data)) - if len(data) > 0 { - _arg1 = (*C.guchar)(unsafe.Pointer(&data[0])) + 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])) + } } - C.g_checksum_update(_arg0, _arg1, _arg2) - runtime.KeepAlive(checksum) - runtime.KeepAlive(data) + return _utf8s } -// ChecksumTypeGetLength gets the length in bytes of digests of type -// checksum_type. +// 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: // -// - checksumType: Type. +// - uri: valid URI. // // 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 +// - 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 - _arg1 = C.GChecksumType(checksumType) + _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_checksum_type_get_length(_arg1) - runtime.KeepAlive(checksumType) + _cret = C.g_bookmark_file_get_visited_date_time(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _gssize int // out + var _dateTime *DateTime // out + var _goerr error // out - _gssize = int(_cret) + _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 _gssize + return _dateTime, _goerr } -// DateTime: GDateTime is an opaque structure whose members cannot be accessed -// directly. +// HasApplication checks whether the bookmark for uri inside bookmark has been +// registered by application name. // -// An instance of this type is always passed by reference. -type DateTime struct { - *dateTime -} +// 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 -// dateTime is the struct that's finalized. -type dateTime struct { - native *C.GDateTime -} + _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)) -func marshalDateTime(p uintptr) (interface{}, error) { - b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &DateTime{&dateTime{(*C.GDateTime)(b)}}, nil -} + C.g_bookmark_file_has_application(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(name) -// 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 + var _goerr error // 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)) - }, - ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _dateTime + return _goerr } -// 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 +// 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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(text))) + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(uri))) defer C.free(unsafe.Pointer(_arg1)) - if defaultTz != nil { - _arg2 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(defaultTz))) - } + _arg2 = (*C.gchar)(unsafe.Pointer(C.CString(group))) + defer C.free(unsafe.Pointer(_arg2)) - _cret = C.g_date_time_new_from_iso8601(_arg1, _arg2) - runtime.KeepAlive(text) - runtime.KeepAlive(defaultTz) + C.g_bookmark_file_has_group(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(group) - var _dateTime *DateTime // out + var _goerr error // 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)) - }, - ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _dateTime + return _goerr } -// NewDateTimeFromTimevalLocal constructs a struct DateTime. -func NewDateTimeFromTimevalLocal(tv *TimeVal) *DateTime { - var _arg1 *C.GTimeVal // out - var _cret *C.GDateTime // in +// 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 - _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(tv))) + _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_date_time_new_from_timeval_local(_arg1) - runtime.KeepAlive(tv) + _cret = C.g_bookmark_file_has_item(_arg0, _arg1) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _dateTime *DateTime // out + var _ok bool // 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)) - }, - ) + if _cret != 0 { + _ok = true } - return _dateTime + return _ok } -// NewDateTimeFromTimevalUTC constructs a struct DateTime. -func NewDateTimeFromTimevalUTC(tv *TimeVal) *DateTime { - var _arg1 *C.GTimeVal // out - var _cret *C.GDateTime // in +// 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 - _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(tv))) + _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)) - _cret = C.g_date_time_new_from_timeval_utc(_arg1) - runtime.KeepAlive(tv) + C.g_bookmark_file_load_from_data(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(data) - var _dateTime *DateTime // out + var _goerr error // 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)) - }, - ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _dateTime + return _goerr } -// NewDateTimeFromUnixLocal constructs a struct DateTime. -func NewDateTimeFromUnixLocal(t int64) *DateTime { - var _arg1 C.gint64 // out - var _cret *C.GDateTime // in +// 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 - _arg1 = C.gint64(t) + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(file))) + defer C.free(unsafe.Pointer(_arg1)) - _cret = C.g_date_time_new_from_unix_local(_arg1) - runtime.KeepAlive(t) + C.g_bookmark_file_load_from_data_dirs(_arg0, _arg1, &_arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(file) - var _dateTime *DateTime // out + var _fullPath string // out + var _goerr error // 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)) - }, - ) + 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 _dateTime + return _fullPath, _goerr } -// NewDateTimeFromUnixUTC constructs a struct DateTime. -func NewDateTimeFromUnixUTC(t int64) *DateTime { - var _arg1 C.gint64 // out - var _cret *C.GDateTime // in +// 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 - _arg1 = C.gint64(t) + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) - _cret = C.g_date_time_new_from_unix_utc(_arg1) - runtime.KeepAlive(t) + C.g_bookmark_file_load_from_file(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(filename) - var _dateTime *DateTime // out + var _goerr error // 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)) - }, - ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _dateTime + return _goerr } -// 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 +// 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 - _arg1 = C.gint(year) - _arg2 = C.gint(month) - _arg3 = C.gint(day) - _arg4 = C.gint(hour) - _arg5 = C.gint(minute) - _arg6 = C.gdouble(seconds) + _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)) + } - _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) + C.g_bookmark_file_move_item(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(oldUri) + runtime.KeepAlive(newUri) - var _dateTime *DateTime // out + var _goerr error // 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)) - }, - ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _dateTime + return _goerr } -// 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 -} +// 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 -// NewDateTimeNowLocal constructs a struct DateTime. -func NewDateTimeNowLocal() *DateTime { - var _cret *C.GDateTime // 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)) - _cret = C.g_date_time_new_now_local() + C.g_bookmark_file_remove_application(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(name) - var _dateTime *DateTime // out + var _goerr error // 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)) - }, - ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _dateTime + return _goerr } -// NewDateTimeNowUTC constructs a struct DateTime. -func NewDateTimeNowUTC() *DateTime { - var _cret *C.GDateTime // in +// 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 - _cret = C.g_date_time_new_now_utc() + _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)) - var _dateTime *DateTime // out + C.g_bookmark_file_remove_group(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(group) - 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)) - }, - ) + var _goerr error // out + + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _dateTime + return _goerr } -// 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 +// 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 - _arg1 = C.gint(year) - _arg2 = C.gint(month) - _arg3 = C.gint(day) - _arg4 = C.gint(hour) - _arg5 = C.gint(minute) - _arg6 = C.gdouble(seconds) + _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_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) + C.g_bookmark_file_remove_item(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) - var _dateTime *DateTime // out + var _goerr error // 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)) - }, - ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _dateTime + return _goerr } -// Add creates a copy of datetime and adds the specified timespan to the copy. -// -// The function takes the following parameters: +// SetAddedDateTime sets the time the bookmark for uri was added into bookmark. // -// - timespan: Span. +// If no bookmark for uri is found then it is created. // -// The function returns the following values: +// The function takes the following parameters: // -// - 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 +// - 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 - 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)) - }, - ) - } + _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))) - return _dateTime + C.g_bookmark_file_set_added_date_time(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(added) } -// AddDays creates a copy of datetime and adds the specified number of days to -// the copy. Add negative values to subtract days. +// SetApplicationInfo sets the meta-data of application name inside the list of +// applications that have registered a bookmark for uri inside bookmark. // -// The function takes the following parameters: +// You should rarely use this function; use g_bookmark_file_add_application() +// and g_bookmark_file_remove_application() instead. // -// - days: number of days. +// 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. // -// The function returns the following values: +// 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. // -// - 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 +// 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.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _arg1 = C.gint(days) + _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))) + } - _cret = C.g_date_time_add_days(_arg0, _arg1) - runtime.KeepAlive(datetime) - runtime.KeepAlive(days) + 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 _dateTime *DateTime // out + var _goerr error // 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)) - }, - ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _dateTime + return _goerr } -// AddFull creates a new Time adding the specified values to the current date -// and time in datetime. Add negative values to subtract. +// SetDescription sets description as the description of the bookmark for uri. // -// The function takes the following parameters: +// If uri is NULL, the description of bookmark is set. // -// - 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. +// If a bookmark for uri cannot be found then it is created. // -// The function returns the following values: +// The function takes the following parameters: // -// - 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 +// - 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 - 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)) - }, - ) + _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)) - return _dateTime + C.g_bookmark_file_set_description(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(description) } -// AddHours creates a copy of datetime and adds the specified number of hours. -// Add negative values to subtract hours. +// 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: // -// - 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 +// - 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 - 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)) - }, - ) + _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])) + } } - return _dateTime + C.g_bookmark_file_set_groups(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(groups) } -// AddMinutes creates a copy of datetime adding the specified number of minutes. -// Add negative values to subtract minutes. -// -// The function takes the following parameters: +// 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. // -// - minutes: number of minutes to add. +// If no bookmark for uri is found one is created. // -// The function returns the following values: +// The function takes the following parameters: // -// - 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 +// - 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 - 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)) - }, - ) + _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)) - return _dateTime + C.g_bookmark_file_set_icon(_arg0, _arg1, _arg2, _arg3) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(href) + runtime.KeepAlive(mimeType) } -// AddMonths creates a copy of datetime and adds the specified number of months -// to the copy. Add negative values to subtract months. +// SetIsPrivate sets the private flag of the bookmark for uri. // -// 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. +// If a bookmark for uri cannot be found then it is created. // // 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 +// - 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 - 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)) - }, - ) + _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 } - return _dateTime + C.g_bookmark_file_set_is_private(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(isPrivate) } -// 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: +// SetMIMEType sets mime_type as the MIME type of the bookmark for uri. // -// - seconds: number of seconds to add. +// If a bookmark for uri cannot be found then it is created. // -// The function returns the following values: +// The function takes the following parameters: // -// - 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 +// - 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 - 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)) - }, - ) - } + _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)) - return _dateTime + C.g_bookmark_file_set_mime_type(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(mimeType) } -// AddWeeks creates a copy of datetime and adds the specified number of weeks to -// the copy. Add negative values to subtract weeks. +// SetModifiedDateTime sets the last time the bookmark for uri was last +// modified. // -// The function takes the following parameters: +// If no bookmark for uri is found then it is created. // -// - weeks: number of weeks. +// 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 returns the following values: +// The function takes the following parameters: // -// - 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 +// - 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.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _arg1 = C.gint(weeks) + _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))) - _cret = C.g_date_time_add_weeks(_arg0, _arg1) - runtime.KeepAlive(datetime) - runtime.KeepAlive(weeks) + C.g_bookmark_file_set_modified_date_time(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(modified) +} - var _dateTime *DateTime // out +// 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 - 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)) - }, - ) + _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)) - return _dateTime + C.g_bookmark_file_set_title(_arg0, _arg1, _arg2) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(uri) + runtime.KeepAlive(title) } -// AddYears creates a copy of datetime and adds the specified number of years to -// the copy. Add negative values to subtract years. +// SetVisitedDateTime sets the time the bookmark for uri was last visited. // -// 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. +// 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: // -// - years: number of years. +// - 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: // -// - 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 +// - 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.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _arg1 = C.gint(years) + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) - _cret = C.g_date_time_add_years(_arg0, _arg1) - runtime.KeepAlive(datetime) - runtime.KeepAlive(years) + _cret = C.g_bookmark_file_to_data(_arg0, &_arg1, &_cerr) + runtime.KeepAlive(bookmark) - var _dateTime *DateTime // out + var _guint8s []byte // out + var _goerr error // 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)) - }, - ) + 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 _dateTime + return _guint8s, _goerr } -// Compare: comparison function for Times that is suitable as a Func. Both Times -// must be non-NULL. +// 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: // -// - 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 +// - 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.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt1))) - _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt2))) + _arg0 = (*C.GBookmarkFile)(gextras.StructNative(unsafe.Pointer(bookmark))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) - _cret = C.g_date_time_compare(_arg0, _arg1) - runtime.KeepAlive(dt1) - runtime.KeepAlive(dt2) + C.g_bookmark_file_to_file(_arg0, _arg1, &_cerr) + runtime.KeepAlive(bookmark) + runtime.KeepAlive(filename) - var _gint int // out + var _goerr error // out - _gint = int(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } - return _gint + return _goerr } -// 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). +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: // -// - begin: Time. +// - bytes2: pointer to a #GBytes to compare with bytes1. // // 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 +// - 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.GDateTime)(gextras.StructNative(unsafe.Pointer(end))) - _arg1 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(begin))) + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes2))) - _cret = C.g_date_time_difference(_arg0, _arg1) - runtime.KeepAlive(end) - runtime.KeepAlive(begin) + _cret = C.g_bytes_compare(_arg0, _arg1) + runtime.KeepAlive(bytes1) + runtime.KeepAlive(bytes2) - var _timeSpan TimeSpan // out + var _gint int // out - _timeSpan = TimeSpan(_cret) + _gint = int(_cret) - return _timeSpan + return _gint } -// Equal checks to see if dt1 and dt2 are equal. +// Equal compares the two #GBytes values being pointed to and returns TRUE if +// they are equal. // -// Equal here means that they represent the same moment after converting them to -// the same time zone. +// 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: // -// - dt2: Time. +// - bytes2: pointer to a #GBytes to compare with bytes1. // // The function returns the following values: // -// - ok: TRUE if dt1 and dt2 are equal. -func (dt1 *DateTime) Equal(dt2 *DateTime) bool { +// - 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(dt1))) - _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt2))) + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(bytes2))) - _cret = C.g_date_time_equal(_arg0, _arg1) - runtime.KeepAlive(dt1) - runtime.KeepAlive(dt2) + _cret = C.g_bytes_equal(_arg0, _arg1) + runtime.KeepAlive(bytes1) + runtime.KeepAlive(bytes2) var _ok bool // out @@ -14223,684 +14938,836 @@ func (dt1 *DateTime) Equal(dt2 *DateTime) bool { return _ok } -// Format creates a newly allocated string representing the requested format. +// Data: get the byte data in the #GBytes. This data should not be modified. // -// 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. +// This function will always return the same pointer for a given #GBytes. // -// 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. +// 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 following format specifiers are supported: +// The function returns the following values: // -// - \a: the abbreviated weekday name according to the current locale +// - 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. // -// - \A: the full weekday name according to the current locale +// The region starts at offset many bytes from the start of the data and +// contains n_elements many elements of element_size size. // -// - \b: the abbreviated month name according to the current locale +// n_elements may be zero, but element_size must always be non-zero. Ideally, +// element_size is a static constant (eg: sizeof a struct). // -// - \B: the full month name according to the current locale +// 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. // -// - \c: the preferred date and time representation for the current locale +// 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". // -// - \C: the century number (year/100) as a 2-digit integer (00-99) +// The function takes the following parameters: // -// - \d: the day of the month as a decimal number (range 01 to 31) +// - elementSize: non-zero element size. +// - offset to the start of the region within the bytes. +// - nElements: number of elements in the region. // -// - \e: the day of the month as a decimal number (range 1 to 31) +// The function returns the following values: // -// - \F: equivalent to Y-m-d (the ISO 8601 date format) +// - 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. // -// - \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. +// This function will always return the same value for a given #GBytes. // -// - \G: the ISO 8601 week-based year as a decimal number. This works well with -// \V and \u. +// The function returns the following values: // -// - \h: equivalent to \b +// - 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. // -// - \H: the hour as a decimal number using a 24-hour clock (range 00 to 23) +// 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. // -// - \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 blank -// -// - \l: the hour (12-hour clock) as a decimal number (range 1 to 12); single -// digits are preceded by a blank -// -// - \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. +// The function returns the following values: // -// - -: Do not pad a numeric result. This overrides the default padding for the -// specifier. +// - 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. // -// - 0: Pad a numeric result with zeros. This overrides the default padding for -// the specifier. +// A reference to bytes will be held by the newly created #GBytes until the byte +// data is no longer needed. // -// 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 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: // -// - format: valid UTF-8 string, containing the format for the Time. +// - offset which subsection starts at. +// - length of subsection. // // 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 +// - 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.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(format))) - defer C.free(unsafe.Pointer(_arg1)) + _arg0 = (*C.GBytes)(gextras.StructNative(unsafe.Pointer(bytes))) + _arg1 = C.gsize(offset) + _arg2 = C.gsize(length) - _cret = C.g_date_time_format(_arg0, _arg1) - runtime.KeepAlive(datetime) - runtime.KeepAlive(format) + _cret = C.g_bytes_new_from_bytes(_arg0, _arg1, _arg2) + runtime.KeepAlive(bytes) + runtime.KeepAlive(offset) + runtime.KeepAlive(length) - var _utf8 string // out + var _ret *Bytes // out - if _cret != nil { - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) - } + _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 _utf8 + return _ret } -// 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. +// 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. // -// Since GLib 2.66, this will output to sub-second precision if needed. +// To create a new GChecksum, use glib.Checksum.New. To free a GChecksum, +// use glib.Checksum.Free(). // -// The function returns the following values: +// 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. // -// - 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 +// An instance of this type is always passed by reference. +type Checksum struct { + *checksum +} - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) +// checksum is the struct that's finalized. +type checksum struct { + native *C.GChecksum +} - _cret = C.g_date_time_format_iso8601(_arg0) - runtime.KeepAlive(datetime) +func marshalChecksum(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &Checksum{&checksum{(*C.GChecksum)(b)}}, nil +} - var _utf8 string // out +// 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 { - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) + _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 _utf8 + return _checksum } -// DayOfMonth retrieves the day of the month represented by datetime in the -// gregorian calendar. +// 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: // -// - gint: day of the month. -func (datetime *DateTime) DayOfMonth() int { - var _arg0 *C.GDateTime // out - var _cret C.gint // in +// - 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.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg0 = (*C.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) - _cret = C.g_date_time_get_day_of_month(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_checksum_copy(_arg0) + runtime.KeepAlive(checksum) - var _gint int // out + var _ret *Checksum // out - _gint = int(_cret) + _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 _gint + return _ret } -// DayOfWeek retrieves the ISO 8601 day of the week on which datetime falls (1 -// is Monday, 2 is Tuesday... 7 is Sunday). +// 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: // -// - gint: day of the week. -func (datetime *DateTime) DayOfWeek() int { - var _arg0 *C.GDateTime // out - var _cret C.gint // in +// - 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.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg0 = (*C.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) - _cret = C.g_date_time_get_day_of_week(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_checksum_get_string(_arg0) + runtime.KeepAlive(checksum) - var _gint int // out + var _utf8 string // out - _gint = int(_cret) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - return _gint + return _utf8 } -// 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) +// Reset resets the state of the checksum back to its initial state. +func (checksum *Checksum) Reset() { + var _arg0 *C.GChecksum // out - var _gint int // out + _arg0 = (*C.GChecksum)(gextras.StructNative(unsafe.Pointer(checksum))) - _gint = int(_cret) + C.g_checksum_reset(_arg0) + runtime.KeepAlive(checksum) +} - return _gint +// 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) } -// Hour retrieves the hour of the day represented by datetime. +// 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: // -// - gint: hour of the day. -func (datetime *DateTime) Hour() int { - var _arg0 *C.GDateTime // out - var _cret C.gint // in +// - 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 - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.GChecksumType(checksumType) - _cret = C.g_date_time_get_hour(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_checksum_type_get_length(_arg1) + runtime.KeepAlive(checksumType) - var _gint int // out + var _gssize int // out - _gint = int(_cret) + _gssize = int(_cret) - return _gint + return _gssize } -// Microsecond retrieves the microsecond of the date represented by datetime. +// 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. // -// The function returns the following values: +// 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(). // -// - 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))) +// 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 +} - _cret = C.g_date_time_get_microsecond(_arg0) - runtime.KeepAlive(datetime) +// completion is the struct that's finalized. +type completion struct { + native *C.GCompletion +} - var _gint int // out +// 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 - _gint = int(_cret) + _arg0 = (*C.GCompletion)(gextras.StructNative(unsafe.Pointer(cmp))) - return _gint + C.g_completion_clear_items(_arg0) + runtime.KeepAlive(cmp) } -// Minute retrieves the minute of the hour represented by datetime. +// DateTime: GDateTime is a structure that combines a Gregorian date and time +// into a single structure. // -// The function returns the following values: +// 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. // -// - gint: minute of the hour. -func (datetime *DateTime) Minute() int { - var _arg0 *C.GDateTime // out - var _cret C.gint // in +// 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 +} - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) +// dateTime is the struct that's finalized. +type dateTime struct { + native *C.GDateTime +} - _cret = C.g_date_time_get_minute(_arg0) - runtime.KeepAlive(datetime) +func marshalDateTime(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &DateTime{&dateTime{(*C.GDateTime)(b)}}, nil +} - var _gint int // out +// 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 - _gint = int(_cret) + _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) - return _gint + _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 } -// 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 +// 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 - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _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_get_month(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_from_iso8601(_arg1, _arg2) + runtime.KeepAlive(text) + runtime.KeepAlive(defaultTz) - var _gint int // out + var _dateTime *DateTime // out - _gint = int(_cret) + 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 _gint + return _dateTime } -// 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 +// NewDateTimeFromTimevalLocal constructs a struct DateTime. +func NewDateTimeFromTimevalLocal(tv *TimeVal) *DateTime { + var _arg1 *C.GTimeVal // out + var _cret *C.GDateTime // in - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(tv))) - _cret = C.g_date_time_get_second(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_from_timeval_local(_arg1) + runtime.KeepAlive(tv) - var _gint int // out + var _dateTime *DateTime // out - _gint = int(_cret) + 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 _gint + return _dateTime } -// 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 +// NewDateTimeFromTimevalUTC constructs a struct DateTime. +func NewDateTimeFromTimevalUTC(tv *TimeVal) *DateTime { + var _arg1 *C.GTimeVal // out + var _cret *C.GDateTime // in - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(tv))) - _cret = C.g_date_time_get_seconds(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_from_timeval_utc(_arg1) + runtime.KeepAlive(tv) - var _gdouble float64 // out + var _dateTime *DateTime // out - _gdouble = float64(_cret) + 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 _gdouble + return _dateTime } -// 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 +// NewDateTimeFromUnixLocal constructs a struct DateTime. +func NewDateTimeFromUnixLocal(t int64) *DateTime { + var _arg1 C.gint64 // out + var _cret *C.GDateTime // in - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint64(t) - _cret = C.g_date_time_get_timezone(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_from_unix_local(_arg1) + runtime.KeepAlive(t) - var _timeZone *TimeZone // out + var _dateTime *DateTime // 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)) - }, - ) + 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 _timeZone + return _dateTime } -// 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 +// NewDateTimeFromUnixLocalUsec constructs a struct DateTime. +func NewDateTimeFromUnixLocalUsec(usecs int64) *DateTime { + var _arg1 C.gint64 // out + var _cret *C.GDateTime // in - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint64(usecs) - _cret = C.g_date_time_get_timezone_abbreviation(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_from_unix_local_usec(_arg1) + runtime.KeepAlive(usecs) - var _utf8 string // out + var _dateTime *DateTime // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + 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 _utf8 + return _dateTime } -// 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 +// NewDateTimeFromUnixUTC constructs a struct DateTime. +func NewDateTimeFromUnixUTC(t int64) *DateTime { + var _arg1 C.gint64 // out + var _cret *C.GDateTime // in - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint64(t) - _cret = C.g_date_time_get_utc_offset(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_from_unix_utc(_arg1) + runtime.KeepAlive(t) - var _timeSpan TimeSpan // out + var _dateTime *DateTime // out - _timeSpan = TimeSpan(_cret) + 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 _timeSpan + return _dateTime } -// 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 +// NewDateTimeFromUnixUTCUsec constructs a struct DateTime. +func NewDateTimeFromUnixUTCUsec(usecs int64) *DateTime { + var _arg1 C.gint64 // out + var _cret *C.GDateTime // in - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint64(usecs) - _cret = C.g_date_time_get_week_numbering_year(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_from_unix_utc_usec(_arg1) + runtime.KeepAlive(usecs) - var _gint int // out + var _dateTime *DateTime // out - _gint = int(_cret) + 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 _gint + return _dateTime } -// 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 +// 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 - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _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_get_week_of_year(_arg0) - runtime.KeepAlive(datetime) + _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 _gint int // out + var _dateTime *DateTime // out - _gint = int(_cret) + 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 _gint + return _dateTime } -// 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 +// NewDateTimeNow constructs a struct DateTime. +func NewDateTimeNow(tz *TimeZone) *DateTime { + 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_get_year(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_now(_arg1) + runtime.KeepAlive(tz) - var _gint int // out + var _dateTime *DateTime // out - _gint = int(_cret) + 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 _gint + return _dateTime } -// 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))) +// NewDateTimeNowLocal constructs a struct DateTime. +func NewDateTimeNowLocal() *DateTime { + var _cret *C.GDateTime // in - C.g_date_time_get_ymd(_arg0, &_arg1, &_arg2, &_arg3) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_now_local() - var _year int // out - var _month int // out - var _day int // out + var _dateTime *DateTime // out - _year = int(_arg1) - _month = int(_arg2) - _day = int(_arg3) + 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 _year, _month, _day + return _dateTime } -// 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))) +// NewDateTimeNowUTC constructs a struct DateTime. +func NewDateTimeNowUTC() *DateTime { + var _cret *C.GDateTime // in - _cret = C.g_date_time_hash(_arg0) - runtime.KeepAlive(datetime) + _cret = C.g_date_time_new_now_utc() - var _guint uint // out + var _dateTime *DateTime // out - _guint = uint(_cret) + 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 _guint + return _dateTime } -// 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 +// 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 - _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _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_is_daylight_savings(_arg0) - runtime.KeepAlive(datetime) + _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 _ok bool // out + var _dateTime *DateTime // out - if _cret != 0 { - _ok = true + 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 _ok + return _dateTime } -// ToLocal creates a new Time corresponding to the same instant in time as -// datetime, but in the local time zone. +// Add creates a copy of datetime and adds the specified timespan to the copy. // -// This call is equivalent to calling g_date_time_to_timezone() with the time -// zone returned by g_time_zone_new_local(). +// 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) ToLocal() *DateTime { +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_to_local(_arg0) + _cret = C.g_date_time_add(_arg0, _arg1) runtime.KeepAlive(datetime) + runtime.KeepAlive(timespan) var _dateTime *DateTime // out @@ -14917,75 +15784,86 @@ func (datetime *DateTime) ToLocal() *DateTime { 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. +// 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: // -// - tv to modify. +// - days: number of days. // // The function returns the following values: // -// - ok: TRUE if successful, else FALSE. -func (datetime *DateTime) ToTimeval(tv *TimeVal) bool { +// - 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.GTimeVal // out - var _cret C.gboolean // in + var _arg1 C.gint // out + var _cret *C.GDateTime // in _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(tv))) + _arg1 = C.gint(days) - _cret = C.g_date_time_to_timeval(_arg0, _arg1) + _cret = C.g_date_time_add_days(_arg0, _arg1) runtime.KeepAlive(datetime) - runtime.KeepAlive(tv) + runtime.KeepAlive(days) - var _ok bool // out + var _dateTime *DateTime // out - if _cret != 0 { - _ok = true + 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 _ok + return _dateTime } -// 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). +// 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: // -// - tz: new Zone. +// - 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) ToTimezone(tz *TimeZone) *DateTime { +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.GTimeZone // 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.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) + _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_to_timezone(_arg0, _arg1) + _cret = C.g_date_time_add_full(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6) runtime.KeepAlive(datetime) - runtime.KeepAlive(tz) + runtime.KeepAlive(years) + runtime.KeepAlive(months) + runtime.KeepAlive(days) + runtime.KeepAlive(hours) + runtime.KeepAlive(minutes) + runtime.KeepAlive(seconds) var _dateTime *DateTime // out @@ -15002,49 +15880,28 @@ func (datetime *DateTime) ToTimezone(tz *TimeZone) *DateTime { 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: +// AddHours creates a copy of datetime and adds the specified number of hours. +// Add negative values to subtract hours. // -// - 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 -} - -// ToUTC creates a new Time corresponding to the same instant in time as -// datetime, but in UTC. +// The function takes the following parameters: // -// This call is equivalent to calling g_date_time_to_timezone() with the time -// zone returned by g_time_zone_new_utc(). +// - 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) ToUTC() *DateTime { +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_to_utc(_arg0) + _cret = C.g_date_time_add_hours(_arg0, _arg1) runtime.KeepAlive(datetime) + runtime.KeepAlive(hours) var _dateTime *DateTime // out @@ -15061,353 +15918,287 @@ func (datetime *DateTime) ToUTC() *DateTime { return _dateTime } -// DebugKey associates a string with a bit flag. Used in g_parse_debug_string(). +// AddMinutes creates a copy of datetime adding the specified number of minutes. +// Add negative values to subtract minutes. // -// 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 -} +// 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 -// Value: flag. -func (d *DebugKey) Value() uint { - valptr := &d.native.value - var _v uint // out - _v = uint(*valptr) - return _v -} + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(minutes) -// Value: flag. -func (d *DebugKey) SetValue(value uint) { - valptr := &d.native.value - *valptr = C.guint(value) -} + _cret = C.g_date_time_add_minutes(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(minutes) -// 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 -} + var _dateTime *DateTime // out -// hashTable is the struct that's finalized. -type hashTable struct { - native *C.GHashTable -} + 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)) + }, + ) + } -func marshalHashTable(p uintptr) (interface{}, error) { - b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &HashTable{&hashTable{(*C.GHashTable)(b)}}, nil + return _dateTime } -// 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. +// AddMonths creates a copy of datetime and adds the specified number of months +// to the copy. Add negative values to subtract months. // -// 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 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: // -// - hashTable: Table. -// - key (optional) to insert. +// - months: number of months. // // 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 +// - 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 - _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)) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(months) - _cret = C.g_hash_table_add(_arg1, _arg2) - runtime.KeepAlive(hashTable) - runtime.KeepAlive(key) + _cret = C.g_date_time_add_months(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(months) - var _ok bool // out + var _dateTime *DateTime // out - if _cret != 0 { - _ok = true + 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 _ok + return _dateTime } -// HashTableContains checks if key is in hash_table. +// 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: // -// - hashTable: Table. -// - key (optional) to check. +// - seconds: number of seconds to add. // // 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 +// - 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 - _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)) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gdouble(seconds) - _cret = C.g_hash_table_contains(_arg1, _arg2) - runtime.KeepAlive(hashTable) - runtime.KeepAlive(key) + _cret = C.g_date_time_add_seconds(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(seconds) - var _ok bool // out + var _dateTime *DateTime // out - if _cret != 0 { - _ok = true + 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 _ok + return _dateTime } -// 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. +// 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: // -// - hashTable: Table. -func HashTableDestroy(hashTable map[unsafe.Pointer]unsafe.Pointer) { - var _arg1 *C.GHashTable // out +// - 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 - _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))) + _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)) + }, + ) } - defer C.g_hash_table_unref(_arg1) - C.g_hash_table_destroy(_arg1) - runtime.KeepAlive(hashTable) + return _dateTime } -// 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. +// AddYears creates a copy of datetime and adds the specified number of years to +// the copy. Add negative values to subtract years. // -// 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. +// 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: // -// - hashTable: Table. -// - key (optional) to insert. -// - value (optional) to associate with the key. +// - years: number of years. // // 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 +// - 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 - _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)) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = C.gint(years) - _cret = C.g_hash_table_insert(_arg1, _arg2, _arg3) - runtime.KeepAlive(hashTable) - runtime.KeepAlive(key) - runtime.KeepAlive(value) + _cret = C.g_date_time_add_years(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(years) - var _ok bool // out + var _dateTime *DateTime // out - if _cret != 0 { - _ok = true + 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 _ok + return _dateTime } -// 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(). +// Compare: comparison function for Times that is suitable as a Func. Both Times +// must be non-NULL. // // The function takes the following parameters: // -// - hashTable: Table. -// - key (optional) to look up. +// - dt2: second Time to compare. // // 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 +// - 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 - _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)) + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt2))) - _cret = C.g_hash_table_lookup(_arg1, _arg2) - runtime.KeepAlive(hashTable) - runtime.KeepAlive(key) + _cret = C.g_date_time_compare(_arg0, _arg1) + runtime.KeepAlive(dt1) + runtime.KeepAlive(dt2) - var _gpointer unsafe.Pointer // out + var _gint int // out - _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + _gint = int(_cret) - return _gpointer + return _gint } -// 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. +// 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: // -// - hashTable: Table. -// - lookupKey (optional): key to look up. +// - begin: Time. // // 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 +// - 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 - _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)) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(end))) + _arg1 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(begin))) - _cret = C.g_hash_table_lookup_extended(_arg1, _arg2, &_arg3, &_arg4) - runtime.KeepAlive(hashTable) - runtime.KeepAlive(lookupKey) + _cret = C.g_date_time_difference(_arg0, _arg1) + runtime.KeepAlive(end) + runtime.KeepAlive(begin) - var _origKey unsafe.Pointer // out - var _value unsafe.Pointer // out - var _ok bool // out + var _timeSpan TimeSpan // out - _origKey = (unsafe.Pointer)(unsafe.Pointer(_arg3)) - _value = (unsafe.Pointer)(unsafe.Pointer(_arg4)) - if _cret != 0 { - _ok = true - } + _timeSpan = TimeSpan(_cret) - return _origKey, _value, _ok + return _timeSpan } -// HashTableRemove removes a key and its associated value from a Table. +// Equal checks to see if dt1 and dt2 are equal. // -// 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. +// Equal here means that they represent the same moment after converting them to +// the same time zone. // // The function takes the following parameters: // -// - hashTable: Table. -// - key (optional) to remove. +// - dt2: Time. // // The function returns the following values: // -// - ok: TRUE if the key was found and removed from the Table. -func HashTableRemove(hashTable map[unsafe.Pointer]unsafe.Pointer, key unsafe.Pointer) bool { - var _arg1 *C.GHashTable // out - var _arg2 C.gconstpointer // out +// - 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 - _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)) + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt1))) + _arg1 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(dt2))) - _cret = C.g_hash_table_remove(_arg1, _arg2) - runtime.KeepAlive(hashTable) - runtime.KeepAlive(key) + _cret = C.g_date_time_equal(_arg0, _arg1) + runtime.KeepAlive(dt1) + runtime.KeepAlive(dt2) var _ok bool // out @@ -15418,3182 +16209,5596 @@ func HashTableRemove(hashTable map[unsafe.Pointer]unsafe.Pointer, key unsafe.Poi return _ok } -// HashTableRemoveAll removes all keys and their associated values from a Table. +// Format creates a newly allocated string representing the requested format. // -// 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 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. // -// The function takes the following parameters: +// 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. // -// - 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. +// The following format specifiers are supported: // -// 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. +// - a: the abbreviated weekday name according to the current locale // -// The function takes the following parameters: +// - A: the full weekday name according to the current locale // -// - hashTable: Table. -// - key (optional) to insert. -// - value (optional) to associate with the key. +// - b: the abbreviated month name according to the current locale // -// The function returns the following values: +// - B: the full month name according to the current locale // -// - 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. +// - c: the preferred date and time representation for the current locale // -// The function takes the following parameters: +// - C: the century number (year/100) as a 2-digit integer (00-99) // -// - hashTable: Table. +// - d: the day of the month as a decimal number (range 01 to 31) // -// The function returns the following values: +// - e: the day of the month as a decimal number (range 1 to 31); single digits +// are preceded by a figure space (U+2007) // -// - 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. +// - 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: // -// - hashTable: Table. -// - key (optional) to remove. +// - format: valid UTF-8 string, containing the format for the Time. // // 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 +// - 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 - _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)) + _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_hash_table_steal(_arg1, _arg2) - runtime.KeepAlive(hashTable) - runtime.KeepAlive(key) + _cret = C.g_date_time_format(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(format) - var _ok bool // out + var _utf8 string // out - if _cret != 0 { - _ok = true + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) } - return _ok + return _utf8 } -// HashTableStealAll removes all keys and their associated values from a Table -// without calling the key and value destroy functions. +// 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. // -// The function takes the following parameters: +// Since GLib 2.66, this will output to sub-second precision if needed. // -// - hashTable: Table. -func HashTableStealAll(hashTable map[unsafe.Pointer]unsafe.Pointer) { - var _arg1 *C.GHashTable // out +// 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 - _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))) + _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)) } - defer C.g_hash_table_unref(_arg1) - C.g_hash_table_steal_all(_arg1) - runtime.KeepAlive(hashTable) + return _utf8 } -// 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(). -// -// You can pass NULL for lookup_key, 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. +// DayOfMonth retrieves the day of the month represented by datetime in the +// gregorian calendar. // // 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 +// - gint: day of the month. +func (datetime *DateTime) DayOfMonth() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // 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)) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_hash_table_steal_extended(_arg1, _arg2, &_arg3, &_arg4) - runtime.KeepAlive(hashTable) - runtime.KeepAlive(lookupKey) + _cret = C.g_date_time_get_day_of_month(_arg0) + runtime.KeepAlive(datetime) - var _stolenKey unsafe.Pointer // out - var _stolenValue unsafe.Pointer // out - var _ok bool // out + var _gint int // out - _stolenKey = (unsafe.Pointer)(unsafe.Pointer(_arg3)) - _stolenValue = (unsafe.Pointer)(unsafe.Pointer(_arg4)) - if _cret != 0 { - _ok = true - } + _gint = int(_cret) - return _stolenKey, _stolenValue, _ok + return _gint } -// 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(). +// DayOfWeek retrieves the ISO 8601 day of the week on which datetime falls (1 +// is Monday, 2 is Tuesday... 7 is Sunday). // -// The iteration order of a TableIter over the keys/values in a hash table is -// not defined. +// The function returns the following values: // -// An instance of this type is always passed by reference. -type HashTableIter struct { - *hashTableIter -} +// - gint: day of the week. +func (datetime *DateTime) DayOfWeek() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in -// hashTableIter is the struct that's finalized. -type hashTableIter struct { - native *C.GHashTableIter + _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 } -// 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 -// }. +// DayOfYear retrieves the day of the year represented by datetime in the +// Gregorian calendar. // -// The function takes the following parameters: +// The function returns the following values: // -// - hashTable: Table. -func (iter *HashTableIter) Init(hashTable map[unsafe.Pointer]unsafe.Pointer) { - var _arg0 *C.GHashTableIter // out - var _arg1 *C.GHashTable // out +// - gint: day of the year. +func (datetime *DateTime) DayOfYear() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in - _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) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - C.g_hash_table_iter_init(_arg0, _arg1) - runtime.KeepAlive(iter) - runtime.KeepAlive(hashTable) + _cret = C.g_date_time_get_day_of_year(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint } -// 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. +// Hour retrieves the hour of the day represented by datetime. // // 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 +// - gint: hour of the day. +func (datetime *DateTime) Hour() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in - _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_hash_table_iter_next(_arg0, &_arg1, &_arg2) - runtime.KeepAlive(iter) + _cret = C.g_date_time_get_hour(_arg0) + runtime.KeepAlive(datetime) - var _key unsafe.Pointer // out - var _value unsafe.Pointer // out - var _ok bool // out + var _gint int // out - _key = (unsafe.Pointer)(unsafe.Pointer(_arg1)) - _value = (unsafe.Pointer)(unsafe.Pointer(_arg2)) - if _cret != 0 { - _ok = true - } + _gint = int(_cret) - return _key, _value, _ok + return _gint } -// 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. +// Microsecond retrieves the microsecond of the date represented by datetime. // -// It is safe to continue iterating the Table afterward: +// The function returns the following values: // -// 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 +// - gint: microsecond of the second. +func (datetime *DateTime) Microsecond() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in - _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - C.g_hash_table_iter_remove(_arg0) - runtime.KeepAlive(iter) + _cret = C.g_date_time_get_microsecond(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint } -// 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. +// Minute retrieves the minute of the hour represented by datetime. // -// The function takes the following parameters: +// The function returns the following values: // -// - value (optional) to replace with. -func (iter *HashTableIter) Replace(value unsafe.Pointer) { - var _arg0 *C.GHashTableIter // out - var _arg1 C.gpointer // out +// - gint: minute of the hour. +func (datetime *DateTime) Minute() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in - _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) - _arg1 = (C.gpointer)(unsafe.Pointer(value)) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - C.g_hash_table_iter_replace(_arg0, _arg1) - runtime.KeepAlive(iter) - runtime.KeepAlive(value) -} + _cret = C.g_date_time_get_minute(_arg0) + runtime.KeepAlive(datetime) -// 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 + var _gint int // out - _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + _gint = int(_cret) - C.g_hash_table_iter_steal(_arg0) - runtime.KeepAlive(iter) + return _gint } -// IOChannel: data structure representing an IO Channel. The fields should be -// considered private and should only be accessed with the following functions. +// Month retrieves the month of the year represented by datetime in the +// Gregorian calendar. // -// An instance of this type is always passed by reference. -type IOChannel struct { - *ioChannel -} +// 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 -// ioChannel is the struct that's finalized. -type ioChannel struct { - native *C.GIOChannel -} + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) -func marshalIOChannel(p uintptr) (interface{}, error) { - b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &IOChannel{&ioChannel{(*C.GIOChannel)(b)}}, nil + _cret = C.g_date_time_get_month(_arg0) + runtime.KeepAlive(datetime) + + var _gint int // out + + _gint = int(_cret) + + return _gint } -// 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 +// 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 - _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)) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_new_file(_arg1, _arg2, &_cerr) - runtime.KeepAlive(filename) - runtime.KeepAlive(mode) + _cret = C.g_date_time_get_second(_arg0) + runtime.KeepAlive(datetime) - var _ioChannel *IOChannel // out - var _goerr error // out + var _gint int // 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)) - } + _gint = int(_cret) - return _ioChannel, _goerr + return _gint } -// NewIOChannelUnix constructs a struct IOChannel. -func NewIOChannelUnix(fd int) *IOChannel { - var _arg1 C.int // out - var _cret *C.GIOChannel // in +// 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 - _arg1 = C.int(fd) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_unix_new(_arg1) - runtime.KeepAlive(fd) + _cret = C.g_date_time_get_seconds(_arg0) + runtime.KeepAlive(datetime) - var _ioChannel *IOChannel // out + var _gdouble float64 // 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)) - }, - ) + _gdouble = float64(_cret) - return _ioChannel + return _gdouble } -// 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. +// Timezone: get the time zone for this datetime. // // The function returns the following values: // -// - ioStatus status of the operation: One of IO_STATUS_NORMAL, -// IO_STATUS_AGAIN, or IO_STATUS_ERROR. -func (channel *IOChannel) Flush() (IOStatus, error) { - var _arg0 *C.GIOChannel // out - var _cret C.GIOStatus // in - var _cerr *C.GError // in +// - timeZone: time zone. +func (datetime *DateTime) Timezone() *TimeZone { + var _arg0 *C.GDateTime // out + var _cret *C.GTimeZone // in - _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_flush(_arg0, &_cerr) - runtime.KeepAlive(channel) + _cret = C.g_date_time_get_timezone(_arg0) + runtime.KeepAlive(datetime) - var _ioStatus IOStatus // out - var _goerr error // out + var _timeZone *TimeZone // out - _ioStatus = IOStatus(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _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 _ioStatus, _goerr + return _timeZone } -// 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. +// 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: // -// - ioCondition: OCondition. -func (channel *IOChannel) BufferCondition() IOCondition { - var _arg0 *C.GIOChannel // out - var _cret C.GIOCondition // in +// - 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_get_buffer_condition(_arg0) - runtime.KeepAlive(channel) + _cret = C.g_date_time_get_timezone_abbreviation(_arg0) + runtime.KeepAlive(datetime) - var _ioCondition IOCondition // out + var _utf8 string // out - _ioCondition = IOCondition(_cret) + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - return _ioCondition + return _utf8 } -// BufferSize gets the buffer size. +// 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: // -// - gsize: size of the buffer. -func (channel *IOChannel) BufferSize() uint { - var _arg0 *C.GIOChannel // out - var _cret C.gsize // in +// - 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_get_buffer_size(_arg0) - runtime.KeepAlive(channel) + _cret = C.g_date_time_get_utc_offset(_arg0) + runtime.KeepAlive(datetime) - var _gsize uint // out + var _timeSpan TimeSpan // out - _gsize = uint(_cret) + _timeSpan = TimeSpan(_cret) - return _gsize + return _timeSpan } -// Buffered returns whether channel is buffered. +// 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: // -// - ok: TRUE if the channel is buffered. -func (channel *IOChannel) Buffered() bool { - var _arg0 *C.GIOChannel // out - var _cret C.gboolean // in +// - 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_get_buffered(_arg0) - runtime.KeepAlive(channel) + _cret = C.g_date_time_get_week_numbering_year(_arg0) + runtime.KeepAlive(datetime) - var _ok bool // out + var _gint int // out - if _cret != 0 { - _ok = true - } + _gint = int(_cret) - return _ok + return _gint } -// 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. +// 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: // -// - 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 +// - gint: ISO 8601 week number for datetime. +func (datetime *DateTime) WeekOfYear() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in - _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_get_encoding(_arg0) - runtime.KeepAlive(channel) + _cret = C.g_date_time_get_week_of_year(_arg0) + runtime.KeepAlive(datetime) - var _utf8 string // out + var _gint int // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + _gint = int(_cret) - return _utf8 + return _gint } -// 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. +// Year retrieves the year represented by datetime in the Gregorian calendar. // // 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 +// - gint: year represented by datetime. +func (datetime *DateTime) Year() int { + var _arg0 *C.GDateTime // out + var _cret C.gint // in - _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_get_flags(_arg0) - runtime.KeepAlive(channel) + _cret = C.g_date_time_get_year(_arg0) + runtime.KeepAlive(datetime) - var _ioFlags IOFlags // out + var _gint int // out - _ioFlags = IOFlags(_cret) + _gint = int(_cret) - return _ioFlags + return _gint } -// 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 takes the following parameters: -// -// - length: location to return the length of the line terminator. +// Ymd retrieves the Gregorian day, month, and year of a given Time. // // The function returns the following values: // -// - utf8: line termination string. This value is owned by GLib and must not -// be freed. -func (channel *IOChannel) LineTerm(length *int) string { - var _arg0 *C.GIOChannel // out - var _arg1 *C.gint // out - var _cret *C.gchar // in +// - 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - _arg1 = (*C.gint)(unsafe.Pointer(length)) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_get_line_term(_arg0, _arg1) - runtime.KeepAlive(channel) - runtime.KeepAlive(length) + C.g_date_time_get_ymd(_arg0, &_arg1, &_arg2, &_arg3) + runtime.KeepAlive(datetime) - var _utf8 string // out + var _year int // out + var _month int // out + var _day int // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + _year = int(_arg1) + _month = int(_arg2) + _day = int(_arg3) - return _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) + return _year, _month, _day } -// ReadChars: replacement for g_io_channel_read() with the new API. -// -// The function takes the following parameters: -// -// - buf: a buffer to read data into. +// Hash hashes datetime into a #guint, suitable for use within Table. // // 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 +// - guint containing the hash. +func (datetime *DateTime) Hash() uint { + var _arg0 C.gconstpointer // out + var _cret C.guint // 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)) + _arg0 = *(*C.gconstpointer)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_read_chars(_arg0, _arg1, _arg2, &_arg3, &_cerr) - runtime.KeepAlive(channel) - runtime.KeepAlive(buf) + _cret = C.g_date_time_hash(_arg0) + runtime.KeepAlive(datetime) - var _bytesRead uint // out - var _ioStatus IOStatus // out - var _goerr error // out + var _guint uint // out - _bytesRead = uint(_arg3) - _ioStatus = IOStatus(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _guint = uint(_cret) - return _bytesRead, _ioStatus, _goerr + return _guint } -// 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. +// 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: // -// - 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 +// - 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_read_line(_arg0, &_arg1, &_arg2, &_arg3, &_cerr) - runtime.KeepAlive(channel) + _cret = C.g_date_time_is_daylight_savings(_arg0) + runtime.KeepAlive(datetime) - var _strReturn string // out - var _length uint // out - var _terminatorPos uint // out - var _ioStatus IOStatus // out - var _goerr error // out + var _ok bool // 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)) + if _cret != 0 { + _ok = true } - return _strReturn, _length, _terminatorPos, _ioStatus, _goerr + return _ok } -// ReadToEnd reads all the remaining data from the file. +// 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: // -// - 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 +// - 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_read_to_end(_arg0, &_arg1, &_arg2, &_cerr) - runtime.KeepAlive(channel) + _cret = C.g_date_time_to_local(_arg0) + runtime.KeepAlive(datetime) - var _strReturn []byte // out - var _ioStatus IOStatus // out - var _goerr error // out + var _dateTime *DateTime // 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)) + 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 _strReturn, _ioStatus, _goerr + return _dateTime } -// ReadUnichar reads a Unicode character from channel. This function cannot be -// called on a channel with NULL encoding. +// ToTimeval stores the instant in time that datetime represents into tv. // -// The function returns the following values: +// 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. // -// - 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(). +// 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. // -// Deprecated: Use g_io_channel_seek_position() instead. +// 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: // -// - 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). +// - tv to modify. // // 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 +// - 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - _arg1 = C.gint64(offset) - _arg2 = C.GSeekType(typ) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = (*C.GTimeVal)(gextras.StructNative(unsafe.Pointer(tv))) - _cret = C.g_io_channel_seek(_arg0, _arg1, _arg2) - runtime.KeepAlive(channel) - runtime.KeepAlive(offset) - runtime.KeepAlive(typ) + _cret = C.g_date_time_to_timeval(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(tv) - var _ioError IOError // out + var _ok bool // out - _ioError = IOError(_cret) + if _cret != 0 { + _ok = true + } - return _ioError + return _ok } -// SeekPosition: replacement for g_io_channel_seek() with the new API. +// 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: // -// - 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. +// - tz: new Zone. // // 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) +// - 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 - _cret = C.g_io_channel_seek_position(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(channel) - runtime.KeepAlive(offset) - runtime.KeepAlive(typ) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) + _arg1 = (*C.GTimeZone)(gextras.StructNative(unsafe.Pointer(tz))) - var _ioStatus IOStatus // out - var _goerr error // out + _cret = C.g_date_time_to_timezone(_arg0, _arg1) + runtime.KeepAlive(datetime) + runtime.KeepAlive(tz) - _ioStatus = IOStatus(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + 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 _ioStatus, _goerr + return _dateTime } -// SetBufferSize sets the buffer size. +// ToUnix gives the Unix time corresponding to datetime, rounding down to the +// nearest second. // -// The function takes the following parameters: +// 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. // -// - 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 +// 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - _arg1 = C.gsize(size) + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - C.g_io_channel_set_buffer_size(_arg0, _arg1) - runtime.KeepAlive(channel) - runtime.KeepAlive(size) + _cret = C.g_date_time_to_unix(_arg0) + runtime.KeepAlive(datetime) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 } -// 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. +// ToUnixUsec gives the Unix time corresponding to datetime, in microseconds. // -// The default state of the channel is buffered. +// 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 takes the following parameters: +// The function returns the following values: // -// - 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 +// - gint64: unix time corresponding to datetime. +func (datetime *DateTime) ToUnixUsec() int64 { + var _arg0 *C.GDateTime // out + var _cret C.gint64 // in - _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - if buffered { - _arg1 = C.TRUE - } + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - C.g_io_channel_set_buffered(_arg0, _arg1) - runtime.KeepAlive(channel) - runtime.KeepAlive(buffered) + _cret = C.g_date_time_to_unix_usec(_arg0) + runtime.KeepAlive(datetime) + + var _gint64 int64 // out + + _gint64 = int64(_cret) + + return _gint64 } -// 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: +// ToUTC creates a new Time corresponding to the same instant in time as +// datetime, but in UTC. // -// - encoding (optional) type. +// 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: // -// - 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 +// - 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - if encoding != "" { - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(encoding))) - defer C.free(unsafe.Pointer(_arg1)) - } + _arg0 = (*C.GDateTime)(gextras.StructNative(unsafe.Pointer(datetime))) - _cret = C.g_io_channel_set_encoding(_arg0, _arg1, &_cerr) - runtime.KeepAlive(channel) - runtime.KeepAlive(encoding) + _cret = C.g_date_time_to_utc(_arg0) + runtime.KeepAlive(datetime) - var _ioStatus IOStatus // out - var _goerr error // out + var _dateTime *DateTime // out - _ioStatus = IOStatus(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + 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 _ioStatus, _goerr + return _dateTime } -// 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. +// DebugKey associates a string with a bit flag. Used in g_parse_debug_string(). // -// The function returns the following values: +// 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. // -// - 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 +// An instance of this type is always passed by reference. +type Dir struct { + *dir +} - _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - _arg1 = C.GIOFlags(flags) +// dir is the struct that's finalized. +type dir struct { + native *C.GDir +} - _cret = C.g_io_channel_set_flags(_arg0, _arg1, &_cerr) - runtime.KeepAlive(channel) +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 _ioStatus IOStatus // out - var _goerr error // out + var _dir *Dir // out + var _goerr error // out - _ioStatus = IOStatus(_cret) + _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 _ioStatus, _goerr + return _dir, _goerr } -// SetLineTerm: this sets the string that OChannel uses to determine where in -// the file a line break occurs. +// Close closes the directory immediately and decrements the reference count. // -// The function takes the following parameters: +// Once the reference count reaches zero, the GDir structure itself will be +// freed. Prior to GLib 2.80, GDir was not reference counted. // -// - 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. -// - length of the termination string. If -1 is passed, the string is assumed -// to be nul-terminated. This option allows termination strings with -// embedded nuls. -func (channel *IOChannel) SetLineTerm(lineTerm string, length int) { - var _arg0 *C.GIOChannel // out - var _arg1 *C.gchar // out - var _arg2 C.gint // out +// 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - if lineTerm != "" { - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(lineTerm))) - defer C.free(unsafe.Pointer(_arg1)) - } - _arg2 = C.gint(length) + _arg0 = (*C.GDir)(gextras.StructNative(unsafe.Pointer(dir))) - C.g_io_channel_set_line_term(_arg0, _arg1, _arg2) - runtime.KeepAlive(channel) - runtime.KeepAlive(lineTerm) - runtime.KeepAlive(length) + C.g_dir_close(_arg0) + runtime.KeepAlive(dir) } -// 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(). +// 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. // -// The function takes the following parameters: +// 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. // -// - flush: if TRUE, flush pending. +// 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: // -// - 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 +// - 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.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - if flush { - _arg1 = C.TRUE - } + _arg0 = (*C.GDir)(gextras.StructNative(unsafe.Pointer(dir))) - _cret = C.g_io_channel_shutdown(_arg0, _arg1, &_cerr) - runtime.KeepAlive(channel) - runtime.KeepAlive(flush) + _cret = C.g_dir_read_name(_arg0) + runtime.KeepAlive(dir) - var _ioStatus IOStatus // out - var _goerr error // out + var _filename string // out - _ioStatus = IOStatus(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - return _ioStatus, _goerr + return _filename } -// 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 +// 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 - _gint = int(_cret) + _arg0 = (*C.GDir)(gextras.StructNative(unsafe.Pointer(dir))) - return _gint + C.g_dir_rewind(_arg0) + runtime.KeepAlive(dir) } -// Write writes data to a OChannel. +// DirMakeTmp creates a subdirectory in the preferred directory for temporary +// files (as returned by g_get_tmp_dir()). // -// Deprecated: Use g_io_channel_write_chars() instead. +// 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: // -// - buf: buffer containing the data to write. -// - count: number of bytes to write. -// - bytesWritten: number of bytes actually written. +// - tmpl (optional): template for directory name, as in g_mkdtemp(), basename +// only, or NULL for a default template. // // 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 +// - 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 - _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)) + if tmpl != "" { + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(tmpl))) + defer C.free(unsafe.Pointer(_arg1)) + } - _cret = C.g_io_channel_write(_arg0, _arg1, _arg2, _arg3) - runtime.KeepAlive(channel) - runtime.KeepAlive(buf) - runtime.KeepAlive(count) - runtime.KeepAlive(bytesWritten) + _cret = C.g_dir_make_tmp(_arg1, &_cerr) + runtime.KeepAlive(tmpl) - var _ioError IOError // out + var _filename string // out + var _goerr error // out - _ioError = IOError(_cret) + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } - return _ioError + return _filename, _goerr } -// WriteChars: replacement for g_io_channel_write() with the new API. +// HashTable struct is an opaque data structure to represent a [Hash +// Table][glib-Hash-Tables]. It should only be accessed via the following +// functions. // -// 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 (). +// 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: // -// - buf: buffer to write data from. -// - count: size of the buffer. If -1, the buffer is taken to be a -// nul-terminated string. +// - hashTable: Table. +// - key (optional) to insert. // // 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 +// - 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 - _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) + _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_io_channel_write_chars(_arg0, _arg1, _arg2, &_arg3, &_cerr) - runtime.KeepAlive(channel) - runtime.KeepAlive(buf) - runtime.KeepAlive(count) + _cret = C.g_hash_table_add(_arg1, _arg2) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(key) - var _bytesWritten uint // out - var _ioStatus IOStatus // out - var _goerr error // out + var _ok bool // out - _bytesWritten = uint(_arg3) - _ioStatus = IOStatus(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + if _cret != 0 { + _ok = true } - return _bytesWritten, _ioStatus, _goerr + return _ok } -// WriteUnichar writes a Unicode character to channel. This function cannot be -// called on a channel with NULL encoding. +// HashTableContains checks if key is in hash_table. // // The function takes the following parameters: // -// - thechar: character. +// - hashTable: Table. +// - key (optional) to check. // // 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 +// - 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 - _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - _arg1 = C.gunichar(thechar) + _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_io_channel_write_unichar(_arg0, _arg1, &_cerr) - runtime.KeepAlive(channel) - runtime.KeepAlive(thechar) + _cret = C.g_hash_table_contains(_arg1, _arg2) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(key) - var _ioStatus IOStatus // out - var _goerr error // out + var _ok bool // out - _ioStatus = IOStatus(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + if _cret != 0 { + _ok = true } - return _ioStatus, _goerr + return _ok } -// IOChannelErrorFromErrno converts an errno error number to a OChannelError. +// 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: // -// - 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 +// - hashTable: Table. +func HashTableDestroy(hashTable map[unsafe.Pointer]unsafe.Pointer) { + var _arg1 *C.GHashTable // out - _quark = Quark(_cret) + _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) - return _quark + C.g_hash_table_destroy(_arg1) + runtime.KeepAlive(hashTable) } -// IOFuncs: table of functions used to handle different types of OChannel in a -// generic way. +// 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). // -// 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 struct contains only private data and should not be accessed -// directly. +// 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). // -// 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 -} +// 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 -// NewKeyFile constructs a struct KeyFile. -func NewKeyFile() *KeyFile { - var _cret *C.GKeyFile // 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_key_file_new() + _cret = C.g_hash_table_find(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(predicate) - var _keyFile *KeyFile // out + var _gpointer unsafe.Pointer // 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)) - }, - ) + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) - return _keyFile + return _gpointer } -// Boolean returns the value associated with key under group_name as a boolean. +// 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(). // -// If key cannot be found then FALSE is returned and error is set to -// 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 -// KEY_FILE_ERROR_INVALID_VALUE. +// 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: // -// - 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 +// - 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 - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + _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)) - return _goerr + C.g_hash_table_foreach(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(fn) } -// BooleanList returns the values associated with key under group_name as -// booleans. +// 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. // -// If key cannot be found then NULL is returned and error is set to -// 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 -// KEY_FILE_ERROR_INVALID_VALUE. +// See TableIter for an alternative way to loop over the key/value pairs in the +// hash table. // // The function takes the following parameters: // -// - groupName: group name. -// - key: key. +// - hashTable: Table. +// - fn: function to call for each key/value pair. // // 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 +// - 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 - _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)) + _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_key_file_get_boolean_list(_arg0, _arg1, _arg2, &_arg3, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) + _cret = C.g_hash_table_foreach_remove(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(fn) - var _oks []bool // out - var _goerr error // out + var _guint uint // 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)) - } + _guint = uint(_cret) - return _oks, _goerr + return _guint } -// 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. +// 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. // -// 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. +// See TableIter for an alternative way to loop over the key/value pairs in the +// hash table. // // The function takes the following parameters: // -// - groupName (optional): group name, or NULL. -// - key (optional): key. +// - hashTable: Table. +// - fn: function to call for each key/value pair. // // 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 +// - 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 - _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)) + _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_key_file_get_comment(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) + _cret = C.g_hash_table_foreach_steal(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(fn) - var _utf8 string // out - var _goerr error // out + var _guint uint // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _guint = uint(_cret) - return _utf8, _goerr + return _guint } -// 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 -// 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 -// KEY_FILE_ERROR_INVALID_VALUE. -// -// The function takes the following parameters: +// HashTableInsert inserts a new key and value into a Table. // -// - groupName: group name. -// - key: key. +// 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: // -// - 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 +// - 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 - _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)) + _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_key_file_get_double(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) + _cret = C.g_hash_table_insert(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) runtime.KeepAlive(key) + runtime.KeepAlive(value) - var _gdouble float64 // out - var _goerr error // out + var _ok bool // out - _gdouble = float64(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + if _cret != 0 { + _ok = true } - return _gdouble, _goerr + return _ok } -// 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 -// 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 -// KEY_FILE_ERROR_INVALID_VALUE. +// 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: // -// - groupName: group name. -// - key: key. +// - hashTable: Table. +// - key (optional) to look up. // // 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 +// - 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 - _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)) + _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_key_file_get_double_list(_arg0, _arg1, _arg2, &_arg3, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) + _cret = C.g_hash_table_lookup(_arg1, _arg2) + runtime.KeepAlive(hashTable) runtime.KeepAlive(key) - var _gdoubles []float64 // out - var _goerr error // out + var _gpointer unsafe.Pointer // 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)) - } + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) - return _gdoubles, _goerr + return _gpointer } -// 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. +// 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: // -// - 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))) +// - 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 - _cret = C.g_key_file_get_groups(_arg0, &_arg1) - runtime.KeepAlive(keyFile) + _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)) - var _length uint // out - var _utf8s []string // out + _cret = C.g_hash_table_lookup_extended(_arg1, _arg2, &_arg3, &_arg4) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(lookupKey) - _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++ - } + var _origKey unsafe.Pointer // out + var _value unsafe.Pointer // out + var _ok bool // out - 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])) - } + _origKey = (unsafe.Pointer)(unsafe.Pointer(_arg3)) + _value = (unsafe.Pointer)(unsafe.Pointer(_arg4)) + if _cret != 0 { + _ok = true } - return _length, _utf8s + return _origKey, _value, _ok } -// 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. +// 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: // -// - groupName: non-NULL group name. -// - key: non-NULL key. +// - otherHashTable: another Table. // // 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 +// - 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 - _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)) + _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_key_file_get_int64(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) + _cret = C.g_hash_table_new_similar(_arg1) + runtime.KeepAlive(otherHashTable) - var _gint64 int64 // out - var _goerr error // out + var _hashTable map[unsafe.Pointer]unsafe.Pointer // out - _gint64 = int64(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _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 _gint64, _goerr + return _hashTable } -// Integer returns the value associated with key under group_name as an integer. +// HashTableRemoveAll removes all keys and their associated values from a Table. // -// If key cannot be found then 0 is returned and error is set to -// 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 KEY_FILE_ERROR_INVALID_VALUE. +// 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: // -// - 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 +// - hashTable: Table. +func HashTableRemoveAll(hashTable map[unsafe.Pointer]unsafe.Pointer) { + var _arg1 *C.GHashTable // out - _gint = int(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + _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) - return _gint, _goerr + C.g_hash_table_remove_all(_arg1) + runtime.KeepAlive(hashTable) } -// IntegerList returns the values associated with key under group_name as -// integers. +// 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. // -// If key cannot be found then NULL is returned and error is set to -// 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 KEY_FILE_ERROR_INVALID_VALUE. +// 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: // -// - groupName: group name. -// - key: key. +// - hashTable: Table. +// - key (optional) to insert. +// - value (optional) to associate with the 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 +// - 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 - _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)) + _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_key_file_get_integer_list(_arg0, _arg1, _arg2, &_arg3, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) + _cret = C.g_hash_table_replace(_arg1, _arg2, _arg3) + runtime.KeepAlive(hashTable) runtime.KeepAlive(key) + runtime.KeepAlive(value) - var _gints []int // out - var _goerr error // out + var _ok bool // 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)) + if _cret != 0 { + _ok = true } - return _gints, _goerr + return _ok } -// 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 -// KEY_FILE_ERROR_GROUP_NOT_FOUND. +// HashTableSize returns the number of elements contained in the Table. // // The function takes the following parameters: // -// - groupName: group name. +// - hashTable: Table. // // 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)) +// - 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 - _cret = C.g_key_file_get_keys(_arg0, _arg1, &_arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) + _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) - var _length uint // out - var _utf8s []string // out - var _goerr error // out + _cret = C.g_hash_table_size(_arg1) + runtime.KeepAlive(hashTable) - _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++ - } + var _guint uint // out - 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)) - } + _guint = uint(_cret) - return _length, _utf8s, _goerr + return _guint } -// 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. +// 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: // -// - groupName: group name. -// - key: key. -// - locale (optional) identifier or NULL. +// - hashTable: Table. +// - key (optional) to remove. // // 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 +// - 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 - _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)) + _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_key_file_get_locale_for_key(_arg0, _arg1, _arg2, _arg3) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) + _cret = C.g_hash_table_steal(_arg1, _arg2) + runtime.KeepAlive(hashTable) runtime.KeepAlive(key) - runtime.KeepAlive(locale) - var _utf8 string // out + var _ok bool // out - if _cret != nil { - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) + if _cret != 0 { + _ok = true } - return _utf8 + return _ok } -// 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 -// 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. +// 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: // -// - 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 +// - hashTable: Table. +func HashTableStealAll(hashTable map[unsafe.Pointer]unsafe.Pointer) { + var _arg1 *C.GHashTable // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + _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) - return _utf8, _goerr + C.g_hash_table_steal_all(_arg1) + runtime.KeepAlive(hashTable) } -// 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. +// 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 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 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. // -// If key cannot be found then NULL is returned and error is set to -// 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. +// 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: // -// - groupName: group name. -// - key: key. -// - locale (optional) identifier or NULL. +// - hashTable: Table. +// - lookupKey (optional): key to look up. // // 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 +// - 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 - _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)) + _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_key_file_get_locale_string_list(_arg0, _arg1, _arg2, _arg3, &_arg4, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(locale) + _cret = C.g_hash_table_steal_extended(_arg1, _arg2, &_arg3, &_arg4) + runtime.KeepAlive(hashTable) + runtime.KeepAlive(lookupKey) - var _utf8s []string // out - var _goerr error // out + var _stolenKey unsafe.Pointer // out + var _stolenValue unsafe.Pointer // out + var _ok bool // 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)) + _stolenKey = (unsafe.Pointer)(unsafe.Pointer(_arg3)) + _stolenValue = (unsafe.Pointer)(unsafe.Pointer(_arg4)) + if _cret != 0 { + _ok = true } - return _utf8s, _goerr + return _stolenKey, _stolenValue, _ok } -// StartGroup returns the name of the start group of the file. +// 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: // -// - utf8 (optional): start group of the key file. -func (keyFile *KeyFile) StartGroup() string { - var _arg0 *C.GKeyFile // out - var _cret *C.gchar // in +// - 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.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) - _cret = C.g_key_file_get_start_group(_arg0) - runtime.KeepAlive(keyFile) + _cret = C.g_hash_table_iter_get_hash_table(_arg0) + runtime.KeepAlive(iter) - var _utf8 string // out + var _hashTable map[unsafe.Pointer]unsafe.Pointer // out - if _cret != nil { - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) - } + _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 _utf8 + return _hashTable } -// String returns the string value associated with key under group_name. Unlike -// g_key_file_get_value(), this function handles escape sequences like \s. +// 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. // -// In the event the key cannot be found, NULL is returned and error is set to -// KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the group_name cannot be -// found, NULL is returned and error is set to KEY_FILE_ERROR_GROUP_NOT_FOUND. +// 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: // -// - groupName: group name. -// - key: key. +// - 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: // -// - 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 +// - 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.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)) + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) - _cret = C.g_key_file_get_string(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) + _cret = C.g_hash_table_iter_next(_arg0, &_arg1, &_arg2) + runtime.KeepAlive(iter) - var _utf8 string // out - var _goerr error // out + var _key unsafe.Pointer // out + var _value unsafe.Pointer // out + var _ok bool // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + _key = (unsafe.Pointer)(unsafe.Pointer(_arg1)) + _value = (unsafe.Pointer)(unsafe.Pointer(_arg2)) + if _cret != 0 { + _ok = true } - return _utf8, _goerr + return _key, _value, _ok } -// StringList returns the values associated with key under group_name. +// 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. // -// In the event the key cannot be found, NULL is returned and error is set to -// KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the group_name cannot be -// found, NULL is returned and error is set to KEY_FILE_ERROR_GROUP_NOT_FOUND. +// 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. // -// The function takes the following parameters: +// It is safe to continue iterating the Table afterward: // -// - groupName: group name. -// - key: key. +// 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. // -// The function returns the following values: +// If you supplied a value_destroy_func when creating the Table, the old value +// is freed using that function. // -// - 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 +// 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.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)) + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) + _arg1 = (C.gpointer)(unsafe.Pointer(value)) - _cret = C.g_key_file_get_string_list(_arg0, _arg1, _arg2, &_arg3, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) + C.g_hash_table_iter_replace(_arg0, _arg1) + runtime.KeepAlive(iter) + runtime.KeepAlive(value) +} - var _utf8s []string // out - var _goerr error // out +// 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 - 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)) - } + _arg0 = (*C.GHashTableIter)(gextras.StructNative(unsafe.Pointer(iter))) - return _utf8s, _goerr + C.g_hash_table_iter_steal(_arg0) + runtime.KeepAlive(iter) } -// 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. +// 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. // -// The function takes the following parameters: +// Both the key and data are arbitrary byte arrays of bytes or characters. // -// - groupName: non-NULL group name. -// - key: non-NULL key. +// 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. // -// The function returns the following values: +// To create a new GHmac, use glib.HMAC.New. To free a GHmac, use +// glib.HMAC.Unref(). // -// - 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 +// An instance of this type is always passed by reference. +type HMAC struct { + *hmaC +} - _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)) +// hmaC is the struct that's finalized. +type hmaC struct { + native *C.GHmac +} - _cret = C.g_key_file_get_uint64(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) +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 _guint64 uint64 // out - var _goerr error // out + var _hmac *HMAC // out - _guint64 = uint64(_cret) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + 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 _guint64, _goerr + return _hmac } -// 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 -// KEY_FILE_ERROR_KEY_NOT_FOUND. In the event that the group_name cannot be -// found, NULL is returned and error is set to KEY_FILE_ERROR_GROUP_NOT_FOUND. -// -// The function takes the following parameters: -// -// - groupName: group name. -// - key: key. +// 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: // -// - 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 +// - 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.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)) + _arg0 = (*C.GHmac)(gextras.StructNative(unsafe.Pointer(hmac))) - _cret = C.g_key_file_get_value(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) + _cret = C.g_hmac_copy(_arg0) + runtime.KeepAlive(hmac) - var _utf8 string // out - var _goerr error // out + var _ret *HMAC // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _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 _utf8, _goerr + return _ret } -// HasGroup looks whether the key file has the group group_name. +// String gets the HMAC as a hexadecimal string. // -// The function takes the following parameters: +// Once this function has been called the #GHmac can no longer be updated with +// g_hmac_update(). // -// - groupName: group name. +// The hexadecimal characters will be lower case. // // 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 +// - 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.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) - defer C.free(unsafe.Pointer(_arg1)) + _arg0 = (*C.GHmac)(gextras.StructNative(unsafe.Pointer(hmac))) - _cret = C.g_key_file_has_group(_arg0, _arg1) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) + _cret = C.g_hmac_get_string(_arg0) + runtime.KeepAlive(hmac) - var _ok bool // out + var _utf8 string // out - if _cret != 0 { - _ok = true - } + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - return _ok + return _utf8 } -// 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. +// 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: // -// - 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 +// - 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 - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + _arg0 = (*C.GHmac)(gextras.StructNative(unsafe.Pointer(hmac))) + _arg2 = (C.gssize)(len(data)) + if len(data) > 0 { + _arg1 = (*C.guchar)(unsafe.Pointer(&data[0])) } - return _goerr + C.g_hmac_update(_arg0, _arg1, _arg2) + runtime.KeepAlive(hmac) + runtime.KeepAlive(data) } -// 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. +// 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. // -// The function takes the following parameters: +// 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. // -// - data: key file loaded in memory. -// - length of data in bytes (or (gsize)-1 if data is nul-terminated). -// - flags from FileFlags. -func (keyFile *KeyFile) LoadFromData(data string, length uint, flags KeyFileFlags) error { - var _arg0 *C.GKeyFile // out - var _arg1 *C.gchar // out - var _arg2 C.gsize // out - 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(data))) - defer C.free(unsafe.Pointer(_arg1)) - _arg2 = C.gsize(length) - _arg3 = C.GKeyFileFlags(flags) +// 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 +} - C.g_key_file_load_from_data(_arg0, _arg1, _arg2, _arg3, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(data) - runtime.KeepAlive(length) - runtime.KeepAlive(flags) +// ioChannel is the struct that's finalized. +type ioChannel struct { + native *C.GIOChannel +} - var _goerr error // out +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 _goerr + return _ioChannel, _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 +// NewIOChannelUnix constructs a struct IOChannel. +func NewIOChannelUnix(fd int) *IOChannel { + var _arg1 C.int // out + var _cret *C.GIOChannel // 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) + _arg1 = C.int(fd) - C.g_key_file_load_from_data_dirs(_arg0, _arg1, &_arg2, _arg3, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(file) - runtime.KeepAlive(flags) + _cret = C.g_io_channel_unix_new(_arg1) + runtime.KeepAlive(fd) - var _fullPath string // out - var _goerr error // out + var _ioChannel *IOChannel // 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)) - } + _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 _fullPath, _goerr + return _ioChannel } -// 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: +// 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(). // -// - file: relative path to a filename to open and parse. -// - searchDirs: NULL-terminated array of directories to search. -// - flags from FileFlags. +// 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: // -// - 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 +// - 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.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) + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - 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) + _cret = C.g_io_channel_flush(_arg0, &_cerr) + runtime.KeepAlive(channel) - var _fullPath string // out - var _goerr error // out + var _ioStatus IOStatus // out + var _goerr error // out - if _arg3 != nil { - _fullPath = C.GoString((*C.gchar)(unsafe.Pointer(_arg3))) - defer C.free(unsafe.Pointer(_arg3)) - } + _ioStatus = IOStatus(_cret) if _cerr != nil { _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - return _fullPath, _goerr + return _ioStatus, _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. +// 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 takes the following parameters: +// The function returns the following values: // -// - 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 +// - ioCondition: OCondition. +func (channel *IOChannel) BufferCondition() IOCondition { + var _arg0 *C.GIOChannel // out + var _cret C.GIOCondition // 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) + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - C.g_key_file_load_from_file(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(file) - runtime.KeepAlive(flags) + _cret = C.g_io_channel_get_buffer_condition(_arg0) + runtime.KeepAlive(channel) - var _goerr error // out + var _ioCondition IOCondition // out - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _ioCondition = IOCondition(_cret) - return _goerr + return _ioCondition } -// 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. +// BufferSize gets the buffer size. // -// The function takes the following parameters: +// The function returns the following values: // -// - 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 +// - gsize: size of the buffer. +func (channel *IOChannel) BufferSize() uint { + var _arg0 *C.GIOChannel // out + var _cret C.gsize // 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)) - } + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - C.g_key_file_remove_comment(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) + _cret = C.g_io_channel_get_buffer_size(_arg0) + runtime.KeepAlive(channel) - var _goerr error // out + var _gsize uint // out - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _gsize = uint(_cret) - return _goerr + return _gsize } -// RemoveGroup removes the specified group, group_name, from the key file. +// Buffered returns whether channel is buffered. // -// The function takes the following parameters: +// The function returns the following values: // -// - 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 +// - ok: TRUE if the channel is buffered. +func (channel *IOChannel) Buffered() bool { + var _arg0 *C.GIOChannel // 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)) + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - C.g_key_file_remove_group(_arg0, _arg1, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) + _cret = C.g_io_channel_get_buffered(_arg0) + runtime.KeepAlive(channel) - var _goerr error // out + var _ok bool // out - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + if _cret != 0 { + _ok = true } - return _goerr + return _ok } -// RemoveKey removes key in group_name from the key file. +// 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 takes the following parameters: +// The function returns the following values: // -// - 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 +// - 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.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)) + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - C.g_key_file_remove_key(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) + _cret = C.g_io_channel_get_encoding(_arg0) + runtime.KeepAlive(channel) - var _goerr error // out + var _utf8 string // out - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - return _goerr + return _utf8 } -// 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(). +// Flags gets the current flags for a OChannel, including read-only flags such +// as G_IO_FLAG_IS_READABLE. // -// This function can fail for any of the reasons that g_file_set_contents() may -// fail. +// 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 takes the following parameters: +// The function returns the following values: // -// - 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 +// - 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.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) - defer C.free(unsafe.Pointer(_arg1)) + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - C.g_key_file_save_to_file(_arg0, _arg1, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(filename) + _cret = C.g_io_channel_get_flags(_arg0) + runtime.KeepAlive(channel) - var _goerr error // out + var _ioFlags IOFlags // out - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _ioFlags = IOFlags(_cret) - return _goerr + return _ioFlags } -// SetBoolean associates a new boolean value with key under group_name. If key -// cannot be found then it is created. +// 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 takes the following parameters: +// The function returns the following values: // -// - 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 +// - 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.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 - } + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - C.g_key_file_set_boolean(_arg0, _arg1, _arg2, _arg3) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(value) + _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 } -// 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: +// Init initializes a OChannel struct. // -// - 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 +// 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.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])) - } + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - C.g_key_file_set_boolean_list(_arg0, _arg1, _arg2, _arg3, _arg4) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(list) + C.g_io_channel_init(_arg0) + runtime.KeepAlive(channel) } -// SetComment places a comment above key from group_name. +// ReadChars: replacement for g_io_channel_read() with the new API. // -// 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. +// The function takes the following parameters: // -// Note that this function prepends a '#' comment marker to each line of -// comment. +// - buf: a buffer to read data into. // -// The function takes the following parameters: +// The function returns the following values: // -// - 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 +// - 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.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)) + _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)) - C.g_key_file_set_comment(_arg0, _arg1, _arg2, _arg3, &_cerr) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(comment) + _cret = C.g_io_channel_read_chars(_arg0, _arg1, _arg2, &_arg3, &_cerr) + runtime.KeepAlive(channel) + runtime.KeepAlive(buf) - var _goerr error // out + 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 _goerr + return _bytesRead, _ioStatus, _goerr } -// SetDouble associates a new double value with key under group_name. If key -// cannot be found then it is created. +// 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 takes the following parameters: +// The function returns the following values: // -// - 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) +// - 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 - C.g_key_file_set_double(_arg0, _arg1, _arg2, _arg3) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(value) -} + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) -// 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 + _cret = C.g_io_channel_read_line(_arg0, &_arg1, &_arg2, &_arg3, &_cerr) + runtime.KeepAlive(channel) - _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(groupName))) + 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)) - _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])) + _length = uint(_arg2) + _terminatorPos = uint(_arg3) + _ioStatus = IOStatus(_cret) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) } - C.g_key_file_set_double_list(_arg0, _arg1, _arg2, _arg3, _arg4) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(list) + return _strReturn, _length, _terminatorPos, _ioStatus, _goerr } -// SetInt64 associates a new integer value with key under group_name. If key -// cannot be found then it is created. +// ReadToEnd reads all the remaining data from the file. // -// The function takes the following parameters: +// The function returns the following values: // -// - 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 +// - 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.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) + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) - C.g_key_file_set_int64(_arg0, _arg1, _arg2, _arg3) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(value) -} + _cret = C.g_io_channel_read_to_end(_arg0, &_arg1, &_arg2, &_cerr) + runtime.KeepAlive(channel) -// 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 + var _strReturn []byte // out + var _ioStatus IOStatus // out + var _goerr error // 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) + _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)) + } - C.g_key_file_set_integer(_arg0, _arg1, _arg2, _arg3) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(value) + return _strReturn, _ioStatus, _goerr } -// SetIntegerList associates a list of integer values with key under group_name. -// If key cannot be found then it is created. +// ReadUnichar reads a Unicode character from channel. This function cannot be +// called on a channel with NULL encoding. // -// The function takes the following parameters: +// The function returns the following values: // -// - 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 +// - 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.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]) - } + _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)) } - C.g_key_file_set_integer_list(_arg0, _arg1, _arg2, _arg3, _arg4) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(list) + return _thechar, _ioStatus, _goerr } -// SetListSeparator sets the character which is used to separate values -// in lists. Typically ';' or ',' are used as separators. The default list -// separator is ';'. +// 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: // -// - separator: separator. -func (keyFile *KeyFile) SetListSeparator(separator byte) { - var _arg0 *C.GKeyFile // out - var _arg1 C.gchar // out +// - 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.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) - _arg1 = C.gchar(separator) + _arg0 = (*C.GIOChannel)(gextras.StructNative(unsafe.Pointer(channel))) + _arg1 = C.gint64(offset) + _arg2 = C.GSeekType(typ) - C.g_key_file_set_list_separator(_arg0, _arg1) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(separator) + _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 } -// SetLocaleString associates a string value for key and locale under -// group_name. If the translation for key cannot be found then it is created. +// SeekPosition: replacement for g_io_channel_seek() with the new API. // // 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)) +// - 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) + 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 } -// 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. +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: // -// - 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 +// - 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 - _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])) - } + 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)) + }, + ) - 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) + return _source } -// 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. +// 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: // -// - 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 +// - 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 - _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)) + 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_key_file_set_string(_arg0, _arg1, _arg2, _arg3) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(str) + C.g_main_context_invoke_full(_arg0, _arg1, _arg2, _arg3, _arg4) + runtime.KeepAlive(context) + runtime.KeepAlive(priority) + runtime.KeepAlive(function) } -// 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. +// 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 takes the following parameters: +// The function returns the following values: // -// - 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 +// - ok: TRUE if current thread is owner of context. +func (context *MainContext) IsOwner() bool { + var _arg0 *C.GMainContext // 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)) - _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])) - } + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) } - C.g_key_file_set_string_list(_arg0, _arg1, _arg2, _arg3, _arg4) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(list) + _cret = C.g_main_context_is_owner(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok } -// SetUint64 associates a new integer value with key under group_name. If key -// cannot be found then it is created. +// 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: // -// - 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 +// - 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 - _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) + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + if mayBlock { + _arg1 = C.TRUE + } - C.g_key_file_set_uint64(_arg0, _arg1, _arg2, _arg3) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(value) + _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 } -// 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(). +// Pending checks if any sources have pending events for the given context. // -// The function takes the following parameters: +// The function returns the following values: // -// - 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 +// - ok: TRUE if events are pending. +func (context *MainContext) Pending() bool { + var _arg0 *C.GMainContext // 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)) - _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)) + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } - C.g_key_file_set_value(_arg0, _arg1, _arg2, _arg3) - runtime.KeepAlive(keyFile) - runtime.KeepAlive(groupName) - runtime.KeepAlive(key) - runtime.KeepAlive(value) + _cret = C.g_main_context_pending(_arg0) + runtime.KeepAlive(context) + + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok } -// ToData: this function outputs key_file as a string. +// 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 (). // -// Note that this function never reports an error, so it is safe to pass NULL as -// error. +// You must have successfully acquired the context with g_main_context_acquire() +// before you may call this function. // // 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 +// - 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 - _arg0 = (*C.GKeyFile)(gextras.StructNative(unsafe.Pointer(keyFile))) + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } - _cret = C.g_key_file_to_data(_arg0, &_arg1, &_cerr) - runtime.KeepAlive(keyFile) + _cret = C.g_main_context_prepare(_arg0, &_arg1) + runtime.KeepAlive(context) - var _length uint // out - var _utf8 string // out - var _goerr error // out + var _priority int // out + var _ok bool // 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)) + _priority = int(_arg1) + if _cret != 0 { + _ok = true } - return _length, _utf8, _goerr + return _priority, _ok } -func KeyFileErrorQuark() Quark { - var _cret C.GQuark // in - - _cret = C.g_key_file_error_quark() - - var _quark Quark // out +// 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 - _quark = Quark(_cret) + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } - return _quark + C.g_main_context_push_thread_default(_arg0) + runtime.KeepAlive(context) } -// 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. +// 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. // -// An instance of this type is always passed by reference. -type LogField struct { - *logField -} +// 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 -// logField is the struct that's finalized. -type logField struct { - native *C.GLogField -} + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } -// 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 + C.g_main_context_release(_arg0) + runtime.KeepAlive(context) } -// MainContext: GMainContext struct is an opaque data type representing a set of -// sources to be handled in a main loop. +// 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. // -// An instance of this type is always passed by reference. -type MainContext struct { - *mainContext -} +// 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 -// mainContext is the struct that's finalized. -type mainContext struct { - native *C.GMainContext -} + if context != nil { + _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } -func marshalMainContext(p uintptr) (interface{}, error) { - b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &MainContext{&mainContext{(*C.GMainContext)(b)}}, nil + C.g_main_context_wakeup(_arg0) + runtime.KeepAlive(context) } -// NewMainContext constructs a struct MainContext. -func NewMainContext() *MainContext { +// 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_new() + _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 }) { @@ -18604,872 +21809,1048 @@ func NewMainContext() *MainContext { 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(). +// 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.) // -// 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(). +// If you need to hold a reference on the context, use +// g_main_context_ref_thread_default() instead. // // 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 - - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) +// - 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_acquire(_arg0) - runtime.KeepAlive(context) + _cret = C.g_main_context_get_thread_default() - var _ok bool // out + var _mainContext *MainContext // out - if _cret != 0 { - _ok = true + 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 _ok + return _mainContext } -// Dispatch dispatches all pending sources. +// 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. // -// You must have successfully acquired the context with g_main_context_acquire() -// before you may call this function. -func (context *MainContext) Dispatch() { - var _arg0 *C.GMainContext // out +// 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 - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + _cret = C.g_main_context_ref_thread_default() - C.g_main_context_dispatch(_arg0) - runtime.KeepAlive(context) + 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 } -// 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: +// MainLoop: GMainLoop struct is an opaque data type representing the main event +// loop of a GLib or GTK application. // -// - 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 +// 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 { - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + _arg1 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + } + if isRunning { + _arg2 = C.TRUE } - _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) + _cret = C.g_main_loop_new(_arg1, _arg2) runtime.KeepAlive(context) - runtime.KeepAlive(funcs) - runtime.KeepAlive(userData) + runtime.KeepAlive(isRunning) - var _source *Source // out + var _mainLoop *MainLoop // out - _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) - C.g_source_ref(_cret) + _mainLoop = (*MainLoop)(gextras.NewStructNative(unsafe.Pointer(_cret))) runtime.SetFinalizer( - gextras.StructIntern(unsafe.Pointer(_source)), + gextras.StructIntern(unsafe.Pointer(_mainLoop)), func(intern *struct{ C unsafe.Pointer }) { - C.g_source_unref((*C.GSource)(intern.C)) + C.g_main_loop_unref((*C.GMainLoop)(intern.C)) }, ) - return _source + return _mainLoop } -// 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(). +// Context returns the Context of loop. // // 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 +// - mainContext of loop. +func (loop *MainLoop) Context() *MainContext { + var _arg0 *C.GMainLoop // out + var _cret *C.GMainContext // in - if context != nil { - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) - } - _arg1 = C.guint(sourceId) + _arg0 = (*C.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) - _cret = C.g_main_context_find_source_by_id(_arg0, _arg1) - runtime.KeepAlive(context) - runtime.KeepAlive(sourceId) + _cret = C.g_main_loop_get_context(_arg0) + runtime.KeepAlive(loop) - var _source *Source // out + var _mainContext *MainContext // out - _source = (*Source)(gextras.NewStructNative(unsafe.Pointer(_cret))) - C.g_source_ref(_cret) + _mainContext = (*MainContext)(gextras.NewStructNative(unsafe.Pointer(_cret))) + C.g_main_context_ref(_cret) runtime.SetFinalizer( - gextras.StructIntern(unsafe.Pointer(_source)), + gextras.StructIntern(unsafe.Pointer(_mainContext)), func(intern *struct{ C unsafe.Pointer }) { - C.g_source_unref((*C.GSource)(intern.C)) + C.g_main_context_unref((*C.GMainContext)(intern.C)) }, ) - return _source + return _mainContext } -// 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. +// IsRunning checks to see if the main loop is currently being run via +// g_main_loop_run(). // // 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 +// - 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.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) - _arg1 = (C.gpointer)(unsafe.Pointer(userData)) + _arg0 = (*C.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) - _cret = C.g_main_context_find_source_by_user_data(_arg0, _arg1) - runtime.KeepAlive(context) - runtime.KeepAlive(userData) + _cret = C.g_main_loop_is_running(_arg0) + runtime.KeepAlive(loop) - var _source *Source // out + var _ok bool // 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)) - }, - ) + if _cret != 0 { + _ok = true + } - return _source + return _ok } -// 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: +// Quit stops a Loop from running. Any calls to g_main_loop_run() for the loop +// will return. // -// - 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 +// 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 - 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)) + _arg0 = (*C.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) - C.g_main_context_invoke_full(_arg0, _arg1, _arg2, _arg3, _arg4) - runtime.KeepAlive(context) - runtime.KeepAlive(priority) - runtime.KeepAlive(function) + C.g_main_loop_quit(_arg0) + runtime.KeepAlive(loop) } -// 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: +// 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. // -// - ok: TRUE if current thread is owner of context. -func (context *MainContext) IsOwner() bool { - var _arg0 *C.GMainContext // out - var _cret C.gboolean // in +// An instance of this type is always passed by reference. +type MappedFile struct { + *mappedFile +} - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) +// mappedFile is the struct that's finalized. +type mappedFile struct { + native *C.GMappedFile +} - _cret = C.g_main_context_is_owner(_arg0) - runtime.KeepAlive(context) +func marshalMappedFile(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &MappedFile{&mappedFile{(*C.GMappedFile)(b)}}, nil +} - var _ok bool // out +// 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 - if _cret != 0 { - _ok = true + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) + defer C.free(unsafe.Pointer(_arg1)) + if writable { + _arg2 = C.TRUE } - return _ok -} + _cret = C.g_mapped_file_new(_arg1, _arg2, &_cerr) + runtime.KeepAlive(filename) + runtime.KeepAlive(writable) -// 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 + var _mappedFile *MappedFile // out + var _goerr error // out - if context != nil { - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + _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)) } - if mayBlock { - _arg1 = C.TRUE + + 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_main_context_iteration(_arg0, _arg1) - runtime.KeepAlive(context) - runtime.KeepAlive(mayBlock) + _cret = C.g_mapped_file_new_from_fd(_arg1, _arg2, &_cerr) + runtime.KeepAlive(fd) + runtime.KeepAlive(writable) - var _ok bool // out + var _mappedFile *MappedFile // out + var _goerr error // out - if _cret != 0 { - _ok = true + _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 _ok + return _mappedFile, _goerr } -// Pending checks if any sources have pending events for the given context. +// 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: // -// - 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 +// - bytes: newly allocated #GBytes referencing data from file. +func (file *MappedFile) Bytes() *Bytes { + var _arg0 *C.GMappedFile // out + var _cret *C.GBytes // in - if _cret != 0 { - _ok = true - } + _arg0 = (*C.GMappedFile)(gextras.StructNative(unsafe.Pointer(file))) - return _ok -} + _cret = C.g_mapped_file_get_bytes(_arg0) + runtime.KeepAlive(file) -// 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 + var _bytes *Bytes // out - if context != nil { - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) - } + _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)) + }, + ) - C.g_main_context_pop_thread_default(_arg0) - runtime.KeepAlive(context) + return _bytes } -// Prepare prepares to poll sources within a main loop. The resulting -// information for polling is determined by calling g_main_context_query (). +// Contents returns the contents of a File. // -// You must have successfully acquired the context with g_main_context_acquire() -// before you may call this function. +// 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: // -// - 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 +// - utf8 contents of file, or NULL. +func (file *MappedFile) Contents() string { + var _arg0 *C.GMappedFile // out + var _cret *C.gchar // in - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + _arg0 = (*C.GMappedFile)(gextras.StructNative(unsafe.Pointer(file))) - _cret = C.g_main_context_prepare(_arg0, &_arg1) - runtime.KeepAlive(context) + _cret = C.g_mapped_file_get_contents(_arg0) + runtime.KeepAlive(file) - var _priority int // out - var _ok bool // out + var _utf8 string // out - _priority = int(_arg1) - if _cret != 0 { - _ok = true - } + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) - return _priority, _ok + return _utf8 } -// 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 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. +// Length returns the length of the contents of a File. // -// 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. +// The function returns the following values: // -// 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 +// - gsize: length of the contents of file. +func (file *MappedFile) Length() uint { + var _arg0 *C.GMappedFile // out + var _cret C.gsize // in - if context != nil { - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) - } + _arg0 = (*C.GMappedFile)(gextras.StructNative(unsafe.Pointer(file))) - C.g_main_context_push_thread_default(_arg0) - runtime.KeepAlive(context) -} + _cret = C.g_mapped_file_get_length(_arg0) + runtime.KeepAlive(file) -// 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. -func (context *MainContext) Release() { - var _arg0 *C.GMainContext // out + var _gsize uint // out - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) + _gsize = uint(_cret) - C.g_main_context_release(_arg0) - runtime.KeepAlive(context) + return _gsize } -// 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: +// MarkupParseContext: parse context is used to parse a stream of bytes that you +// expect to contain marked-up text. // -// perform_work(); +// See g_markup_parse_context_new(), Parser, and so on for more details. // -// if (g_atomic_int_dec_and_test (&tasks_remaining)) -// g_main_context_wakeup (NULL);. -func (context *MainContext) Wakeup() { - var _arg0 *C.GMainContext // out +// An instance of this type is always passed by reference. +type MarkupParseContext struct { + *markupParseContext +} - _arg0 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) +// markupParseContext is the struct that's finalized. +type markupParseContext struct { + native *C.GMarkupParseContext +} - C.g_main_context_wakeup(_arg0) - runtime.KeepAlive(context) +func marshalMarkupParseContext(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &MarkupParseContext{&markupParseContext{(*C.GMarkupParseContext)(b)}}, nil } -// 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: +// EndParse signals to the ParseContext that all data has been fed into the +// parse context with g_markup_parse_context_parse(). // -// - mainContext: global default main context. -func MainContextDefault() *MainContext { - var _cret *C.GMainContext // in +// 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 - _cret = C.g_main_context_default() + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) - var _mainContext *MainContext // out + C.g_markup_parse_context_end_parse(_arg0, &_cerr) + runtime.KeepAlive(context) - _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)) - }, - ) + var _goerr error // out - return _mainContext + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } + + return _goerr } -// 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.) +// Element retrieves the name of the currently open element. // -// If you need to hold a reference on the context, use -// g_main_context_ref_thread_default() instead. +// 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: // -// - mainContext (optional): thread-default Context, or NULL if the -// thread-default context is the global default 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)) - }, - ) - } +// - utf8: name of the currently open element, or NULL. +func (context *MarkupParseContext) Element() string { + var _arg0 *C.GMarkupParseContext // out + var _cret *C.gchar // in - return _mainContext + _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 } -// 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. +// 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: // -// - mainContext: thread-default Context. Unref with g_main_context_unref() -// when you are done with it. -func MainContextRefThreadDefault() *MainContext { - var _cret *C.GMainContext // in +// - sList: element stack, which must not be modified. +func (context *MarkupParseContext) ElementStack() []string { + var _arg0 *C.GMarkupParseContext // out + var _cret *C.GSList // in - _cret = C.g_main_context_ref_thread_default() + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) - var _mainContext *MainContext // out + _cret = C.g_markup_parse_context_get_element_stack(_arg0) + runtime.KeepAlive(context) - _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)) - }, - ) + var _sList []string // out - return _mainContext + _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 } -// MainLoop: GMainLoop struct is an opaque data type representing the main event -// loop of a GLib or GTK+ application. +// 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.". // -// An instance of this type is always passed by reference. -type MainLoop struct { - *mainLoop -} +// 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 -// mainLoop is the struct that's finalized. -type mainLoop struct { - native *C.GMainLoop -} + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) -func marshalMainLoop(p uintptr) (interface{}, error) { - b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &MainLoop{&mainLoop{(*C.GMainLoop)(b)}}, nil + 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 } -// 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 +// 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 - if context != nil { - _arg1 = (*C.GMainContext)(gextras.StructNative(unsafe.Pointer(context))) - } - if isRunning { - _arg2 = C.TRUE - } + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) - _cret = C.g_main_loop_new(_arg1, _arg2) + _cret = C.g_markup_parse_context_get_user_data(_arg0) runtime.KeepAlive(context) - runtime.KeepAlive(isRunning) - var _mainLoop *MainLoop // out + var _gpointer unsafe.Pointer // 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)) - }, - ) + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) - return _mainLoop + return _gpointer } -// Context returns the Context of loop. +// Parse: feed some data to the ParseContext. // -// The function returns the following values: +// 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. // -// - mainContext of loop. -func (loop *MainLoop) Context() *MainContext { - var _arg0 *C.GMainLoop // out - var _cret *C.GMainContext // in +// 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.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) + _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)) - _cret = C.g_main_loop_get_context(_arg0) - runtime.KeepAlive(loop) + C.g_markup_parse_context_parse(_arg0, _arg1, _arg2, &_cerr) + runtime.KeepAlive(context) + runtime.KeepAlive(text) - var _mainContext *MainContext // out + var _goerr error // 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)) - }, - ) + if _cerr != nil { + _goerr = gerror.Take(unsafe.Pointer(_cerr)) + } - return _mainContext + return _goerr } -// IsRunning checks to see if the main loop is currently being run via -// g_main_loop_run(). +// 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: // -// - ok: TRUE if the mainloop is currently being run. -func (loop *MainLoop) IsRunning() bool { - var _arg0 *C.GMainLoop // out - var _cret C.gboolean // in +// - 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.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) - _cret = C.g_main_loop_is_running(_arg0) - runtime.KeepAlive(loop) + _cret = C.g_markup_parse_context_pop(_arg0) + runtime.KeepAlive(context) - var _ok bool // out + var _gpointer unsafe.Pointer // out - if _cret != 0 { - _ok = true - } + _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) - return _ok + return _gpointer } -// Quit stops a Loop from running. Any calls to g_main_loop_run() for the loop -// will return. +// Push: temporarily redirects markup data to a sub-parser. // -// 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 +// 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.GMainLoop)(gextras.StructNative(unsafe.Pointer(loop))) + _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + _arg1 = (*C.GMarkupParser)(gextras.StructNative(unsafe.Pointer(parser))) + _arg2 = (C.gpointer)(unsafe.Pointer(userData)) - C.g_main_loop_quit(_arg0) - runtime.KeepAlive(loop) + C.g_markup_parse_context_push(_arg0, _arg1, _arg2) + runtime.KeepAlive(context) + runtime.KeepAlive(parser) + runtime.KeepAlive(userData) } -// 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))) +// 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 +} - C.g_main_loop_run(_arg0) - runtime.KeepAlive(loop) +// markupParser is the struct that's finalized. +type markupParser struct { + native *C.GMarkupParser } -// MappedFile represents a file mapping created with g_mapped_file_new(). -// It has only private members and should not be accessed directly. +// MatchInfo is an opaque struct used to return information about matches. // // An instance of this type is always passed by reference. -type MappedFile struct { - *mappedFile +type MatchInfo struct { + *matchInfo } -// mappedFile is the struct that's finalized. -type mappedFile struct { - native *C.GMappedFile +// matchInfo is the struct that's finalized. +type matchInfo struct { + native *C.GMatchInfo } -func marshalMappedFile(p uintptr) (interface{}, error) { +func marshalMatchInfo(p uintptr) (interface{}, error) { b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &MappedFile{&mappedFile{(*C.GMappedFile)(b)}}, nil + return &MatchInfo{&matchInfo{(*C.GMatchInfo)(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 +// 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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(filename))) - defer C.free(unsafe.Pointer(_arg1)) - if writable { - _arg2 = C.TRUE + 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_mapped_file_new(_arg1, _arg2, &_cerr) - runtime.KeepAlive(filename) - runtime.KeepAlive(writable) + _cret = C.g_match_info_expand_references(_arg0, _arg1, &_cerr) + runtime.KeepAlive(matchInfo) + runtime.KeepAlive(stringToExpand) - var _mappedFile *MappedFile // out - var _goerr error // out + var _utf8 string // 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 _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 _mappedFile, _goerr + return _utf8, _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 +// 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 - _arg1 = C.gint(fd) - if writable { - _arg2 = C.TRUE + _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)) } - _cret = C.g_mapped_file_new_from_fd(_arg1, _arg2, &_cerr) - runtime.KeepAlive(fd) - runtime.KeepAlive(writable) + return _utf8 +} - var _mappedFile *MappedFile // out - var _goerr error // out +// 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 - _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)) + _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 _mappedFile, _goerr + return _utf8s } -// 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. +// 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: // -// - bytes: newly allocated #GBytes referencing data from file. -func (file *MappedFile) Bytes() *Bytes { - var _arg0 *C.GMappedFile // out - var _cret *C.GBytes // in +// - 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.GMappedFile)(gextras.StructNative(unsafe.Pointer(file))) + _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_mapped_file_get_bytes(_arg0) - runtime.KeepAlive(file) + _cret = C.g_match_info_fetch_named(_arg0, _arg1) + runtime.KeepAlive(matchInfo) + runtime.KeepAlive(name) - var _bytes *Bytes // out + var _utf8 string // 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 _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } - return _bytes + return _utf8 } -// Contents returns the contents of a File. +// FetchNamedPos retrieves the position in bytes of the capturing parentheses +// named name. // -// Note that the contents may not be zero-terminated, even if the File is backed -// by a text file. +// 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. // -// If the file is empty then NULL is returned. +// The function takes the following parameters: +// +// - name of the subexpression. // // 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 +// - 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.GMappedFile)(gextras.StructNative(unsafe.Pointer(file))) + _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_mapped_file_get_contents(_arg0) - runtime.KeepAlive(file) + _cret = C.g_match_info_fetch_named_pos(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(matchInfo) + runtime.KeepAlive(name) - var _utf8 string // out + var _startPos int // out + var _endPos int // out + var _ok bool // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) + _startPos = int(_arg2) + _endPos = int(_arg3) + if _cret != 0 { + _ok = true + } - return _utf8 + return _startPos, _endPos, _ok } -// Length returns the length of the contents of a File. +// 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: // -// - gsize: length of the contents of file. -func (file *MappedFile) Length() uint { - var _arg0 *C.GMappedFile // out - var _cret C.gsize // in +// - 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.GMappedFile)(gextras.StructNative(unsafe.Pointer(file))) + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + _arg1 = C.gint(matchNum) - _cret = C.g_mapped_file_get_length(_arg0) - runtime.KeepAlive(file) + _cret = C.g_match_info_fetch_pos(_arg0, _arg1, &_arg2, &_arg3) + runtime.KeepAlive(matchInfo) + runtime.KeepAlive(matchNum) - var _gsize uint // out + var _startPos int // out + var _endPos int // out + var _ok bool // out - _gsize = uint(_cret) + _startPos = int(_arg2) + _endPos = int(_arg3) + if _cret != 0 { + _ok = true + } - return _gsize + return _startPos, _endPos, _ok } -// MarkupParseContext: parse context is used to parse a stream of bytes that you -// expect to contain marked-up text. +// 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. // -// See g_markup_parse_context_new(), Parser, and so on for more details. +// 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. // -// An instance of this type is always passed by reference. -type MarkupParseContext struct { - *markupParseContext -} +// 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 -// markupParseContext is the struct that's finalized. -type markupParseContext struct { - native *C.GMarkupParseContext -} + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) -func marshalMarkupParseContext(p uintptr) (interface{}, error) { - b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &MarkupParseContext{&markupParseContext{(*C.GMarkupParseContext)(b)}}, nil + _cret = C.g_match_info_get_match_count(_arg0) + runtime.KeepAlive(matchInfo) + + var _gint int // out + + _gint = int(_cret) + + return _gint } -// EndParse signals to the ParseContext that all data has been fed into the -// parse context with g_markup_parse_context_parse(). +// 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. // -// 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 +// 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.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) - C.g_markup_parse_context_end_parse(_arg0, &_cerr) - runtime.KeepAlive(context) + _cret = C.g_match_info_get_regex(_arg0) + runtime.KeepAlive(matchInfo) - var _goerr error // out + var _regex *Regex // out - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) - } + _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 _goerr + return _regex } -// 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(). +// 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: name of the currently open element, or NULL. -func (context *MarkupParseContext) Element() string { - var _arg0 *C.GMarkupParseContext // out - var _cret *C.gchar // in +// - utf8: string searched with match_info. +func (matchInfo *MatchInfo) String() string { + var _arg0 *C.GMatchInfo // out + var _cret *C.gchar // in - _arg0 = (*C.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) - _cret = C.g_markup_parse_context_get_element(_arg0) - runtime.KeepAlive(context) + _cret = C.g_match_info_get_string(_arg0) + runtime.KeepAlive(matchInfo) var _utf8 string // out @@ -19478,91 +22859,95 @@ func (context *MarkupParseContext) Element() string { return _utf8 } -// 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.". +// 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: // -// - 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 +// - 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.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) - C.g_markup_parse_context_get_position(_arg0, &_arg1, &_arg2) - runtime.KeepAlive(context) + _cret = C.g_match_info_is_partial_match(_arg0) + runtime.KeepAlive(matchInfo) - var _lineNumber int // out - var _charNumber int // out + var _ok bool // out - _lineNumber = int(_arg1) - _charNumber = int(_arg2) + if _cret != 0 { + _ok = true + } - return _lineNumber, _charNumber + return _ok } -// 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(). +// Matches returns whether the previous match operation succeeded. // // 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 +// - 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.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) - _cret = C.g_markup_parse_context_get_user_data(_arg0) - runtime.KeepAlive(context) + _cret = C.g_match_info_matches(_arg0) + runtime.KeepAlive(matchInfo) - var _gpointer unsafe.Pointer // out + var _ok bool // out - _gpointer = (unsafe.Pointer)(unsafe.Pointer(_cret)) + if _cret != 0 { + _ok = true + } - return _gpointer + return _ok } -// 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: +// 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. // -// - text: chunk of text to parse. -// - textLen: length of text in bytes. -func (context *MarkupParseContext) Parse(text string, textLen int) error { - var _arg0 *C.GMarkupParseContext // out - var _arg1 *C.gchar // out - var _arg2 C.gssize // out - var _cerr *C.GError // in +// 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.GMarkupParseContext)(gextras.StructNative(unsafe.Pointer(context))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(text))) - defer C.free(unsafe.Pointer(_arg1)) - _arg2 = C.gssize(textLen) + _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) - C.g_markup_parse_context_parse(_arg0, _arg1, _arg2, &_cerr) - runtime.KeepAlive(context) - runtime.KeepAlive(text) - runtime.KeepAlive(textLen) + C.g_match_info_next(_arg0, &_cerr) + runtime.KeepAlive(matchInfo) var _goerr error // out @@ -19573,775 +22958,804 @@ func (context *MarkupParseContext) Parse(text string, textLen int) error { 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: +// Node struct represents one node in a [n-ary tree][glib-N-ary-Trees]. // -// - 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 +// An instance of this type is always passed by reference. +type Node struct { + *node } -// 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) +// node is the struct that's finalized. +type node struct { + native *C.GNode } -// 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 +// 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 } -// markupParser is the struct that's finalized. -type markupParser struct { - native *C.GMarkupParser +// 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 } -// 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 +// 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 } -// matchInfo is the struct that's finalized. -type matchInfo struct { - native *C.GMatchInfo +// 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 } -func marshalMatchInfo(p uintptr) (interface{}, error) { - b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &MatchInfo{&matchInfo{(*C.GMatchInfo)(b)}}, nil +// 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 } -// 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 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. +// ChildIndex gets the position of the first child of a #GNode which contains +// the given data. // // The function takes the following parameters: // -// - stringToExpand: string to expand. +// - data (optional) to find. // // 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 +// - 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 - 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)) + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _arg1 = (C.gpointer)(unsafe.Pointer(data)) - _cret = C.g_match_info_expand_references(_arg0, _arg1, &_cerr) - runtime.KeepAlive(matchInfo) - runtime.KeepAlive(stringToExpand) + _cret = C.g_node_child_index(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(data) - var _utf8 string // out - var _goerr error // out + var _gint int // 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)) - } + _gint = int(_cret) - return _utf8, _goerr + return _gint } -// 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, +// 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. // -// 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. +// - child of node. // // 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 +// - 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.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) - _arg1 = C.gint(matchNum) + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _arg1 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(child))) - _cret = C.g_match_info_fetch(_arg0, _arg1) - runtime.KeepAlive(matchInfo) - runtime.KeepAlive(matchNum) + _cret = C.g_node_child_position(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(child) - var _utf8 string // out + var _gint int // out - if _cret != nil { - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) - } + _gint = int(_cret) - return _utf8 + return _gint } -// 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. +// Depth gets the depth of a #GNode. // -// The strings are fetched from the string passed to the match function, -// so you cannot call this function after freeing the string. +// 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: // -// - 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 +// - guint: depth of the #GNode. +func (node *Node) Depth() uint { + var _arg0 *C.GNode // out + var _cret C.guint // in - _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) - _cret = C.g_match_info_fetch_all(_arg0) - runtime.KeepAlive(matchInfo) + _cret = C.g_node_depth(_arg0) + runtime.KeepAlive(node) - var _utf8s []string // out + var _guint uint // 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++ - } + _guint = uint(_cret) - 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 _guint +} - return _utf8s +// 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) } -// 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. +// 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: // -// - name of the subexpression. +// - descendant: #GNode. // // 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 +// - 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.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) - defer C.free(unsafe.Pointer(_arg1)) + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _arg1 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(descendant))) - _cret = C.g_match_info_fetch_named(_arg0, _arg1) - runtime.KeepAlive(matchInfo) - runtime.KeepAlive(name) + _cret = C.g_node_is_ancestor(_arg0, _arg1) + runtime.KeepAlive(node) + runtime.KeepAlive(descendant) - var _utf8 string // out + var _ok bool // out - if _cret != nil { - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) - defer C.free(unsafe.Pointer(_cret)) + if _cret != 0 { + _ok = true } - return _utf8 + return _ok } -// 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: +// MaxHeight gets the maximum height of all branches beneath a #GNode. This is +// the maximum distance from the #GNode to all leaf nodes. // -// - name of the subexpression. +// 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: // -// - 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 +// - 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.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(name))) - defer C.free(unsafe.Pointer(_arg1)) + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(root))) - _cret = C.g_match_info_fetch_named_pos(_arg0, _arg1, &_arg2, &_arg3) - runtime.KeepAlive(matchInfo) - runtime.KeepAlive(name) + _cret = C.g_node_max_height(_arg0) + runtime.KeepAlive(root) - var _startPos int // out - var _endPos int // out - var _ok bool // out + var _guint uint // out - _startPos = int(_arg2) - _endPos = int(_arg3) - if _cret != 0 { - _ok = true - } + _guint = uint(_cret) - return _startPos, _endPos, _ok + return _guint } -// 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. +// NChildren gets the number of children of a #GNode. // -// 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. +// The function returns the following values: // -// 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. +// - 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: // -// - matchNum: number of the sub expression. +// - 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: // -// - 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 +// - 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.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) - _arg1 = C.gint(matchNum) + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(root))) + _arg1 = C.GTraverseFlags(flags) - _cret = C.g_match_info_fetch_pos(_arg0, _arg1, &_arg2, &_arg3) - runtime.KeepAlive(matchInfo) - runtime.KeepAlive(matchNum) + _cret = C.g_node_n_nodes(_arg0, _arg1) + runtime.KeepAlive(root) + runtime.KeepAlive(flags) - var _startPos int // out - var _endPos int // out - var _ok bool // out + var _guint uint // out - _startPos = int(_arg2) - _endPos = int(_arg3) - if _cret != 0 { - _ok = true - } + _guint = uint(_cret) - return _startPos, _endPos, _ok + return _guint } -// 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 +// 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.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) - _cret = C.g_match_info_get_match_count(_arg0) - runtime.KeepAlive(matchInfo) + C.g_node_reverse_children(_arg0) + runtime.KeepAlive(node) +} - var _gint int // out +// Unlink unlinks a #GNode from a tree, resulting in two separate trees. +func (node *Node) Unlink() { + var _arg0 *C.GNode // out - _gint = int(_cret) + _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) - return _gint + C.g_node_unlink(_arg0) + runtime.KeepAlive(node) } -// 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: +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(). // -// - regex object used in match_info. -func (matchInfo *MatchInfo) Regex() *Regex { - var _arg0 *C.GMatchInfo // out - var _cret *C.GRegex // in +// An instance of this type is always passed by reference. +type OptionEntry struct { + *optionEntry +} - _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) +// optionEntry is the struct that's finalized. +type optionEntry struct { + native *C.GOptionEntry +} - _cret = C.g_match_info_get_regex(_arg0) - runtime.KeepAlive(matchInfo) +// 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 +} - var _regex *Regex // out +// 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 +} - _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)) - }, - ) +// Flags from Flags. +func (o *OptionEntry) Flags() int { + valptr := &o.native.flags + var _v int // out + _v = int(*valptr) + return _v +} - return _regex +// 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 } -// 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. +// 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. // -// The function returns the following values: +// 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. // -// - utf8: string searched with match_info. -func (matchInfo *MatchInfo) String() string { - var _arg0 *C.GMatchInfo // out - var _cret *C.gchar // in +// An instance of this type is always passed by reference. +type OptionGroup struct { + *optionGroup +} - _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) +// optionGroup is the struct that's finalized. +type optionGroup struct { + native *C.GOptionGroup +} - _cret = C.g_match_info_get_string(_arg0) - runtime.KeepAlive(matchInfo) +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) +} - var _utf8 string // out +// 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 - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + _arg0 = (*C.GOptionGroup)(gextras.StructNative(unsafe.Pointer(group))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + defer C.free(unsafe.Pointer(_arg1)) - return _utf8 + C.g_option_group_set_translation_domain(_arg0, _arg1) + runtime.KeepAlive(group) + runtime.KeepAlive(domain) } -// 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. +// PathBuf: GPathBuf is a helper type that allows you to easily build paths +// from individual elements, using the platform specific conventions for path +// separators. // -// 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. +// g_auto (GPathBuf) path; // -// GRegex supports the concept of partial matching by means of the -// REGEX_MATCH_PARTIAL_SOFT and 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(). +// g_path_buf_init (&path); // -// The difference between REGEX_MATCH_PARTIAL_SOFT and REGEX_MATCH_PARTIAL_HARD -// is that when a partial match is encountered with REGEX_MATCH_PARTIAL_SOFT, -// matching continues to search for a possible complete match, while with -// REGEX_MATCH_PARTIAL_HARD matching stops at the partial match. When both -// REGEX_MATCH_PARTIAL_SOFT and REGEX_MATCH_PARTIAL_HARD are set, the latter -// takes precedence. +// g_path_buf_push (&path, "usr"); +// g_path_buf_push (&path, "bin"); +// g_path_buf_push (&path, "echo"); // -// There were formerly some restrictions on the pattern for partial matching. -// The restrictions no longer apply. +// g_autofree char *echo = g_path_buf_to_path (&path); +// g_assert_cmpstr (echo, ==, "/usr/bin/echo"); // -// See pcrepartial(3) for more information on partial matching. +// You can also load a full path and then operate on its components: // -// The function returns the following values: +// g_auto (GPathBuf) path; // -// - 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))) +// 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 +} - _cret = C.g_match_info_is_partial_match(_arg0) - runtime.KeepAlive(matchInfo) +// pathBuf is the struct that's finalized. +type pathBuf struct { + native *C.GPathBuf +} - var _ok bool // out +// 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 - if _cret != 0 { - _ok = true - } + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) - return _ok + C.g_path_buf_clear(_arg0) + runtime.KeepAlive(buf) } -// Matches returns whether the previous match operation succeeded. +// 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: // -// - 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 +// - filename (optional): built path. +func (buf *PathBuf) ClearToPath() string { + var _arg0 *C.GPathBuf // out + var _cret *C.char // in - _arg0 = (*C.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) - _cret = C.g_match_info_matches(_arg0) - runtime.KeepAlive(matchInfo) + _cret = C.g_path_buf_clear_to_path(_arg0) + runtime.KeepAlive(buf) - var _ok bool // out + var _filename string // out - if _cret != 0 { - _ok = true + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) } - return _ok + return _filename } -// 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. +// FreeToPath frees a GPathBuf allocated by g_path_buf_new(), and returns the +// path inside the buffer. // -// 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 +// 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.GMatchInfo)(gextras.StructNative(unsafe.Pointer(matchInfo))) + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + runtime.SetFinalizer(gextras.StructIntern(unsafe.Pointer(buf)), nil) - C.g_match_info_next(_arg0, &_cerr) - runtime.KeepAlive(matchInfo) + _cret = C.g_path_buf_free_to_path(_arg0) + runtime.KeepAlive(buf) - var _goerr error // out + var _filename string // out - if _cerr != nil { - _goerr = gerror.Take(unsafe.Pointer(_cerr)) + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) } - return _goerr + return _filename } -// Node struct represents one node in a [n-ary tree][glib-N-ary-Trees]. +// Init initializes a GPathBuf instance. // -// 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 -} +// 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 -// 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 -} + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) -// 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 -} + _cret = C.g_path_buf_init(_arg0) + runtime.KeepAlive(buf) -// 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 -} + var _pathBuf *PathBuf // out -// 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 -} + _pathBuf = (*PathBuf)(gextras.NewStructNative(unsafe.Pointer(_cret))) -// 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 + return _pathBuf } -// ChildIndex gets the position of the first child of a #GNode which contains -// the given data. +// InitFromPath initializes a GPathBuf instance with the given path. // // The function takes the following parameters: // -// - data (optional) to find. +// - path (optional): file system path. // // 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 +// - 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.GNode)(gextras.StructNative(unsafe.Pointer(node))) - _arg1 = (C.gpointer)(unsafe.Pointer(data)) + _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_node_child_index(_arg0, _arg1) - runtime.KeepAlive(node) - runtime.KeepAlive(data) + _cret = C.g_path_buf_init_from_path(_arg0, _arg1) + runtime.KeepAlive(buf) + runtime.KeepAlive(path) - var _gint int // out + var _pathBuf *PathBuf // out - _gint = int(_cret) + _pathBuf = (*PathBuf)(gextras.NewStructNative(unsafe.Pointer(_cret))) - return _gint + return _pathBuf } -// 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. +// Pop removes the last element of the path buffer. // -// The function takes the following parameters: +// 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. // -// - child of node. +// 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: // -// - 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 +// - 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.GNode)(gextras.StructNative(unsafe.Pointer(node))) - _arg1 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(child))) + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) - _cret = C.g_node_child_position(_arg0, _arg1) - runtime.KeepAlive(node) - runtime.KeepAlive(child) + _cret = C.g_path_buf_pop(_arg0) + runtime.KeepAlive(buf) - var _gint int // out + var _ok bool // out - _gint = int(_cret) + if _cret != 0 { + _ok = true + } - return _gint + return _ok } -// Depth gets the depth of a #GNode. +// Push extends the given path buffer with path. // -// 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. +// 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: // -// - guint: depth of the #GNode. -func (node *Node) Depth() uint { - var _arg0 *C.GNode // out - var _cret C.guint // in +// - 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.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _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_node_depth(_arg0) - runtime.KeepAlive(node) + _cret = C.g_path_buf_push(_arg0, _arg1) + runtime.KeepAlive(buf) + runtime.KeepAlive(path) - var _guint uint // out + var _pathBuf *PathBuf // out - _guint = uint(_cret) + _pathBuf = (*PathBuf)(gextras.NewStructNative(unsafe.Pointer(_cret))) - return _guint + return _pathBuf } -// Destroy removes root and its children from the tree, freeing any memory -// allocated. -func (root *Node) Destroy() { - var _arg0 *C.GNode // out +// 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.GNode)(gextras.StructNative(unsafe.Pointer(root))) + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) + if extension != "" { + _arg1 = (*C.char)(unsafe.Pointer(C.CString(extension))) + defer C.free(unsafe.Pointer(_arg1)) + } - C.g_node_destroy(_arg0) - runtime.KeepAlive(root) + _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 } -// 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. +// 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: // -// - descendant: #GNode. +// - fileName: file name in the path. // // 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 +// - 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.GNode)(gextras.StructNative(unsafe.Pointer(node))) - _arg1 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(descendant))) + _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_node_is_ancestor(_arg0, _arg1) - runtime.KeepAlive(node) - runtime.KeepAlive(descendant) + _cret = C.g_path_buf_set_filename(_arg0, _arg1) + runtime.KeepAlive(buf) + runtime.KeepAlive(fileName) var _ok bool // out @@ -20352,274 +23766,276 @@ func (node *Node) IsAncestor(descendant *Node) bool { 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. +// ToPath retrieves the built path from the path buffer. // -// 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. +// 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: // -// - guint: maximum height of the tree beneath root. -func (root *Node) MaxHeight() uint { - var _arg0 *C.GNode // out - var _cret C.guint // in +// - filename (optional): path. +func (buf *PathBuf) ToPath() string { + var _arg0 *C.GPathBuf // out + var _cret *C.char // in - _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(root))) + _arg0 = (*C.GPathBuf)(gextras.StructNative(unsafe.Pointer(buf))) - _cret = C.g_node_max_height(_arg0) - runtime.KeepAlive(root) + _cret = C.g_path_buf_to_path(_arg0) + runtime.KeepAlive(buf) - var _guint uint // out + var _filename string // out - _guint = uint(_cret) + if _cret != nil { + _filename = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + defer C.free(unsafe.Pointer(_cret)) + } - return _guint + return _filename } -// NChildren gets the number of children of a #GNode. +// 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: // -// - guint: number of children of node. -func (node *Node) NChildren() uint { - var _arg0 *C.GNode // out - var _cret C.guint // in +// - 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 - _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _arg1 = (C.gconstpointer)(unsafe.Pointer(v1)) + _arg2 = (C.gconstpointer)(unsafe.Pointer(v2)) - _cret = C.g_node_n_children(_arg0) - runtime.KeepAlive(node) + _cret = C.g_path_buf_equal(_arg1, _arg2) + runtime.KeepAlive(v1) + runtime.KeepAlive(v2) - var _guint uint // out + var _ok bool // out - _guint = uint(_cret) + if _cret != 0 { + _ok = true + } - return _guint + return _ok } -// NNodes gets the number of nodes in a tree. +// PatternSpec: GPatternSpec struct is the 'compiled' form of a glob-style +// pattern. // -// The function takes the following parameters: +// 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. // -// - flags: which types of children are to be counted, one of G_TRAVERSE_ALL, -// G_TRAVERSE_LEAVES and G_TRAVERSE_NON_LEAVES. +// 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. // -// The function returns the following values: +// 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. // -// - 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 +// An instance of this type is always passed by reference. +type PatternSpec struct { + *patternSpec +} - _guint = uint(_cret) +// patternSpec is the struct that's finalized. +type patternSpec struct { + native *C.GPatternSpec +} - return _guint +func marshalPatternSpec(p uintptr) (interface{}, error) { + b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() + return &PatternSpec{&patternSpec{(*C.GPatternSpec)(b)}}, nil } -// 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 +// NewPatternSpec constructs a struct PatternSpec. +func NewPatternSpec(pattern string) *PatternSpec { + var _arg1 *C.gchar // out + var _cret *C.GPatternSpec // in - _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(pattern))) + defer C.free(unsafe.Pointer(_arg1)) - C.g_node_reverse_children(_arg0) - runtime.KeepAlive(node) -} + _cret = C.g_pattern_spec_new(_arg1) + runtime.KeepAlive(pattern) -// Unlink unlinks a #GNode from a tree, resulting in two separate trees. -func (node *Node) Unlink() { - var _arg0 *C.GNode // out + var _patternSpec *PatternSpec // out - _arg0 = (*C.GNode)(gextras.StructNative(unsafe.Pointer(node))) + _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)) + }, + ) - C.g_node_unlink(_arg0) - runtime.KeepAlive(node) + return _patternSpec } -// 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(). +// Copy copies pspec in a new Spec. // -// 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 -} +// 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 -// 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 -} + _arg0 = (*C.GPatternSpec)(gextras.StructNative(unsafe.Pointer(pspec))) -// Flags from Flags. -func (o *OptionEntry) Flags() int { - valptr := &o.native.flags - var _v int // out - _v = int(*valptr) - return _v -} + _cret = C.g_pattern_spec_copy(_arg0) + runtime.KeepAlive(pspec) -// 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 -} + var _patternSpec *PatternSpec // out -// 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 -} + _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)) + }, + ) -// 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 + return _patternSpec } -// 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 -} +// 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 -// 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) -} + _arg0 = (*C.GPatternSpec)(gextras.StructNative(unsafe.Pointer(pspec1))) + _arg1 = (*C.GPatternSpec)(gextras.StructNative(unsafe.Pointer(pspec2))) -// Flags from Flags. -func (o *OptionEntry) SetFlags(flags int) { - valptr := &o.native.flags - *valptr = C.gint(flags) -} + _cret = C.g_pattern_spec_equal(_arg0, _arg1) + runtime.KeepAlive(pspec1) + runtime.KeepAlive(pspec2) -// 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 -} + var _ok bool // out -// optionGroup is the struct that's finalized. -type optionGroup struct { - native *C.GOptionGroup -} + if _cret != 0 { + _ok = true + } -func marshalOptionGroup(p uintptr) (interface{}, error) { - b := coreglib.ValueFromNative(unsafe.Pointer(p)).Boxed() - return &OptionGroup{&optionGroup{(*C.GOptionGroup)(b)}}, nil + return _ok } -// AddEntries adds the options specified in entries to group. +// 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: // -// - entries: NULL-terminated array of Entrys. -func (group *OptionGroup) AddEntries(entries []OptionEntry) { - var _arg0 *C.GOptionGroup // out - var _arg1 *C.GOptionEntry // out +// - 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.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])))) - } - } + _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)) } - C.g_option_group_add_entries(_arg0, _arg1) - runtime.KeepAlive(group) - runtime.KeepAlive(entries) + _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 } -// SetTranslationDomain: convenience function to use gettext() for translating -// user-visible strings. +// 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: // -// - domain to use. -func (group *OptionGroup) SetTranslationDomain(domain string) { - var _arg0 *C.GOptionGroup // out +// - 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.GOptionGroup)(gextras.StructNative(unsafe.Pointer(group))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(domain))) + _arg0 = (*C.GPatternSpec)(gextras.StructNative(unsafe.Pointer(pspec))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) defer C.free(unsafe.Pointer(_arg1)) - C.g_option_group_set_translation_domain(_arg0, _arg1) - runtime.KeepAlive(group) - runtime.KeepAlive(domain) + _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. @@ -20680,6 +24096,30 @@ func (queue *Queue) Clear() { 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: @@ -20731,7 +24171,7 @@ func (queue *Queue) Index(data unsafe.Pointer) int { } // Init: statically-allocated #GQueue must be initialized with this function -// before it can be used. Alternatively you can initialize it with QUEUE_INIT. +// 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 @@ -20742,6 +24182,34 @@ func (queue *Queue) Init() { 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: @@ -20996,49 +24464,341 @@ func (queue *Queue) Remove(data unsafe.Pointer) bool { return _ok } -// RemoveAll: remove all elements whose data equals data from queue. +// 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: // -// - data (optional) to remove. +// - begin: lower closed bound of the interval. +// - end: upper open bound of the interval. // // 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 +// - 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.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) - _arg1 = (C.gconstpointer)(unsafe.Pointer(data)) + _arg0 = (*C.GRand)(gextras.StructNative(unsafe.Pointer(rand_))) + _arg1 = C.gint32(begin) + _arg2 = C.gint32(end) - _cret = C.g_queue_remove_all(_arg0, _arg1) - runtime.KeepAlive(queue) - runtime.KeepAlive(data) + _cret = C.g_rand_int_range(_arg0, _arg1, _arg2) + runtime.KeepAlive(rand_) + runtime.KeepAlive(begin) + runtime.KeepAlive(end) - var _guint uint // out + var _gint32 int32 // out - _guint = uint(_cret) + _gint32 = int32(_cret) - return _guint + return _gint32 } -// Reverse reverses the order of the items in queue. -func (queue *Queue) Reverse() { - var _arg0 *C.GQueue // out +// 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.GQueue)(gextras.StructNative(unsafe.Pointer(queue))) + _arg0 = (*C.GRand)(gextras.StructNative(unsafe.Pointer(rand_))) + _arg1 = C.guint32(seed) - C.g_queue_reverse(_arg0) - runtime.KeepAlive(queue) + 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: g_regex_*() functions implement regular expression pattern matching -// using syntax and semantics similar to Perl regular expression. +// 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 REGEX_MATCH_NOTBOL in the case +// 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 @@ -21049,12 +24809,13 @@ func (queue *Queue) Reverse() { // 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 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 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. +// 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 @@ -21067,28 +24828,16 @@ func (queue *Queue) Reverse() { // 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 REGEX_NEWLINE_CR, REGEX_NEWLINE_LF and REGEX_NEWLINE_CRLF compile -// options, and with REGEX_MATCH_NEWLINE_ANY, REGEX_MATCH_NEWLINE_CR, -// REGEX_MATCH_NEWLINE_LF and REGEX_MATCH_NEWLINE_CRLF match options. These -// settings are also relevant when compiling a pattern if REGEX_EXTENDED is set, -// and an unescaped "#" outside a character class is encountered. This indicates -// a comment that lasts until after the next newline. -// -// When setting the G_REGEX_JAVASCRIPT_COMPAT flag, pattern syntax and pattern -// matching is changed to be compatible with the way that regular expressions -// work in JavaScript. More precisely, a lonely ']' character in the pattern is -// a syntax error; the '\x' escape only allows 0 to 2 hexadecimal digits, and -// you must use the '\u' escape sequence with 4 hex digits to specify a unicode -// codepoint instead of '\x' or 'x{....}'. If '\x' or '\u' are not followed -// by the specified number of hex digits, they match 'x' and 'u' literally; -// also '\U' always matches 'U' instead of being an error in the pattern. -// Finally, pattern matching is modified so that back references to an unset -// subpattern group produces a match with the empty string instead of an error. -// See pcreapi(3) for more information. -// -// 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 Info is not threadsafe. +// 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. @@ -21352,7 +25101,7 @@ func (regex *Regex) StringNumber(name string) int { // GRegex *regex; // GMatchInfo *match_info; // -// regex = g_regex_new ("[A-Z]+", 0, 0, NULL); +// 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)) // { @@ -21598,23 +25347,57 @@ func RegexErrorQuark() Quark { // The function takes the following parameters: // // - str: string to escape. -// - length of string. // // The function returns the following values: // // - utf8: newly-allocated escaped string. -func RegexEscapeNUL(str string, length int) string { +func RegexEscapeNUL(str string) string { var _arg1 *C.gchar // out - var _arg2 C.gint // out + var _arg2 C.gint var _cret *C.gchar // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gint(length) _cret = C.g_regex_escape_nul(_arg1, _arg2) runtime.KeepAlive(str) - runtime.KeepAlive(length) + + 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 @@ -21750,7 +25533,7 @@ func RegexSplitSimple(pattern, str string, compileOptions RegexCompileFlags, mat return _utf8s } -// Scanner: data structure representing a lexical scanner. +// 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 @@ -21918,21 +25701,20 @@ func (scanner *Scanner) InputFile(inputFd int) { // The function takes the following parameters: // // - text buffer to scan. -// - textLen: length of the text buffer. -func (scanner *Scanner) InputText(text string, textLen uint) { +func (scanner *Scanner) InputText(text string) { var _arg0 *C.GScanner // out var _arg1 *C.gchar // out - var _arg2 C.guint // out + var _arg2 C.guint _arg0 = (*C.GScanner)(gextras.StructNative(unsafe.Pointer(scanner))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(text))) + _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)) - _arg2 = C.guint(textLen) C.g_scanner_input_text(_arg0, _arg1, _arg2) runtime.KeepAlive(scanner) runtime.KeepAlive(text) - runtime.KeepAlive(textLen) } // LookupSymbol looks up a symbol in the current scope and return its value. @@ -22023,6 +25805,32 @@ func (scanner *Scanner) ScopeAddSymbol(scopeId uint, symbol string, value unsafe 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. // @@ -22197,7 +26005,7 @@ func (s *ScannerConfig) CsetSkipCharacters() string { } // CsetIdentifierFirst specifies the characters which can start identifiers (the -// default is CSET_a_2_z, "_", and CSET_A_2_Z). +// 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 @@ -22206,8 +26014,8 @@ func (s *ScannerConfig) CsetIdentifierFirst() string { } // CsetIdentifierNth specifies the characters which can be used in identifiers, -// after the first character (the default is CSET_a_2_z, "_0123456789", -// CSET_A_2_Z, CSET_LATINS, CSET_LATINC). +// 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 @@ -22308,7 +26116,8 @@ func (source *Source) AddChildSource(childSource *Source) { // // The function takes the following parameters: // -// - context (optional) (if NULL, the default context will be used). +// - context (optional) (if NULL, the global-default main context will be +// used). // // The function returns the following values: // @@ -22343,6 +26152,10 @@ func (source *Source) Attach(context *MainContext) uint { // // 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 @@ -22510,8 +26323,8 @@ func (source *Source) Priority() int { // ReadyTime gets the "ready time" of source, as set by // g_source_set_ready_time(). // -// Any time before the current monotonic time (including 0) is an indication -// that the source will fire immediately. +// 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: // @@ -22644,6 +26457,9 @@ func (source *Source) RemoveChildSource(childSource *Source) { // 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. @@ -22737,7 +26553,7 @@ func (source *Source) SetFuncs(funcs *SourceFuncs) { // 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 +// 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 @@ -22749,6 +26565,8 @@ func (source *Source) SetFuncs(funcs *SourceFuncs) { // 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. @@ -22826,6 +26644,25 @@ func (source *Source) SetReadyTime(readyTime int64) { 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. @@ -22964,8 +26801,10 @@ 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. +// 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 @@ -23158,7 +26997,31 @@ func TimeValFromISO8601(isoDate string) (*TimeVal, bool) { return _time_, _ok } -// TimeZone is an opaque structure whose members cannot be accessed directly. +// 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 { @@ -23290,51 +27153,6 @@ func NewTimeZoneUTC() *TimeZone { return _timeZone } -// AdjustTime finds an interval within tz that corresponds to the given time_, -// possibly adjusting time_ if required to fit into an interval. The meaning of -// time_ depends on type. -// -// This function is similar to g_time_zone_find_interval(), with the difference -// that it always succeeds (by making the adjustments described below). -// -// In any of the cases where g_time_zone_find_interval() succeeds then this -// function returns the same value, without modifying time_. -// -// This function may, however, modify time_ in order to deal with non-existent -// times. If the non-existent local time_ of 02:30 were requested on March 14th -// 2010 in Toronto then this function would adjust time_ to be 03:00 and return -// the interval containing the adjusted time. -// -// The function takes the following parameters: -// -// - typ of time_. -// - time_: pointer to a number of seconds since January 1, 1970. -// -// The function returns the following values: -// -// - gint: interval containing time_, never -1. -func (tz *TimeZone) AdjustTime(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)(unsafe.Pointer(time_)) - - _cret = C.g_time_zone_adjust_time(_arg0, _arg1, _arg2) - runtime.KeepAlive(tz) - runtime.KeepAlive(typ) - runtime.KeepAlive(time_) - - var _gint int // out - - _gint = int(_cret) - - return _gint -} - // FindInterval finds an interval within tz that corresponds to the given time_. // The meaning of time_ depends on type. // @@ -23664,7 +27482,11 @@ func (tree *Tree) LookupExtended(lookupKey unsafe.Pointer) (origKey unsafe.Point // // The function returns the following values: // -// - gint: number of nodes in tree. +// - 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 @@ -23720,6 +27542,17 @@ func (tree *Tree) Remove(key unsafe.Pointer) bool { 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. // @@ -23776,17 +27609,157 @@ func (tree *Tree) Steal(key unsafe.Pointer) bool { return _ok } -// URI type and related functions can be used to parse URIs into their +// 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. // -// Note that #GUri scope is to help manipulate URIs in various applications, -// following RFC 3986 (https://tools.ietf.org/html/rfc3986). +// 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/) +// 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. +// (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 // @@ -23808,74 +27781,75 @@ func (tree *Tree) Steal(key unsafe.Pointer) bool { // // 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 g_uri_parse_relative(). +// 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 +// 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 g_uri_split() and -// g_uri_split_with_user(). These split a URI into its component parts, -// and return the parts; the difference between the two is that g_uri_split() -// treats the ‘userinfo’ component of the URI as a single element, -// while g_uri_split_with_user() can (depending on the Flags you pass) treat -// it as containing a username, password, and authentication parameters. -// Alternatively, g_uri_split_network() 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). -// -// g_uri_parse() is similar to g_uri_split(), but instead of returning -// individual strings, it returns a #GUri structure (and it requires that the -// URI be an absolute URI). -// -// g_uri_resolve_relative() and g_uri_parse_relative() allow you to resolve -// a relative URI relative to a base URI. g_uri_resolve_relative() takes two -// strings and returns a string, and g_uri_parse_relative() takes a #GUri and a -// string and returns a #GUri. -// -// All of the parsing functions take a Flags 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 g_uri_peek_scheme() on the URI string to -// check the scheme first, and use that to decide what flags to parse it with. +// 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 g_uri_peek_scheme() against +// params for a web URI, so compare the result of glib.URI().PeekScheme against // http and https. // // # Building URIs // -// g_uri_join() and g_uri_join_with_user() can be used to construct valid -// URI strings from a set of component strings. They are the inverse of -// g_uri_split() and g_uri_split_with_user(). +// 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, g_uri_build() and g_uri_build_with_user() can be used to construct -// a #GUri from a set of component strings. +// 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 Flags 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. +// 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 -// g_filename_from_uri() and g_filename_to_uri() if you want to properly convert -// between file:// URIs and local filenames. +// 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 Flags as well as -// G_URI_FLAGS_SCHEME_NORMALIZE however it is not comprehensive. For example, +// 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. // @@ -24165,9 +28139,10 @@ func (uri *URI) Userinfo() string { return _utf8 } -// ParseRelative parses uri_ref according to flags and, if it is a [relative -// URI][relative-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. +// 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: // @@ -24552,8 +28527,8 @@ func URIEscapeString(unescaped, reservedCharsAllowed string, allowUtf8 bool) str return _utf8 } -// URIIsValid parses uri_string according to flags, to determine whether it is -// a valid [absolute URI][relative-absolute-uris], i.e. it does not need to be +// 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. @@ -24806,8 +28781,8 @@ func URIListExtractURIs(uriList string) []string { } // URIParse parses uri_string according to flags. If the result is not a valid -// [absolute URI][relative-absolute-uris], it will be discarded, and an error -// returned. +// absolute URI (#relative-and-absolute-uris), it will be discarded, and an +// error returned. // // The function takes the following parameters: // @@ -24875,7 +28850,6 @@ func URIParse(uriString string, flags URIFlags) (*URI, error) { // The function takes the following parameters: // // - params: %-encoded string containing attribute=value parameters. -// - length of params, or -1 if it is nul-terminated. // - 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 @@ -24887,24 +28861,24 @@ func URIParse(uriString string, flags URIFlags) (*URI, error) { // // - hashTable: A hash table of attribute/value pairs, with both names and // values fully-decoded; or NULL on error. -func URIParseParams(params string, length int, separators string, flags URIParamsFlags) (map[string]string, error) { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +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 - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(params))) + _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)) - _arg2 = C.gssize(length) _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(length) runtime.KeepAlive(separators) runtime.KeepAlive(flags) @@ -25003,10 +28977,10 @@ func URIPeekScheme(uri string) string { return _utf8 } -// URIResolveRelative parses uri_ref according to flags and, if it is -// a [relative URI][relative-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. +// 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.). @@ -25052,8 +29026,8 @@ func URIResolveRelative(baseUriString, uriRef string, flags URIFlags) (string, e return _utf8, _goerr } -// URISplit parses uri_ref (which can be an [absolute or relative -// URI][relative-absolute-uris]) according to flags, and returns the pieces. +// 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). @@ -25143,8 +29117,8 @@ func URISplit(uriRef string, flags URIFlags) (scheme, userinfo, host string, por return _scheme, _userinfo, _host, _port, _path, _query, _fragment, _goerr } -// URISplitNetwork parses uri_string (which must be an [absolute -// URI][relative-absolute-uris]) according to flags, and returns the pieces +// 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, @@ -25198,8 +29172,8 @@ func URISplitNetwork(uriString string, flags URIFlags) (scheme, host string, por return _scheme, _host, _port, _goerr } -// URISplitWithUser parses uri_ref (which can be an [absolute or relative -// URI][relative-absolute-uris]) according to flags, and returns the pieces. +// 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). @@ -25312,8 +29286,6 @@ func URISplitWithUser(uriRef string, flags URIFlags) (scheme, user, password, au // The function takes the following parameters: // // - escapedString: URI-escaped string. -// - length (in bytes) of escaped_string to escape, or -1 if it is -// nul-terminated. // - illegalCharacters (optional): string of illegal characters not to be // allowed, or NULL. // @@ -25322,16 +29294,17 @@ func URISplitWithUser(uriRef string, flags URIFlags) (scheme, user, password, au // - 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 string, length int, illegalCharacters string) (*Bytes, error) { - var _arg1 *C.char // out - var _arg2 C.gssize // out +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 - _arg1 = (*C.char)(unsafe.Pointer(C.CString(escapedString))) + _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)) - _arg2 = C.gssize(length) if illegalCharacters != "" { _arg3 = (*C.char)(unsafe.Pointer(C.CString(illegalCharacters))) defer C.free(unsafe.Pointer(_arg3)) @@ -25339,7 +29312,6 @@ func URIUnescapeBytes(escapedString string, length int, illegalCharacters string _cret = C.g_uri_unescape_bytes(_arg1, _arg2, _arg3, &_cerr) runtime.KeepAlive(escapedString) - runtime.KeepAlive(length) runtime.KeepAlive(illegalCharacters) var _bytes *Bytes // out @@ -25516,24 +29488,24 @@ type uriParamsIter struct { // The function takes the following parameters: // // - params: %-encoded string containing attribute=value parameters. -// - length of params, or -1 if it is nul-terminated. // - 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, length int, separators string, flags URIParamsFlags) { +func (iter *URIParamsIter) Init(params string, separators string, flags URIParamsFlags) { var _arg0 *C.GUriParamsIter // out var _arg1 *C.gchar // out - var _arg2 C.gssize // out + var _arg2 C.gssize var _arg3 *C.gchar // out var _arg4 C.GUriParamsFlags // out _arg0 = (*C.GUriParamsIter)(gextras.StructNative(unsafe.Pointer(iter))) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(params))) + _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)) - _arg2 = C.gssize(length) _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(separators))) defer C.free(unsafe.Pointer(_arg3)) _arg4 = C.GUriParamsFlags(flags) @@ -25541,7 +29513,6 @@ func (iter *URIParamsIter) Init(params string, length int, separators string, fl C.g_uri_params_iter_init(_arg0, _arg1, _arg2, _arg3, _arg4) runtime.KeepAlive(iter) runtime.KeepAlive(params) - runtime.KeepAlive(length) runtime.KeepAlive(separators) runtime.KeepAlive(flags) } @@ -25589,103 +29560,106 @@ func (iter *URIParamsIter) Next() (attribute string, value string, goerr error) return _attribute, _value, _goerr } -// Variant is a variant datatype; it can contain one or more values along with -// information about the type of the values. +// 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; +// 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 +// 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. +// 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. +// 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 +// 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. +// 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-pointers]. +// 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 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 +// 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 g_variant_ref() and g_variant_unref(). -// #GVariant also has floating reference counts -- see g_variant_ref_sink(). +// 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 +// 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 serialised form. +// 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 deserialisation operations in a small constant time, -// usually touching only a single memory page. Serialised #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 Type for exceptions. (However, -// #GVariant's serialisation format is not the same as the serialisation format -// of a D-Bus message body: use BusMessage, in the gio library, for those.) -// -// For space-efficiency, the #GVariant serialisation format does not -// automatically include the variant's length, type or endianness, which +// 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 File, and call -// g_variant_new_from_data() on it. +// 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 +// 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 +// 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. +// 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 serialised data, memory for the type information cache, buffer -// management memory and memory for the #GVariant structure itself. +// 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. // -// # Serialised Data Memory +// # Serialized Data Memory // -// This is the memory that is used for storing GVariant data in serialised form. +// 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" +// 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. +// ‘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 @@ -25704,23 +29678,23 @@ func (iter *URIParamsIter) Next() (attribute string, value string, goerr error) // 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 serialisation. +// 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 byte to store the int32 (so 6 for the variant containing it) and 6 +// 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) +// 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 +// 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 +// 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. // @@ -25728,14 +29702,13 @@ func (iter *URIParamsIter) Next() (attribute string, value string, goerr error) // // 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 deserialisation. +// 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. +// 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 @@ -25745,21 +29718,21 @@ func (iter *URIParamsIter) Next() (attribute string, value string, goerr error) // // 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 malloc overhead). +// 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 malloc overhead). +// 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. +// 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 Table 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. +// 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 @@ -25768,45 +29741,45 @@ func (iter *URIParamsIter) Next() (attribute string, value string, goerr error) // // # Buffer Management Memory // -// #GVariant uses an internal buffer management structure to deal with the -// various different possible sources of serialised 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 g_free() or a -// g_slice_free() or even g_mapped_file_unref(). +// 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 serialised data. +// 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. +// systems, that’s 16 bytes. // // # GVariant structure // -// The size of a #GVariant structure is 6 * (void *). On 32-bit systems, -// that's 24 bytes. +// 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 serialised data -// for the example given above (with the dictionary) then although there are 9 +// 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 +// 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 g_variant_unref()). The type information is shared. -// The serialised data and the buffer management structure for that serialised +// 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 serialised data, -// 16 bytes for buffer management and 24 bytes for the #GVariant instance, -// or a total of 160 bytes, plus malloc overhead. If we were to use -// g_variant_get_child_value() to access the two dictionary entries, we would +// 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 serialised data and buffer management +// 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. @@ -26493,7 +30466,13 @@ func NewVariantVariant(value *Variant) *Variant { // multi-byte numeric data. That include strings, booleans, bytes and containers // containing only these things (recursively). // -// The returned value is always in normal form and is marked as trusted. +// 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: // @@ -26990,7 +30969,7 @@ func (value *Variant) BytestringArray() []string { // // 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 serialised at the time this function is called. +// 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. // @@ -27035,32 +31014,32 @@ func (value *Variant) ChildValue(index_ uint) *Variant { return _variant } -// Data returns a pointer to the serialised form of a #GVariant instance. The +// 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 deserialised from a corrupted -// serialised container then NULL may be returned. In this case, the proper +// 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 serialised form, this function is O(1). -// If the value is not already in serialised form, serialisation occurs +// 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 deserialise the data returned by this function, in addition to the -// serialised data, you must know the type of the #GVariant, and (if the +// 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 serialised +// 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 serialised data). +// addition to the serialized data). // // The function returns the following values: // -// - gpointer (optional): serialised form of value, or NULL. +// - gpointer (optional): serialized form of value, or NULL. func (value *Variant) Data() unsafe.Pointer { var _arg0 *C.GVariant // out var _cret C.gconstpointer // in @@ -27077,7 +31056,7 @@ func (value *Variant) Data() unsafe.Pointer { return _gpointer } -// DataAsBytes returns a pointer to the serialised form of a #GVariant instance. +// 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. // @@ -27271,10 +31250,11 @@ func (value *Variant) Maybe() *Variant { // 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. +// 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 serialised output is definitely +// 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 @@ -27354,14 +31334,14 @@ func (value *Variant) Objv() []string { // If value has a fixed-sized type then this function always returned that fixed // size. // -// In the case that value is already in serialised form or the size has already +// 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: serialised size of value. +// - gsize: serialized size of value. func (value *Variant) Size() uint { var _arg0 *C.GVariant // out var _cret C.gsize // in @@ -27686,7 +31666,7 @@ func (value *Variant) IsFloating() bool { // IsNormalForm checks if value is in normal form. // -// The main reason to do this is to detect if a given chunk of serialised +// 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. // @@ -27924,14 +31904,14 @@ func (value *Variant) RefSink() *Variant { return _variant } -// Store stores the serialised form of value at data. data should be large +// 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 deserialise the serialised +// 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. // @@ -27939,7 +31919,7 @@ func (value *Variant) RefSink() *Variant { // // The function takes the following parameters: // -// - data: location to store the serialised data at. +// - 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 @@ -28509,7 +32489,7 @@ func (dict *VariantDict) InsertValue(key string, value *Variant) { // // The function returns the following values: // -// - variant: value of the dictionary key, or NULL. +// - 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 @@ -28530,13 +32510,15 @@ func (dict *VariantDict) LookupValue(key string, expectedType *VariantType) *Var var _variant *Variant // out - _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)) - }, - ) + 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 } @@ -28572,82 +32554,92 @@ func (dict *VariantDict) Remove(key string) bool { return _ok } -// VariantType: this section introduces the GVariant 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 +// 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 -// GVariant. +// 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 GVariant 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 GVariant 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 GVariant, 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. +// 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, GVariant 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. GVariant deals with single values -// directly so GVariant type strings always describe the type of exactly one -// value. This means that a D-Bus signature string is generally not a valid -// GVariant type string -- except in the case that it is the signature of a +// 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, g_variant_get_type() will never return an -// indefinite type, but calling g_variant_is_of_type() 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 Bin can exist (since Bin -// is an abstract class), but a Window can certainly be instantiated, and you -// would say that the Window is a Bin (since Window is a subclass of Bin). +// 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 GVariant type string can be any of the following: +// A glib.Variant type string can be any of the following: // // - any basic type string (listed below) // -// - "v", "r" or "*" +// - v, r or * // -// - one of the characters 'a' or 'm', followed by another type string +// - 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 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 '}' +// - 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 g_variant_type_is_basic()) -// 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 "?". +// 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, #GVariant imposes a limit on recursion +// 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 BusMessage to be nested in a top-level tuple. +// (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: // @@ -28689,23 +32681,23 @@ func (dict *VariantDict) Remove(key string) bool { // 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 +// 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 +// - 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. +// 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 +// 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 @@ -28714,21 +32706,20 @@ func (dict *VariantDict) Remove(key string) bool { // // - *: 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". +// 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 +// 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. +// 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 +// 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. +// 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 { @@ -29465,15 +33456,15 @@ func (typ *VariantType) Value() *VariantType { return _variantType } -func VariantTypeChecked_(arg0 string) *VariantType { +func VariantTypeChecked_(typeString string) *VariantType { var _arg1 *C.gchar // out var _cret *C.GVariantType // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(arg0))) + _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(typeString))) defer C.free(unsafe.Pointer(_arg1)) _cret = C.g_variant_type_checked_(_arg1) - runtime.KeepAlive(arg0) + runtime.KeepAlive(typeString) var _variantType *VariantType // out diff --git a/pkg/glib/v2/glib_export.go b/pkg/glib/v2/glib_export.go index 2c36cfa64..4f400edb3 100644 --- a/pkg/glib/v2/glib_export.go +++ b/pkg/glib/v2/glib_export.go @@ -39,6 +39,34 @@ func _gotk4_glib2_CompareDataFunc(arg1 C.gconstpointer, arg2 C.gconstpointer, ar 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 @@ -181,15 +209,15 @@ func _gotk4_glib2_SourceFunc(arg1 C.gpointer) (cret C.gboolean) { return cret } -//export _gotk4_glib2_SpawnChildSetupFunc -func _gotk4_glib2_SpawnChildSetupFunc(arg1 C.gpointer) { - var fn SpawnChildSetupFunc +//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.(SpawnChildSetupFunc) + fn = v.(SourceOnceFunc) } fn() diff --git a/pkg/gobject/v2/gobject.go b/pkg/gobject/v2/gobject.go index 86eb4a2e6..9769a6889 100644 --- a/pkg/gobject/v2/gobject.go +++ b/pkg/gobject/v2/gobject.go @@ -6,7 +6,7 @@ import ( _ "runtime/cgo" ) -// #cgo pkg-config: gobject-2.0 gobject-introspection-1.0 +// #cgo pkg-config: gobject-2.0 glib-2.0 // #cgo CFLAGS: -Wno-deprecated-declarations // #include // #include diff --git a/pkg/graphene/graphene.go b/pkg/graphene/graphene.go index c21df0da5..fe1a11203 100644 --- a/pkg/graphene/graphene.go +++ b/pkg/graphene/graphene.go @@ -2029,7 +2029,7 @@ func NewMatrixAlloc() *Matrix { // 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://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c). +// (http://web.archive.org/web/20150512160205/http://tog.acm.org/resources/GraphicsGems/gemsii/unmatrix.c). // // The function returns the following values: // diff --git a/pkg/gsk/v4/gsk.go b/pkg/gsk/v4/gsk.go index 1084c1b18..89e5229f6 100644 --- a/pkg/gsk/v4/gsk.go +++ b/pkg/gsk/v4/gsk.go @@ -6,6 +6,7 @@ import ( "fmt" "runtime" _ "runtime/cgo" + "strings" "unsafe" "github.com/diamondburned/gotk4/pkg/cairo" @@ -25,17 +26,25 @@ import ( // #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()) @@ -48,10 +57,13 @@ var ( 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()) @@ -62,10 +74,18 @@ var ( 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()) ) @@ -73,11 +93,18 @@ 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}, @@ -90,10 +117,13 @@ func init() { 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}, @@ -104,10 +134,18 @@ func init() { 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}, }) } @@ -116,7 +154,7 @@ func init() { // // The implementation of each blend mode is deferred to the rendering pipeline. // -// See https://www.w3.org/TR/compositing-1/#blending for more information on +// See for more information on // blending and blend modes. type BlendMode C.gint @@ -213,7 +251,7 @@ func (b BlendMode) String() string { } } -// Corner: corner indices used by RoundedRect. +// Corner: corner indices used by GskRoundedRect. type Corner C.gint const ( @@ -247,6 +285,49 @@ func (c Corner) String() string { } } +// 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. // @@ -301,6 +382,223 @@ func (g GLUniformType) String() string { } } +// 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 @@ -309,7 +607,7 @@ const ( NotARenderNodeType RenderNodeType = iota // ContainerNodeType: node containing a stack of children. ContainerNodeType - // CairoNodeType: node drawing a #cairo_surface_t. + // CairoNodeType: node drawing a cairo_surface_t. CairoNodeType // ColorNodeType: node drawing a single color rectangle. ColorNodeType @@ -327,7 +625,7 @@ const ( ConicGradientNodeType // BorderNodeType: node stroking a border around an area. BorderNodeType - // TextureNodeType: node drawing a Texture. + // TextureNodeType: node drawing a GdkTexture. TextureNodeType // InsetShadowNodeType: node drawing an inset shadow. InsetShadowNodeType @@ -360,6 +658,17 @@ const ( 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) { @@ -421,6 +730,16 @@ func (r RenderNodeType) String() string { 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) } @@ -564,10 +883,206 @@ func (t TransformCategory) String() string { } } +// 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 { @@ -747,7 +1262,7 @@ func marshalBlurNode(p uintptr) (interface{}, error) { // The function takes the following parameters: // // - child node to blur. -// - radius: blur radius. +// - radius: blur radius. Must be positive. // // The function returns the following values: // @@ -858,7 +1373,7 @@ func marshalBorderNode(p uintptr) (interface{}, error) { // // The function takes the following parameters: // -// - outline describing the outline of the border. +// - 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. @@ -898,8 +1413,8 @@ func NewBorderNode(outline *RoundedRect, borderWidth [4]float32, borderColor [4] // // The function returns the following values: // -// - rgbA: array of 4 RGBA structs for the top, right, bottom and left color -// of the border. +// - 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 @@ -1246,11 +1761,12 @@ func marshalColorMatrixNode(p uintptr) (interface{}, error) { // NewColorMatrixNode creates a GskRenderNode that will drawn the child with // color_matrix. // -// In particular, the node will transform the operation +// In particular, the node will transform colors by applying // -// pixel = color_matrix * pixel + color_offset +// pixel = transpose(color_matrix) * pixel + color_offset // -// for every pixel. +// for every pixel. The transformation operates on unpremultiplied colors, +// with color components ordered R, G, B, A. // // The function takes the following parameters: // @@ -2018,71 +2534,215 @@ func (node *DebugNode) Message() string { return _utf8 } -// GLShaderOverrides contains methods that are overridable. -type GLShaderOverrides struct { +// 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 } -func defaultGLShaderOverrides(v *GLShader) GLShaderOverrides { - return GLShaderOverrides{} +var ( + _ RenderNoder = (*FillNode)(nil) +) + +func wrapFillNode(obj *coreglib.Object) *FillNode { + return &FillNode{ + RenderNode: RenderNode{ + Object: obj, + }, + } } -// 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. +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 main function the shader must implement is: +// The function takes the following parameters: // -// void mainImage(out vec4 fragColor, -// in vec2 fragCoord, -// in vec2 resolution, -// in vec2 uv) +// - child: node to fill the area with. +// - path describing the area to fill. +// - fillRule: fill rule to use. // -// 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 function returns the following values: // -// 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. +// - 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. // -// 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. +// The function returns the following values: // -// All textures sources contain premultiplied alpha colors, but if some there +// - 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. // @@ -2094,14 +2754,14 @@ func defaultGLShaderOverrides(v *GLShader) GLShaderOverrides { // uniform sampler2D u_texture1; // uniform sampler2D u_texture2; // -// GTK uses the 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: +// 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 -// containes some helper ifdefs to ensure that it works on all OpenGL versions. +// 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 @@ -2571,7 +3231,7 @@ func (shader *GLShader) NUniforms() int { // // The function returns the following values: // -// - utf8: resource path for the shader, or NULL if none. +// - utf8 (optional): resource path for the shader. func (shader *GLShader) Resource() string { var _arg0 *C.GskGLShader // out var _cret *C.char // in @@ -2583,7 +3243,9 @@ func (shader *GLShader) Resource() string { var _utf8 string // out - _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + if _cret != nil { + _utf8 = C.GoString((*C.gchar)(unsafe.Pointer(_cret))) + } return _utf8 } @@ -2745,11 +3407,11 @@ func marshalGLShaderNode(p uintptr) (interface{}, error) { // // The function takes the following parameters: // -// - shader: GLShader. +// - shader: GskGLShader. // - bounds: rectangle to render the shader into. // - args arguments for the uniforms. -// - children: array of child nodes, these will be rendered to textures and -// used as input. +// - children (optional): array of child nodes, these will be rendered to +// textures and used as input. // // The function returns the following values: // @@ -2765,13 +3427,15 @@ func NewGLShaderNode(shader *GLShader, bounds *graphene.Rect, args *glib.Bytes, _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))) - _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())) + 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())) + } } } @@ -2792,7 +3456,7 @@ func NewGLShaderNode(shader *GLShader, bounds *graphene.Rect, args *glib.Bytes, // // The function returns the following values: // -// - bytes with the uniform arguments. +// - bytes: GBytes with the uniform arguments. func (node *GLShaderNode) Args() *glib.Bytes { var _arg0 *C.GskRenderNode // out var _cret *C.GBytes // in @@ -2885,7 +3549,7 @@ func (node *GLShaderNode) NChildren() uint { // // The function returns the following values: // -// - glShader: GLShader shader. +// - glShader: GskGLShader shader. func (node *GLShaderNode) Shader() *GLShader { var _arg0 *C.GskRenderNode // out var _cret *C.GskGLShader // in @@ -3259,70 +3923,77 @@ func (node *LinearGradientNode) Start() *graphene.Point { return _point } -// OpacityNode: render node controlling the opacity of its single child node. -type OpacityNode struct { +// MaskNode: render node masking one child node with another. +type MaskNode struct { _ [0]func() // equal guard RenderNode } var ( - _ RenderNoder = (*OpacityNode)(nil) + _ RenderNoder = (*MaskNode)(nil) ) -func wrapOpacityNode(obj *coreglib.Object) *OpacityNode { - return &OpacityNode{ +func wrapMaskNode(obj *coreglib.Object) *MaskNode { + return &MaskNode{ RenderNode: RenderNode{ Object: obj, }, } } -func marshalOpacityNode(p uintptr) (interface{}, error) { - return wrapOpacityNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +func marshalMaskNode(p uintptr) (interface{}, error) { + return wrapMaskNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// NewOpacityNode creates a GskRenderNode that will drawn the child with reduced -// opacity. +// 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: // -// - child: node to draw. -// - opacity to apply. +// - source node to be drawn. +// - mask: node to be used as mask. +// - maskMode: mask mode to use. // // The function returns the following values: // -// - opacityNode: new GskRenderNode. -func NewOpacityNode(child RenderNoder, opacity float32) *OpacityNode { +// - maskNode: new GskRenderNode. +func NewMaskNode(source, mask RenderNoder, maskMode MaskMode) *MaskNode { var _arg1 *C.GskRenderNode // out - var _arg2 C.float // out + var _arg2 *C.GskRenderNode // out + var _arg3 C.GskMaskMode // out var _cret *C.GskRenderNode // in - _arg1 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) - _arg2 = C.float(opacity) + _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_opacity_node_new(_arg1, _arg2) - runtime.KeepAlive(child) - runtime.KeepAlive(opacity) + _cret = C.gsk_mask_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(source) + runtime.KeepAlive(mask) + runtime.KeepAlive(maskMode) - var _opacityNode *OpacityNode // out + var _maskNode *MaskNode // out - _opacityNode = wrapOpacityNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + _maskNode = wrapMaskNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) - return _opacityNode + return _maskNode } -// Child gets the child node that is getting opacityed by the given node. +// Mask retrieves the mask GskRenderNode child of the node. // // The function returns the following values: // -// - renderNode: child that is getting opacityed. -func (node *OpacityNode) Child() RenderNoder { +// - 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_opacity_node_get_child(_arg0) + _cret = C.gsk_mask_node_get_mask(_arg0) runtime.KeepAlive(node) var _renderNode RenderNoder // out @@ -3348,68 +4019,248 @@ func (node *OpacityNode) Child() RenderNoder { return _renderNode } -// Opacity gets the transparency factor for an opacity node. +// MaskMode retrieves the mask mode used by node. // // The function returns the following values: // -// - gfloat: opacity factor. -func (node *OpacityNode) Opacity() float32 { +// - maskMode: mask mode. +func (node *MaskNode) MaskMode() MaskMode { var _arg0 *C.GskRenderNode // out - var _cret C.float // in + var _cret C.GskMaskMode // in _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) - _cret = C.gsk_opacity_node_get_opacity(_arg0) + _cret = C.gsk_mask_node_get_mask_mode(_arg0) runtime.KeepAlive(node) - var _gfloat float32 // out + var _maskMode MaskMode // out - _gfloat = float32(_cret) + _maskMode = MaskMode(_cret) - return _gfloat + return _maskMode } -// OutsetShadowNode: render node for an outset shadow. -type OutsetShadowNode struct { +// 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 = (*OutsetShadowNode)(nil) + _ RenderNoder = (*OpacityNode)(nil) ) -func wrapOutsetShadowNode(obj *coreglib.Object) *OutsetShadowNode { - return &OutsetShadowNode{ +func wrapOpacityNode(obj *coreglib.Object) *OpacityNode { + return &OpacityNode{ RenderNode: RenderNode{ Object: obj, }, } } -func marshalOutsetShadowNode(p uintptr) (interface{}, error) { - return wrapOutsetShadowNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +func marshalOpacityNode(p uintptr) (interface{}, error) { + return wrapOpacityNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// NewOutsetShadowNode creates a GskRenderNode that will render an outset shadow -// around the box given by outline. +// NewOpacityNode creates a GskRenderNode that will drawn the child with reduced +// opacity. // // 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. +// - child: node to draw. +// - opacity to apply. // // 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 +// - 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 @@ -3588,7 +4439,7 @@ func marshalRadialGradientNode(p uintptr) (interface{}, error) { // 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 vertial +// dictated by hradius in horizontal orientation and by vradius in vertical // orientation. // // The function takes the following parameters: @@ -3720,7 +4571,7 @@ func (node *RadialGradientNode) End() float32 { return _gfloat } -// Hradius retrieves the horizonal radius for the gradient. +// Hradius retrieves the horizontal radius for the gradient. // // The function returns the following values: // @@ -3805,7 +4656,7 @@ func (node *RadialGradientNode) Vradius() float32 { } // RenderNode: GskRenderNode is the basic block in a scene graph to be rendered -// using GskRenderer. +// using gsk.Renderer. // // Each node has a parent, except the top-level node; each node may have // children nodes. @@ -3860,7 +4711,7 @@ func BaseRenderNode(obj RenderNoder) *RenderNode { // // 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 GdkSurface's rendering buffer. +// 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. @@ -3936,7 +4787,7 @@ func (node *RenderNode) NodeType() RenderNodeType { // // The function returns the following values: // -// - bytes representing the node. +// - bytes: GBytes representing the node. func (node *RenderNode) Serialize() *glib.Bytes { var _arg0 *C.GskRenderNode // out var _cret *C.GBytes // in @@ -3960,7 +4811,7 @@ func (node *RenderNode) Serialize() *glib.Bytes { } // WriteToFile: this function is equivalent to calling -// gsk_render_node_serialize() followed by g_file_set_contents(). +// gsk.RenderNode.Serialize() followed by glib.FileSetContents(). // // See those two functions for details on the arguments. // @@ -3993,18 +4844,18 @@ func (node *RenderNode) WriteToFile(filename string) error { } // RenderNodeDeserialize loads data previously created via -// gsk_render_node_serialize(). +// 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 or NULL. +// - errorFunc (optional): callback on parsing errors. // // The function returns the following values: // -// - renderNode (optional): new GskRenderNode or NULL on error. +// - renderNode (optional): new GskRenderNode. func RenderNodeDeserialize(bytes *glib.Bytes, errorFunc ParseErrorFunc) RenderNoder { var _arg1 *C.GBytes // out var _arg2 C.GskParseErrorFunc // out @@ -4190,16 +5041,25 @@ func (renderer *Renderer) IsRealized() bool { // 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: GdkSurface renderer will be used on. +// - 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())) - _arg1 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + if surface != nil { + _arg1 = (*C.GdkSurface)(unsafe.Pointer(coreglib.InternObject(surface).Native())) + } C.gsk_renderer_realize(_arg0, _arg1, &_cerr) runtime.KeepAlive(renderer) @@ -4214,8 +5074,41 @@ func (renderer *Renderer) Realize(surface gdk.Surfacer) error { 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, ensuring that the given region gets redrawn. +// 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 @@ -4529,7 +5422,7 @@ func marshalRepeatingRadialGradientNode(p uintptr) (interface{}, error) { // radial gradient. // // The radial gradient starts around center. The size of the gradient is -// dictated by hradius in horizontal orientation and by vradius in vertial +// dictated by hradius in horizontal orientation and by vradius in vertical // orientation. // // The function takes the following parameters: @@ -4639,7 +5532,7 @@ func NewRoundedClipNode(child RenderNoder, clip *RoundedRect) *RoundedClipNode { var _roundedClipNode *RoundedClipNode // out - _roundedClipNode = wrapRoundedClipNode(coreglib.Take(unsafe.Pointer(_cret))) + _roundedClipNode = wrapRoundedClipNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) return _roundedClipNode } @@ -4850,181 +5743,386 @@ func (node *ShadowNode) Shadow(i uint) *Shadow { return _shadow } -// TextNode: render node drawing a set of glyphs. -type TextNode struct { +// 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 = (*TextNode)(nil) + _ RenderNoder = (*StrokeNode)(nil) ) -func wrapTextNode(obj *coreglib.Object) *TextNode { - return &TextNode{ +func wrapStrokeNode(obj *coreglib.Object) *StrokeNode { + return &StrokeNode{ RenderNode: RenderNode{ Object: obj, }, } } -func marshalTextNode(p uintptr) (interface{}, error) { - return wrapTextNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +func marshalStrokeNode(p uintptr) (interface{}, error) { + return wrapStrokeNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// NewTextNode creates a render node that renders the given glyphs. +// NewStrokeNode creates a RenderNode that will fill the outline generated by +// stroking the given path using the attributes defined in stroke. // -// Note that color may not be used if the font contains color glyphs. +// The area is filled with child. // // The function takes the following parameters: // -// - font containing the glyphs. -// - glyphs 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. +// - child: node to stroke the area with. +// - path describing the area to stroke. +// - stroke attributes to use. // // 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 +// - 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 - _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) + _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_text_node_get_color(_arg0) - runtime.KeepAlive(node) + _cret = C.gsk_stroke_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(child) + runtime.KeepAlive(path) + runtime.KeepAlive(stroke) - var _rgbA *gdk.RGBA // out + var _strokeNode *StrokeNode // out - _rgbA = (*gdk.RGBA)(gextras.NewStructNative(unsafe.Pointer(_cret))) + _strokeNode = wrapStrokeNode(coreglib.Take(unsafe.Pointer(_cret))) - return _rgbA + return _strokeNode } -// Font returns the font used by the text node. +// Child gets the child node that is getting drawn by the given node. // // The function returns the following values: // -// - font: font. -func (node *TextNode) Font() pango.Fonter { +// - renderNode: child that is getting drawn. +func (node *StrokeNode) Child() RenderNoder { var _arg0 *C.GskRenderNode // out - var _cret *C.PangoFont // in + var _cret *C.GskRenderNode // in _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) - _cret = C.gsk_text_node_get_font(_arg0) + _cret = C.gsk_stroke_node_get_child(_arg0) runtime.KeepAlive(node) - var _font pango.Fonter // out + var _renderNode RenderNoder // out { objptr := unsafe.Pointer(_cret) if objptr == nil { - panic("object of type pango.Fonter is nil") + panic("object of type gsk.RenderNoder is nil") } object := coreglib.Take(objptr) casted := object.WalkCast(func(obj coreglib.Objector) bool { - _, ok := obj.(pango.Fonter) + _, ok := obj.(RenderNoder) return ok }) - rv, ok := casted.(pango.Fonter) + rv, ok := casted.(RenderNoder) if !ok { - panic("no marshaler for " + object.TypeFromInstance().String() + " matching pango.Fonter") + panic("no marshaler for " + object.TypeFromInstance().String() + " matching gsk.RenderNoder") } - _font = rv + _renderNode = rv } - return _font + return _renderNode } -// Glyphs retrieves the glyph information in the node. +// Path retrieves the path that will be stroked with the contents of 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 +// - 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_text_node_get_glyphs(_arg0, &_arg1) + _cret = C.gsk_stroke_node_get_path(_arg0) runtime.KeepAlive(node) - var _glyphInfos []pango.GlyphInfo // out + var _path *Path // 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])))) - } - } + _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 _glyphInfos + return _path } -// NumGlyphs retrieves the number of glyphs in the text node. +// Stroke retrieves the stroke attributes used in this node. // // The function returns the following values: // -// - guint: number of glyphs. -func (node *TextNode) NumGlyphs() uint { +// - stroke: Stroke. +func (node *StrokeNode) Stroke() *Stroke { var _arg0 *C.GskRenderNode // out - var _cret C.guint // in + var _cret *C.GskStroke // in _arg0 = (*C.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(node).Native())) - _cret = C.gsk_text_node_get_num_glyphs(_arg0) + _cret = C.gsk_stroke_node_get_stroke(_arg0) runtime.KeepAlive(node) - var _guint uint // out + var _stroke *Stroke // out - _guint = uint(_cret) + _stroke = (*Stroke)(gextras.NewStructNative(unsafe.Pointer(_cret))) - return _guint + return _stroke } -// Offset retrieves the offset applied to the text. -// -// The function returns the following values: -// -// - point with the horizontal and vertical offsets. +// 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 @@ -5064,7 +6162,7 @@ func (node *TextNode) HasColorGlyphs() bool { return _ok } -// TextureNode: render node for a Texture. +// TextureNode: render node for a GdkTexture. type TextureNode struct { _ [0]func() // equal guard RenderNode @@ -5089,6 +6187,9 @@ func marshalTextureNode(p uintptr) (interface{}, error) { // 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. @@ -5153,54 +6254,176 @@ func (node *TextureNode) Texture() gdk.Texturer { return _texture } -// TransformNode: render node applying a GskTransform to its single child node. -type TransformNode struct { +// TextureScaleNode: render node for a GdkTexture. +type TextureScaleNode struct { _ [0]func() // equal guard RenderNode } var ( - _ RenderNoder = (*TransformNode)(nil) + _ RenderNoder = (*TextureScaleNode)(nil) ) -func wrapTransformNode(obj *coreglib.Object) *TransformNode { - return &TransformNode{ +func wrapTextureScaleNode(obj *coreglib.Object) *TextureScaleNode { + return &TextureScaleNode{ RenderNode: RenderNode{ Object: obj, }, } } -func marshalTransformNode(p uintptr) (interface{}, error) { - return wrapTransformNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil +func marshalTextureScaleNode(p uintptr) (interface{}, error) { + return wrapTextureScaleNode(coreglib.ValueFromNative(unsafe.Pointer(p)).Object()), nil } -// NewTransformNode creates a GskRenderNode that will transform the given child -// with the given transform. +// 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: // -// - child: node to transform. -// - transform to apply. +// - texture to scale. +// - bounds: size of the texture to scale to. +// - filter: how to scale the texture. // // 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 +// - 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.GskRenderNode)(unsafe.Pointer(coreglib.InternObject(child).Native())) - _arg2 = (*C.GskTransform)(gextras.StructNative(unsafe.Pointer(transform))) + _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_transform_node_new(_arg1, _arg2) - runtime.KeepAlive(child) - runtime.KeepAlive(transform) + _cret = C.gsk_texture_scale_node_new(_arg1, _arg2, _arg3) + runtime.KeepAlive(texture) + runtime.KeepAlive(bounds) + runtime.KeepAlive(filter) - var _transformNode *TransformNode // out + var _textureScaleNode *TextureScaleNode // out - _transformNode = wrapTransformNode(coreglib.AssumeOwnership(unsafe.Pointer(_cret))) + _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 } @@ -5398,28 +6621,1879 @@ func (p *ParseLocation) SetBytes(bytes uint) { *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) +// 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 } -// Lines: line of the location in the parse buffer. -func (p *ParseLocation) SetLines(lines uint) { - valptr := &p.native.lines - *valptr = C.gsize(lines) -} +// 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 -// LineBytes: position in the line, as bytes. -func (p *ParseLocation) SetLineBytes(lineBytes uint) { - valptr := &p.native.line_bytes - *valptr = C.gsize(lineBytes) -} + _arg0 = (*C.GskPathPoint)(gextras.StructNative(unsafe.Pointer(point))) + _arg1 = (*C.GskPath)(gextras.StructNative(unsafe.Pointer(path))) + _arg2 = C.GskPathDirection(direction) -// LineChars: position in the line, as characters. -func (p *ParseLocation) SetLineChars(lineChars uint) { - valptr := &p.native.line_chars - *valptr = C.gsize(lineChars) + 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. @@ -5801,7 +8875,7 @@ func (self *RoundedRect) Shrink(top float32, right float32, bottom float32, left return _roundedRect } -// ShaderArgsBuilder: object to build the uniforms data for a GLShader. +// ShaderArgsBuilder: object to build the uniforms data for a GskGLShader. // // An instance of this type is always passed by reference. type ShaderArgsBuilder struct { @@ -6052,59 +9126,447 @@ type Shadow struct { *shadow } -// shadow is the struct that's finalized. -type shadow struct { - native *C.GskShadow +// 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) } -// 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 -} +// 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 -// Dx: horizontal offset of the shadow. -func (s *Shadow) Dx() float32 { - valptr := &s.native.dx - var _v float32 // out - _v = float32(*valptr) - return _v -} + _arg0 = (*C.GskStroke)(gextras.StructNative(unsafe.Pointer(self))) + _arg1 = (*C.cairo_t)(unsafe.Pointer(cr.Native())) -// Dy: vertical offset of the shadow. -func (s *Shadow) Dy() float32 { - valptr := &s.native.dy - var _v float32 // out - _v = float32(*valptr) - return _v + C.gsk_stroke_to_cairo(_arg0, _arg1) + runtime.KeepAlive(self) + runtime.KeepAlive(cr) } -// Radius radius of the shadow. -func (s *Shadow) Radius() float32 { - valptr := &s.native.radius - var _v float32 // out - _v = float32(*valptr) - return _v -} +// 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 -// Dx: horizontal offset of the shadow. -func (s *Shadow) SetDx(dx float32) { - valptr := &s.native.dx - *valptr = C.float(dx) -} + _arg1 = (C.gconstpointer)(unsafe.Pointer(stroke1)) + _arg2 = (C.gconstpointer)(unsafe.Pointer(stroke2)) -// Dy: vertical offset of the shadow. -func (s *Shadow) SetDy(dy float32) { - valptr := &s.native.dy - *valptr = C.float(dy) -} + _cret = C.gsk_stroke_equal(_arg1, _arg2) + runtime.KeepAlive(stroke1) + runtime.KeepAlive(stroke2) -// Radius radius of the shadow. -func (s *Shadow) SetRadius(radius float32) { - valptr := &s.native.radius - *valptr = C.float(radius) + var _ok bool // out + + if _cret != 0 { + _ok = true + } + + return _ok } // Transform: GskTransform is an object to describe transform matrices. @@ -6217,8 +9679,7 @@ func (self *Transform) Category() TransformCategory { // // The function returns the following values: // -// - transform (optional): inverted transform or NULL if the transform cannot -// be inverted. +// - transform (optional): inverted transform. func (self *Transform) Invert() *Transform { var _arg0 *C.GskTransform // out var _cret *C.GskTransform // in @@ -6322,7 +9783,8 @@ func (next *Transform) Perspective(depth float32) *Transform { return _transform } -// Rotate rotates next angle degrees in 2D - or in 3D-speak, around the z axis. +// 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: // @@ -6330,7 +9792,7 @@ func (next *Transform) Perspective(depth float32) *Transform { // // The function returns the following values: // -// - transform: new transform. +// - transform (optional): new transform. func (next *Transform) Rotate(angle float32) *Transform { var _arg0 *C.GskTransform // out var _arg1 C.float // out @@ -6347,13 +9809,15 @@ func (next *Transform) Rotate(angle float32) *Transform { 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)) - }, - ) + 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 } @@ -6369,7 +9833,7 @@ func (next *Transform) Rotate(angle float32) *Transform { // // The function returns the following values: // -// - transform: new transform. +// - transform (optional): new transform. func (next *Transform) Rotate3D(angle float32, axis *graphene.Vec3) *Transform { var _arg0 *C.GskTransform // out var _arg1 C.float // out @@ -6389,13 +9853,15 @@ func (next *Transform) Rotate3D(angle float32, axis *graphene.Vec3) *Transform { 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)) - }, - ) + 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 } @@ -6411,7 +9877,7 @@ func (next *Transform) Rotate3D(angle float32, axis *graphene.Vec3) *Transform { // // The function returns the following values: // -// - transform: new transform. +// - transform (optional): new transform. func (next *Transform) Scale(factorX float32, factorY float32) *Transform { var _arg0 *C.GskTransform // out var _arg1 C.float // out @@ -6431,13 +9897,15 @@ func (next *Transform) Scale(factorX float32, factorY float32) *Transform { 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)) - }, - ) + 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 } @@ -6452,7 +9920,7 @@ func (next *Transform) Scale(factorX float32, factorY float32) *Transform { // // The function returns the following values: // -// - transform: new transform. +// - 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 @@ -6475,13 +9943,57 @@ func (next *Transform) Scale3D(factorX float32, factorY float32, factorZ float32 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)) - }, - ) + 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 } @@ -6539,10 +10051,82 @@ func (self *Transform) To2D() (outXx float32, outYx float32, outXy float32, outY return _outXx, _outYx, _outXy, _outYy, _outDx, _outDy } -// ToAffine converts a GskTransform to 2D affine transformation factors. +// 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_AFFINE to check. +// +// 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: // @@ -6631,7 +10215,10 @@ func (self *Transform) String() string { // 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. +// +// gsk_transform_get_category() >= GSK_TRANSFORM_CATEGORY_2D_TRANSLATE +// +// to check. // // The function returns the following values: // @@ -6664,7 +10251,7 @@ func (self *Transform) ToTranslate() (outDx float32, outDy float32) { // // The function returns the following values: // -// - transform: new transform. +// - transform (optional): new transform. func (next *Transform) Transform(other *Transform) *Transform { var _arg0 *C.GskTransform // out var _arg1 *C.GskTransform // out @@ -6683,13 +10270,15 @@ func (next *Transform) Transform(other *Transform) *Transform { 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)) - }, - ) + 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 } @@ -6760,7 +10349,7 @@ func (self *Transform) TransformPoint(point *graphene.Point) *graphene.Point { // // The function returns the following values: // -// - transform: new transform. +// - transform (optional): new transform. func (next *Transform) Translate(point *graphene.Point) *Transform { var _arg0 *C.GskTransform // out var _arg1 *C.graphene_point_t // out @@ -6777,13 +10366,15 @@ func (next *Transform) Translate(point *graphene.Point) *Transform { 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)) - }, - ) + 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 } @@ -6796,7 +10387,7 @@ func (next *Transform) Translate(point *graphene.Point) *Transform { // // The function returns the following values: // -// - transform: new transform. +// - transform (optional): new transform. func (next *Transform) Translate3D(point *graphene.Point3D) *Transform { var _arg0 *C.GskTransform // out var _arg1 *C.graphene_point3d_t // out @@ -6813,13 +10404,15 @@ func (next *Transform) Translate3D(point *graphene.Point3D) *Transform { 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)) - }, - ) + 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 } diff --git a/pkg/gsk/v4/gsk_export.go b/pkg/gsk/v4/gsk_export.go index 7ec193220..92130f98c 100644 --- a/pkg/gsk/v4/gsk_export.go +++ b/pkg/gsk/v4/gsk_export.go @@ -8,6 +8,7 @@ import ( "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 @@ -35,3 +36,35 @@ func _gotk4_gsk4_ParseErrorFunc(arg1 *C.GskParseLocation, arg2 *C.GskParseLocati 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/pkg/gtk/v3/gtk.go b/pkg/gtk/v3/gtk.go index c0cc2f2dd..f60ed4ee1 100644 --- a/pkg/gtk/v3/gtk.go +++ b/pkg/gtk/v3/gtk.go @@ -3,7 +3,6 @@ package gtk import ( - "context" "fmt" "runtime" _ "runtime/cgo" @@ -13,7 +12,6 @@ import ( "github.com/diamondburned/gotk4/pkg/atk" "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" @@ -684,7 +682,6 @@ import ( // extern void _gotk4_gtk3_ButtonClass_enter(GtkButton*); // extern void _gotk4_gtk3_ButtonClass_clicked(GtkButton*); // extern void _gotk4_gtk3_ButtonClass_activate(GtkButton*); -// extern void _gotk4_gtk3_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer); // extern void _gotk4_gtk3_Assistant_ConnectPrepare(gpointer, GtkWidget*, guintptr); // extern void _gotk4_gtk3_Assistant_ConnectEscape(gpointer, guintptr); // extern void _gotk4_gtk3_Assistant_ConnectClose(gpointer, guintptr); @@ -723,7 +720,6 @@ import ( // extern void _gotk4_gtk3_AccessibleClass_widget_set(GtkAccessible*); // extern void _gotk4_gtk3_AccessibleClass_connect_widget_destroyed(GtkAccessible*); // extern void _gotk4_gtk3_AccelMap_ConnectChanged(gpointer, gchar*, guint, GdkModifierType, guintptr); -// extern void _gotk4_gio2_AsyncReadyCallback(GObject*, GAsyncResult*, gpointer); // extern guint _gotk4_gtk3_RcStyleClass_parse(GtkRcStyle*, GtkSettings*, GScanner*); // extern guint _gotk4_gtk3_EntryBufferClass_insert_text(GtkEntryBuffer*, guint, gchar*, guint); // extern guint _gotk4_gtk3_EntryBufferClass_get_length(GtkEntryBuffer*); @@ -3594,7 +3590,7 @@ func init() { // BINARY_AGE: like gtk_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 = 2427 +const BINARY_AGE = 2442 // INPUT_ERROR: constant to return from a signal handler for the // SpinButton::input signal in case of conversion failure. @@ -3603,7 +3599,7 @@ const INPUT_ERROR = -1 // INTERFACE_AGE: like gtk_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 = 23 +const INTERFACE_AGE = 32 // LEVEL_BAR_OFFSET_FULL: name used for the stock full offset included by // LevelBar. @@ -3628,7 +3624,7 @@ const MAX_COMPOSE_LEN = 7 // MICRO_VERSION: like gtk_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 = 27 +const MICRO_VERSION = 42 // MINOR_VERSION: like gtk_get_minor_version(), but from the headers used at // application compile time, rather than from the library linked against at @@ -11064,7 +11060,7 @@ type TextBufferDeserializeFunc func(registerBuffer, contentBuffer *TextBuffer, i // TextBufferSerializeFunc: function that is called to serialize the content of // a text buffer. It must return the serialized form of the content. -type TextBufferSerializeFunc func(registerBuffer, contentBuffer *TextBuffer, start, end *TextIter) (length uint, guint8 *byte) +type TextBufferSerializeFunc func(registerBuffer, contentBuffer *TextBuffer, start, end *TextIter) (guint8s []byte) type TextCharPredicate func(ch uint32) (ok bool) @@ -17281,6 +17277,10 @@ func (activatable *Activatable) syncActionProperties(action *Action) { runtime.KeepAlive(action) } +// Update: called to update the activatable when its related action’s properties +// change. You must check the Activatable:use-action-appearance property only +// apply action properties that are meant to effect the appearance accordingly. +// // The function takes the following parameters: // // - action @@ -18831,41 +18831,6 @@ func (cellEditable *CellEditable) startEditing(event *gdk.Event) { // // This is an example of a UI definition fragment specifying attributes: // -// -// -// -// -// 0 -// -// " -// -// -// Furthermore for implementations of GtkCellLayout that use a CellArea -// to lay out cells (all GtkCellLayouts in GTK+ use a GtkCellArea) [cell -// properties][cell-properties] can also be defined in the format by specifying -// the custom attribute which can contain multiple -// elements defined in the normal way. -// -// Here is a UI definition fragment specifying cell properties: -// -// -// -// -// -// True -// False -// -// " -// -// -// # Subclassing GtkCellLayout implementations -// -// When subclassing a widget that implements CellLayout like IconView -// or ComboBox, there are some considerations related to the fact that -// these widgets internally use a CellArea. The cell area is exposed as a -// construct-only property by these widgets. This means that it is possible to -// e.g. do -// // static void // my_combo_box_init (MyComboBox *b) // { @@ -21075,7 +21040,7 @@ func (chooser *FileChooser) CurrentFolder() string { // // The function returns the following values: // -// - file for the current folder. +// - file (optional) for the current folder. func (chooser *FileChooser) CurrentFolderFile() *gio.File { var _arg0 *C.GtkFileChooser // out var _cret *C.GFile // in @@ -21087,10 +21052,12 @@ func (chooser *FileChooser) CurrentFolderFile() *gio.File { var _file *gio.File // out - { - obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) - _file = &gio.File{ - Object: obj, + if _cret != nil { + { + obj := coreglib.AssumeOwnership(unsafe.Pointer(_cret)) + _file = &gio.File{ + Object: obj, + } } } @@ -24699,6 +24666,8 @@ func (chooser *RecentChooser) items() []*RecentInfo { return _list } +// itemActivated: signal emitted when the user “activates” a recent item in the +// recent chooser. func (chooser *RecentChooser) itemActivated() { gclass := (*C.GtkRecentChooserIface)(coreglib.PeekParentClass(chooser)) fnarg := gclass.item_activated @@ -24807,6 +24776,8 @@ func (chooser *RecentChooser) selectURI(uri string) error { return _goerr } +// selectionChanged: signal emitted when there is a change in the set of +// selected recently used resources. func (chooser *RecentChooser) selectionChanged() { gclass := (*C.GtkRecentChooserIface)(coreglib.PeekParentClass(chooser)) fnarg := gclass.selection_changed @@ -25678,6 +25649,7 @@ func (shell *ToolShell) ellipsizeMode() pango.EllipsizeMode { return _ellipsizeMode } +// iconSize: mandatory implementation of gtk_tool_shell_get_icon_size(). func (shell *ToolShell) iconSize() IconSize { gclass := (*C.GtkToolShellIface)(coreglib.PeekParentClass(shell)) fnarg := gclass.get_icon_size @@ -29689,6 +29661,9 @@ func (accelGroup *AccelGroup) Unlock() { runtime.KeepAlive(accelGroup) } +// accelChanged: signal emitted when an entry is added to or removed from the +// accel group. +// // The function takes the following parameters: // // - keyval @@ -33550,6 +33525,9 @@ func (alignment *Alignment) SetPadding(paddingTop, paddingBottom, paddingLeft, p // AppChooserButtonOverrides contains methods that are overridable. type AppChooserButtonOverrides struct { + // CustomItemActivated: signal emitted when a custom item, previously added + // with gtk_app_chooser_button_append_custom_item(), is activated from the + // dropdown menu. CustomItemActivated func(itemName string) } @@ -33903,6 +33881,9 @@ func (self *AppChooserButton) SetShowDialogItem(setting bool) { runtime.KeepAlive(setting) } +// customItemActivated: signal emitted when a custom item, previously added with +// gtk_app_chooser_button_append_custom_item(), is activated from the dropdown +// menu. func (self *AppChooserButton) customItemActivated(itemName string) { gclass := (*C.GtkAppChooserButtonClass)(coreglib.PeekParentClass(self)) fnarg := gclass.custom_item_activated @@ -34164,8 +34145,15 @@ func (self *AppChooserDialog) SetHeading(heading string) { // AppChooserWidgetOverrides contains methods that are overridable. type AppChooserWidgetOverrides struct { + // ApplicationActivated: signal emitted when an application item is + // activated from the widget’s list. ApplicationActivated func(appInfo gio.AppInfor) - ApplicationSelected func(appInfo gio.AppInfor) + // ApplicationSelected: signal emitted when an application item is selected + // from the widget’s list. + ApplicationSelected func(appInfo gio.AppInfor) + // PopulatePopup: signal emitted when a context menu is about to popup over + // an application item. + // // The function takes the following parameters: // // - menu @@ -34597,6 +34585,8 @@ func (self *AppChooserWidget) SetShowRecommended(setting bool) { runtime.KeepAlive(setting) } +// applicationActivated: signal emitted when an application item is activated +// from the widget’s list. func (self *AppChooserWidget) applicationActivated(appInfo gio.AppInfor) { gclass := (*C.GtkAppChooserWidgetClass)(coreglib.PeekParentClass(self)) fnarg := gclass.application_activated @@ -34612,6 +34602,8 @@ func (self *AppChooserWidget) applicationActivated(appInfo gio.AppInfor) { runtime.KeepAlive(appInfo) } +// applicationSelected: signal emitted when an application item is selected from +// the widget’s list. func (self *AppChooserWidget) applicationSelected(appInfo gio.AppInfor) { gclass := (*C.GtkAppChooserWidgetClass)(coreglib.PeekParentClass(self)) fnarg := gclass.application_selected @@ -34627,6 +34619,9 @@ func (self *AppChooserWidget) applicationSelected(appInfo gio.AppInfor) { runtime.KeepAlive(appInfo) } +// populatePopup: signal emitted when a context menu is about to popup over an +// application item. +// // The function takes the following parameters: // // - menu @@ -34651,7 +34646,12 @@ func (self *AppChooserWidget) populatePopup(menu *Menu, appInfo gio.AppInfor) { // ApplicationOverrides contains methods that are overridable. type ApplicationOverrides struct { - WindowAdded func(window *Window) + // WindowAdded: signal emitted when a Window is added to application through + // gtk_application_add_window(). + WindowAdded func(window *Window) + // WindowRemoved: signal emitted when a Window is removed from application, + // either as a side-effect of being destroyed or explicitly through + // gtk_application_remove_window(). WindowRemoved func(window *Window) } @@ -34718,7 +34718,7 @@ func defaultApplicationOverrides(v *Application) ApplicationOverrides { // # A simple application // // A simple example -// (https://git.gnome.org/browse/gtk+/tree/examples/bp/bloatpad.c) +// (https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/examples/bp/bloatpad.c) // // GtkApplication optionally registers with a session manager of the users // session (if you set the Application:register-session property) and offers @@ -35618,6 +35618,8 @@ func (application *Application) Uninhibit(cookie uint) { runtime.KeepAlive(cookie) } +// windowAdded: signal emitted when a Window 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 @@ -35633,6 +35635,9 @@ func (application *Application) windowAdded(window *Window) { runtime.KeepAlive(window) } +// windowRemoved: signal emitted when a Window 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 @@ -36303,9 +36308,15 @@ func (aspectFrame *AspectFrame) Set(xalign, yalign, ratio float32, obeyChild boo // AssistantOverrides contains methods that are overridable. type AssistantOverrides struct { - Apply func() - Cancel func() - Close func() + // Apply: signal emitted when the apply button is clicked. + Apply func() + // Cancel: signal emitted when the cancel button is clicked. + Cancel func() + // Close: signal emitted either when the close button or last page apply + // button is clicked. + Close func() + // Prepare: signal emitted when a new page is set as the assistant’s current + // page, before making the new page visible. Prepare func(page Widgetter) } @@ -37161,6 +37172,7 @@ func (assistant *Assistant) UpdateButtonsState() { runtime.KeepAlive(assistant) } +// Apply: signal emitted when the apply button is clicked. func (assistant *Assistant) apply() { gclass := (*C.GtkAssistantClass)(coreglib.PeekParentClass(assistant)) fnarg := gclass.apply @@ -37173,6 +37185,7 @@ func (assistant *Assistant) apply() { runtime.KeepAlive(assistant) } +// Cancel: signal emitted when the cancel button is clicked. func (assistant *Assistant) cancel() { gclass := (*C.GtkAssistantClass)(coreglib.PeekParentClass(assistant)) fnarg := gclass.cancel @@ -37185,6 +37198,8 @@ func (assistant *Assistant) cancel() { runtime.KeepAlive(assistant) } +// Close: signal emitted either when the close button or last page apply button +// is clicked. func (assistant *Assistant) close() { gclass := (*C.GtkAssistantClass)(coreglib.PeekParentClass(assistant)) fnarg := gclass.close @@ -37197,6 +37212,8 @@ func (assistant *Assistant) close() { runtime.KeepAlive(assistant) } +// Prepare: signal emitted when a new page is set as the assistant’s current +// page, before making the new page visible. func (assistant *Assistant) prepare(page Widgetter) { gclass := (*C.GtkAssistantClass)(coreglib.PeekParentClass(assistant)) fnarg := gclass.prepare @@ -37994,8 +38011,8 @@ func defaultBuilderOverrides(v *Builder) BuilderOverrides { // object. 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 “.”. The builder will error out if -// the version requirements are not met. +// target version in the form .. The builder will error out if the +// version requirements are not met. // // Typically, the specific kind of object represented by an element // is specified by the “class” attribute. If the type has not been loaded yet, @@ -38248,23 +38265,22 @@ func NewBuilderFromResource(resourcePath string) *Builder { // The function takes the following parameters: // // - str: user interface (XML) description. -// - length of string, or -1. // // The function returns the following values: // // - builder containing the interface described by string. -func NewBuilderFromString(str string, length int) *Builder { - var _arg1 *C.gchar // out - var _arg2 C.gssize // out +func NewBuilderFromString(str string) *Builder { + var _arg1 *C.gchar // out + var _arg2 C.gssize var _cret *C.GtkBuilder // in - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(str))) + _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)) - _arg2 = C.gssize(length) _cret = C.gtk_builder_new_from_string(_arg1, _arg2) runtime.KeepAlive(str) - runtime.KeepAlive(length) var _builder *Builder // out @@ -38377,27 +38393,26 @@ func (builder *Builder) AddFromResource(resourcePath string) (uint, error) { // The function takes the following parameters: // // - buffer: string to parse. -// - length of buffer (may be -1 if buffer is nul-terminated). // // The function returns the following values: // // - guint: positive value on success, 0 if an error occurred. -func (builder *Builder) AddFromString(buffer string, length uint) (uint, error) { +func (builder *Builder) AddFromString(buffer string) (uint, error) { var _arg0 *C.GtkBuilder // out var _arg1 *C.gchar // out - var _arg2 C.gsize // out - var _cret C.guint // in - var _cerr *C.GError // in + var _arg2 C.gsize + var _cret C.guint // in + var _cerr *C.GError // in _arg0 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(buffer))) + _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)) - _arg2 = C.gsize(length) _cret = C.gtk_builder_add_from_string(_arg0, _arg1, _arg2, &_cerr) runtime.KeepAlive(builder) runtime.KeepAlive(buffer) - runtime.KeepAlive(length) var _guint uint // out var _goerr error // out @@ -38542,24 +38557,24 @@ func (builder *Builder) AddObjectsFromResource(resourcePath string, objectIds [] // The function takes the following parameters: // // - buffer: string to parse. -// - length of buffer (may be -1 if buffer is nul-terminated). // - objectIds: nul-terminated array of objects to build. // // The function returns the following values: // // - guint: positive value on success, 0 if an error occurred. -func (builder *Builder) AddObjectsFromString(buffer string, length uint, objectIds []string) (uint, error) { +func (builder *Builder) AddObjectsFromString(buffer string, objectIds []string) (uint, error) { var _arg0 *C.GtkBuilder // out var _arg1 *C.gchar // out - var _arg2 C.gsize // out - var _arg3 **C.gchar // out - var _cret C.guint // in - var _cerr *C.GError // in + var _arg2 C.gsize + var _arg3 **C.gchar // out + var _cret C.guint // in + var _cerr *C.GError // in _arg0 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(buffer))) + _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)) - _arg2 = C.gsize(length) { _arg3 = (**C.gchar)(C.calloc(C.size_t((len(objectIds) + 1)), C.size_t(unsafe.Sizeof(uint(0))))) defer C.free(unsafe.Pointer(_arg3)) @@ -38577,7 +38592,6 @@ func (builder *Builder) AddObjectsFromString(buffer string, length uint, objectI _cret = C.gtk_builder_add_objects_from_string(_arg0, _arg1, _arg2, _arg3, &_cerr) runtime.KeepAlive(builder) runtime.KeepAlive(buffer) - runtime.KeepAlive(length) runtime.KeepAlive(objectIds) var _guint uint // out @@ -38662,33 +38676,32 @@ func (builder *Builder) ExposeObject(name string, object *coreglib.Object) { // - widget that is being extended. // - templateType: type that the template is for. // - buffer: string to parse. -// - length of buffer (may be -1 if buffer is nul-terminated). // // The function returns the following values: // // - guint: positive value on success, 0 if an error occurred. -func (builder *Builder) ExtendWithTemplate(widget Widgetter, templateType coreglib.Type, buffer string, length uint) (uint, error) { +func (builder *Builder) ExtendWithTemplate(widget Widgetter, templateType coreglib.Type, buffer string) (uint, error) { var _arg0 *C.GtkBuilder // out var _arg1 *C.GtkWidget // out var _arg2 C.GType // out var _arg3 *C.gchar // out - var _arg4 C.gsize // out - var _cret C.guint // in - var _cerr *C.GError // in + var _arg4 C.gsize + var _cret C.guint // in + var _cerr *C.GError // in _arg0 = (*C.GtkBuilder)(unsafe.Pointer(coreglib.InternObject(builder).Native())) _arg1 = (*C.GtkWidget)(unsafe.Pointer(coreglib.InternObject(widget).Native())) _arg2 = C.GType(templateType) - _arg3 = (*C.gchar)(unsafe.Pointer(C.CString(buffer))) + _arg4 = (C.gsize)(len(buffer)) + _arg3 = (*C.gchar)(C.calloc(C.size_t((len(buffer) + 1)), C.size_t(C.sizeof_gchar))) + copy(unsafe.Slice((*byte)(unsafe.Pointer(_arg3)), len(buffer)), buffer) defer C.free(unsafe.Pointer(_arg3)) - _arg4 = C.gsize(length) _cret = C.gtk_builder_extend_with_template(_arg0, _arg1, _arg2, _arg3, _arg4, &_cerr) runtime.KeepAlive(builder) runtime.KeepAlive(widget) runtime.KeepAlive(templateType) runtime.KeepAlive(buffer) - runtime.KeepAlive(length) var _guint uint // out var _goerr error // out @@ -38968,6 +38981,9 @@ func (builder *Builder) typeFromName(typeName string) coreglib.Type { // ButtonOverrides contains methods that are overridable. type ButtonOverrides struct { + // Activate: signal that causes the button to animate press then release. + // Applications should never connect to this signal, but use the clicked + // signal. Activate func() // Clicked emits a Button::clicked signal to the given Button. Clicked func() @@ -39831,6 +39847,8 @@ func (button *Button) SetUseUnderline(useUnderline bool) { runtime.KeepAlive(useUnderline) } +// Activate: signal that causes the button to animate press then release. +// Applications should never connect to this signal, but use the clicked signal. func (button *Button) activate() { gclass := (*C.GtkButtonClass)(coreglib.PeekParentClass(button)) fnarg := gclass.activate @@ -44235,8 +44253,12 @@ type CellRendererOverrides struct { // The function returns the following values: // // - ok: TRUE if the event was consumed/handled. - Activate func(event *gdk.Event, widget Widgetter, path string, backgroundArea, cellArea *gdk.Rectangle, flags CellRendererState) bool + Activate func(event *gdk.Event, widget Widgetter, path string, backgroundArea, cellArea *gdk.Rectangle, flags CellRendererState) bool + // EditingCanceled: signal gets emitted when the user cancels the process of + // editing a cell. EditingCanceled func() + // EditingStarted: signal gets emitted when a cell starts to be edited. + // // The function takes the following parameters: // // - editable @@ -45390,6 +45412,8 @@ func (cell *CellRenderer) activate(event *gdk.Event, widget Widgetter, path stri return _ok } +// editingCanceled: signal gets emitted when the user cancels the process of +// editing a cell. func (cell *CellRenderer) editingCanceled() { gclass := (*C.GtkCellRendererClass)(coreglib.PeekParentClass(cell)) fnarg := gclass.editing_canceled @@ -45402,6 +45426,8 @@ func (cell *CellRenderer) editingCanceled() { runtime.KeepAlive(cell) } +// editingStarted: signal gets emitted when a cell starts to be edited. +// // The function takes the following parameters: // // - editable @@ -47420,6 +47446,7 @@ func (checkButton *CheckButton) drawIndicator(cr *cairo.Context) { // CheckMenuItemOverrides contains methods that are overridable. type CheckMenuItemOverrides struct { + // DrawIndicator: called to draw the check indicator. DrawIndicator func(cr *cairo.Context) // Toggled emits the CheckMenuItem::toggled signal. Toggled func() @@ -47752,6 +47779,7 @@ func (checkMenuItem *CheckMenuItem) Toggled() { runtime.KeepAlive(checkMenuItem) } +// drawIndicator: called to draw the check indicator. func (checkMenuItem *CheckMenuItem) drawIndicator(cr *cairo.Context) { gclass := (*C.GtkCheckMenuItemClass)(coreglib.PeekParentClass(checkMenuItem)) fnarg := gclass.draw_indicator @@ -48122,22 +48150,20 @@ func (clipboard *Clipboard) SetImage(pixbuf *gdkpixbuf.Pixbuf) { // The function takes the following parameters: // // - text: UTF-8 string. -// - len: length of text, in bytes, or -1, in which case the length will be -// determined with strlen(). -func (clipboard *Clipboard) SetText(text string, len int) { +func (clipboard *Clipboard) SetText(text string) { var _arg0 *C.GtkClipboard // out var _arg1 *C.gchar // out - var _arg2 C.gint // out + var _arg2 C.gint _arg0 = (*C.GtkClipboard)(unsafe.Pointer(coreglib.InternObject(clipboard).Native())) - _arg1 = (*C.gchar)(unsafe.Pointer(C.CString(text))) + _arg2 = (C.gint)(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)) - _arg2 = C.gint(len) C.gtk_clipboard_set_text(_arg0, _arg1, _arg2) runtime.KeepAlive(clipboard) runtime.KeepAlive(text) - runtime.KeepAlive(len) } // Store stores the current clipboard data somewhere so that it will stay around @@ -49684,7 +49710,10 @@ func (colorsel *ColorSelectionDialog) ColorSelection() Widgetter { // ComboBoxOverrides contains methods that are overridable. type ComboBoxOverrides struct { - Changed func() + // Changed: signal is emitted when the active item is changed. + Changed func() + // FormatEntryText: signal which allows you to change how the text displayed + // in a combo box’s entry is displayed. FormatEntryText func(path string) string } @@ -50790,6 +50819,7 @@ func (comboBox *ComboBox) SetWrapWidth(width int) { runtime.KeepAlive(width) } +// Changed: signal is emitted when the active item is changed. func (comboBox *ComboBox) changed() { gclass := (*C.GtkComboBoxClass)(coreglib.PeekParentClass(comboBox)) fnarg := gclass.changed @@ -50802,6 +50832,8 @@ func (comboBox *ComboBox) changed() { runtime.KeepAlive(comboBox) } +// formatEntryText: signal which allows you to change how the text displayed in +// a combo box’s entry is displayed. func (comboBox *ComboBox) formatEntryText(path string) string { gclass := (*C.GtkComboBoxClass)(coreglib.PeekParentClass(comboBox)) fnarg := gclass.format_entry_text @@ -50926,16 +50958,6 @@ func defaultComboBoxTextOverrides(v *ComboBoxText) ComboBoxTextOverrides { // // Here is a UI definition fragment specifying GtkComboBoxText items: // -// -// -// Factory -// Home -// Subway -// -// -// -// CSS nodes -// // combobox // ╰── box.linked // ├── entry.combo @@ -51280,7 +51302,8 @@ type ContainerOverrides struct { // The function takes the following parameters: // // - widget to be placed inside container. - Add func(widget Widgetter) + Add func(widget Widgetter) + // CheckResize: signal emitted when a size recalculation is needed. CheckResize func() // ChildType returns the type of the children supported by the container. // @@ -51290,7 +51313,8 @@ type ContainerOverrides struct { // The function returns the following values: // // - gType: #GType. - ChildType func() coreglib.Type + ChildType func() coreglib.Type + // CompositeName gets a widget’s composite name. Deprecated: 3.10. CompositeName func(child Widgetter) string // PathForChild returns a newly created widget path representing all the // widget hierarchy from the toplevel down to and including child. @@ -51408,98 +51432,6 @@ func defaultContainerOverrides(v *Container) ContainerOverrides { // This is easily achieved by simply calling the reverse apis implemented for // itself as follows: // -// static void -// foo_container_get_preferred_width_for_height (GtkWidget *widget, -// gint for_height, -// gint *min_width, -// gint *nat_width) -// { -// if (i_am_in_height_for_width_mode) -// { -// GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget, -// min_width, -// nat_width); -// } -// else -// { -// ... execute the real width-for-height request here based on -// the required width of the children collectively if the -// container were to be allocated the said height ... -// } -// } -// -// Height for width requests are generally implemented in terms of a -// virtual allocation of widgets in the input orientation. Assuming -// an height-for-width request mode, a container would implement the -// get_preferred_height_for_width() virtual function by first calling -// gtk_widget_get_preferred_width() for each of its children. -// -// For each potential group of children that are lined up horizontally, the -// values returned by gtk_widget_get_preferred_width() should be collected in an -// array of RequestedSize structures. Any child spacing should be removed from -// the input for_width and then the collective size should be allocated using -// the gtk_distribute_natural_allocation() convenience function. -// -// The container will then move on to request the preferred height for each -// child by using gtk_widget_get_preferred_height_for_width() and using the -// sizes stored in the RequestedSize array. -// -// To allocate a height-for-width container, it’s again important to -// consider that a container must prioritize one dimension over the other. -// So if a container is a height-for-width container it must first -// allocate all widgets horizontally using a RequestedSize array and -// gtk_distribute_natural_allocation() and then add any extra space (if and -// where appropriate) for the widget to expand. -// -// After adding all the expand space, the container assumes it was -// allocated sufficient height to fit all of its content. At this time, -// the container must use the total horizontal sizes of each widget to request -// the height-for-width of each of its children and store the requests in a -// RequestedSize array for any widgets that stack vertically (for tabular -// containers this can be generalized into the heights and widths of rows -// and columns). The vertical space must then again be distributed using -// gtk_distribute_natural_allocation() while this time considering the allocated -// height of the widget minus any vertical spacing that the container adds. -// Then vertical expand space should be added where appropriate and available -// and the container should go on to actually allocating the child widgets. -// -// See [GtkWidget’s geometry management section][geometry-management] to learn -// more about implementing height-for-width geometry management for widgets. -// -// # Child properties -// -// GtkContainer introduces child properties. These are object properties that -// are not specific to either the container or the contained widget, but rather -// to their relation. Typical examples of child properties are the position or -// pack-type of a widget which is contained in a Box. -// -// Use gtk_container_class_install_child_property() to install child properties -// for a container class and gtk_container_class_find_child_property() or -// gtk_container_class_list_child_properties() to get information about existing -// child properties. -// -// To set the value of a child property, use gtk_container_child_set_property(), -// gtk_container_child_set() or gtk_container_child_set_valist(). To obtain -// the value of a child property, use gtk_container_child_get_property(), -// gtk_container_child_get() or gtk_container_child_get_valist(). To emit -// notification about child property changes, use gtk_widget_child_notify(). -// -// # GtkContainer as GtkBuildable -// -// The GtkContainer implementation of the GtkBuildable interface supports -// a element for children, which can contain multiple -// elements that specify child properties for the child. -// -// Since 2.16, child properties can also be marked as translatable using the -// same “translatable”, “comments” and “context” attributes that are used for -// regular properties. -// -// Since 3.16, containers can have a element containing multiple -// elements, one for each child that should be added to the focus -// chain. The ”name” attribute gives the id of the widget. -// -// An example of these properties in UI definitions: -// // // // @@ -52394,6 +52326,7 @@ func (container *Container) add(widget Widgetter) { runtime.KeepAlive(widget) } +// checkResize: signal emitted when a size recalculation is needed. func (container *Container) checkResize() { gclass := (*C.GtkContainerClass)(coreglib.PeekParentClass(container)) fnarg := gclass.check_resize @@ -52433,6 +52366,7 @@ func (container *Container) childType() coreglib.Type { return _gType } +// compositeName gets a widget’s composite name. Deprecated: 3.10. func (container *Container) compositeName(child Widgetter) string { gclass := (*C.GtkContainerClass)(coreglib.PeekParentClass(container)) fnarg := gclass.composite_name @@ -53092,6 +53026,8 @@ func CSSProviderGetNamed(name, variant string) *CSSProvider { // DialogOverrides contains methods that are overridable. type DialogOverrides struct { + // Close: signal emitted when the user uses a keybinding to close the + // dialog. Close func() // Response emits the Dialog::response signal with the given response ID. // Used to indicate that the user has responded to the dialog in some way; @@ -53157,56 +53093,6 @@ func defaultDialogOverrides(v *Dialog) DialogOverrides { // // An example for simple GtkDialog usage: // -// // Function to open a dialog box with a message -// void -// quick_message (GtkWindow *parent, gchar *message) -// { -// GtkWidget *dialog, *label, *content_area; -// GtkDialogFlags flags; -// -// // Create the widgets -// flags = GTK_DIALOG_DESTROY_WITH_PARENT; -// dialog = gtk_dialog_new_with_buttons ("Message", -// parent, -// flags, -// _("_OK"), -// GTK_RESPONSE_NONE, -// NULL); -// content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); -// label = gtk_label_new (message); -// -// // Ensure that the dialog box is destroyed when the user responds -// -// g_signal_connect_swapped (dialog, -// "response", -// G_CALLBACK (gtk_widget_destroy), -// dialog); -// -// // Add the label, and show everything we’ve added -// -// gtk_container_add (GTK_CONTAINER (content_area), label); -// gtk_widget_show_all (dialog); -// } -// -// # GtkDialog as GtkBuildable -// -// The GtkDialog implementation of the Buildable interface exposes the vbox and -// action_area as internal children with the names “vbox” and “action_area”. -// -// GtkDialog supports a custom element, which can contain -// multiple elements. The “response” attribute specifies a -// numeric response, and the content of the element is the id of widget (which -// should be a child of the dialogs action_area). To mark a response as default, -// set the “default“ attribute of the element to true. -// -// GtkDialog supports adding action widgets by specifying “action“ as the “type“ -// attribute of a element. The widget will be added either to the action -// area or the headerbar of the dialog, depending on the “use-header-bar“ -// property. The response id has to be associated with the action widget using -// the element. -// -// An example of a Dialog UI definition fragment: -// // // // @@ -53699,6 +53585,7 @@ func (dialog *Dialog) SetResponseSensitive(responseId int, setting bool) { runtime.KeepAlive(setting) } +// Close: signal emitted when the user uses a keybinding to close the dialog. func (dialog *Dialog) close() { gclass := (*C.GtkDialogClass)(coreglib.PeekParentClass(dialog)) fnarg := gclass.close @@ -53883,15 +53770,33 @@ func NewDrawingArea() *DrawingArea { // EntryOverrides contains methods that are overridable. type EntryOverrides struct { - Activate func() - Backspace func() + // Activate class handler for the Entry::activate signal. The default + // implementation calls gtk_window_activate_default() on the entry’s + // top-level window. + Activate func() + // Backspace class handler for the Entry::backspace signal. The default + // implementation deletes the selection or a single character or word. + Backspace func() + // CopyClipboard class handler for the Entry::copy-clipboard signal. + // The default implementation copies the selection, if one exists. CopyClipboard func() - CutClipboard func() + // CutClipboard class handler for the Entry::cut-clipboard signal. + // The default implementation cuts the selection, if one exists. + CutClipboard func() + // DeleteFromCursor class handler for the Entry::delete-from-cursor signal. + // The default implementation deletes the selection or the specified number + // of characters or words. + // // The function takes the following parameters: // // - typ // - count DeleteFromCursor func(typ DeleteType, count int) + // FrameSize: calculate the size of the text area frame, which is its + // allocated width and requested height, minus space for margins and + // borders, and taking baseline and text height into account. This virtual + // function must be non-NULL. + // // The function takes the following parameters: // // - x @@ -53899,23 +53804,40 @@ type EntryOverrides struct { // - width // - height FrameSize func(x, y, width, height *int) + // TextAreaSize: calculate the size of the text area, which is its allocated + // width and requested height, minus space for margins and borders. This + // virtual function must be non-NULL. + // // The function takes the following parameters: // // - x // - y // - width // - height - TextAreaSize func(x, y, width, height *int) + TextAreaSize func(x, y, width, height *int) + // InsertAtCursor class handler for the Entry::insert-at-cursor signal. + // The default implementation inserts text at the cursor. InsertAtCursor func(str string) InsertEmoji func() + // MoveCursor class handler for the Entry::move-cursor signal. The default + // implementation specifies the standard Entry cursor movement behavior. + // // The function takes the following parameters: // // - step // - count // - extendSelection - MoveCursor func(step MovementStep, count int, extendSelection bool) - PasteClipboard func() - PopulatePopup func(popup Widgetter) + MoveCursor func(step MovementStep, count int, extendSelection bool) + // PasteClipboard class handler for the Entry::paste-clipboard signal. + // The default implementation pastes at the current cursor position or over + // the current selection if one exists. + PasteClipboard func() + // PopulatePopup class handler for the Entry::populate-popup signal. + // If non-NULL, this will be called to add additional entries to the context + // menu when it is displayed. + PopulatePopup func(popup Widgetter) + // ToggleOverwrite class handler for the Entry::toggle-overwrite signal. + // The default implementation toggles overwrite mode and blinks the cursor. ToggleOverwrite func() } @@ -56177,6 +56099,9 @@ func (entry *Entry) UnsetInvisibleChar() { runtime.KeepAlive(entry) } +// Activate class handler for the Entry::activate signal. The default +// implementation calls gtk_window_activate_default() on the entry’s top-level +// window. func (entry *Entry) activate() { gclass := (*C.GtkEntryClass)(coreglib.PeekParentClass(entry)) fnarg := gclass.activate @@ -56189,6 +56114,8 @@ func (entry *Entry) activate() { runtime.KeepAlive(entry) } +// Backspace class handler for the Entry::backspace signal. The default +// implementation deletes the selection or a single character or word. func (entry *Entry) backspace() { gclass := (*C.GtkEntryClass)(coreglib.PeekParentClass(entry)) fnarg := gclass.backspace @@ -56201,6 +56128,8 @@ func (entry *Entry) backspace() { runtime.KeepAlive(entry) } +// copyClipboard class handler for the Entry::copy-clipboard signal. The default +// implementation copies the selection, if one exists. func (entry *Entry) copyClipboard() { gclass := (*C.GtkEntryClass)(coreglib.PeekParentClass(entry)) fnarg := gclass.copy_clipboard @@ -56213,6 +56142,8 @@ func (entry *Entry) copyClipboard() { runtime.KeepAlive(entry) } +// cutClipboard class handler for the Entry::cut-clipboard signal. The default +// implementation cuts the selection, if one exists. func (entry *Entry) cutClipboard() { gclass := (*C.GtkEntryClass)(coreglib.PeekParentClass(entry)) fnarg := gclass.cut_clipboard @@ -56225,6 +56156,10 @@ func (entry *Entry) cutClipboard() { runtime.KeepAlive(entry) } +// deleteFromCursor class handler for the Entry::delete-from-cursor signal. +// The default implementation deletes the selection or the specified number of +// characters or words. +// // The function takes the following parameters: // // - typ @@ -56247,6 +56182,11 @@ func (entry *Entry) deleteFromCursor(typ DeleteType, count int) { runtime.KeepAlive(count) } +// frameSize: calculate the size of the text area frame, which is its +// allocated width and requested height, minus space for margins and borders, +// and taking baseline and text height into account. This virtual function must +// be non-NULL. +// // The function takes the following parameters: // // - x @@ -56277,6 +56217,10 @@ func (entry *Entry) frameSize(x, y, width, height *int) { runtime.KeepAlive(height) } +// textAreaSize: calculate the size of the text area, which is its allocated +// width and requested height, minus space for margins and borders. This virtual +// function must be non-NULL. +// // The function takes the following parameters: // // - x @@ -56307,6 +56251,8 @@ func (entry *Entry) textAreaSize(x, y, width, height *int) { runtime.KeepAlive(height) } +// insertAtCursor class handler for the Entry::insert-at-cursor signal. +// The default implementation inserts text at the cursor. func (entry *Entry) insertAtCursor(str string) { gclass := (*C.GtkEntryClass)(coreglib.PeekParentClass(entry)) fnarg := gclass.insert_at_cursor @@ -56335,6 +56281,9 @@ func (entry *Entry) insertEmoji() { runtime.KeepAlive(entry) } +// moveCursor class handler for the Entry::move-cursor signal. The default +// implementation specifies the standard Entry cursor movement behavior. +// // The function takes the following parameters: // // - step @@ -56363,6 +56312,9 @@ func (entry *Entry) moveCursor(step MovementStep, count int, extendSelection boo runtime.KeepAlive(extendSelection) } +// pasteClipboard class handler for the Entry::paste-clipboard signal. +// The default implementation pastes at the current cursor position or over the +// current selection if one exists. func (entry *Entry) pasteClipboard() { gclass := (*C.GtkEntryClass)(coreglib.PeekParentClass(entry)) fnarg := gclass.paste_clipboard @@ -56375,6 +56327,9 @@ func (entry *Entry) pasteClipboard() { runtime.KeepAlive(entry) } +// populatePopup class handler for the Entry::populate-popup signal. If +// non-NULL, this will be called to add additional entries to the context menu +// when it is displayed. func (entry *Entry) populatePopup(popup Widgetter) { gclass := (*C.GtkEntryClass)(coreglib.PeekParentClass(entry)) fnarg := gclass.populate_popup @@ -56390,6 +56345,8 @@ func (entry *Entry) populatePopup(popup Widgetter) { runtime.KeepAlive(popup) } +// toggleOverwrite class handler for the Entry::toggle-overwrite signal. +// The default implementation toggles overwrite mode and blinks the cursor. func (entry *Entry) toggleOverwrite() { gclass := (*C.GtkEntryClass)(coreglib.PeekParentClass(entry)) fnarg := gclass.toggle_overwrite @@ -58680,26 +58637,26 @@ func marshalEventControllerScroll(p uintptr) (interface{}, error) { // K_EVENT_CONTROLLER_SCROLL_KINETIC flag is set. vel_x and vel_y express the // initial velocity that was imprinted by the scroll events. vel_x and vel_y are // expressed in pixels/ms. -func (controller *EventControllerScroll) ConnectDecelerate(f func(velX, velY float64)) coreglib.SignalHandle { - return coreglib.ConnectGeneratedClosure(controller, "decelerate", false, unsafe.Pointer(C._gotk4_gtk3_EventControllerScroll_ConnectDecelerate), f) +func (scroll *EventControllerScroll) ConnectDecelerate(f func(velX, velY float64)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(scroll, "decelerate", false, unsafe.Pointer(C._gotk4_gtk3_EventControllerScroll_ConnectDecelerate), f) } // ConnectScroll signals that the widget should scroll by the amount specified // by dx and dy. -func (controller *EventControllerScroll) ConnectScroll(f func(dx, dy float64)) coreglib.SignalHandle { - return coreglib.ConnectGeneratedClosure(controller, "scroll", false, unsafe.Pointer(C._gotk4_gtk3_EventControllerScroll_ConnectScroll), f) +func (scroll *EventControllerScroll) ConnectScroll(f func(dx, dy float64)) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(scroll, "scroll", false, unsafe.Pointer(C._gotk4_gtk3_EventControllerScroll_ConnectScroll), f) } // ConnectScrollBegin signals that a new scrolling operation has begun. It will // only be emitted on devices capable of it. -func (controller *EventControllerScroll) ConnectScrollBegin(f func()) coreglib.SignalHandle { - return coreglib.ConnectGeneratedClosure(controller, "scroll-begin", false, unsafe.Pointer(C._gotk4_gtk3_EventControllerScroll_ConnectScrollBegin), f) +func (scroll *EventControllerScroll) ConnectScrollBegin(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(scroll, "scroll-begin", false, unsafe.Pointer(C._gotk4_gtk3_EventControllerScroll_ConnectScrollBegin), f) } // ConnectScrollEnd signals that a new scrolling operation has finished. It will // only be emitted on devices capable of it. -func (controller *EventControllerScroll) ConnectScrollEnd(f func()) coreglib.SignalHandle { - return coreglib.ConnectGeneratedClosure(controller, "scroll-end", false, unsafe.Pointer(C._gotk4_gtk3_EventControllerScroll_ConnectScrollEnd), f) +func (scroll *EventControllerScroll) ConnectScrollEnd(f func()) coreglib.SignalHandle { + return coreglib.ConnectGeneratedClosure(scroll, "scroll-end", false, unsafe.Pointer(C._gotk4_gtk3_EventControllerScroll_ConnectScrollEnd), f) } // NewEventControllerScroll creates a new event controller that will handle @@ -58737,14 +58694,14 @@ func NewEventControllerScroll(widget Widgetter, flags EventControllerScrollFlags // The function returns the following values: // // - eventControllerScrollFlags: controller flags. -func (controller *EventControllerScroll) Flags() EventControllerScrollFlags { +func (scroll *EventControllerScroll) Flags() EventControllerScrollFlags { var _arg0 *C.GtkEventControllerScroll // out var _cret C.GtkEventControllerScrollFlags // in - _arg0 = (*C.GtkEventControllerScroll)(unsafe.Pointer(coreglib.InternObject(controller).Native())) + _arg0 = (*C.GtkEventControllerScroll)(unsafe.Pointer(coreglib.InternObject(scroll).Native())) _cret = C.gtk_event_controller_scroll_get_flags(_arg0) - runtime.KeepAlive(controller) + runtime.KeepAlive(scroll) var _eventControllerScrollFlags EventControllerScrollFlags // out @@ -58758,20 +58715,21 @@ func (controller *EventControllerScroll) Flags() EventControllerScrollFlags { // The function takes the following parameters: // // - flags: behavior flags. -func (controller *EventControllerScroll) SetFlags(flags EventControllerScrollFlags) { +func (scroll *EventControllerScroll) SetFlags(flags EventControllerScrollFlags) { var _arg0 *C.GtkEventControllerScroll // out var _arg1 C.GtkEventControllerScrollFlags // out - _arg0 = (*C.GtkEventControllerScroll)(unsafe.Pointer(coreglib.InternObject(controller).Native())) + _arg0 = (*C.GtkEventControllerScroll)(unsafe.Pointer(coreglib.InternObject(scroll).Native())) _arg1 = C.GtkEventControllerScrollFlags(flags) C.gtk_event_controller_scroll_set_flags(_arg0, _arg1) - runtime.KeepAlive(controller) + runtime.KeepAlive(scroll) runtime.KeepAlive(flags) } // ExpanderOverrides contains methods that are overridable. type ExpanderOverrides struct { + // Activate: keybinding signal is emitted when the user hits the Enter key. Activate func() } @@ -59312,6 +59270,7 @@ func (expander *Expander) SetUseUnderline(useUnderline bool) { runtime.KeepAlive(useUnderline) } +// Activate: keybinding signal is emitted when the user hits the Enter key. func (expander *Expander) activate() { gclass := (*C.GtkExpanderClass)(coreglib.PeekParentClass(expander)) fnarg := gclass.activate @@ -59385,6 +59344,7 @@ func marshalExpanderAccessible(p uintptr) (interface{}, error) { // FileChooserButtonOverrides contains methods that are overridable. type FileChooserButtonOverrides struct { + // FileSet: signal emitted when the user selects a file. FileSet func() } @@ -59692,6 +59652,7 @@ func (button *FileChooserButton) SetWidthChars(nChars int) { runtime.KeepAlive(nChars) } +// fileSet: signal emitted when the user selects a file. func (fc *FileChooserButton) fileSet() { gclass := (*C.GtkFileChooserButtonClass)(coreglib.PeekParentClass(fc)) fnarg := gclass.file_set @@ -60521,6 +60482,37 @@ func NewFileChooserWidget(action FileChooserAction) *FileChooserWidget { return _fileChooserWidget } +type FileChooserWidgetAccessible struct { + _ [0]func() // equal guard + ContainerAccessible + + atk.Action +} + +var ( + _ coreglib.Objector = (*FileChooserWidgetAccessible)(nil) +) + +func wrapFileChooserWidgetAccessible(obj *coreglib.Object) *FileChooserWidgetAccessible { + return &FileChooserWidgetAccessible{ + ContainerAccessible: ContainerAccessible{ + WidgetAccessible: WidgetAccessible{ + Accessible: Accessible{ + AtkObject: atk.AtkObject{ + Object: obj, + }, + }, + Component: atk.Component{ + Object: obj, + }, + }, + }, + Action: atk.Action{ + Object: obj, + }, + } +} + // FileFilter can be used to restrict the files being shown in a // FileChooser. Files can be filtered based on their name (with // gtk_file_filter_add_pattern()), on their mime type (with @@ -63802,24 +63794,13 @@ func defaultFrameOverrides(v *Frame) FrameOverrides { // // # GtkFrame as GtkBuildable // -// The GtkFrame implementation of the GtkBuildable interface supports placing a +// The GtkFrame implementation of the Buildable interface supports placing a // child in the label position by specifying “label” as the “type” attribute of // a element. A normal content child can be specified without specifying // a type attribute. // // An example of a UI definition fragment with GtkFrame: // -// -// -// -// -// -// -// -// -// -// CSS nodes -// // frame // ├── border[.flat] // ├──